LiquidSense Dev AutoSoup module 2 files, 171 lines

LiquidSense Dev AutoSoup: Full Source Analysis

AutoSoup is a health-gated mushroom-stew chugger that fires the entire eat ceremony from one UpdateEvent.

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

Published 2026-08-13 · Updated 2026-08-13

Analysis

Overview

AutoSoup is a health-gated mushroom-stew chugger that fires the entire eat ceremony from one UpdateEvent. While health is at or below the Health threshold (default 15) and a stew sits in the hotbar, the module queues C09(soup slot), C08(use item), C07 DROP_ITEM and C09(restore) in a single tick, then resets its MSTimer for the Delay interval (default 150ms, range 0-500). The DROP_ITEM with BlockPos.ORIGIN and DOWN facing is the bowl drop that instant-soup servers expect after the heal; a RELEASE_USE_ITEM is never sent. When the hotbar is empty and stew remains in the inventory, the module shift-clicks it into the hotbar with the same simulated open-inventory ceremony AutoPot uses: C16 OPEN_INVENTORY_ACHIEVEMENT, a window-0 C0E click, and C0D close.

Health gate and slot scan

The single onUpdate handler starts from a timer check: timer.hasTimePassed(delayValue) with delay defaulting to 150ms and reset() called after every successful action, so the cadence is a real 150ms-plus period rather than a one-shot latch. With health <= Health (default 15), InventoryUtils.findItem(36, 45, Items.mushroom_stew) locates the first stew in the hotbar container range. The tag property exposes the configured Health so the HUD shows the trigger value. Every packet is queued through mc.netHandler.addToSendQueue, so the four-packet ceremony lands in the order they are queued.

Same-tick eat ceremony

The hotbar path sends C09PacketHeldItemChange(soupInHotbar - 36), then C08PacketPlayerBlockPlacement with the stew stack read from inventoryContainer.getSlot(soupInHotbar).stack (the single-argument form, BlockPos.ORIGIN plus face 255), then C07PacketPlayerDigging with action DROP_ITEM at BlockPos.ORIGIN facing DOWN, then C09(currentItem) to restore the held slot. All four queue inside one event, so the server processes switch, use, drop and switch-back within a single tick. The DROP_ITEM is the bowl-drop idiom: on servers that complete consumption from the use packet, the empty bowl is pitched immediately. On a vanilla 32-tick use window the ceremony never completes the eat, so neither the heal nor the bowl materializes and the module is effectively silent there.

Refill path

With the hotbar empty and stew present in the inventory (findItem(9, 36)) plus a free hotbar slot (InventoryUtils.hasSpaceHotbar), the module refills. OpenInv on requires an actually open GuiInventory and returns otherwise; SimulateInventory on performs the fabricated open: C16 OPEN_INVENTORY_ACHIEVEMENT, then mc.playerController.windowClick(0, soupInInventory, 0, 1), the C0E mode-1 shift-click, then C0D close. The client never renders a GUI, so the window exists only in the server ledger, and the timer resets after the refill as well. Whether the fork's windowClick syncs the held slot with a C09 is unverifiable here because the snapshot ships no net/minecraft tree.

source AutoSoup.kt

AutoSoup.kt75 lines · JavaOriginal ↗
1
/*
2
 * LiquidBounce Hacked Client
3
 * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
4
 * https://github.com/CCBlueX/LiquidBounce/
5
 */
6
package net.ccbluex.liquidbounce.features.module.modules.combat
7
8
import net.ccbluex.liquidbounce.event.EventTarget
9
import net.ccbluex.liquidbounce.event.UpdateEvent
10
import net.ccbluex.liquidbounce.features.module.Module
11
import net.ccbluex.liquidbounce.features.module.ModuleCategory
12
import net.ccbluex.liquidbounce.features.module.ModuleInfo
13
import net.ccbluex.liquidbounce.utils.InventoryUtils
14
import net.ccbluex.liquidbounce.utils.timer.MSTimer
15
import net.ccbluex.liquidbounce.value.BoolValue
16
import net.ccbluex.liquidbounce.value.FloatValue
17
import net.ccbluex.liquidbounce.value.IntegerValue
18
import net.minecraft.client.gui.inventory.GuiInventory
19
import net.minecraft.init.Items
20
import net.minecraft.network.play.client.*
21
import net.minecraft.util.BlockPos
22
import net.minecraft.util.EnumFacing
23
24
@ModuleInfo(name = "AutoSoup", description = "Makes you automatically eat soup whenever your health is low.", category = ModuleCategory.COMBAT)
25
class AutoSoup : Module() {
26
27
    private val healthValue = FloatValue("Health", 15f, 0f, 20f)
28
    private val delayValue = IntegerValue("Delay", 150, 0, 500)
29
    private val openInventoryValue = BoolValue("OpenInv", false)
30
    private val simulateInventory = BoolValue("SimulateInventory", true)
31
32
    private val timer = MSTimer()
33
34
    override val tag: String
35
        get() = healthValue.get().toString()
36
37
    @EventTarget
38
    fun onUpdate(event: UpdateEvent?) {
39
        if (!timer.hasTimePassed(delayValue.get().toLong()))
40
            return
41
42
        val soupInHotbar = InventoryUtils.findItem(36, 45, Items.mushroom_stew)
43
        if (mc.thePlayer.health <= healthValue.get() && soupInHotbar != -1) {
44
            mc.netHandler.addToSendQueue(C09PacketHeldItemChange(soupInHotbar - 36))
45
            mc.netHandler.addToSendQueue(C08PacketPlayerBlockPlacement(mc.thePlayer.inventoryContainer
46
                    .getSlot(soupInHotbar).stack))
47
            mc.netHandler.addToSendQueue(C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM,
48
                    BlockPos.ORIGIN, EnumFacing.DOWN))
49
            mc.netHandler.addToSendQueue(C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem))
50
            timer.reset()
51
            return
52
        }
