Tenacity 6.0 Sprint module 2 files, 118 lines

Tenacity 6.0 Sprint: Full Source Analysis

Tenacity's Sprint is a one-line key-forcer: every pre-motion tick it sets the vanilla sprint key binding's pressed state to true, except while the Scaffold module is enabled, which walks the client's…

dev/tenacity/module/impl/player/SprintModule.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-10-14

Packets This Module Uses

Analysis

Overview

Tenacity's Sprint is a one-line key-forcer: every pre-motion tick it sets the vanilla sprint key binding's pressed state to true, except while the Scaffold module is enabled, which walks the client's own sprint state machine into sprinting whenever its gates pass (forward input at 0.8 or above, food above 6, not blinded, not using an item), and the vanilla transition code emits the C0B START_SPRINTING entity action on the state change. onDisable releases the key and clears the sprinting state directly. The module builds no packets and changes no server-side state by itself; its entire wire footprint is the C0B stream the vanilla client produces for a permanently held sprint key.

Architecture

The module registers one IEventListener on MotionEvent with no settings. The handler's only guard is a module-repository lookup: if ScaffoldModule is enabled, the listener returns, so the key is never forced while scaffolding. onDisable releases the key binding and calls setSprinting(false) on the player, undoing both the binding state and the entity flag so the sprint state cannot linger after a manual toggle-off.

Key-forcing mechanics

