LiquidSense Dev Aimbot module 2 files, 541 lines

LiquidSense Dev Aimbot: Full Source Analysis

Aimbot is a rotation-only assist driven from StrafeEvent: it picks the entity that passes the client's target filters, is visible through a vanilla ray trace, sits within range of its bounding box…

net/ccbluex/liquidbounce/features/module/modules/combat/Aimbot.kt · GitHub source ↗

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

Packets This Module Uses

Analysis

Overview

Aimbot is a rotation-only assist driven from StrafeEvent: it picks the entity that passes the client's target filters, is visible through a vanilla ray trace, sits within range of its bounding box, and is closest in rotation difference, then steps the view toward an aim point at a limited turn speed. The module never touches packet classes; the smoothed rotation rides the player's own C03 look values and the C02 attacks the player's own clicks produce. Center mode aims at the box center, the default searchCenter mode aims at the visible box sample that requires the least rotation, and an optional jitter perturbs the view by up to one degree.

Target selection

onStrafe runs per movement tick. The filter chain requires EntityUtils.isSelected(entity, true), which applies the client's player and mob toggles plus AntiBot, NoHurt and friend checks; mc.thePlayer.canEntityBeSeen for a vanilla ray trace; getDistanceToEntityBox within the range setting (default 4.4); and a rotation difference within the FOV setting (default 180). The survivor set is reduced with minBy RotationUtils.getRotationDifference, so the target is the nearest in aim, not in space. OnClick mode gates the whole assist on a clickTimer that resets while the attack key is held and skips assist for 500ms after the last click, and Lock mode stops assisting once RotationUtils.isFaced reports the current view already covers the target.

Rotation smoothing

The aim point is either the box center via RotationUtils.getCenter plus toRotation with prediction, or the searchCenter result: searchCenter samples the bounding box at 0.1-step fractions (x and z from 0.15 to 0.85, y from 0.15 to 1.0), keeps samples within range that pass the visibility ray trace, and returns the sample whose rotation differs least from the player's current rotation. The target rotation is then fed to RotationUtils.limitAngleChange with a step limit of turnSpeed plus a fresh uniform 0-1 draw, so per-tick yaw and pitch deltas are capped at the setting plus up to one degree of noise, and rotation.toPlayer writes the result straight into rotationYaw and rotationPitch.

Gating and jitter

Jitter mode adds a random walk on top of the converged view: per tick, independent Random.nextBoolean draws decide whether yaw and pitch move and in which sign, each by up to one degree, with pitch clamped to the legal [-90, 90] range. Because the assist writes the local view, the next C03 carries the smoothed values, and any attack the player lands emits a C02 whose direction matches the aim point. The turnSpeed noise means the step size is never exactly constant, which is the module's hedge against fixed-step rotation detectors.

source Aimbot.kt

Aimbot.kt87 lines · JavaOriginal ↗
1
/*
2
 * LiquidBounce Hacked Client
3
 * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
4
 * https://github.com/CCBlueX/LiquidBounce/
5
 */
6
package net.ccbluex.liquidbounce.features.module.modules.combat
7
8
import net.ccbluex.liquidbounce.event.EventTarget
9
import net.ccbluex.liquidbounce.event.StrafeEvent
10
import net.ccbluex.liquidbounce.features.module.Module
11
import net.ccbluex.liquidbounce.features.module.ModuleCategory
12
import net.ccbluex.liquidbounce.features.module.ModuleInfo
13
import net.ccbluex.liquidbounce.utils.EntityUtils
14
import net.ccbluex.liquidbounce.utils.Rotation
15
import net.ccbluex.liquidbounce.utils.RotationUtils
16
import net.ccbluex.liquidbounce.utils.extensions.getDistanceToEntityBox
17
import net.ccbluex.liquidbounce.utils.misc.RandomUtils
18
import net.ccbluex.liquidbounce.utils.timer.MSTimer
19
import net.ccbluex.liquidbounce.value.BoolValue
20
import net.ccbluex.liquidbounce.value.FloatValue
21
import kotlin.random.Random
22
23
@ModuleInfo(name = "Aimbot", description = "Automatically faces selected entities around you.", category = ModuleCategory.COMBAT)
24
class Aimbot : Module() {
25
26
    private val rangeValue = FloatValue("Range", 4.4F, 1F, 8F)
27
    private val turnSpeedValue = FloatValue("TurnSpeed", 2F, 1F, 180F)
28
    private val fovValue = FloatValue("FOV", 180F, 1F, 180F)
29
    private val centerValue = BoolValue("Center", false)
30
    private val lockValue = BoolValue("Lock", true)
31
    private val onClickValue = BoolValue("OnClick", false)
32
    private val jitterValue = BoolValue("Jitter", false)
33
34
    private val clickTimer = MSTimer()
35
36
    @EventTarget
37
    fun onStrafe(event: StrafeEvent) {
38
        if (mc.gameSettings.keyBindAttack.isKeyDown)
39
            clickTimer.reset()
40
41
        if (onClickValue.get() && clickTimer.hasTimePassed(500L))
42
            return
43
44
        val thePlayer = mc.thePlayer ?: return
45
46
        val range = rangeValue.get()
47
        val entity = mc.theWorld!!.loadedEntityList
48
                .filter {
49
                    EntityUtils.isSelected(it, true) && thePlayer.canEntityBeSeen(it) &&
50
                            thePlayer.getDistanceToEntityBox(it) <= range && RotationUtils.getRotationDifference(it) <= fovValue.get()
51
                }
52
                .minBy { RotationUtils.getRotationDifference(it) } ?: return
53
54
        if (!lockValue.get() && RotationUtils.isFaced(entity, range.toDouble()))
55
            return
56
57
        val rotation = RotationUtils.limitAngleChange(
58
                Rotation(thePlayer.rotationYaw, thePlayer.rotationPitch),
59
                if (centerValue.get())
60
                    RotationUtils.toRotation(RotationUtils.getCenter(entity.entityBoundingBox), true)
61
                else
62
                    RotationUtils.searchCenter(entity.entityBoundingBox, false, false, true,
63
                            false, range).rotation,
64
                (turnSpeedValue.get() + Math.random()).toFloat()
65
        )
66
67
        rotation.toPlayer(thePlayer)
68
69
        if (jitterValue.get()) {
70
            val yaw = Random.nextBoolean()
71
            val pitch = Random.nextBoolean()
72
            val yawNegative = Random.nextBoolean()
73
            val pitchNegative = Random.nextBoolean()
74
75
            if (yaw)
76
                thePlayer.rotationYaw += if (yawNegative) -RandomUtils.nextFloat(0F, 1F) else RandomUtils.nextFloat(0F, 1F)
77
78
            if (pitch) {
79
                thePlayer.rotationPitch += if (pitchNegative) -RandomUtils.nextFloat(0F, 1F) else RandomUtils.nextFloat(0F, 1F)
80
                if (thePlayer.rotationPitch > 90)
81
                    thePlayer.rotationPitch = 90F
82
                else if (thePlayer.rotationPitch < -90)
83
                    thePlayer.rotationPitch = -90F
84
            }
85
        }
86
    }
87
}

What this file does

The whole assist is one StrafeEvent handler: the filter chain, the minBy selection, the Lock/OnClick gates, the limitAngleChange step with the turnSpeed plus random draw, and the optional jitter walk with its pitch clamp. The file contains no packet imports, which is the core finding: every observable is rotation.

source RotationUtils.java (rotation math)

