Rise 6.1.30 Velocity module 2 files, 112 lines

Rise 6.1.30 Velocity: Full Source Analysis

Rise 6.1.30's Velocity is a thin module class that holds a ModeValue with nineteen per-mode classes plus an On Swing boolean, moving every implementation into its own file under the velocity subpackage.

com/alan/clients/module/impl/combat/Velocity.java · GitHub source ↗

Published 2026-08-12 · Updated 2026-08-12

Analysis

Overview

Rise 6.1.30's Velocity is a thin module class that holds a ModeValue with nineteen per-mode classes plus an On Swing boolean, moving every implementation into its own file under the velocity subpackage. The modes are Standard (percentage scaling), Buffer Abuse (cancel the first N knockbacks), Delay (ping-spoof the movement window), Legit/Jump Reset (inject a jump on the knockback tick), Ground (fake onGround one tick after the hit), Intave, Matrix, AAC, Vulcan (scale plus C0F cancellation), Redesky, Tick (stop motion after a delay), Bounce (invert the knockback), Karhu, MMC, Universocraft, Watchdog (cancel but keep grounded knockback), Grim Reduce (attack to satisfy Grim's velocity tracking) and Grim (cancel the velocity that follows the damage status). Each mode registers its own event listeners against the shared parent module, so the module's surface is the sum of the per-mode listeners.

Architecture

The parent Velocity class only builds the ModeValue and the onSwing boolean. Each mode is a Mode<Velocity> subclass in the velocity package that registers its own EventLink listeners, so enabling a mode activates exactly that mode's listeners. The onSwing boolean is read by most modes as a gate: when enabled, the listener returns unless the player is mid-swing, which ties anti-knockback to an attack animation. The modes fall into three families: packet-rewriting modes (Standard, Buffer Abuse, Vulcan, Redesky) that scale or cancel the S12 and S27 packets on receive, motion-timing modes (Tick, Bounce, Ground, Delay, Watchdog, Legit) that act from PreMotion or PreUpdate events against the hurtTime and ticksSinceVelocity counters, and anticheat-specific modes (Grim, Grim Reduce, Intave, Matrix, AAC, Karhu, MMC, Universocraft) that exploit a particular check's model.

Key techniques

The scaling modes share one pattern: on the S12 for the player entity, multiply motionX and motionZ by horizontal over 100 and motionY by vertical over 100 and replace the packet, or cancel outright when both are zero. Standard adds a guard that returns when motionY over 8000 exceeds 0.6, so heavy knockback is never touched, and an Explosion Ignore toggle that cancels S27 packets. Buffer Abuse cancels the first N knockbacks (Buffer setting) and scales the rest, resetting the counter after a scaled one. Vulcan adds a C0F cancellation on PacketSend while hurtTime equals 10, desyncing the transaction stream around the hit. Tick and Bounce act from PreMotion: Tick calls MoveUtil.stop() when hurtTime reaches 10 minus the setting, and Bounce inverts motionX/motionZ (or strafes while moving) and optionally motionY when hurtTime reaches 9 minus the setting.

Mode-specific streams

Delay is a ping-spoof: every PreUpdate it calls PingSpoofComponent.spoof with the delay setting times 50 milliseconds, so the server measures the player's ping as delayed and the knockback window stretches. Legit is a jump-reset: on the S12 while on the ground with positive motionY (and the legitTiming gates), it arms a jump flag that MoveInputEvent turns into a jump, with a Chance percentage. Ground fakes onGround one tick after the velocity and blocks the jump the next tick. Watchdog cancels the S12 but re-applies the real vertical motion when the player is near the last ground Y, keeping grounded knockback while removing airborne knockback. Grim waits for the S19 damage status (opcode 2) and cancels the velocity packet that follows, then sends a C07 digging packet so Grim's velocity tracking sees a block interaction. Grim Reduce attacks the target while ticksSinceVelocity is under 14 to satisfy Grim's knockback prediction.

source Velocity.java (module)

