LiquidSense Dev InvMove module 2 files, 407 lines

LiquidSense Dev InvMove: Full Source Analysis

LiquidSense Dev's InvMove keeps the player moving while a screen is open by re-asserting the raw keyboard state into the movement keybinding pressed flags on every UpdateEvent.

net/ccbluex/liquidbounce/features/module/modules/movement/InventoryMove.kt · GitHub source ↗

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

Packets This Module Uses

Analysis

Overview

LiquidSense Dev's InvMove keeps the player moving while a screen is open by re-asserting the raw keyboard state into the movement keybinding pressed flags on every UpdateEvent. The handler excludes GuiChat and the pause menu outright, and the NoDetectable switch adds a second carve-out: when it is on, the current screen must not be a GuiContainer, so movement only survives on non-container screens. The AACAdditionPro switch is a display tag only and changes nothing in the handler, and the NoMoveClicks switch cancels every ClickWindowEvent while the player is moving so the forced walk cannot be paired with a GUI click. The wire fingerprint is the same as every inventory-move module: the C03 position stream keeps advancing while a server-side container is open.

Input-path bypass

The module never touches packet code. onUpdate fires once per tick and, when the screen guard passes, writes GameSettings.isKeyDown(keyBindForward) into keyBindForward.pressed for forward, back, right, left, jump and sprint. The vanilla input classes read those flags (MovementInputFromOptions calls getIsKeyPressed), so the player entity keeps producing movement input while a chest, furnace or inventory screen has focus. Because the write happens on the pre update event, the forced state is in place before the tick's movement is computed, and the C03 variant that tick carries nonzero position deltas. The NoDetectable carve-out inverts the guard: with the switch on, the handler only runs when the current screen is not a GuiContainer, which excludes exactly the container screens the inventory-move checks watch.

Click suppression and cleanup

NoMoveClicks is the anti-mistake companion: onClick cancels any ClickWindowEvent while MovementUtils.isMoving() reports forward or strafe input, so a player holding W cannot accidentally shift-click an item out of a moving inventory. onDisable releases every forced pressed flag, but only when the physical key is up or a screen is still open, so the cleanup cannot fight an active key press. The jump and sprint bindings are part of the forced set, which is what makes the module heavier than a walk-only InvMove: the server sees jumps and sprint transitions under an open window, not just horizontal drift.

Server-side view

Vanilla clients freeze in place under a screen because the GUI swallows the movement input. The module's forced flags make the server receive position-changing C03 packets, sprint-state C0B packets and movement for a player whose server-side window is still open, a contradiction the inventory-move checks validate. CheaterDeleter flags position changes under a live screen handler, Photon scores movement past a breaking-time leniency and any jump, Negativity scores distance and sprint and sneak transitions from Bukkit events, and Hawk flags rotation, sprint or sneak while an inventory is open.

source InventoryMove.kt

InventoryMove.kt63 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.movement
7
8
import net.ccbluex.liquidbounce.event.ClickWindowEvent
9
import net.ccbluex.liquidbounce.event.EventTarget
10
import net.ccbluex.liquidbounce.event.UpdateEvent
11
import net.ccbluex.liquidbounce.features.module.Module
12
import net.ccbluex.liquidbounce.features.module.ModuleCategory
13
import net.ccbluex.liquidbounce.features.module.ModuleInfo
14
import net.ccbluex.liquidbounce.utils.MovementUtils
15
import net.ccbluex.liquidbounce.value.BoolValue
16
import net.minecraft.client.gui.GuiChat
17
import net.minecraft.client.gui.GuiIngameMenu
18
import net.minecraft.client.gui.inventory.GuiContainer
19
import net.minecraft.client.settings.GameSettings
20
21
@ModuleInfo(name = "InvMove", description = "Allows you to walk while an inventory is opened.", category = ModuleCategory.MOVEMENT)
22
class InventoryMove : Module() {
23
24
    private val noDetectableValue = BoolValue("NoDetectable", false)
25
    val aacAdditionProValue = BoolValue("AACAdditionPro", false)
26
    private val noMoveClicksValue = BoolValue("NoMoveClicks", false)
27
28
    @EventTarget
29
    fun onUpdate(event: UpdateEvent) {
30
        if (mc.currentScreen !is GuiChat && mc.currentScreen !is GuiIngameMenu && (!noDetectableValue.get() || mc.currentScreen !is GuiContainer)) {
31
            mc.gameSettings.keyBindForward.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindForward)
32
            mc.gameSettings.keyBindBack.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindBack)
33
            mc.gameSettings.keyBindRight.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindRight)
34
            mc.gameSettings.keyBindLeft.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindLeft)
35
            mc.gameSettings.keyBindJump.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindJump)
36
            mc.gameSettings.keyBindSprint.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindSprint)
37
        }
38
    }
39
40
    @EventTarget
41
    fun onClick(event: ClickWindowEvent) {
42
        if (noMoveClicksValue.get() && MovementUtils.isMoving())
43
            event.cancelEvent()
44
    }
45
46
    override fun onDisable() {
47
        if (!GameSettings.isKeyDown(mc.gameSettings.keyBindForward) || mc.currentScreen != null)
48
            mc.gameSettings.keyBindForward.pressed = false
49
        if (!GameSettings.isKeyDown(mc.gameSettings.keyBindBack) || mc.currentScreen != null)
50
            mc.gameSettings.keyBindBack.pressed = false
51
        if (!GameSettings.isKeyDown(mc.gameSettings.keyBindRight) || mc.currentScreen != null)
52
            mc.gameSettings.keyBindRight.pressed = false
53
        if (!GameSettings.isKeyDown(mc.gameSettings.keyBindLeft) || mc.currentScreen != null)
54
            mc.gameSettings.keyBindLeft.pressed = false
55
        if (!GameSettings.isKeyDown(mc.gameSettings.keyBindJump) || mc.currentScreen != null)
56
            mc.gameSettings.keyBindJump.pressed = false
57
        if (!GameSettings.isKeyDown(mc.gameSettings.keyBindSprint) || mc.currentScreen != null)
58
            mc.gameSettings.keyBindSprint.pressed = false
59
    }
60
61
    override val tag: String?
