funkemunky-KauriV3 KillAura (Bot) module 5 files, 675 lines

funkemunky-KauriV3 KillAura (Bot): Full Source Analysis

KABot is Kauri's killaura check built on planted fake entities instead of statistics.

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

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

Analysis

Overview

KABot is Kauri's killaura check built on planted fake entities instead of statistics. The anticheat mirrors every entity the server spawns into a TrackedEntity inside a per-world tracker, attaches invisible fake mobs to tracked entities, and keeps a personal bait mob that follows each suspect's aim line; it then reads the client's C02 interact stream against those bait entity ids. Two independent buffers measure two failure modes: attacking a real entity whose surroundings carry fake mobs without ever touching the fake mobs (the signature of an entity filter, buffer above 3), and attacking the personal bait mob itself (the signature of an unfiltered aura, buffer2 above 3). Each C0A arm swing drains both buffers (0.05 and 0.25) so that vanilla's swing-per-attack cadence keeps a legitimate player's net change near zero. The check is flag-only: it feeds the violation system but never cancels packets or damage. The killaura package's calc/ directory (KACalc, RotationCheck, KAZero, KAGrid) is the sibling rotation-analysis machinery; KABot does not invoke it, but both halves read the same tracked-entity pipeline.

Bait infrastructure

APlayer.load() wires the tracker: worldTracker is a BlockUpdateHandler whose currentWorld AtomicReference holds the per-world mirror (a dev.brighten.ac.handler.block.World), and entityTrackHandler is an EntityTrackHandler that feeds it. PacketHandler inserts a TrackedEntity on every spawn packet (S0F mob spawns, S0C player spawns, S0E object spawns), and EntityTrackHandler processes the position stream (relative moves, position sync, teleports) into interpolated old/new EntityLocation states on the flying-packet cadence, with the apply ordered by keepalive actions so the client has actually received the packet. Each TrackedEntity carries a fakeMobs list. EntityTrackHandler.createFakeMob plants three invisible size-10 magma cubes at -1.25/0/+1.25 offsets around the tracked entity plus one invisible size-5 slime placed by ray-casting the player's eye direction 0.4 blocks ahead, and flips clientHasEntity (an AtomicBoolean) via a keepalive action once the client has acknowledged the spawns. APlayer also carries a single FakeMob field (mob): BlockUpdateHandler.onRespawn and the world-change teleport listener respawn it behind the player, and MovementHandler.processBotMove re-teleports it along the player's aim line on every movement packet so it stays inside the attack cone. FakeMob entity ids are drawn from 1.5-2 billion so they never collide with real server ids, and the invisible metadata flag (0x20) makes them render transparently.

Detection logic

Both branches are @Bind WActions. The arm action runs on every WrapperPlayClientAnimation (C0A) and drains buffer by 0.05 and buffer2 by 0.25, on the source's own reasoning that a vanilla 1.8.8 player swings with every attack, so a legitimate attack cadence leaves both buffers net-zero. The interact action runs on every WrapperPlayClientInteractEntity (C02). The first branch resolves the attacked id through the world tracker's getTrackedEntity; if the target is tracked and either clientHasEntity is set or its fakeMobs list is non-empty, buffer increments and above 3 the check flags 'Attacked player without attacking bot!', otherwise the buffer resets to 0, so attacking a fake mob (whose id is not in the tracked map) actively clears the buffer. The second branch compares the attacked id to player.getMob().getEntityId(); a match increments buffer2 and above 3 flags 'Player attacked bot' while preloading buffer to 2. The thresholds are effectively four net attacks: the swing drains are small relative to the +1 per attack, so a filter that never touches the bait flags after four attacks on the real entity, and an unfiltered aura flags after four hits on the personal bait. The check never cancels anything: it only feeds the flag pipeline, and server-side damage denial is handled elsewhere through the hitsToCancel counter in GeneralListener.

Killaura calc package

The calc/ directory holds the killaura package's rotation machinery. KACalc is a @Hook KListener that runs on every flying packet while the player has a target and the last attack is under 40ms old: it resolves the target's interpolated location, builds the eye origin (1.62, or 1.54 while sneaking), computes the yaw and pitch offsets between the eye line and the target's eye-height midpoint, accumulates the last 10 offsets, and hands the old/new EntityLocation pair, the standard deviations and the raw offsets to the RotationCheck implementations. KAZero (KillAura (Zero)) flags when the horizontal offset is exactly 0 with a buffer over 2, a perfect error-free aim line. KAGrid (KillAura (Grid)) accumulates the summed offsets into a 100-entry ring and runs a grid analysis once 50 samples exist. KABot shares the tracked-entity pipeline these checks read but does not invoke any of them: the two halves of the package attack killaura from opposite directions, statistical rotation analysis versus planted-entity bait.