RotationUtils.java454 lines · JavaOriginal ↗
1
/*
2
 * LiquidBounce Hacked Client
3
 * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
4
 * https://github.com/CCBlueX/LiquidBounce/
5
 */
6
package net.ccbluex.liquidbounce.utils;
7
8
import net.ccbluex.liquidbounce.LiquidBounce;
9
import net.ccbluex.liquidbounce.event.EventTarget;
10
import net.ccbluex.liquidbounce.event.Listenable;
11
import net.ccbluex.liquidbounce.event.PacketEvent;
12
import net.ccbluex.liquidbounce.event.TickEvent;
13
import net.ccbluex.liquidbounce.features.module.modules.combat.FastBow;
14
import net.minecraft.client.entity.EntityPlayerSP;
15
import net.minecraft.entity.Entity;
16
import net.minecraft.entity.EntityLivingBase;
17
import net.minecraft.network.Packet;
18
import net.minecraft.network.play.client.C03PacketPlayer;
19
import net.minecraft.util.*;
20
import net.minecraftforge.fml.relauncher.Side;
21
import net.minecraftforge.fml.relauncher.SideOnly;
22
import org.jetbrains.annotations.NotNull;
23
import net.minecraft.util.Vec3;
24
25
import java.util.Random;
26
27
@SideOnly(Side.CLIENT)
28
public final class RotationUtils extends MinecraftInstance implements Listenable {
29
30
    private static Random random = new Random();
31
32
    private static int keepLength;
33
34
    public static Rotation targetRotation;
35
    public static Rotation serverRotation;
36
37
    public static boolean keepCurrentRotation = false;
38
39
    private static double x = random.nextDouble();
40
    private static double y = random.nextDouble();
41
    private static double z = random.nextDouble();
42
43
    public static float getRotations(EntityLivingBase ent ,float otPos) {
44
        double x = ent.posX + Math.sin(otPos);
45
        double z = ent.posZ + Math.cos(otPos);
46
        return getRotationFromPosition(x, z);
47
    }
48
49
    public static float getRotationFromPosition(double x, double z) {
50
        double xDiff = x - mc.thePlayer.posX;
51
        double zDiff = z - mc.thePlayer.posZ;
52
53
        float yaw = (float) (Math.atan2(zDiff, xDiff) * 180.0D / 3.141592653589793D) - 90.0F;
54
        return yaw;
55
    }
56
57
58
    public static float[] getRotationFromPosition(double x, double z, double y) {
59
        double xDiff = x - mc.thePlayer.posX;
60
        double zDiff = z - mc.thePlayer.posZ;
61
        double yDiff = y - mc.thePlayer.posY - 1.2;
62
63
        double dist = MathHelper.sqrt_double(xDiff * xDiff + zDiff * zDiff);
64
        float yaw = (float) (Math.atan2(zDiff, xDiff) * 180.0D / 3.141592653589793D) - 90.0F;
65
        float pitch = (float) -(Math.atan2(yDiff, dist) * 180.0D / 3.141592653589793D);
66
        return new float[]{yaw, pitch};
67
    }
68
69
    public static VecRotation faceBlock(final BlockPos blockPos) {
70
        if (blockPos == null)
71
            return null;
72
73
        VecRotation vecRotation = null;
74
75
        for(double xSearch = 0.1D; xSearch < 0.9D; xSearch += 0.1D) {
76
            for(double ySearch = 0.1D; ySearch < 0.9D; ySearch += 0.1D) {
77
                for (double zSearch = 0.1D; zSearch < 0.9D; zSearch += 0.1D) {
78
                    final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
79
                    final Vec3 posVec = new Vec3(blockPos).addVector(xSearch, ySearch, zSearch);
80
                    final double dist = eyesPos.distanceTo(posVec);
81
82
                    final double diffX = posVec.xCoord - eyesPos.xCoord;
83
                    final double diffY = posVec.yCoord - eyesPos.yCoord;
84
                    final double diffZ = posVec.zCoord - eyesPos.zCoord;
85
86
                    final double diffXZ = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);
87
88
                    final Rotation rotation = new Rotation(
89
                            MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F),
90
                            MathHelper.wrapAngleTo180_float((float) -Math.toDegrees(Math.atan2(diffY, diffXZ)))
91
                    );
92
93
                    final Vec3 rotationVector = getVectorForRotation(rotation);
94
                    final Vec3 vector = eyesPos.addVector(rotationVector.xCoord * dist, rotationVector.yCoord * dist,
95
                            rotationVector.zCoord * dist);
96
                    final MovingObjectPosition obj = mc.theWorld.rayTraceBlocks(eyesPos, vector, false,
97
                            false, true);
98
99
                    if (obj.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
100
                        final VecRotation currentVec = new VecRotation(posVec, rotation);
101
102
                        if (vecRotation == null || getRotationDifference(currentVec.getRotation()) < getRotationDifference(vecRotation.getRotation()))
103
                            vecRotation = currentVec;
104
                    }
105
                }
106
            }
107
        }
108
109
        return vecRotation;
110
    }
111
112
113
114
    /**
115
     * Face target with bow
116
     *
117
     * @param target your enemy
118
     * @param silent client side rotations
119
     * @param predict predict new enemy position
120
     * @param predictSize predict size of predict
121
     */
122
    public static void faceBow(final Entity target, final boolean silent, final boolean predict, final float predictSize) {
123
        final EntityPlayerSP player = mc.thePlayer;
124
125
        final double posX = target.posX + (predict ? (target.posX - target.prevPosX) * predictSize : 0) - (player.posX + (predict ? (player.posX - player.prevPosX) : 0));
126
        final double posY = target.getEntityBoundingBox().minY + (predict ? (target.getEntityBoundingBox().minY - target.prevPosY) * predictSize : 0) + target.getEyeHeight() - 0.15 - (player.getEntityBoundingBox().minY + (predict ? (player.posY - player.prevPosY) : 0)) - player.getEyeHeight();
127
        final double posZ = target.posZ + (predict ? (target.posZ - target.prevPosZ) * predictSize : 0) - (player.posZ + (predict ? (player.posZ - player.prevPosZ) : 0));
128
        final double posSqrt = Math.sqrt(posX * posX + posZ * posZ);
129
130
        float velocity = LiquidBounce.moduleManager.getModule(FastBow.class).getState() ? 1F : player.getItemInUseDuration() / 20F;
131
        velocity = (velocity * velocity + velocity * 2) / 3;
132
133
        if(velocity > 1) velocity = 1;
134
135
        final Rotation rotation = new Rotation(
136
                (float) (Math.atan2(posZ, posX) * 180 / Math.PI) - 90,
137
                (float) -Math.toDegrees(Math.atan((velocity * velocity - Math.sqrt(velocity * velocity * velocity * velocity - 0.006F * (0.006F * (posSqrt * posSqrt) + 2 * posY * (velocity * velocity)))) / (0.006F * posSqrt)))
138
        );
139
140
        if(silent)
141
            setTargetRotation(rotation);
142
        else
143
            limitAngleChange(new Rotation(player.rotationYaw, player.rotationPitch), rotation,10 +
144
                    new Random().nextInt(6)).toPlayer(mc.thePlayer);
145
    }
146
    /**
147
     * Search good center
148
     *
149
     * @param bb enemy box
150
     * @param outborder outborder option
151
     * @param random random option
152
     * @param predict predict option
153
     * @param throughWalls throughWalls option
154
     * @return center
155
     */
