Rise 5.99 AutoGap module 2 files, 662 lines

Rise 5.99 AutoGap: Full Source Analysis

Rise 5.99's AutoGap eats golden apples in a single pre-motion burst: when ticks exceed 10 and health is below the Health setting (default 10), it queues a C07 release, a C09 switch to the gap slot…

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

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

Analysis

Overview

Rise 5.99's AutoGap eats golden apples in a single pre-motion burst: when ticks exceed 10 and health is below the Health setting (default 10), it queues a C07 release, a C09 switch to the gap slot, a C08 use, a burst of 31 empty C03PacketPlayer packets, a C09 switch back, and a closing C07 release - all through addToSendQueue in one tick. The C03 burst is the module's signature: 31 position-less movement packets hammer the server in the same instant as the use, which is what collapses the vanilla eat window on servers that process use-duration per received packet. A companion PacketSendEvent handler cancels every C0A swing while the gap slot is armed, suppressing swing traffic for the duration of the eat burst. Slot selection is PlayerUtil.findGap(), matching hotbar stacks whose display name contains 'Golden' and which are ItemFood.

One-tick burst eat

The entire eat sequence is queued inside a single onPreMotion when the gate opens: C07PacketPlayerDigging RELEASE_USE_ITEM at BlockPos.ORIGIN facing down (cancelling any in-progress use), C09PacketHeldItemChange(gap) when switchSlot is enabled, C08PacketPlayerBlockPlacement with the gap stack (the use), then a for loop queuing 31 new C03PacketPlayer() packets - the no-argument constructor, so each is a position-less ground=false movement packet - then the switch-back C09 when switchSlot is on, and a trailing C07 RELEASE_USE_ITEM. gap is reset to -37 at the end of the same tick, and ticks is zeroed so the next cycle needs another 11 ticks. All sends go through mc.getNetHandler().addToSendQueue or addToSendQueueWithoutEvent, bypassing the module's own event bus.

The C03 burst and swing suppression

The 31 C03PacketPlayer() packets carry no position, look, or ground data - they are pure movement-tick traffic. Their purpose is to flood the server with packet processing during the use so that servers which advance item-use duration per received packet complete the gap's 32-tick eat window almost instantly, making the trailing release finish the consumption in the same tick as the use began. On vanilla the burst is redundant (the release after an under-32-tick use does not complete the eat), but the wire fingerprint is unmistakable: 31 empty C03s in a single tick. The onPacketSend handler meanwhile cancels every C0APacketAnimation while gap != -37, which suppresses swing packets emitted by other modules during the eat window, keeping the burst clean of animation traffic.

Slot finder and cycle gate

findGap() scans hotbar container slots 36-44 for a stack that is non-null, has stackSize above 0, is an ItemFood, and whose display name contains 'Golden', returning the first match as a container index; the module subtracts 36 for the hotbar index and treats -37 as not-found (findGap -1 minus 36). The cycle gate is ticks > 10 plus health below the threshold; ticks is incremented every pre-motion regardless of whether a gap was found, so the module polls the hotbar once per tick while low, and after a successful eat resets ticks to 0, imposing an 11-tick (roughly 550ms) cooldown between eats.

source AutoGap.java

AutoGap.java67 lines · JavaOriginal ↗
1
/*
2
 Copyright Alan Wood 2021
3
 None of this code to be reused without my written permission
4
 Intellectual Rights owned by Alan Wood
5
 */
6
package dev.rise.module.impl.combat;
7
8
import dev.rise.event.impl.motion.PreMotionEvent;
9
import dev.rise.event.impl.packet.PacketSendEvent;
10
import dev.rise.module.Module;
11
import dev.rise.module.api.ModuleInfo;
12
import dev.rise.module.enums.Category;
13
import dev.rise.setting.impl.BooleanSetting;
14
import dev.rise.setting.impl.NumberSetting;
15
import dev.rise.util.player.PlayerUtil;
16
import net.minecraft.network.play.client.*;
17
import net.minecraft.util.BlockPos;
18
import net.minecraft.util.EnumFacing;
19
20
@ModuleInfo(name = "AutoGap", description = "Eats Golden Apples when your health is getting low", category = Category.COMBAT)
21
public final class AutoGap extends Module {
22
23
    private int ticks;
24
    public static int gap = -37;
25
26
    private final NumberSetting health = new NumberSetting("Health", this, 10, 0, 20, 0.1);
27
28
    private final BooleanSetting switchSlot = new BooleanSetting("Switch Slots", this, true);
29
30
    @Override
31
    protected void onDisable() {
32
        gap = -37;
33
    }
34
35
    @Override
36
    public void onPreMotion(final PreMotionEvent event) {
37
        ++ticks;
38
39
        if (ticks > 10 && mc.thePlayer.getHealth() < health.getValue()) {
40
            gap = PlayerUtil.findGap() - 36;
41
42
            if (gap != -37) {
43
                mc.getNetHandler().addToSendQueueWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
44
                if (switchSlot.isEnabled()) mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(gap));
45
                mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getStackInSlot(gap)));
46
47
                for (int i = 0; i <= 31; i++) mc.getNetHandler().addToSendQueue(new C03PacketPlayer());
48
49
                if (switchSlot.isEnabled())
50
                    mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
51
52
                mc.getNetHandler().addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
53
54
                ticks = 0;
55
            }
