Rise 5.99 AimAssist module 2 files, 315 lines

Rise 5.99 AimAssist: Full Source Analysis

Rise 5.99's AimAssist is a mouse-delta assist that steers the player's real view rotation toward the nearest valid target.

dev/rise/module/impl/ghost/AimAssist.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-08-13

Packets This Module Uses

Analysis

Overview

Rise 5.99's AimAssist is a mouse-delta assist that steers the player's real view rotation toward the nearest valid target. onPreMotion resolves the closest entity under the players, non-players, teams, invisibles and dead filters, computes the smoothed error to the target's interpolated position, divides it by a strength-derived step, and quantizes the result into whole mouse deltas using the sensitivity GCD. onRender3D applies those deltas through setAngles on every render frame while the left mouse button is down (onlyClick is on by default), so the rotation that reaches the server inside C03 is the player's own rotation, gently pulled toward the target in gcd-sized steps rather than snapped. The strength setting, the +1.0 jitter on the target angles, the fixed-rotation smoothing against Aura's last rotations and the pitch clamp all exist to make that pull look like mouse movement.

Rotation math

The step size comes from the strength setting: s = (strength maximum minus the value) plus one, and the per-tick correction is (target rotation minus current rotation) divided by max(2, s), so a low strength value produces a large divisor and a slow pull, and strength 50 (s = 1) still divides by at least 2. The target angles are jittered by a random double before the error is computed, and getRotations feeds the raw angles through RotationUtil.getFixedRotation against Aura's last rotations, which clamps the per-update change to the smoothed rate the aura machinery allows, before the pitch is clamped to plus or minus 90. The result is a rotation that approaches the target exponentially and never overshoots.

GCD quantization and application

The mouse sensitivity is folded into the classic 1.8 GCD formula: f = sensitivity times 0.6 plus 0.2, gcd = f cubed times 8. deltaX and deltaY are computed as round(niggaYaw / gcd) and round(niggaPitch / gcd), so every applied correction is a whole number of gcd steps. onRender3D then rebuilds the delta as (mouse delta plus the stored correction minus the mouse delta), multiplies back by the gcd, applies the invert-mouse sign to the pitch, and calls setAngles only while the left button is held and no screen is open (onlyClick), or unconditionally when onlyClick is off. Because setAngles modifies the real rotation, the C03 stream carries the corrected rotation, and because the correction is re-derived from the live mouse delta each frame, the module composes with the player's own mouse input rather than replacing it.

Targeting

getClosest walks the loaded entity list, keeping the nearest living entity within range that passes canAttack: players, animals, mobs and villagers are filtered by their toggles, invisibles and dead entities by theirs, team-mates are skipped when teams is on, AntiBot-listed entities are always skipped, entities younger than two ticks are ignored, friends are excluded by name, and the player itself is never a target. The target is a static field shared with the rest of the combat modules. onDisable zeroes the stored deltas so a disabled module leaves no pending correction.

source AimAssist.java (mouse-delta assist)

AimAssist.java204 lines · JavaOriginal ↗
1
/*
2
 Copyright Alan Wood 2021
3
 None of this code to be reused without my written permission
4
 Intellectual Rights owned by Alan Wood
5
 */
