NoDelay module

NoDelay: Minecraft 26.3 cheat module, full source for every implementation (1 client: Combatant).

1 implementationPLAYER

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

CombatantPLAYERsrc/main/java/combatant/client/features/module/modules/player/NoDelay.javaJava · 359 lines · 14.2 KB

Removes selected vanilla client-side delays.

SettingsnoDelayTypesnoDelayUseDelaynoDelayDelayMsnoDelayIntervalMsnoDelayInteractDelayMsnoDelayInteractIntervalMsnoDelayBlockPlaceCooldownTicksnoDelayFastBreakModenoDelayFastBreakProgress
NoDelay.javaJava · Minecraft 26.2 · 359 lines · 14.2 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Combatant Client distribution.
3
 * Copyright (c) 2026 pivosos2007.
4
 *
5
 * Licensed under the GNU General Public License v3.0.
6
 */
7
8
package combatant.client.features.module.modules.player;
9
10
import combatant.client.config.common.CommonSettingSchemas;
11
import net.minecraft.client.Minecraft;
12
import net.minecraft.client.player.LocalPlayer;
13
import net.minecraft.core.BlockPos;
14
import net.minecraft.core.Direction;
15
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
16
import net.minecraft.world.InteractionHand;
17
import net.minecraft.world.InteractionResult;
18
import net.minecraft.world.entity.decoration.ItemFrame;
19
import net.minecraft.world.item.BlockItem;
20
import net.minecraft.world.item.Item;
21
import net.minecraft.world.item.Items;
22
import net.minecraft.world.phys.BlockHitResult;
23
import net.minecraft.world.phys.EntityHitResult;
24
import net.minecraft.world.phys.HitResult;
25
import combatant.client.config.values.BooleanMapValue;
26
import combatant.client.config.values.BooleanValue;
27
import combatant.client.config.values.EnumValue;
28
import combatant.client.config.values.NumberValue;
29
import combatant.client.features.module.Module;
30
import combatant.client.features.module.ModuleCategory;
31
import combatant.client.features.module.ModuleInfo;
32
import combatant.client.mixins.accessors.LivingEntityAccessor;
33
import combatant.client.mixins.accessors.MinecraftAccessor;
34
import combatant.client.mixins.accessors.MultiPlayerGameModeAccessor;
35
36
import java.util.LinkedHashMap;
37
import java.util.Map;
38
39
@ModuleInfo(
40
        id = "nodelay",
41
        displayName = "NoDelay",
42
        aliases = {"FastUse", "FastBreak", "FastPlace"},
43
        category = ModuleCategory.PLAYER,
44
        description = "module.nodelay.description"
45
)
46
public final class NoDelay extends Module {
47
48
    private static final float VULCAN_297_MIN_SERVER_ACCEPT_PROGRESS = 0.7f;
49
50
    private static final String SETTING_TYPES = "types";
51
    private static final String SETTING_USE_DELAY = "use_delay";
52
    private static final String SETTING_DELAY_MS = "delay_ms";
53
    private static final String SETTING_INTERVAL_MS = "interval_ms";
54
    private static final String SETTING_INTERACT_DELAY_MS = "interact_delay_ms";
55
    private static final String SETTING_INTERACT_INTERVAL_MS = "interact_interval_ms";
56
    private static final String SETTING_BLOCK_PLACE_COOLDOWN_TICKS = "block_place_cooldown_ticks";
57
    private static final String SETTING_FAST_BREAK_MODE = "fast_break_mode";
58
    private static final String SETTING_FAST_BREAK_PROGRESS = "fast_break_progress";
59
60
    private static final String TYPE_JUMP = "Jump";
61
    private static final String TYPE_RIGHT_CLICK = "Right Click";
62
    private static final String TYPE_BLOCK_PLACE = "Block Place";
63
    private static final String TYPE_BREAK_COOLDOWN = "Break CoolDown";
64
    private static final String TYPE_FAST_BREAK = "Fast Break";
65
    private static final String TYPE_FAST_THROW = "Fast throw";
66
    private static final String TYPE_FAST_INTERACT = "Fast interact";
67
    private static final String TYPE_SHIELD_COOLDOWN = "Shield Cooldown";
68
69
    private final BooleanMapValue types = group("noDelayTypes", SETTING_TYPES, defaultTypes());
70
    private final BooleanValue useDelay =
71
            visibleWhen(bool("noDelayUseDelay", SETTING_USE_DELAY, true), () -> types.get(TYPE_FAST_THROW));
72
    private final NumberValue<Integer> delayMs =
73
            visibleWhen(num("noDelayDelayMs", SETTING_DELAY_MS, 250, 10, 250),
74
                    () -> types.get(TYPE_FAST_THROW) && useDelay.get());
75
    private final NumberValue<Integer> intervalMs =
76
            visibleWhen(num("noDelayIntervalMs", SETTING_INTERVAL_MS, 35, 10, 100),
77
                    () -> types.get(TYPE_FAST_THROW));
78
    private final NumberValue<Integer> interactDelayMs =
79
            visibleWhen(num("noDelayInteractDelayMs", SETTING_INTERACT_DELAY_MS, 150, 10, 250),
80
                    () -> types.get(TYPE_FAST_INTERACT));
81
    private final NumberValue<Integer> interactIntervalMs =
82
            visibleWhen(num("noDelayInteractIntervalMs", SETTING_INTERACT_INTERVAL_MS, 45, 10, 150),
83
                    () -> types.get(TYPE_FAST_INTERACT));
84
    private final NumberValue<Integer> blockPlaceCooldownTicks =
85
            visibleWhen(num("noDelayBlockPlaceCooldownTicks", SETTING_BLOCK_PLACE_COOLDOWN_TICKS, 0, 0, 6),
86
                    () -> types.get(TYPE_BLOCK_PLACE));
87
    private final EnumValue<FastBreakMode> fastBreakMode =
88
            visibleWhen(enumCommon(
89
                            "noDelayFastBreakMode",
90
                            SETTING_FAST_BREAK_MODE,
91
                            CommonSettingSchemas.MODE,
92
                            FastBreakMode.NORMAL,
93
                            FastBreakMode.values()
94
                    ),
95
                    () -> types.get(TYPE_FAST_BREAK));
96
    private final NumberValue<Float> fastBreakProgress =
97
            visibleWhen(num("noDelayFastBreakProgress", SETTING_FAST_BREAK_PROGRESS, 0.5f, 0.1f, 1.0f),
98
                    () -> types.get(TYPE_FAST_BREAK));
99
100
    private final Minecraft mc = Minecraft.getInstance();
101
102
    private long pressStartThrow = 0L;
103
    private long lastThrow = 0L;
104
    private long pressStartInteract = 0L;
105
    private long lastInteract = 0L;
106
    private BlockPos lastBoostedBreakPos;
107
108
    private static Map<String, Boolean> defaultTypes() {
109
        Map<String, Boolean> defaults = new LinkedHashMap<>();
110
        defaults.put(TYPE_JUMP, true);
111
        defaults.put(TYPE_RIGHT_CLICK, true);
112
        defaults.put(TYPE_BLOCK_PLACE, false);
113
        defaults.put(TYPE_BREAK_COOLDOWN, true);
114
        defaults.put(TYPE_FAST_BREAK, true);
115
        defaults.put(TYPE_FAST_THROW, true);
116
        defaults.put(TYPE_FAST_INTERACT, true);
117
        defaults.put(TYPE_SHIELD_COOLDOWN, true);
118
        return defaults;
119
    }
120
121
    @Override
122
    public void onTick() {
123
        if (!isEnabled() || mc == null || mc.player == null) {
124
            resetBreakBoost();
125
            return;
126
        }
127
128
        if (types.get(TYPE_RIGHT_CLICK)) {
129
            ((MinecraftAccessor) mc).combatant$setItemUseCooldown(0);
130
        } else if (types.get(TYPE_BLOCK_PLACE)) {
131
            applyBlockPlaceCooldown();
132
        }
133
134
        if (types.get(TYPE_BREAK_COOLDOWN) && mc.gameMode instanceof MultiPlayerGameModeAccessor accessor) {
135
            accessor.combatant$setBlockBreakingCooldown(0);
136
        }
137
138
        if (types.get(TYPE_FAST_BREAK)) {
139
            applyFastBreakBoost();
140
        } else {
141
            resetBreakBoost();
142
        }
143
144
        if (types.get(TYPE_JUMP)) {
145
            ((LivingEntityAccessor) mc.player).combatant$setJumpingCooldown(0);
146
        }
147
    }
148
149
150
    public boolean shouldDisableShieldCooldown() {
151
        return isEnabled() && types.get(TYPE_SHIELD_COOLDOWN);
152
    }
153
154
    @Override
155
    public void onDisable() {
156
        pressStartThrow = 0L;
157
        lastThrow = 0L;
158
        pressStartInteract = 0L;
159
        lastInteract = 0L;
160
        resetBreakBoost();
161
    }
162
163
    public boolean handleFastUse() {
164
        if (!isEnabled()) return false;
165
        if (mc == null || mc.player == null || mc.gameMode == null) return false;
166
        if (!types.get(TYPE_FAST_THROW) && !types.get(TYPE_FAST_INTERACT)) return false;
167
168
        LocalPlayer player = mc.player;
169
170
        if (!mc.options.keyUse.isDown()) {
171
            pressStartThrow = 0L;
172
            pressStartInteract = 0L;
173
            return false;
174
        }
175
176
        Item main = player.getMainHandItem().getItem();
177
        Item off = player.getOffhandItem().getItem();
178
        HitResult hit = mc.hitResult;
179
        UseContext ctx = resolveFastUseContext(main, off, hit);
180
        if (ctx == null) return false;
181
182
        if (ctx.target == UseTarget.THROWABLE && !types.get(TYPE_FAST_THROW)) return false;
183
        if ((ctx.target == UseTarget.BONE_MEAL_BLOCK || ctx.target == UseTarget.ITEM_FRAME) && !types.get(TYPE_FAST_INTERACT)) {
184
            return false;
185
        }
186
187
        long now = System.currentTimeMillis();
188
        if (ctx.target == UseTarget.THROWABLE) {
189
            if (pressStartThrow == 0L) {
190
                pressStartThrow = now;
191
                return false;
192
            }
193
            if (useDelay.get() && (now - pressStartThrow) < delayMs.get()) return true;
194
            if ((now - lastThrow) < intervalMs.get()) return true;
195
            lastThrow = now;
196
197
            InteractionResult result = performFastUse(player, ctx);
198
            if (result != null && result.consumesAction()) player.swing(ctx.hand);
199
            return true;
200
        }
201
202
        if (pressStartInteract == 0L) {
203
            pressStartInteract = now;
204
            return false;
205
        }
206
        if ((now - pressStartInteract) < interactDelayMs.get()) return true;
207
        if ((now - lastInteract) < interactIntervalMs.get()) return true;
208
        lastInteract = now;
209
210
        InteractionResult result = performFastUse(player, ctx);
211
        if (result != null && result.consumesAction()) player.swing(ctx.hand);
212
        return true;
213
    }
214
215
    private void applyBlockPlaceCooldown() {
216
        if (mc.player == null || !mc.options.keyUse.isDown()) return;
217
        if (!isBlockPlaceCandidate(mc.player, mc.hitResult)) return;
218
219
        MinecraftAccessor accessor = (MinecraftAccessor) mc;
220
        int current = accessor.combatant$getItemUseCooldown();
221
        int maxCooldown = blockPlaceCooldownTicks.get();
222
        if (current > maxCooldown) {
223
            accessor.combatant$setItemUseCooldown(maxCooldown);
224
        }
225
    }
226
227
    private boolean isBlockPlaceCandidate(LocalPlayer player, HitResult hit) {
228
        if (!(hit instanceof BlockHitResult)) return false;
229
        Item main = player.getMainHandItem().getItem();
230
        Item off = player.getOffhandItem().getItem();
231
        return main instanceof BlockItem || off instanceof BlockItem;
232
    }
233
234
    private void applyFastBreakBoost() {
235
        if (mc.gameMode == null || mc.getConnection() == null) {
236
            resetBreakBoost();
237
            return;
238
        }
239
        if (!mc.gameMode.isDestroying()) {
240
            resetBreakBoost();
241
            return;
242
        }
243
        if (!(mc.gameMode instanceof MultiPlayerGameModeAccessor accessor)) {
244
            return;
245
        }
246
247
        BlockPos pos = accessor.combatant$getCurrentBreakingPos();
248
        if (pos == null) return;
249
250
        float progress = accessor.combatant$getCurrentBreakingProgress();
251
        float requiredProgress = fastBreakMode.get() == FastBreakMode.VULCAN_297
252
                ? Math.max(fastBreakProgress.get(), VULCAN_297_MIN_SERVER_ACCEPT_PROGRESS)
253
                : fastBreakProgress.get();
254
        if (progress < requiredProgress) return;
255
        if (pos.equals(lastBoostedBreakPos)) return;
256
257
        if (fastBreakMode.get() == FastBreakMode.VULCAN_297) {
258
            // A vanilla server accepts STOP once its own progress reaches 0.7; clamping the trigger
259
            // above keeps legacy 0.5 configs from falling back to server-side delayed destruction.
260
            // Let vanilla finish the break during handleKeybinds on the next tick. Its STOP packet
261
            // is then sent before LocalPlayer emits movement, outside Vulcan 2.9.7 BadPackets N's
262
            // "movement -> <5 ms dig -> 40..100 ms movement" timing window.
263
            accessor.combatant$setCurrentBreakingProgress(1.0f);
264
            lastBoostedBreakPos = pos.immutable();
265
            return;
266
        }
267
268
        Direction direction = resolveBreakingDirection(pos);
269
        mc.getConnection().send(
270
                new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, pos, direction)
271
        );
272
        mc.getConnection().send(
273
                new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, pos, direction)
274
        );