source KABot.java (the check)

KABot.java50 lines · Java
1
package dev.brighten.ac.check.impl.combat.killaura;
2
3
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientAnimation;
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.annotation.Bind;
11
import lombok.val;
12
13
@CheckData(name = "KillAura (Bot)", checkId = "kabot", type = CheckType.KILLAURA)
14
public class KABot extends Check {
15
16
    public KABot(APlayer player) {
17
        super(player);
18
    }
19
20
    private float buffer, buffer2;
21
22
    @Bind
23
    WAction<WrapperPlayClientAnimation> arm = packet -> {
24
        // Lower both buffers on each arm swing to prevent false positives for legitimate players.
25
        // In vanilla 1.8.8, every attack is accompanied by a swing animation, so a legit player's
26
        // attack count and swing count should be roughly equal (net-zero buffer change).
27
        if(buffer > 0) buffer-= 0.05f;
28
        if(buffer2 > 0) buffer2-= 0.25f;
29
    };
30
31
    @Bind
32
    WAction<WrapperPlayClientInteractEntity> packet = packet -> {
33
        val optional = player.getWorldTracker().getCurrentWorld().get().getTrackedEntity(packet.getEntityId());
34
35
        if(optional.isPresent()
36
                && (player.getEntityTrackHandler().clientHasEntity.get()
37
                || !optional.get().getFakeMobs().isEmpty()))  {
38
            if(++buffer > 3) {
39
                flag("Attacked player without attacking bot!");
40
            }
41
        } else buffer = 0;
42
43
        if(player.getMob().getEntityId() == packet.getEntityId()) {
44
            if(++buffer2 > 3) {
45
                buffer = 2;
46
                flag("Player attacked bot");
47
            }
48
        } else buffer2 = 0;
49
    };
50
}

What this file does

The check is declared with @CheckData(name = "KillAura (Bot)", checkId = "kabot", type = CheckType.KILLAURA) and holds two float buffers plus two @Bind WActions, one per packet type. The arm action (lines 23-29) drains buffer by 0.05 and buffer2 by 0.25 on every C0A swing; the source comment states the design contract: in vanilla 1.8.8 every attack is accompanied by a swing, so a legit player's attack count and swing count are roughly equal and the buffers stay near zero.

The interact action (lines 31-49) is where the detection lives. Branch one resolves the attacked entity id through player.getWorldTracker().getCurrentWorld().get().getTrackedEntity(...); if the entity is tracked and either clientHasEntity is set or its fakeMobs list is non-empty, buffer gains 1 and above 3 the check flags 'Attacked player without attacking bot!'. The else branch resets buffer to 0, which is what happens when the client attacks a fake mob id, since fake mobs are not entries in the tracked-entity map. Branch two compares the attacked id to player.getMob().getEntityId(); a match gains 1 on buffer2 and above 3 flags 'Player attacked bot' while seeding buffer to 2. With the swing drains, each branch needs roughly four net attacks to fire. The check is flag-only: flag() feeds the violation pipeline, and neither branch cancels packets or damage.

source KACalc.java (calc entry point)

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 @Hook KListener that runs the rotation math for the killaura package's statistical checks. Its flying action only runs while the player has a current target and the last attack was under 40ms ago, which ties the analysis to actual combat windows. It resolves the target's interpolated EntityLocation, builds the attacker origin as the movement position plus 1.62 (1.54 while sneaking), and computes the yaw/pitch offset between that eye line and the target position plus half its eye height using MathUtils.getRotation and getOffsetFromLocation.

The last 10 offsets are kept in EvictingList buffers, and once both are full the action computes the standard deviation of the yaw and pitch offset series, packages the old/new locations, std devs, current offsets and rotations into a Tuple, and dispatches to the RotationCheck implementations found on the player, KAZero and KAGrid. This file is the shared pipeline entry that KABot's world lookups also sit on: KABot calls getTrackedEntity directly and never enters KACalc, but both read the same interpolated entity state that EntityTrackHandler maintains.

source EntityTrackHandler.java (bait lifecycle)

