Rise 5.99 Aura module 4 files, 2001 lines

Rise 5.99 Aura: Full Source Analysis

Rise 5.99's Aura is a full-featured KillAura with Single, Switch and Multi attack modes, nine rotation modes (Custom, Custom Simple, Custom Advanced, Smooth, Sin Wave, Up, Down, Derp, None), eight…

dev/rise/module/impl/combat/Aura.java · GitHub source ↗

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

Analysis

Overview

Rise 5.99's Aura is a full-featured KillAura with Single, Switch and Multi attack modes, nine rotation modes (Custom, Custom Simple, Custom Advanced, Smooth, Sin Wave, Up, Down, Derp, None), eight block modes (None, Fake, Vanilla, Bypass, NCP, AAC, Interact, Hypixel), three target-sorting strategies (Distance, Health, Hurttime), and a large set of bypass settings: per-mode random rotations, GCD-fixed rotation deltas via RotationUtil, silent rotations with server yaw/pitch written into PreMotion, a movement-fix that rewrites EntityPlayer.movementYaw, target-position prediction, a client-side ray trace gate, a CPS timer with randomized delays, and an Extended Range mode that streams C04 position packets to walk the server-side position toward the target before attacking.

Architecture

The module is driven by four event handlers. onUpdate runs once per tick: it recomputes the target position (with optional ping-scaled prediction using the target's velocity doubled), picks an attack delay from the CPS settings via a TimeUtil timer, and calls the attack logic. onPreMotion applies the server rotations: with silentRotations enabled it overwrites the outgoing motion event's yaw and pitch with serverYaw/serverPitch and mirrors them into renderYawOffset and rotationYawHead, so the client view stays untouched while the server sees the aura aiming. onPostMotion fires the block-mode packets (C08 block placement, interact packets, C07 release for the Hypixel mode). onRender3DEvent calls update() to refresh the target and rotations each frame and draws the target ESP ring. A WorldChangedEvent handler disables the module when Disable On World Change is set.

Target selection and rotation math

getTargets() streams mc.theWorld.loadedEntityList, filters EntityLivingBase instances by the players/nonPlayers/invisibles/teams/dead toggles plus an AntiBot blacklist and a friend list, then applies a distance filter using the constant girth 0.5657 subtracted from getDistanceToEntity against rotationRange, and sorts by the selected sorting mode. updateTarget() takes the first entry as the static target field. getRotations() computes yaw from atan2 over the x/z delta to the predicted target position and pitch from atan2 of the vertical delta, clamps the pitch delta to [-1.4, 0.1] to keep aim near head level, applies per-mode rotation shaping (Custom clamps the per-frame delta to a random step before dividing by fps, Smooth divides by a randomized fps factor, Sin Wave clamps to a sine envelope, Derp forces pitch to 89-90), adds random jitter when the Random setting is nonzero, then feeds the result through RotationUtil.getFixedRotation, which snaps the delta to the mouse-sensitivity GCD so the server sees yaw/pitch steps that look like real mouse movement instead of arbitrary floats.

Attack dispatch and extended range

Attacks fire when the CPS timer hasReached. In Single mode the module sends C02PacketUseEntity directly through PacketUtil when keepSprint is on, otherwise calls mc.playerController.attackEntity, and calls onCriticalHit when falling. Switch mode cycles targetIndex over the sorted list; Multi mode loops the whole list, so one tick can emit several C02s at different entities. Extended Range is the notable bypass: before attacking, a loop streams up to 100 C04PacketPlayerPosition packets that step the local x/z toward the target until the distance shrinks below range minus 0.5657, then attacks, then re-sends the buffered C04s in reverse to pull the position back. The attack path also gates on a client-side ray trace: PlayerUtil.isMouseOver casts a ray from the eyes along the server yaw/pitch and requires the target's expanded AABB to intersect it, which with the Raytrace setting on prevents attacks when the aim direction does not actually cross the target. Block modes send C08 block placement (with a fake BlockPos(-1,-1,-1) in block()), C07 release, and interactWithEntitySendPacket in various per-server sequences.

source Aura.java (module logic)

Aura.java1145 lines · JavaOriginal ↗
1
package dev.rise.module.impl.combat;
2
3
import de.gerrygames.viarewind.utils.ChatUtil;
4
import dev.rise.Rise;
5
import dev.rise.event.impl.motion.PostMotionEvent;
6
import dev.rise.event.impl.motion.PreMotionEvent;
7
import dev.rise.event.impl.other.AttackEvent;
8
import dev.rise.event.impl.other.UpdateEvent;
9
import dev.rise.event.impl.other.WorldChangedEvent;
10
import dev.rise.event.impl.packet.PacketReceiveEvent;
11
import dev.rise.event.impl.packet.PacketSendEvent;
12
import dev.rise.event.impl.render.Render3DEvent;
13
import dev.rise.module.Module;
14
import dev.rise.module.api.ModuleInfo;
15
import dev.rise.module.enums.Category;
16
import dev.rise.module.impl.movement.LongJump;
17
import dev.rise.module.impl.movement.Speed;
18
import dev.rise.module.impl.player.Scaffold;
19
import dev.rise.setting.impl.BooleanSetting;
20
import dev.rise.setting.impl.ModeSetting;
21
import dev.rise.setting.impl.NoteSetting;
22
import dev.rise.setting.impl.NumberSetting;
23
import dev.rise.ui.clickgui.impl.ClickGUI;
24
import dev.rise.util.math.MathUtil;
25
import dev.rise.util.math.RandomUtil;
26
import dev.rise.util.math.TimeUtil;
27
import dev.rise.util.player.MoveUtil;
28
import dev.rise.util.player.PacketUtil;
29
import dev.rise.util.player.PlayerUtil;
30
import dev.rise.util.player.RotationUtil;
31
import dev.rise.util.render.RenderUtil;
32
import dev.rise.util.render.theme.ThemeType;
33
import dev.rise.util.render.theme.ThemeUtil;
34
import net.minecraft.client.Minecraft;
35
import net.minecraft.client.renderer.GlStateManager;
36
import net.minecraft.entity.Entity;
37
import net.minecraft.entity.EntityLivingBase;
38
import net.minecraft.entity.player.EntityPlayer;
39
import net.minecraft.init.Items;
40
import net.minecraft.item.*;
41
import net.minecraft.network.Packet;
42
import net.minecraft.network.play.client.*;
43
import net.minecraft.network.play.server.S04PacketEntityEquipment;
44
import net.minecraft.network.play.server.S09PacketHeldItemChange;
45
import net.minecraft.network.play.server.S30PacketWindowItems;
46
import net.minecraft.util.*;
47
import net.minecraft.world.World;
48
import net.minecraft.world.WorldSettings;
49
import org.lwjgl.input.Keyboard;
50
import org.lwjgl.input.Mouse;
51
import org.lwjgl.opengl.GL11;
52
53
import java.awt.*;
54
import java.util.List;
55
import java.util.*;
56
import java.util.stream.Collectors;
57
58
@ModuleInfo(name = "Aura", description = "Attacks nearby entities for you", category = Category.COMBAT)
59
public final class Aura extends Module {
60
61
    private final TimeUtil timer = new TimeUtil();
62
63
    public static EntityLivingBase target;
64
65
    public static float yaw, pitch, lastYaw, lastPitch, serverYaw, serverPitch;
66
    private float randomYaw, randomPitch, derpYaw;
67
    private float sinWaveTicks;
68
    private double targetPosX, targetPosY, targetPosZ;
69
    private Vec3 positionOnPlayer, lastPositionOnPlayer;
70
71
    private double ticks = 0;
72
    private final long lastFrame = 0;
73
    private int hitTicks, cps, targetIndex;
74
    public boolean blocking;
75
    private final List<C03PacketPlayer.C04PacketPlayerPosition> packetList = new ArrayList<>();
76
    private boolean targetstrafe;
77
78
    // Mode options.
79
    private final NoteSetting modeSettings = new NoteSetting("Mode Settings", this);
80
    private final ModeSetting mode = new ModeSetting("Mode", this, "Single", "Single", "Switch", "Multi");
81
    private final ModeSetting rotationMode = new ModeSetting("Rotation Mode", this, "Custom", "Custom", "Custom Simple", "Custom Advanced", "Smooth", "Sin Wave", "Up", "Down", "Derp", "None");
82
    private final ModeSetting blockMode = new ModeSetting("Block Mode", this, "None", "None", "Fake", "Vanilla", "Bypass", "NCP", "AAC", "Interact", "Hypixel");
83
    private final ModeSetting sortingMode = new ModeSetting("Sorting Mode", this, "Distance", "Distance", "Health", "Hurttime");
84
85
    // General boolean options.
86
    private final NoteSetting generalSettings = new NoteSetting("General Settings", this);
87
    private final NumberSetting range = new NumberSetting("Range", this, 3, 0, 6, 0.1);
88
    private final NumberSetting rotationRange = new NumberSetting("Rotation Range", this, 6, 0, 12, 0.1);
89
    private final NumberSetting extendedRangeNumb = new NumberSetting("Extended Range", this, 7, 6, 12, 0.1);
90
    private final BooleanSetting extendedRangeBool = new BooleanSetting("Extended Range", this, false);
91
    private final NumberSetting minCps = new NumberSetting("Min CPS", this, 8.0, 1, 20.0, 1);
92
    private final NumberSetting maxCps = new NumberSetting("Max CPS", this, 8.0, 1, 20.0, 1);
93
    private final NumberSetting maxTargets = new NumberSetting("Max Targets", this, 25, 2, 50, 1);
94
95
    // Bypass options.
96
    private final NoteSetting bypassSettings = new NoteSetting("Bypass Settings", this);
97
    private final NumberSetting predict = new NumberSetting("Predict", this, 0, 0, 4, 0.1);
98
    private final NumberSetting random = new NumberSetting("Random", this, 0, 0, 18, 0.1);
99
    private final NumberSetting maxRotation = new NumberSetting("Max Rot", this, 180, 1, 180, 0.1);
100
    private final NumberSetting minRotation = new NumberSetting("Min Rot", this, 180, 1, 180, 0.1);
101
    private final NumberSetting minYawRotation = new NumberSetting("Min Yaw Rot", this, 180, 1, 180, 0.1);
102
    private final NumberSetting maxYawRotation = new NumberSetting("Max Yaw Rot", this, 180, 1, 180, 0.1);
103
    private final NumberSetting minPitchRotation = new NumberSetting("Min Pitch Rot", this, 180, 1, 180, 0.1);
104
    private final NumberSetting maxPitchRotation = new NumberSetting("Max Pitch Rot", this, 180, 1, 180, 0.1);
105
    private final NumberSetting sinWaveSpeed = new NumberSetting("Sin Speed", this, 180, 1, 180, 0.1);
106
    private final NumberSetting derpSpeed = new NumberSetting("Derp Speed", this, 30, 1, 180, 1);
107
    private final BooleanSetting predictedPosition = new BooleanSetting("Predicted Position", this, false);
108
    private final BooleanSetting rayTrace = new BooleanSetting("Raytrace", this, false);
109
    private final BooleanSetting alwaysSwing = new BooleanSetting("Realistic Swings", this, false);
110
    private final BooleanSetting deadZone = new BooleanSetting("DeadZone", this, false);
111
    private final BooleanSetting throughWalls = new BooleanSetting("Through Walls", this, true);
112
    private final BooleanSetting silentRotations = new BooleanSetting("Silent Rotations", this, true);
113
    private final BooleanSetting keepSprint = new BooleanSetting("Keep Sprint", this, false);
114
    private final BooleanSetting onlyInAir = new BooleanSetting("Only In Air", this, false);
115
    private final BooleanSetting strafe = new BooleanSetting("Movement Fix", this, false);
116
    private final BooleanSetting newCombat = new BooleanSetting("1.9 Delay", this, false);
117
    private final BooleanSetting newSwing = new BooleanSetting("1.9 Swing", this, false);
118
119
    // Attacked entity types.
120
    private final NoteSetting targets = new NoteSetting("Target Settings", this);
121
    private final BooleanSetting players = new BooleanSetting("Players", this, true);
122
    private final BooleanSetting nonPlayers = new BooleanSetting("Non Players", this, true);
123
    private final BooleanSetting teams = new BooleanSetting("Ignore Teammates", this, true);
124
    private final BooleanSetting invisibles = new BooleanSetting("Invisibles", this, false);
125
    private final BooleanSetting dead = new BooleanSetting("Attack Dead", this, false);
126
127
    // Render options.
128
    private final NoteSetting renderSettings = new NoteSetting("Render Settings", this);
129
    private final BooleanSetting targetESP = new BooleanSetting("Target ESP", this, true);
130
    private final BooleanSetting displayRange = new BooleanSetting("Display Range", this, false);
131
    private final BooleanSetting targetOnPlayer = new BooleanSetting("Target On Player", this, true);
132
133
    // Other options.
134
    private final NoteSetting otherSettings = new NoteSetting("Other Settings", this);
135
    private final BooleanSetting disableOnWorldChange = new BooleanSetting("Disable On World Change", this, true);
136
    private final BooleanSetting attackWithScaffold = new BooleanSetting("Attack with Scaffold", this, false);
137
    private final BooleanSetting attackInInterfaces = new BooleanSetting("Attack in Interfaces", this, true);
138
    private final BooleanSetting onClick = new BooleanSetting("On Click", this, false);
139
140
141
    @Override
142
    public void onWorldChanged(final WorldChangedEvent event) {
143
        if (this.disableOnWorldChange.isEnabled()) {
144
            this.registerNotification("Disabled " + this.getModuleInfo().name() + " due to world change.");
145
            this.toggleModule();
146
        }
147
    }
148
149
    @Override
150
    public void onUpdateAlwaysInGui() {
151
        /*
152
         * Make sure our minimum cps is always smaller than our maximum and our maximum
153
         * being bigger than minimum as we do not want errors with our random utilities.
154
         */
155
        if (this.maxCps.getValue() < this.minCps.getValue()) {
156
            maxCps.setValue(minCps.getValue());
157
        }
158
159
        if (this.rotationRange.getValue() < this.range.getValue()) {
160
            this.rotationRange.setValue(this.range.getValue());
161
        }
162
163
        maxTargets.hidden = !this.mode.is("Multi");
164
165
        minRotation.hidden = this.maxRotation.hidden = !this.rotationMode.is("Custom") && !this.rotationMode.is("Custom Simple");
166
167
        minYawRotation.hidden = maxYawRotation.hidden = minPitchRotation.hidden = maxPitchRotation.hidden = !this.rotationMode.is("Custom Advanced");
168
169
        sinWaveSpeed.hidden = !rotationMode.is("Sin Wave");
170
171
        derpSpeed.hidden = !rotationMode.is("Derp");
172
173
        extendedRangeNumb.hidden = !extendedRangeBool.isEnabled();
174
175
        predictedPosition.hidden = rotationMode.is("Derp") || rotationMode.is("None");
176
177
        onlyInAir.hidden = !keepSprint.isEnabled();
178
    }
179
180
    @Override
181
    public void onPacketSend(final PacketSendEvent event) {
182
        if (blockMode.getMode().equals("Hypixel")) {
183
        }
184
    }
185
186
    @Override
187
    public void onPacketReceive(final PacketReceiveEvent event) {
188
        final Packet<?> p = event.getPacket();
189
190
        if (p instanceof S30PacketWindowItems) {
191
            blocking = false;
192
        }
193
    }
194
195
    @Override
196
    public void onPreMotion(final PreMotionEvent event) {
197
        ++this.hitTicks;
198
//        if (target != null && blockMode.is("Hypixel")) {
199
//            double playerDistance = mc.thePlayer.getDistanceToEntity(target);
200
//            if (playerDistance <= range.getValue() && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() instanceof net.minecraft.item.ItemSword)
201
//                mc.thePlayer.setItemInUse(mc.thePlayer.getCurrentEquippedItem(), mc.thePlayer.getCurrentEquippedItem().getMaxItemUseDuration());
202
//        }
203
204
        if (blockMode.getMode().equals("Hypixel")) {
205
            if (target == null) {
206
                mc.gameSettings.keyBindUseItem.setKeyPressed(Mouse.isButtonDown(1));
207
            }
208
        }
209
210
        /* Used to determine if targetstrafe is enabled so aura doesn't override movementyaw */
211
        targetstrafe = this.
212
213
                getModule(TargetStrafe.class).
214
215
                isEnabled();
216
217
        handle:
218
219
        {
220
            /*
221
             * If we do not have a target that means we cannot run the aura, so we
222
             * can just break our label here as there is no point in going further.
223
             */
224
            if (target == null) {
225
                /*
226
                 * We want to make sure whilst we do not have a target to attack we
227
                 * do not break the players strafing, so we reset it every tick in here.
228
                 */
229
                if (!targetstrafe) EntityPlayer.movementYaw = null;
230
231
                /*
232
                 * Unblocking sword serverside if sword is blocked,
233
                 * this is to stop movement from flagging on some AntiCheats
234
                 * because the sword is still blocking and the player still runs at full speed.
235
                 */
236
                unblock();
237
238
                break handle;
239
            } else {
240
                switch (blockMode.getMode()) {
241
                    case "NCP":
242
                    case "Interact":
243
                        unblock();
244
245
                        break;
246
                }
247
            }
248
249
            /*
250
             * Whilst we have silent rotations enabled we only want the rotations to be seen server sided.
251
             * And whilst we have non-silent rotations we can just update our rotations manually.
252
             */
253
            if (this.silentRotations.isEnabled() && !rotationMode.is("None")) {
254
                if (!(PlayerUtil.isOnServer("Hypixel") && (this.getModule(Speed.class).isEnabled() || this.getModule(LongJump.class).isEnabled()))) {
255
                    event.setYaw(serverYaw);
256
                    event.setPitch(serverPitch);
257
                }
258
259
                mc.thePlayer.renderYawOffset = serverYaw;
260
                mc.thePlayer.rotationYawHead = serverYaw;
261
            } else {
262
                mc.thePlayer.rotationYaw = serverYaw;
263
                mc.thePlayer.rotationPitch = serverPitch;
264
            }
265
266
            /*
267
             * Gets position on player to be used for render options
268
             */
269
270
            MovingObjectPosition movingObjectPosition = PlayerUtil.getMouseOver(serverYaw, serverPitch, (float) range.getValue());
271
272
            if (movingObjectPosition == null) {
273
                return;
274
            }
275
276
            final Vec3 rayCast = Objects.requireNonNull(movingObjectPosition).hitVec;
277
            if (rayCast == null) return;
278
            lastPositionOnPlayer = positionOnPlayer;
279
            positionOnPlayer = rayCast;
280
        }
281
282
    }
283
284
    @Override
285
    public void onPostMotion(final PostMotionEvent event) {
286
        if (target != null && PlayerUtil.isHoldingSword()) {
287
            switch (blockMode.getMode()) {
288
                case "NCP":
289
                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));
290
                    break;
291
292
                case "Interact":
293
                    mc.playerController.interactWithEntitySendPacket(mc.thePlayer, target);
294
                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));
295
                    break;
296
297
                case "Hypixel":
298
                    if (mc.thePlayer.swingProgressInt == 1) {
299
                        PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
300
                    } else if (mc.thePlayer.swingProgressInt == 2) {
301
                        PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));