156
    public static VecRotation searchCenter(final AxisAlignedBB bb, final boolean outborder, final boolean random,
157
                                           final boolean predict, final boolean throughWalls, final float distance) {
158
        if(outborder) {
159
            final Vec3 vec3 = new Vec3(bb.minX + (bb.maxX - bb.minX) * (x * 0.3 + 1.0), bb.minY + (bb.maxY - bb.minY) * (y * 0.3 + 1.0), bb.minZ + (bb.maxZ - bb.minZ) * (z * 0.3 + 1.0));
160
            return new VecRotation(vec3, toRotation(vec3, predict));
161
        }
162
163
        final Vec3 randomVec = new Vec3(bb.minX + (bb.maxX - bb.minX) * x * 0.8, bb.minY + (bb.maxY - bb.minY) * y * 0.8, bb.minZ + (bb.maxZ - bb.minZ) * z * 0.8);
164
        final Rotation randomRotation = toRotation(randomVec, predict);
165
166
        final Vec3 eyes = mc.thePlayer.getPositionEyes(1F);
167
168
        VecRotation vecRotation = null;
169
170
        for(double xSearch = 0.15D; xSearch < 0.85D; xSearch += 0.1D) {
171
            for (double ySearch = 0.15D; ySearch < 1D; ySearch += 0.1D) {
172
                for (double zSearch = 0.15D; zSearch < 0.85D; zSearch += 0.1D) {
173
                    final Vec3 vec3 = new Vec3(bb.minX + (bb.maxX - bb.minX) * xSearch,
174
                            bb.minY + (bb.maxY - bb.minY) * ySearch, bb.minZ + (bb.maxZ - bb.minZ) * zSearch);
175
                    final Rotation rotation = toRotation(vec3, predict);
176
                    final double vecDist = eyes.distanceTo(vec3);
177
178
                    if (vecDist > distance)
179
                        continue;
180
181
                    if(throughWalls || isVisible(vec3)) {
182
                        final VecRotation currentVec = new VecRotation(vec3, rotation);
183
184
                        if (vecRotation == null || (random ? getRotationDifference(currentVec.getRotation(), randomRotation) < getRotationDifference(vecRotation.getRotation(), randomRotation) : getRotationDifference(currentVec.getRotation()) < getRotationDifference(vecRotation.getRotation())))
185
                            vecRotation = currentVec;
186
                    }
187
                }
188
            }
189
        }
190
191
        return vecRotation;
192
    }
193
194
    /**
195
     * Translate vec to rotation
196
     *
197
     * @param vec target vec
198
     * @param predict predict new location of your body
199
     * @return rotation
200
     */