EntityTrackHandler.java365 lines · Java
1
package dev.brighten.ac.handler;
2
3
import com.github.retrooper.packetevents.protocol.attribute.Attribute;
4
import com.github.retrooper.packetevents.protocol.attribute.Attributes;
5
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
6
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
7
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
8
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
9
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
10
import com.github.retrooper.packetevents.util.Vector3d;
11
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;
12
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;
13
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;
14
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;
15
import dev.brighten.ac.data.APlayer;
16
import dev.brighten.ac.handler.entity.FakeMob;
17
import dev.brighten.ac.handler.entity.TrackedEntity;
18
import dev.brighten.ac.packet.WPacketPlayOutEntity;
19
import dev.brighten.ac.utils.EntityLocation;
20
import dev.brighten.ac.utils.KLocation;
21
import dev.brighten.ac.utils.timer.Timer;
22
import dev.brighten.ac.utils.timer.impl.MillisTimer;
23
import dev.brighten.ac.utils.world.types.RayCollision;
24
import lombok.RequiredArgsConstructor;
25
26
import java.util.*;
27
import java.util.concurrent.atomic.AtomicBoolean;
28
29
@RequiredArgsConstructor
30
public class EntityTrackHandler {
31
32
    private final APlayer data;
33
    private final Timer lastFlying = new MillisTimer();
34
35
    public Set<Integer> canCreateMob = new HashSet<>();
36
    public int streak;
37
    public AtomicBoolean clientHasEntity = new AtomicBoolean(false);
38
39
    private final Set<EntityType> allowedEntityTypes = Set.of(EntityTypes.ZOMBIE, EntityTypes.SHEEP,
40
            EntityTypes.BLAZE, EntityTypes.SKELETON, EntityTypes.PLAYER, EntityTypes.VILLAGER, EntityTypes.IRON_GOLEM,
41
            EntityTypes.WITCH, EntityTypes.COW, EntityTypes.CREEPER);
42
43
    public Optional<Integer> getTargetOfFakeMob(int fakeMobId) {
44
        for (TrackedEntity value : data.getWorldTracker().getCurrentWorld().get()
45
                .getTrackedEntities().values()) {
46
            if(value.getFakeMobs().stream().anyMatch(mob -> mob.getEntityId() == fakeMobId)) {
47
                return Optional.of(value.getEntityId());
48
            }
49
        }
50
        return Optional.empty();
51
    }
52
53
    /**
54
     *
55
     * We are processing PacketPlayInFlying to iterate the tracked entity locations
56
     *
57
     */
58
    void onFlying() {
59
        if(lastFlying.isNotPassed(1)) streak++;
60
        else {
61
            streak = 1;
62
        }
63
64
        processZombie();
65
66
        data.getWorldTracker().getCurrentWorld().get().getTrackedEntities().values().forEach(entity -> {
67
            var oldLoc = entity.getOldEntityLocation();
68
            var newLoc = entity.getNewEntityLocation();
69
70
            if(oldLoc != null) {
71
                if(oldLoc.interpolatedLocations.size() > 1 && oldLoc.increment == 0) {
72
                    oldLoc.interpolatedLocations.removeFirst();
73
                }
74
                oldLoc.interpolateLocation();
75
            }
76
            if(newLoc != null) {
77
                if(newLoc.interpolatedLocations.size() > 1 && newLoc.increment == 0) {
78
                    newLoc.interpolatedLocations.removeFirst();
79
                }
80
                newLoc.interpolateLocation();
81
            }
82
        });
83
84
        lastFlying.reset();
85
    }
86
87
    /**
88
     *
89
     * Processing PacketPlayOutRelativePosition for updating entity locations in a relative manner.
90
     *
91
     * @param packet WrappedOutRelativePosition
92
     */
93
    void onRelPosition(WPacketPlayOutEntity packet) {
94
        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()
95
                .getTrackedEntity(packet.getId());
96
97
        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;
98
99
        processFakeMobs(packet.getId(), true, packet.getX(), packet.getY(), packet.getZ());
100
101
        EntityLocation eloc = entity.get().getNewEntityLocation();
102
103
        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());
104
105
        runAction(entity.get(), () -> {
106
            //We don't need to do version checking here. Atlas handles this for us.
107
            eloc.newX += packet.getX();
108
            eloc.newY += packet.getY();
109
            eloc.newZ += packet.getZ();
110
            eloc.newYaw += packet.getYaw();
111
            eloc.newPitch += packet.getPitch();
112
113
            eloc.increment = 3;
114
        });
115
    }