Velocity.java36 lines · JavaOriginal ↗
1
package com.alan.clients.module.impl.combat;
2
3
import com.alan.clients.module.Module;
4
import com.alan.clients.module.api.Category;
5
import com.alan.clients.module.api.ModuleInfo;
6
import com.alan.clients.module.impl.combat.velocity.*;
7
import com.alan.clients.value.impl.BooleanValue;
8
import com.alan.clients.value.impl.ModeValue;
9
10
@ModuleInfo(aliases = {"module.combat.velocity.name"}, description = "module.combat.velocity.description" /* Sorry, Tecnio. */ /* Sorry Hazsi. */, category = Category.COMBAT)
11
public final class Velocity extends Module {
12
13
    private final ModeValue mode = new ModeValue("Mode", this)
14
            .add(new StandardVelocity("Standard", this))
15
            .add(new BufferAbuseVelocity("Buffer Abuse", this))
16
            .add(new DelayVelocity("Delay", this))
17
            .add(new LegitVelocity("Legit/Jump Reset", this))
18
            .add(new LegitVelocity("Polar", this))
19
            .add(new GroundVelocity("Ground", this))
20
            .add(new IntaveVelocity("Intave", this))
21
            .add(new MatrixVelocity("Matrix", this))
22
            .add(new AACVelocity("AAC", this))
23
            .add(new VulcanVelocity("Vulcan", this))
24
            .add(new RedeskyVelocity("Redesky", this))
25
            .add(new TickVelocity("Tick", this))
26
            .add(new BounceVelocity("Bounce", this))
27
            .add(new KarhuVelocity("Karhu", this))
28
            .add(new MMCVelocity("MMC", this))
29
            .add(new UniversoCraftVelocity("Universocraft", this))
30
            .add(new WatchdogVelocity("Watchdog", this))
31
            .add(new GrimReduceVelocity("Grim Reduce", this))
32
            .add(new GrimVelocity("Grim", this))
33
            .setDefault("Standard");
34
35
    public final BooleanValue onSwing = new BooleanValue("On Swing", this, false);
36
}

What this file does

The module file is deliberately minimal: it declares the ModuleInfo, builds the ModeValue with all nineteen modes and sets Standard as the default, and exposes the onSwing BooleanValue. Every behavior lives in the mode classes, which register their own listeners, so this file is only the wiring. The mode list is the specification of what the module can do: Standard, Buffer Abuse, Delay, Legit (registered twice as Legit/Jump Reset and Polar), Ground, Intave, Matrix, AAC, Vulcan, Redesky, Tick, Bounce, Karhu, MMC, Universocraft, Watchdog, Grim Reduce and Grim.

The onSwing boolean is the one piece of shared state. It is read at the top of the receive handlers in Standard, Buffer Abuse, Vulcan, Redesky, Legit, Watchdog, Tick, Bounce and Ground, and in each case it gates the whole listener on mc.thePlayer.isSwingInProgress, so when enabled the module only suppresses knockback while the player is attacking. This is what makes the module look legitimate to velocity checks that expect knockback to be missing only during combat.

The mode registration is also where the two LegitVelocity instances differ: both use the same class with different names, so Legit/Jump Reset and Polar are the same jump-reset behavior under two labels. The default Standard mode is the safe baseline, and the Grim and Grim Reduce modes are the anticheat-specific answers to Grim's velocity prediction.

source StandardVelocity.java (default scaling mode)

