funkemunky-KauriV3 KillAura (Trace) module 2 files, 174 lines

funkemunky-KauriV3 KillAura (Trace): Full Source Analysis

KATrace is Kauri's killaura check for attacks through solid blocks, registered as 'KillAura (Trace)' (checkId katrace, CheckType.KILLAURA) and bound to WrapperPlayClientInteractEntity…

Anticheat/src/main/java/dev/brighten/ac/check/impl/combat/killaura/KATrace.java ·

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

Packets This Module Uses

Analysis

Overview

KATrace is Kauri's killaura check for attacks through solid blocks, registered as 'KillAura (Trace)' (checkId katrace, CheckType.KILLAURA) and bound to WrapperPlayClientInteractEntity - the serverbound interact packet (C02) - so it only ever runs on ATTACK actions against a current target. It reconstructs the player's view server-side: the ray origin is the movement 'to' location raised by the player's eye height, the direction comes from origin.getDirection() (the yaw/pitch of the last movement packet), and a RayCollision computes the entry point of that ray on the target's server-tracked bounding box. The check then tests the same ray against the block collision boxes that MovementProcessor already collected for the look ray: only integer-aligned SimpleCollisionBoxes (full blocks; stairs/slabs/snow sub-boxes are skipped) shrunk by 0.005 per axis count, and any block intersect closer than the target hit minus 0.2 in squared distance means the attack crossed a block first. A buffer smooths false positives: 'Attacker hit through block!' fires only once the buffer exceeds 2, clean attacks decrement it, and an empty looking-at list resets it outright.

Detection model

The check is a single ray tested against two box sets. First the target: the entity is fetched from the world tracker by the current target's entity id, its bounding box is built with EntityData.getEntityBox, and RayCollision.collisionPoint(targetBox) returns the entry point of the eye ray on that AABB. The distance is kept squared - originVec.distanceSquared(targetPoint) - with the source comment noting the square root is skipped for performance. Then the block set: the synchronized walk over player.getMovement().getLookingAtBoxes() filters to SimpleCollisionBox instances whose min/max are all integer-aligned (line 80-81), which excludes partial boxes like slabs, stairs and snow layers and leaves only full blocks; each candidate is shrunk 0.005 per axis 'since there is a bit of a margin of error in the ray trace' and re-intersected with the same ray. A hit counts as a blocked attack only when its squared distance is less than dist - 0.2 - i.e. the ray meets solid geometry more than ~0.45 blocks (sqrt of 0.2) before it reaches the target box - so grazing a block edge inside the epsilon does not count. The ray itself is the server's reconstruction from the movement stream, not the client's render view: the direction is KLocation.getDirection() of the last movement 'to' location, which is why a killaura that aims its C02 at an entity through a wall while the movement yaw/pitch points into the wall is exactly what this check exposes.

Buffer and flag shaping

The buffer is the only state, and every path through the handler touches it. When the player's ray intersects no block boxes at all - getLookingAtBoxes() is empty - the check cannot evaluate and resets buffer to 0 (lines 39-43), so a player who never faces a wall can never accumulate. On a detected block-crossing attack the buffer increments and the flag fires only when ++buffer > 2 (lines 95-100): two prior blocked attacks must have been observed, which absorbs the occasional legitimate edge-clip where the 0.005 shrink and the 0.2 margin disagree with the true hitbox. Clean attacks (no block collision) decay the buffer with buffer-- (line 101), so a stretch of legitimate combat drains the ledger at one point per attack rather than resetting it. The flag message embeds both the buffer and the size of the looking-at list ('Attacker hit through block! [b=%s s=%s]'), and debug() logs the per-attack state, which makes the check's sensitivity tunable from the violation data alone. The early returns are strict: no target, non-ATTACK action, empty box list, untracked entity, null target box, and a ray that misses the target box entirely all bail before the buffer is touched, so the buffer can only ever be fed by genuine ATTACK packets whose ray reached the target.