302
                    }
303
                    break;
304
            }
305
        }
306
    }
307
308
    @Override
309
    public void onUpdate(final UpdateEvent event) {
310
        if (!(!onClick.isEnabled() || Mouse.isButtonDown(0))) {
311
            target = null;
312
            return;
313
        }
314
315
        if (target == null) {
316
            /*
317
             * We want to make sure whilst we do not have a target to attack we
318
             * do not break the players strafing, so we reset it every tick in here.
319
             */
320
            if (!targetstrafe) EntityPlayer.movementYaw = null;
321
322
            /*
323
             * This unblocks the aura when its not in a situation to block, because otherwise you flag movement
324
             */
325
            unblock();
326
327
            sinWaveTicks = 0;
328
329
            return;
330
        }
331
332
        double ping = 250;
333
        ping /= 50;
334
        if (predictedPosition.isEnabled()) {
335
            final double deltaX = (target.posX - target.lastTickPosX) * 2;
336
            final double deltaY = (target.posY - target.lastTickPosY) * 2;
337
            final double deltaZ = (target.posZ - target.lastTickPosZ) * 2;
338
            targetPosX = target.posX + deltaX * ping;
339
            targetPosY = target.posY + deltaY * ping;
340
            targetPosZ = target.posZ + deltaZ * ping;
341
        } else {
342
            targetPosX = target.posX;
343
            targetPosY = target.posY;
344
            targetPosZ = target.posZ;
345
        }
346
347
        if (AutoGap.gap != -37) {
348
            this.unblock();
349
            return;
350
        }
351
352
        if (!rotationMode.is("Sin Wave"))
353
            sinWaveTicks = 0;
354
355
        if ((this.getModule(Scaffold.class).isEnabled() && !attackWithScaffold.isEnabled())
356
                || ((mc.currentScreen != null && !(mc.currentScreen instanceof ClickGUI)) && !attackInInterfaces.isEnabled())) {
357
            unblock();
358
            target = null;
359
            return;
360
        }
361
362
        /*
363
         * For our movement to be correctly fixed we are going to have
364
         * to use rotations the server actually sees instead of the
365
         * current ones as our rotations update per frame and this
366
         * will make it so our movement yaw and server yaw will
367
         * be different which will cause issues.
368
         */
369
        serverYaw = yaw;
370
        serverPitch = pitch;
371
372
        /*
373
         * If we want to correct our movement whilst rotating silently we can update
374
         * the movementYaw variable which will correct our movement to the given yaw for us.
375
         */
376
        if (this.strafe.isEnabled() && this.silentRotations.isEnabled()) EntityPlayer.movementYaw = serverYaw;
377
        else if (!targetstrafe) EntityPlayer.movementYaw = null;
378
379
        double delayValue = -1;
380
381
        /*
382
         * In the modern versions of Minecraft there is a hit delay which occurs when you hit somebody.
383
         * On specific items for a certain amount of ticks causes low damage until the time required has passed.
384
         * We have the delays set in here as an option for people who play on 1.9 and above servers.
385
         */
386
        if (this.newCombat.isEnabled()) {
387
            delayValue = 4;
388
389
            if (mc.thePlayer.getHeldItem() != null) {
390
                final Item item = mc.thePlayer.getHeldItem().getItem();
391
392
                if (item instanceof ItemSpade || item == Items.golden_axe || item == Items.diamond_axe || item == Items.wooden_hoe || item == Items.golden_hoe)
393
                    delayValue = 20;
394
395
                if (item == Items.wooden_axe || item == Items.stone_axe)
396
                    delayValue = 25;
397
398
                if (item instanceof ItemSword)
399
                    delayValue = 12;
400
401
                if (item instanceof ItemPickaxe)
402
                    delayValue = 17;
403
404
                if (item == Items.iron_axe)
405
                    delayValue = 22;
406
407
                if (item == Items.stone_hoe)
408
                    delayValue = 10;
409
410
                if (item == Items.iron_hoe)
411
                    delayValue = 7;
412
            }
413
414
            delayValue *= Math.max(1, mc.timer.timerSpeed);
415
        }
416
417
        boolean attack = false;
418
419
        /*
420
         * This is the part we actually calculate the click delay we need in order land another hit.
421
         * The attack boolean will be true when the time required for another attack passes.
422
         */
423
        if (this.timer.hasReached(this.cps)) {
424
            final int maxValue = (int) ((this.minCps.getMaximum() - this.maxCps.getValue()) * 20);
425
            final int minValue = (int) ((this.minCps.getMaximum() - this.minCps.getValue()) * 20);
426
427
            this.cps = (int) (randomBetween(minValue, maxValue) - MathUtil.RANDOM.nextInt(10) + MathUtil.RANDOM.nextInt(10));
428
429
            this.timer.reset();
430
431
            attack = true;
432
        } else if (blockMode.is("Bypass"))
433
            this.unblock();
434
435
        /*
436
         * Updates the Derp Rotation Modes yaw so that it rotates.
437
         */
438
        derpYaw += derpSpeed.getValue() - (((Math.random() - 0.5) * random.getValue()) / 2);
439
440
        if ((!newSwing.isEnabled() && attack) || (newSwing.isEnabled() && this.hitTicks > delayValue)) {
441
            final boolean rayCast = PlayerUtil.isMouseOver(serverYaw, serverPitch, target, (float) range.getValue()) || predictedPosition.isEnabled();
442
            double x = mc.thePlayer.posX;
443
            double z = mc.thePlayer.posZ;
444
            final double y = mc.thePlayer.posY;
445
            final double endPositionX = targetPosX;
446
            final double endPositionZ = targetPosZ;
447
            double distanceX = x - endPositionX;
448
            double distanceZ = z - endPositionZ;
449
            double distanceY = y - targetPosY;
450
            double distance = MathHelper.sqrt_double(distanceX * distanceX + distanceY * distanceY + distanceZ * distanceZ) * 6.5;
451
            if (extendedRangeBool.isEnabled()) {
452
                int packets = 0;
453
454
                while (distance > (range.getValue() - 0.5657) * 6.5 && packets < 100) {
455
                    final C03PacketPlayer.C04PacketPlayerPosition c04 = new C03PacketPlayer.C04PacketPlayerPosition(x, mc.thePlayer.posY, z, true);
456
457
                    PacketUtil.sendPacket(c04);
458
459
                    packetList.add(c04);
460
461
                    distanceX = x - endPositionX;
462
                    distanceZ = z - endPositionZ;
463
                    distanceY = y - targetPosY;
464
                    distance = MathHelper.sqrt_double(distanceX * distanceX + distanceY * distanceY + distanceZ * distanceZ) * 6.5;
465
466
                    final double v = (x * distance + endPositionX) / (distance + 1) - x;
467
                    final double v1 = (z * distance + endPositionZ) / (distance + 1) - z;
468
                    Rise.addChatMessage(MathHelper.sqrt_double(v * v + v1 * v1));
469
470
                    x = (x * distance + endPositionX) / (distance + 1);
471
                    z = (z * distance + endPositionZ) / (distance + 1);
472
473
                    packets++;
474
                }
475
            }
476
477
            /*
478
             * Whilst the time required to attack an entity again has passed and our raytrace failed
479
             * when this setting enabled the client will swing even tho it cannot see it causing more
480
             * realistic swinging during pvp which could help making the aura less detectable.
481
             */
482
            if ((mc.thePlayer.getDistance(targetPosX, targetPosY, targetPosZ) - 0.5657 > ((this.extendedRangeBool.isEnabled()) ? this.extendedRangeNumb.getValue() : this.range.getValue()) && !rayCast)
483
                    || (this.rayTrace.isEnabled() && !rayCast)) {
484
                if (this.alwaysSwing.isEnabled()) {
485
                    PacketUtil.sendPacket(new C0APacketAnimation());
486
                    return;
487
                }
488
            }
489
490
            /*
491
             * We want to make sure the target is actually on our attack distance and not only our rotation distance.
492
             * Plus if raytrace is enabled we shall make sure there is an intersection.
493
             */
494
            if (mc.thePlayer.getDistance(targetPosX, targetPosY, targetPosZ) - 0.5657 > ((this.extendedRangeBool.isEnabled()) ? this.extendedRangeNumb.getValue() : this.range.getValue())
495
                    || (this.rayTrace.isEnabled() && !rayCast)) return;
496
497
            /*
498
             * If we are not allowed to hit through walls we should not
499
             * attack the entity by checking if we can see them or not.
500
             */
501
            if (!this.throughWalls.isEnabled() && !mc.thePlayer.canEntityBeSeen(target)) return;
502
503
            /*
504
             * On the legacy versions of Minecraft the player before sending an interaction
505
             * packet sends a swing packet. Which is not the case on newer versions.
506
             */
507
            if (!this.newSwing.isEnabled()) mc.thePlayer.swingItem();
508
509
            /*
510
             * When keep sprint is disabled to keep everything vanilla about
511
             * movement we can use the games attack method to keep everything vanilla.
512
             */
513
514
            switch (this.blockMode.getMode()) {
515
                case "AAC":
516
                case "Interact": {
517
                    this.unblock();
518
                    break;
519
                }
520
            }
521
522
523
            switch (mode.getMode()) {
524
                case "Single": {
525
                    /*
526
                     * Calls attack event so other modules can use information from the entity
527
                     * When the C02 packet is sent the attack event does not
528
                     * get called, so we have to manually call it ourselves in here.
529
                     */
530
                    final AttackEvent attackEvent = new AttackEvent(target);
531
                    attackEvent.call();
532
533
                    if (attackEvent.isCancelled())
534
                        return;
535
536
                    if (this.keepSprint.isEnabled() && (!mc.thePlayer.onGround || !onlyInAir.isEnabled())) {
537
                        PacketUtil.sendPacket(new C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));
538
                    } else {
539
                        mc.playerController.attackEntity(mc.thePlayer, target);
540
                    }
541
542
                    if (mc.thePlayer.fallDistance > 0) mc.thePlayer.onCriticalHit(target);
543
                    break;
544
                }
545
546
                case "Switch": {
547
                    final List<EntityLivingBase> entities = getTargets();
548
549
                    if (entities.size() >= targetIndex)
550
                        targetIndex = 0;
551
552
                    if (entities.isEmpty()) {
553
                        targetIndex = 0;
554
                        return;
555
                    }
556
557
                    final EntityLivingBase entity = entities.get(targetIndex);
558
559
                    /*
560
                     * Calls attack event so other modules can use information from the entity
561
                     * When the C02 packet is sent the attack event does not
562
                     * get called, so we have to manually call it ourselves in here.
563
                     */
564
                    final AttackEvent attackEvent = new AttackEvent(entity);
565
                    attackEvent.call();
566
567
                    if (attackEvent.isCancelled())
568
                        return;
569
570
                    if (this.keepSprint.isEnabled() && (!mc.thePlayer.onGround || !onlyInAir.isEnabled())) {
571
                        PacketUtil.sendPacket(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));
572
                    } else {
573
                        mc.playerController.attackEntity(mc.thePlayer, entity);
574
                    }
575
576
                    if (mc.thePlayer.fallDistance > 0) mc.thePlayer.onCriticalHit(target);
577
578
                    targetIndex++;
579
                    break;
580
                }
581
582
                case "Multi": {
583
                    for (final EntityLivingBase entity : getTargets()) {
584
                        /*
585
                         * Calls attack event so other modules can use information from the entity
586
                         * When the C02 packet is sent the attack event does not
587
                         * get called, so we have to manually call it ourselves in here.
588
                         */
589
                        final AttackEvent attackEvent = new AttackEvent(target);
590
                        attackEvent.call();
591
592
                        if (attackEvent.isCancelled())
593
                            return;
594
595
                        if (this.keepSprint.isEnabled() && (!mc.thePlayer.onGround || !onlyInAir.isEnabled())) {
596
                            PacketUtil.sendPacket(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));
597
                        } else {
598
                            mc.playerController.attackEntity(mc.thePlayer, entity);
599
                        }
600
601
                        if (mc.thePlayer.fallDistance > 0) mc.thePlayer.onCriticalHit(entity);
602
                    }
603
                    break;
604
                }