62
        get() = if (aacAdditionProValue.get()) "AACAdditionPro" else null
63
}

What this file does

The module is a single UpdateEvent handler plus one ClickWindowEvent guard and a cleanup routine. The screen condition combines three checks: the current screen must not be GuiChat, must not be GuiIngameMenu, and when NoDetectable is enabled must not be a GuiContainer. When it passes, the six movement keybindings are re-asserted from GameSettings.isKeyDown, which polls the physical keyboard directly and bypasses the GUI input path entirely. The NoMoveClicks handler then cancels window clicks while movement input is present, and onDisable only clears the forced flags when the key is released or a screen remains open. The tag getter is the AACAdditionPro switch's only effect: it appends the AACAdditionPro label to the module name in the module list.

source MovementUtils.java (movement predicates)

MovementUtils.java344 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.MoveEvent;
9
import net.minecraft.block.Block;
10
import net.minecraft.block.BlockAir;
11
import net.minecraft.block.BlockLiquid;
12
import net.minecraft.block.material.Material;
13
import net.minecraft.client.Minecraft;
14
import net.minecraft.client.entity.EntityPlayerSP;
15
import net.minecraft.client.multiplayer.WorldClient;
16
import net.minecraft.entity.Entity;
17
import net.minecraft.potion.Potion;
18
import net.minecraft.potion.PotionEffect;
19
import net.minecraft.util.AxisAlignedBB;
20
import net.minecraft.util.BlockPos;
21
import net.minecraft.util.MathHelper;
22
23
public final class MovementUtils extends MinecraftInstance {
24
25
    public static float getSpeed() {
26
        return (float) Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ);
27
    }
28
29
    public static float getMaxFallDist() {
30
        PotionEffect potioneffect = mc.thePlayer.getActivePotionEffect(Potion.jump);
31
        int f2 = potioneffect != null ? potioneffect.getAmplifier() + 1 : 0;
32
        return mc.thePlayer.getMaxFallHeight() + f2;
33
        //  int f = potioneffect != null ? potioneffect.getAmplifier() + 1 : 0;
34
        //return mc.thePlayer.getMaxFallHeight() + f;
35
    }
36
37
    public static int LongJumpEffect() {
38
        if (mc.thePlayer.isPotionActive(Potion.jump))
39
            return mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1;
40
        else
41
            return 0;
42
    }
43
44
    public static double LongJumpMoveSpeed() {
45
        double baseSpeed = 0.2873;
46
        if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) {
47
            int amplifier = mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier();
48
            baseSpeed *= 1.0 + 0.2 * (amplifier + 1);
49
        }
50
        return baseSpeed;
51
    }
52
53
    public static void setMoveSpeed(final MoveEvent event, final double speed) {
54
        double forward = mc.thePlayer.moveForward;
55
        double strafe = mc.thePlayer.moveStrafing;
56
        float yaw = mc.thePlayer.rotationYaw;
57
        if (forward == 0.0 && strafe == 0.0) {
58
            event.setX(0.0);
59
            event.setZ(0.0);
60
        } else {
61
            if (forward != 0.0) {
62
                if (strafe > 0.0) {
63
                    yaw += ((forward > 0.0) ? -45 : 45);
64
                } else if (strafe < 0.0) {
65
                    yaw += ((forward > 0.0) ? 45 : -45);
66
                }
67
                strafe = 0.0;
68
                if (forward > 0.0) {
69
                    forward = 1.0;
70
                } else if (forward < 0.0) {
71
                    forward = -1.0;
72
                }
73
            }
74
            event.setX(forward * speed * Math.cos(Math.toRadians(yaw + 90.0f))
75
                    + strafe * speed * Math.sin(Math.toRadians(yaw + 90.0f)));
76
            event.setZ(forward * speed * Math.sin(Math.toRadians(yaw + 90.0f))
77
                    - strafe * speed * Math.cos(Math.toRadians(yaw + 90.0f)));
78
        }
79
    }
80
81
    public static void setSpeed(final MoveEvent moveEvent, final double moveSpeed) {
82
        setSpeed(moveEvent, moveSpeed, mc.thePlayer.rotationYaw, mc.thePlayer.movementInput.moveStrafe, mc.thePlayer.movementInput.moveForward);
83
    }
84
    public static boolean isBlockUnder() {
85
        EntityPlayerSP player = mc.thePlayer;
86
        WorldClient world = mc.theWorld;
87
        AxisAlignedBB pBb = player.getEntityBoundingBox();
88
        double height = player.posY + (double) player.getEyeHeight();
89
        int offset = 0;
90
        while ((double) offset < height) {
91
            if (!world.getCollidingBoundingBoxes(player, pBb.offset(0.0, -offset, 0.0)).isEmpty()) {
92
                return true;
93
            }
94
            offset += 2;
95
        }
96
        return false;
97
    }
98
    public static void setSpeed(final MoveEvent moveEvent, final double moveSpeed, final float pseudoYaw, final double pseudoStrafe, final double pseudoForward) {
99
        double forward = pseudoForward;
100
        double strafe = pseudoStrafe;
101
        float yaw = pseudoYaw;
102
        if (forward != 0.0) {
103
            if (strafe > 0.0) {
104
                yaw += ((forward > 0.0) ? -45 : 45);
105
            }
106
            else if (strafe < 0.0) {
107
                yaw += ((forward > 0.0) ? 45 : -45);
108
            }
109
            strafe = 0.0;
110
            if (forward > 0.0) {
111
                forward = 1.0;
112
            }
113
            else if (forward < 0.0) {
114
                forward = -1.0;
115
            }
116
        }
117
        if (strafe > 0.0) {
118
            strafe = 1.0;
119
        }
120
        else if (strafe < 0.0) {
121
            strafe = -1.0;
122
        }
123
        final double mx = Math.cos(Math.toRadians(yaw + 90.0f));
124
        final double mz = Math.sin(Math.toRadians(yaw + 90.0f));
125
        moveEvent.setX(forward * moveSpeed * mx + strafe * moveSpeed * mz);
126
        moveEvent.setZ(forward * moveSpeed * mz - strafe * moveSpeed * mx);
127
    }