116
117
    void onPositionSync(WrapperPlayServerEntityPositionSync packet) {
118
        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()
119
                .getTrackedEntity(packet.getId());
120
121
        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;
122
123
        processFakeMobs(packet.getId(), false, packet.getValues().getPosition().getX(),
124
                packet.getValues().getPosition().getY(), packet.getValues().getPosition().getZ());
125
126
        EntityLocation eloc = entity.get().getNewEntityLocation();
127
128
        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());
129
130
        runAction(entity.get(), () -> {
131
            //We don't need to do version checking here. Atlas handles this for us.
132
            eloc.newX = packet.getValues().getPosition().getX();
133
            eloc.newY = packet.getValues().getPosition().getY();
134
            eloc.newZ = packet.getValues().getPosition().getZ();
135
            eloc.newYaw = packet.getValues().getYaw();
136
            eloc.newPitch = packet.getValues().getPitch();
137
138
            eloc.increment = 3;
139
        });
140
    }
141
    /**
142
     *
143
     * Processing PacketPlayOutEntityTeleport to update locations in a non-relative manner.
144
     *
145
     * @param packet WrappedOutEntityTeleportPacket
146
     */
147
    void onTeleportSent(WrapperPlayServerEntityTeleport packet) {
148
        Optional<TrackedEntity> entity = data.getWorldTracker().getCurrentWorld().get()
149
                .getTrackedEntity(packet.getEntityId());
150
151
        if(entity.isEmpty() || !allowedEntityTypes.contains(entity.get().getEntityType())) return;
152
153
        processFakeMobs(packet.getEntityId(), false, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ());
154
155
        EntityLocation eloc = entity.get().getNewEntityLocation();
156
157
        entity.get().setOldEntityLocation(entity.get().getNewEntityLocation().clone());
158
159
        runAction(entity.get(), () -> {
160
            if(data.getPlayerVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {
161
                if (!(Math.abs(eloc.x - packet.getPosition().getX()) >= 0.03125D)
162
                        && !(Math.abs(eloc.y - packet.getPosition().getY()) >= 0.015625D)
163
                        && !(Math.abs(eloc.z - packet.getPosition().getZ()) >= 0.03125D)) {
164
                    eloc.increment = 0;
165
                    //We don't need to do version checking here. Atlas handles this for us.
166
                    eloc.newX = eloc.x = packet.getPosition().getX();
167
                    eloc.newY = eloc.y = packet.getPosition().getY();
168
                    eloc.newZ = eloc.z = packet.getPosition().getZ();
169
                    eloc.newYaw = eloc.yaw = packet.getYaw();
170
                    eloc.newPitch = eloc.pitch = packet.getPitch();
171
                } else {
172
                    eloc.newX = packet.getPosition().getX();
173
                    eloc.newY = packet.getPosition().getY();
174
                    eloc.newZ = packet.getPosition().getZ();
175
                    eloc.newYaw = packet.getYaw();
176
                    eloc.newPitch = packet.getPitch();
177
178
                    eloc.increment = 3;
179
                }
180
            } else {
181
                //We don't need to do version checking here. Atlas handles this for us.
182
                eloc.newX = packet.getPosition().getX();
183
                eloc.newY = packet.getPosition().getY();
184
                eloc.newZ = packet.getPosition().getZ();
185
                eloc.newYaw = packet.getYaw();
186
                eloc.newPitch = packet.getPitch();
187
188
                eloc.increment = 3;
189
            }
190
        });
191
    }
192
193
    void updateAttributes(WrapperPlayServerUpdateAttributes attributes) {
194
        data.runKeepaliveAction(ka -> {
195
            TrackedEntity tracked = data.getWorldTracker().getCurrentWorld().get()
196
                    .getTrackedEntity(attributes.getEntityId()).orElse(null);
197
198
            if(tracked == null) return;
199
200
            for (WrapperPlayServerUpdateAttributes.Property property : attributes.getProperties()) {
201
                Attribute attribute = property.getAttribute();
202
203
                if(attributes.getEntityId() == data.getBukkitPlayer().getEntityId() && attribute == Attributes.MOVEMENT_SPEED) {
204
                    ValuedAttribute value = tracked.getAttribute(attribute);
205
206
                    value.updateAttribute(property);
207
                    data.getInfo().setWalkSpeed(value.getValue());
208
                }
209
210
                tracked.updateAttribute(property);
211
            }
212
        });
213
    }
214
215
    /**
216
     *
217
     * We are running an action when a transaction is received. If the Entity provided is currently a target,
218
     * we want to send a tranasction on this method being run and use that to more accurately get an estimate of when
219
     * the client receives the transaction relative to what we want in the action. If not the target, then we use our
220
     * transaction system which sends one transaction every tick, and then on return runs a list of Runnables which
221
     * may be less accurate in some situations, but uses less processing and network resources.
222
     *
223
     * @param entity Entity
224
     * @param action Runnable
225
     */
226
    private void runAction(TrackedEntity entity, Runnable action) {
227
        if(data.getInfo().getTarget() != null && data.getInfo().getTarget().getEntityId() == entity.getEntityId()) {
228
            data.runInstantAction(ia -> {
229
                if(!ia.isEnd()) {
230
                    action.run();
231
                } else entity.setOldEntityLocation(null);
232
            }, true);
233
        } else {
234
            data.runKeepaliveAction(keepalive -> action.run());
235
            data.runKeepaliveAction(keepalive ->
236
                    entity.setOldEntityLocation(null), 1);
237
        }
238
    }
239
240
    public void onEntityDestroy(WrapperPlayServerDestroyEntities packet) {
241
        data.runKeepaliveAction(ka -> {
242
            for(int id : packet.getEntityIds()) {
243
                removeFakeMob(id);
244
            }
245
        });
246
    }
247
248
    public void removeFakeMob(int id) {
249
        if(data.getWorldTracker().getCurrentWorld().get()
250
                .getTrackedEntities().containsKey(id)) {
251
            List<FakeMob> mobs = data.getWorldTracker().getCurrentWorld().get()
252
                    .getTrackedEntity(id).map(TrackedEntity::getFakeMobs).orElse(new ArrayList<>());
253
254
            for (FakeMob mob : mobs) {
255
                mob.despawn();
256
            }
257
258
            mobs.clear();
259
        }
260
        clientHasEntity.set(false);
261
    }
262
263
    private static final double[] offsets = new double[]{-1.25, 0, 1.25};
264
265
    private void createFakeMob(int entityId, KLocation location) {
266
        if (!canCreateMob.contains(entityId)) return;
267
268
        Optional<TrackedEntity> trackedEntity = data.getWorldTracker().getCurrentWorld().get()
269
                .getTrackedEntity(entityId);
270
271
        Optional<TrackedEntity> playerEntity = data.getWorldTracker().getCurrentWorld().get()
272
                .getTrackedEntity(data.getBukkitPlayer().getEntityId());
273
274
        if(trackedEntity.isEmpty() || playerEntity.isEmpty()) return;
275
276
        for (double offset : offsets) {
277
            FakeMob mob = new FakeMob(EntityTypes.MAGMA_CUBE);
278
279
            List<EntityData<?>> types = new ArrayList<>();
280
            EntityData<?> entityData = new EntityData<>(16, EntityDataTypes.BYTE, (byte)10);
281
            types.add(entityData);
282
283
            // Setting Magma cube size to size 10
284
            mob.spawn(true, location.clone().add(offset, offset, offset),
285
                    types, data);
286
287
            trackedEntity.get().getFakeMobs().add(mob);
288
        }
289
290
        KLocation eyeLoc = data.getMovement().getTo().getLoc().clone()
291
                .add(0, data.getEyeHeight() / 2.5, 0);
292
293
        RayCollision collision = new RayCollision(eyeLoc.toVector(), eyeLoc.getDirection());
294
295
        Vector3d point = collision.collisionPoint(0.4);
296
297
        FakeMob mob = new FakeMob(EntityTypes.SLIME);
298
        List<EntityData<?>> types = new ArrayList<>();
299
        EntityData<?> entityData = new EntityData<>(16, EntityDataTypes.BYTE, (byte)5);
300
301
        types.add(entityData);
302
        mob.spawn(true, new KLocation(point.getX(), point.getY(), point.getZ()), types, data);
303
304
        playerEntity.get().getFakeMobs().add(mob);
305
306
        canCreateMob.remove(entityId);
307
308
        data.runKeepaliveAction(ka -> clientHasEntity.set(true));
309
    }
310
311
    public void processZombie() {
312
        List<FakeMob> fakeMobs = data.getWorldTracker().getCurrentWorld().get()
313
                .getTrackedEntity(data.getBukkitPlayer().getEntityId())
314
                .map(TrackedEntity::getFakeMobs)
315
                .orElse(new ArrayList<>());
316
317
        if(fakeMobs.size() > 1) {
318
            fakeMobs.forEach(fakeMob -> removeFakeMob(fakeMob.getEntityId()));
319
        }
320
321
        for (FakeMob fakeMob : fakeMobs) {
322
            if(fakeMob.getType() == EntityTypes.SLIME) {
323
                KLocation eyeLoc = data.getMovement().getTo().getLoc().clone().add(0, 0.6, 0);
324
325
                RayCollision collision = new RayCollision(eyeLoc.toVector(), eyeLoc.getDirection());
326
327
                Vector3d point = collision.collisionPoint(0.4);
328
329
                fakeMob.teleport(point.getX(), point.getY(), point.getZ(), 0 ,0);
330
                break;
331
            }
332
        }
333
    }
334
335
    public void processFakeMobs(int entityId, boolean rel, double x, double y, double z) {
336
        List<FakeMob> fakeMobs = data.getWorldTracker().getCurrentWorld().get()
337
                .getTrackedEntity(entityId).map(TrackedEntity::getFakeMobs).orElse(new ArrayList<>());
338
339
        if(fakeMobs.isEmpty()) {
340
            if(!rel) {
341
                createFakeMob(entityId, new KLocation(x, y, z));
342
            }
343
344
            if(data.getInfo().getTarget() != null && data.getInfo().getTarget().getEntityId() == entityId) {
345
                clientHasEntity.set(false);
346
            }
347
            return;
348
        }
349
350
        if(fakeMobs.size() != offsets.length + 1) {
351
            fakeMobs.forEach(fakeMob -> removeFakeMob(fakeMob.getEntityId()));
352
        }
353
354
        int current = 0;
355
        for (FakeMob fakeMob : fakeMobs) {
356
            double offset = offsets[current++];
357
358
            if(rel) {
359
                fakeMob.move(x, y, z);
360
            } else {
361
                fakeMob.teleport(x + offset, y + offset, z + offset, 0, 0);
362
            }
363
        }
364
    }
365
}

