0x00 C00PacketKeepAlive
Response to S00PacketKeepAlive. The client echoes back the server's keep-alive ID.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| key | int | The keep-alive ID received from the server |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Keep Alive ID | int | Echoed from S00PacketKeepAlive |
MCP References
NetHandlerPlayServer.processKeepAlive()Handler Interface
INetHandlerPlayServerNotes
Vanilla Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
Deobfuscated MCP 1.8.9 source of C00PacketKeepAlive, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/client/C00PacketKeepAlive.java) at build time and verified present.
Deep Dive
Role in the protocol
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.
Vanilla handling
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.
Why clients touch it
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).
Exploit surface
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).
Server-Side 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 Analysis
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.
Anti-Cheat 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.
implementation Implementation Cases
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.
Inflate the player's measured ping by delaying keepalive (and transaction) echoes.
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).
// ===== FILE: Rise 5.99, dev/rise/module/impl/other/PingSpoof.java =====
package dev.rise.module.impl.other;
import dev.rise.event.impl.motion.PreMotionEvent;
import dev.rise.event.impl.other.WorldChangedEvent;
import dev.rise.event.impl.packet.PacketReceiveEvent;
import dev.rise.event.impl.packet.PacketSendEvent;
import dev.rise.module.Module;
import dev.rise.module.api.ModuleInfo;
import dev.rise.module.enums.Category;
import dev.rise.setting.impl.NumberSetting;
import dev.rise.util.math.TimeUtil;
import dev.rise.util.player.PacketUtil;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C00PacketKeepAlive;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ModuleInfo(name = "PingSpoof", description = "Makes your ping higher for the server", category = Category.OTHER)
public final class PingSpoof extends Module {
private final NumberSetting delay = new NumberSetting("Delay", this, 1000, 10, 30000, 1);
private final ConcurrentHashMap<Packet<?>, Long> packets = new ConcurrentHashMap<>();
private final TimeUtil timer = new TimeUtil();
@Override
protected void onDisable() {
packets.clear();
}
@Override
public void onWorldChanged(final WorldChangedEvent event) {
if (mc.isSingleplayer()) return;
packets.clear();
}
@Override
public void onPreMotion(final PreMotionEvent event) {
if (mc.isSingleplayer())
return;
for (final Iterator<Map.Entry<Packet<?>, Long>> iterator = packets.entrySet().iterator(); iterator.hasNext(); ) {
final Map.Entry<Packet<?>, Long> entry = iterator.next();
if (entry.getValue() < System.currentTimeMillis()) {
PacketUtil.sendPacket(entry.getKey());
iterator.remove();
}
}
}
@Override
public void onPacketReceive(final PacketReceiveEvent event) {
if (mc.isSingleplayer())
return;
if (event.getPacket() instanceof S08PacketPlayerPosLook) {
timer.reset();
}
}
@Override
public void onPacketSend(final PacketSendEvent event) {
if (mc.isSingleplayer())
return;
final Packet<?> p = event.getPacket();
if (p instanceof C0FPacketConfirmTransaction || p instanceof C00PacketKeepAlive) {
packets.put(p, (long) (System.currentTimeMillis() + delay.getValue()));
event.setCancelled(true);
}
}
}
// NOTE (AI): The entire PingSpoof module: buffers C0F and C00 in a ConcurrentHashMap
// keyed by release time, cancels them on PacketSendEvent, and flushes via
// PacketUtil.sendPacket (event-bus bypass) on each PreMotion tick.Break anti-cheat timing heuristics that use keepalive as a latency reference.
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.
// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/exploit/Disabler.java =====
package me.memewaredevs.client.module.exploit;
import me.hippo.api.lwjeb.annotation.Handler;
import me.memewaredevs.client.event.events.PacketInEvent;
import me.memewaredevs.client.event.events.PacketOutEvent;
import me.memewaredevs.client.event.events.UpdateEvent;
import me.memewaredevs.client.module.Module;
import me.memewaredevs.client.util.ChatUtil;
import me.memewaredevs.client.util.misc.Timer;
import me.memewaredevs.client.util.packet.PacketUtil;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import net.minecraft.network.play.server.S2APacketParticles;
import org.apache.commons.lang3.RandomUtils;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.function.Consumer;
public class Disabler extends Module {
private static final int VERUS_DISABLE_AUTOBAN_CHANNEL = 65536;
private static final short VERUS_DISABLE_AUTOBAN_UID = 32767;
private final Queue<Packet> packetQueue = new ConcurrentLinkedQueue();
private final Timer timer = new Timer();
private final Timer timer1 = new Timer();
public Disabler(final String name, final int key, final Module.Category category) {
super(name, key, category);
this.addModes("Mineplex Combat", "Transaction", "Latest Verus", "PvPTemple", "OmegaCraft", "Timer", "AACv1.9.10", "Sloth", "Ghostly", "Watchdog", "Faithful Movement");
}
@Override
public void onDisable() {
packetQueue.clear();
}
@Override
public void onEnable() {
timer.reset();
}
@Handler
public Consumer<PacketInEvent> packetInEventConsumer = (event) -> {
if (isMode("Sloth")) {
if (event.getPacket() instanceof S08PacketPlayerPosLook) {
S08PacketPlayerPosLook playerPosLook = (S08PacketPlayerPosLook) event.getPacket();
/**
* Works alongside with the spigot exploit.
* Exploit PlayerData bug (Player data gets set to null if the previous event is cancelled, and y difference <= 1.0E-4)
*/
playerPosLook.y += 1.0E-4;
}
}
};
@Handler
public Consumer<UpdateEvent> eventConsumer = (event) -> {
if (isMode("Latest Verus")) {
if (timer.delay(490L)) {
if (!packetQueue.isEmpty()) {
PacketUtil.sendPacketSilent(packetQueue.poll());
}
timer.reset();
}
}
if (isMode("OmegaCraft")) {
PacketUtil.sendPacketSilent(new C0FPacketConfirmTransaction(VERUS_DISABLE_AUTOBAN_CHANNEL, VERUS_DISABLE_AUTOBAN_UID, true));
}
if (isMode("PvPTemple")) { // Added by Auth
event.setGround(false);
event.setY(event.getY() + 0.42);
event.setYaw(0);
event.setPitch(0);
}
if (isMode("Watchdog")) {
if (timer.delay(15000L)) {
if (!packetQueue.isEmpty()) {
PacketUtil.sendPacketSilent(packetQueue.poll());
}
timer.reset();
}
}
};
@Handler
public Consumer<PacketInEvent> eventConsumer0 = (event) -> {
if (event.getPacket() instanceof S2APacketParticles) {
event.cancel();
}
};
@Handler
public Consumer<PacketOutEvent> eventConsumer1 = (event) -> {
if (isMode("Mineplex Combat"))
if (event.getPacket() instanceof C00PacketKeepAlive) {
C00PacketKeepAlive packetKeepAlive = (C00PacketKeepAlive) event.getPacket();
packetKeepAlive.key -= RandomUtils.nextInt(3, 128);
}
if (isMode("OmegaCraft"))
if (event.getPacket() instanceof C0FPacketConfirmTransaction)
event.cancel();
if (isMode("Latest Verus")) {
if (event.getPacket() instanceof C0FPacketConfirmTransaction) {
C0FPacketConfirmTransaction c0fPacketConfirmTransaction = (C0FPacketConfirmTransaction) event.getPacket();
packetQueue.add(c0fPacketConfirmTransaction);
event.cancel();
}
if (event.getPacket() instanceof C03PacketPlayer) {
C03PacketPlayer c03 = (C03PacketPlayer) event.getPacket();
if (mc.thePlayer.ticksExisted % 33 == 0) {
c03.y = -0.911;
c03.onGround = false;
c03.field_149480_h = false;
}
}
if (mc.thePlayer != null && mc.thePlayer.ticksExisted <= 7) {
timer.reset();
packetQueue.clear();
}
}
if (isMode("Timer") && event.getPacket() instanceof C03PacketPlayer) {
if (mc.thePlayer.ticksExisted % 3 != 0) {
event.cancel();
}
}
if (isMode("AACv1.9.10")) {
if (event.getPacket() instanceof C03PacketPlayer) {
PacketUtil.sendPacketSilent(new C0CPacketInput());
C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();
/**
* Resets all checks VL due to a bug in critical hit check
*/
packetPlayer.y += 7.0E-9D;
}
}
if (isMode("Sloth")) {
if (event.getPacket() instanceof C03PacketPlayer) {
C03PacketPlayer packetPlayer = (C03PacketPlayer) event.getPacket();
if (!timer.delay(1000L)) {
for (int i = 0; i < 10; ++i) {
double y = i > 2 && i < 8 ? 11 : 120;
PacketUtil.sendPacketSilent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - y, mc.thePlayer.posZ, true));
}
} else {
//set to default jump value so viper can stop fucking value patching it
packetPlayer.y += 0.42F;
}
}
}
if (isMode("Faithful Movement")) {
if (mc.thePlayer != null && event.getPacket() instanceof C00PacketKeepAlive) {
C00PacketKeepAlive packetKeepAlive = (C00PacketKeepAlive) event.getPacket();
packetKeepAlive.key -= 31;
}
}
if (isMode("Ghostly")) { // Ghostly Disabler added by Auth
if (event.getPacket() instanceof C03PacketPlayer)
PacketUtil.sendPacketSilent(new C0CPacketInput());
if (event.getPacket() instanceof C0FPacketConfirmTransaction)
event.cancel();
}
if (isMode("Watchdog")) {
// PacketUtil.sendPacketSilent(new C0EPacketClickWindow());
if (mc.getCurrentServerData().serverIP.contains("hypixel.net")) {
if (mc.thePlayer.ticksExisted % 30 == 0) {
PlayerCapabilities pc = new PlayerCapabilities();
pc.isFlying = true;
pc.setFlySpeed(Float.NaN);
PacketUtil.sendPacketSilent(new C13PacketPlayerAbilities(pc));
}
System.out.println(event.getPacket());
if (event.getPacket() instanceof C0FPacketConfirmTransaction) {
event.setPacket(new C0FPacketConfirmTransaction(Integer.MIN_VALUE, Short.MAX_VALUE, true));
}
} else {
ChatUtil.printChat("You must be on Hypixel to use Watchdog Disabler!");
this.toggle();
}
}
};
}
// NOTE (AI): Keepalive handling is in eventConsumer1, Mineplex Combat mode: the key is
// mutated by a random 3..127 offset so NetHandlerPlayServer's key comparison
// fails and the ping EMA is never updated. The Watchdog mode instead queues
// packets and flushes them every 15s to look like a laggy connection.Cancel keepalive as collateral when a movement exploit needs to stop all stateful serverbound traffic.
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.
// ===== FILE: Nekoware v1 private, me/nekoWare/client/module/movement/Fly.java =====
package me.nekoWare.client.module.movement;
import me.hippo.api.lwjeb.annotation.Handler;
import me.nekoWare.client.event.events.EventCollide;
import me.nekoWare.client.event.events.MovementEvent;
import me.nekoWare.client.event.events.PacketOutEvent;
import me.nekoWare.client.event.events.UpdateEvent;
import me.nekoWare.client.module.Module;
import me.nekoWare.client.util.blocks.misc.BlockUtil;
import me.nekoWare.client.util.misc.Timer;
import me.nekoWare.client.util.movement.MovementUtils;
import me.nekoWare.client.util.packet.PacketUtil;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.C00PacketKeepAlive;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.network.play.client.C0CPacketInput;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import net.minecraft.network.play.client.C18PacketSpectate;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MovementInput;
import org.apache.commons.lang3.RandomUtils;
import java.util.function.Consumer;
public class Fly extends Module {
private Timer timer = new Timer();
private double y;
public Fly() {
super("Fly", 34, Module.Category.MOVEMENT);
this.addDouble("Speed", 2.5, 0.1, 5.0);
this.addModes("Vanilla", "Damage", "Verus");
this.addBoolean("Anti-Kick", false);
}
@Handler
public Consumer<MovementEvent> eventConsumer0 = event -> {
};
@Handler
public Consumer<UpdateEvent> eventConsumer1 = (event) -> {
if (isMode("Vanilla")) {
mc.timer.timerSpeed = 1f;
if (event.isPre()) {
float speed = getDouble("Speed").floatValue();
MovementInput movementInput = mc.thePlayer.movementInput;
mc.thePlayer.motionY = movementInput.isJumping() ? speed * 0.5F
: movementInput.isSneaking() ? -speed * 0.5F
: 0.0F;
MovementUtils.setMoveSpeed(speed);
if (getBool("Anti-Kick") && timer.delay(700.0f)) {
MovementUtils.fallPacket();
MovementUtils.ascendPacket();
timer.reset();
}
}
}
if (isMode("Damage")) {
mc.timer.timerSpeed = 1f;
if (event.isPre()) {
mc.thePlayer.sendQueue.addToSendQueue(new C0CPacketInput());
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(true));
mc.thePlayer.onGround = false;
float speed = getDouble("Speed").floatValue();
MovementInput movementInput = mc.thePlayer.movementInput;
mc.thePlayer.motionY = movementInput.isJumping() ? speed * 0.5F
: movementInput.isSneaking() ? -speed * 0.5F : 0.0F;
MovementUtils.setMoveSpeed(speed);
}
}
if (isMode("Verus")) {
mc.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));
MovementUtils.setMoveSpeed(0.36);
mc.timer.timerSpeed = 1f;
if (y >= 11) {
y = 0;
}
y++;
mc.thePlayer.motionY = 0f;
}
};
@Handler
public Consumer<PacketOutEvent> eventConsumer11 = (event) -> {
if (event.getPacket() instanceof C0FPacketConfirmTransaction) {
event.cancel();
timer.reset();
}
if (event.getPacket() instanceof C00PacketKeepAlive) {
event.cancel();
timer.reset();
}
};
@Override
public void onEnable() {
if(this.isMode("Damage")) {
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,
mc.thePlayer.posY + 3.05, mc.thePlayer.posZ, false));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,
mc.thePlayer.posY, mc.thePlayer.posZ, false));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX,
mc.thePlayer.posY + 0.41999998688697815, mc.thePlayer.posZ, true));
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.5, mc.thePlayer.posZ);
}
}
@Override
public void onDisable() {
MovementUtils.setMoveSpeed(0);
}
}
// NOTE (AI): eventConsumer11 cancels C0F and C00 together and resets the module timer.
// This is a movement-exploit pattern: keepalive is collateral damage, not the
// target; the server-side player view stays frozen while position packets
// are replayed for the damage/fly trick.Buffer-and-release: keepalive is one of the packet types held while the client 'blinks' (stays frozen server-side).
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.
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.
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.
// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/movement/Fly.java =====
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.module.modules.movement;
import net.ccbluex.liquidbounce.event.*;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.utils.ClientUtils;
import net.ccbluex.liquidbounce.utils.MovementUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.ccbluex.liquidbounce.utils.timer.TickTimer;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.FloatValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.block.BlockAir;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C00PacketKeepAlive;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C13PacketPlayerAbilities;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import net.minecraft.potion.Potion;
import net.minecraft.util.*;
import org.lwjgl.input.Keyboard;
import java.awt.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Random;
@ModuleInfo(name = "Fly", description = "Allows you to fly in survival mode.", category = ModuleCategory.MOVEMENT, keyBind = Keyboard.KEY_F)
public class Fly extends Module {
public final ListValue modeValue = new ListValue("Mode", new String[]{
"Zoom",
"Vanilla",
"SmoothVanilla",
// NCP
"NCP",
"OldNCP",
// AAC
"AAC1.9.10",
"AAC3.0.5",
"AAC3.1.6-Gomme",
"AAC3.3.12",
"AAC3.3.12-Glide",
"AAC3.3.13",
// CubeCraft
"CubeCraft",
// Hypixel
"Hypixel",
"BoostHypixel",
"FreeHypixel",
// Rewinside
"Rewinside",
"TeleportRewinside",
// Other server specific flys
"Mineplex",
"NeruxVace",
"Minesucht",
// Spartan
"Spartan",
"Spartan2",
"BugSpartan",
// Other anticheats
"MineSecure",
"HawkEye",
"HAC",
"WatchCat",
// Other
"Jetpack",
"KeepAlive",
"Flag"
}, "Vanilla");
private final FloatValue vanillaSpeedValue = new FloatValue("VanillaSpeed", 2F, 0F, 5F);
private final BoolValue vanillaKickBypassValue = new BoolValue("VanillaKickBypass", false);
private final FloatValue ncpMotionValue = new FloatValue("NCPMotion", 0F, 0F, 1F);
// AAC
private final FloatValue aacSpeedValue = new FloatValue("AAC1.9.10-Speed", 0.3F, 0F, 1F);
private final BoolValue aacFast = new BoolValue("AAC3.0.5-Fast", true);
private final FloatValue aacMotion = new FloatValue("AAC3.3.12-Motion", 10F, 0.1F, 10F);
private final FloatValue aacMotion2 = new FloatValue("AAC3.3.13-Motion", 10F, 0.1F, 10F);
// Hypixel
private final BoolValue hypixelBoost = new BoolValue("Hypixel-Boost", true);
private final IntegerValue hypixelBoostDelay = new IntegerValue("Hypixel-BoostDelay", 1200, 0, 2000);
private final FloatValue hypixelBoostTimer = new FloatValue("Hypixel-BoostTimer", 1F, 0F, 5F);
private final BoolValue blinkAttack = new BoolValue("Zoom-Attack", true);
private final FloatValue blinkAttackPacket = new FloatValue("ZoomAttack-Packet", 4F, 2F, 20F);
private final FloatValue mineplexSpeedValue = new FloatValue("MineplexSpeed", 1F, 0.5F, 10F);
private final IntegerValue neruxVaceTicks = new IntegerValue("NeruxVace-Ticks", 6, 0, 20);
// Visuals
private final BoolValue markValue = new BoolValue("Mark", true);
private double startY;
private final MSTimer flyTimer = new MSTimer();
private final MSTimer groundTimer = new MSTimer();
public static boolean noPacketModify;
private double aacJump;
private int aac3delay;
private int aac3glideDelay;
private boolean noFlag;
private final MSTimer mineSecureVClipTimer = new MSTimer();
private final TickTimer spartanTimer = new TickTimer();
private long minesuchtTP;
private final MSTimer mineplexTimer = new MSTimer();
private boolean wasDead;
private final TickTimer hypixelTimer = new TickTimer();
private int boostHypixelState = 1;
private double moveSpeed, lastDistance;
private boolean failedStart = false;
private final TickTimer cubecraft2TickTimer = new TickTimer();
private final TickTimer cubecraftTeleportTickTimer = new TickTimer();
private final TickTimer freeHypixelTimer = new TickTimer();
private float freeHypixelYaw;
private float freeHypixelPitch;
public ListValue getModeValue() {
return modeValue;
}
private ArrayList<Packet> packetList = new ArrayList<Packet>();
@Override
public void onEnable() {
if(mc.thePlayer == null)
return;
flyTimer.reset();
noPacketModify = true;
double x = mc.thePlayer.posX;
double y = mc.thePlayer.posY;
double z = mc.thePlayer.posZ;
final String mode = modeValue.get();
switch(mode.toLowerCase()) {
case "ncp":
if(!mc.thePlayer.onGround)
break;
for(int i = 0; i < 65; ++i) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.049D, z, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, false));
}
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.1D, z, true));
mc.thePlayer.motionX *= 0.1D;
mc.thePlayer.motionZ *= 0.1D;
mc.thePlayer.swingItem();
break;
case "oldncp":
if(!mc.thePlayer.onGround)
break;
for(int i = 0; i < 4; i++) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 1.01, z, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, false));
}
mc.thePlayer.jump();
mc.thePlayer.swingItem();
break;
case "bugspartan":
for(int i = 0; i < 65; ++i) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.049D, z, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y, z, false));
}
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(x, y + 0.1D, z, true));
mc.thePlayer.motionX *= 0.1D;
mc.thePlayer.motionZ *= 0.1D;
mc.thePlayer.swingItem();
break;
case "infinitycubecraft":
ClientUtils.displayChatMessage("§8[§c§lCubeCraft-§a§lFly§8] §aPlace a block before landing.");
break;
case "infinityvcubecraft":
ClientUtils.displayChatMessage("§8[§c§lCubeCraft-§a§lFly§8] §aPlace a block before landing.");
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 2, mc.thePlayer.posZ);
break;
case "boosthypixel":
if(!mc.thePlayer.onGround) break;
//for (int i = 0; i < 10; i++) //Imagine flagging to NCP.
// mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
double fallDistance = 3.0125; //add 0.0125 to ensure we get the fall dmg
while (fallDistance > 0) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0624986421, mc.thePlayer.posZ, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0625 , mc.thePlayer.posZ, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0624986421, mc.thePlayer.posZ, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0000013579, mc.thePlayer.posZ, false));
fallDistance -= 0.0624986421;
}
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.thePlayer.jump();
mc.thePlayer.posY += 0.42F; // Visual
boostHypixelState = 1;
moveSpeed = 0.1D;
lastDistance = 0D;
failedStart = false;
break;
case "zoom":
if(!mc.thePlayer.onGround) break;
//for (int i = 0; i < 10; i++) //Imagine flagging to NCP.
// mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
double fall = 3.0125; //add 0.0125 to ensure we get the fall dmg
while (fall > 0) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0624986421, mc.thePlayer.posZ, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0625 , mc.thePlayer.posZ, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0624986421, mc.thePlayer.posZ, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.0000013579, mc.thePlayer.posZ, false));
fall -= 0.0624986421;
}
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
mc.thePlayer.jump();
mc.thePlayer.posY += 0.42F; // Visual
boostHypixelState = 1;
moveSpeed = 0.1D;
lastDistance = 0D;
failedStart = false;
break;
}
startY = mc.thePlayer.posY;
aacJump = -3.8D;
noPacketModify = false;
if(mode.equalsIgnoreCase("freehypixel")) {
freeHypixelTimer.reset();
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + 0.42D, mc.thePlayer.posZ);
freeHypixelYaw = mc.thePlayer.rotationYaw;
freeHypixelPitch = mc.thePlayer.rotationPitch;
}
super.onEnable();
}
@Override
public void onDisable() {
wasDead = false;
if (mc.thePlayer == null)
return;
noPacketModify = true;
noFlag = false;
final String mode = modeValue.get();
if (!mode.toUpperCase().startsWith("AAC") && !mode.equalsIgnoreCase("Hypixel") &&
!mode.equalsIgnoreCase("CubeCraft")) {
mc.thePlayer.motionX = 0;
mc.thePlayer.motionY = 0;
mc.thePlayer.motionZ = 0;
}
mc.thePlayer.capabilities.isFlying = false;
mc.timer.timerSpeed = 1F;
mc.thePlayer.speedInAir = 0.02F;
if(mode.equalsIgnoreCase("Zoom")) {
PlayerCapabilities playerCapabilities = new PlayerCapabilities();
playerCapabilities.allowFlying = true;
playerCapabilities.isFlying = true;
mc.thePlayer.sendQueue.addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));
for (Packet p:packetList) {
mc.getNetHandler().addToSendQueue(p);
}
packetList.clear();
}
noPacketModify = false;
}
@EventTarget
public void onUpdate(final UpdateEvent event) {
final float vanillaSpeed = vanillaSpeedValue.get();
switch (modeValue.get().toLowerCase()) {
case "vanilla":
mc.thePlayer.capabilities.isFlying = false;
mc.thePlayer.motionY = 0;
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
if (mc.gameSettings.keyBindJump.isKeyDown())
mc.thePlayer.motionY += vanillaSpeed;
if (mc.gameSettings.keyBindSneak.isKeyDown())
mc.thePlayer.motionY -= vanillaSpeed;
MovementUtils.strafe(vanillaSpeed);
handleVanillaKickBypass();
break;
case "smoothvanilla":
mc.thePlayer.capabilities.isFlying = true;
handleVanillaKickBypass();
break;
case "cubecraft":
mc.timer.timerSpeed = 0.6F;
cubecraftTeleportTickTimer.update();
break;
case "ncp":
mc.thePlayer.motionY = -ncpMotionValue.get();
if(mc.gameSettings.keyBindSneak.isKeyDown())
mc.thePlayer.motionY = -0.5D;
MovementUtils.strafe();
break;
case "oldncp":
if(startY > mc.thePlayer.posY)
mc.thePlayer.motionY = -0.000000000000000000000000000000001D;
if(mc.gameSettings.keyBindSneak.isKeyDown())
mc.thePlayer.motionY = -0.2D;
if(mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.posY < (startY - 0.1D))
mc.thePlayer.motionY = 0.2D;
MovementUtils.strafe();
break;
case "aac1.9.10":
if(mc.gameSettings.keyBindJump.isKeyDown())
aacJump += 0.2D;
if(mc.gameSettings.keyBindSneak.isKeyDown())
aacJump -= 0.2D;
if((startY + aacJump) > mc.thePlayer.posY) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));
mc.thePlayer.motionY = 0.8D;
MovementUtils.strafe(aacSpeedValue.get());
}
MovementUtils.strafe();
break;
case "aac3.0.5":
if (aac3delay == 2)
mc.thePlayer.motionY = 0.1D;
else if (aac3delay > 2)
aac3delay = 0;
if (aacFast.get()) {
if (mc.thePlayer.movementInput.moveStrafe == 0D)
mc.thePlayer.jumpMovementFactor = 0.08F;
else
mc.thePlayer.jumpMovementFactor = 0F;
}
aac3delay++;
break;
case "aac3.1.6-gomme":
mc.thePlayer.capabilities.isFlying = true;
if (aac3delay == 2) {
mc.thePlayer.motionY += 0.05D;
} else if (aac3delay > 2) {
mc.thePlayer.motionY -= 0.05D;
aac3delay = 0;
}
aac3delay++;
if(!noFlag)
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.onGround));
if(mc.thePlayer.posY <= 0D)
noFlag = true;
break;
case "flag":
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));
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));
mc.thePlayer.setPosition(mc.thePlayer.posX + mc.thePlayer.motionX * 11, mc.thePlayer.posY, mc.thePlayer.posZ + mc.thePlayer.motionZ * 11);
mc.thePlayer.motionY = 0F;
break;
case "keepalive":
mc.getNetHandler().addToSendQueue(new C00PacketKeepAlive());
mc.thePlayer.capabilities.isFlying = false;
mc.thePlayer.motionY = 0;
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
if(mc.gameSettings.keyBindJump.isKeyDown())
mc.thePlayer.motionY += vanillaSpeed;
if(mc.gameSettings.keyBindSneak.isKeyDown())
mc.thePlayer.motionY -= vanillaSpeed;
MovementUtils.strafe(vanillaSpeed);
break;
case "minesecure":
mc.thePlayer.capabilities.isFlying = false;
if(!mc.gameSettings.keyBindSneak.isKeyDown())
mc.thePlayer.motionY = -0.01F;
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
MovementUtils.strafe(vanillaSpeed);
if(mineSecureVClipTimer.hasTimePassed(150) && mc.gameSettings.keyBindJump.isKeyDown()) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 5, mc.thePlayer.posZ, false));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(0.5D, -1000, 0.5D, false));
final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
final double x = -Math.sin(yaw) * 0.4D;
final double z = Math.cos(yaw) * 0.4D;
mc.thePlayer.setPosition(mc.thePlayer.posX + x, mc.thePlayer.posY, mc.thePlayer.posZ + z);
mineSecureVClipTimer.reset();
}
break;
case "hac":
mc.thePlayer.motionX *= 0.8;
mc.thePlayer.motionZ *= 0.8;
case "hawkeye":
mc.thePlayer.motionY = mc.thePlayer.motionY <= -0.42 ? 0.42 : -0.42;
break;
case "teleportrewinside":
final Vec3 vectorStart = new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);
final float yaw = -mc.thePlayer.rotationYaw;
final float pitch = -mc.thePlayer.rotationPitch;
final double length = 9.9;
final Vec3 vectorEnd = new Vec3(
Math.sin(Math.toRadians(yaw)) * Math.cos(Math.toRadians(pitch)) * length + vectorStart.xCoord,
Math.sin(Math.toRadians(pitch)) * length + vectorStart.yCoord,
Math.cos(Math.toRadians(yaw)) * Math.cos(Math.toRadians(pitch)) * length + vectorStart.zCoord
);
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vectorEnd.xCoord, mc.thePlayer.posY + 2, vectorEnd.zCoord, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vectorStart.xCoord, mc.thePlayer.posY + 2, vectorStart.zCoord, true));
mc.thePlayer.motionY = 0;
break;
case "minesucht":
final double posX = mc.thePlayer.posX;
final double posY = mc.thePlayer.posY;
final double posZ = mc.thePlayer.posZ;
if(!mc.gameSettings.keyBindForward.isKeyDown())
break;
if(System.currentTimeMillis() - minesuchtTP > 99) {
final Vec3 vec3 = mc.thePlayer.getPositionEyes(0);
final Vec3 vec31 = mc.thePlayer.getLook(0);
final Vec3 vec32 = vec3.addVector(vec31.xCoord * 7, vec31.yCoord * 7, vec31.zCoord * 7);
if(mc.thePlayer.fallDistance > 0.8) {
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY + 50, posZ, false));
mc.thePlayer.fall(100, 100);
mc.thePlayer.fallDistance = 0;
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY + 20, posZ, true));
}
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec32.xCoord, mc.thePlayer.posY + 50, vec32.zCoord, true));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY, posZ, false));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(vec32.xCoord, posY, vec32.zCoord, true));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY, posZ, false));
minesuchtTP = System.currentTimeMillis();
}else{
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, false));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, posY, posZ, true));
}
break;
case "jetpack":
if(mc.gameSettings.keyBindJump.isKeyDown()) {
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);
mc.thePlayer.motionY += 0.15D;
mc.thePlayer.motionX *= 1.1D;
mc.thePlayer.motionZ *= 1.1D;
}
break;
case "mineplex":
if(mc.thePlayer.inventory.getCurrentItem() == null) {
if(mc.gameSettings.keyBindJump.isKeyDown() && mineplexTimer.hasTimePassed(100)) {
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.6, mc.thePlayer.posZ);
mineplexTimer.reset();
}
if(mc.thePlayer.isSneaking() && mineplexTimer.hasTimePassed(100)) {
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 0.6, mc.thePlayer.posZ);
mineplexTimer.reset();
}
final BlockPos blockPos = new BlockPos(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY - 1, mc.thePlayer.posZ);
final Vec3 vec = new Vec3(blockPos).addVector(0.4F, 0.4F, 0.4F).add(new Vec3(EnumFacing.UP.getDirectionVec()));
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));
MovementUtils.strafe(0.27F);
mc.timer.timerSpeed = (1 + mineplexSpeedValue.get());
}else{
mc.timer.timerSpeed = 1;
setState(false);
ClientUtils.displayChatMessage("§8[§c§lMineplex-§a§lFly§8] §aSelect an empty slot to fly.");
}
break;
case "aac3.3.12":
if(mc.thePlayer.posY < -70)
mc.thePlayer.motionY = aacMotion.get();
mc.timer.timerSpeed = 1F;
if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
mc.timer.timerSpeed = 0.2F;
mc.rightClickDelayTimer = 0;
}
break;
case "aac3.3.12-glide":
if(!mc.thePlayer.onGround)
aac3glideDelay++;
if(aac3glideDelay == 2)
mc.timer.timerSpeed = 1F;
if(aac3glideDelay == 12)
mc.timer.timerSpeed = 0.1F;
if(aac3glideDelay >= 12 && !mc.thePlayer.onGround) {
aac3glideDelay = 0;
mc.thePlayer.motionY = .015;
}
break;
case "aac3.3.13":
if(mc.thePlayer.isDead)
wasDead = true;
if(wasDead || mc.thePlayer.onGround) {
wasDead = false;
mc.thePlayer.motionY = aacMotion2.get();
mc.thePlayer.onGround = false;
}
mc.timer.timerSpeed = 1F;
if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
mc.timer.timerSpeed = 0.2F;
mc.rightClickDelayTimer = 0;
}
break;
case "watchcat":
MovementUtils.strafe(0.15F);
mc.thePlayer.setSprinting(true);
if(mc.thePlayer.posY < startY + 2) {
mc.thePlayer.motionY = Math.random() * 0.5;
break;
}
if(startY > mc.thePlayer.posY)
MovementUtils.strafe(0F);
break;
case "spartan":
mc.thePlayer.motionY = 0;
spartanTimer.update();
if(spartanTimer.hasTimePassed(12)) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 8, mc.thePlayer.posZ, true));
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY - 8, mc.thePlayer.posZ, true));
spartanTimer.reset();
}
break;
case "spartan2":
MovementUtils.strafe(0.264F);
if(mc.thePlayer.ticksExisted % 8 == 0)
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + 10, mc.thePlayer.posZ, true));
break;
case "neruxvace":
if (!mc.thePlayer.onGround)
aac3glideDelay++;
if (aac3glideDelay >= neruxVaceTicks.get() && !mc.thePlayer.onGround) {
aac3glideDelay = 0;
mc.thePlayer.motionY = .015;
}
break;
case "hypixel":
final int boostDelay = hypixelBoostDelay.get();
if (hypixelBoost.get() && !flyTimer.hasTimePassed(boostDelay)) {
mc.timer.timerSpeed = 1F + (hypixelBoostTimer.get() * ((float) flyTimer.hasTimeLeft(boostDelay) / (float) boostDelay));
}
hypixelTimer.update();
if (hypixelTimer.hasTimePassed(2)) {
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.0E-5, mc.thePlayer.posZ);
hypixelTimer.reset();
}
break;
case "freehypixel":
if(freeHypixelTimer.hasTimePassed(10)) {
mc.thePlayer.capabilities.isFlying = true;
break;
}else{
mc.thePlayer.rotationYaw = freeHypixelYaw;
mc.thePlayer.rotationPitch = freeHypixelPitch;
mc.thePlayer.motionX = mc.thePlayer.motionZ = mc.thePlayer.motionY = 0;
}
if(startY == new BigDecimal(mc.thePlayer.posY).setScale(3, RoundingMode.HALF_DOWN).doubleValue())
freeHypixelTimer.update();
break;
case "bugspartan":
mc.thePlayer.capabilities.isFlying = false;
mc.thePlayer.motionY = 0;
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
if (mc.gameSettings.keyBindJump.isKeyDown())
mc.thePlayer.motionY += vanillaSpeed;
if (mc.gameSettings.keyBindSneak.isKeyDown())
mc.thePlayer.motionY -= vanillaSpeed;
MovementUtils.strafe(vanillaSpeed);
break;
}
}
@EventTarget
public void onMotion(final MotionEvent event) {
if(modeValue.get().equalsIgnoreCase("zoom")) {
switch (event.getEventState()) {
case PRE:
hypixelTimer.update();
if (hypixelTimer.hasTimePassed(2)) {
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.0E-5, mc.thePlayer.posZ);
hypixelTimer.reset();
}
if (!failedStart) mc.thePlayer.motionY = 0D;
break;
case POST:
double xDist = mc.thePlayer.posX - mc.thePlayer.prevPosX;
double zDist = mc.thePlayer.posZ - mc.thePlayer.prevPosZ;
lastDistance = Math.sqrt(xDist * xDist + zDist * zDist);
break;
}
}
if(modeValue.get().equalsIgnoreCase("boosthypixel")) {
switch(event.getEventState()) {
case PRE:
hypixelTimer.update();
if (hypixelTimer.hasTimePassed(2)) {
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.0999E-5, mc.thePlayer.posZ);
hypixelTimer.reset();
}
if(!failedStart) mc.thePlayer.motionY = 0D;
break;
case POST:
double xDist = mc.thePlayer.posX - mc.thePlayer.prevPosX;
double zDist = mc.thePlayer.posZ - mc.thePlayer.prevPosZ;
lastDistance = Math.sqrt(xDist * xDist + zDist * zDist);
break;
}
}
}
@EventTarget
public void onRender3D(final Render3DEvent event) {
final String mode = modeValue.get();
if (!markValue.get() || mode.equalsIgnoreCase("Vanilla") || mode.equalsIgnoreCase("SmoothVanilla"))
return;
double y = startY + 2D;
RenderUtils.drawPlatform(y, mc.thePlayer.getEntityBoundingBox().maxY < y ? new Color(0, 255, 0, 90) : new Color(255, 0, 0, 90), 1);
switch (mode.toLowerCase()) {
case "aac1.9.10":
RenderUtils.drawPlatform(startY + aacJump, new Color(0, 0, 255, 90), 1);
break;
case "aac3.3.12":
RenderUtils.drawPlatform(-70, new Color(0, 0, 255, 90), 1);
break;
}
}
@EventTarget
public void onPacket(PacketEvent event) {
if(noPacketModify)
return;
final Packet<?> packet = event.getPacket();
if(packet instanceof C03PacketPlayer) {
final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;
final String mode = modeValue.get();
if (mode.equalsIgnoreCase("NCP") || mode.equalsIgnoreCase("Rewinside") ||
(mode.equalsIgnoreCase("Mineplex") && mc.thePlayer.inventory.getCurrentItem() == null))
packetPlayer.onGround = true;
if (mode.equalsIgnoreCase("Hypixel") || mode.equalsIgnoreCase("BoostHypixel") || mode.equalsIgnoreCase("Zoom"))
packetPlayer.onGround = true;
}
if(modeValue.get().equalsIgnoreCase("Zoom"))
{
if(packet instanceof C03PacketPlayer) {
event.cancelEvent();
packetList.add(packet);
}
if(blinkAttack.get() && packet instanceof C02PacketUseEntity && packetList.size() >= blinkAttackPacket.get()) {
noPacketModify = true;
PlayerCapabilities playerCapabilities = new PlayerCapabilities();
playerCapabilities.allowFlying = true;
playerCapabilities.isFlying = true;
mc.thePlayer.sendQueue.addToSendQueue(new C13PacketPlayerAbilities(playerCapabilities));
for (Packet p:packetList) {
mc.getNetHandler().addToSendQueue(p);
}
packetList.clear();
noPacketModify = false;
}
}
if(packet instanceof S08PacketPlayerPosLook) {
final String mode = modeValue.get();
if(mode.equalsIgnoreCase("BoostHypixel")) {
failedStart = true;
ClientUtils.displayChatMessage("§8[§c§lBoostHypixel-§a§lFly§8] §cSetback detected.");
}
if(mode.equalsIgnoreCase("Zoom")) {
failedStart = true;
ClientUtils.displayChatMessage("§8[§c§lZoom-§a§lFly§8] §cSetback detected.");
}
}
}
@EventTarget
public void onMove(final MoveEvent event) {
switch(modeValue.get().toLowerCase()) {
case "cubecraft": {
final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
if (cubecraftTeleportTickTimer.hasTimePassed(2)) {
event.setX(-Math.sin(yaw) * 2.4D);
event.setZ(Math.cos(yaw) * 2.4D);
cubecraftTeleportTickTimer.reset();
} else {
event.setX(-Math.sin(yaw) * 0.2D);
event.setZ(Math.cos(yaw) * 0.2D);
}
break;
}
case "boosthypixel":
if (!MovementUtils.isMoving()) {
event.setX(0D);
event.setZ(0D);
break;
}
if (failedStart)
break;
final double amplifier = 1 + (mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 0.2 *
(mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1) : 0);
final double baseSpeed = 0.29D * amplifier;
switch (boostHypixelState) {
case 1:
moveSpeed = (mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 1.56 : 2.034) * baseSpeed;
boostHypixelState = 2;
break;
case 2:
moveSpeed *= 2.16D;
boostHypixelState = 3;
break;
case 3:
moveSpeed = lastDistance - (mc.thePlayer.ticksExisted % 2 == 0 ? 0.0103D : 0.0123D) * (lastDistance - baseSpeed);
boostHypixelState = 4;
break;
default:
moveSpeed = lastDistance - lastDistance / 159.8D;
break;
}
moveSpeed = Math.max(moveSpeed, 0.3D);
final double yaw = MovementUtils.getDirection();
event.setX(-Math.sin(yaw) * moveSpeed);
event.setZ(Math.cos(yaw) * moveSpeed);
mc.thePlayer.motionX = event.getX();
mc.thePlayer.motionZ = event.getZ();
break;
case "zoom":
if (!MovementUtils.isMoving()) {
event.setX(0D);
event.setZ(0D);
break;
}
if (failedStart)
break;
final double amplif = 1 + (mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 0.2 *
(mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1) : 0);
final double base = 0.29D * amplif;
switch (boostHypixelState) {
case 1:
moveSpeed = (mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 1.56 : 2.034) * base;
boostHypixelState = 2;
break;
case 2:
moveSpeed *= 2.16D;
boostHypixelState = 3;
break;
case 3:
moveSpeed = lastDistance - (mc.thePlayer.ticksExisted % 2 == 0 ? 0.0103D : 0.0123D) * (lastDistance - base);
boostHypixelState = 4;
break;
default:
moveSpeed = lastDistance - lastDistance / 159.8D;
break;
}
moveSpeed = Math.max(moveSpeed, 0.3D);
final double ya = MovementUtils.getDirection();
event.setX(-Math.sin(ya) * moveSpeed);
event.setZ(Math.cos(ya) * moveSpeed);
mc.thePlayer.motionX = event.getX();
mc.thePlayer.motionZ = event.getZ();
break;
case "freehypixel":
if (!freeHypixelTimer.hasTimePassed(10))
event.zero();
break;
}
}
@EventTarget
public void onBB(final BlockBBEvent event) {
if (mc.thePlayer == null) return;
final String mode = modeValue.get();
if (event.getBlock() instanceof BlockAir && (mode.equalsIgnoreCase("Hypixel") ||
mode.equalsIgnoreCase("BoostHypixel") || mode.equalsIgnoreCase("Zoom") ||mode.equalsIgnoreCase("Rewinside") ||
(mode.equalsIgnoreCase("Mineplex") && mc.thePlayer.inventory.getCurrentItem() == null)) && event.getY() < mc.thePlayer.posY)
event.setBoundingBox(AxisAlignedBB.fromBounds(event.getX(), event.getY(), event.getZ(), event.getX() + 1, mc.thePlayer.posY, event.getZ() + 1));
}
@EventTarget
public void onJump(final JumpEvent e) {
final String mode = modeValue.get();
if (mode.equalsIgnoreCase("Hypixel") || mode.equalsIgnoreCase("BoostHypixel") ||
mode.equalsIgnoreCase("Zoom") ||mode.equalsIgnoreCase("Rewinside") || (mode.equalsIgnoreCase("Mineplex") && mc.thePlayer.inventory.getCurrentItem() == null))
e.cancelEvent();
}
@EventTarget
public void onStep(final StepEvent e) {
final String mode = modeValue.get();
if (mode.equalsIgnoreCase("Hypixel") || mode.equalsIgnoreCase("BoostHypixel") ||
mode.equalsIgnoreCase("Zoom") ||mode.equalsIgnoreCase("Rewinside") || (mode.equalsIgnoreCase("Mineplex") && mc.thePlayer.inventory.getCurrentItem() == null))
e.setStepHeight(0F);
}
private void handleVanillaKickBypass() {
if(!vanillaKickBypassValue.get() || !groundTimer.hasTimePassed(1000)) return;
final double ground = calculateGround();
for(double posY = mc.thePlayer.posY; posY > ground; posY -= 8D) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ, true));
if(posY - 8D < ground) break; // Prevent next step
}
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, ground, mc.thePlayer.posZ, true));
for(double posY = ground; posY < mc.thePlayer.posY; posY += 8D) {
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ, true));
if(posY + 8D > mc.thePlayer.posY) break; // Prevent next step
}
mc.getNetHandler().addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
groundTimer.reset();
}
// TODO: Make better and faster calculation lol
private double calculateGround() {
final AxisAlignedBB playerBoundingBox = mc.thePlayer.getEntityBoundingBox();
double blockHeight = 1D;
for(double ground = mc.thePlayer.posY; ground > 0D; ground -= blockHeight) {
final AxisAlignedBB customBox = new AxisAlignedBB(playerBoundingBox.maxX, ground + blockHeight, playerBoundingBox.maxZ, playerBoundingBox.minX, ground, playerBoundingBox.minZ);
if(mc.theWorld.checkBlockCollision(customBox)) {
if(blockHeight <= 0.05D)
return ground + blockHeight;
ground += blockHeight;
blockHeight = 0.05D;
}
}
return 0F;
}
@Override
public String getTag() {
return modeValue.get();
}
}
// NOTE (AI): Only the keepalive case (line ~423) touches C00; the rest of the file is the standard LiquidBounce Fly mode switch.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.
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.
// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====
/* November.lol © 2023 */
package lol.november.scripting.wrapper.event;
import java.util.HashMap;
import java.util.Map;
import lol.november.listener.event.net.EventPacket;
import lol.november.protect.DontObfuscate;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
/**
* @author Gavin
* @since 2.0.0
*/
@Getter
@Setter
@DontObfuscate
public class LuaEventPacket {
/**
* A map of each {@link Packet} to their id
*/
private static final Map<Class<? extends Packet<?>>, Integer> packetIds =
new HashMap<>();
static {
// you may ask: why not use reflection and just.. do a funny?
// obfuscation eventually happens so this aids has to happen
packetIds.put(C0APacketAnimation.class, 0x0A);
packetIds.put(C0BPacketEntityAction.class, 0x0B);
packetIds.put(C0CPacketInput.class, 0x0C);
packetIds.put(C0DPacketCloseWindow.class, 0x0D);
packetIds.put(C0EPacketClickWindow.class, 0x0E);
packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);
packetIds.put(C00PacketKeepAlive.class, 0x00);
packetIds.put(C01PacketChatMessage.class, 0x01);
packetIds.put(C02PacketUseEntity.class, 0x02);
packetIds.put(C03PacketPlayer.class, 0x03);
packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);
packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);
packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);
packetIds.put(C07PacketPlayerDigging.class, 0x07);
packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);
packetIds.put(C09PacketHeldItemChange.class, 0x09);
packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);
packetIds.put(C11PacketEnchantItem.class, 0x11);
packetIds.put(C12PacketUpdateSign.class, 0x12);
packetIds.put(C13PacketPlayerAbilities.class, 0x13);
packetIds.put(C14PacketTabComplete.class, 0x14);
packetIds.put(C15PacketClientSettings.class, 0x15);
packetIds.put(C16PacketClientStatus.class, 0x16);
packetIds.put(C17PacketCustomPayload.class, 0x17);
packetIds.put(C18PacketSpectate.class, 0x18);
packetIds.put(C19PacketResourcePackStatus.class, 0x19);
}
private final int packet;
private final String direction;
public LuaEventPacket(EventPacket event) {
packet = packetIds.getOrDefault(event.get().getClass(), -1);
direction = event.get() instanceof EventPacket.Out ? "out" : "in";
}
}
// NOTE (AI): The id map covers every serverbound play packet; C00 is registered as 0x00, matching the wire id.anticheat Anti-Cheat Checks
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.
Cross-checks the keepalive round-trip against the transaction round-trip to catch ping spoofers that delay keepalive echoes.
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.
// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/pingspoof/PingSpoofA.java =====
package xyz.elevated.frequency.check.impl.pingspoof;
import xyz.elevated.frequency.check.CheckData;
import xyz.elevated.frequency.check.type.PacketCheck;
import xyz.elevated.frequency.data.PlayerData;
import xyz.elevated.frequency.exempt.type.ExemptType;
import xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;
@CheckData(name = "PingSpoof (A)")
public final class PingSpoofA extends PacketCheck {
public PingSpoofA(final PlayerData playerData) {
super(playerData);
}
@Override
public void process(final Object object) {
if (object instanceof WrappedPlayInFlying) {
final long transactionPing = playerData.getTransactionPing().get();
final long keepAlivePing = playerData.getKeepAlivePing().get();
final boolean joined = playerData.getTicks().get() - playerData.getJoined().get() < 10;
final boolean exempt = this.isExempt(ExemptType.LAGGING, ExemptType.TELEPORTING, ExemptType.TPS, ExemptType.CHUNK);
if (!exempt && !joined && transactionPing > keepAlivePing && Math.abs(transactionPing - keepAlivePing) > 50) fail();
}
}
}
// 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.Rejects keepalive replies whose ID was never issued by the server, catching fabricated echoes, key-mutating disablers and duplicate replays.
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.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java =====
package ac.grim.grimac.checks.impl.badpackets;
import ac.grim.grimac.api.storage.verbose.Verbose;
import ac.grim.grimac.checks.Check;
import ac.grim.grimac.checks.CheckData;
import ac.grim.grimac.checks.type.PacketReceiveListener;
import ac.grim.grimac.checks.type.PacketSendListener;
import ac.grim.grimac.player.GrimPlayer;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientKeepAlive;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerKeepAlive;
import java.util.LinkedList;
@CheckData(name = "BadPacketsO", stableKey = "grim.badpackets.invalid_keepalive", description = "Responded with a keepalive ID that was not sent by the server")
public class BadPacketsO extends Check implements PacketReceiveListener, PacketSendListener {
private static final Verbose V = Verbose.of("id={slong}");
private final LinkedList<Long> keepalives = new LinkedList<>();
public BadPacketsO(GrimPlayer player) {
super(player);
}
@Override
public void onPacketSend(PacketSendEvent event) {
if (event.getPacketType() == PacketType.Play.Server.KEEP_ALIVE) {
keepalives.add(new WrapperPlayServerKeepAlive(event).getId());
}
}
@Override
public void onPacketReceive(PacketReceiveEvent event) {
if (event.getPacketType() == PacketType.Play.Client.KEEP_ALIVE) {
final long id = new WrapperPlayClientKeepAlive(event).getId();
for (long keepalive : keepalives) {
if (keepalive == id) {
// Found the ID, remove stuff until we get to it (to stop very slow memory leaks)
Long data;
do {
data = keepalives.poll();
} while (data != null && data != id);
return;
}
}
if (flag(V.write(verbose()).slong(id)) && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
}
}
}
// 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.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.
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.
// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/net/KeepAliveFrequency.java =====
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.net;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.CheckUtils;
public class KeepAliveFrequency extends Check {
public KeepAliveFrequency() {
super(CheckType.NET_KEEPALIVEFREQUENCY);
}
/**
* Checks hasBypass on violation only.
* @param player
* @param time
* @param data
* @param cc
* @return If to cancel.
*/
public boolean check(final Player player, final long time, final NetData data, final NetConfig cc, final IPlayerData pData) {
final long now = System.currentTimeMillis();
final long joinTime = pData.getLastJoinTime();
if (joinTime > 0L && now < joinTime + cc.keepAliveFrequencyStartupDelay) {
return false;
}
if (data.keepAliveExpectedResponse && !data.keepAliveDuplicateId) {
return false;
}
data.keepAliveFreq.add(time, 1f);
final float first = data.keepAliveFreq.bucketScore(0);
if (first > 1f) {
// Trigger a violation.
final float fullScore = data.keepAliveFreq.score(1f);
if (isModeledBoundaryBurst(data, fullScore, first)) {
return false;
}
final double vl = Math.max(first - getFirstBucketViolationLimit(data), fullScore - data.keepAliveFreq.numberOfBuckets());
final boolean cancel = executeActions(player, vl, 1.0, cc.keepAliveFrequencyActions).willCancel();
return cancel;
}
return false;
}
private boolean isModeledBoundaryBurst(final NetData data, final float fullScore, final float first) {
// KeepAlive model: if outgoing tracking is unavailable, only treat small monotonic id bursts as timing leftovers.
if (data.keepAliveDuplicateId || fullScore > data.keepAliveFreq.numberOfBuckets() + 2f) {
return false;
}
// Folia/netty can timestamp two adjacent valid replies in the same millisecond; do not cancel a single pair.
return first <= 2f || isUntrackedMonotonicBurst(data, fullScore, first);
}
private boolean isUntrackedMonotonicBurst(final NetData data, final float fullScore, final float first) {
if (data.keepAliveOutgoingSeen || fullScore > data.keepAliveFreq.numberOfBuckets()) {
return false;
}
if (!data.keepAlivePacketIdAvailable || !data.keepAlivePreviousPacketIdAvailable) {
return false;
}
if (data.keepAlivePacketId <= data.keepAlivePreviousPacketId) {
return false;
}
return first <= getFallbackFirstBucketLimit(data);
}
private float getFirstBucketViolationLimit(final NetData data) {
if (data.keepAliveDuplicateId) {
return 1f;
}
if (!data.keepAliveOutgoingSeen
&& data.keepAlivePacketIdAvailable
&& data.keepAlivePreviousPacketIdAvailable
&& data.keepAlivePacketId > data.keepAlivePreviousPacketId) {
return getFallbackFirstBucketLimit(data);
}
return 2f;
}
private float getFallbackFirstBucketLimit(final NetData data) {
return Math.max(3f, Math.min(6f, data.keepAliveFreq.numberOfBuckets() / 4f));
}
}
// 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.Detects timer speed by measuring movement packet cadence against the 50 ms tick, gated on keepalive confirmation that the server tick actually ran.
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.
// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/timer/TimerA.java =====
package xyz.elevated.frequency.check.impl.timer;
import xyz.elevated.frequency.Frequency;
import xyz.elevated.frequency.check.CheckData;
import xyz.elevated.frequency.check.type.PacketCheck;
import xyz.elevated.frequency.data.PlayerData;
import xyz.elevated.frequency.exempt.type.ExemptType;
import xyz.elevated.frequency.util.MovingStats;
import xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;
@CheckData(name = "Timer (A)")
public final class TimerA extends PacketCheck {
private final MovingStats movingStats = new MovingStats(20);
private long lastFlying = 0L;
private long allowance = 0;
public TimerA(final PlayerData playerData) {
super(playerData);
}
@Override
public void process(final Object object) {
final boolean flying = object instanceof WrappedPlayInFlying;
if (flying) {
// Get the server ticks and the current time for the check processing
final int serverTicks = Frequency.INSTANCE.getTickManager().getTicks();
final long now = System.currentTimeMillis();
/*
* We want to make sure the player is not exempt from any of the actions below.
* Additionally, we want to ensure that the player is not lagged out and accepted a keepalive.
* Thankfully, we shouldn't have any bypasses because of this because of PingSpoof.
*/
final boolean exempt = this.isExempt(ExemptType.TPS, ExemptType.TELEPORTING, ExemptType.LAGGING);
final boolean accepted = playerData.getConnectionManager().getKeepAliveTime(serverTicks).isPresent();
/*
* Basic theory is that the player is going to deviate through 50ms without many changes to that
* basic range of [48, 50]. So we're running a deviation check to check how much the player has deviated
* from the basic limit of 50ms (square-root of 50 is 7.07). We're also making sure the player is actually
* increasing speed through an allowance that accounts for the tick expected versus the tick received.
*/
handle: {
if (exempt || !accepted) break handle;
// Get the delay from the current and the last flying packet
final long delay = now - lastFlying;
// Add the delay to the MovingStats to analyze our input
movingStats.add(delay);
/*
* As mentioned above, the basic threshold of the player is the square-root of 50. Because
* the expected tick should always be 50ms. To check how much the player has deviated from that
* single point, we're using it as a threshold value in the deviation check below.
*/
final double threshold = 7.07;
final double deviation = movingStats.getStdDev(threshold);
// We're making sure the deviation check processed and the deviation is smaller than the threshold.
if (deviation < threshold && !Double.isNaN(deviation)) {
/*
* I am sure many of you have seen this before, and it's essentially the most basic version of
* a balance / allowance check. We're increasing the allowance with the expected amount of 50,
* and we're subtracting from it the actual delay received. This will act as our "buffer" system.
*/
allowance += 50;
allowance -= delay;
// Our previous threshold can act as one here too.
if (allowance > Math.floor(threshold)) fail();
}
else {
allowance = 0;
}
}
this.lastFlying = now;
}
}
}
// 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.Related Packets
Wiki Cross-Reference
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
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
Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.
Vanilla Internals
Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.
Module Analyses Using C00PacketKeepAlive
Full source walkthroughs of the modules and anti-cheats that use this packet.