128
129
    public static float getDistanceToGround(Entity e) {
130
        if (mc.thePlayer.isCollidedVertically && mc.thePlayer.onGround) {
131
            return 0.0F;
132
        }
133
        for (float a = (float) e.posY; a > 0.0F; a -= 1.0F) {
134
            int[] stairs = { 53, 67, 108, 109, 114, 128, 134, 135, 136, 156, 163, 164, 180 };
135
            int[] exemptIds = { 6, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 63, 65, 66, 68, 69, 70, 72, 75,
136
                    76, 77, 83, 92, 93, 94, 104, 105, 106, 115, 119, 131, 132, 143, 147, 148, 149, 150, 157, 171, 175,
137
                    176, 177 };
138
            Block block = mc.theWorld.getBlockState(new BlockPos(e.posX, a - 1.0F, e.posZ)).getBlock();
139
            if (!(block instanceof BlockAir)) {
140
                if ((Block.getIdFromBlock(block) == 44) || (Block.getIdFromBlock(block) == 126)) {
141
                    return (float) (e.posY - a - 0.5D) < 0.0F ? 0.0F : (float) (e.posY - a - 0.5D);
142
                }
143
                int[] arrayOfInt1;
144
                int j = (arrayOfInt1 = stairs).length;
145
                for (int i = 0; i < j; i++) {
146
                    int id = arrayOfInt1[i];
147
                    if (Block.getIdFromBlock(block) == id) {
148
                        return (float) (e.posY - a - 1.0D) < 0.0F ? 0.0F : (float) (e.posY - a - 1.0D);
149
                    }
150
                }
151
                j = (arrayOfInt1 = exemptIds).length;
152
                for (int i = 0; i < j; i++) {
153
                    int id = arrayOfInt1[i];
154
                    if (Block.getIdFromBlock(block) == id) {
155
                        return (float) (e.posY - a) < 0.0F ? 0.0F : (float) (e.posY - a);
156
                    }
157
                }
158
                return (float) (e.posY - a + block.getBlockBoundsMaxY() - 1.0D);
159
            }
160
        }
161
        return 0.0F;
162
    }
163
164
    public static double getBaseMoveSpeed() {
165
        double baseSpeed = 0.2873;
166
        if (mc.thePlayer.isPotionActive(Potion.moveSpeed))
167
            baseSpeed *= 1.0 + 0.2 * (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1);
168
        return baseSpeed;
169
    }
170
171
    public static int getSpeedEffect() {
172
        return Minecraft.getMinecraft().thePlayer.isPotionActive(Potion.moveSpeed)?Minecraft.getMinecraft().thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1:0;
173
    }
174
175
    public static int getJumpEffect() {
176
        return Minecraft.getMinecraft().thePlayer.isPotionActive(Potion.jump)?Minecraft.getMinecraft().thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1:0;
177
    }
178
179
180
    public static boolean isInLiquid() {
181
        if(Minecraft.getMinecraft().thePlayer.isInWater()) {
182
            return true;
183
        } else {
184
            boolean inLiquid = false;
185
            int y = (int)Minecraft.getMinecraft().thePlayer.getEntityBoundingBox().minY;
186
187
            for(int x = MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.getEntityBoundingBox().minX); x < MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.getEntityBoundingBox().maxX) + 1; ++x) {
188
                for(int z = MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.getEntityBoundingBox().minZ); z < MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.getEntityBoundingBox().maxZ) + 1; ++z) {
189
                    Block block = Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(x, y, z)).getBlock();
190
                    if(block != null && block.getMaterial() != Material.air) {
191
                        if(!(block instanceof BlockLiquid)) {
192
                            return false;
193
                        }
194
195
                        inLiquid = true;
196
                    }
197
                }
198
            }
199
200
            return inLiquid;
201
        }
202
    }
203
204
    public static void SpeedSetMotion(double speed) {
205
        double forward = mc.thePlayer.movementInput.moveForward;
206
        double strafe = mc.thePlayer.movementInput.moveStrafe;
207
        float yaw = mc.thePlayer.rotationYaw;
208
        if ((forward == 0.0D) && (strafe == 0.0D)) {
209
            mc.thePlayer.motionX = 0;
210
            mc.thePlayer.motionZ = 0;
211
        } else {
212
            if (forward != 0.0D) {
213
                if (strafe > 0.0D) {
214
                    yaw += (forward > 0.0D ? -45 : 45);
215
                } else if (strafe < 0.0D) {
216
                    yaw += (forward > 0.0D ? 45 : -45);
217
                }
218
                strafe = 0.0D;
219
                if (forward > 0.0D) {
220
                    forward = 1;
221
                } else if (forward < 0.0D) {
222
                    forward = -1;
223
                }
224
            }
225
            mc.thePlayer.motionX = forward * speed * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * speed * Math.sin(Math.toRadians(yaw + 90.0F));
226
            mc.thePlayer.motionZ = forward * speed * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * speed * Math.cos(Math.toRadians(yaw + 90.0F));
227
        }
228
    }
229
230
    public static void setMotion(MoveEvent event, double speed, double motion) {
231
        double forward = mc.thePlayer.movementInput.moveForward;
232
        double strafe = mc.thePlayer.movementInput.moveStrafe;
233
        double yaw = mc.thePlayer.rotationYaw;
234
        if ((forward == 0.0) && (strafe == 0.0)) {
235
            event.setX(0.0);
236
            event.setZ(0.0);
237
        } else {
238
            if (forward != 0.0) {
239
                if (strafe > 0.0) {
240
                    yaw += (forward > 0.0 ? -45 : 45);
241
                } else if (strafe < 0.0) {
242
                    yaw += (forward > 0.0 ? 45 : -45);
243
                }
244
                strafe = 0.0;
245
                if (forward > 0.0) {
246
                    forward = 1.0;
247
                } else if (forward < 0.0) {
248
                    forward = -1.0;
249
                }
250
            }
251
            double cos = Math.cos(Math.toRadians(yaw + 90.0f));
252
            double sin = Math.sin(Math.toRadians(yaw + 90.0f));
253
            event.setX(( forward * speed * cos + strafe * speed * sin) * motion);
254
            event.setZ(( forward * speed * sin - strafe * speed * cos) * motion);
255
        }
256
    }