StandardVelocity.java76 lines · JavaOriginal ↗
1
package com.alan.clients.module.impl.combat.velocity;
2
3
import com.alan.clients.event.Listener;
4
import com.alan.clients.event.Priorities;
5
import com.alan.clients.event.annotations.EventLink;
6
import com.alan.clients.event.impl.packet.PacketReceiveEvent;
7
import com.alan.clients.module.impl.combat.Velocity;
8
import com.alan.clients.value.Mode;
9
import com.alan.clients.value.impl.BooleanValue;
10
import com.alan.clients.value.impl.NumberValue;
11
import net.minecraft.network.Packet;
12
import net.minecraft.network.play.server.S12PacketEntityVelocity;
13
import net.minecraft.network.play.server.S27PacketExplosion;
14
15
public final class StandardVelocity extends Mode<Velocity> {
16
17
    private final NumberValue horizontal = new NumberValue("Horizontal", this, 0, 0, 100, 1);
18
    private final NumberValue vertical = new NumberValue("Vertical", this, 0, 0, 100, 1);
19
20
    private final BooleanValue onExplode = new BooleanValue("Explosion Ignore", this, false);
21
22
    public StandardVelocity(String name, Velocity parent) {
23
        super(name, parent);
24
    }
25
26
    @EventLink(value = Priorities.VERY_LOW)
27
    public final Listener<PacketReceiveEvent> onPacketReceiveEvent = event -> {
28
        if ((getParent().onSwing.getValue() && !mc.thePlayer.isSwingInProgress) || event.isCancelled()) {
29
            return;
30
        }
31
32
        final Packet<?> p = event.getPacket();
33
34
        final double horizontal = this.horizontal.getValue().doubleValue();
35
        final double vertical = this.vertical.getValue().doubleValue();
36
        final boolean onExplode = this.onExplode.getValue();
37
38
        if (p instanceof S12PacketEntityVelocity) {
39
            final S12PacketEntityVelocity wrapper = (S12PacketEntityVelocity) p;
40
41
            if (wrapper.getEntityID() == mc.thePlayer.getEntityId()) {
42
                if (wrapper.getMotionY() / 8000.0D > 0.6) return;
43
44
                if (horizontal == 0) {
45
                    if (vertical != 0 && !event.isCancelled()) {
46
                        mc.thePlayer.motionY = wrapper.getMotionY() / 8000.0D;
47
                    }
48
49
                    event.setCancelled();
50
                    return;
51
                }
52
53
                wrapper.motionX *= horizontal / 100;
54
                wrapper.motionY *= vertical / 100;
55
                wrapper.motionZ *= horizontal / 100;
56
57
                event.setPacket(wrapper);
58
59
            }
60
        } else if (p instanceof S27PacketExplosion) {
61
            final S27PacketExplosion wrapper = (S27PacketExplosion) p;
62
63
            if (onExplode) {
64
                event.setCancelled();
65
                return;
66
            }
67
68
            wrapper.posX *= horizontal / 100;
69
            wrapper.posY *= vertical / 100;
70
            wrapper.posZ *= horizontal / 100;
71
72
            event.setPacket(wrapper);
73
        }
74
    };
75
76
}

What this file does

StandardVelocity is the default and the template for the scaling family. Its PacketReceiveEvent listener, at VERY_LOW priority, first checks the onSwing gate and the cancelled state, then handles S12 and S27. For the player's S12 it returns early when motionY over 8000 exceeds 0.6, so a heavy hit passes untouched; when horizontal is 0 it cancels the packet and, if vertical is nonzero, applies the raw vertical motion directly to the player so the rise happens without a scaled packet; otherwise it scales the three motion components by the horizontal and vertical percentages and replaces the packet. The S27 branch scales the explosion offsets the same way, or cancels when the Explosion Ignore toggle is on.

The 0.6 guard is the interesting design choice. It means Standard only suppresses weak-to-medium knockback, which is the range where a velocity check's tolerance is small enough to flag; strong hits that would produce a visible missing-motion violation are left alone. The horizontal-zero branch shows the same logic: rather than scaling to zero, it cancels the packet and manually applies the vertical component, so the horizontal knockback is removed while the vertical rise still happens.

The listener is registered at VERY_LOW priority, which matters for the event bus: lower priority listeners run later, so Standard observes the packet after other modules have had their chance to cancel or modify it, and its own cancellation is the last word. The class holds only the three NumberValues and the BooleanValue, so all state is the settings themselves.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat KnockbackHandler (AntiKB, prediction offset)