201
202
203
    public static Rotation toRotation(final Vec3 vec, final boolean predict) {
204
        final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY +
205
                mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
206
207
        if(predict) eyesPos.addVector(mc.thePlayer.motionX, mc.thePlayer.motionY, mc.thePlayer.motionZ);
208
209
        final double diffX = vec.xCoord - eyesPos.xCoord;
210
        final double diffY = vec.yCoord - eyesPos.yCoord;
211
        final double diffZ = vec.zCoord - eyesPos.zCoord;
212
213
        return new Rotation(MathHelper.wrapAngleTo180_float(
214
                (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F
215
        ), MathHelper.wrapAngleTo180_float(
216
                (float) (-Math.toDegrees(Math.atan2(diffY, Math.sqrt(diffX * diffX + diffZ * diffZ))))
217
        ));
218
    }
219
220
    /*
221
    sb
222
     */
223
224
225
    public static Rotation OtherRotation(final AxisAlignedBB bb,final Vec3 vec, final boolean predict,final boolean throughWalls, final float distance) {
226
        final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY +
227
                mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
228
        final Vec3 eyes = mc.thePlayer.getPositionEyes(1F);
229
        VecRotation vecRotation = null;
230
        for(double xSearch = 0.15D; xSearch < 0.85D; xSearch += 0.1D) {
231
            for (double ySearch = 0.15D; ySearch < 1D; ySearch += 0.1D) {
232
                for (double zSearch = 0.15D; zSearch < 0.85D; zSearch += 0.1D) {
233
                    final Vec3 vec3 = new Vec3(bb.minX + (bb.maxX - bb.minX) * xSearch,
234
                            bb.minY + (bb.maxY - bb.minY) * ySearch, bb.minZ + (bb.maxZ - bb.minZ) * zSearch);
235
                    final Rotation rotation = toRotation(vec3, predict);
236
                    final double vecDist = eyes.distanceTo(vec3);
237
238
                    if (vecDist > distance)
239
                        continue;
240
241
                    if(throughWalls || isVisible(vec3)) {
242
                        final VecRotation currentVec = new VecRotation(vec3, rotation);
243
244
                        if (vecRotation == null)
245
                            vecRotation = currentVec;
246
                    }
247
                }
248
            }
249
        }
250
251
        if(predict) eyesPos.addVector(mc.thePlayer.motionX, mc.thePlayer.motionY, mc.thePlayer.motionZ);
252
253
        final double diffX = vec.xCoord - eyesPos.xCoord;
254
        final double diffY = vec.yCoord - eyesPos.yCoord;
255
        final double diffZ = vec.zCoord - eyesPos.zCoord;
256
257
        return new Rotation(MathHelper.wrapAngleTo180_float(
258
                (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F
259
        ), MathHelper.wrapAngleTo180_float(
260
                (float) (-Math.toDegrees(Math.atan2(diffY, Math.sqrt(diffX * diffX + diffZ * diffZ))))
261
        ));
262
263
264
    }
265
266
    /**
267
     * Get the center of a box
268
     *
269
     * @param bb your box
270
     * @return center of box
271
     */
272
    public static Vec3 getCenter(final AxisAlignedBB bb) {
273
        return new Vec3(bb.minX + (bb.maxX - bb.minX) * 0.5, bb.minY + (bb.maxY - bb.minY) * 0.5, bb.minZ + (bb.maxZ - bb.minZ) * 0.5);
274
    }
275
276
277
    /**
278
     * Calculate difference between the client rotation and your entity
279
     *
280
     * @param entity your entity
281
     * @return difference between rotation
282
     */
283
    public static double getRotationDifference(final Entity entity) {
284
        final Rotation rotation = toRotation(getCenter(entity.getEntityBoundingBox()), true);
285
286
        return getRotationDifference(rotation, new Rotation(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch));
287
    }
288
289
    /**
290
     * Calculate difference between the server rotation and your rotation
291
     *
292
     * @param rotation your rotation
293
     * @return difference between rotation
294
     */
295
    public static double getRotationDifference(final Rotation rotation) {
296
        return serverRotation == null ? 0D : getRotationDifference(rotation, serverRotation);
297
    }
298
299
    /**
300
     * Calculate difference between two rotations
301
     *
302
     * @param a rotation
303
     * @param b rotation
304
     * @return difference between rotation
305
     */
306
    public static double getRotationDifference(final Rotation a, final Rotation b) {
307
        return Math.hypot(getAngleDifference(a.getYaw(), b.getYaw()), a.getPitch() - b.getPitch());
308
    }
309
310
    /**
311
     * Limit your rotation using a turn speed
312
     *
313
     * @param currentRotation your current rotation
314
     * @param targetRotation your goal rotation
315
     * @param turnSpeed your turn speed
316
     * @return limited rotation
317
     */
318
    @NotNull
319
    public static Rotation limitAngleChange(final Rotation currentRotation, final Rotation targetRotation, final float turnSpeed) {
320
        final float yawDifference = getAngleDifference(targetRotation.getYaw(), currentRotation.getYaw());
321
        final float pitchDifference = getAngleDifference(targetRotation.getPitch(), currentRotation.getPitch());
322
323
        return new Rotation(
324
                currentRotation.getYaw() + (yawDifference > turnSpeed ? turnSpeed : Math.max(yawDifference, -turnSpeed)),
325
                currentRotation.getPitch() + (pitchDifference > turnSpeed ? turnSpeed : Math.max(pitchDifference, -turnSpeed)
326
        ));
327
    }
328
329
    /**
330
     * Calculate difference between two angle points
331
     *
332
     * @param a angle point
333
     * @param b angle point
334
     * @return difference between angle points
335
     */
336
    private static float getAngleDifference(final float a, final float b) {
337
        return ((((a - b) % 360F) + 540F) % 360F) - 180F;
338
    }
339
340
    /**
341
     * Calculate rotation to vector
342
     *
343
     * @param rotation your rotation
344
     * @return target vector
345
     */
346
    public static Vec3 getVectorForRotation(final Rotation rotation) {
347
        float yawCos = MathHelper.cos(-rotation.getYaw() * 0.017453292F - (float) Math.PI);
348
        float yawSin = MathHelper.sin(-rotation.getYaw() * 0.017453292F - (float) Math.PI);
349
        float pitchCos = -MathHelper.cos(-rotation.getPitch() * 0.017453292F);
350
        float pitchSin = MathHelper.sin(-rotation.getPitch() * 0.017453292F);
351
        return new Vec3(yawSin * pitchCos, pitchSin, yawCos * pitchCos);
352
    }
353
354
    /**
355
     * Allows you to check if your crosshair is over your target entity
356
     *
357
     * @param targetEntity your target entity
358
     * @param blockReachDistance your reach
359
     * @return if crosshair is over target
360
     */
361
    public static boolean isFaced(final Entity targetEntity, double blockReachDistance) {
362
        return RaycastUtils.raycastEntity(blockReachDistance, entity -> entity == targetEntity) != null;
363
    }
364
365
    /**
366
     * Allows you to check if your enemy is behind a wall
367
     */
368
    public static boolean isVisible(final Vec3 vec3) {
369
        final Vec3 eyesPos = new Vec3(mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ);
370
371
        return mc.theWorld.rayTraceBlocks(eyesPos, vec3) == null;
372
    }
373
374
    /**
375
     * Handle minecraft tick
376
     *
377
     * @param event Tick event
378
     */
379
    @EventTarget
380
    public void onTick(final TickEvent event) {
381
        if(targetRotation != null) {
382
            keepLength--;
383
384
            if (keepLength <= 0)
385
                reset();
386
        }
387
388
        if(random.nextGaussian() > 0.8D) x = Math.random();
389
        if(random.nextGaussian() > 0.8D) y = Math.random();
390
        if(random.nextGaussian() > 0.8D) z = Math.random();
391
    }
392
393
    /**
394
     * Handle packet
395
     *
396
     * @param event Packet Event
397
     */
398
    @EventTarget
399
    public void onPacket(final PacketEvent event) {
400
        final Packet<?> packet = event.getPacket();
401
402
        if(packet instanceof C03PacketPlayer) {
403
            final C03PacketPlayer packetPlayer = (C03PacketPlayer) packet;
404
405
            if(targetRotation != null && !keepCurrentRotation && (targetRotation.getYaw() != serverRotation.getYaw() || targetRotation.getPitch() != serverRotation.getPitch())) {
406
                packetPlayer.yaw = targetRotation.getYaw();
407
                packetPlayer.pitch = targetRotation.getPitch();
408
                packetPlayer.rotating = true;
409
            }
410
411
            if(packetPlayer.rotating) serverRotation = new Rotation(packetPlayer.yaw, packetPlayer.pitch);
412
        }
413
    }
414
415
    /**
416
     * Set your target rotation
417
     *
418
     * @param rotation your target rotation
419
     */
420
    public static void setTargetRotation(final Rotation rotation) {
421
        setTargetRotation(rotation, 0);
422
    }
423
424
    /**
425
     * Set your target rotation
426
     *
427
     * @param rotation your target rotation
428
     */
429
    public static void setTargetRotation(final Rotation rotation, final int keepLength) {
430
        if(Double.isNaN(rotation.getYaw()) || Double.isNaN(rotation.getPitch())
431
                || rotation.getPitch() > 90 || rotation.getPitch() < -90)
432
            return;
433
434
        rotation.fixedSensitivity(mc.gameSettings.mouseSensitivity);
435
        targetRotation = rotation;
436
        RotationUtils.keepLength = keepLength;
437
    }
438
439
    /**
440
     * Reset your target rotation
441
     */
442
    public static void reset() {
443
        keepLength = 0;
444
        targetRotation = null;
445
    }
446
447
    /**
448
     * @return YESSSS!!!
449
     */
450
    @Override
451
    public boolean handleEvents() {
452
        return true;
453
    }
454
}

What this file does

The file supplies every helper the assist leans on: limitAngleChange caps the per-tick step, toRotation converts an aim point to yaw and pitch with optional target prediction, getCenter and searchCenter pick the aim point (searchCenter ray-traces 0.1-step box samples and picks the least-rotation visible one), and isFaced and getRotationDifference implement the Lock gate and the angle-space FOV and selection distance.

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 Angle (attack-time aim ledger)

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 Angle check records every attack as an AttackLocation with its yaw, the yaw difference to the previous attack, the time gap and whether the target switched, then over a 1000ms window averages movement, time, yaw delta and target switches against config thresholds. A single-target aimbot produces small, steady yaw deltas, which is exactly what the model tolerates; the check only pressures multi-target flows, and at the stock thresholds in this tree the per-call scores stay far below the action limits, so the check is dormant until an admin lowers them.

anticheat KillAura (combat sub-checks)

KillAura.java114 lines · Java
1
package me.vrekt.arc.check.combat;
2
3
import me.vrekt.arc.Arc;
4
import me.vrekt.arc.check.Check;
5
import me.vrekt.arc.check.CheckType;
6
import me.vrekt.arc.data.combat.FightData;
7
import me.vrekt.arc.utilties.LocationHelper;
8
import org.bukkit.ChatColor;
9
import org.bukkit.entity.Entity;
10
import org.bukkit.entity.Player;
11
import org.bukkit.util.Vector;
12
13
public class KillAura extends Check {
14
15
    private double maxAngle, maxReach;
16
    private int maxSwingTime, maxAttacks, maxAttackPackets;
17
18
    public KillAura() {
19
        super(CheckType.KILLAURA);
20
21
        maxAngle = Arc.getCheckManager().getValueDouble(CheckType.KILLAURA, "max-direction-angle");
22
        maxSwingTime = Arc.getCheckManager().getValueInt(CheckType.KILLAURA, "max-swing-time");
23
        maxReach = Arc.getCheckManager().getValueDouble(CheckType.KILLAURA, "max-reach");
24
        maxAttacks = Arc.getCheckManager().getValueInt(CheckType.KILLAURA, "max-attacks");
25
        maxAttackPackets = Arc.getCheckManager().getValueInt(CheckType.KILLAURA, "max-attack-packets");
26
27
    }
28
29
    public boolean check(FightData data, Player player) {
30
        result.reset();
31
32
        Entity last = data.getLastAttackedEntity();
33
        Entity entity = data.getAttackedEntity();
34
35
        // Calculate angle stuff.
36
        Vector playerLocation = player.getLocation().toVector();
37
        Vector entityLocation = entity.getLocation().toVector();
38
        double angle = entityLocation.subtract(playerLocation).angle(player.getLocation().getDirection());
39
40
        if (last != null && !entity.equals(last)) {
41
            // check the angle between the two entities
42
            Vector lastLocation = last.getLocation().toVector();
43
            double angleToLast = lastLocation.subtract(playerLocation).angle(player.getLocation().getDirection());
44
            double angleDifference = Math.abs(angleToLast - angle);
45
            double distanceDifference = LocationHelper.distance(last.getLocation(), entity.getLocation());
46
            if (angleDifference > maxAngle && distanceDifference <= maxReach) {
47
                getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Multi)");
48
                result.set(checkViolation(player, "Angle difference greater than allowed. a=" + angleDifference + " e=" + maxAngle));
49
            }
50
        }
51
52
        // check yaw difference.
53
        if (angle > maxAngle) {
54
            getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Direction)");
55
            result.set(checkViolation(player, "Angle distance greater than allowed. a=" + angle + " e=" + maxAngle));
56
        }
57
58
        // check swing time.
59
        long time = System.currentTimeMillis() - data.getLastArmSwing();
60
        if (time > maxSwingTime) {
61
            getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(NoSwing)");
62
            result.set(checkViolation(player, "Player did not swing their arm in time."));
63
        }
64
65
        // distance to entity excluding knockback.
66
        double distance = LocationHelper.distance(player.getLocation(), entity.getLocation().subtract(entity.getVelocity()));
67
        // check for reach
68
        if (distance > maxReach) {
69
            getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Reach)");
70
            result.set(checkViolation(player, "Entity is out of players range. d=" + distance + " e=" + maxReach));
71
        }