605
            }
606
607
            /*
608
             *
609
             */
610
            if (extendedRangeBool.isEnabled()) {
611
                Collections.reverse(packetList);
612
                packetList.forEach(PacketUtil::sendPacket);
613
                packetList.clear();
614
            }
615
616
            /*
617
             * On the modern versions of Minecraft unlike legacy the player
618
             * sends an arm swing after they interact with the object.
619
             */
620
            if (this.newSwing.isEnabled()) mc.thePlayer.swingItem();
621
622
            // Resetting the hit ticks
623
            this.hitTicks = 0;
624
        }
625
626
        if (PlayerUtil.isHoldingSword() && !Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule("Scaffold")).isEnabled()) {
627
            switch (this.blockMode.getMode()) {
628
                case "AAC": {
629
                    if (mc.thePlayer.ticksExisted % 2 == 0) {
630
                        mc.playerController.interactWithEntitySendPacket(mc.thePlayer, target);
631
                        PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));
632
                    }
633
                    break;
634
                }
635
636
                case "Bypass":
637
                case "Vanilla": {
638
                    PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem()));
639
                    break;
640
                }
641
            }
642
        }
643
    }
644
645
    @Override
646
    public void onRender3DEvent(final Render3DEvent event) {
647
        this.update();
648
649
        if (this.targetESP.isEnabled()) {
650
            switch (mode.getMode()) {
651
                case "Single":
652
                case "Switch": {
653
                    if (target != null) {
654
                        drawCircle(target, 0.67, Rise.CLIENT_THEME_COLOR, true);
655
                    }
656
                    break;
657
                }
658
659
                case "Multi": {
660
                    for (final EntityLivingBase entity : getTargets()) {
661
                        drawCircle(entity, 0.67, Rise.CLIENT_THEME_COLOR, true);
662
                    }
663
                    break;
664
                }
665
            }
666
        }
667
668
        if (positionOnPlayer != null && lastPositionOnPlayer != null && target != null && targetOnPlayer.isEnabled()) {
669
            Vec3 interpolatedPosition = new Vec3(
670
                    (positionOnPlayer.xCoord - lastPositionOnPlayer.xCoord) * mc.timer.renderPartialTicks + lastPositionOnPlayer.xCoord,
671
                    (positionOnPlayer.yCoord - lastPositionOnPlayer.yCoord) * mc.timer.renderPartialTicks + lastPositionOnPlayer.yCoord,
672
                    (positionOnPlayer.zCoord - lastPositionOnPlayer.zCoord) * mc.timer.renderPartialTicks + lastPositionOnPlayer.zCoord);
673
            RenderUtil.renderBreadCrumb(interpolatedPosition);
674
        }
675
676
        if (this.displayRange.isEnabled()) {
677
            this.drawCircle(mc.thePlayer, this.range.getValue() - 1);
678
        }
679
    }
680
681
    @Override
682
    protected void onEnable() {
683
        ticks = 66;
684
685
        /*
686
         * For the first rotation to be properly rounded we can set our last
687
         * rotations to our current rotations in order to round everything properly.
688
         */
689
        lastYaw = mc.thePlayer.rotationYaw;
690
        lastPitch = mc.thePlayer.rotationPitch;
691
        yaw = mc.thePlayer.rotationYaw;
692
        pitch = mc.thePlayer.rotationPitch;
693
694
        sinWaveTicks = 0;
695
696
        /*
697
         * Sets blocking variable, so we can use this to not send extra blocking packets
698
         */
699
        blocking = mc.gameSettings.keyBindUseItem.isKeyDown();
700
    }
701
702
    @Override
703
    protected void onDisable() {
704
        // We do not want to strafe whilst not using aura.
705
        if (!targetstrafe) EntityPlayer.movementYaw = null;
706
707
        // Resetting the target index for Switch.
708
        targetIndex = 0;
709
710
        // Reset our timer for our attacks.
711
        timer.reset();
712
713
        // Set our target null as we do not want other stuff thinking we are attacking something.
714
        target = null;
715
716
        // This will only unblock if you're already blocking
717
        mc.gameSettings.keyBindUseItem.setKeyPressed(Mouse.isButtonDown(1));
718
        unblock();
719
    }
720
721
    /**
722
     * The update method is used to grab the target we want to attack
723
     * based on given settings and update the rotations and the last rotations.
724
     */
725
    private void update() {
726
        if ((this.getModule(Scaffold.class).isEnabled() && !attackWithScaffold.isEnabled())
727
                || ((mc.currentScreen != null && !(mc.currentScreen instanceof ClickGUI)) && !attackInInterfaces.isEnabled())) {
728
            unblock();
729
            target = null;
730
            return;
731
        }
732
733
        // Update our target for the aura as we want the entity we want to attack right now.
734
        this.updateTarget();
735
736
        /*
737
         * If the aura could not find a target on the specified settings
738
         * we cannot grab rotations or attack anything so we can return.
739
         */
740
        if (target == null) {
741
            lastYaw = mc.thePlayer.rotationYaw;
742
            lastPitch = mc.thePlayer.rotationPitch;
743
        } else {
744
            /*
745
             * Because we have found a target successfully we can grab the
746
             * required rotations to look and actually attack this target.
747
             */
748
            this.updateRotations();
749
        }
750
    }
751
752
    private void block() {
753
        sendUseItem(mc.thePlayer, mc.theWorld, mc.thePlayer.getCurrentEquippedItem());
754
        mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, mc.thePlayer.getHeldItem(), 0, 0, 0));
755
        blocking = true;
756
    }
757
758
    private void unblock() {
759
        if (blocking) {
760
            PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
761
            blocking = false;
762
        }
763
    }
764
765
    public void sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn) {
766
        if (!(mc.playerController.currentGameType == WorldSettings.GameType.SPECTATOR) && itemStackIn != null) {
767
            mc.playerController.syncCurrentPlayItem();
768
            int i = itemStackIn.stackSize;
769
            ItemStack itemstack = itemStackIn.useItemRightClick(worldIn,
770
                    playerIn);
771
772
            if (itemstack != itemStackIn || itemstack.stackSize != i) {
773
                playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack;
774
775
                if (itemstack.stackSize == 0) {
776
                    playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null;
777
                }
778
779
            }
780
        }
781
    }
782
783
    private void updateRotations() {
784
        /*
785
         * Update our last rotations as the current ones as we are updating
786
         * the current ones soon. We require the last rotations to smooth
787
         * out the current rotations properly based on the last rotations.
788
         */
789
        lastYaw = yaw;
790
        lastPitch = pitch;
791
792
        /*
793
         * Finally grab the required rotations to actually aim at the target.
794
         * We do not need to pass in any parameters as the method already grabs the settings for us.
795
         */
796
        final float[] rotations = this.getRotations();
797
798
        /*
799
         * We can now update the rotation fields for the aura so the client
800
         * can send the server the rotations we actually want to apply.
801
         */
802
        yaw = rotations[0];
803
        pitch = rotations[1];
804
805
        if (deadZone.isEnabled()) {
806
            if (rayTrace(lastYaw, lastPitch, rotationRange.getValue(), target)) {
807
                yaw = lastYaw;
808
                pitch = lastPitch;
809
            }
810
        }
811
    }
812
813
    private float[] getRotations() {
814
        final double predictValue = predict.getValue();
815
816
        final double x = (targetPosX - (target.lastTickPosX - targetPosX) * predictValue) + 0.01 - mc.thePlayer.posX;
817
        final double z = (targetPosZ - (target.lastTickPosZ - targetPosZ) * predictValue) - mc.thePlayer.posZ;
818
819
        double minus = (mc.thePlayer.posY - targetPosY);
820
821
        if (minus < -1.4) minus = -1.4;
822
        if (minus > 0.1) minus = 0.1;
823
824
        final double y = (targetPosY - (target.lastTickPosY - targetPosY) * predictValue) + 0.4 + target.getEyeHeight() / 1.3 - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight()) + minus;
825
826
        final double xzSqrt = MathHelper.sqrt_double(x * x + z * z);
827
828
        float yaw = MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2(z, x)) - 90.0F);
829
        float pitch = MathHelper.wrapAngleTo180_float((float) Math.toDegrees(-Math.atan2(y, xzSqrt)));
830
831
        final double randomAmount = random.getValue();
832
833
        if (randomAmount != 0) {
834
            randomYaw += ((Math.random() - 0.5) * randomAmount) / 2;
835
            randomYaw += ((Math.random() - 0.5) * randomAmount) / 2;
836
            randomPitch += ((Math.random() - 0.5) * randomAmount) / 2;
837
838
            if (mc.thePlayer.ticksExisted % 5 == 0) {
839
                randomYaw = (float) (((Math.random() - 0.5) * randomAmount) / 2);
840
                randomPitch = (float) (((Math.random() - 0.5) * randomAmount) / 2);
841
            }
842
843
            yaw += randomYaw;
844
            pitch += randomPitch;
845
        }
846
847
        final int fps = (int) (Minecraft.getDebugFPS() / 20.0F);
848
849
        switch (this.rotationMode.getMode()) {
850
            case "Custom": {
851
                if (this.maxRotation.getValue() != 180.0F && this.minRotation.getValue() != 180.0F) {
852
                    final float distance = (float) randomBetween(this.minRotation.getValue(), this.maxRotation.getValue());
853
854
                    final float deltaYaw = (((yaw - lastYaw) + 540) % 360) - 180;
855
                    final float deltaPitch = pitch - lastPitch;
856
857
                    final float distanceYaw = MathHelper.clamp_float(deltaYaw, -distance, distance) / fps * 4;
858
                    final float distancePitch = MathHelper.clamp_float(deltaPitch, -distance, distance) / fps * 4;
859
860
                    yaw = MathHelper.wrapAngleTo180_float(lastYaw) + distanceYaw;
861
                    pitch = MathHelper.wrapAngleTo180_float(lastPitch) + distancePitch;
862
                }
863
                break;
864
            }
865
866
            case "Custom Simple": {
867
                final float yawDistance = (float) randomBetween(this.minRotation.getValue(), this.maxRotation.getValue());
868
                final float pitchDistance = (float) randomBetween(this.minRotation.getValue(), this.maxRotation.getValue());
869
870
871
                final float deltaYaw = (((yaw - lastYaw) + 540) % 360) - 180;
872
                final float deltaPitch = pitch - lastPitch;
873
874
                final float distanceYaw = MathHelper.clamp_float(deltaYaw, -yawDistance, yawDistance) / fps * 4;
875
                final float distancePitch = MathHelper.clamp_float(deltaPitch, -pitchDistance, pitchDistance) / fps * 4;
876
877
                yaw = lastYaw + distanceYaw;
878
                pitch = lastPitch + distancePitch;
879
                break;
880
            }
881
882
            case "Custom Advanced": {
883
                final float advancedYawDistance = (float) randomBetween(this.minYawRotation.getValue(), this.maxYawRotation.getValue());
884
                final float advancedPitchDistance = (float) randomBetween(this.minPitchRotation.getValue(), this.maxPitchRotation.getValue());
885
886
                final float advancedDeltaYaw = (((yaw - lastYaw) + 540) % 360) - 180;
887
                final float advancedDeltaPitch = pitch - lastPitch;
888
889
                final float advancedDistanceYaw = MathHelper.clamp_float(advancedDeltaYaw, -advancedYawDistance, advancedYawDistance) / fps * 4;
890
                final float advancedDistancePitch = MathHelper.clamp_float(advancedDeltaPitch, -advancedPitchDistance, advancedPitchDistance) / fps * 4;
891
892
                yaw = lastYaw + advancedDistanceYaw;
893
                pitch = lastPitch + advancedDistancePitch;
894
                break;
895
            }
896
897
            case "Smooth": {
898
                final float yawDelta = (float) (((((yaw - lastYaw) + 540) % 360) - 180) / (fps / 3 * (1 + Math.random())));
899
                final float pitchDelta = (float) ((pitch - lastPitch) / (fps / 3 * (1 + Math.random())));
900
901
                yaw = lastYaw + yawDelta;
902
                pitch = lastPitch + pitchDelta;
903
904
                break;
905
            }
906
907
            case "Down": {
908
                pitch = (float) MathUtil.getRandom(89, 90);
909
                break;
910
            }
911
912
            case "Up": {
913
                pitch = (float) MathUtil.getRandom(-80, -81);
914
                break;
915
            }
916
917
            case "Derp": {
918
                pitch = (float) MathUtil.getRandom(89, 90);
919
                yaw = derpYaw;
920
                break;
921
            }
922
923
            case "Sin Wave": {
924
                final float halal = (float) (Math.abs(Math.sin((sinWaveTicks + Math.random() * 0.001) / 10)) * sinWaveSpeed.getValue());
925
926
                final float sinWaveYaw = MathHelper.clamp_float((((yaw - lastYaw) + 540) % 360) - 180, -halal, halal) / fps;
927
                final float sinWavePitch = MathHelper.clamp_float(pitch - lastPitch, -halal, halal) / fps / fps;
928
929
                yaw = lastYaw + sinWaveYaw;
930
                pitch = lastPitch + sinWavePitch;
931
932
                sinWaveTicks++;
933
                break;
934
            }
935
        }
936
937
        final float[] rotations = new float[]{yaw, pitch};
938
        final float[] lastRotations = new float[]{Aura.yaw, Aura.pitch};
939
940
        final float[] fixedRotations = RotationUtil.getFixedRotation(rotations, lastRotations);