KnockbackHandler.java262 lines · Java
1
package ac.grim.grimac.checks.impl.velocity;
2
3
import ac.grim.grimac.api.config.ConfigManager;
4
import ac.grim.grimac.api.storage.verbose.Verbose;
5
import ac.grim.grimac.checks.Check;
6
import ac.grim.grimac.checks.CheckData;
7
import ac.grim.grimac.checks.type.PacketSendListener;
8
import ac.grim.grimac.checks.type.PostPredictionListener;
9
import ac.grim.grimac.player.GrimPlayer;
10
import ac.grim.grimac.utils.anticheat.update.PredictionComplete;
11
import ac.grim.grimac.utils.data.Pair;
12
import ac.grim.grimac.utils.data.VectorData;
13
import ac.grim.grimac.utils.data.VelocityData;
14
import ac.grim.grimac.utils.math.Vector3dm;
15
import com.github.retrooper.packetevents.event.PacketSendEvent;
16
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
17
import com.github.retrooper.packetevents.util.Vector3d;
18
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityVelocity;
19
import lombok.Getter;
20
import org.jetbrains.annotations.NotNull;
21
22
import java.util.Deque;
23
import java.util.LinkedList;
24
25
// We are making a velocity sandwich between two pieces of transaction packets (bread)
26
@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)
27
public class KnockbackHandler extends Check implements PacketSendListener, PostPredictionListener {
28
    private static final Verbose V = Verbose.of("[ignored knockback|o: {offset}]");
29
30
    private final Deque<VelocityData> firstBreadMap = new LinkedList<>();
31
32
    private final Deque<VelocityData> lastKnockbackKnownTaken = new LinkedList<>();
33
    private VelocityData firstBreadOnlyKnockback = null;
34
    @Getter
35
    private boolean knockbackPointThree = false;
36
37
    private double offsetToFlag;
38
    private double maxAdv, immediate, ceiling, multiplier;
39
40
    private double threshold;
41
42
    public KnockbackHandler(GrimPlayer player) {
43
        super(player);
44
    }
45
46
    @Override
47
    public void onPacketSend(final PacketSendEvent event) {
48
        if (event.getPacketType() == PacketType.Play.Server.ENTITY_VELOCITY) {
49
            WrapperPlayServerEntityVelocity velocity = new WrapperPlayServerEntityVelocity(event);
50
            int entityId = velocity.getEntityId();
51
52
            // Detect whether this knockback packet affects the player or if it is useless
53
            // Mojang sends extra useless knockback packets for no apparent reason
54
            if (player.compensatedEntities.serverPlayerVehicle != null && entityId != player.compensatedEntities.serverPlayerVehicle) {
55
                return;
56
            }
57
            if (player.compensatedEntities.serverPlayerVehicle == null && entityId != player.entityID) {
58
                return;
59
            }
60
61
            // If the player isn't in a vehicle and the ID is for the player, the player will take kb
62
            // If the player is in a vehicle and the ID is for the player's vehicle, the player will take kb
63
            Vector3d playerVelocity = velocity.getVelocity();
64
65
            // Blacklist problemated vector until mojang fixes a client-sided bug
66
            if (playerVelocity.getY() == -0.04) {
67
                velocity.setVelocity(playerVelocity.add(new Vector3d(0, 1 / 8000D, 0)));
68
                playerVelocity = velocity.getVelocity();
69
                event.markForReEncode(true);
70
            }
71
72
            playerVelocity = VectorPrecisionConverter.convert(player.getClientVersion(), playerVelocity);
73
74
            // Wrap velocity between two transactions
75
            player.sendTransaction();
76
            addPlayerKnockback(entityId, player.lastTransactionSent.get(), new Vector3dm(playerVelocity.getX(), playerVelocity.getY(), playerVelocity.getZ()));
77
            event.getTasksAfterSend().add(player::sendTransaction);
78
        }
79
    }
80
81
    @NotNull
82
    public Pair<VelocityData, Vector3dm> getFutureKnockback() {
83
        // Chronologically in the future
84
        if (!firstBreadMap.isEmpty()) {
85
            VelocityData data = firstBreadMap.peek();
86
            return new Pair<>(data, data != null ? data.vector : null);
87
        }
88
89
        // Less in the future
90
        if (!lastKnockbackKnownTaken.isEmpty()) {
91
            VelocityData data = lastKnockbackKnownTaken.peek();
92
            return new Pair<>(data, data != null ? data.vector : null);
93
        }
94
95
        // Uncertain, might be in the future
96
        if (player.firstBreadKB != null && player.likelyKB == null) {
97
            VelocityData data = player.firstBreadKB;
98
            return new Pair<>(data, data.vector.clone());
99
        } else if (player.likelyKB != null) { // Known to be in the present
100
            VelocityData data = player.likelyKB;
101
            return new Pair<>(data, data.vector.clone());
102
        }
103
        return new Pair<>(null, null);
104
    }
105
106
    private void addPlayerKnockback(int entityID, int breadOne, @NotNull Vector3dm knockback) {
107
        firstBreadMap.add(new VelocityData(entityID, breadOne, player.getSetbackTeleportUtil().isSendingSetback, knockback));
108
    }
109
110
    public VelocityData calculateRequiredKB(int entityID, int transaction, boolean isJustTesting) {
111
        tickKnockback(transaction);
112
113
        VelocityData returnLastKB = null;
114
        for (VelocityData data : lastKnockbackKnownTaken) {
115
            if (data.entityID == entityID)
116
                returnLastKB = data;
117
        }
118
119
        if (!isJustTesting) {
120
            lastKnockbackKnownTaken.clear();
121
        }
122
        return returnLastKB;
123
    }
124
125
    private void tickKnockback(int transactionID) {
126
        firstBreadOnlyKnockback = null;
127
        if (firstBreadMap.isEmpty()) return;
128
        VelocityData data = firstBreadMap.peek();
129
        while (data != null) {
130
            if (data.transaction == transactionID) { // First bread knockback
131
                firstBreadOnlyKnockback = new VelocityData(data.entityID, data.transaction, data.isSetback, data.vector);
132
                //firstBreadMap.poll();
133
                break; // All knockback after this will have not been applied
134
            } else if (data.transaction < transactionID) { // This kb has 100% arrived to the player
135
                VelocityData velocityData = new VelocityData(data.entityID, data.transaction, data.isSetback, data.vector);
136
137
                if (firstBreadOnlyKnockback != null) { // Don't require kb twice
138
                    velocityData.offset = data.offset;
139
                }
140
141
                lastKnockbackKnownTaken.add(velocityData);
142
143
                // Knockback has been applied and is now required, remove it from first bread
144
                firstBreadOnlyKnockback = null;
145
                firstBreadMap.poll();
146
                data = firstBreadMap.peek();
147
            } else { // We are too far ahead in the future
148
                break;
149
            }
150
        }
151
    }
152
153
    public void forceExempt() {
154
        // Unsure knockback was taken
155
        if (player.firstBreadKB != null) {
156
            player.firstBreadKB.offset = 0;
157
        }
158
159
        if (player.likelyKB != null) {
160
            player.likelyKB.offset = 0;
161
        }
162
    }
163
164
    public void setPointThree(boolean isPointThree) {
165
        knockbackPointThree = knockbackPointThree || isPointThree;
166
    }
167
168
    public void handlePredictionAnalysis(double offset) {
169
        if (player.firstBreadKB != null) {
170
            player.firstBreadKB.offset = Math.min(player.firstBreadKB.offset, offset);
171
        }
172
173
        if (player.likelyKB != null) {
174
            player.likelyKB.offset = Math.min(player.likelyKB.offset, offset);
175
        }
176
    }
177
178
    @Override
179
    public void onPredictionComplete(final PredictionComplete predictionComplete) {
180
        double offset = predictionComplete.getOffset();
181
        if (!predictionComplete.isChecked() || predictionComplete.getData().isTeleport()) {
182
            forceExempt();
183
            return;
184
        }
185
186
        boolean wasZero = knockbackPointThree;
187
        knockbackPointThree = false;
188
189
        if (player.likelyKB == null && player.firstBreadKB == null) {
190
            return;
191
        }
192
193
        if (player.predictedVelocity.isFirstBreadKb()) {
194
            firstBreadOnlyKnockback = null;
195
            firstBreadMap.poll(); // Remove from map so we don't pull it again
196
        }
197
198
        if (wasZero || player.predictedVelocity.isKnockback()) {
199
            // Unsure knockback was taken
200
            if (player.firstBreadKB != null) {
201
                player.firstBreadKB.offset = Math.min(player.firstBreadKB.offset, offset);
202
            }
203
204
            // 100% known kb was taken
205
            if (player.likelyKB != null) {
206
                player.likelyKB.offset = Math.min(player.likelyKB.offset, offset);
207
            }
208
        }
209
210
        if (player.likelyKB != null) {
211
            if (player.likelyKB.offset > offsetToFlag) {
212
                threshold = Math.min(threshold + player.likelyKB.offset, ceiling);
213
                if (player.likelyKB.isSetback) { // Don't increase violations if this velocity was setback, just teleport and resend them velocity.
214
                    if (!isNoSetbackPermission()) {
215
                        player.getSetbackTeleportUtil().executeViolationSetback();
216
                    }
217
                } else {
218
                    boolean ignored = player.likelyKB.offset == Integer.MAX_VALUE;
219
                    if (flag(V.write(verbose()).bool(ignored).f64(player.likelyKB.offset))) { // This velocity was sent by the server.
220
                        if (player.likelyKB.offset >= immediate || threshold >= maxAdv) {
221
                            setbackIfAboveSetbackVL();
222
                        }
223
                    } else {
224
                        reward();
225
                    }
226
                }
227
            } else if (threshold > 0.05) {
228
                threshold *= multiplier;
229
            }
230
        }
231
    }
232
233
    public boolean shouldIgnoreForPrediction(VectorData data) {
234
        if (data.isKnockback() && data.isFirstBreadKb()) {
235
            return player.firstBreadKB.offset > offsetToFlag;
236
        }
237
        return false;
238
    }
239
240
    public boolean wouldFlag() {
241
        return (player.likelyKB != null && player.likelyKB.offset > offsetToFlag) || (player.firstBreadKB != null && player.firstBreadKB.offset > offsetToFlag);
242
    }
243
244
    public VelocityData calculateFirstBreadKnockback(int entityID, int transaction) {
245
        tickKnockback(transaction);
246
        if (firstBreadOnlyKnockback != null && firstBreadOnlyKnockback.entityID == entityID)
247
            return firstBreadOnlyKnockback;
248
        return null;
249
    }
250
251
    @Override
252
    public void onReload(@NotNull ConfigManager config) {
253
        offsetToFlag = config.getDoubleElse("Knockback.threshold", 0.001);
254
        maxAdv = config.getDoubleElse("Knockback.max-advantage", 1);
255
        immediate = config.getDoubleElse("Knockback.immediate-setback-threshold", 0.1);
256
        multiplier = config.getDoubleElse("Knockback.setback-decay-multiplier", 0.999);
257
        ceiling = config.getDoubleElse("Knockback.max-ceiling", 4);
258
        if (maxAdv < 0) maxAdv = Double.MAX_VALUE;
259
        if (immediate < 0) immediate = Double.MAX_VALUE;
260
    }
261
262
}