56
        }
57
58
        gap = -37;
59
    }
60
61
    @Override
62
    public void onPacketSend(final PacketSendEvent event) {
63
        if (event.getPacket() instanceof C0APacketAnimation && gap != -37) {
64
            event.setCancelled(true);
65
        }
66
    }
67
}

What this file does

onPreMotion (lines 36-59) is the whole eat engine. The ticks counter (line 37) gates the cycle, and the sequence at lines 43-52 is the burst: leading C07 release, C09 to the gap slot (when switchSlot is on), C08 use with the gap stack, the for loop over i <= 31 queuing empty C03PacketPlayer objects, the switch-back C09, and the trailing C07 release. All sends use the net handler directly - addToSendQueueWithoutEvent for the leading release, addToSendQueue for the rest - so the packets bypass the module's own event stream; that is why the C0A cancel in onPacketSend (lines 62-66) cannot intercept the module's own sends and exists to catch swings from other modules during the armed window. gap is a public static field, reset to -37 at the end of every tick (line 58), so the C0A suppression window lasts exactly one tick.\n\nThe 31 C03PacketPlayer() instances are the no-argument constructor: onGround defaults to false and no position, yaw or pitch is set, so each is a bare flying packet. The module never opens a window and never sends C0E; its entire interaction surface is C09/C08/C07/C03 traffic against the hotbar. onDisable only clears the sentinel, leaving the real slot untouched if the module is disabled mid-cycle.

source PlayerUtil.java (findGap slot finder)

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

findGap (lines 297-307) scans container slots 36 to 44, the hotbar in the player inventory container, and returns the first stack that is non-null, has stackSize above 0, is an ItemFood, and whose display name contains 'Golden'. The display-name predicate is what separates golden apples from other ItemFood items, and the ItemFood requirement excludes non-edible 'Golden' items. The return value is a container index, so the module subtracts 36 to obtain the hotbar index used in the C09 and the inventory.getStackInSlot(gap) lookup for the C08 payload.\n\nOnly the hotbar is scanned: gaps in the main inventory are never considered, so the module depends on the player pre-loading golden apples into the hotbar. The same class provides findSoup and findHead for the sibling AutoSoup and AutoHead modules with the identical slots-36-to-44 scan pattern.

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 ItemSwitchSpeed (same-tick switch-back)

ItemSwitchSpeed.java80 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
package me.islandscout.hawk.check.interaction.item;
19
20
import me.islandscout.hawk.HawkPlayer;
21
import me.islandscout.hawk.check.Cancelless;
22
import me.islandscout.hawk.check.CustomCheck;
23
import me.islandscout.hawk.event.Event;
24
import me.islandscout.hawk.event.InteractItemEvent;
25
import me.islandscout.hawk.event.InteractWorldEvent;
26
import me.islandscout.hawk.event.ItemSwitchEvent;
27
import org.bukkit.entity.Player;
28
29
import java.util.*;
30
31
public class ItemSwitchSpeed extends CustomCheck implements Cancelless {
32
33
    private Map<UUID, Long> lastSwitchTicks;
34
    private Set<UUID> usedSomething;
35
    private int MIN_SWITCH_TICKS;
36
37
    //might rename this to "AutoUse"
38
    public ItemSwitchSpeed() {
39
        super("itemswitchspeed", true, -1, 1, 0.999, 5000, "%player% failed item switch speed, VL: %vl%", null);
40
        lastSwitchTicks = new HashMap<>();
41
        usedSomething = new HashSet<>();
42
        MIN_SWITCH_TICKS = (int)customSetting("minSwitchTicks", "", 1);
43
    }
44
45
    //For future reference, if you try to verify that the item-switch packet points to a different slot, beware of falses.
46
    //The client can send item-switch packets regardless if the slot switched or not.
47
48
    @Override
49
    protected void check(Event event) {
50
        if(event instanceof InteractItemEvent || event instanceof InteractWorldEvent) {
51
            usedSomething.add(event.getPlayer().getUniqueId());
52
        }
53
        else if(event instanceof ItemSwitchEvent) {
54
55
            HawkPlayer pp = event.getHawkPlayer();
56
            UUID uuid = pp.getUuid();
57
58
            if(usedSomething.contains(uuid)) {
59
                long lastSwitchTick = lastSwitchTicks.getOrDefault(uuid, 0L);
60
                if(pp.getCurrentTick() - lastSwitchTick < MIN_SWITCH_TICKS) {
61
                    punish(pp, 1, false, event);
62
                }
63
                else {
64
                    reward(pp);
65
                }
66
67
                usedSomething.remove(uuid);
68
            }
69
70
            lastSwitchTicks.put(pp.getUuid(), pp.getCurrentTick());
71
        }
72
    }
73
74
    @Override
75
    public void removeData(Player p) {
76
        UUID uuid = p.getUniqueId();
77
        lastSwitchTicks.remove(uuid);
78
        usedSomething.remove(uuid);
79
    }
80
}