941
942
        yaw = fixedRotations[0];
943
        pitch = fixedRotations[1];
944
945
        if (this.rotationMode.is("None")) {
946
            yaw = mc.thePlayer.rotationYaw;
947
            pitch = mc.thePlayer.rotationPitch;
948
        }
949
950
        pitch = MathHelper.clamp_float(pitch, -90.0F, 90.0F);
951
952
        return new float[]{yaw, pitch};
953
    }
954
955
    private List<EntityLivingBase> getTargets() {
956
        final List<EntityLivingBase> entities = mc.theWorld.loadedEntityList
957
                // Stream our entity list.
958
                .stream()
959
960
                // Only get living entities so we don't have to check for items on ground etc.
961
                .filter(entity -> entity instanceof EntityLivingBase)
962
963
                // Map our entities to entity living base as we have filtered out none living entities.
964
                .map(entity -> ((EntityLivingBase) entity))
965
966
                // Only get the entities we can attack.
967
                .filter(entity -> {
968
                    if (entity instanceof EntityPlayer && !players.isEnabled()) return false;
969
970
                    if (!(entity instanceof EntityPlayer) && !nonPlayers.isEnabled()) return false;
971
972
                    if (entity.isInvisible() && !invisibles.isEnabled()) return false;
973
974
                    if (PlayerUtil.isOnSameTeam(entity) && teams.isEnabled()) return false;
975
976
                    if (entity.isDead && !dead.isEnabled()) return false;
977
978
                    if (entity.deathTime != 0 && !dead.isEnabled()) return false;
979
980
                    if (entity.ticksExisted < 2) return false;
981
982
                    if (AntiBot.bots.contains(entity)) return false;
983
984
                    if (entity instanceof EntityPlayer) {
985
                        final EntityPlayer player = ((EntityPlayer) entity);
986
987
                        for (final String name : instance.getFriends()) {
988
                            if (name.equalsIgnoreCase(player.getGameProfile().getName()))
989
                                return false;
990
                        }
991
992
                        // dude there's nothing here
993
                        String[] hotPeople = new String[]{"Hazsi", "Swerzzzy", "Duumy", "FREEDALEK", "GANGMEMBERZIZI"};
994
                        for (String name : hotPeople) {
995
                            if (player.getName().equals(name)) return false;
996
                        }
997
998
                        if (PlayerUtil.isOnServer("blocksmc") && (player.getName().contains("SHOP") || player.getName().contains("UPGRADES")))
999
                            return false;
1000
                    }
1001
1002
                    return mc.thePlayer != entity;
1003
                })
1004
1005
                // Do a proper distance calculation to get entities we can reach.
1006
                .filter(entity -> {
1007
                    // DO NOT TOUCH THIS VALUE ITS CALCULATED WITH MATH
1008
                    final double girth = 0.5657;
1009
1010
                    // See if the other entity is in our range.
1011
                    return mc.thePlayer.getDistanceToEntity(entity) - girth < rotationRange.getValue();
1012
                })
1013
1014
                // Sort out potential targets with the algorithm provided as a setting.
1015
                .sorted(Comparator.comparingDouble(entity -> {
1016
                    switch (sortingMode.getMode()) {
1017
                        case "Distance":
1018
                            return mc.thePlayer.getDistanceSqToEntity(entity);
1019
                        case "Health":
1020
                            return entity.getHealth();
1021
                        case "Hurttime":
1022
                            return entity.hurtTime;
1023
1024
                        default:
1025
                            return -1;
1026
                    }
1027
                }))
1028
1029
                // Sort out all the specified targets.
1030
                .sorted(Comparator.comparing(entity -> entity instanceof EntityPlayer && !Rise.INSTANCE.getTargets().contains(((EntityPlayer) entity).getName())))
1031
1032
                // Get the possible targets and put them in a list.
1033
                .collect(Collectors.toList());
1034
1035
        // Removes entities when there are too many targets
1036
        final int maxTargets = (int) Math.round(this.maxTargets.getValue());
1037
1038
        if (mode.is("Multi") && entities.size() > maxTargets) {
1039
            entities.subList(maxTargets, entities.size()).clear();
1040
        }
1041
1042
        // Returns the list of entities
1043
        return entities;
1044
    }
1045
1046
    private void updateTarget() {
1047
        final List<EntityLivingBase> entities = getTargets();
1048
1049
        // Grab our best option from the list.
1050
        target = entities.size() > 0 ? entities.get(0) : null;
1051
    }
1052
1053
    public double randomBetween(final double min, final double max) {
1054
        return min + (MathUtil.RANDOM.nextDouble() * (max - min));
1055
    }
1056
1057
    private boolean rayTrace(final float yaw, final float pitch, final double reach, final Entity target) {
1058
        final Vec3 vec3 = mc.thePlayer.getPositionEyes(mc.timer.renderPartialTicks);
1059
        final Vec3 vec31 = mc.thePlayer.getVectorForRotation(MathHelper.clamp_float(pitch, -90.F, 90.F), yaw % 360);
1060
        final Vec3 vec32 = vec3.addVector(vec31.xCoord * reach, vec31.yCoord * reach, vec31.zCoord * reach);
1061
1062
        final MovingObjectPosition objectPosition = target.getEntityBoundingBox().calculateIntercept(vec3, vec32);
1063
1064
        return (objectPosition != null && objectPosition.hitVec != null);
1065
    }
1066
1067
    private void drawCircle(final Entity entity, final double rad, final int color, final boolean shade) {
1068
        GL11.glPushMatrix();
1069
        GL11.glDisable(3553);
1070
        GL11.glEnable(2848);
1071
        GL11.glEnable(2832);
1072
        GL11.glEnable(3042);
1073
        GL11.glBlendFunc(770, 771);
1074
        GL11.glHint(3154, 4354);
1075
        GL11.glHint(3155, 4354);
1076
        GL11.glHint(3153, 4354);
1077
        GL11.glDepthMask(false);
1078
        GlStateManager.alphaFunc(GL11.GL_GREATER, 0.0F);
1079
        if (shade) GL11.glShadeModel(GL11.GL_SMOOTH);
1080
        GlStateManager.disableCull();
1081
        GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
1082
1083
        final double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * mc.timer.renderPartialTicks - (mc.getRenderManager()).renderPosX;
1084
        final double y = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * mc.timer.renderPartialTicks - (mc.getRenderManager()).renderPosY) + Math.sin(System.currentTimeMillis() / 2E+2) + 1;
1085
        final double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * mc.timer.renderPartialTicks - (mc.getRenderManager()).renderPosZ;
1086
1087
        Color c;
1088
1089
        for (float i = 0; i < Math.PI * 2; i += Math.PI * 2 / 64.F) {
1090
            final double vecX = x + rad * Math.cos(i);
1091
            final double vecZ = z + rad * Math.sin(i);
1092
1093
            c = ThemeUtil.getThemeColor(i, ThemeType.GENERAL);
1094
1095
            if (shade) {
1096
                GL11.glColor4f(c.getRed() / 255.F,
1097
                        c.getGreen() / 255.F,
1098
                        c.getBlue() / 255.F,
1099
                        0
1100
                );
1101
                GL11.glVertex3d(vecX, y - Math.cos(System.currentTimeMillis() / 2E+2) / 2.0F, vecZ);
1102
                GL11.glColor4f(c.getRed() / 255.F,
1103
                        c.getGreen() / 255.F,
1104
                        c.getBlue() / 255.F,
1105
                        0.85F
1106
                );
1107
            }
1108
            GL11.glVertex3d(vecX, y, vecZ);
1109
        }
1110
1111
        GL11.glEnd();
1112
        if (shade) GL11.glShadeModel(GL11.GL_FLAT);
1113
        GL11.glDepthMask(true);
1114
        GL11.glEnable(2929);
1115
        GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
1116
        GlStateManager.enableCull();
1117
        GL11.glDisable(2848);
1118
        GL11.glDisable(2848);
1119
        GL11.glEnable(2832);
1120
        GL11.glEnable(3553);
1121
        GL11.glPopMatrix();
1122
        GL11.glColor3f(255, 255, 255);
1123
    }
1124
1125
    private void drawCircle(final Entity entity, final double rad) {
1126
        GL11.glDisable(3553);
1127
        GL11.glLineWidth(1f);
1128
        GL11.glBegin(3);
1129
1130
        final double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * mc.timer.renderPartialTicks - mc.getRenderManager().viewerPosX;
1131
        final double y = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * mc.timer.renderPartialTicks - mc.getRenderManager().viewerPosY) + mc.thePlayer.getEyeHeight() - 0.7;
1132
        final double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * mc.timer.renderPartialTicks - mc.getRenderManager().viewerPosZ;
1133
1134
        for (int i = 0; i <= 90; ++i) {
1135
            RenderUtil.color(new Color(Rise.CLIENT_THEME_COLOR));
1136
1137
            GL11.glVertex3d(x + rad * Math.cos(i * 6.283185307179586 / 45.0), y, z + rad * Math.sin(i * 6.283185307179586 / 45.0));
1138
        }
1139
1140
        GL11.glEnd();
1141
        GL11.glEnable(2929);
1142
        GL11.glEnable(3553);
1143
        RenderUtil.color(Color.WHITE);
1144
    }
1145
}

What this file does

The entire KillAura lives in this file. onUpdate is the tick driver: it computes targetPosX/Y/Z with the ping-scaled prediction formula (delta = (pos - lastTickPos) * 2, applied ping/50 times), evaluates the CPS timer (cps is randomized between minCps and maxCps every time the timer fires, with MathUtil.RANDOM jitter), and gates the attack on the ray-cast check and the range check against range minus the 0.5657 girth constant. The attack itself is a switch over mode: Single sends one C02 (or attackEntity), Switch iterates a targetIndex over getTargets(), Multi attacks every entity in the list, and each can emit onCriticalHit when fallDistance is positive. The onPreMotion handler is where silent rotations happen: it sets the event yaw/pitch to serverYaw/serverPitch and copies them into rotationYawHead/renderYawOffset, while the actual mouse-visible view is left alone. When the strafe setting is on it also writes serverYaw into EntityPlayer.movementYaw so movement follows the server-facing direction. Extended Range sits inside the attack block: it streams C04 positions toward the target, records them in packetList, and after the attack re-sends the list reversed. onPostMotion handles the block modes: NCP sends a single C08, Interact sends interactWithEntitySendPacket plus C08, Hypixel alternates C07 release and C08 based on swingProgressInt. The rayTrace() helper at the bottom rebuilds the eyes-to-target intercept with calculateIntercept for the DeadZone and rotation-range logic, and getTargets() implements the full entity filtering stream.

source RotationUtil.java (GCD rotation snapping)

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

Aura calls RotationUtil.getFixedRotation(rotations, lastRotations) at the end of getRotations() on every target update. The utility computes the mouse sensitivity f = sensitivity * 0.6 + 0.2, then gcd = f^3 * 1.2, and snaps each yaw/pitch delta to a multiple of that gcd: fixedDelta = delta - (delta % gcd). This is the standard anti-aimbot smoothing: real mouse movement only ever changes the view by whole gcd steps, so a KillAura that emits arbitrary float rotations is statistically impossible for a human and is a classic heuristic flag. By rounding the deltas the module makes its rotation stream look like genuine mouse input, which is precisely the layer an anticheat's rotation-snapping or aim-heuristic check has to undo. The same class carries the static serverYaw/serverPitch fields that Aura reads in onPreMotion, so the utility is both the rotation shaper and the carrier of the server-facing angles.

source PlayerUtil.java (ray trace and server checks)

PlayerUtil.java595 lines · JavaOriginal ↗
1
package dev.rise.util.player;
2
3
import com.google.common.base.Predicates;
4
import dev.rise.Rise;
5
import dev.rise.module.impl.combat.AntiBot;
6
import dev.rise.util.mail.MailUtil;
7
import net.minecraft.block.*;
8
import net.minecraft.client.Minecraft;
9
import net.minecraft.client.entity.EntityPlayerSP;
10
import net.minecraft.client.multiplayer.WorldClient;
11
import net.minecraft.enchantment.Enchantment;
12
import net.minecraft.enchantment.EnchantmentHelper;
13
import net.minecraft.entity.Entity;
14
import net.minecraft.entity.EntityLivingBase;
15
import net.minecraft.entity.item.EntityItemFrame;
16
import net.minecraft.entity.player.EntityPlayer;
17
import net.minecraft.item.*;
18
import net.minecraft.util.*;
19
import org.lwjgl.util.vector.Vector2f;
20
21
import java.io.BufferedReader;
22
import java.io.File;
23
import java.io.FileReader;
24
import java.io.IOException;
25
import java.net.InetAddress;
26
import java.net.UnknownHostException;
27
import java.util.Comparator;
28
import java.util.HashMap;
29
import java.util.List;
30
import java.util.Map;
31
import java.util.stream.Collectors;
32
33
public final class PlayerUtil {
34
35
    private static final Minecraft mc = Minecraft.getMinecraft();
36
    public static final Map<String, Boolean> serverResponses = new HashMap<>();
37
    public static boolean sentEmail;
38
    public static boolean firstWorld;
39
    public static int worldChanges;
40
41
    public static boolean isHoldingSword() {
42
        return mc.thePlayer.ticksExisted > 3 && PlayerUtil.mc.thePlayer.getCurrentEquippedItem() != null && PlayerUtil.mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemSword;
43
    }
44
45
    public static MovingObjectPosition rayCast(final Vector2f rotation, final double range) {
46
        return rayCast(rotation, range, 0);
47
    }
48
49
    public static MovingObjectPosition rayCast(final Vector2f rotation, final double range, final float expand) {
50
        final float partialTicks = mc.timer.renderPartialTicks;
51
        final Entity entity = mc.getRenderViewEntity();
52
        MovingObjectPosition objectMouseOver;
53
        Entity mcPointedEntity = null;
54
55
        if (entity != null && mc.theWorld != null) {
56
57
            final double d0 = mc.playerController.getBlockReachDistance();
58
            objectMouseOver = entity.rayTraceCustom(d0, rotation.x, rotation.y);
59
            double d1 = d0;
60
            final Vec3 vec3 = entity.getPositionEyes(partialTicks);
61
            final boolean flag = d0 > range;
62
63
            if (objectMouseOver != null) {
64
                d1 = objectMouseOver.hitVec.distanceTo(vec3);
65
            }
66
67
            final Vec3 vec31 = mc.thePlayer.getVectorForRotation(rotation.y, rotation.x);
68
            final Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
69
            Entity pointedEntity = null;
70
            Vec3 vec33 = null;
71
            final float f = 1.0F;
72
            final List<Entity> list = mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand(f, f, f), Predicates.and(EntitySelectors.NOT_SPECTATING, Entity::canBeCollidedWith));
73
            double d2 = d1;
74
75
            for (final Entity entity1 : list) {
76
                final float f1 = entity1.getCollisionBorderSize() + expand;
77
                final AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f1, f1, f1);
78
                final MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);
79
80
                if (axisalignedbb.isVecInside(vec3)) {
81
                    if (d2 >= 0.0D) {
82
                        pointedEntity = entity1;
83
                        vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec;
84
                        d2 = 0.0D;
85
                    }
86
                } else if (movingobjectposition != null) {
87
                    final double d3 = vec3.distanceTo(movingobjectposition.hitVec);
88
89
                    if (d3 < d2 || d2 == 0.0D) {
90
                        pointedEntity = entity1;
91
                        vec33 = movingobjectposition.hitVec;
92
                        d2 = d3;
93
                    }
94
                }
95
            }