257
258
    public static double getJumpBoostModifier(double baseJumpHeight, boolean potionJumpHeight) {
259
        if (mc.thePlayer.isPotionActive(Potion.jump) && potionJumpHeight) {
260
            int amplifier = mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier();
261
            baseJumpHeight += ((float)(amplifier + 1) * 0.1f);
262
263
        }
264
        return baseJumpHeight;
265
    }
266
267
    public static void setMotion(MoveEvent e, double speed) {
268
        double forward = mc.thePlayer.movementInput.moveForward;
269
        double strafe = mc.thePlayer.movementInput.moveStrafe;
270
        double yaw = mc.thePlayer.rotationYaw;
271
        if ((forward == 0.0D) && (strafe == 0.0D)) {
272
            mc.thePlayer.motionX = 0;
273
            mc.thePlayer.motionZ = 0;
274
        } else {
275
            if (forward != 0.0D) {
276
                if (strafe > 0.0D) {
277
                    yaw += (forward > 0.0D ? -45 : 45);
278
                } else if (strafe < 0.0D) {
279
                    yaw += (forward > 0.0D ? 45 : -45);
280
                }
281
                strafe = 0.0D;
282
                if (forward > 0.0D) {
283
                    forward = 1;
284
                } else if (forward < 0.0D) {
285
                    forward = -1;
286
                }
287
            }
288
            e.setX( forward * speed * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * speed * Math.sin(Math.toRadians(yaw + 90.0F)));
289
            e.setZ( forward * speed * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * speed * Math.cos(Math.toRadians(yaw + 90.0F)));
290
        }
291
    }
292
    public static void strafe() {
293
        strafe(getSpeed());
294
    }
295
    public static boolean isOnGround(double height) {
296
        if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(0.0D, -height, 0.0D)).isEmpty()) {
297
            return true;
298
        } else {
299
            return false;
300
        }
301
    }
302
    public static boolean isMoving() {
303
        return mc.thePlayer != null && (mc.thePlayer.movementInput.moveForward != 0F || mc.thePlayer.movementInput.moveStrafe != 0F);
304
    }
305
306
    public static boolean hasMotion() {
307
        return mc.thePlayer.motionX != 0D && mc.thePlayer.motionZ != 0D && mc.thePlayer.motionY != 0D;
308
    }
309
310
    public static void strafe(final float speed) {
311
        if(!isMoving())
312
            return;
313
314
        final double yaw = getDirection();
315
        mc.thePlayer.motionX = -Math.sin(yaw) * speed;
316
        mc.thePlayer.motionZ = Math.cos(yaw) * speed;
317
    }
318
319
    public static void forward(final double length) {
320
        final double yaw = Math.toRadians(mc.thePlayer.rotationYaw);
321
        mc.thePlayer.setPosition(mc.thePlayer.posX + (-Math.sin(yaw) * length), mc.thePlayer.posY, mc.thePlayer.posZ + (Math.cos(yaw) * length));
322
    }
323
324
    public static double getDirection() {
325
        float rotationYaw = mc.thePlayer.rotationYaw;
326
327
        if(mc.thePlayer.moveForward < 0F)
328
            rotationYaw += 180F;
329
330
        float forward = 1F;
331
        if(mc.thePlayer.moveForward < 0F)
332
            forward = -0.5F;
333
        else if(mc.thePlayer.moveForward > 0F)
334
            forward = 0.5F;
335
336
        if(mc.thePlayer.moveStrafing > 0F)
337
            rotationYaw -= 90F * forward;
338
339
        if(mc.thePlayer.moveStrafing < 0F)
340
            rotationYaw += 90F * forward;
341
342
        return Math.toRadians(rotationYaw);
343
    }
344
}

What this file does

The module's only util dependency. isMoving() (line 302) reads movementInput.moveForward and moveStrafe and gates the NoMoveClicks cancellation, so a click is only cancelled while real walk input is present. The class also carries the isOnGround and isInLiquid predicates used across the LiquidSense Dev movement modules; for this module only the isMoving check matters. The file lives under net/ccbluex/liquidbounce/utils with a .java extension while the module itself is Kotlin, a mix that is normal for this snapshot.

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 InventoryMoveCheck (position change under a screen handler)

InventoryMoveCheck.java106 lines · Java
1
package io.github.coolmineman.cheaterdeleter.modules.movement;
2
3
import io.github.coolmineman.cheaterdeleter.events.PlayerMovementListener;
4
import io.github.coolmineman.cheaterdeleter.events.PacketCallback;
5
import io.github.coolmineman.cheaterdeleter.events.PlayerDamageListener;
6
import io.github.coolmineman.cheaterdeleter.modules.CDModule;
7
import io.github.coolmineman.cheaterdeleter.objects.PlayerMoveC2SPacketView;
8
import io.github.coolmineman.cheaterdeleter.objects.entity.CDPlayer;
9
import io.github.coolmineman.cheaterdeleter.util.BlockCollisionUtil;
10
import net.minecraft.entity.damage.DamageSource;
11
import net.minecraft.network.Packet;
12
import net.minecraft.network.listener.ServerPlayPacketListener;
13
import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket;
14
import net.minecraft.util.ActionResult;
15
16
public class InventoryMoveCheck extends CDModule
17
        implements PlayerMovementListener, PacketCallback, PlayerDamageListener {
18
    public InventoryMoveCheck() {
19
        super("inventorymove_check");
20
        PlayerMovementListener.EVENT.register(this);
21
        PacketCallback.EVENT.register(this);
22
        PlayerDamageListener.EVENT.register(this);
23
    }
24
25
    @Override
26
    public long getFlagCoolDownMs() {
27
        return 100;
28
    }
29
30
    @Override
31
    public void onMovement(CDPlayer player, PlayerMoveC2SPacketView packet, MoveCause cause) {
32
        if (
33
            !enabledFor(player) ||
34
            player.isFallFlying() ||
35
            player.isSpectator() ||
36
            BlockCollisionUtil.isNearby(player, 2, 4, BlockCollisionUtil.NON_SOLID_COLLISION)
37
        ) {
38
            return;
39
        }
40
        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);
41
        if (packet.isChangePosition() && player.getCurrentScreenHandler() != null) {
42
            if (!data.wasOpen) {
43
                data.wasOpen = true;
44
                data.openTime = System.currentTimeMillis();
45
            }
46
            if (invalidateMove(player, packet)) {
47
                flag(player, FlagSeverity.MINOR, "Inventory Move");
48
            }
49
        } else if (player.getCurrentScreenHandler() == null) {
50
            data.lastDeltaX = Double.MAX_VALUE;
51
            data.lastDeltaZ = Double.MAX_VALUE;
52
            data.wasOpen = false;
53
        }
54
    }