How it counteracts this module

Grim's KnockbackHandler is a PacketSendListener on ENTITY_VELOCITY that sandwiches the packet between two server transactions: one sent before the velocity and a second through tasksAfterSend after it. The velocity is recorded into firstBreadMap keyed by the first transaction id, and tickKnockback promotes an entry into lastKnockbackKnownTaken once a transaction with a larger id arrives, which proves the packet reached the client. From that moment the knockback vector is required movement: the prediction engine must see it in the player's motion, and onPredictionComplete compares the prediction offset against a threshold, set-backing the player when the offset accumulates past the maximum advantage.

The scaling modes are the direct targets. Standard at 0/0, Buffer Abuse while the counter is below the buffer, Vulcan at 0/0 and Watchdog's cancel path all remove the required vector, so the offset is the full knockback and the set-back fires. Standard's 0.6 guard only protects strong hits, which is exactly the range where Grim's threshold (default 0.001) is proportionally small. Tick's delayed stop loses because the vector was required from the moment the sandwich confirmed, before the tick window elapses. Bounce's inversion is also caught, since the prediction expects the original vector, not its negation.

The Grim mode is the honest answer to this check: it cancels the velocity that follows the S19 damage status and sends a C07 digging packet, and Grim's velocity tracking accepts the block interaction as the reason the knockback never appeared in motion. Grim Reduce attacks the target within 14 ticks of the velocity, which Grim's prediction consumes as the knockback being taken. Delay's ping spoofing only stretches the window, it does not remove the requirement, so it still flags against Grim.