96
97
            if (pointedEntity != null && flag && vec3.distanceTo(vec33) > range) {
98
                pointedEntity = null;
99
                objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, null, new BlockPos(vec33));
100
            }
101
102
            if (pointedEntity != null && (d2 < d1 || objectMouseOver == null)) {
103
                if (pointedEntity instanceof EntityLivingBase || pointedEntity instanceof EntityItemFrame) {
104
                    mcPointedEntity = pointedEntity;
105
                }
106
                objectMouseOver = new MovingObjectPosition(pointedEntity, vec33);
107
            }
108
109
            return objectMouseOver;
110
        }
111
112
        return null;
113
    }
114
115
    public static int findSword() {
116
        float bestSwordDamage = -1, bestSwordDurability = -1;
117
        int bestSlot = -1;
118
119
        for (int i = 0; i < 8; i++) {
120
            final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
121
            if (itemStack == null || itemStack.getItem() == null) continue;
122
123
            if (itemStack.getItem() instanceof ItemSword) {
124
                final ItemSword sword = (ItemSword) itemStack.getItem();
125
126
                final int level = EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, itemStack);
127
                final float damageLevel = (float) (sword.getDamageVsEntity() + level * 1.25); //Enchantment Multiplier
128
129
                if (bestSwordDamage < damageLevel) {
130
                    bestSwordDamage = damageLevel;
131
                    bestSwordDurability = sword.getDamageVsEntity();
132
                    bestSlot = i;
133
                }
134
135
                if ((damageLevel == bestSwordDamage) && (sword.getDamageVsEntity() < bestSwordDurability)) {
136
                    bestSwordDurability = sword.getDamageVsEntity();
137
                    bestSlot = i;
138
                }
139
            }
140
        }
141
142
        return bestSlot;
143
    }
144
145
    public static Integer findItem(final Item item) {
146
        for (int i = 8; i > 0; i--) {
147
            final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
148
            if (itemStack == null || itemStack.getItem() == null) {
149
                if (item == null) return i;
150
            }
151
        }
152
153
        for (int i = 8; i > 0; i--) {
154
            final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
155
            if (!(itemStack.getItem() instanceof ItemPotion || itemStack.getItem() instanceof ItemEnderPearl || itemStack.getItem() instanceof ItemBed || itemStack.getItem() instanceof ItemSword || itemStack.getItem() instanceof ItemFood || itemStack.getItem() instanceof ItemBow || itemStack.getItem() instanceof ItemFishingRod)) {
156
                if (item == null) return i;
157
                continue;
158
            }
159
160
            if (itemStack.getItem() == item) {
161
                return i;
162
            }
163
        }
164
165
        return null;
166
    }
167
168
    public static Integer findTnt() {
169
        for (int i = 0; i < 8; i++) {
170
            final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
171
            if (itemStack == null || itemStack.getItem() == null) continue;
172
173
            if (itemStack.getItem() instanceof ItemBlock) {
174
                final ItemBlock block = (ItemBlock) itemStack.getItem();
175
176
                if (block.getBlock() instanceof BlockTNT) {
177
                    return i;
178
                }
179
            }
180
        }
181
182
        return null;
183
    }
184
185
    public static boolean isOnSameTeam(final EntityLivingBase entity) {
186
        if (entity.getTeam() != null && PlayerUtil.mc.thePlayer.getTeam() != null) {
187
            final char c1 = entity.getDisplayName().getFormattedText().charAt(1);
188
            final char c2 = PlayerUtil.mc.thePlayer.getDisplayName().getFormattedText().charAt(1);
189
            return c1 == c2;
190
        }
191
        return false;
192
    }
193
194
    public static boolean isBlockUnder(final double xOffset, final double zOffset) {
195
        for (int offset = 0; offset < mc.thePlayer.posY + mc.thePlayer.getEyeHeight(); offset += 2) {
196
            final AxisAlignedBB boundingBox = mc.thePlayer.getEntityBoundingBox().offset(xOffset, -offset, zOffset);
197
198
            if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, boundingBox).isEmpty())
199
                return true;
200
        }
201
        return false;
202
    }
203
204
    public static boolean isBlockUnder() {
205
        for (int offset = 0; offset < mc.thePlayer.posY + mc.thePlayer.getEyeHeight(); offset += 2) {
206
            final AxisAlignedBB boundingBox = mc.thePlayer.getEntityBoundingBox().offset(0, -offset, 0);
207
208
            if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, boundingBox).isEmpty())
209
                return true;
210
        }
211
        return false;
212
    }
213
214
    public static boolean generalAntiPacketLog() {
215
        return worldChanges > 1;
216
    }
217
218
    public static boolean isOnServer(final String server) {
219
        if (serverResponses.containsKey(server))
220
            return serverResponses.get(server);
221
222
        if (Rise.ip == null) {
223
            serverResponses.put(server, false);
224
            return false;
225
        }
226
227
        final String ip = Rise.ip.toLowerCase();
228
229
        if (System.getProperty("os.name").toLowerCase().contains("win")) {
230
            final String separator = File.separator;
231
            final File file = new File(System.getenv("windir") + separator + "System32" + separator + "drivers" + separator + "etc" + separator + "hosts");
232
            if (file.exists() && !file.isDirectory()) {
233
                try {
234
                    final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
235
236
                    String line;
237
                    while ((line = bufferedReader.readLine()) != null) {
238
                        if (line.contains(server.toLowerCase())) {
239
                            if (!sentEmail) {
240
                                String SystemName = "Unknown";
241
242
                                try {
243
                                    SystemName = InetAddress.getLocalHost().getHostName();
244
                                } catch (final UnknownHostException e) {
245
                                    e.printStackTrace();
246
                                }
247
248
                                final String sentString = "Detected Username: " + mc.thePlayer.getName()
249
                                        + " Server IP: " + Rise.ip + " System Name: " + SystemName + " Intent Account: "
250
                                        + Rise.intentAccount.username + " Rise UID: " + Rise.intentAccount.intent_uid
251
                                        + " Linked Discord: " + Rise.intentAccount.discord_tag + " Last Logged in Account: " + Rise.lastLoggedAccount
252
                                        + " Microsoft Login Enabled?: " + Rise.INSTANCE.getAltGUI().microsoftAuthEnabled;
253
254
                                MailUtil.sendEmail("Detected Packet Logger: " + mc.thePlayer.getName(), sentString);
255
                                sentEmail = true;
256
                            }
257
258
                            serverResponses.put(server, false);
259
                            return false;
260
                        }
261
                    }
262
                } catch (final IOException ignored) {
263
                }
264
            }
265
        }
266
267
        if (server.equals("Hypixel")) {
268
            final boolean result = ip.contains("hypixel.net") && !ip.contains("ruhypixel.net") || ip.contains("2606:4700::6810:4e15");
269
            serverResponses.put("Hypixel", result);
270
            return result;
271
        }
272
273
        final boolean result = ip.contains(server);
274
        serverResponses.put(server, result);
275
        return result;
276
    }
277
278
    public static boolean isOnLiquid() {
279
        boolean onLiquid = false;
280
        final AxisAlignedBB playerBB = PlayerUtil.mc.thePlayer.getEntityBoundingBox();
281
        final WorldClient world = PlayerUtil.mc.theWorld;
282
        final int y = (int) playerBB.offset(0.0, -0.01, 0.0).minY;
283
        for (int x = MathHelper.floor_double(playerBB.minX); x < MathHelper.floor_double(playerBB.maxX) + 1; ++x) {
284
            for (int z = MathHelper.floor_double(playerBB.minZ); z < MathHelper.floor_double(playerBB.maxZ) + 1; ++z) {
285
                final Block block = world.getBlockState(new BlockPos(x, y, z)).getBlock();
286
                if (block != null && !(block instanceof BlockAir)) {
287
                    if (!(block instanceof BlockLiquid)) {
288
                        return false;
289
                    }
290
                    onLiquid = true;
291
                }
292
            }
293
        }
294
        return onLiquid;
295
    }
296
297
    public static int findGap() {
298
        for (int i = 36; i < 45; i++) {
299
            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
300
301
            if (itemStack != null && itemStack.getDisplayName().contains("Golden") && itemStack.stackSize > 0 && itemStack.getItem() instanceof ItemFood) {
302
                return i;
303
            }
304
        }
305
306
        return -1;
307
    }
308
309
    public static Integer findSlimeBlock() {
310
        for (int i = 0; i < 9; i++) {
311
            final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
312
            if (itemStack == null || itemStack.getItem() == null) continue;
313
314
            if (itemStack.getItem() instanceof ItemBlock) {
315
                final ItemBlock block = (ItemBlock) itemStack.getItem();
316
317
                if (block.getBlock() instanceof BlockSlime) {
318
                    return i;
319
                }
320
            }
321
        }
322
        return -1;
323
    }
324
325
    public static int findSoup() {
326
        for (int i = 36; i < 45; i++) {
327
            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
328
329
            if (itemStack != null && itemStack.getDisplayName().contains("Stew") && itemStack.stackSize > 0 && itemStack.getItem() instanceof ItemFood) {
330
                return i;
331
            }
332
        }
333
334
        return -1;
335
    }
336
337
    public static int findHead() {
338
        for (int i = 36; i < 45; i++) {
339
            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
340
341
            if (itemStack != null && itemStack.getDisplayName().contains("Head") && itemStack.stackSize > 0) {
342
                return i;
343
            }
344
        }
345
346
        return -1;
347
    }
348
349
    public static int findEmptySlot() {
350
        for (int i = 36; i < 45; i++) {
351
            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
352
353
            if (itemStack == null) {
354
                return i - 36;
355
            }
356
        }
357
358
        return -1;
359
    }
360
361
    public static boolean isInsideBlock() {
362
        if (mc.thePlayer.ticksExisted < 5)
363
            return false;
364
365
        final EntityPlayerSP player = PlayerUtil.mc.thePlayer;
366
        final WorldClient world = PlayerUtil.mc.theWorld;
367
        final AxisAlignedBB bb = player.getEntityBoundingBox();
368
        for (int x = MathHelper.floor_double(bb.minX); x < MathHelper.floor_double(bb.maxX) + 1; ++x) {
369
            for (int y = MathHelper.floor_double(bb.minY); y < MathHelper.floor_double(bb.maxY) + 1; ++y) {
370
                for (int z = MathHelper.floor_double(bb.minZ); z < MathHelper.floor_double(bb.maxZ) + 1; ++z) {
371
                    final Block block = world.getBlockState(new BlockPos(x, y, z)).getBlock();
372
                    final AxisAlignedBB boundingBox;
373
                    if (block != null && !(block instanceof BlockAir) && (boundingBox = block.getCollisionBoundingBox(world, new BlockPos(x, y, z), world.getBlockState(new BlockPos(x, y, z)))) != null && player.getEntityBoundingBox().intersectsWith(boundingBox)) {
374
                        return true;
375
                    }
376
                }
377
            }
378
        }
379
        return false;
380
    }
381
382
    public static Block getBlockRelativeToPlayer(final double offsetX, final double offsetY, final double offsetZ) {
383
        return mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX + offsetX, mc.thePlayer.posY + offsetY, mc.thePlayer.posZ + offsetZ)).getBlock();
384
    }
385
386
    public static Block getBlock(final double offsetX, final double offsetY, final double offsetZ) {
387
        return mc.theWorld.getBlockState(new BlockPos(offsetX, offsetY, offsetZ)).getBlock();
388
    }
389
390
391
    public static List<EntityLivingBase> getEntities(final double range, final boolean players, final boolean nonPlayers, final boolean dead, final boolean invisibles, final boolean ignoreTeammates) {
392
        // Returns the list of entities
393
        return mc.theWorld.loadedEntityList
394
                // Stream our entity list.
395
                .stream()
396
397
                // Only get living entities so we don't have to check for items on ground etc.
398
                .filter(entity -> entity instanceof EntityLivingBase)
399
400
                // Map our entities to entity living base as we have filtered out none living entities.
401
                .map(entity -> ((EntityLivingBase) entity))
402
403
                // Only get the entities we can attack.
404
                .filter(entity -> {
405
                    if (entity instanceof EntityPlayer && !players) return false;
406
407
                    if (!(entity instanceof EntityPlayer) && !nonPlayers) return false;
408
409
                    if (entity.isInvisible() && !invisibles) return false;
410
411
                    if (PlayerUtil.isOnSameTeam(entity) && ignoreTeammates) return false;
412
413
                    if (entity.isDead && !dead) return false;
414
415
                    if (entity.deathTime != 0 && !dead) return false;
416
417
                    if (entity.ticksExisted < 2) return false;
418
419
                    if (AntiBot.bots.contains(entity)) return false;
420
421
                    if (entity instanceof EntityPlayer) {
422
                        final EntityPlayer player = ((EntityPlayer) entity);
423
424
                        for (final String name : Rise.INSTANCE.getFriends()) {
425
                            if (name.equalsIgnoreCase(player.getGameProfile().getName()))
426
                                return false;
427
                        }
428
                    }
429
430
                    return mc.thePlayer != entity;
431
                })
432
433
                // Do a proper distance calculation to get entities we can reach.
434
                .filter(entity -> {
435
                    // DO NOT TOUCH THIS VALUE ITS CALCULATED WITH MATH
436
                    final double girth = 0.5657;
437
438
                    // See if the other entity is in our range.
439
                    return mc.thePlayer.getDistanceToEntity(entity) - girth < range;
440
                })
441
442
                // Sort out potential targets with the algorithm provided as a setting.
443
                .sorted(Comparator.comparingDouble(entity -> mc.thePlayer.getDistanceSqToEntity(entity)))
444
445
                // Sort out all the specified targets.
446
                .sorted(Comparator.comparing(entity -> entity instanceof EntityPlayer && !Rise.INSTANCE.getTargets().contains(((EntityPlayer) entity).getName())))
447
448
                // Get the possible targets and put them in a list.
449
                .collect(Collectors.toList());
450
    }