6
package dev.rise.module.impl.ghost;
7
8
import dev.rise.Rise;
9
import dev.rise.event.impl.motion.PreMotionEvent;
10
import dev.rise.event.impl.render.Render3DEvent;
11
import dev.rise.module.Module;
12
import dev.rise.module.api.ModuleInfo;
13
import dev.rise.module.enums.Category;
14
import dev.rise.module.impl.combat.AntiBot;
15
import dev.rise.module.impl.combat.Aura;
16
import dev.rise.setting.impl.BooleanSetting;
17
import dev.rise.setting.impl.NoteSetting;
18
import dev.rise.setting.impl.NumberSetting;
19
import dev.rise.util.player.PlayerUtil;
20
import dev.rise.util.player.RotationUtil;
21
import net.minecraft.entity.Entity;
22
import net.minecraft.entity.EntityLivingBase;
23
import net.minecraft.entity.monster.EntityMob;
24
import net.minecraft.entity.passive.EntityAnimal;
25
import net.minecraft.entity.passive.EntityVillager;
26
import net.minecraft.entity.player.EntityPlayer;
27
import net.minecraft.util.MathHelper;
28
import org.apache.commons.lang3.RandomUtils;
29
import org.lwjgl.input.Mouse;
30
31
@ModuleInfo(name = "AimAssist", description = "Helps you aim at people", category = Category.LEGIT)
32
public final class AimAssist extends Module {
33
34
    public static EntityLivingBase target;
35
36
    private final NumberSetting strength = new NumberSetting("Strength", this, 40, 1, 50, 0.1);
37
    private final NumberSetting range = new NumberSetting("Range", this, 6, 0.1, 10, 0.1);
38
    private final BooleanSetting onlySword = new BooleanSetting("Only Sword", this, false);
39
    private final BooleanSetting onlyClick = new BooleanSetting("Only Clicking", this, true);
40
    private final BooleanSetting vertical = new BooleanSetting("Vertical", this, true);
41
42
    private final NoteSetting note = new NoteSetting("Targets", this);
43
    private final BooleanSetting players = new BooleanSetting("Players", this, true);
44
    private final BooleanSetting nonPlayers = new BooleanSetting("Non Players", this, true);
45
    private final BooleanSetting teams = new BooleanSetting("Teams", this, true);
46
    private final BooleanSetting invisibles = new BooleanSetting("Invisibles", this, false);
47
    private final BooleanSetting dead = new BooleanSetting("Dead", this, false);
48
49
    public static int deltaX, deltaY;
50
51
    @Override
52
    public void onPreMotion(final PreMotionEvent event) {
53
        target = getClosest(range.getValue());
54
55
        final float s = (float) (strength.getMaximum() - strength.getValue()) + 1;
56
57
        if (target == null || onlySword.isEnabled() && !PlayerUtil.isHoldingSword() || !mc.thePlayer.canEntityBeSeen(target)) {
58
            deltaX = deltaY = 0;
59
            return;
60
        }
61
62
        final float[] rotations = getRotations();
63
64
        final float targetYaw = (float) (rotations[0] + Math.random());
65
        final float targetPitch = (float) (rotations[1] + Math.random());
66
67
        final float niggaYaw = (targetYaw - mc.thePlayer.rotationYaw) / Math.max(2, s);
68
        final float niggaPitch = (targetPitch - mc.thePlayer.rotationPitch) / Math.max(2, s);
69
70
        final float f = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
71
        final float gcd = f * f * f * 8.0F;
72
73
        deltaX = Math.round(niggaYaw / gcd);
74
75
        if (vertical.isEnabled()) deltaY = Math.round(niggaPitch / gcd);
76
        else deltaY = 0;
77
    }
78
79
    @Override
80
    public void onRender3DEvent(final Render3DEvent event) {
81
82
        final float f = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
83
        final float gcd = f * f * f * 8.0F;
84
85
        int i = mc.gameSettings.invertMouse ? -1 : 1;
86
        float f2 = (float) (this.mc.mouseHelper.deltaX + (deltaX - this.mc.mouseHelper.deltaX)) * gcd;
87
        float f3 = vertical.isEnabled() ? (float) (this.mc.mouseHelper.deltaY - (deltaY - this.mc.mouseHelper.deltaY)) * gcd : 0;
88
89
        if (!this.onlyClick.isEnabled() || Mouse.isButtonDown(0) && mc.currentScreen == null) this.mc.thePlayer.setAngles(f2, f3 * (float) i);
90
    }
91
92
    @Override
93
    protected void onDisable() {
94
        deltaX = 0;
95
        deltaY = 0;
96
    }
97
98
    /**
99
     * Gets the closest target in a range for the aura to decide which entity it will attack.
100
     *
101
     * @param range The maximum range the closest entity will be searched for.
102
     * @return The closest entity in a range.
103
     */
104
    private EntityLivingBase getClosest(final double range) {
105
        if (mc.theWorld == null) return null;
106
107
        double dist = range;
108
        EntityLivingBase target = null;
109
110
        for (final Entity entity : mc.theWorld.loadedEntityList) {
111
112
            if (entity instanceof EntityLivingBase && !AntiBot.bots.contains(entity)) {
113
                final EntityLivingBase livingBase = (EntityLivingBase) entity;
114
115
                if (canAttack(livingBase)) {
116
                    final double currentDist = mc.thePlayer.getDistanceToEntity(livingBase);
117
118
                    if (currentDist <= dist) {
119
                        dist = currentDist;
120
                        target = livingBase;
121
                    }
122
                }
123
            }
124
        }
125
126
        return target;
127
    }
128
129
    private boolean canAttack(final EntityLivingBase player) {
130
        if (player instanceof EntityPlayer && !players.isEnabled()) {
131
            return false;
132
        }
133
134
        if (player instanceof EntityAnimal || player instanceof EntityMob || player instanceof EntityVillager) {
135
            if (!nonPlayers.isEnabled())
136
                return false;
137
        }
138
139
        if (player.isInvisible() && !invisibles.isEnabled())
140
            return false;
141
142
        if (player.isDead && !dead.isEnabled())
143
            return false;
144
145
        if (AntiBot.bots.contains(player))
146
            return false;
147
148
        if (player.isOnSameTeam(mc.thePlayer) && teams.isEnabled())
149
            return false;
150
151
        if (player.ticksExisted < 2)
152
            return false;
153
154
        for (final String name : Rise.INSTANCE.getFriends()) {
155
            if (name.equals(player.getCommandSenderName())) {
156
                return false;
157
            }
158
        }
159
160
        return mc.thePlayer != player;
161
    }
162
163
    private float[] getRotations() {
164
        /*
165
         * Using some basic math this method gets the rotations needed to look inside an entities BoundingBox.
166
         *
167
         * Credits to Alan
168
         */
169
        final double var4 = (target.posX - (target.lastTickPosX - target.posX)) + 0.01 - mc.thePlayer.posX;
170
        final double var6 = (target.posZ - (target.lastTickPosZ - target.posZ)) - mc.thePlayer.posZ;
171
        final double var8 = (target.posY - (target.lastTickPosY - target.posY)) + 0.4 + target.getEyeHeight() / 1.3 - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight());
172
173
        final double var14 = MathHelper.sqrt_double(var4 * var4 + var6 * var6);
174
175
        float yaw = (float) (Math.atan2(var6, var4) * 180.0D / Math.PI) - 90.0F;
176
        float pitch = (float) -(Math.atan2(var8, var14) * 180.0D / Math.PI);
177
178
        yaw = mc.thePlayer.rotationYaw + MathHelper.wrapAngleTo180_float(yaw - mc.thePlayer.rotationYaw);
179
        pitch = mc.thePlayer.rotationPitch + MathHelper.wrapAngleTo180_float(pitch - mc.thePlayer.rotationPitch);
180
181
182
        /*
183
         * Gets the current and last rotations and smooths them for aura to be harder to flag.
184
         */
185
        final float[] rotations = new float[]{yaw, pitch};
186
        final float[] lastRotations = new float[]{Aura.yaw, Aura.pitch};
187
188
        final float[] fixedRotations = RotationUtil.getFixedRotation(rotations, lastRotations);
189
190
        yaw = fixedRotations[0];
191
        pitch = fixedRotations[1];
192
193
194
        // Clamps the pitch so that aura doesn't flag everything with an illegal rotation.
195
        pitch = MathHelper.clamp_float(pitch, -90.0F, 90.0F);
196
197
        return new float[]{yaw, pitch};
198
    }