72
73
        // check max attacks
74
        if (data.getLastAttackCheck() == 0) {
75
            data.setLastAttackCheck(System.currentTimeMillis());
76
        }
77
        long lastAttack = System.currentTimeMillis() - data.getLastAttackCheck();
78
        if (lastAttack >= 1000) {
79
            // check if we exceeded the max attacks in the last second.
80
            int totalAttacks = data.getTotalAttacks();
81
            if (totalAttacks > maxAttacks) {
82
                getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Speed)");
83
                result.set(checkViolation(player, "Attacking too fast. a=" + totalAttacks + " e=" + maxAttacks));
84
            }
85
            // reset data for next check.
86
            data.setTotalAttacks(0);
87
            data.setLastAttackCheck(System.currentTimeMillis());
88
        }
89
90
        getCheck().setCheckName("KillAura");
91
        return result.failed();
92
    }
93
94
    public boolean checkFrequency(FightData data, Player player) {
95
        if (data.getLastAttackCheck() == 0) {
96
            data.setLastAttackCheck(System.currentTimeMillis());
97
            return false;
98
        }
99
100
        long time = System.currentTimeMillis() - data.getLastAttackCheck();
101
        if (time >= 1000) {
102
            data.setLastAttackCheck(System.currentTimeMillis());
103
            int totalPackets = data.getAttackPackets();
104
            if (totalPackets > maxAttackPackets) {
105
                data.setAttackPackets(0);
106
                getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Speed)");
107
                return checkViolation(player, "Attacking too fast a=" + totalPackets + " e=" + maxAttackPackets);
108
            }
109
        }
110
111
        return false;
112
    }
113
114
}

How it counteracts this module

Arc v2's KillAura check reads FightData per attack and enforces maxAngle on both the angle to the target and the angle difference between consecutive attacks, maxReach on the distance, and maxSwingTime on the swing gap. The aimbot's own rotation is invisible to it, but a C02 attack fired mid-convergence carries a direction up to turnSpeed plus a degree off the line, and hits on targets beyond the reach bound trip the distance branch; the module's default 4.4 range sits above the vanilla attack reach, so long-range click attacks accumulate.

anticheat AimbotHeuristic (click-window rotation)

AimbotHeuristic.java164 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.check.Cancelless;
24
import me.islandscout.hawk.event.*;
25
import me.islandscout.hawk.util.Debug;
26
import me.islandscout.hawk.util.MathPlus;
27
import org.bukkit.entity.Player;
28
import org.bukkit.util.Vector;
29
30
import java.util.*;
31
32
/**
33
 * AimbotHeuristic exploits flaws in aim-bot cheats by
34
 * analyzing mouse movement patterns during interaction. Although
35
 * easily bypassed, it catches a significant number of cheaters.
36
 * Caution is advised since this check may false flag during
37
 * certain circumstances. This check should only be used as a
38
 * hint that the player might be cheating.
39
 */
40
public class AimbotHeuristic extends CustomCheck implements Cancelless {
41
42
    private final Map<UUID, List<Vector>> mouseMoves;
43
    private final Map<UUID, List<Long>> clickTimes;
44
45
    private static final int MOVES_PER_SAMPLE = 4; //must be greater than 0
46
    private final int MOVES_AFTER_HIT;
47
    private final boolean DEBUG;
48
49
    public AimbotHeuristic() {
50
        super("aimbotheuristic", false, -1, 5, 0.99, 5000, "&7%player% failed aimbot (heuristic), VL %vl%", null);
51
        mouseMoves = new HashMap<>();
52
        clickTimes = new HashMap<>();
53
54
        MOVES_AFTER_HIT = MOVES_PER_SAMPLE - MOVES_PER_SAMPLE / 2;
55
56
        DEBUG = (boolean) customSetting("debug", "", false);
57
    }
58
59
    public void check(Event e) {
60
        if (e instanceof MoveEvent) {
61
            processMove((MoveEvent) e);
62
        } else if (e instanceof InteractEntityEvent || e instanceof InteractWorldEvent) {
63
            processClick(e);
64
        }
65
    }
66
67
    private void processMove(MoveEvent e) {
68
        Player p = e.getPlayer();
69
        HawkPlayer pp = e.getHawkPlayer();
70
        UUID uuid = p.getUniqueId();
71
72
        List<Vector> lastMoves = mouseMoves.getOrDefault(uuid, new ArrayList<>());
73
        Vector mouseMove = new Vector(e.getTo().getYaw() - e.getFrom().getYaw(), e.getTo().getPitch() - e.getFrom().getPitch(), 0);
74
75
        lastMoves.add(mouseMove);
76
        //make size 1 bigger so that we can get the move before
77
        //the first move that we check
78
        if(lastMoves.size() > MOVES_PER_SAMPLE + 1) {
79
            lastMoves.remove(0);
80
        }
81
        mouseMoves.put(uuid, lastMoves);
82
83
        if(clickedXMovesBefore(MOVES_AFTER_HIT, pp)) {
84
            double minSpeed = Double.MAX_VALUE;
85
            double maxSpeed = 0D;
86
            double maxAngle = 0D;
87
            for(int i = 1; i < lastMoves.size(); i++) {
88
                Vector lastMouseMove = lastMoves.get(i - 1);
89
                Vector currMouseMove = lastMoves.get(i);
90
                double speed = currMouseMove.length();
91
                double lastSpeed = lastMouseMove.length();
92
                double angle = (lastSpeed != 0 && lastSpeed != 0) ? MathPlus.angle(lastMouseMove, currMouseMove) : 0D;
93
                if(Double.isNaN(angle))
94
                    angle = 0D;
95
                maxSpeed = Math.max(speed, maxSpeed);
96
                minSpeed = Math.min(speed, minSpeed);
97
                maxAngle = Math.max(angle, maxAngle);
98
99
                //stutter
100
                if(maxSpeed - minSpeed > 4 && minSpeed < 0.01 && maxAngle < 0.1 && lastSpeed > 1) { //this lastSpeed check eliminates a false positive
101
                    if(DEBUG) {
102
                        p.sendMessage("AimbotHeuristic: A");
103
                    }
104
                    punishEm(pp, e);
105
                }
106
                //twitching or zig zags
107
                else if(speed > 20 && lastSpeed > 20 && angle > 2.86) {
108
                    if(DEBUG) {
109
                        p.sendMessage("AimbotHeuristic: B");
110
                    }
111
                    punishEm(pp, e);
112
                }
113
                //jump discontinuity
114
                else if(speed - lastSpeed < -30 && angle > 0.8) {
115
                    if(DEBUG) {
116
                        p.sendMessage("AimbotHeuristic: C");
117
                    }
118
                    punishEm(pp, e);
119
                }
120
                else {
121
                    reward(pp);
122
                }
123
            }
124
        }
125
    }
126
127
    private boolean clickedXMovesBefore(long x, HawkPlayer pp) {
128
        List<Long> clickTimess = clickTimes.getOrDefault(pp.getUuid(), new ArrayList<>());
129
        long time = pp.getCurrentTick() - x;
130
        for(int i = 0; i < clickTimess.size(); i++) {
131
            if(time == clickTimess.get(i)) {
132
                clickTimess.remove(i);
133
                return true;
134
            }
135
        }
136
        return false;
137
    }
138
139
    private void processClick(Event e) {
140
        UUID uuid = e.getPlayer().getUniqueId();
141
        List<Long> clickTimess = clickTimes.getOrDefault(uuid, new ArrayList<>());
142
        long currTick = e.getHawkPlayer().getCurrentTick();
143
        if(!clickTimess.contains(currTick))
144
            clickTimess.add(e.getHawkPlayer().getCurrentTick());
145
146
        //memory leak fail-safe, if necessary?
147
        for(int i = clickTimess.size() - 1; i >= 0; i--) {
148
            if(currTick - clickTimess.get(i) > MOVES_PER_SAMPLE + 1)
149
                clickTimess.remove(i);
150
        }
151
152
        clickTimes.put(uuid, clickTimess);
153
    }
154
155
    private void punishEm(HawkPlayer pp, MoveEvent e) {
156
        punish(pp, false, e);
157
    }
158
159
    @Override
160
    public void removeData(Player p) {
161
        mouseMoves.remove(p.getUniqueId());
162
        clickTimes.remove(p.getUniqueId());
163
    }
164
}