275
276
        lastBoostedBreakPos = pos.immutable();
277
    }
278
279
    private void resetBreakBoost() {
280
        lastBoostedBreakPos = null;
281
    }
282
283
    private Direction resolveBreakingDirection(BlockPos breakingPos) {
284
        HitResult hit = mc.hitResult;
285
        if (hit instanceof BlockHitResult blockHit && breakingPos.equals(blockHit.getBlockPos())) {
286
            return blockHit.getDirection();
287
        }
288
        return Direction.DOWN;
289
    }
290
291
    private boolean isThrowable(Item item) {
292
        return item == Items.EXPERIENCE_BOTTLE || item == Items.SNOWBALL || item == Items.EGG;
293
    }
294
295
    private boolean isBoneMeal(Item item) {
296
        return item == Items.BONE_MEAL;
297
    }
298
299
    private boolean isItemFrameTargeted(HitResult hit) {
300
        return hit instanceof EntityHitResult ehr && ehr.getEntity() instanceof ItemFrame;
301
    }
302
303
    private UseContext resolveFastUseContext(Item main, Item off, HitResult hit) {
304
        if (isThrowable(main)) return new UseContext(InteractionHand.MAIN_HAND, UseTarget.THROWABLE, null, null);
305
        if (isThrowable(off)) return new UseContext(InteractionHand.OFF_HAND, UseTarget.THROWABLE, null, null);
306
307
        if (isBoneMeal(main) && hit instanceof BlockHitResult bhr) {
308
            return new UseContext(InteractionHand.MAIN_HAND, UseTarget.BONE_MEAL_BLOCK, bhr, null);
309
        }
310
        if (isBoneMeal(off) && hit instanceof BlockHitResult bhr) {
311
            return new UseContext(InteractionHand.OFF_HAND, UseTarget.BONE_MEAL_BLOCK, bhr, null);
312
        }
313
314
        if (isItemFrameTargeted(hit)) {
315
            return new UseContext(InteractionHand.MAIN_HAND, UseTarget.ITEM_FRAME, null, (EntityHitResult) hit);
316
        }
317
        return null;
318
    }