199
200
    public double randomBetween(final double min, final double max) {
201
        return ((Math.random() * ((RandomUtils.nextDouble(max, max + 1)) - RandomUtils.nextDouble(min, min + 1)) + 1) + min);
202
    }
203
204
}

What this file does

The module is two handlers and a target scan. onPreMotion resolves the closest valid target and computes the correction: the strength-derived divisor s, the jittered target angles, the fixed-rotation smoothing against Aura's stored rotations, and finally the GCD quantization that converts the floating-point error into whole mouse deltas (round(niggaYaw / gcd)). The vertical correction is suppressed entirely when the vertical toggle is off. onRender3D applies the stored deltas through setAngles on every frame, gated by onlyClick and the invert-mouse sign, which moves the actual view rotation in gcd steps. The targeting half walks loadedEntityList with the canAttack filter chain. The wire presence of the module is the C03 rotation stream: gcd-quantized, smoothed steps toward a target while the button is held, with the rotation otherwise following the player's own mouse.

source RotationUtil.java (fixed-rotation smoother)

RotationUtil.java111 lines · JavaOriginal ↗
1
package dev.rise.util.player;
2
3
import lombok.experimental.UtilityClass;
4
import net.minecraft.client.Minecraft;
5
6
@UtilityClass
7
public final class RotationUtil {
8
9
    /**
10
     * These are the rotations seen by the server.
11
     */
12
    public float serverYaw, serverPitch;
13
14
    public int uwu = 5;//0;
15
16
    /**
17
     * Smooths the current rotation using the last for it to make aura harder to flag.
18
     *
19
     * @param rotations     Current rotations.
20
     * @param lastRotations Last rotations.
21
     * @return Current rotation smoothed according to last.
22
     */
23
    public float[] getFixedRotation(final float[] rotations, final float[] lastRotations) {
24
        final Minecraft mc = Minecraft.getMinecraft();
25
26
        final float yaw = rotations[0];
27
        final float pitch = rotations[1];
28
29
        final float lastYaw = lastRotations[0];
30
        final float lastPitch = lastRotations[1];
31
32
        final float f = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
33
        final float gcd = f * f * f * 1.2F;
34
35
        final float deltaYaw = yaw - lastYaw;
36
        final float deltaPitch = pitch - lastPitch;
37
38
        final float fixedDeltaYaw = deltaYaw - (deltaYaw % gcd);
39
        final float fixedDeltaPitch = deltaPitch - (deltaPitch % gcd);
40
41
        final float fixedYaw = lastYaw + fixedDeltaYaw;
42
        final float fixedPitch = lastPitch + fixedDeltaPitch;
43
44
        return new float[]{fixedYaw, fixedPitch};
45
    }
46
47
    /**
48
     * Limits the rotation on given limits.
49
     *
50
     * @param currRot   Current rotation.
51
     * @param targetRot The rotation wanted.
52
     * @param turnSpeed The maximum turn speed we allow.
53
     * @return The limited angle change.
54
     */
55
    public float[] limitAngleChange(final float[] currRot, final float[] targetRot, final float turnSpeed) {
56
        final float currentYaw = currRot[0];
57
        final float currentPitch = currRot[1];
58
59
        final float targetYaw = targetRot[0];
60
        final float targetPitch = targetRot[1];
61
62
        final float yawDifference = getAngleDifference(targetYaw, currentYaw);
63
        final float pitchDifference = getAngleDifference(targetPitch, currentPitch);
64
65
        final float limitedYaw = currentYaw + (yawDifference > turnSpeed ? turnSpeed : Math.max(yawDifference, -turnSpeed));
66
        final float limitedPitch = currentPitch + (pitchDifference > turnSpeed ? turnSpeed : Math.max(pitchDifference, -turnSpeed));
67
68
        return new float[]{limitedYaw, limitedPitch};
69
    }
70
71
    public float getAngleDifference(final float a, final float b) {
72
        return ((((a - b) % 360F) + 540F) % 360F) - 180F;
73
    }
74
75
   /* public boolean validate() {
76
        try {
77
            final HttpsURLConnection connection =
78
                    (HttpsURLConnection) new URL("https://intent.store/product/25/whitelist?hwid=" + HWID.getHardwareID())
79
                            .openConnection();
80
81
            connection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0");
82
83
            final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
84
85
            String currentln;
86
            final ArrayList<String> response = new ArrayList<>();
87
88
            while ((currentln = in.readLine()) != null) {
89
                response.add(currentln);
90
            }
91
92
            if (!response.contains("true") || response.contains("false")) {
93
                for (int i = 0; i < 0; i = 2) {
94
95
                }
96
                return false;
97
            }
98
        } catch (final Exception e) {
99
            for (int i = 0; i < 0; i = 2) {
100
101
            }
102
            return false;
103
        }
104
105
        AuthGUI.sr = new ScaledResolution(Minecraft.getMinecraft());
106
        uwu = 5;
107
108
        return true;
109
    }*/
110
111
}