55
56
    private boolean invalidateMove(CDPlayer player, PlayerMoveC2SPacketView packet) {
57
        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);
58
        if (System.currentTimeMillis() - data.openTime < 500)
59
            return false;
60
        if (player.getVelocity().getY() < 0.0 && packet.getY() > player.getPacketY())
61
            return true;
62
        double delaX = Math.abs(packet.getX() - player.getPacketX());
63
        double delaZ = Math.abs(packet.getZ() - player.getPacketZ());
64
        if (player.getVelocity().getX() == 0.0 && delaX > 0.0 && delaX > data.lastDeltaX)
65
            return true;
66
        if (player.getVelocity().getX() != 0.0) {
67
            data.lastDeltaX = Double.MAX_VALUE;
68
        } else {
69
            data.lastDeltaX = delaX;
70
        }
71
        if (player.getVelocity().getZ() == 0.0 && delaZ > 0.0 && delaZ > data.lastDeltaZ)
72
            return true;
73
        if (player.getVelocity().getZ() != 0.0) {
74
            data.lastDeltaZ = Double.MAX_VALUE;
75
        } else {
76
            data.lastDeltaZ = delaZ;
77
        }
78
        return false;
79
    }
80
81
    public static class InventoryMoveCheckData {
82
        volatile double lastDeltaX = Double.MAX_VALUE;
83
        volatile double lastDeltaZ = Double.MAX_VALUE;
84
        volatile boolean wasOpen = false;
85
        volatile long openTime = 0;
86
    }
87
88
    @Override
89
    public ActionResult onPacket(CDPlayer player, Packet<ServerPlayPacketListener> packet) {
90
        if (packet instanceof CloseHandledScreenC2SPacket) {
91
            InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class,
92
                    InventoryMoveCheckData::new);
93
            data.wasOpen = false;
94
        }
95
        return ActionResult.PASS;
96
    }
97
98
    @Override
99
    public void onPlayerDamage(CDPlayer player, DamageSource source, float amount) {
100
        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);
101
        data.lastDeltaX = Double.MAX_VALUE;
102
        data.lastDeltaZ = Double.MAX_VALUE;
103
        data.openTime = System.currentTimeMillis() + 1000;
104
    }
105
    
106
}

How it counteracts this module

CheaterDeleter's check runs on every serverbound move through PlayerMovementListener.onMovement and keys on the exact module signature: packet.isChangePosition() while player.getCurrentScreenHandler() != null (lines 41-48). After a 500ms grace from the moment the screen opened (lines 58-59), invalidateMove flags when a horizontal delta grows while the server-side velocity on that axis is zero (lines 62-77), which is precisely what forced keybind input produces. The flag is MINOR severity with a 100ms cooldown, and the data resets on window close and on damage (onPlayerDamage extends the grace by 1000ms, lines 99-104). The module's sustained WASD movement past the grace drives deltas that grow against zero server velocity, so the check flags on steady use. Movement that rides server-applied velocity (knockback, a moving platform) or movement confined to the first 500ms after opening does not trip it, and the check skips players near non-solid collision and in spectator.

anticheat InventoryMove (movement and jump under an open inventory)