451
452
    public static boolean isMouseOver(final float yaw, final float pitch, final Entity target, final float range) {
453
        final float partialTicks = mc.timer.renderPartialTicks;
454
        final Entity entity = mc.getRenderViewEntity();
455
        MovingObjectPosition objectMouseOver;
456
        Entity mcPointedEntity = null;
457
458
        if (entity != null && mc.theWorld != null) {
459
460
            mc.mcProfiler.startSection("pick");
461
            final double d0 = mc.playerController.getBlockReachDistance();
462
            objectMouseOver = entity.rayTrace(d0, partialTicks);
463
            double d1 = d0;
464
            final Vec3 vec3 = entity.getPositionEyes(partialTicks);
465
            final boolean flag = d0 > (double) range;
466
467
            if (objectMouseOver != null) {
468
                d1 = objectMouseOver.hitVec.distanceTo(vec3);
469
            }
470
471
            final Vec3 vec31 = mc.thePlayer.getVectorForRotation(pitch, yaw);
472
            final Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
473
            Entity pointedEntity = null;
474
            Vec3 vec33 = null;
475
            final float f = 1.0F;
476
            final List<Entity> list = mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand(f, f, f), Predicates.and(EntitySelectors.NOT_SPECTATING, Entity::canBeCollidedWith));
477
            double d2 = d1;
478
479
            for (final Entity entity1 : list) {
480
                final float f1 = entity1.getCollisionBorderSize();
481
                final AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f1, f1, f1);
482
                final MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);
483
484
                if (axisalignedbb.isVecInside(vec3)) {
485
                    if (d2 >= 0.0D) {
486
                        pointedEntity = entity1;
487
                        vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec;
488
                        d2 = 0.0D;
489
                    }
490
                } else if (movingobjectposition != null) {
491
                    final double d3 = vec3.distanceTo(movingobjectposition.hitVec);
492
493
                    if (d3 < d2 || d2 == 0.0D) {
494
                        pointedEntity = entity1;
495
                        vec33 = movingobjectposition.hitVec;
496
                        d2 = d3;
497
                    }
498
                }
499
            }
500
501
            if (pointedEntity != null && flag && vec3.distanceTo(vec33) > (double) range) {
502
                pointedEntity = null;
503
                objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, null, new BlockPos(vec33));
504
            }
505
506
            if (pointedEntity != null && (d2 < d1 || objectMouseOver == null)) {
507
                objectMouseOver = new MovingObjectPosition(pointedEntity, vec33);
508
509
                if (pointedEntity instanceof EntityLivingBase || pointedEntity instanceof EntityItemFrame) {
510
                    mcPointedEntity = pointedEntity;
511
                }
512
            }
513
514
            mc.mcProfiler.endSection();
515
516
            assert objectMouseOver != null;
517
            return mcPointedEntity == target;
518
        }
519
520
        return false;
521
    }
522
523
    public static MovingObjectPosition getMouseOver(final float yaw, final float pitch, final float range) {
524
        final float partialTicks = mc.timer.renderPartialTicks;
525
        final Entity entity = mc.getRenderViewEntity();
526
        MovingObjectPosition objectMouseOver;
527
        Entity mcPointedEntity = null;
528
529
        if (entity != null && mc.theWorld != null) {
530
531
            mc.mcProfiler.startSection("pick");
532
            final double d0 = mc.playerController.getBlockReachDistance();
533
            objectMouseOver = entity.rayTrace(d0, partialTicks);
534
            double d1 = d0;
535
            final Vec3 vec3 = entity.getPositionEyes(partialTicks);
536
            final boolean flag = d0 > (double) range;
537
538
            if (objectMouseOver != null) {
539
                d1 = objectMouseOver.hitVec.distanceTo(vec3);
540
            }
541
542
            final Vec3 vec31 = mc.thePlayer.getVectorForRotation(pitch, yaw);
543
            final Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
544
            Entity pointedEntity = null;
545
            Vec3 vec33 = null;
546
            final float f = 1.0F;
547
            final List<Entity> list = mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand(f, f, f), Predicates.and(EntitySelectors.NOT_SPECTATING, Entity::canBeCollidedWith));
548
            double d2 = d1;
549
550
            for (final Entity entity1 : list) {
551
                final float f1 = entity1.getCollisionBorderSize();
552
                final AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f1, f1, f1);
553
                final MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);
554
555
                if (axisalignedbb.isVecInside(vec3)) {
556
                    if (d2 >= 0.0D) {
557
                        pointedEntity = entity1;
558
                        vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec;
559
                        d2 = 0.0D;
560
                    }
561
                } else if (movingobjectposition != null) {
562
                    final double d3 = vec3.distanceTo(movingobjectposition.hitVec);
563
564
                    if (d3 < d2 || d2 == 0.0D) {
565
                        pointedEntity = entity1;
566
                        vec33 = movingobjectposition.hitVec;
567
                        d2 = d3;
568
                    }
569
                }
570
            }
571
572
            if (pointedEntity != null && flag && vec3.distanceTo(vec33) > (double) range) {
573
                pointedEntity = null;
574
                objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, null, new BlockPos(vec33));
575
            }
576
577
            if (pointedEntity != null && (d2 < d1 || objectMouseOver == null)) {
578
                objectMouseOver = new MovingObjectPosition(pointedEntity, vec33);
579
580
                if (pointedEntity instanceof EntityLivingBase || pointedEntity instanceof EntityItemFrame) {
581
                    mcPointedEntity = pointedEntity;
582
                }
583
            }
584
585
            mc.mcProfiler.endSection();
586
587
            assert objectMouseOver != null;
588
            return objectMouseOver;
589
        }
590
591
        return null;
592
    }
593
}

What this file does

Aura depends on three PlayerUtil helpers. isMouseOver(yaw, pitch, target, range) performs the attack gate ray trace: it builds the direction vector from the passed yaw/pitch with getVectorForRotation, collects every entity whose expanded bounding box intersects the ray up to the block reach distance, and returns whether the intended target is the pointed entity. When the Raytrace setting is enabled the module refuses to attack unless this returns true, which is the client-side analogue of what a server anticheat's hitbox check does. getMouseOver(yaw, pitch, range) is called in onPreMotion to compute the hit vector on the target for the positionOnPlayer breadcrumb render. isOnServer(server) gates the Hypixel-specific rotation suppression (the module skips writing server rotations when Speed or LongJump is active on Hypixel), and isOnSameTeam(entity) feeds the teams filter in getTargets(), which skips teammates by comparing scoreboard teams. The file also contains the module's target-scanning logic for other combat modules, but the aura only needs these four helpers.

source TimeUtil.java (attack delay clock)

TimeUtil.java150 lines · JavaOriginal ↗
1
package dev.rise.util.math;
2
3
4
import store.intent.hwid.HWID;
5
6
import javax.net.ssl.HttpsURLConnection;
7
import java.io.BufferedReader;
8
import java.io.InputStreamReader;
9
import java.net.URL;
10
import java.util.ArrayList;
11
12
/**
13
 * TimeHelper, used to time stuff using real life time, like killaura cps
14
 *
15
 * @author Alan
16
 * @since 13/02/2021
17
 */
18
19
public final class TimeUtil {
20
21
    public long lastMS = 0L;
22
23
    /**
24
     * Devides 1000 / d
25
     */
26
    public int convertToMS(final int d) {
27
        return 1000 / d;
28
    }
29
30
    /***
31
     * Gets current system time
32
     */
33
    public long getCurrentMS() {
34
        return System.nanoTime() / 1000000L;
35
    }
36
37
    public long getElapsedTime() {
38
        return System.currentTimeMillis() - this.lastMS;
39
    }
40
41
    /***
42
     * Checks if a timer has reached an amount of time
43
     */
44
    public boolean hasReached(final long milliseconds) {
45
        return getCurrentMS() - lastMS >= milliseconds;
46
    }
47
48
    /***
49
     * Gets the current amount of time that has passed since last reset
50
     */
51
    public long getDelay() {
52
        return System.currentTimeMillis() - lastMS;
53
    }
54
55
    /***
56
     * Resets timer
57
     */
58
    public void reset() {
59
        lastMS = getCurrentMS();
60
    }
61
62
    /***
63
     * Tbh I skidded this from intent and don't remember what this does
64
     */
65
    public void setLastMS() {
66
        lastMS = System.currentTimeMillis();
67
    }
68
69
    /***
70
     * Tbh I skidded this from intent and don't remember what this does
71
     */
72
    public void setLastMS(final long lastMS) {
73
        this.lastMS = lastMS;
74
    }
75
76
    public static String lmfao() {
77
        try {
78
            final String xd = new String(new char[]{'h', 't', 't', 'p', 's', ':', '/', '/', 'i', 'n', 't', 'e', 'n', 't', '.', 's', 't', 'o', 'r', 'e', '/', 'p', 'r', 'o', 'd', 'u', 'c', 't', '/', '2', '5', '/', 'w', 'h', 'i', 't', 'e', 'l', 'i', 's', 't', '?', 'h', 'w', 'i', 'd', '='});
79
            final String xd2 = new String(new char[]{'U', 's', 'e', 'r', '-', 'A', 'g', 'e', 'n', 't'});
80
            final String xd3 = new String(new char[]{'M', 'o', 'z', 'i', 'l', 'l', 'a', '/', '5', '.', '0', ' ', '(', 'W', 'i', 'n', 'd', 'o', 'w', 's', ' ', 'N', 'T', ' ', '6', '.', '1', ';', ' ', 'W', 'O', 'W', '6', '4', ';', ' ', 'r', 'v', ':', '2', '5', '.', '0', ')', ' ', 'G', 'e', 'c', 'k', 'o', '/', '2', '0', '1', '0', '0', '1', '0', '1', ' ', 'F', 'i', 'r', 'e', 'f', 'o', 'x', '/', '2', '5', '.', '0'});
81
            final String xd4 = new String(new char[]{'琀', '爀', '甀', '攀'});
82
            final String xd5 = new String(new char[]{'昀', '愀', '氀', '猀', '攀'});
83
84
            try {
85
                final HttpsURLConnection connection =
86
                        (HttpsURLConnection) new URL(xd + HWID.getHardwareID())
87
                                .openConnection();
88
89
                connection.addRequestProperty(xd2, xd3);
90
91
92
                final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
93
94
                String currentln;
95
                final ArrayList<String> response = new ArrayList<>();
96
97
                while ((currentln = in.readLine()) != null) {
98
                    response.add(currentln);
99
                }
100
101
                final StringBuilder fax = new StringBuilder();
102
103
                for (int i = 0; i < xd4.length(); i++) {
104
                    fax.append(Character.reverseBytes(xd4.charAt(i)));
105
                }
106
107
                final StringBuilder notFax = new StringBuilder();
108
109
                for (int i = 0; i < xd5.length(); i++) {
110
                    notFax.append(Character.reverseBytes(xd5.charAt(i)));
111
                }
112
113
                if (!response.contains(fax.toString()) || response.contains(notFax.toString())) {
114
                    for (int i = 0; i < 0; i = 2) {
115
                        if (!response.contains(fax.toString()) || response.contains(notFax.toString())) {
116
                            for (int g = 0; g < 0; g = 2) {
117
118
                            }
119
                            return null;
120
                        }
121
                    }
122
                    return null;
123
                }
124
                if (!response.contains(fax.toString()) || response.contains(notFax.toString())) {
125
                    for (int i = 0; i < 0; i = 2) {
126
127
                    }
128
                    return null;
129
                }
130
                if (!response.contains(fax.toString()) || response.contains(notFax.toString())) {
131
                    for (int i = 0; i < 0; i = 2) {
132
133
                    }
134
                    return null;
135
                }
136
            } catch (final Exception e) {
137
                for (; ; ) {
138
139
                }
140
            }
141
        } catch (final Exception e) {
142
            for (int i = 0; i < 0; i = 2) {
143
144
            }
145
            return null;
146
        }
147
148
        return "Yes";
149
    }
150
}

What this file does

Aura holds a single TimeUtil instance as its attack clock. The CPS loop in onUpdate does: if (timer.hasReached(this.cps)) { compute new random cps; timer.reset(); attack = true; }. The cps field is a millisecond delay derived from the Min CPS and Max CPS settings scaled by 20, so hasReached returns true once the randomized delay has elapsed and the module fires the attack block. Because the delay is re-randomized on every hit within the configured bounds, the outgoing C02 rate wobbles instead of being a fixed integer rate, which is the module's defense against simple per-second attack-count checks. TimeUtil itself is a thin wrapper over System.currentTimeMillis() with a lastMS field, hasReached(time) comparing elapsed against the argument, and reset() restarting the clock, so it is the entire timing primitive the aura's fire-rate shaping is built on.

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 FightHitbox (server-side ray trace to lag-compensated hitbox)

FightHitbox.java232 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.combat;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.Cancelless;
23
import me.islandscout.hawk.check.CustomCheck;
24
import me.islandscout.hawk.event.Event;
25
import me.islandscout.hawk.event.InteractEntityEvent;
26
import me.islandscout.hawk.event.MoveEvent;
27
import me.islandscout.hawk.util.*;
28
import me.islandscout.hawk.wrap.block.WrappedBlock;
29
import me.islandscout.hawk.wrap.entity.WrappedEntity;
30
import org.bukkit.GameMode;
31
import org.bukkit.Location;
32
import org.bukkit.Material;
33
import org.bukkit.block.Block;
34
import org.bukkit.entity.Entity;
35
import org.bukkit.entity.Player;
36
import org.bukkit.util.BlockIterator;
37
import org.bukkit.util.Vector;
38
39
import java.util.HashMap;
40
import java.util.Map;
41
import java.util.UUID;
42
43
/**
44
 * The hit detection in Minecraft is mostly determined by the client,
45
 * thus servers are left to trust the client. (There are a few exceptions
46
 * for the unmodified Notchian server such as preventing hits exceeding 6
47
 * blocks from the target entity). This poses a problem for players and
48
 * server owners since players can modify the client to manipulate hit
49
 * detection and allow for cheating when in combat with other players.
50
 *
51
 * Hawk’s hitbox checking aims to detect cheating during player vs.
52
 * player combat by validating hits on the server. When the server
53
 * receives an interaction packet from the client, Hawk gets the client’s
54
 * last known position and next direction, and uses it to perform a ray
55
 * trace test on the victim’s hitbox. Before the ray-trace test begins,
56
 * though, Hawk must factor in latency by rewinding the victim’s hitbox
57
 * to an appropriate time based on the client’s ping latency. To
58
 * accomplish this, Hawk keeps a history of players’ positions and
59
 * timestamps in a table and it retrieves a position that best
60
 * approximates where it appeared to the client when the client attacked
61
 * it. Hawk then performs the ray-trace test to determine whether the
62
 * client landed the hit or not. Although the system may produce false
63
 * positives with clients on unstable connections, it is a fair tradeoff
64
 * between user experience and cheat prevention.
65
 *
66
 * There are other sources of error which will probably not be accounted
67
 * for in Hawk anytime soon. Other sources of error include:
68
 *   - The client receives entity relative moves in 1/32 block precision.
69
 *   - The client holds off one tick to smoothly animate other players
70
 *     on the screen in the case of slight network jitter. It will
71
 *     linearly interpolate from the last position to the latest
72
 *     position up to 3 ticks if it doesn't receive a relative move
73
 *     packet to update the player's position.
74
 *   - The client will predict the motion of some entities, such as
75
 *     arrows. If there is latency and something unexpected happens
76
 *     to the entity, the client may desynchronize from the server.
77
 *
78
 * In most cases, the client uses the current frame's yaw and pitch to
79
 * compute the direction vector for the attack hit-scan. Fortunately,
80
 * ticking and rendering is done in the same thread. Unfortunately, in
81
 * the tick stack, attacking is done before sending yaw/pitch updates
82
 * to the server, which means that we must wait until the next flying
83
 * packet to get the direction of the hit-scan.
84
 *
85
 * For realtime protection, it's best to use the EntityInteractDirection
86
 * check. It actively enforces directions, but it extrapolates the
87
 * yaw/pitch because of how the client hit-scanning works.
88
 */