How it counteracts this module

Hawk analyzes the last four move vectors only when a click landed two ticks ago, flagging the stutter signature (maxSpeed minus minSpeed above 4 with a near-zero minimum and a tiny angle), twitch steps, or a jump discontinuity. The aimbot's step-capped rotation with its per-tick random turnSpeed inflation produces exactly the constant-step-then-park pattern branch A looks for when the player attacks, though the noise draw spreads the step sizes; jitter mode widens the spread further and shrinks the detection window.

anticheat Reach (interaction distance)

Reach.java404 lines · Java
1
// This file was designed and is an original check for GrimAC
2
// Copyright (C) 2021 DefineOutside
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
package ac.grim.grimac.checks.impl.combat;
17
18
import ac.grim.grimac.api.config.ConfigManager;
19
import ac.grim.grimac.api.storage.verbose.Verbose;
20
import ac.grim.grimac.checks.Check;
21
import ac.grim.grimac.checks.CheckData;
22
import ac.grim.grimac.checks.type.PacketReceiveListener;
23
import ac.grim.grimac.player.GrimPlayer;
24
import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;
25
import ac.grim.grimac.utils.data.packetentity.PacketEntity;
26
import ac.grim.grimac.utils.data.packetentity.PacketEntitySizeable;
27
import ac.grim.grimac.utils.data.packetentity.dragon.PacketEntityEnderDragonPart;
28
import ac.grim.grimac.utils.math.Vector3dm;
29
import ac.grim.grimac.utils.nmsutil.ReachUtils;
30
import ac.grim.grimac.utils.viaversion.ViaVersionUtil;
31
import com.github.retrooper.packetevents.PacketEvents;
32
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
33
import com.github.retrooper.packetevents.manager.server.ServerVersion;
34
import com.github.retrooper.packetevents.protocol.attribute.Attributes;
35
import com.github.retrooper.packetevents.protocol.component.ComponentTypes;
36
import com.github.retrooper.packetevents.protocol.component.builtin.item.ItemAttackRange;
37
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
38
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
39
import com.github.retrooper.packetevents.protocol.item.ItemStack;
40
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
41
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
42
import com.github.retrooper.packetevents.protocol.player.GameMode;
43
import com.github.retrooper.packetevents.protocol.player.InteractionHand;
44
import com.github.retrooper.packetevents.util.Vector3d;
45
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientAttack;
46
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
47
import com.viaversion.viaversion.api.Via;
48
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
49
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
50
import org.jetbrains.annotations.NotNull;
51
52
import java.util.ArrayList;
53
import java.util.Arrays;
54
import java.util.Collections;
55
import java.util.List;
56
57
// You may not copy the check unless you are licensed under GPL
58
@CheckData(name = "Reach", stableKey = "grim.combat.reach", description = "Attacked an entity from too far away")
59
public class Reach extends Check implements PacketReceiveListener {
60
    private static final Verbose V = Verbose.of("{f64:%.5f} blocks, type={entity}");
61
62
    private static final List<EntityType> blacklisted = Arrays.asList(
63
            EntityTypes.BOAT,
64
            EntityTypes.CHEST_BOAT,
65
            EntityTypes.SHULKER);
66
    private static final CheckResult NONE = new CheckResult(ResultType.NONE, 0, 0, false);
67
    // Only one flag per reach attack, per entity, per tick.
68
    // We store position because lastX isn't reliable on teleports.
69
    private final Int2ObjectMap<InteractionData> playerAttackQueue = new Int2ObjectOpenHashMap<>();
70
    private boolean cancelImpossibleHits;
71
    private double threshold;
72
    private double cancelBuffer; // For the next 4 hits after using reach, we aggressively cancel reach
73
74
    public Reach(GrimPlayer player) {
75
        super(player);
76
    }
77
78
    @Override
79
    public void onPacketReceive(final PacketReceiveEvent event) {
80
        if (!player.disableGrim && event.getPacketType() == PacketType.Play.Client.ATTACK) {
81
            WrapperPlayClientAttack packet = new WrapperPlayClientAttack(event);
82
            onInteract(event, packet.getEntityId(), InteractionHand.MAIN_HAND);
83
        }
84
85
        if (!player.disableGrim && event.getPacketType() == PacketType.Play.Client.INTERACT_ENTITY) {
86
            WrapperPlayClientInteractEntity packet = new WrapperPlayClientInteractEntity(event);
87
            onInteract(event, packet.getEntityId(), packet.getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK ? InteractionHand.MAIN_HAND : packet.getHand());
88
        }
89
90
        // If the player set their look, or we know they have a new tick
91
        if (isUpdate(event.getPacketType())) {
92
            tickBetterReachCheckWithAngle();
93
        }
94
    }
95
96
    private void onInteract(PacketReceiveEvent event, int entityId, InteractionHand hand) {
97
        // Don't let the player teleport to bypass reach
98
        if (player.getSetbackTeleportUtil().shouldBlockMovement()) {
99
            event.setCancelled(true);
100
            player.onPacketCancel();
101
            return;
102
        }
103
104
        PacketEntity entity = player.compensatedEntities.entityMap.get(entityId);
105
        // Stop people from freezing transactions before an entity spawns to bypass reach
106
        // TODO: implement dragon parts?
107
        if (entity == null || entity instanceof PacketEntityEnderDragonPart) {
108
            // Only cancel if and only if we are tracking this entity
109
            // This is because we don't track paintings.
110
            if (shouldModifyPackets() && player.compensatedEntities.serverPositionsMap.containsKey(entityId)) {
111
                event.setCancelled(true);
112
                player.onPacketCancel();
113
            }
114
            return;
115
        }
116
117
        // Dead entities cause false flags (https://github.com/GrimAnticheat/Grim/issues/546)
118
        if (entity.isDead) return;
119
120
        // TODO: Remove when in front of via
121
        if (entity.getType() == EntityTypes.ARMOR_STAND && player.getClientVersion().isOlderThan(ClientVersion.V_1_8))
122
            return;
123
        // Prevents Happy Ghast Reach false on 1.21.6+ servers with ViaBackwards set up
124
        if (entity.getType() == EntityTypes.HAPPY_GHAST && player.getClientVersion().isOlderThan(ClientVersion.V_1_21_6))
125
            return;
126
        if (player.gamemode == GameMode.CREATIVE || player.gamemode == GameMode.SPECTATOR)
127
            return;
128
        if (player.inVehicle()) return;
129
        if (entity.riding != null) return;
130
131
        ItemStack currentStack = player.inventory.getItemInHand(hand);
132
        ItemStack startStack = player.inventory.getStartOfTickStack();
133
134
        boolean hasRange = false;
135
        float maxReach = 0f;
136
        float hitboxMargin = 0f;
137
        Vector3dm attackRangeMovement = null;
138
139
        boolean clientAttackRangeExists = player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_11);
140
        boolean clientAndServerAgrees = clientAttackRangeExists && ATTACK_RANGE_COMPONENT_EXISTS;
141
142
        boolean viaVersionAvailable = false;
143
        if (USE_1_8_HITBOX_MARGIN && ViaVersionUtil.isAvailable) {
144
            viaVersionAvailable = Via.getConfig().getValues().containsKey("use-1_8-hitbox-margin") && Via.getConfig().use1_8HitboxMargin();
145
        }
146
147
        boolean clientAndViaVersion = clientAttackRangeExists && viaVersionAvailable;
148
        if (clientAndServerAgrees || clientAndViaVersion) {
149
            ItemAttackRange startRange = startStack.getComponentOr(ComponentTypes.ATTACK_RANGE, null);
150
            ItemAttackRange currentRange = currentStack.getComponentOr(ComponentTypes.ATTACK_RANGE, null);
151
152
            if (clientAndViaVersion) {
153
                if (startStack != ItemStack.EMPTY) {
154
                    startRange = new ItemAttackRange(0F, 3F, 0F, 4F, 0.1F, 1F);
155
                }
156
157
                if (currentStack != ItemStack.EMPTY) {
158
                    currentRange = new ItemAttackRange(0F, 3F, 0F, 4F, 0.1F, 1F);
159
                }
160
            }
161
162
            // If the start stack has no range component, the client defaults to vanilla reach behavior,
163
            // regardless of what the current stack is (No Range -> X = No Range used).
164
            if (startRange != null) {
165
                hasRange = true;
166
                if (currentRange == null) {
167
                    // Range (Start) -> No Range (Current)
168
                    // Client logic uses Start Range, including the attack_range movement projection.
169
                    if (!clientAndViaVersion) {
170
                        attackRangeMovement = player.clientVelocity.clone();
171
                    }
172
                    maxReach = startRange.getMaxRange();
173
                    hitboxMargin = startRange.getHitboxMargin();
174
                } else {
175
                    // Range (Start) -> Range (Current)
176
                    // Client logic requires satisfying BOTH constraints
177
                    maxReach = Math.min(startRange.getMaxRange(), currentRange.getMaxRange());
178
                    hitboxMargin = Math.min(startRange.getHitboxMargin(), currentRange.getHitboxMargin());
179
                }
180
            }
181
        }
182
183
        boolean tooManyAttacks = playerAttackQueue.size() > 10;
184
        if (!tooManyAttacks) {
185
            playerAttackQueue.put(entityId, new InteractionData(
186
                    player.x, player.y, player.z,
187
                    hasRange, maxReach, hitboxMargin, attackRangeMovement
188
            )); // Queue for next tick for very precise check
189
        }
190
191
        boolean knownInvalid = attackRangeMovement == null && isKnownInvalid(entity, hasRange, maxReach, hitboxMargin);
192
193
        if ((shouldModifyPackets() && cancelImpossibleHits && knownInvalid) || tooManyAttacks) {
194
            event.setCancelled(true);
195
            player.onPacketCancel();
196
        }
197
    }