What this file does

getFixedRotation is the smoothing layer the assist leans on. It takes the desired rotation and the last rotation, computes the wrapped per-axis difference, and caps the change so the output never moves more than the allowed step per call; the assist feeds it the raw aim angles and Aura's previous rotations, so the per-tick rotation change is bounded before the GCD quantization ever sees it. The same utility serves the Kill Aura rotation system, which is why the assist and the aura share one smoothness budget: the assist's output is post-smoothed by the same function the aura uses for its own silent rotations, keeping the two on a consistent rate.

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 AimbotConvergence (fixed convergence point)

AimbotConvergence.java84 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.look;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.CustomCheck;
23
import me.islandscout.hawk.event.Event;
24
import me.islandscout.hawk.event.MoveEvent;
25
import me.islandscout.hawk.util.*;
26
import org.bukkit.entity.Player;
27
import org.bukkit.util.Vector;
28
29
import java.util.*;
30
31
public class AimbotConvergence extends CustomCheck {
32
33
    //You better turn off your aimbot when your opponent is standing still!
34
    //Flags basic aimbots that update rotation before motion updates
35
36
    private Map<UUID, Vector> lastConvergencePointMap;
37
38
    public AimbotConvergence() {
39
        super("aimbotconvergence", true, -1, 5, 0.999, 5000, "%player% failed aimbot (convergence), VL: %vl%", null);
40
        this.lastConvergencePointMap = new HashMap<>();
41
    }
42
43
    @Override
44
    protected void check(Event event) {
45
        if(event instanceof MoveEvent) {
46
            MoveEvent e = (MoveEvent) event;
47
            HawkPlayer pp = e.getHawkPlayer();
48
            if(!e.hasDeltaPos())
49
                return;
50
            UUID uuid = pp.getUuid();
51
            Vector prePos = e.getFrom().toVector().clone().subtract(pp.getVelocity()).add(new Vector(0, 1.62, 0));
52
            Vector postPos = e.getFrom().toVector().add(new Vector(0, 1.62, 0));
53
            Vector preDir = e.getFrom().getDirection();
54
            Vector postDir = e.getTo().getDirection();
55
            Pair<Vector, Vector> points = new Ray(prePos, preDir).closestPointsBetweenLines(new Ray(postPos, postDir));
56
57
            Vector lastConvergence = lastConvergencePointMap.get(uuid);
58
            Vector convergence = points.getKey().add(points.getValue()).multiply(0.5);
59
60
            if(lastConvergence != null &&
61
                    //make sure TPs don't false this check
62
                    pp.getCurrentTick() - pp.getLastTeleportAcceptTick() > ServerUtils.getPing(e.getPlayer()) / 50 + 10 &&
63
                    pp.getCurrentTick() > 100) {
64
65
                double distance = lastConvergence.distanceSquared(convergence);
66
                if(!Double.isNaN(distance)) {
67
68
                    if(distance < 0.00000001) //TODO convergence point should be some distance away from head position to filter some falses
69
                        punish(pp, false, e);
70
                    else
71
                        reward(pp);
72
73
                }
74
            }
75
76
            lastConvergencePointMap.put(uuid, convergence);
77
        }
78
    }
79
80
    @Override
81
    public void removeData(Player p) {
82
        lastConvergencePointMap.remove(p.getUniqueId());
83
    }
84
}