anticheat AntiVelocityBasic (pending knockback matching)

AntiVelocityBasic.java46 lines · Java
1
/*
2
 * This file is part of Hawk Anticheat.
3
 * Copyright (C) 2018 Hawk Development Team
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
package me.islandscout.hawk.check.movement.position;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.MovementCheck;
23
import me.islandscout.hawk.check.Cancelless;
24
import me.islandscout.hawk.event.MoveEvent;
25
26
/**
27
 * The AntiVelocityBasic check verifies that players accept knockback.
28
 * It relies on MoveEvent's knockback acceptance detection.
29
 * The AntiVelocityBasic check has been tested to detect as low as a
30
 * 10% difference in horizontal and/or vertical knockback.
31
 */
32
public class AntiVelocityBasic extends MovementCheck implements Cancelless {
33
34
    public AntiVelocityBasic() {
35
        super("antivelocitybasic", true, -1, 5, 0.999, 5000, "%player% may be using anti-velocity (basic), VL: %vl%", null);
36
    }
37
38
    @Override
39
    protected void check(MoveEvent event) {
40
        HawkPlayer pp = event.getHawkPlayer();
41
        if(event.hasFailedKnockback())
42
            punish(pp, false, event);
43
        else
44
            reward(pp);
45
    }
46
}