198
199
    // This method finds the most optimal point at which the user should be aiming at
200
    // and then measures the distance between the player's eyes and this target point
201
    //
202
    // It will not cancel every invalid attack but should cancel 3.05+ or so in real-time
203
    // Let the post look check measure the distance, as it will always return equal or higher
204
    // than this method.  If this method flags, the other method WILL flag.
205
    //
206
    // Meaning that the other check should be the only one that flags.
207
    private boolean isKnownInvalid(PacketEntity reachEntity, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin) {
208
        // If the entity doesn't exist, or if it is exempt, or if it is dead
209
        if ((blacklisted.contains(reachEntity.getType()) || !reachEntity.isLivingEntity) && reachEntity.getType() != EntityTypes.END_CRYSTAL)
210
            return false; // exempt
211
212
        if (player.gamemode == GameMode.CREATIVE || player.gamemode == GameMode.SPECTATOR)
213
            return false;
214
        if (player.inVehicle()) return false;
215
216
        // Filter out what we assume to be cheats
217
        if (cancelBuffer != 0) {
218
            CheckResult result = checkReach(reachEntity, player.x, player.y, player.z, hasAttackRange, itemMaxReach, itemHitboxMargin, null, true);
219
            return result.isFlag();
220
        } else {
221
            SimpleCollisionBox targetBox = getTargetBox(reachEntity);
222
223
            double maxReach = applyReachModifiers(targetBox, hasAttackRange, itemMaxReach, itemHitboxMargin, !player.packetStateData.didLastMovementIncludePosition);
224
            return ReachUtils.getMinReachToBox(player, targetBox) > maxReach;
225
        }
226
    }
227
228
    private void tickBetterReachCheckWithAngle() {
229
        for (Int2ObjectMap.Entry<InteractionData> attack : playerAttackQueue.int2ObjectEntrySet()) {
230
            PacketEntity reachEntity = player.compensatedEntities.entityMap.get(attack.getIntKey());
231
            if (reachEntity == null) continue;
232
233
            InteractionData interactionData = attack.getValue();
234
            CheckResult result = checkReach(reachEntity, interactionData.x, interactionData.y, interactionData.z, interactionData.hasAttackRange, interactionData.maxReach, interactionData.hitboxMargin, interactionData.attackRangeMovement, false);
235
            switch (result.type()) {
236
                case REACH -> flag(
237
                        V.write(verbose()).f64(result.minDistance()).uint(reachEntity.getType().getId(player.getClientVersion())),
238
                        () -> {
239
                            String added = ", type=" + reachEntity.getType().getName().getKey();
240
                            if (reachEntity instanceof PacketEntitySizeable sizeable) {
241
                                added += ", size=" + sizeable.size;
242
                            }
243
                            return result.verbose() + added;
244
                        });
245
                case HITBOX -> {
246
                    String added = "type=" + reachEntity.getType().getName().getKey();
247
                    if (reachEntity instanceof PacketEntitySizeable sizeable) {
248
                        added += ", size=" + sizeable.size;
249
                    }
250
                    player.checkManager.getCheck(Hitboxes.class).flag(result.verbose() + added);
251
                }
252
            }
253
        }
254
255
        playerAttackQueue.clear();
256
    }