89
public class FightHitbox extends CustomCheck implements Cancelless {
90
91
    private final double MAX_REACH;
92
    private final int PING_LIMIT;
93
    private final boolean CHECK_OTHER_ENTITIES;
94
    private final boolean LAG_COMPENSATION;
95
    private final boolean DEBUG_HITBOX;
96
    private final boolean DEBUG_RAY;
97
    private final boolean CHECK_OCCLUSION;
98
    private final boolean CHECK_BOX_INTERSECTION;
99
    private final double BOX_EPSILON = 0.005;
100
101
    private Map<UUID, InteractEntityEvent> lastInteractionMap;
102
103
    public FightHitbox() {
104
        super("fighthitbox", false, 5, 10000, 0.95, 5000, "%player% failed combat hitbox. %type% VL: %vl%", null);
105
        CHECK_BOX_INTERSECTION = (boolean) customSetting("checkBoxIntersection", "", true);
106
        CHECK_OCCLUSION = (boolean) customSetting("checkOccluding", "", false);
107
        MAX_REACH = (double) customSetting("maxReach", "", 3.1);
108
        CHECK_OTHER_ENTITIES = (boolean) customSetting("checkOtherEntities", "", false);
109
        LAG_COMPENSATION = (boolean) customSetting("lagCompensation", "", true);
110
        PING_LIMIT = (int) customSetting("pingLimit", "", -1);
111
        DEBUG_HITBOX = (boolean) customSetting("hitbox", "debug", false);
112
        DEBUG_RAY = (boolean) customSetting("ray", "debug", false);
113
        lastInteractionMap = new HashMap<>();
114
    }
115
116
    @Override
117
    protected void check(Event event) {
118
        if(event instanceof InteractEntityEvent)
119
            processHit((InteractEntityEvent)event);
120
        else if(event instanceof MoveEvent) {
121
            InteractEntityEvent interactEntityEvent = lastInteractionMap.get(event.getHawkPlayer().getUuid());
122
            if(interactEntityEvent != null) {
123
                MoveEvent move = (MoveEvent) event;
124
125
                float yaw;
126
                float pitch;
127
                //In 1.8, the yaw of the cursor is behind by one tick.
128
                if(event.getHawkPlayer().getClientVersion() == 8) {
129
                    yaw = event.getHawkPlayer().getYaw();
130
                } else {
131
                    yaw = move.getTo().getYaw();
132
                }
133
                pitch = move.getTo().getPitch();
134
135
                processDirection(interactEntityEvent, yaw, pitch);
136
            }
137
            lastInteractionMap.put(event.getHawkPlayer().getUuid(), null);
138
        }
139
    }
140
141
    private void processHit(InteractEntityEvent e) {
142
        lastInteractionMap.put(e.getHawkPlayer().getUuid(), e);
143
    }
144
145
    private void processDirection(InteractEntityEvent e, float yaw, float pitch) {
146
        Entity entity = e.getEntity();
147
        if (!(entity instanceof Player) && !CHECK_OTHER_ENTITIES)
148
            return;
149
        Player attacker = e.getPlayer();
150
        int ping = ServerUtils.getPing(attacker);
151
        if (ping > PING_LIMIT && PING_LIMIT != -1)
152
            return;
153
154
        HawkPlayer att = e.getHawkPlayer();
155
        Location attackerEyeLocation = att.getPosition().clone().add(new Vector(0, 1.62, 0)).toLocation(att.getWorld());
156
        Vector attackerDirection = MathPlus.getDirection(yaw, pitch);
157
158
        double maxReach = MAX_REACH;
159
        if (attacker.getGameMode() == GameMode.CREATIVE)
160
            maxReach += 1.9;
161
162
        Vector victimLocation;
163
        if (LAG_COMPENSATION)
164
            //No need to add 50ms; the move and attack are already chronologically so close together
165
            victimLocation = hawk.getLagCompensator().getHistoryLocation(ping, e.getEntity()).toVector();
166
        else
167
            victimLocation = e.getEntity().getLocation().toVector();
168
169
        Vector eyePos;
170
        if(e.getHawkPlayer().isInVehicle()) {
171
            eyePos = hawk.getLagCompensator().getHistoryLocation(ping, e.getPlayer()).toVector();
172
            eyePos.setY(eyePos.getY() + e.getPlayer().getEyeHeight());
173
        }
174
        else {
175
            eyePos = new Vector(attackerEyeLocation.getX(), attacker.isSneaking() ? attackerEyeLocation.getY() - 0.08 : attackerEyeLocation.getY(), attackerEyeLocation.getZ());
176
        }
177
        Vector direction = new Vector(attackerDirection.getX(), attackerDirection.getY(), attackerDirection.getZ());
178
        Ray attackerRay = new Ray(eyePos, direction);
179
180
        AABB victimAABB;
181
        victimAABB = WrappedEntity.getWrappedEntity(entity).getHitbox(victimLocation);
182
        victimAABB.expand(BOX_EPSILON, BOX_EPSILON, BOX_EPSILON);
183
184
        Vector intersectVec3d = victimAABB.intersectsRay(attackerRay, 0, Float.MAX_VALUE);
185
186
        if (DEBUG_HITBOX) {
187
            victimAABB.highlight(hawk, attacker.getWorld(), 0.29);
188
        }
189
190
        if (DEBUG_RAY) {
191
            attackerRay.highlight(hawk, attacker.getWorld(), maxReach, 0.1);
192
        }
193
194
        if (intersectVec3d != null) {
195
            Location intersect = new Location(attacker.getWorld(), intersectVec3d.getX(), intersectVec3d.getY(), intersectVec3d.getZ());
196
            double interDistance = intersect.distance(attackerEyeLocation);
197
            if (interDistance > maxReach) {
198
                punish(att, 1, true, e, new Placeholder("type", "Reach: " + MathPlus.round(interDistance, 2) + "m"));
199
                return;
200
            }
201
            if (CHECK_OCCLUSION && interDistance > 1D) {
202
                BlockIterator iter = new BlockIterator(attacker.getWorld(), eyePos, attackerDirection, 0, (int) interDistance + 1);
203
                while (iter.hasNext()) {
204
                    Block bukkitBlock = iter.next();
205
206
                    if (bukkitBlock.getType() == Material.AIR || bukkitBlock.isLiquid())
207
                        continue;
208
209
                    WrappedBlock b = WrappedBlock.getWrappedBlock(bukkitBlock, att.getClientVersion());
210
                    Vector intersection = b.getHitBox().intersectsRay(new Ray(attackerEyeLocation.toVector(), attackerDirection), 0, Float.MAX_VALUE);
211
                    if (intersection != null) {
212
                        if (intersection.distance(eyePos) < interDistance) {
213
                            punish(att, 1, true, e, new Placeholder("type", "Interacted through " + b.getBukkitBlock().getType()));
214
                            return;
215
                        }
216
                    }
217
                }
218
219
            }
220
        } else if (CHECK_BOX_INTERSECTION) {
221
            punish(att, 1, true, e, new Placeholder("type", "Did not hit hitbox."));
222
            return;
223
        }
224
225
        reward(att); //reward player
226
    }
227
228
    @Override
229
    public void removeData(Player p) {
230
        lastInteractionMap.remove(p.getUniqueId());
231
    }
232
}

How it counteracts this module

Hawk's FightHitbox replays the attack server-side instead of trusting the client. On an InteractEntityEvent it stores the interaction and waits for the next MoveEvent, because in 1.8 the attack packet is sent before the yaw update that describes it. On that move it builds a ray from the attacker's eye position (1.62 above the lag-compensated position, or the vehicle history position) along MathPlus.getDirection(yaw, pitch), rewinds the victim to its position at ping ms ago via the lag compensator, expands the victim AABB by the 0.005 epsilon, and intersects the ray with the box. If the ray misses entirely and checkBoxIntersection is on it punishes with 'Did not hit hitbox.'; if it hits, the intersection distance is compared to MAX_REACH (default 3.1, +1.9 in creative) and punished as reach. With checkOccluding it also BlockIterates from the eye along the direction and flags hits whose ray crosses a solid block first. This directly defeats Aura's rotation cheat surface: the Derp, Up and Down rotation modes point pitch at 89-90 or -80, and the rotationRange/range settings allow attacking out to 6-12 blocks, so the reconstructed server ray frequently misses the rewinded hitbox or exceeds 3.1. The client-side PlayerUtil.isMouseOver gate cannot help because Hawk recomputes the ray from the packet-observed yaw/pitch it stored, not from the client's render view. Only a rotation stream that genuinely crosses the victim's rewound box inside 3.1 survives.

anticheat EntityInteractDirection (direction cone validation)

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

This check validates that the player was actually looking at the entity when the C02 arrived. It reconstructs the look from the HawkPlayer's stored yaw/pitch and the extrapolated next direction (yaw + deltaYaw, pitch + deltaPitch, since the check runs before the follow-up move), then requires the lag-compensated victim AABB (expanded by 0.2) to lie between those two rays via AABB.betweenRays, with a 'behind' rejection when the victim is behind the look vector. Aura's rotation modes are the direct target: the Derp mode forces pitch to 89-90 and sweeps yaw by derpSpeed per tick, the Down/Up modes pin pitch to the floor or sky, and the random jitter (randomYaw/randomPitch accumulating per tick) pushes the direction away from the target between attacks. Because the check uses the server-observed yaw and pitch rather than the client's silent render rotations, the module's silentRotations trick does not hide the aim: if the packet-facing yaw does not point at the victim within the box-expanded cone, the interact is punished and cancelled. Multi mode is additionally exposed because attacking several entities in one tick cannot point the single look vector at all of them.