keyBindSprint.pressed = true every tick feeds the vanilla sprint logic in EntityPlayerSP.onLivingUpdate: sprint starts when forward input is at 0.8 or above, food is above 6 (or the player may fly), the player is not blinded and not using an item (Tenacity's NoSlow module can override the item gate), and sprint stops when forward input drops below 0.8, the player collides horizontally, or food drops to 6 or below. The C0B entity action fires only on state transitions: the client compares isSprinting() against serverSprintState and sends START or STOP on change, so the module's permanent key press yields one START per transition, never a packet flood.

Wire footprint and limits

Functionally the module is indistinguishable from a player physically holding the sprint key: same state machine, same gates, same single C0B per transition. Its abuse surface is therefore not a packet anomaly but the sprint-state contract itself: sprinting kept alive through the strafes, item uses (with NoSlow) and boundary conditions that vanilla's forward gate alone cannot police once the state is on. Detection targets that contract: direction-vs-state consistency, redundant status packets, and the hunger window.

source SprintModule.java

SprintModule.java27 lines · JavaOriginal ↗
1
package dev.tenacity.module.impl.player;
2
3
import dev.tenacity.Tenacity;
4
import dev.tenacity.event.IEventListener;
5
import dev.tenacity.event.impl.player.MotionEvent;
6
import dev.tenacity.module.Module;
7
import dev.tenacity.module.ModuleCategory;
8
9
public final class SprintModule extends Module {
10
11
    public SprintModule() {
12
        super("Sprint", "Automatically makes your players sprint state to true", ModuleCategory.PLAYER);
13
    }
14
15
    private final IEventListener<MotionEvent> onMotionEvent = event -> {
16
        if(Tenacity.getInstance().getModuleRepository().getModule(ScaffoldModule.class).isEnabled()) return;
17
18
        mc.gameSettings.keyBindSprint.pressed = true;
19
    };
20
21
    @Override
22
    public void onDisable() {
23
        mc.gameSettings.keyBindSprint.pressed = false;
24
        mc.thePlayer.setSprinting(false);
25
        super.onDisable();
26
    }
27
}

What this file does

The whole module: the MotionEvent listener that forces keyBindSprint.pressed true every tick unless ScaffoldModule is enabled, and the onDisable that releases the key and clears the sprinting state. The module repository lookup makes the Scaffold guard a live dependency on another module's toggle state. No packet is constructed anywhere; the C0B stream is produced entirely by the vanilla sprint transition code downstream of the forced key.

source MotionEvent.java (pre-motion carrier)

MotionEvent.java91 lines · JavaOriginal ↗
1
package dev.tenacity.event.impl.player;
2
3
import dev.tenacity.event.Event;
4
import net.minecraft.entity.player.EntityPlayer;
5
6
public final class MotionEvent extends Event {
7
    private boolean canceled = false;
8
9
    public void setCanceled(boolean canceled) {
10
        this.canceled = canceled;
11
    }
12
13
    public boolean isCanceled() {
14
        return canceled;
15
    }
16
    private double x, y, z;
17
    private float yaw, pitch;
18
    private boolean onGround;
19
20
    public MotionEvent(final double x, final double y, final double z, final float yaw, final float pitch, final boolean onGround) {
21
        this.x = x;
22
        this.y = y;
23
        this.z = z;
24
        this.yaw = yaw;
25
        this.pitch = pitch;
26
        this.onGround = onGround;
27
    }
28
29
    public double getX() {
30
        return x;
31
    }
32
33
    public double getY() {
34
        return y;
35
    }
36
37
    public double getZ() {
38
        return z;
39
    }
40
41
    public float getYaw() {
42
        return yaw;
43
    }
44
45
    public float getPitch() {
46
        return pitch;
47
    }
48
49
    public boolean isOnGround() {
50
        return onGround;
51
    }
52
53
    public void setX(final double x) {
54
        this.x = x;
55
    }
56
57
    public void setY(final double y) {
58
        this.y = y;
59
    }
60
61
    public void setZ(final double z) {
62
        this.z = z;
63
    }
64
65
    public void setYaw(final float yaw) {
66
        this.yaw = yaw;
67
    }
68
69
    public void setPitch(final float pitch) {
70
        this.pitch = pitch;
71
    }
72
73
    public void setOnGround(final boolean onGround) {
74
        this.onGround = onGround;
75
    }
76
    private EntityPlayer player;
77
78
    public MotionEvent(EntityPlayer player, double x, double y, double z, float yaw, float pitch, boolean onGround) {
79
        this.player = player;
80
        this.x = x;
81
        this.y = y;
82
        this.z = z;
83
        this.yaw = yaw;
84
        this.pitch = pitch;
85
        this.onGround = onGround;
86
    }
87
    public EntityPlayer getPlayer() {
88
        return this.player;
89
    }
90
}

What this file does

The pre-motion event the module hooks. Its constructor is invoked by the client's movement pipeline once per tick (the exact cadence of the key-forcing), and its x, y, z, yaw, pitch and onGround fields mirror the values that serialize into the next C03PacketPlayer, the packet that precedes the sprint-state transition check in the vanilla update order. The event's cancel flag and player reference go unused here; the module only needs the dispatch to run.

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 SprintDirection (sprint-state direction cone)

SprintDirection.java128 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.event.MoveEvent;
24
import me.islandscout.hawk.util.Direction;
25
import me.islandscout.hawk.util.MathPlus;
26
import me.islandscout.hawk.wrap.entity.WrappedEntity;
27
import org.bukkit.Material;
28
import org.bukkit.block.Block;
29
import org.bukkit.entity.Player;
30
import org.bukkit.util.Vector;
31
32
import java.util.*;
33
34
public class SprintDirection extends MovementCheck {
35
36
    //TODO If jump and dY is 0, that means they POSSIBLY could have jumped; not always. eg: SprintDirection falses with extreme negative jump boost or jumping into a 2-block-high space.
37
38
    private Map<UUID, Long> lastSprintTickMap;
39
    private Set<UUID> collisionHorizontalSet;
40
41
    public SprintDirection() {
42
        super("sprintdirection", true, 5, 5, 0.999, 5000, "%player% failed sprint direction, VL %vl%", null);
43
        lastSprintTickMap = new HashMap<>();
44
        collisionHorizontalSet = new HashSet<>();
45
    }
46
47
    @Override
48
    protected void check(MoveEvent e) {
49
        HawkPlayer pp = e.getHawkPlayer();
50
51
        boolean collisionHorizontal = collidingHorizontally(e);
52
        Vector moveHoriz = e.getTo().toVector().subtract(e.getFrom().toVector()).setY(0);
53
54
        if(!pp.isSprinting())
55
            lastSprintTickMap.put(pp.getUuid(), pp.getCurrentTick());
56
57
        Set<Material> collidedMats = WrappedEntity.getWrappedEntity(e.getPlayer()).getCollisionBox(e.getFrom().toVector()).getMaterials(pp.getWorld());
58
        if(pp.isSwimming() || e.isTeleportAccept() || e.hasAcceptedKnockback() ||
59
                (collisionHorizontal && !collisionHorizontalSet.contains(pp.getUuid())) ||
60
                pp.getCurrentTick() - lastSprintTickMap.getOrDefault(pp.getUuid(), pp.getCurrentTick()) < 2 ||
61
                moveHoriz.lengthSquared() < 0.04 || collidedMats.contains(Material.LADDER) ||
62
                collidedMats.contains(Material.VINE)) {
63
            return;
64
        }
65
66
        float yaw = e.getTo().getYaw();
67
        Vector prevVelocity = pp.getVelocity().clone();
68
69
        List<Block> activeBlocks = e.getActiveBlocks();
70
        for(Block b : activeBlocks) {
71
            if(b.getType() == Material.SOUL_SAND) {
72
                prevVelocity.multiply(0.4); //which would you prefer: iterative multiplication or using Math.pow()?
73
            }
74
            if(b.getType() == Material.WEB) {
75
                prevVelocity.multiply(0);
76
                break; //Any number times 0 is 0; no reason to continue looping.
77
            }
78
        }
79
80
        if(e.hasHitSlowdown()) {
81
            prevVelocity.multiply(0.6);
82
        }
83
        double dX = e.getTo().getX() - e.getFrom().getX();
84
        double dZ = e.getTo().getZ() - e.getFrom().getZ();
85
        float friction = e.getFriction();
86
        dX /= friction;
87
        dZ /= friction;
88
        if(e.isJump()) {
89
            float yawRadians = yaw * 0.017453292F;
90
            dX += (MathPlus.sin(yawRadians) * 0.2F);
91
            dZ -= (MathPlus.cos(yawRadians) * 0.2F);
92
        }
93
94
        //Div by 1.7948708571637845???? What the hell are these numbers?
95
96
        dX -= prevVelocity.getX();
97
        dZ -= prevVelocity.getZ();
98
99
        Vector moveForce = new Vector(dX, 0, dZ);
100
        Vector yawVec = MathPlus.getDirection(yaw, 0);
101
102
        if(MathPlus.angle(yawVec, moveForce) > Math.PI / 4 + 0.3) { //0.3 is arbitrary. Prevents falses due to silly stuff in game
103
            punishAndTryRubberband(pp, e);
104
        }
105
        else {
106
            reward(pp);
107
        }
108
109
        if(collisionHorizontal)
110
            collisionHorizontalSet.add(pp.getUuid());
111
        else
112
            collisionHorizontalSet.remove(pp.getUuid());
113
    }
114
115
    private boolean collidingHorizontally(MoveEvent e) {
116
        for(Direction dir : e.getBoxSidesTouchingBlocks()) {
117
            if(dir == Direction.EAST || dir == Direction.NORTH || dir == Direction.SOUTH || dir == Direction.WEST)
118
                return true;
119
        }
120
        return false;
121
    }
122
123
    @Override
124
    public void removeData(Player p) {
125
        lastSprintTickMap.remove(p.getUniqueId());
126
        collisionHorizontalSet.remove(p.getUniqueId());
127
    }
128
}

How it counteracts this module

Hawk's SprintDirection polices the contract between sprint state and movement direction. It records the last tick the player was not sprinting and only evaluates once sprint has been active for at least two ticks, then reconstructs the expected move from the tracked velocity (adjusting for soul sand, webs, hit slowdown, friction and the 0.2 forward component of a jump) and compares the actual horizontal move against the yaw vector: an angle beyond pi/4 + 0.3 radians (~62 degrees) punishes with a rubber-band. Teleport-accepted moves, knockback, swimming, wall collisions and ladder/vine contact are exempted.\n\nThe forced key keeps sprint state alive through the strafes and velocity changes that a physically held key would also survive, so the check's cone is the boundary of the module's reach: straight runs and W-A diagonals sit inside the tolerance, while any sprinting move pushed beyond the cone (hard strafes into knockback, or direction changes the forward gate alone cannot police) rubber-bands. The 2-tick grace and the exemptions are the check's honest tolerance; within them, vanilla-compliant sprinting passes.

anticheat BadPacketsF (duplicate sprint status)

BadPacketsF.java59 lines · Java
1
package ac.grim.grimac.checks.impl.badpackets;
2
3
import ac.grim.grimac.api.storage.verbose.Verbose;
4
import ac.grim.grimac.checks.Check;
5
import ac.grim.grimac.checks.CheckData;
6
import ac.grim.grimac.checks.type.PreViaPacketReceiveListener;
7
import ac.grim.grimac.player.GrimPlayer;
8
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
9
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
10
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction;
11
12
@CheckData(name = "BadPacketsF", stableKey = "grim.badpackets.duplicate_sprint", description = "Sent duplicate sprinting status")
13
public class BadPacketsF extends Check implements PreViaPacketReceiveListener {
14
    private static final Verbose V = Verbose.of("state={bool}");
15
16
    public boolean lastSprinting;
17
    public boolean exemptNext = true; // Support 1.14+ clients starting on either true or false sprinting, we don't know
18
19
    public BadPacketsF(GrimPlayer player) {
20
        super(player);
21
    }
22
23
    @Override
24
    public void onPreViaPacketReceive(PacketReceiveEvent event) {
25
        if (event.getPacketType() == PacketType.Play.Client.ENTITY_ACTION) {
26
            WrapperPlayClientEntityAction packet = new WrapperPlayClientEntityAction(event);
27
28
            if (packet.getAction() == WrapperPlayClientEntityAction.Action.START_SPRINTING) {
29
                if (lastSprinting) {
30
                    if (exemptNext) {
31
                        exemptNext = false;
32
                        return;
33
                    }
34
                    boolean state = true;
35
                    if (flag(V.write(verbose()).bool(state)) && shouldModifyPackets()) {
36
                        event.setCancelled(true);
37
                        player.onPacketCancel();
38
                    }
39
                }
40
41
                lastSprinting = true;
42
            } else if (packet.getAction() == WrapperPlayClientEntityAction.Action.STOP_SPRINTING) {
43
                if (!lastSprinting) {
44
                    if (exemptNext) {
45
                        exemptNext = false;
46
                        return;
47
                    }
48
                    boolean state = false;
49
                    if (flag(V.write(verbose()).bool(state)) && shouldModifyPackets()) {
50
                        event.setCancelled(true);
51
                        player.onPacketCancel();
52
                    }
53
                }
54
55
                lastSprinting = false;
56
            }
57
        }
58
    }
59
}

How it counteracts this module

Grim's BadPacketsF validates the C0B state machine itself: a START_SPRINTING while the server already tracks sprinting, or a STOP while it does not, is a redundant status packet and is flagged and cancelled (one transition is exempt to support 1.14+ clients whose initial sprint state is unknown). The check runs as a PreViaPacketReceiveListener, so the duplicate packet is cancelled before ViaVersion or the server processes it.\n\nThe re-asserted key press is what produces the redundant status: the client's own stop conditions (horizontal collision or the food boundary at line 858 of the bundled EntityPlayerSP) can drop sprint state and re-start it within the same tick window, before the transition sender records the change, yielding two STARTs with no STOP between them. Each such duplicate is cancelled and flagged. The single exempt transition is the tolerance; beyond it, every repeated status packet is evidence.

anticheat SprintA (hunger gate window)

SprintA.java35 lines · Java
1
package ac.grim.grimac.checks.impl.sprint;
2
3
import ac.grim.grimac.api.storage.verbose.Verbose;
4
import ac.grim.grimac.checks.Check;
5
import ac.grim.grimac.checks.CheckData;
6
import ac.grim.grimac.checks.type.PostPredictionListener;
7
import ac.grim.grimac.player.GrimPlayer;
8
import ac.grim.grimac.utils.anticheat.update.PredictionComplete;
9
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
10
11
@CheckData(name = "SprintA", stableKey = "grim.sprint.hunger", description = "Sprinting with too low hunger", setback = 0)
12
public class SprintA extends Check implements PostPredictionListener {
13
    private static final Verbose V = Verbose.of("hunger={uint}");
14
15
    public SprintA(GrimPlayer player) {
16
        super(player);
17
    }
18
19
    @Override
20
    public void onPredictionComplete(PredictionComplete predictionComplete) {
21
        if (!predictionComplete.isChecked()) return;
22
23
        // Players can sprint if they're able to fly
24
        // Players can also sprint if they are on a camel, regardless of their hunger level
25
        if (player.canFly || EntityTypes.isTypeInstanceOf(player.getVehicleType(), EntityTypes.CAMEL)) return;
26
27
        if (player.food <= 6.0F) {
28
            if (player.isSprinting) {
29
                flagWithSetback(V.write(verbose()).uint(player.food));
30
            } else {
31
                reward();
32
            }
33
        }
34
    }
35
}

How it counteracts this module

Grim's SprintA runs after each prediction and flags whenever the server-tracked food level is at or below 6.0 while the player is sprinting, with exemptions for fly-capable players and camel riders. The check is stable (non-experimental) and carries no setback of its own.\n\nThe client-side gate is strictly food above 6, so the module cannot start sprint at the boundary, but the check's window is the drop: when food falls to 6 or below while sprint is already on, the client's stop transition fires on the next tick, and in the window where the server still tracks sprint state with food at the boundary, the check flags. Clients that bypass the hunger gate entirely are caught directly on every sprinting tick; the module itself only ever reaches the check's window at the boundary, which is the honest scope of this counter. The reward-on-legit path keeps the check quiet during normal full-hunger sprinting.

anticheat ToggleFrequency (C0B toggle ledger)

ToggleFrequency.java61 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.net;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.checks.Check;
20
import fr.neatmonster.nocheatplus.checks.CheckType;
21
import fr.neatmonster.nocheatplus.players.IPlayerData;
22
import fr.neatmonster.nocheatplus.utilities.TickTask;
23
24
/**
25
 * The ToggleFrequency check is used to detect players who toggle certain actions too quickly (i.e.: sneaking).
26
 */
27
public class ToggleFrequency extends Check {
28
29
    /**
30
     * Instantiates a new toggle frequency check.
31
     */
32
    public ToggleFrequency() {
33
        super(CheckType.NET_TOGGLEFREQUENCY);
34
    }
35
36
    /**
37
     * Checks a player.
38
     * 
39
     * @param player
40
     *            the player
41
     * @param data
42
     * @param cc
43
     * @param pData
44
     * @return true, if successful
45
     */
46
    public boolean check(final Player player, final NetData data, final NetConfig cc, final IPlayerData pData) {
47
        boolean cancel = false;
48
        // (Addition to frequency is done in the listener for each toggle event)
49
        // Full time resolution
50
        final long actionFullTime = data.playerActionFreq.bucketDuration() * data.playerActionFreq.numberOfBuckets();
51
        /** Toggle action events counted */
52
        final float fullActionScore = data.playerActionFreq.score(1f) / TickTask.getLag(actionFullTime);
53
        final double violation = fullActionScore > cc.toggleActionLimit ? fullActionScore - cc.toggleActionLimit : 0.0;
54
        if (violation > 0.0) {
55
            data.toggleFrequencyVL += violation;
56
            cancel = executeActions(player, data.toggleFrequencyVL, violation, cc.toggleFrequencyActions).willCancel();
57
        }
58
        else data.toggleFrequencyVL *= 0.9;
59
        return cancel;
60
    }
61
}

How it counteracts this module

NoCheatPlus's ToggleFrequency counts toggle actions (every sprint or sneak start-or-stop scored into data.playerActionFreq) over the full window, divides by the lag factor, and flags when the sustained toggle rate exceeds cc.toggleActionLimit, accumulating toggleFrequencyVL and running the configured cancel actions; the VL decays by 0.9 on clean ticks.\n\nAlways-sprint setups feed this check through the toggle patterns they enable: sprint-state flicker at the boundary conditions (wall collisions, hunger drops, item uses) turns the module's re-asserted key into rapid START/STOP cycles, and any WTap-style macro layered on top of the forced key pushes the ledger past the limit on a sustained basis. The honest scope is the same as the module's wire footprint: a clean always-on sprint emits a single START and never trips the ledger: the check catches the toggling abuse that sprint automation enables, not the steady state itself.

← Back to Analysis Hub