Packet-observation pipeline

KATrace is deliberately lazy about geometry. The comment at lines 75-76 states that the ray-vs-block scan is 'already grabbed in MovementProcessor' and reused here to save compute: the looking-at box list is populated once per movement packet by the movement processor's own ray trace, and KATrace consumes it under a synchronized lock (line 77) rather than re-casting the ray against the world. The per-attack cost is therefore one AABB intersection against the target box plus a linear scan of a small box list. The bound event is WrapperPlayClientInteractEntity, so the check observes the C02-equivalent stream only, and the box list it reads reflects the server's last processed movement - the look state at the time of the previous movement packet, which in 1.8 arrives ahead of the attack packet. The eye origin (line 55-58) is the movement 'to' location cloned and raised by player.getEyeHeight(), which is pose-aware in Kauri, so a sneaking attacker's ray starts 1.54 blocks up and a standing attacker's at 1.62, matching the hardcoded heights used by the sibling KACalc listener. The target box comes from EntityData.getEntityBox with the tracked entity's interpolated location, giving the check a lag-aware target AABB to intersect.

source KATrace.java (the check)

KATrace.java105 lines · Java
1
package dev.brighten.ac.check.impl.combat.killaura;
2
3
import com.github.retrooper.packetevents.util.Vector3d;
4
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
5
import dev.brighten.ac.api.check.CheckType;
6
import dev.brighten.ac.check.Check;
7
import dev.brighten.ac.check.CheckData;
8
import dev.brighten.ac.check.WAction;
9
import dev.brighten.ac.data.APlayer;
10
import dev.brighten.ac.utils.KLocation;
11
import dev.brighten.ac.utils.annotation.Bind;
12
import dev.brighten.ac.utils.world.CollisionBox;
13
import dev.brighten.ac.utils.world.EntityData;
14
import dev.brighten.ac.utils.world.types.RayCollision;
15
import dev.brighten.ac.utils.world.types.SimpleCollisionBox;
16
17
/**
18
 * @author funkemunky
19
 * @since 12/31/2020
20
 * This check is designed to detect an attack through solid blocks, which would be impossible under normal
21
 * circumstances.
22
 */