How it counteracts this module

Hawk's MoveEvent matches every move's current velocity against the list of pending knockbacks. Each pending entry is a vector plus the time the server sent it, and it stays eligible while the elapsed time is within the player's ping plus 200ms. A match requires the move's Y to be within 0.01 of the knockback's Y (unless the player collides, jumps, swims or steps) and X and Z to fall inside a maxDiscrepancy window computed from walk speed, potions and the sprint multiplier, plus an epsilon. When a knockback entry becomes older than ping plus 200ms without any move matching it, failedKnockback is set and the check punishes at 5 VL.

Every cancel mode leaves the entry unmatched. Standard at 0/0, Buffer Abuse for the first N hits, Vulcan at 0/0, Redesky at 0/0 and Watchdog's cancel all produce moves with no knockback component, so the entry expires and flags. A partial reduction (Standard at 50/50) stays under the tolerance only when the scaled-down remainder still sits inside maxDiscrepancy; the stronger the original hit, the larger the absolute gap a fixed percentage leaves, so moderate to heavy reductions flag. Tick and Bounce are also caught: Tick's stop comes after the Y match window, and Bounce's inverted vector fails the Y and X/Z matches outright.

Hawk's tolerance is the bypass surface: small reductions that keep the movement inside maxDiscrepancy pass, and the ping-plus-200ms window forgives a knockback the player has not moved into yet. Among the Rise modes, tiny percentage reductions in Standard sit inside the window, and the Grim mode's C07 digging may satisfy Hawk's block-collision exemption for the Y match, but the cancel family is uniformly flagged.

anticheat UnusedVelocity (unused knockback ledger)