How it counteracts this module

Hawk's ItemSwitchSpeed marks a player as having used something on InteractItemEvent or InteractWorldEvent, then checks the next ItemSwitchEvent against the stored lastSwitchTick, punishing when the gap is under minSwitchTicks (default 1).\n\nAutoGap queues the C09 switch, the C08 use, and the switch-back C09 all inside one tick, so the switch-back ItemSwitchEvent lands in the same tick as the C08 that armed usedSomething: the delta is 0 ticks, below the default minimum of 1, and the check punishes on every eat burst. The module's own cooldown (ticks reset to 0, next burst after 11 ticks) does not help, because each burst re-triggers the punish and Hawk's VL accumulates across bursts. This is the most reliable counter in the set: the same-tick slot restore is structurally incompatible with the check's minimum switch gap.

anticheat FastConsume (consume duration)

FastConsume.java28 lines · Java
1
package me.vrekt.arc.check.inventory;
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.inventory.InventoryData;
7
import org.bukkit.entity.Player;
8
9
public class FastConsume extends Check {
10
11
    private int consumeTime = 0;
12
13
    public FastConsume() {
14
        super(CheckType.FASTCONSUME);
15
16
        consumeTime = Arc.getCheckManager().getValueInt(CheckType.FASTCONSUME, "consume-time");
17
    }
18
19
    public boolean check(Player player, InventoryData data) {
20
21
        long now = System.currentTimeMillis();
22
        long last = data.getConsumeTime();
23
        long total = now - last;
24
25
        // check if the time it took to consume the item is less than allowed.
26
        return total < consumeTime && checkViolation(player, "consume time less than allowed.");
27
    }
28
}

How it counteracts this module

Arc v2's FastConsume stamps InventoryData.consumeTime on a RIGHT_CLICK_AIR or RIGHT_CLICK_BLOCK with an edible item and flags a PlayerItemConsumeEvent arriving within consume-time (default 1280ms) of the stamp.\n\nAutoGap sends the C08 use and the trailing C07 release in the same tick, roughly 50ms apart, so on servers where the golden apple consumption completes at release - which is precisely the server model the 31-C03 burst is designed to force - the consume event lands within a few tens of milliseconds of the stamp, far under the 1280ms floor, and the check fires. On vanilla the burst cannot shorten the fixed 32-tick use window, no consume event fires, and the check stays silent; the honest split is that FastConsume catches the module exactly on the instant-gap servers it targets, and the C03 burst is what makes the eat 'instant' in the first place.

anticheat FastClick (window click rate, missed)

FastClick.java243 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.inventory;
16
17
import java.util.ArrayList;
18
import java.util.List;
19
20
import org.bukkit.Material;
21
import org.bukkit.entity.Player;
22
import org.bukkit.event.inventory.InventoryClickEvent;
23
import org.bukkit.event.inventory.InventoryType;
24
import org.bukkit.inventory.InventoryView;
25
import org.bukkit.inventory.ItemStack;
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.permissions.Permissions;
33
import fr.neatmonster.nocheatplus.players.IPlayerData;
34
import fr.neatmonster.nocheatplus.utilities.entity.InventoryUtil;
35
import fr.neatmonster.nocheatplus.utilities.StringUtil;
36
import fr.neatmonster.nocheatplus.utilities.TickTask;
37
38
39
/**
40
 * FastClick checks for players clicking in inventories too quickly (nerfs autosteal cheats and the like).
41
 */