53
54
        val soupInInventory = InventoryUtils.findItem(9, 36, Items.mushroom_stew)
55
        if (soupInInventory != -1 && InventoryUtils.hasSpaceHotbar()) {
56
            if (openInventoryValue.get() && mc.currentScreen !is GuiInventory)
57
                return
58
59
            val openInventory = mc.currentScreen !is GuiInventory && simulateInventory.get()
60
61
            if (openInventory)
62
                mc.netHandler.addToSendQueue(
63
                        C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT))
64
65
            mc.playerController.windowClick(0, soupInInventory, 0, 1, mc.thePlayer)
66
67
            if (openInventory)
68
                mc.netHandler.addToSendQueue(C0DPacketCloseWindow())
69
70
            timer.reset()
71
        }
72
    }
73
74
75
}

What this file does

The whole module: the health and timer gates, the four-packet same-tick ceremony (C09, C08, C07 DROP_ITEM, C09), and the C16-C0E-C0D simulated refill. The brief pins C08 and C09; the C07 and the refill C0E are part of the same cycle and belong in the prose. There is no release path: C07 is always DROP_ITEM, never RELEASE_USE_ITEM.

source InventoryUtils.java (slot routing)

InventoryUtils.java96 lines · JavaOriginal ↗
1
/*
2
 * LiquidBounce Hacked Client
3
 * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
4
 * https://github.com/CCBlueX/LiquidBounce/
5
 */
6
package net.ccbluex.liquidbounce.utils;
7
8
import net.ccbluex.liquidbounce.event.ClickWindowEvent;
9
import net.ccbluex.liquidbounce.event.EventTarget;
10
import net.ccbluex.liquidbounce.event.Listenable;
11
import net.ccbluex.liquidbounce.event.PacketEvent;
12
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
13
import net.minecraft.block.Block;
14
import net.minecraft.init.Blocks;
15
import net.minecraft.item.Item;
16
import net.minecraft.item.ItemBlock;
17
import net.minecraft.item.ItemStack;
18
import net.minecraft.network.Packet;
19
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
20
21
import java.util.Arrays;
22
import java.util.List;
23
24
public final class InventoryUtils extends MinecraftInstance implements Listenable {
25
26
    public static final MSTimer CLICK_TIMER = new MSTimer();
27
    public static final List<Block> BLOCK_BLACKLIST = Arrays.asList(Blocks.enchanting_table, Blocks.chest, Blocks.ender_chest, Blocks.trapped_chest,
28
            Blocks.anvil, Blocks.sand, Blocks.web, Blocks.torch, Blocks.crafting_table, Blocks.furnace, Blocks.waterlily, Blocks.dispenser,
29
            Blocks.stone_pressure_plate, Blocks.wooden_pressure_plate, Blocks.noteblock, Blocks.dropper);
30
31
    public static int findItem(final int startSlot, final int endSlot, final Item item) {
32
        for(int i = startSlot; i < endSlot; i++) {
33
            final ItemStack stack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
34
35
            if(stack != null && stack.getItem() == item)
36
                return i;
37
        }
38
        return -1;
39
    }
40
41
    public static boolean hasSpaceHotbar() {
42
        for(int i = 36; i < 45; i++) {
43
            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
44
45
            if(itemStack == null)
46
                return true;
47
        }
48
        return false;
49
    }
50
51
    public static int findAutoBlockBlock() {
52
        for(int i = 36; i < 45; i++) {
53
            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
54
55
            if(itemStack != null && itemStack.getItem() instanceof ItemBlock) {
56
                final ItemBlock itemBlock = (ItemBlock) itemStack.getItem();
57
                final Block block = itemBlock.getBlock();
58
59
                if (block.isFullCube() && !BLOCK_BLACKLIST.contains(block))
60
                    return i;
61
            }
62
        }
63
64
        for(int i = 36; i < 45; i++) {
65
            final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
66
67
            if(itemStack != null && itemStack.getItem() instanceof ItemBlock) {
68
                final ItemBlock itemBlock = (ItemBlock) itemStack.getItem();
69
                final Block block = itemBlock.getBlock();
70
71
                if (!BLOCK_BLACKLIST.contains(block))
72
                    return i;
73
            }
74
        }
75
76
        return -1;
77
    }
78
79
    @EventTarget
80
    public void onClick(final ClickWindowEvent event) {
81
        CLICK_TIMER.reset();
82
    }
83
84
    @EventTarget
85
    public void onPacket(final PacketEvent event) {
86
        final Packet packet = event.getPacket();
87
88
        if (packet instanceof C08PacketPlayerBlockPlacement)
89
            CLICK_TIMER.reset();
90
    }
91
92
    @Override
93
    public boolean handleEvents() {
94
        return true;
95
    }
96
}