UnusedVelocity.java87 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.moving.player;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.checks.CheckType;
20
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
21
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
22
import fr.neatmonster.nocheatplus.checks.moving.velocity.SimpleAxisVelocity;
23
import fr.neatmonster.nocheatplus.checks.moving.velocity.UnusedTracker;
24
import fr.neatmonster.nocheatplus.logging.debug.DebugUtil;
25
import fr.neatmonster.nocheatplus.players.IPlayerData;
26
import fr.neatmonster.nocheatplus.utilities.CheckUtils;
27
28
public class UnusedVelocity {
29
    
30
    // TODO: Currently is debug only (!). Only call if some debug flag is set. Needs checks.moving.debug to work at all.
31
32
    /**
33
     * Test if any unused velocity has been tracked and what that means. (Convenience.)
34
     * 
35
     * @param player
36
     * @return If the player has failed the check, whatever that means.
37
     */
38
    public static boolean checkUnusedVelocity(final Player player, 
39
            final CheckType checkType, final IPlayerData pData) {
40
        return checkUnusedVelocity(
41
                player, checkType, 
42
                pData.getGenericInstance(MovingData.class), 
43
                pData.getGenericInstance(MovingConfig.class)
44
                );
45
    }
46
47
48
    /**
49
     * Test if any unused velocity has been tracked and what that means.
50
     * 
51
     * @param player
52
     * @param data
53
     * @param cc
54
     * @return If the player has failed the check, whatever that means.
55
     */
56
    public static boolean checkUnusedVelocity(final Player player, 
57
            final CheckType checkType, final MovingData data, final MovingConfig cc) {
58
        boolean violation = false;
59
        final SimpleAxisVelocity verVel = data.getVerticalVelocityTracker();
60
        violation |= quickCheckDirection(player, verVel.unusedTrackerPos, checkType, "vert/pos", data, cc);
61
        violation |= quickCheckDirection(player, verVel.unusedTrackerNeg, checkType, "vert/neg", data, cc);
62
        return violation;
63
    }
64
65
    /**
66
     * Quick check tracker for one direction.
67
     * @param player
68
     * @param checkType 
69
     * @param unusedTrackerPos
70
     * @param string
71
     * @param data
72
     * @param cc
73
     */
74
    private static boolean quickCheckDirection(final Player player, 
75
            final UnusedTracker tracker, final CheckType checkType, final String trackerId ,
76
            MovingData data, MovingConfig cc) {
77
        final int countV = tracker.getResultViolationCount();
78
        if (countV > 0) {
79
            String msg = "Unused velocity " + trackerId + ": c_v: " + countV + " , a_v: " + tracker.getResultViolationAmount() + " , c_u: " + tracker.getResultUpdateCount();
80
            DebugUtil.debug(CheckUtils.getLogMessagePrefix(player, checkType) + msg);
81
        }
82
        tracker.resetResults(); // Reset for now.
83
        // TODO: A real check, e.g. track frequency and/or average amount of violation per so and so time.
84
        return false; // Player can't possibly fail this yet.
85
    }
86
87
}

How it counteracts this module

NCP's movement model queues the vertical velocity the server applies and later consumes it to explain the player's actual movement. SurvivalFly calls checkUnusedVelocity on every move, and the method reads the pos and neg UnusedTracker instances of the SimpleAxisVelocity tracker. UnusedTracker.addValue records a violation amount only when the direction has been blocked since the entry was added, meaning the server pushed velocity in a direction the player never moved, and quickCheckDirection reports the violation count, accumulated amount and update count before resetting.

In this build the check is a debug ledger: quickCheckDirection logs through DebugUtil and returns false with a TODO for a real frequency or amount check, so the player cannot fail it yet. The mechanism it would enforce is the queue model: getOrUseVerticalVelocity consumes queued velocity to explain a vertical move, and a cancelled knockback leaves the queued velocity unused, which is exactly the violation the tracker accumulates. Every Rise cancel mode (Standard at 0/0, Vulcan, Redesky, Watchdog, Buffer Abuse, Tick's stop, Bounce's inversion) would trip that ledger once it is enabled, because the vertical push is never consumed.

The honest statement is the debug-only status itself: a velocity module today faces NCP's SurvivalFly envelope, not this check, and unused velocity only appears in debug output until the TODO is implemented. Partial reductions leave a partial unused remainder, so the ledger would catch them too; the check as shipped cannot flag anything, which is why this entry documents the direction NCP is heading rather than an active counter.

← Back to Analysis Hub