InventoryMove.java190 lines · Java
1
package de.photon.anticheataddition.modules.checks.inventory;
2
3
import de.photon.anticheataddition.AntiCheatAddition;
4
import de.photon.anticheataddition.modules.ViolationModule;
5
import de.photon.anticheataddition.user.User;
6
import de.photon.anticheataddition.user.data.TimeKey;
7
import de.photon.anticheataddition.util.datastructure.SetUtil;
8
import de.photon.anticheataddition.util.log.Log;
9
import de.photon.anticheataddition.util.mathematics.TimeUtil;
10
import de.photon.anticheataddition.util.minecraft.ping.PingProvider;
11
import de.photon.anticheataddition.util.minecraft.world.WorldUtil;
12
import de.photon.anticheataddition.util.minecraft.world.entity.EntityUtil;
13
import de.photon.anticheataddition.util.minecraft.world.entity.InternalPotion;
14
import de.photon.anticheataddition.util.minecraft.world.material.MaterialUtil;
15
import de.photon.anticheataddition.util.violationlevels.Flag;
16
import de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;
17
import de.photon.anticheataddition.util.violationlevels.ViolationManagement;
18
import org.bukkit.Bukkit;
19
import org.bukkit.Location;
20
import org.bukkit.Material;
21
import org.bukkit.block.Block;
22
import org.bukkit.block.BlockFace;
23
import org.bukkit.event.EventHandler;
24
import org.bukkit.event.EventPriority;
25
import org.bukkit.event.Listener;
26
import org.bukkit.event.player.PlayerMoveEvent;
27
import org.bukkit.event.player.PlayerTeleportEvent;
28
import org.bukkit.potion.PotionEffect;
29
30
import java.util.Set;
31
import java.util.stream.Stream;
32
33
public final class InventoryMove extends ViolationModule implements Listener
34
{
35
    // 300 is the vanilla breaking time without a speed effect (derived from testing, especially slab jumping)
36
    public static final long BASE_BREAKING_TIME = 300L;
37
38
39
    // The materials below a player that allow a player to jump while having an open inventory.
40
    private static final Set<Material> JUMP_ENABLING_MATERIALS = Stream.of(MaterialUtil.INSTANCE.getAutoStepMaterials(),
41
                                                                           MaterialUtil.INSTANCE.getBounceMaterials())
42
                                                                       .flatMap(Set::stream)
43
                                                                       .collect(SetUtil.toImmutableEnumSet());
44
45
    public static final InventoryMove INSTANCE = new InventoryMove();
46
    public static final double STANDING_STILL_THRESHOLD = 0.005;
47
    private final int cancelVl = loadInt(".cancel_vl", 60);
48
    private final boolean extremePingLeniency = loadBoolean(".extreme_ping_leniency", false);
49
50
    private InventoryMove()
51
    {
52
        super("Inventory.parts.Move");
53
    }
54
55
    private static void cancelAction(User user, PlayerMoveEvent event)
56
    {
57
        // Not many blocks moved to prevent exploits and world change problems.
58
        if (WorldUtil.INSTANCE.inSameWorld(event.getFrom(), event.getTo()) && event.getFrom().distanceSquared(event.getTo()) < 4) {
59
            // Teleport back the next tick.
60
            Bukkit.getScheduler().runTask(AntiCheatAddition.getInstance(), () -> user.getPlayer().teleport(event.getFrom(), PlayerTeleportEvent.TeleportCause.UNKNOWN));
61
        }
62
    }
63
64
    private static long breakingTime(User user)
65
    {
66
        return BASE_BREAKING_TIME + InternalPotion.SPEED.getPotionEffect(user.getPlayer())
67
                                                        .map(PotionEffect::getAmplifier)
68
                                                        // If a speed effect exists calculate the speed millis, otherwise the speedMillis are 0.
69
                                                        .map(amplifier -> TimeUtil.toMillis(Math.max(100, amplifier + 1)))
70
                                                        .orElse(0L);
71
    }
72
73
    @EventHandler(priority = EventPriority.LOWEST)
74
    public void onPlayerMove(PlayerMoveEvent event)
75
    {
76
        final var user = User.getUser(event.getPlayer());
77
        if (User.isUserInvalid(user, this) || event.getTo() == null ||
78
            // Check that the player has actually moved.
79
            // Do this here to prevent bypasses with setting allowedToJump to true
80
            event.getTo().distanceSquared(event.getFrom()) <= STANDING_STILL_THRESHOLD) return;
81
82
        // Not inside a vehicle
83
        if (user.getPlayer().isInsideVehicle() ||
84
            // Not flying (vanilla or elytra) as it may trigger some fps
85
            user.getPlayer().isFlying() ||
86
            EntityUtil.INSTANCE.isFlyingWithElytra(user.getPlayer()) ||
87
            // Player must not be in an inventory
88
            !user.hasOpenInventory() ||
89
            // After being hit a player moves due to knock-back, so recent hits can cause false positives.
90
            user.getPlayer().getNoDamageTicks() != 0 ||
91
            // Recent teleports can cause bugs
92
            Inventory.teleportOrWorldChangeBypassed(user) ||
93
            // The player is currently not in a liquid (liquids push)
94
            // This would need to check for async chunk loads if done in packets (see history)
95
            user.isInLiquids() ||
96
            // Auto-Disable if TPS are too low
97
            !Inventory.hasMinTPS()) {
98
            user.getData().bool.allowedToJump = true;
99
            return;
100
        }
101
102
        final boolean movingUpwards = event.getFrom().getY() < event.getTo().getY();
103
        final boolean noYMovement = event.getFrom().getY() == event.getTo().getY();
104
105
        // Player accelerated upwards.
106
        if (movingUpwards && !user.getData().bool.movingUpwards) {
107
            handleJump(user, event);
108
            return;
109
        }
110
111
        final double yMovement = event.getPlayer().getVelocity().getY();
112
113
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " checking for falling: " + user.getTimeMap().at(TimeKey.VELOCITY_CHANGE_NO_EXTERNAL_CAUSES).passedTime() + " | y-velocity: " + yMovement);
114
115
        // This bypasses players during a long fall from hundreds of blocks.
116
        if (yMovement < -2.0 ||
117
            // Bypass a falling player after a normal jump in which they opened an inventory.
118
            // If the y-movement is 0, the falling process is finished and there is no need for bypassing anymore.
119
            (user.hasJumpedRecently(1850) && !noYMovement)) {
120
            user.getTimeMap().at(TimeKey.INVENTORY_MOVE_JUMP_END).update();
121
            return;
122
        }
123
124
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " is not fall-bypassed with y-movement: " + yMovement);
125
126
        final long leniency = extremePingLeniency ? Math.min(PingProvider.INSTANCE.getPing(user.getPlayer()) / 2, 500) : 0;
127
        final long totalBreakingTime = breakingTime(user) + leniency;
128
129
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " breaking time: " + totalBreakingTime + " (leniency: " + leniency + ")" +
130
                        " | inventory open passed time: " + user.getTimeMap().at(TimeKey.INVENTORY_OPENED).passedTime() +
131
                        " | jump end passed time: " + user.getTimeMap().at(TimeKey.INVENTORY_MOVE_JUMP_END).passedTime());
132
133
        // The breaking is no longer affecting the user as they have opened their inventory long enough ago.
134
        if (user.notRecentlyOpenedInventory(totalBreakingTime) &&
135
            // If the player jumped, we need to check the breaking time after the jump ended.
136
            user.getTimeMap().at(TimeKey.INVENTORY_MOVE_JUMP_END).notRecentlyUpdated(totalBreakingTime) &&
137
            // Do the entity pushing stuff here (performance impact)
138
            // No nearby entities that could push the player
139
            WorldUtil.INSTANCE.getLivingEntitiesAroundEntity(user.getPlayer(), user.getHitboxLocation().hitbox(), 0.1D).isEmpty()) {
140
            getManagement().flag(Flag.of(user)
141
                                     .setAddedVl(5)
142
                                     .setCancelAction(cancelVl, () -> cancelAction(user, event))
143
                                     .setDebug(() -> "Inventory-Debug | Player: " + user.getPlayer().getName() + " moved while having an open inventory."));
144
        }
145
    }
146
147
    private void handleJump(User user, PlayerMoveEvent event)
148
    {
149
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " detected a jump.");
150
151
        // A player is only allowed to jump once.
152
        if (user.getData().bool.allowedToJump) {
153
            user.getData().bool.allowedToJump = false;
154
            return;
155
        }
156
157
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " is not jump-bypassed.");
158
159
        // Bouncing can lead to false positives.