What this file does

findItem walks the container slot range and returns the first stack whose item matches, and hasSpaceHotbar decides whether the refill path is allowed at all; both decide which ceremony the module runs on a given tick. The same helpers drive AutoPot's refill, so the eat/refill routing of the two modules shares one code path.

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 eat restore)

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

The direct hit: the C08 use arms usedSomething through InteractItemEvent, and the restore C09 in the same tick lands with a gap of 0 under minSwitchTicks 1, so every eat cycle punishes. Unlike the Rise eaters that delay the switch-back one tick and stay ahead of the default window, this module restores the slot in the same event, which is exactly the pattern the check was written for.

anticheat InventoryActions (window-0 click with no window)

InventoryActions.java60 lines · Java
1
/*
2
 * This file is part of Hawk Anticheat.
3
 * Copyright (C) 2018 Hawk Development Team
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
package me.islandscout.hawk.check.interaction.inventory;
20
21
/*
22
 * InventoryActions check originally written by Havesta; modified, split apart, and implemented into Hawk by Islandscout
23
 *
24
 * InventoryActions checks if a player is
25
 * - interacting with entities/blocks while inventory is opened
26
 */
27
28
import me.islandscout.hawk.HawkPlayer;
29
import me.islandscout.hawk.check.CustomCheck;
30
import me.islandscout.hawk.event.*;
31
32
public class InventoryActions extends CustomCheck {
33
34
    public InventoryActions() {
35
        super("inventoryactions", true, 3, 5, 0.999, 5000, "%player% failed inventory-actions, VL: %vl%", null);
36
    }
37
38
    @Override
39
    protected void check(Event e) {
40
        HawkPlayer pp = e.getHawkPlayer();
41
42
        //player tried to interact with entities/world while an inventory window is open
43
        if(pp.hasInventoryOpen() != 0 && (e instanceof InteractEntityEvent || e instanceof BlockDigEvent ||
44
                e instanceof ArmSwingEvent || e instanceof InteractWorldEvent)) {
45
            punish(pp, true, e);
46
            e.resync();
47
            //TODO After failing several times, there's a chance that they could be legit, but the inventory state is glitched. Close the player's inventory.
48
        }
49
50
        //player tried to interact with inventory while it is closed
51
        else if(pp.hasInventoryOpen() == 0 && e instanceof ClickInventoryEvent) {
52
            //TODO also check that window ID makes sense with the window type (eg. ID 0 must mean hasInventoryOpen() == 0)
53
            punish(pp, true, e);
54
            e.resync();
55
        }
56
        else {
57
            reward(pp);
58
        }
59
    }
60
}

How it counteracts this module

The refill C0E is a ClickInventoryEvent while HawkPlayer.hasInventoryOpen() reads 0, because the C16 simulated open never sets Hawk's window ledger, so the check punishes and calls e.resync(), which undoes the local slot move. The hotbar eat path itself carries no C0E and evades this check; only the refill half of the cycle is exposed.

anticheat FastClick (window-click ledger)

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

The refill rate is one C0E per 150ms-plus cycle, far under the short-term buckets (ActionFrequency(5, 200L), limit 4) and the 15/s normal window, so the volume alone never trips it. The real weight is checkContainerInteraction scoring window-0 clicks that no container-open event precedes, plus the Improbable feed when fastClickImprobableWeight is configured; the eat ceremony itself is invisible to a click-ledger check.

anticheat FastConsume (instant-soup ledger)

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's InventoryListener stamps InventoryData.consumeTime on the edible right-click, and FastConsume compares it against the configured consume-time (default 1280ms) when the consume completes. On the instant-soup servers this module targets, the eat completes within a few milliseconds of the C08 and flags immediately; on a vanilla 32-tick server the one-tick ceremony never finishes the use, so the heal and the check both stay silent. The counter only bites exactly where the module works.

← Back to Analysis Hub