What this file does

EntityTrackHandler owns the fake-mob lifecycle. createFakeMob (lines 265-309) runs when a tracked entity moves non-relatively and no fake mobs exist yet, gated on canCreateMob: it spawns three invisible size-10 magma cubes at -1.25, 0 and +1.25 offsets on all axes around the entity and attaches them to its TrackedEntity, then ray-casts from the player's eye (eye height divided by 2.5) along the look direction, spawns one invisible size-5 slime at the 0.4-block collision point, attaches it to the player's own TrackedEntity, removes the entity id from canCreateMob, and flips clientHasEntity through a keepalive action so the flag is only set once the client has provably received the spawns.

processZombie (lines 311-333) runs on the flying cadence and keeps the bait aligned: if the player's tracked entity carries more than one fake mob they are all removed (a desync guard), and the slime among them is re-teleported to the current aim-ray collision point 0.4 blocks ahead, 0.6 above the player's position. processFakeMobs (lines 335-364) relocates the cluster when the real entity moves: relative moves are forwarded as relative moves, teleports reposition the three cubes with their offsets, and any count mismatch against offsets.length + 1 triggers a full remove. onEntityDestroy (lines 240-246) defers fake-mob despawn to a keepalive action and clears clientHasEntity. The allowedEntityTypes set (zombie, sheep, blaze, skeleton, player, villager, iron golem, witch, cow, creeper) gates which entities get bait at all.