23
@CheckData(name = "KillAura (Trace)", checkId = "katrace", type = CheckType.KILLAURA)
24
public class KATrace extends Check {
25
26
    public KATrace(APlayer player) {
27
        super(player);
28
    }
29
30
    private int buffer;
31
32
    @Bind
33
    WAction<WrapperPlayClientInteractEntity> useEntity = packet -> {
34
        if(player.getInfo().getTarget() == null
35
                || packet.getAction() != WrapperPlayClientInteractEntity.InteractAction.ATTACK)
36
            return;
37
38
        // If the player isn't looking at the target, then a raytrace check wouldn't work.
39
        if(player.getMovement().getLookingAtBoxes().isEmpty()) {
40
            debug("No boxes to look at!");
41
            buffer = 0;
42
            return;
43
        }
44
45
        var trackedEntity = player.getWorldTracker().getCurrentWorld().get().getTrackedEntity(player.getInfo().getTarget().getEntityId());
46
47
        if(trackedEntity.isEmpty()) {
48
            return;
49
        }
50
        // Getting the target's bounding box
51
        SimpleCollisionBox targetBox = (SimpleCollisionBox) EntityData.getEntityBox(player.getInfo().getTarget().getLocation(), trackedEntity.get());
52
53
        if(targetBox == null) return;
54
55
        final KLocation origin = player.getMovement().getTo().getLoc().clone();
56
57
        // Setting the player's eye height based on their sneak status
58
        origin.add(0, player.getEyeHeight(), 0);
59
60
        final Vector3d originVec = origin.toVector();
61
62
        // Setting a trace based on their view direction
63
        RayCollision collision = new RayCollision(originVec, origin.getDirection());
64
65
        Vector3d targetPoint = collision.collisionPoint(targetBox);
66
        //If the ray isn't collided, we might as well not run this check. Just a simple boxes on array check
67
        if(targetPoint == null) return;
68
69
        // The distance bteween the player's eye and the intersect point of the ray and the target's bounding box.
70
        // We don't do the square root to save on performance.
71
        double dist = originVec.distanceSquared(targetPoint);
72
73
        boolean rayCollidedOnBlock = false;
74
75
        // Grabbing the boxes found on the ray trace. This is already grabbed in MovementProcessor so we can use
76
        // the result from there in this check to save on compute time.
77
        synchronized (player.getMovement().getLookingAtBoxes()) {
78
            for (CollisionBox lookingAtBox : player.getMovement().getLookingAtBoxes()) {
79
                if((lookingAtBox instanceof SimpleCollisionBox box)) {
80
                    if(box.minX % 1 != 0 || box.minY % 1 != 0 || box.minZ % 1 != 0
81
                            || box.maxX % 1 != 0 || box.maxY % 1 != 0 || box.maxZ % 1 != 0)
82
                        continue;
83
84
                    // We want to shrink the box slightly since there is a bit of a margin of error in the ray trace.
85
                    Vector3d point = collision.collisionPoint(box.copy().shrink(0.005f, 0.005f, 0.005f));
86
87
                    if (point != null && originVec.distanceSquared(point) < dist - 0.2) {
88
                        rayCollidedOnBlock = true;
89
                        break;
90
                    }
91
                }
92
            }
93
        }
94
95
        if(rayCollidedOnBlock) {
96
            // The buffer is here to smooth out false positives.
97
            if(++buffer > 2) {
98
                flag("Attacker hit through block! [b=%s s=%s]",
99
                        buffer, player.getMovement().getLookingAtBoxes().size());
100
            }
101
        } else if(buffer > 0) buffer--;
102
103
        debug("b=%s collides=%s", buffer, rayCollidedOnBlock);
104
    };
105
}

What this file does

The check is 105 lines and one bound action. The @CheckData declaration (line 23) registers it as 'KillAura (Trace)' with checkId katrace under CheckType.KILLAURA. The bound useEntity handler (lines 33-104) opens with the four bails: no current target, non-ATTACK interact action, an empty looking-at box list (which resets the buffer, lines 39-43), and an untracked target entity (lines 45-49). The target geometry is built at lines 51-53 via EntityData.getEntityBox on the tracked entity's location. The ray is constructed at lines 55-63: the movement 'to' location is cloned, raised by the eye height, and turned into a RayCollision with the direction from KLocation.getDirection(); the collision point on the target box is found at line 65 and the squared distance to it computed at line 71. The block scan (lines 73-93) is the core: under synchronized access it walks the MovementProcessor-provided box list, keeps only integer-aligned SimpleCollisionBoxes, shrinks each by 0.005, re-intersects, and compares squared distances with the dist - 0.2 margin. The buffer logic (lines 95-101) and the flag/debug messages (lines 98-103) close the handler. The design note at lines 75-76 - that the box list is computed once in MovementProcessor and reused to save compute - explains why the check has no world access of its own and why the per-attack cost is so low.

source KACalc.java (companion calc listener)