How it counteracts this module

AimbotConvergence builds a ray from each consecutive pair of head positions and directions, computes the closest point between the pre-move and post-move rays, and flags when that convergence point stays fixed across moves (squared distance under 1e-8), with teleport and early-tick exemptions. The comment in the check's source states the failure mode directly: 'You better turn off your aimbot when your opponent is standing still'. The assist's steady state is exactly that: the view is pulled toward the target's head on every frame, so the rays from the moving player converge on the target's head location and the convergence point does not move, which is a punishment. The assist cannot shed the signature by slowing down, because any nonzero pull keeps the convergence on the target; the only escape is a target that moves erratically enough to shift the convergence point every tick.

anticheat Angle (attack-stream analysis)

Angle.java255 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.fight;
16
17
import java.util.Iterator;
18
import java.util.LinkedList;
19
import java.util.List;
20
import java.util.UUID;
21
22
import org.bukkit.ChatColor;
23
import org.bukkit.Location;
24
import org.bukkit.entity.Entity;
25
import org.bukkit.entity.Player;
26
27
import fr.neatmonster.nocheatplus.actions.ParameterName;
28
import fr.neatmonster.nocheatplus.checks.Check;
29
import fr.neatmonster.nocheatplus.checks.CheckType;
30
import fr.neatmonster.nocheatplus.checks.ViolationData;
31
import fr.neatmonster.nocheatplus.permissions.Permissions;
32
import fr.neatmonster.nocheatplus.players.IPlayerData;
33
import fr.neatmonster.nocheatplus.utilities.StringUtil;
34
import fr.neatmonster.nocheatplus.utilities.TickTask;
35
import fr.neatmonster.nocheatplus.utilities.math.TrigUtil;
36
37
/**
38
 * A check used to verify if the player isn't using a forcefield in order to attack multiple entities at the same time.
39
 * 
40
 * Thanks @asofold for the original idea!
41
 */