removeFakeMob (lines 248-261) despawns every attached FakeMob, clears the list and sets clientHasEntity false, which is also the reset path KABot's first branch depends on: once the client attacks and destroys the fake mobs or the entity is destroyed server-side, the tracking state returns to a clean slate. The class also drives the interpolated-location aging on onFlying (lines 58-85) that KACalc's offset math consumes.

source FakeMob.java (bait entity)

FakeMob.java123 lines · Java
1
package dev.brighten.ac.handler.entity;
2
3
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
4
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
5
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
6
import com.github.retrooper.packetevents.util.Vector3d;
7
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;
8
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;
9
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;
10
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;
11
import dev.brighten.ac.Anticheat;
12
import dev.brighten.ac.data.APlayer;
13
import dev.brighten.ac.packet.WPacketPlayOutEntity;
14
import dev.brighten.ac.utils.KLocation;
15
import lombok.Getter;
16
17
import java.util.ArrayList;
18
import java.util.Collections;
19
import java.util.List;
20
import java.util.UUID;
21
import java.util.concurrent.ThreadLocalRandom;
22
23
@Getter
24
public class FakeMob {
25
    private final int entityId;
26
    private final EntityType type;
27
28
    private List<APlayer> watching = Collections.emptyList();
29
30
    public FakeMob(EntityType type) {
31
        // Use a very high ID range to avoid colliding with real server entity IDs.
32
        // Real entity IDs start at 1 and increment; on a long-running server they can
33
        // easily exceed 15 000, making the old [15000, 20000) range unsafe.
34
        entityId = ThreadLocalRandom.current().nextInt(1_500_000_000, 2_000_000_000);
35
        this.type = type;
36
    }
37
38
    public void spawn(boolean invisible, KLocation location, List<EntityData<?>> objects, APlayer... players) {
39
        if(!watching.isEmpty()) {
40
            despawn();
41
        }
42
43
        watching = new ArrayList<>();
44
        for (APlayer player : players) {
45
            if(invisible) {
46
                EntityData<?> entityData = new EntityData<>(0, EntityDataTypes.BYTE, (byte) 0x20);
47
48
                objects.add(entityData);
49
            }
50
            WrapperPlayServerSpawnLivingEntity packet = new WrapperPlayServerSpawnLivingEntity(entityId, UUID.randomUUID(), type,
51
                    new Vector3d(location.getX(), location.getY(), location.getZ()), location.getYaw(), location.getPitch(), location.getYaw(),
52
                    new Vector3d(0, 0, 0), objects);
53
54
            player.sendPacket(packet);
55
            watching.add(player);
56
        }
57
58
        Anticheat.INSTANCE.getFakeTracker().trackEntity(this);
59
    }
60
61
    public void setInvisible(boolean invisible) {
62
        List<EntityData<?>> entityMetadata = new ArrayList<>();
63
64
        if(invisible) {
65
            EntityData<?> entityData = new EntityData<>(0, EntityDataTypes.BYTE, (byte) 0x20);
66
67
            entityMetadata.add(entityData);
68
        } else {
69
            EntityData<?> entityData = new EntityData<>(0, EntityDataTypes.BYTE, (byte) ~0x20);
70
71
            entityMetadata.add(entityData);
72
        }
73
74
        WrapperPlayServerEntityMetadata packet = new WrapperPlayServerEntityMetadata(entityId, entityMetadata);
75
76
        watching.forEach(player -> player.sendPacket(packet));
77
    }
78
79
    public void despawn() {
80
        for (APlayer aPlayer : watching) {
81
            Anticheat.INSTANCE.getLogger().info("Despawning fake entity with ID: " + entityId);
82
            aPlayer.sendPacket(new WrapperPlayServerDestroyEntities(entityId));
83
        }
84
        watching = Collections.emptyList();
85
86
        Anticheat.INSTANCE.getFakeTracker().untrackEntity(this);
87
    }
88
89
    public void move(double dx, double dy, double dz) {
90
        WPacketPlayOutEntity packet = WPacketPlayOutEntity.builder().id(entityId).x(dx).y(dy).z(dz).moved(true).build();
91
92
        for (APlayer player : watching) {
93
            player.sendPacket(packet.getPacket());
94
        }
95
    }
96
97
    public void move(double dx, double dy, double dz, float dyaw, float dpitch) {
98
        WPacketPlayOutEntity packet = WPacketPlayOutEntity.builder().id(entityId).x(dx).y(dy).z(dz).yaw(dyaw)
99
                .pitch(dpitch).moved(true).looked(true).build();
100
101
        for (APlayer player : watching) {
102
            player.sendPacket(packet.getPacket());
103
        }
104
    }
105
106
    public void move(float dyaw, float dpitch) {
107
        WPacketPlayOutEntity packet = WPacketPlayOutEntity.builder().id(entityId).yaw(dyaw).pitch(dpitch)
108
                .looked(true).build();
109
110
        for (APlayer player : watching) {
111
            player.sendPacket(packet.getPacket());
112
        }
113
    }
114
115
    public void teleport(double x, double y, double z, float yaw, float pitch) {
116
        WrapperPlayServerEntityTeleport packet = new WrapperPlayServerEntityTeleport(entityId,
117
                new Vector3d(x, y, z), yaw, pitch, false);
118
119
        for (APlayer player : watching) {
120
            player.sendPacket(packet);
121
        }
122
    }
123
}