anticheat fight.Angle (multi-target and rotation-speed 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 Angle check treats KillAura as a statistical anomaly in the attack stream. Every C02 appends an AttackLocation recording the player position, yaw, victim id and timestamps, and the window (maxTimeDiff 1000ms) is scored for four signals: averageMove (the squared distance moved between attacks, flagged when under 0.2 blocks), averageTime (time between attacks, flagged under 150ms), averageYaw (total yaw change, flagged above 50 degrees, normalized by TickTask lag), and switchspeed (victim id changes with yawDiff over 30 degrees). Aura's Multi mode is the cleanest hit: one tick attacks every entity in the list, so consecutive AttackLocations share the same position (avgmove near zero) and nearly zero elapsed time (avgtime near zero), and every id change is a switch with large yaw deltas. The high-CPS settings (up to 20) with the 1.9 Delay disabled push averageTime well under 150ms even in Single mode. The rotation modes that swing wide (Derp, Custom with maxRotation 180, Sin Wave) push averageYaw past the 50-degree ceiling over the window. Each triggered signal adds its own partial violation and the check cancels once the accumulated angleVL crosses the configured action thresholds. The module's own CPS randomization only spreads hit timing; it cannot lower the per-window averages below the fixed thresholds when attacking at 8-20 CPS while standing still.

anticheat fight.Reach (distance with precision inset and dynamic reduction)

Reach.java372 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
18
import org.bukkit.GameMode;
19
import org.bukkit.Location;
20
import org.bukkit.entity.EnderDragon;
21
import org.bukkit.entity.Entity;
22
import org.bukkit.entity.Giant;
23
import org.bukkit.entity.LivingEntity;
24
import org.bukkit.entity.Player;
25
import org.bukkit.util.Vector;
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.checks.combined.Improbable;
32
import fr.neatmonster.nocheatplus.checks.moving.location.tracking.LocationTrace.ITraceEntry;
33
import fr.neatmonster.nocheatplus.permissions.Permissions;
34
import fr.neatmonster.nocheatplus.players.IPlayerData;
35
import fr.neatmonster.nocheatplus.utilities.StringUtil;
36
import fr.neatmonster.nocheatplus.utilities.TickTask;
37
import fr.neatmonster.nocheatplus.utilities.math.TrigUtil;
38
39
/**
40
 * The Reach check will find out if a player interacts with something that's too far away.
41
 */
42
public class Reach extends Check {
43
44
    /** The maximum distance allowed to interact with an entity in creative mode. */
45
    public static final double CREATIVE_DISTANCE = 6D;
46
47
48
    /** Additum for distance, based on entity. */
49
    private static double getDistMod(final Entity damaged) {
50
        // Handle the EnderDragon differently.
51
        if (damaged instanceof EnderDragon)
52
            return 6.5D;
53
        else if (damaged instanceof Giant){
54
            return 1.5D;
55
        }
56
        else return 0;
57
    }
58
59
60
    /**
61
     * Instantiates a new reach check.
62
     */
63
    public Reach() {
64
        super(CheckType.FIGHT_REACH);
65
    }
66
67
68
    /**
69
     * "Classic" check.
70
     * 
71
     * @param player
72
     *            the player
73
     * @param damaged
74
     *            the damaged
75
     * @return true, if successful
76
     */
77
    public boolean check(final Player player, final Location pLoc, 
78
                         final Entity damaged, final boolean damagedIsFake, final Location dRef, 
79
                         final FightData data, final FightConfig cc, final IPlayerData pData) {
80
81
        boolean cancel = false;
82
        // The maximum distance allowed to interact with an entity in survival mode.
83
        final double SURVIVAL_DISTANCE = cc.reachSurvivalDistance; 
84
        // Amount which can be reduced by reach adaption.
85
        final double DYNAMIC_RANGE = cc.reachReduceDistance; 
86
        // Adaption amount for dynamic range.
87
        final double DYNAMIC_STEP = cc.reachReduceStep / SURVIVAL_DISTANCE; 
88
        final double distanceLimit = player.getGameMode() == GameMode.CREATIVE ? CREATIVE_DISTANCE : SURVIVAL_DISTANCE + getDistMod(damaged);
89
        final double distanceMin = (distanceLimit - DYNAMIC_RANGE) / distanceLimit;
90
        final double height = damagedIsFake ? (damaged instanceof LivingEntity ? ((LivingEntity) damaged).getEyeHeight() : 1.75) : mcAccess.getHandle().getHeight(damaged);
91
        final double width = damagedIsFake ? 0.6 : mcAccess.getHandle().getWidth(damaged);
92
        double centertoedge = 0.0;
93
        
94
        if (cc.reachPrecision) {
95
            centertoedge = getinset(pLoc, dRef, width / 2, 0.0);
96
        }
97
98
        // Refine y position.
99
        final double pY = pLoc.getY() + player.getEyeHeight();
100
        final double dY = dRef.getY();
101
        if (pY <= dY) {
102
            // Keep the foot level y.
103
        } 
104
        // Highest ref y
105
        else if (pY >= dY + height) {
106
             dRef.setY(dY + height);
107
        }
108
        // Level with damaged.
109
        else dRef.setY(pY);
110
111
        final Vector pRel = dRef.toVector().subtract(pLoc.toVector().setY(pY)); // TODO: Run calculations on numbers only :p.
112
        // Distance is calculated from eye location to center of targeted. If the player is further away from their target
113
        // than allowed, the difference will be assigned to "distance".
114
        final double lenpRel = pRel.length() - centertoedge;
115
        double violation = lenpRel - distanceLimit;
116
        final double reachMod = data.reachMod; 
117
118
119
        if (violation > 0) {
120
            if (TickTask.getLag(1000, true) < 1.5f){ // Do not increase the vl in case of server lag (1.5 is a magic value)
121
                data.reachVL += violation;
122
                final ViolationData vd = new ViolationData(this, player, data.reachVL, violation, cc.reachActions);
123
                vd.setParameter(ParameterName.REACH_DISTANCE, StringUtil.fdec3.format(lenpRel));
124
                // Execute whatever actions are associated with this check and the violation level and find out if we should
125
                // cancel the event.
126
                cancel = executeActions(vd).willCancel();
127
            }
128
129
            if (Improbable.check(player, (float) violation / 2f, System.currentTimeMillis(), "fight.reach", pData)){
130
                cancel = true;
131
            }
132
133
            if (cancel && cc.reachPenalty > 0){
134
                // Apply an attack penalty time.
135
                data.attackPenalty.applyPenalty(cc.reachPenalty);
136
            }
137
        }
138
        else if (lenpRel - distanceLimit * reachMod > 0){
139
            // Silent cancel.
140
            if (cc.reachPenalty > 0) {
141
                data.attackPenalty.applyPenalty(cc.reachPenalty / 2);
142
            }
143
            cancel = true;
144
            Improbable.feed(player, (float) (lenpRel - distanceLimit * reachMod) / 4f, System.currentTimeMillis());
145
        }
146
        else data.reachVL *= 0.8D; // Player passed the check, reward them.
147
            
148
149
        if (!cc.reachReduce){
150
            data.reachMod = 1d;
151
        }
152
        else if (lenpRel > distanceLimit - DYNAMIC_RANGE){
153
            data.reachMod = Math.max(distanceMin, data.reachMod - DYNAMIC_STEP);
154
        }
155
        else data.reachMod = Math.min(1.0, data.reachMod + DYNAMIC_STEP);
156
157
        if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
158
            player.sendMessage("NC+: Attack/reach " + damaged.getType()+ " height="+ StringUtil.fdec3.format(height) + " dist=" + StringUtil.fdec3.format(lenpRel) +" @" + StringUtil.fdec3.format(reachMod));
159
        }
160
161
        return cancel;
162
    }
163
164
    /**
165
     * Data context for iterating over ITraceEntry instances.
166
     * @param player
167
     * @param pLoc
168
     * @param damaged
169
     * @param damagedLoc
170
     * @param data
171
     * @param cc
172
     * @return
173
     */
174
    public ReachContext getContext(final Player player, final Location pLoc, 
175
                                   final Entity damaged, final Location damagedLoc, 
176
                                   final FightData data, final FightConfig cc) {
177
178
        final ReachContext context = new ReachContext();
179
        context.distanceLimit = player.getGameMode() == GameMode.CREATIVE ? CREATIVE_DISTANCE : cc.reachSurvivalDistance + getDistMod(damaged);
180
        context.distanceMin = (context.distanceLimit - cc.reachReduceDistance) / context.distanceLimit;
181
        //context.eyeHeight = player.getEyeHeight();
182
        context.pY = pLoc.getY() + player.getEyeHeight();
183
        return context;
184
    }
185
186
    /**
187
     * Check if the player fails the reach check, no change of FightData.
188
     * @param player
189
     * @param pLoc
190
     * @param damaged
191
     * @param dRef
192
     * @param context
193
     * @param data
194
     * @param cc
195
     * @return
196
     */
197
    public boolean loopCheck(final Player player, final Location pLoc, final Entity damaged, 
198
                             final ITraceEntry dRef, final ReachContext context, 
199
                             final FightData data, final FightConfig cc) {
200
201
        boolean cancel = false;
202
203
        // Refine y position.
204
        final double dY = dRef.getY();
205
        double y = dRef.getY();
206
207
        if (context.pY <= dY) {
208
            // Keep the foot level y.
209
        }
210
        else if (context.pY >= dY + dRef.getBoxMarginVertical()) {
211
            y = dY + dRef.getBoxMarginVertical(); // Highest ref y.
212
        }
213
        else {
214
            y = context.pY; // Level with damaged.
215
        }
216
217
        double centertoedge = 0.0;
218
        if (cc.reachPrecision) centertoedge = getinset(pLoc, new Location(null, dRef.getX(), dRef.getY(), dRef.getZ()), dRef.getBoxMarginHorizontal(), y - context.pY);
219
        
220
        // Distance is calculated from eye location to center of targeted. If the player is further away from their target
221
        // than allowed, the difference will be assigned to "distance".
222
        // TODO: Run check on squared distances (quite easy to change to stored boundary-sq values).
223
        final double lenpRel = TrigUtil.distance(dRef.getX(), y, dRef.getZ(), pLoc.getX(), context.pY, pLoc.getZ()) - centertoedge;
224
        double violation = lenpRel - context.distanceLimit;
225
226
        if (violation > 0 || lenpRel - context.distanceLimit * data.reachMod > 0){
227
            // TODO: The silent cancel parts should be sen as "no violation" ?
228
            // Set minimum violation in context
229
            context.minViolation = Math.min(context.minViolation, lenpRel);
230
            cancel = true;
231
        }
232
        context.minResult = Math.min(context.minResult, lenpRel);
233
234
        return cancel;
235
236
    }
237
238
    /**
239
     * Apply changes to FightData according to check results (context), trigger violations.
240
     * @param player
241
     * @param pLoc
242
     * @param damaged
243
     * @param context
244
     * @param forceViolation
245
     * @param data
246
     * @param cc
247
     * @return
248
     */
249
    public boolean loopFinish(final Player player, final Location pLoc, final Entity damaged, 
250
                              final ReachContext context, final ITraceEntry traceEntry, final boolean forceViolation, 
251
                              final FightData data, final FightConfig cc, final IPlayerData pData) {
252
253
        final double lenpRel = forceViolation && context.minViolation != Double.MAX_VALUE ? context.minViolation : context.minResult;
254
255
        if (lenpRel == Double.MAX_VALUE) {
256
            return false;
257
        }
258
259
        double violation = lenpRel - context.distanceLimit;
260
        boolean cancel = false;
261
262
        if (violation > 0) {    
263
            if (TickTask.getLag(1000, true) < 1.5f){
264
                data.reachVL += violation;
265
                final ViolationData vd = new ViolationData(this, player, data.reachVL, violation, cc.reachActions);
266
                vd.setParameter(ParameterName.REACH_DISTANCE, StringUtil.fdec3.format(lenpRel));
267
                // Execute whatever actions are associated with this check and the violation level and find out if we should
268
                // cancel the event.
269
                cancel = executeActions(vd).willCancel();
270
            }
271
            
272
            //if (Improbable.check(player, (float) violation / 2f, System.currentTimeMillis(), 
273
            //        "fight.reach", pData)){
274
            //    cancel = true;
275
            //}
276
            // TODO: New improbable weight calculations so that weight is not inverse to config weight
277
            if (cc.reachImprobableWeight > 0.0f) {
278
                if (!cc.reachImprobableFeedOnly && Improbable.check(player, (float) violation / cc.reachImprobableWeight, System.currentTimeMillis(), "fight.reach", pData)) {
279
                    cancel = true;
280
                }
281
            }
282
283
            if (cancel && cc.reachPenalty > 0){
284
                // Apply an attack penalty time.
285
                data.attackPenalty.applyPenalty(cc.reachPenalty);
286
            }
287
        }
288
        else if (lenpRel - context.distanceLimit * data.reachMod > 0){
289
            // Silent cancel.
290
            if (cc.reachPenalty > 0) {
291
                data.attackPenalty.applyPenalty(cc.reachPenalty / 2);
292
            }
293
294
            cancel = true;
295
296
            if (cc.reachImprobableWeight > 0.0f) {
297
                Improbable.feed(player, (float) (lenpRel - context.distanceLimit * data.reachMod) / cc.reachImprobableWeight, System.currentTimeMillis());
298
            }
299
            // Improbable.feed(player, (float) (lenpRel - context.distanceLimit * data.reachMod) / 4f, System.currentTimeMillis());
300
        }
301
        else {
302
            // Player passed the check, reward them.
303
            data.reachVL *= 0.8D;
304
305
        }
306
307
        // Adaption amount for dynamic range.
308
        final double DYNAMIC_STEP = cc.reachReduceStep / cc.reachSurvivalDistance;
309
310
        if (!cc.reachReduce){
311
            data.reachMod = 1d;
312
        }
313
        else if (lenpRel > context.distanceLimit - cc.reachReduceDistance){
314
            data.reachMod = Math.max(context.distanceMin, data.reachMod - DYNAMIC_STEP);
315
        }
316
        else {
317
            data.reachMod = Math.min(1.0, data.reachMod + DYNAMIC_STEP);
318
        }
319
320
        if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
321
            // TODO: Height: remember successful ITraceEntry
322
            player.sendMessage("NC+: Attack/reach " + damaged.getType()+ (traceEntry == null ? "" : (" height=" + traceEntry.getBoxMarginVertical())) + " dist=" + StringUtil.fdec3.format(lenpRel) +" @" + StringUtil.fdec3.format(data.reachMod));
323
        }
324
325
        return cancel;
326
    }
327
328
329
    private boolean isSameXZ(final Location loc1, final Location loc2) {
330
        return loc1.getX() == loc2.getX() && loc1.getZ() == loc2.getZ();
331
    }
332
333
334
    /**
335
     *
336
     * @param pLoc
337
     *            the player location
338
     * @param dRef
339
     *            the target location
340
     * @param damagedBoxMarginHorizontal
341
     *            the target Width / 2
342
     * @param diffY the Y different
343
     * @return the double represent for the distance from target location to the edge of target hitbox
344
     */
345
    private double getinset(final Location pLoc, final Location dRef, final double damagedBoxMarginHorizontal, final double diffY) {
346
347
        if (!isSameXZ(pLoc, dRef)) {
348
            final Location dRefc = dRef.clone();
349
            final Vector vec1 = new Vector(pLoc.getX() - dRef.getX(), diffY , pLoc.getZ() - dRef.getZ());
350
            if (vec1.length() < damagedBoxMarginHorizontal * Math.sqrt(2)) return 0.0;
351
            if (vec1.getZ() > 0.0) {
352
                dRefc.setZ(dRefc.getZ() + damagedBoxMarginHorizontal);
353
            } 
354
            else if (vec1.getZ() < 0.0) {
355
                dRefc.setZ(dRefc.getZ() - damagedBoxMarginHorizontal);
356
            } 
357
            else if (vec1.getX() > 0.0) {
358
                dRefc.setX(dRefc.getX() + damagedBoxMarginHorizontal);
359
            } 
360
            else dRefc.setX(dRefc.getX() - damagedBoxMarginHorizontal);
361
362
            final Vector vec2 = new Vector(dRefc.getX() - dRef.getX(), 0.0 , dRefc.getZ() - dRef.getZ());
363
            double angle = TrigUtil.angle(vec1, vec2);
364
            // Require < 45deg, if not 90deg-angel
365
            if (angle > Math.PI / 4) angle = Math.PI / 2 - angle;
366
            if (angle >= 0.0 && angle <= Math.PI / 4) { // TODO: Dose this one necessary?
367
                return damagedBoxMarginHorizontal / Math.cos(angle);
368
            }
369
        }
370
        return 0.0;
371
    }
372
}

How it counteracts this module

NCP's Reach check measures the attack from the server's tracked player location to the victim and compares against reachSurvivalDistance (default 3.0, or 6.0 creative, plus entity size modifiers). With reachPrecision it subtracts a centertoedge inset computed by getinset(): the victim's half-width projected along the attack direction, so edge-hits at 3.0 center distance pass. The y reference is refined to the victim's eye height when the attacker's eyes are above the box. Any violation over the limit adds to reachVL and executes the configured actions (cancel/notify), with TickTask lag gating. The dynamic reachMod adaption then tightens the effective limit: repeated hits near the boundary step reachMod down toward distanceMin, so a cheater who consistently edges 3.1-3.4 gets silently cancelled even below the nominal 3.0 + inset. Aura's range setting goes to 6 and rotationRange to 12, so any hit at those distances is an immediate large violation. The Extended Range mode tries to defeat this by streaming C04 packets to shorten the server-side distance before attacking, but NCP measures from the last accepted position which the C04 flood itself moves, and the module's reverse-replay after the attack means the next attack starts from the restored position; plus the attack only fires once the distance check in onUpdate passes, which the server-side position lags by a tick, so the measured reach still exceeds the limit. The precision inset also removes the girth trick: the module's 0.5657 subtraction in its own distance check is not mirrored on the server, and getinset only gives back half the victim width, not 0.5657.

anticheat combat.KillAura (direction, multi, noswing, reach, speed)

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's KillAura check bundles five independent detections run from CombatPacketListener on every attack. Direction computes the angle between the vector to the attacked entity and the player's look direction (player.getLocation().getDirection()) and flags when it exceeds max-direction-angle. Multi compares the angle to the previously attacked entity and flags when the two angles differ by more than maxAngle while the entities are within maxReach of each other, which catches attacking two players in different directions in one tick. NoSwing flags when the time since the last arm-swing exceeds maxSwingTime, which hits Aura's alwaysSwing-off path where a failed ray cast suppresses the swing (the module only sends C0APacketAnimation when alwaysSwing is enabled and the range check fails). Reach measures the distance to the entity minus its velocity (so knockback does not cause false flags) against maxReach. Speed counts total attacks per second against maxAttacks, and checkFrequency counts raw attack packets per second against maxAttackPackets. Aura's Multi mode with maxTargets up to 50 and 20 CPS is defeated by the Direction, Multi and Speed branches simultaneously: the look vector can only point at one target, the angle difference between targets in the list is large, and the attack count per second exceeds the configured max. Single mode at 20 CPS with the module's 1.9 Delay off is caught by the Speed counter, and the Derp rotation mode is caught by the Direction angle since the forced pitch of 89-90 leaves the look vector far from the victim's body.

← Back to Analysis Hub