319
320
    private InteractionResult performFastUse(LocalPlayer player, UseContext ctx) {
321
        if (ctx.target == UseTarget.THROWABLE) {
322
            return mc.gameMode.useItem(player, ctx.hand);
323
        }
324
        if (ctx.target == UseTarget.BONE_MEAL_BLOCK) {
325
            return mc.gameMode.useItemOn(player, ctx.hand, ctx.blockHit);
326
        }
327
        if (ctx.target == UseTarget.ITEM_FRAME) {
328
            return mc.gameMode.interact(player, ctx.entityHit.getEntity(), ctx.entityHit, ctx.hand);
329
        }
330
        return InteractionResult.PASS;
331
    }
332
333
    private enum UseTarget {
334
        THROWABLE,
335
        BONE_MEAL_BLOCK,
336
        ITEM_FRAME
337
    }
338
339
    private enum FastBreakMode implements EnumValue.IdProvider {
340
        NORMAL("normal"),
341
        VULCAN_297("vulcan_297");
342
343
        private final String id;
344
345
        FastBreakMode(String id) {
346
            this.id = id;
347
        }
348
349
        @Override
350
        public String getId() {
351
            return id;
352
        }
353
    }
354
355
    private record UseContext(InteractionHand hand, UseTarget target, BlockHitResult blockHit,
356
                              EntityHitResult entityHit) {
357
    }
358
}
359