42
public class FastClick extends Check {
43
44
45
    final List<String> tags = new ArrayList<String>();
46
47
48
    /**
49
     * Instantiates a new fast click check.
50
     */
51
    public FastClick() {
52
        super(CheckType.INVENTORY_FASTCLICK);
53
    }
54
55
56
   /**
57
    * Checks a player.
58
    * 
59
    * @param player
60
    * @param now Millisec
61
    * @param view
62
    * @param slot
63
    * @param cursor
64
    * @param clicked
65
    * @param isShiftClick
66
    * @param inventoryAction
67
    * @param data
68
    * @param cc 
69
    * @param pData
70
    * @return true, if successful
71
    */
72
    public boolean check(final Player player, final long now, 
73
                         final InventoryClickEvent event, final int slot, final ItemStack cursor, 
74
                         final ItemStack clicked, final boolean isShiftClick, 
75
                         final String inventoryAction, final InventoryData data, final InventoryConfig cc, 
76
                         final IPlayerData pData) {
77
78
        final float amount;
79
        final Material clickedMat = clicked == null ? Material.AIR : clicked.getType();
80
        final Material cursorMat;
81
        final int cursorAmount;
82
        boolean cancel = false;
83
        tags.clear();
84
85
        if (cursor != null) {
86
            cursorMat = cursor.getType();
87
            cursorAmount = Math.max(1, cursor.getAmount());
88
        }
89
        else {
90
            cursorMat = null;
91
            cursorAmount = 0;
92
        }
93
94
        if (inventoryAction != null) {
95
            amount = getAmountWithAction(event, slot, clicked, clickedMat, cursorMat, cursorAmount, isShiftClick, inventoryAction, data, cc);
96
        }
97
        else if (cursor != null) {
98
            // Detect shift-click features indirectly.
99
            amount = detectTweaks1_5(event, slot, clicked, clickedMat, cursorMat, cursorAmount, isShiftClick, data, cc);
100
        }
101
        else amount = 1f;
102
103
        if (isShiftClick && inventoryAction.equals("MOVE_TO_OTHER_INVENTORY") 
104
            && (cursorMat != null && cursorMat != Material.AIR) 
105
            && clickedMat != Material.AIR) {
106
            return false;
107
        }
108
        
109
        // Count clicks
110
        data.fastClickFreq.add(now, amount);
111
        
112
        // Shor-term VL
113
        float shortTerm = data.fastClickFreq.bucketScore(0);
114
        if (shortTerm > cc.fastClickShortTermLimit) {
115
            // Check for lag.
116
            shortTerm /= (float) TickTask.getLag(data.fastClickFreq.bucketDuration(), true);
117
        }
118
        shortTerm -= cc.fastClickShortTermLimit;
119
        
120
        // Normal VL
121
        float normal = data.fastClickFreq.score(1f);
122
        if (normal > cc.fastClickNormalLimit) {
123
            // Check for lag.
124
            normal /= (float) TickTask.getLag(data.fastClickFreq.bucketDuration() * data.fastClickFreq.numberOfBuckets(), true);
125
        }
126
        normal -= cc.fastClickNormalLimit;
127
        
128
        // Process Violations.
129
        final double violation = Math.max(shortTerm, normal);
130
        if (violation > 0.0) {
131
            tags.add("clickspeed");
132
            data.fastClickVL += violation;
133
            final ViolationData vd = new ViolationData(this, player, data.fastClickVL, violation, cc.fastClickActions);
134
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
135
            cancel = executeActions(vd).willCancel();
136
        }
137
        else data.fastClickVL *= 0.99;
138
139
        if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
140
            player.sendMessage("FastClick: " + data.fastClickFreq.bucketScore(0) + " | " + data.fastClickFreq.score(1f) + " | cursor=" + cursor 
141
                                + " | clicked=" + clicked + " | action=" + inventoryAction);
142
        }
143
        
144
        // Adjust data
145
        data.fastClickLastClicked = clickedMat;
146
        data.fastClickLastSlot = slot;
147
        data.fastClickLastCursor = cursorMat;
148
        data.fastClickLastCursorAmount = cursorAmount;
149
150
        // Lastly, always feed the improbable.
151
        if (cc.fastClickImprobableWeight > 0.0f) {
152
            Improbable.feed(player, cc.fastClickImprobableWeight * amount, now);
153
        }
154
        return cancel;
155
    }
156
    
157
158
   /**
159
    * Enforce sane timings for interacting with the container and clicking in it.
160
    * 
161
    * @param player
162
    * @param data
163
    * @param cc
164
    */