What this file does

FakeMob is the planted entity itself. The constructor draws the entity id from 1,500,000,000 to 2,000,000,000 (the source comment explains that real server ids start at 1 and can exceed 15,000 on long-running servers, so the old 15,000-20,000 range was unsafe). spawn() builds a WrapperPlayServerSpawnLivingEntity with a random UUID and the given type, optionally ORs the invisible metadata flag 0x20 into entity data index 0, sends it only to the watching players, and registers the mob in the global fake tracker so the anticheat knows which ids are its own.

despawn() sends WrapperPlayServerDestroyEntities to the watchers and unregisters; move() emits relative WPacketPlayOutEntity moves and teleport() emits absolute WrapperPlayServerEntityTeleport. These are the packets the client actually receives, which is what makes the bait observable: a killaura sees a valid in-range entity and targets it, while the antibot filter sees an invisible, name-less, untabbed entity and marks it. The per-player mob bait that KABot's second branch watches is one of these objects, held on APlayer and respawned on world changes.

source TrackedEntity.java (entity mirror)

TrackedEntity.java68 lines · Java
1
package dev.brighten.ac.handler.entity;
2
3
import com.github.retrooper.packetevents.protocol.attribute.Attribute;
4
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
5
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;
6
import dev.brighten.ac.data.obj.Pose;
7
import dev.brighten.ac.handler.ValuedAttribute;
8
import dev.brighten.ac.utils.EntityLocation;
9
import dev.brighten.ac.utils.KLocation;
10
import lombok.Getter;
11
import lombok.Setter;
12
13
import java.util.ArrayList;
14
import java.util.HashSet;
15
import java.util.List;
16
import java.util.Set;
17
18
@Getter
19
@Setter
20
public class TrackedEntity {
21
    private final int entityId;
22
    private final EntityType entityType;
23
    private KLocation location;
24
    private EntityLocation oldEntityLocation, newEntityLocation;
25
    private List<FakeMob> fakeMobs = new ArrayList<>();
26
    private Set<ValuedAttribute> attributes = new HashSet<>();
27
    private Pose pose = Pose.STANDING;
28
29
    public TrackedEntity(int entityId, EntityType entityType, KLocation location) {
30
        this.entityId = entityId;
31
        this.entityType = entityType;
32
        this.location = location;
33
        this.newEntityLocation = new EntityLocation(this);
34
35
        newEntityLocation.x = location.getX();
36
        newEntityLocation.y = location.getY();
37
        newEntityLocation.z = location.getZ();
38
        newEntityLocation.location = location;
39
        newEntityLocation.yaw = location.getYaw();
40
        newEntityLocation.pitch = location.getPitch();
41
    }
42
    
43
    public KLocation getEyeLocation() {
44
        return new KLocation(location.getX(), location.getY() + pose.eyeHeight, location.getZ(),
45
                location.getYaw(), location.getPitch());
46
    }
47
48
    public ValuedAttribute getAttribute(Attribute type) {
49
        for(ValuedAttribute attribute : attributes) {
50
            if(attribute.getAttribute().equals(type)) {
51
                return attribute;
52
            }
53
        }
54
        return null;
55
    }
56
57
    public void updateAttribute(WrapperPlayServerUpdateAttributes.Property property) {
58
        ValuedAttribute attribute = getAttribute(property.getAttribute());
59
60
        if(attribute == null) {
61
            attribute = new ValuedAttribute(property.getAttribute());
62
        }
63
64
        attribute.updateAttribute(property);
65
66
        attributes.add(attribute);
67
    }
68
}

What this file does

TrackedEntity is the anticheat's mirror of one real entity: entity id, type, current KLocation, old and new interpolated EntityLocation states, an attribute set fed by update-attribute packets, a pose, and the fakeMobs list that KABot's first branch inspects. The constructor seeds the new EntityLocation from the spawn location, and getEyeLocation exposes the eye position from the pose's eye height for the reach and rotation checks.

The fakeMobs list is the bridge between the two halves of KABot: EntityTrackHandler.createFakeMob appends to it, removeFakeMob drains it, and the check's branch one reads it directly. Because getTrackedEntity resolves by the real entity id, an attack on a fake mob id never resolves here, which is the mechanism that lets the check tell a filtered attack (buffer grows) from an unfiltered one (buffer resets).

← Back to Analysis Hub