KACalc.java69 lines · Java
1
package dev.brighten.ac.check.impl.combat.killaura.calc;
2
3
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;
4
import dev.brighten.ac.check.Hook;
5
import dev.brighten.ac.check.KListener;
6
import dev.brighten.ac.check.WAction;
7
import dev.brighten.ac.check.impl.combat.killaura.calc.impl.KAGrid;
8
import dev.brighten.ac.check.impl.combat.killaura.calc.impl.KAZero;
9
import dev.brighten.ac.data.APlayer;
10
import dev.brighten.ac.handler.entity.TrackedEntity;
11
import dev.brighten.ac.utils.EntityLocation;
12
import dev.brighten.ac.utils.KLocation;
13
import dev.brighten.ac.utils.MathUtils;
14
import dev.brighten.ac.utils.Tuple;
15
import dev.brighten.ac.utils.annotation.Bind;
16
import dev.brighten.ac.utils.objects.evicting.EvictingList;
17
import org.bukkit.util.Vector;
18
19
import java.util.List;
20
import java.util.Optional;
21
22
@Hook
23
public class KACalc extends KListener {
24
    public KACalc(APlayer player) {
25
        super(player);
26
    }
27
28
    private final List<Double> YAW_OFFSET = new EvictingList<>(10),
29
            PITCH_OFFSET = new EvictingList<>(10);
30
31
    @Bind
32
    WAction<WrapperPlayClientPlayerFlying> flying = packet -> {
33
        if(player.getInfo().getTarget() == null || player.getInfo().lastAttack.isPassed(40)) return;
34
        Optional<TrackedEntity> optional = player.getWorldTracker().getCurrentWorld().get()
35
                .getTrackedEntity(player.getInfo().getTarget().getEntityId());
36
37
        if(optional.isEmpty()) return;
38
39
        EntityLocation location = optional.get().getNewEntityLocation();
40
41
        if(location == null) {
42
            return;
43
        }
44
        Vector current = location.getCurrentIteration();
45
46
        KLocation originKLoc = player.getMovement().getTo().getLoc().clone()
47
                .add(0, player.getInfo().isSneaking() ? 1.54f : 1.62f, 0);
48
49
        double halfHeight = player.getInfo().getTarget().getPose().eyeHeight / 2;
50
        KLocation targetLocation = new KLocation(current.getX(), current.getY(), current.getZ());
51
        var rotations = MathUtils
52
                .getRotation(originKLoc, targetLocation.clone().add(0, halfHeight, 0));
53
        var offset = MathUtils.getOffsetFromLocation(originKLoc, targetLocation);
54
55
        YAW_OFFSET.add(offset[0]);
56
        PITCH_OFFSET.add(offset[1]);
57
58
        if(YAW_OFFSET.size() < 10 || PITCH_OFFSET.size() < 10) return;
59
60
        double[] std = new double[2];
61
62
        std[0] = MathUtils.stdev(YAW_OFFSET);
63
        std[1] = MathUtils.stdev(PITCH_OFFSET);
64
65
        var elocTuple = new Tuple<>(optional.get().getNewEntityLocation(), optional.get().getOldEntityLocation());
66
        find(KAZero.class).ifPresent(zero -> zero.runCheck(elocTuple, std, offset, rotations));
67
        find(KAGrid.class).ifPresent(grid -> grid.runCheck(elocTuple, std, offset, rotations));
68
    };
69
}

What this file does

KACalc is the only other file in the killaura/calc package, and it is worth being precise about the relationship: KATrace does not call it. KATrace performs its own ray collision through the utils RayCollision class plus the MovementProcessor box list, while KACalc is the sibling listener that computes the rotation statistics consumed by the other two checks in the family, KAZero and KAGrid. Bound to WrapperPlayClientPlayerFlying (the movement packet), it fires only when a target exists and was attacked within 40 ticks (line 33), then computes the yaw/pitch offsets from the eye origin - the movement 'to' location raised by a hardcoded 1.54 (sneaking) or 1.62 (standing) - to the target's current interpolated location, appends them to two 10-entry EvictingLists (lines 55-56), and once full computes their standard deviations (lines 60-63) before handing the offset, rotation and stdev tuples to KAZero and KAGrid via find(). It shares the eye-origin geometry with KATrace but serves a different purpose: its stdev outputs feed the rotation-smoothing checks, and its presence in the calc package is why the package exists - to keep the pure-math killaura helpers out of the check classes. The precise shared pipeline detail (the same sneak-adjusted eye height, the same movement 'to' origin) is what makes the two listeners complementary views of the same attack geometry.

← Back to Analysis Hub