165
    public boolean checkContainerInteraction(final Player player, final InventoryData data, final InventoryConfig cc) {
166
        boolean cancel = false;
167
        tags.clear();
168
        if (InventoryUtil.isContainerInteractionRecent(player, cc.chestOpenLimit)) {
169
            // Interaction was too quick, violation.
170
            tags.add("interact_time");
171
            long duration = Math.max(data.lastClickTime - data.containerInteractTime, 20);
172
            double violation = (cc.chestOpenLimit / duration) * 100D; // Normalize.
173
            data.fastClickVL += violation;
174
            final ViolationData vd = new ViolationData(this, player, data.fastClickVL, violation, cc.fastClickActions);
175
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
176
            cancel = executeActions(vd).willCancel();  
177
        }
178
       return cancel;
179
    }
180
    
181
182
   /**
183
    * Detect the inventory tweaks that were introduced in MC 1.5
184
    * 
185
    * @param view
186
    * @param slot
187
    * @param clicked
188
    * @param clickedMat
189
    * @param cursorAmount
190
    * @param isShiftClick
191
    * @param data
192
    * @param cc
193
    */
194
    private float detectTweaks1_5(final InventoryClickEvent event, final int slot, final ItemStack clicked, 
195
                                  final Material clickedMat, final Material cursorMat, 
196
                                  final int cursorAmount, final boolean isShiftClick, 
197
                                  final InventoryData data, final InventoryConfig cc) {
198
199
        if (cursorMat != data.fastClickLastCursor 
200
            && (!isShiftClick || clickedMat == Material.AIR || clickedMat != data.fastClickLastClicked) 
201
            || cursorMat == Material.AIR || cursorAmount != data.fastClickLastCursorAmount) {
202
            return 1f;
203
        }
204
        else if (clickedMat == Material.AIR || clickedMat == cursorMat 
205
                || isShiftClick && clickedMat == data.fastClickLastClicked ) {
206
            return Math.min(cc.fastClickNormalLimit , cc.fastClickShortTermLimit) 
207
                    / (float) (isShiftClick && clickedMat != Material.AIR ? (1.0 + Math.max(cursorAmount, InventoryUtil.getStackCount(event, clicked))) : cursorAmount)  * 0.75f;
208
        }
209
        return 1f;
210
    }
211
212
213
    private float getAmountWithAction(final InventoryClickEvent event, final int slot, final ItemStack clicked, 
214
                                      final Material clickedMat, final Material cursorMat, 
215
                                      final int cursorAmount, final boolean isShiftClick, 
216
                                      final String inventoryAction, 
217
                                      final InventoryData data, final InventoryConfig cc) {
218
219
        // Continuous drop feature with open inventories.
220
        if (inventoryAction.equals("DROP_ONE_SLOT")
221
            && slot == data.fastClickLastSlot 
222
            && clickedMat == data.fastClickLastClicked
223
            && event.getInventory().getType() == InventoryType.CRAFTING
224
            // && InventoryUtil.couldHaveInventoryOpen(player)
225
            // TODO: Distinguish if the inventory is really open.
226
            ) {
227
            return 0.6f;
228
        }
229
230
        // Collect to cursor.
231
        if (inventoryAction.equals("COLLECT_TO_CURSOR")) {
232
            final int stackCount = InventoryUtil.getStackCount(event, clicked);
233
            return stackCount <= 0 ? 1f : Math.min(cc.fastClickNormalLimit , cc.fastClickShortTermLimit) / stackCount * 0.75f;
234
        }
235
236
        // Shift click features.
237
        if ((inventoryAction.equals("MOVE_TO_OTHER_INVENTORY")) && cursorMat != Material.AIR) {
238
            // Let the legacy method do the side condition checks and counting for now.
239
            return detectTweaks1_5(event, slot, clicked, clickedMat, cursorMat, cursorAmount, isShiftClick, data, cc);
240
        }
241
        return 1f;
242
    }
243
}

How it counteracts this module

NoCheatPlus FastClick counts C0E inventory clicks into an ActionFrequency with five 200ms buckets, comparing the newest bucket against the short-term limit of 4 and the one-second window against the normal limit of 15. Only window-click traffic feeds the ledger.\n\nAutoGap never sends C0E: slot selection is C09, the use is C08, and the burst is C03s, so FastClick's ledger never increments no matter how often the module eats. The check exists to stop click-spam inventory shuffles, and this implementation's hotbar-only design is invisible to it. The countering consequence is that NCP's inventory defense against AutoGap rests on the use-item adapters and the movement-rate checks that see the 31-packet C03 burst, not on the click-rate path; the burst's movement-packet rate is the fingerprint NCP's MorePackets family would measure.

← Back to Analysis Hub