160
        if (playerCanJumpDueToGroundMaterial(event.getFrom())) return;
161
162
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " no jump enabling materials detected.");
163
164
        getManagement().flag(Flag.of(user)
165
                                 .setAddedVl(25)
166
                                 .setCancelAction(cancelVl, () -> cancelAction(user, event))
167
                                 .setDebug(() -> "Inventory-Debug | Player: " + user.getPlayer().getName() + " jumped while having an open inventory."));
168
    }
169
170
    /**
171
     * This checks all 9 blocks centered on where the player stands as well as the 9 blocks below to reliably check for materials like slabs.
172
     * Checking all those blocks is required because stepping up a slab does not mean the player's block-location is already the slab.
173
     */
174
    private static boolean playerCanJumpDueToGroundMaterial(Location location)
175
    {
176
        return Stream.concat(WorldUtil.INSTANCE.getBlocksAround(location.getBlock(), WorldUtil.HORIZONTAL_FACES, Set.of()).stream(),
177
                             WorldUtil.INSTANCE.getBlocksAround(location.getBlock().getRelative(BlockFace.DOWN), WorldUtil.HORIZONTAL_FACES, Set.of()).stream())
178
                     .map(Block::getType)
179
                     .anyMatch(InventoryMove.JUMP_ENABLING_MATERIALS::contains);
180
    }
181
182
    @Override
183
    protected ViolationManagement createViolationManagement()
184
    {
185
        return ViolationLevelManagement.builder(this)
186
                                       .emptyThresholdManagement()
187
                                       .withDecay(100, 2).build();
188
    }
189
}

How it counteracts this module

Photon's InventoryMove listens on PlayerMoveEvent and skips everything that is not real movement: squared distance at or below 0.005, vehicles, flight, no open inventory, damage invulnerability, liquids, recent teleports or world changes, and low TPS (lines 77-100). The leniency is breakingTime (300ms base plus the speed-potion adjustment, lines 64-71) plus an optional ping leniency; movement past that window with no jump-end grace and no pushing entities flags at 5 VL (lines 134-144). A jump while the inventory is open routes to handleJump at 25 VL, with one allowed jump per open and slab and bounce materials exempted (lines 147-180), and cancel at 60 VL teleports back to the move origin. The module's sustained movement maps onto the walk path and its forced jump binding onto the jump branch, so both penalties are available; the one soft spot is the 300ms breaking window, which brief inventory movement could hide inside.

anticheat InventoryMoveProtocol (Bukkit-event distance scoring)

InventoryMoveProtocol.java136 lines · Java
1
package com.elikill58.negativity.spigot.protocols;
2
3
import org.bukkit.Material;
4
import org.bukkit.entity.Player;
5
import org.bukkit.event.EventHandler;
6
import org.bukkit.event.Listener;
7
import org.bukkit.event.inventory.InventoryClickEvent;
8
import org.bukkit.event.inventory.InventoryCloseEvent;
9
import org.bukkit.event.inventory.InventoryOpenEvent;
10
import org.bukkit.event.inventory.InventoryType.SlotType;
11
import org.bukkit.event.player.PlayerMoveEvent;
12
13
import com.elikill58.negativity.spigot.SpigotNegativity;
14
import com.elikill58.negativity.spigot.SpigotNegativityPlayer;
15
import com.elikill58.negativity.spigot.blocks.SpigotLocation;
16
import com.elikill58.negativity.spigot.utils.LocationUtils;
17
import com.elikill58.negativity.universal.Cheat;
18
import com.elikill58.negativity.universal.CheatKeys;
19
import com.elikill58.negativity.universal.ReportType;
20
import com.elikill58.negativity.universal.adapter.Adapter;
21
import com.elikill58.negativity.universal.utils.UniversalUtils;
22
23
public class InventoryMoveProtocol extends Cheat implements Listener {
24
25
	public InventoryMoveProtocol() {
26
		super(CheatKeys.INVENTORY_MOVE, false, Material.NETHER_STAR, CheatCategory.MOVEMENT, true, "invmove");
27
	}
28
29
	@EventHandler
30
	public void onMove(PlayerMoveEvent e) {
31
		Player p = e.getPlayer();
32
		SpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer(p);
33
		if (!np.hasDetectionActive(this) || np.isUsingTrident() || np.hasElytra() || p.isInsideVehicle() || p.getFallDistance() > 0.5 || np.inventoryMoveData == null
34
				|| LocationUtils.isInWater(new SpigotLocation(p.getLocation())) || p.getVelocity().length() > 0.1 || !np.inventoryMoveData.active || LocationUtils.hasMaterialsAround(new SpigotLocation(e.getFrom()), "PISTON")) {
35
			Adapter.getAdapter().debug("Velocity length: " + p.getVelocity().length());
36
			return;
37
		}
38
		if (p.getOpenInventory() == null) {
39
			np.inventoryMoveData = null;
40
			Adapter.getAdapter().debug("No opened inventory but data always running ?");
41
			return;
42
		}
43
		InventoryMoveData data = np.inventoryMoveData;
44
		int amount = 0;
45
		if (p.isSprinting())
46
			amount += data.sprint ? 1 : 5; // means it started sprinting since inv open
47
		if (p.isSneaking())
48
			amount += data.sneak ? 1 : 5; // means it started sneaking since inv open
49
50
		double distance = e.getFrom().distance(e.getTo());
51
		double distanceXZ = LocationUtils.distanceXZ(e.getFrom(), e.getTo());
52
		if (distanceXZ >= data.distanceXZ && distanceXZ >= p.getWalkSpeed()) // if running at least at the same
53
			amount += (data.distanceXZ - distanceXZ) + 1; // +1 to always have alert
54
55
		if (distance >= data.distance && distance >= p.getWalkSpeed() && p.getFallDistance() < 0.5) // fall "allow" to make the distance goes brr
56
			amount += (data.distanceXZ - distanceXZ) + 1 - p.getFallDistance();
57
		if (data.timeSinceOpen > 2)
58
			Adapter.getAdapter().debug("Time: " + data.timeSinceOpen + ", amount: " + amount);
59
		if (data.timeSinceOpen >= 3 && amount > 2) {
60
			SpigotNegativity.alertMod(ReportType.WARNING, p, this, UniversalUtils.parseInPorcent(80 + data.timeSinceOpen),
61
					"Sprint: " + p.isSprinting() + ", Sneak: " + p.isSneaking() + ", data: " + data + ", vel: " + p.getVelocity() + ", fd: " + String.format("%.5f", p.getFallDistance()),
62
					(CheatHover) null, amount);
63
		}
64
		data.update(distance, distanceXZ);
65
	}
66
67
	@EventHandler
68
	public void onClick(InventoryClickEvent e) {
69
		if (!(e.getWhoClicked() instanceof Player) || e.getClickedInventory() == null || !e.getSlotType().equals(SlotType.CONTAINER) || e.isCancelled())
70
			return;
71
		SpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer((Player) e.getWhoClicked());
72
		if (!np.hasDetectionActive(this))
73
			return;
74
		checkInvMove(np, (Player) e.getWhoClicked(), "Click");
75
	}
76
77
	@EventHandler
78
	public void onOpen(InventoryOpenEvent e) {
79
		if (!(e.getPlayer() instanceof Player) || e.isCancelled())
80
			return;
81
		SpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer((Player) e.getPlayer());
82
		if (!np.hasDetectionActive(this))
83
			return;
84
		checkInvMove(np, (Player) e.getPlayer(), "Open");
85
	}
86
87
	@EventHandler
88
	public void onClose(InventoryCloseEvent e) {
89
		if (e.getPlayer() instanceof Player)
90
			SpigotNegativityPlayer.getNegativityPlayer((Player) e.getPlayer()).inventoryMoveData.reset((Player) e.getPlayer());
91
	}
92
93
	private void checkInvMove(SpigotNegativityPlayer np, Player p, String from) {
94
		if (np.hasElytra() || p.isInsideVehicle() || p.getLocation().getBlock().getType().name().contains("WATER"))
95
			return;
96
		np.inventoryMoveData.active = true;
97
	}
98
99
	@Override
100
	public boolean isBlockedInFight() {
101
		return true;
102
	}
103
104
	public static class InventoryMoveData {
105
106
		public Player p;
107
		public double distance = 0, distanceXZ = 0;
108
		public int timeSinceOpen = 0;
109
		public boolean sprint, sneak, active;
110
111
		public InventoryMoveData() {
112
			reset(null);
113
		}
114
115
		public void update(double distance, double distanceXZ) {
116
			this.distance = distance;
117
			this.distanceXZ = distanceXZ;
118
			this.timeSinceOpen++;
119
		}
120
121
		public void reset(Player p) {
122
			this.sprint = p == null ? false : p.isSprinting();
123
			this.sneak = p == null ? false : p.isSneaking();
124
			this.active = false;
125
			this.distance = 0;
126
			this.distanceXZ = 0;
127
			this.timeSinceOpen = 0;
128
		}
129
130
		@Override
131
		public String toString() {
132
			return "InventoryMoveData{sprint=" + sprint + ",sneak=" + sneak + ",distance=" + String.format("%.3f", distance) + ",distanceXZ=" + String.format("%.3f", distance) + ",time="
133
					+ timeSinceOpen + "}";
134
		}
135
	}
136
}