42
public class Angle extends Check {
43
  
44
45
  private final List<String> tags = new LinkedList<String>();
46
47
48
    public static class AttackLocation {
49
        public final double x, y, z;
50
        /** Yaw of the attacker. */
51
        public final float yaw;
52
        public long time;
53
        public final UUID damagedId;
54
        /** Squared distance to the last location (0 if none given). */
55
        public final double distSqLast;
56
        /** Difference in yaw to the last location (0 if none given). */
57
        public final double yawDiffLast;
58
        /** Time difference to the last location (0 if none given). */
59
        public final long timeDiff;
60
        /** If the id differs from the last damaged entity (true if no lastLoc is given). */
61
        public final boolean idDiffLast;
62
        public AttackLocation(final Location loc, final UUID damagedId, final long time, final AttackLocation lastLoc) {
63
            x = loc.getX();
64
            y = loc.getY();
65
            z = loc.getZ();
66
            yaw = loc.getYaw();
67
            this.time = time;
68
            this.damagedId = damagedId;
69
70
            if (lastLoc != null) {
71
                distSqLast = TrigUtil.distanceSquared(x, y, z, lastLoc.x, lastLoc.y, lastLoc.z);
72
                yawDiffLast = TrigUtil.yawDiff(yaw, lastLoc.yaw);
73
                timeDiff = Math.max(0L, time - lastLoc.time);
74
                idDiffLast = !damagedId.equals(lastLoc.damagedId);
75
            } 
76
            else {
77
                distSqLast = 0.0;
78
                yawDiffLast = 0f;
79
                timeDiff = 0L;
80
                idDiffLast = true;
81
            }
82
        }
83
    }
84
    
85
    /** Used to also monitor lag-time */
86
    public static long maxTimeDiff = 1000L;
87
88
89
    /**
90
     * Instantiates a new angle check.
91
     */
92
    public Angle() {
93
        super(CheckType.FIGHT_ANGLE);
94
    }
95
96
97
    /**
98
     * The Angle check.
99
     * @param player
100
     * @param loc Location of the player.
101
     * @param worldChanged
102
     * @param data
103
     * @param cc
104
     * @return
105
     */
106
    public boolean check(final Player player, final Location loc, 
107
                         final Entity damagedEntity, final boolean worldChanged, 
108
                         final FightData data, final FightConfig cc, final IPlayerData pData) {
109
110
        if (worldChanged) {
111
            data.angleHits.clear();
112
        }
113
114
        boolean cancel = false;
115
        tags.clear();
116
117
        // Quick check for expiration of all entries.
118
        final long time = System.currentTimeMillis();
119
        AttackLocation lastLoc = data.angleHits.isEmpty() ? null : data.angleHits.getLast();
120
        if (lastLoc != null && time - lastLoc.time > maxTimeDiff) {
121
            data.angleHits.clear();
122
            lastLoc = null;
123
        }
124
125
        // Add the new location.
126
        data.angleHits.add(new AttackLocation(loc, damagedEntity.getUniqueId(), System.currentTimeMillis(), lastLoc));
127
128
        // Calculate the sums of differences.
129
        double deltaMove = 0D;
130
        long deltaTime = 0L;
131
        float deltaYaw = 0f;
132
        int deltaSwitchTarget = 0;
133
        final Iterator<AttackLocation> it = data.angleHits.iterator();
134
        while (it.hasNext()) {
135
            final AttackLocation refLoc = it.next();
136
            if (time - refLoc.time > maxTimeDiff) {
137
                it.remove();
138
                continue;
139
            }
140
            deltaMove += refLoc.distSqLast;
141
            final double yawDiff = Math.abs(refLoc.yawDiffLast);
142
            deltaYaw += yawDiff;
143
            deltaTime += refLoc.timeDiff;
144
            if (refLoc.idDiffLast && yawDiff > 30.0) {
145
                // TODO: Configurable sensitivity ? Scale with yawDiff?
146
                deltaSwitchTarget += 1;
147
            }
148
        }
149
150
        // Check if there is enough data present.
151
        if (data.angleHits.size() < 2) {
152
            return false;
153
        }
154
155
        final double n = (double) (data.angleHits.size() - 1);
156
157
        // Let's calculate the average move.
158
        double averageMove = deltaMove / n;
159
        // Adjust to server-sided lag
160
        averageMove *= TickTask.getLag(maxTimeDiff, true);
161
162
        // And the average time elapsed.
163
        double averageTime = (double) deltaTime / n;
164
        // Adjust to server-sided lag
165
        averageTime *= TickTask.getLag(maxTimeDiff, true);
166
167
        // And the average yaw delta.
168
        double averageYaw = (double) deltaYaw / n;
169
        // Adjust to server-sided lag
170
        averageYaw /= TickTask.getLag(maxTimeDiff, true);
171
172
        // Average target switching.
173
        double averageSwitching = (double) deltaSwitchTarget / n;
174
        // Adjust to server-sided lag
175
        averageSwitching /= TickTask.getLag(maxTimeDiff, true);
176
177
        // Declare the variables.
178
        double violation = 0.0;
179
        double violationMove = 0.0;
180
        double violationTime = 0.0;
181
        double violationYaw = 0.0;
182
        double violationSwitchSpeed = 0.0;
183
184
        // If the average move is between 0 and 0.2 block(s), add it to the violation.
185
        if (averageMove >= 0.0 && averageMove < 0.2D) {
186
            violationMove += 20.0 * (0.2 - averageMove) / 0.2;
187
            tags.add("avgmove");
188
            if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
189
                player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgMove: " + averageMove + " avgMove VL: " + violationMove + "/" + cc.angleMove);
190
            }
191
        }
192
193
        // If the average time elapsed is between 0 and 150 millisecond(s), add it to the violation.
194
        if (averageTime >= 0.0 && averageTime < 150.0) {
195
            violationTime += 30.0 * (150.0 - averageTime) / 150.0;
196
            tags.add("avgtime");
197
            if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
198
                player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgTime: " + averageTime + " avgTime VL: " + violationTime + "/" + cc.angleTime);
199
            }
200
        }