257
258
    @NotNull
259
    private CheckResult checkReach(PacketEntity reachEntity, double x, double y, double z, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin, Vector3dm attackRangeMovement, boolean isPrediction) {
260
        SimpleCollisionBox targetBox = getTargetBox(reachEntity);
261
262
        double movementAllowance = attackRangeMovement == null ? 0 : getAttackRangeMovementAllowance(attackRangeMovement);
263
        double maxReach = applyReachModifiers(targetBox, hasAttackRange, itemMaxReach, itemHitboxMargin, !player.packetStateData.didLastLastMovementIncludePosition) + movementAllowance;
264
        double minDistance = Double.MAX_VALUE;
265
266
        // https://bugs.mojang.com/browse/MC-67665
267
        List<Vector3dm> possibleLookDirs = new ArrayList<>(Collections.singletonList(ReachUtils.getLook(player, player.yaw, player.pitch)));
268
269
        // If we are a tick behind, we don't know their next look so don't bother doing this
270
        if (!isPrediction) {
271
            // 1.7 players do not have any of these issues! They are always on the latest look vector
272
            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8)) {
273
                possibleLookDirs.add(ReachUtils.getLook(player, player.lastYaw, player.pitch));
274
275
                // 1.9+ players could be a tick behind because we don't get skipped ticks
276
                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {
277
                    possibleLookDirs.add(ReachUtils.getLook(player, player.lastYaw, player.lastPitch));
278
                }
279
            }
280
        }
281
282
        // +3 would be 3 + 3 = 6, which is the pre-1.20.5 behaviour, preventing "Missed Hitbox"
283
        final double distance = maxReach + 3;
284
285
        final double[] possibleEyeHeights = player.getPossibleEyeHeights();
286
        for (Vector3dm lookVec : possibleLookDirs) {
287
            lookVec.multiply(distance);
288
289
            for (double eye : possibleEyeHeights) {
290
                final Vector3d eyePos = new Vector3d(x, y + eye, z);
291
                Vector3d endReachPos = eyePos.add(lookVec.getX(), lookVec.getY(), lookVec.getZ());
292
293
                Vector3d intercept = ReachUtils.calculateIntercept(targetBox, eyePos, endReachPos).first();
294
295
                if (ReachUtils.isVecInside(targetBox, eyePos)) {
296
                    minDistance = 0;
297
                    break;
298
                }
299
300
                if (intercept != null) {
301
                    minDistance = Math.min(eyePos.distance(intercept), minDistance);
302
                }
303
            }
304
        }
305
306
        // if the entity is not exempt and the entity is alive
307
        if ((!blacklisted.contains(reachEntity.getType()) && reachEntity.isLivingEntity) || reachEntity.getType() == EntityTypes.END_CRYSTAL) {
308
            if (minDistance == Double.MAX_VALUE) {
309
                cancelBuffer = 1;
310
                return new CheckResult(ResultType.HITBOX, 0, 0, false);
311
            } else if (minDistance > maxReach) {
312
                cancelBuffer = 1;
313
                return new CheckResult(ResultType.REACH, minDistance, movementAllowance, attackRangeMovement != null);
314
            } else {
315
                cancelBuffer = Math.max(0, cancelBuffer - 0.25);
316
            }
317
        }
318
319
        return NONE;
320
    }
321
322
    private SimpleCollisionBox getTargetBox(PacketEntity reachEntity) {
323
        if (reachEntity.getType() == EntityTypes.END_CRYSTAL) { // Hardcode end crystal box
324
            return new SimpleCollisionBox(reachEntity.trackedServerPosition.getPos().subtract(1, 0, 1), reachEntity.trackedServerPosition.getPos().add(1, 2, 1));
325
        }
326
        return reachEntity.getPossibleCollisionBoxes();
327
    }
328
329
    private double getAttackRangeMovementAllowance(Vector3dm attackRangeMovement) {
330
        if (attackRangeMovement.lengthSquared() == 0) {
331
            return 0;
332
        }
333
334
        return getForwardMovement(attackRangeMovement, player.yaw, player.pitch);
335
    }
336
337
    private double getForwardMovement(Vector3dm movement, float yaw, float pitch) {
338
        return Math.max(0, movement.dot(ReachUtils.getLook(player, yaw, pitch)));
339
    }
340
341
    private static final boolean ATTACK_RANGE_COMPONENT_EXISTS = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_21_11);
342
    private static final boolean USE_1_8_HITBOX_MARGIN = PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8);
343
344
    private double applyReachModifiers(SimpleCollisionBox targetBox, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin, boolean giveMovementThreshold) {
345
        double maxReach;
346
        double hitboxMargin = threshold;
347
348
        if (hasAttackRange) {
349
            maxReach = itemMaxReach;
350
            hitboxMargin += itemHitboxMargin;
351
        } else {
352
            maxReach = player.compensatedEntities.self.getAttributeValue(Attributes.ENTITY_INTERACTION_RANGE);
353
            // 1.7 and 1.8 players get a bit of extra hitbox (this is why you should use 1.8 on cross version servers)
354
            // Yes, this is vanilla and not uncertainty.  All reach checks have this or they are wrong.
355
            if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9)) {
356
                hitboxMargin += 0.1f;
357
            }
358
        }
359
360
        // This is better than adding to the reach, as 0.03 can cause a player to miss their target
361
        // Adds some more than 0.03 uncertainty in some cases, but a good trade off for simplicity
362
        //
363
        // Just give the uncertainty on 1.9+ clients as we have no way of knowing whether they had 0.03 movement
364
        // However, on 1.21.2+ we do know if they had 0.03 movement
365
        if (giveMovementThreshold || player.canSkipTicks()) {
366
            hitboxMargin += player.getMovementThreshold();
367
        }
368
369
        targetBox.expand(hitboxMargin);
370
371
        return maxReach;
372
    }
373
374
    @Override
375
    public void onReload(@NotNull ConfigManager config) {
376
        this.cancelImpossibleHits = config.getBooleanElse("Reach.block-impossible-hits", true);
377
        this.threshold = config.getDoubleElse("Reach.threshold", 0.0005);
378
    }
379
380
    private enum ResultType {
381
        REACH, HITBOX, NONE
382
    }
383
384
    private record CheckResult(ResultType type, double minDistance, double extraMovement, boolean hasExtraMovement) {
385
        public boolean isFlag() {
386
            return type != ResultType.NONE;
387
        }
388
389
        public String verbose() {
390
            if (type != ResultType.REACH) {
391
                return "";
392
            }
393
394
            String verbose = String.format("%.5f", minDistance) + " blocks";
395
            if (hasExtraMovement) {
396
                verbose += String.format(", extraMovement=%.5f", extraMovement);
397
            }
398
            return verbose;
399
        }
400
    }
401
402
    private record InteractionData(double x, double y, double z, boolean hasAttackRange,
403
                                   float maxReach, float hitboxMargin, Vector3dm attackRangeMovement) {}
404
}

How it counteracts this module

Grim's Reach check computes the minimum reachable distance to the victim's hitbox via ReachUtils with the interaction attribute plus a movement allowance, passing borderline hits through an angle check. The aimbot's 4.4 default range enables C02 attacks at distances where a legit player could not land them, so attacks clicked past the survival reach bound flag even though the aim itself is precise; lowering range to 3.0 keeps the assist inside the envelope.

← Back to Analysis Hub