How it counteracts this module

Negativity's protocol is event-based: onMove requires an open inventory (p.getOpenInventory() != null), no elytra, trident, vehicle, water or nearby pistons, fall distance under 0.5 and server velocity at or below 0.1 (lines 33-34), then scores a sprint or sneak transition as 5 points and movement distance at or above the previous move's distance and at or above walk speed as a positive delta (lines 44-56). It flags once timeSinceOpen reaches 3 ticks and the score exceeds 2 (lines 57-63), and isBlockedInFight pauses the protocol during combat. The module's forced sprint binding re-enables sprinting under the open window, which the transition check counts as 5, and sustained walk keeps distance at or above the previous move, so a flag lands from the third tick. Water, pistons, vehicles, fall damage over 0.5 and knockback all silence it, and combat pauses it.

anticheat InventoryMove (rotation or sprint or sneak while open)

InventoryMove.java52 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.movement;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.MovementCheck;
23
import me.islandscout.hawk.event.MoveEvent;
24
25
/*
26
 * InventoryActions check originally written by Havesta; modified, split apart, and implemented into Hawk by Islandscout
27
 *
28
 * InventoryMove checks if a player is
29
 * - rotating, sprinting, or sneaking while inventory is opened
30
 */
31
32
public class InventoryMove extends MovementCheck {
33
34
    public InventoryMove() {
35
        super("inventorymove", true, 3, 5, 0.999, 5000, "%player% failed inventory-move, VL: %vl%", null);
36
    }
37
38
    @Override
39
    protected void check(MoveEvent e) {
40
        HawkPlayer pp = e.getHawkPlayer();
41
42
        //TODO: false flag: rotation is still possible at least 1 tick after opening inventory
43
        //TODO: false flag: you gotta do that TP grace period thing for this too
44
        //TODO: false flag: ESCing out of F6 twitch options while inv is open will cause a desync. Forcibly close inventory on flag to fix desyncs like this?
45
        if((e.isUpdateRot() || pp.isSprinting() || pp.isSneaking()) && pp.hasInventoryOpen() != 0 && !e.isTeleportAccept()) {
46
            punishAndTryRubberband(pp, e);
47
        }
48
        else {
49
            reward(pp);
50
        }
51
    }
52
}

How it counteracts this module

Hawk's check is the broadest of the set: it flags any MoveEvent where the player updates rotation, sprints or sneaks while hasInventoryOpen() is nonzero and the move is not a teleport accept (line 45), with a violation threshold of 3, a 0.999 decay and a 5 second timeout, punishing with a rubberband. Vanilla sends look updates as part of every C03, so any movement under an open container carries an isUpdateRot flag and trips the check immediately; the module's forced sprint binding is a second independent trigger. The check's own TODO comments concede a one-tick false-positive window after opening and the lack of a teleport grace, so a single early move can slip through, but sustained inventory movement flags on the second move and rubberbands. The NoDetectable carve-out is the module's only honest escape: on non-container screens no container is open server-side, so hasInventoryOpen() reads zero.

← Back to Analysis Hub