201
202
        // If the average difference of yaw is superior to 50 degrees, add it to the violation.
203
        if (averageYaw > 50.0) {
204
            violationYaw += 30.0 * averageYaw / 180.0;
205
            tags.add("avgyaw");
206
            if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
207
                player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgYaw: " + averageYaw + " avgYaw VL: " + violationYaw + "/" + cc.angleYaw);
208
            }
209
        }
210
        
211
        // Check for too quick target switch speed
212
        if (averageSwitching > 0.0) {
213
            violationSwitchSpeed += 20.0 * averageSwitching;
214
            tags.add("switchspeed");
215
            if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
216
                player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgSwitch: " + averageSwitching + " avgSwitch VL: " + violationSwitchSpeed + "/" + cc.angleSwitch);
217
            }
218
        }
219
220
221
        if (violationMove > cc.angleMove) {
222
            violation = violationMove;
223
            data.angleVL += violation;
224
            final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
225
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
226
            cancel = executeActions(vd).willCancel();
227
        }
228
        else if (violationTime > cc.angleTime) {
229
            violation = violationTime;
230
            data.angleVL += violation;
231
            final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
232
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
233
            cancel = executeActions(vd).willCancel();
234
        }
235
        else if (violationYaw > cc.angleYaw) {
236
            violation = violationYaw;
237
            data.angleVL += violation;
238
            final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
239
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
240
            cancel = executeActions(vd).willCancel();
241
        } 
242
        else if (violationSwitchSpeed > cc.angleSwitch) {
243
            violation = violationSwitchSpeed;
244
            data.angleVL += violation;
245
            final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
246
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
247
            cancel = executeActions(vd).willCancel();
248
        } 
249
        else {
250
            // Reward the player by lowering their violation level.
251
            data.angleVL *= 0.98D;  
252
        }
253
        return cancel;
254
    }
255
}

How it counteracts this module

NCP's fight.Angle analyzes the C02 attack stream rather than raw rotations: it accumulates the average move between hits (a violation component when the attacker stays within 0.2 blocks of the same spot), the average time between hits (a component when the interval is under 150ms), the average yaw difference (a component above 50 degrees), and the yaw change on target switches (above 30 degrees when the entity id changes). The assist itself sends no C02, so the check only engages when the assisted player attacks; in that combination the assist's target-locked rotation keeps the attacker facing one entity, and an assisted player clicking through the assist at a fast cadence feeds the time accumulator, while rapid retargeting between filtered entities feeds the switch-speed accumulator. On servers running NCP the check is the constraint that turns the ghost module into a risk once attacks are layered on top of the aim pull.

anticheat EntityInteractDirection (direction cone)

EntityInteractDirection.java95 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.interaction.entity;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.EntityInteractionCheck;
23
import me.islandscout.hawk.event.InteractEntityEvent;
24
import me.islandscout.hawk.util.*;
25
import me.islandscout.hawk.wrap.entity.WrappedEntity;
26
import org.bukkit.Location;
27
import org.bukkit.entity.Entity;
28
import org.bukkit.entity.Player;
29
import org.bukkit.util.Vector;
30
31
public class EntityInteractDirection extends EntityInteractionCheck {
32
33
    private final int PING_LIMIT;
34
    private final boolean LAG_COMPENSATION;
35
    private final boolean CHECK_OTHER_ENTITIES;
36
    private final double BOX_EXPAND;
37
38
    public EntityInteractDirection() {
39
        super("entityinteractdirection", true, 0, 10, 0.9, 5000, "%player% failed entity interact direction, VL: %vl%", null);
40
        PING_LIMIT = (int) customSetting("pingLimit", "", -1);
41
        LAG_COMPENSATION = (boolean) customSetting("lagCompensation", "", true);
42
        CHECK_OTHER_ENTITIES = (boolean) customSetting("checkOtherEntities", "", true);
43
        BOX_EXPAND = (double) customSetting("boxExpand", "", 0.2);
44
    }
45
46
    @Override
47
    protected void check(InteractEntityEvent e) {
48
        Player p = e.getPlayer();
49
        HawkPlayer pp = e.getHawkPlayer();
50
        Entity victimEntity = e.getEntity();
51
        if (!(victimEntity instanceof Player) && !CHECK_OTHER_ENTITIES)
52
            return;
53
        int ping = ServerUtils.getPing(e.getPlayer());
54
        if (PING_LIMIT > -1 && ping > PING_LIMIT)
55
            return;
56
        Vector pos;
57
        if(pp.isInVehicle()) {
58
            pos = hawk.getLagCompensator().getHistoryLocation(ping, p).toVector();
59
            pos.setY(pos.getY() + p.getEyeHeight());
60
        }
61
        else {
62
            pos = pp.getHeadPosition();
63
        }
64
        //As I always say in math class, converting polar coordinates to rectangular coordinates is a pain in
65
        //the ass. If you want to use the previous direction vector, you cannot make an accurate cut through the AABB
66
        //using only the previous and extrapolated direction vectors. You'd think you could since the extrapolation
67
        //on yaw and pitch is linear, but the current direction vector won't lie between the other two. Remember Non-
68
        //Euclidean geometry!
69
        Vector dir = MathPlus.getDirection(pp.getYaw(), pp.getPitch());
70
        //Note: in MC 1.8, the cursor yaw is not updated per frame, but rather per tick.
71
        //For ray-hitbox checks, this means that we do not need to extrapolate the yaw,
72
        //but for this check it does not matter whether we do it or not.
73
        Vector extraDir = MathPlus.getDirection(pp.getYaw() + pp.getDeltaYaw(), pp.getPitch() + pp.getDeltaPitch());
74
75
        Location victimLoc;
76
        if(LAG_COMPENSATION)
77
            victimLoc = hawk.getLagCompensator().getHistoryLocation(ping, victimEntity);
78
        else
79
            victimLoc = e.getEntity().getLocation();
80
81
        AABB victimAABB = WrappedEntity.getWrappedEntity(e.getEntity()).getHitbox(victimLoc.toVector());
82
        victimAABB.expand(BOX_EXPAND, BOX_EXPAND, BOX_EXPAND);
83
84
        //this is a crappy workaround to one of the issues with AABB#betweenRays. I'll keep this here until it is rewritten.
85
        Vector toVictim = victimLoc.toVector().setY(0).subtract(pos.clone().setY(0));
86
        boolean behind = toVictim.clone().normalize().dot(dir.clone().setY(0).normalize()) < 0 && toVictim.lengthSquared() > victimAABB.getMax().clone().setY(0).subtract(victimAABB.getMin().clone().setY(0)).lengthSquared();
87
88
        if(victimAABB.betweenRays(pos, dir, extraDir) && !behind) {
89
            reward(pp);
90
        }
91
        else {
92
            punish(pp, true, e);
93
        }
94
    }
95
}

How it counteracts this module

Hawk's EntityInteractDirection validates that an interaction points at the victim by ray-casting the reported direction against the victim's lag-compensated hitbox, expanded by the boxExpand setting, with the player's head position as the origin. The assist's purpose is keeping the facing inside that cone, so the check does not catch the module on its own; it constrains the combined aim-plus-attack behavior, punishing any assisted attack whose rotation drifts off the victim while the click lands. The lag compensation matters to the assist: the check evaluates the direction against the victim's position from ping milliseconds ago, the same history the assist's own client-side interpolation uses, so a fast-moving victim is where the cone check and the assist's smoothing can disagree.

← Back to Analysis Hub