FastUse module

FastUse: Minecraft 26.3 cheat module, full source for every implementation (3 clients: MelaHack (ThunderHack fork), OfflineClient, LiquidBounce (Kotlin)).

3 implementationsPLAYER

Full module source: 3 implementations

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

MelaHack (ThunderHack fork)PLAYERsrc/main/java/thunder/hack/features/modules/player/FastUse.javaJava · 35 lines · 1.3 KB

Removes the item use delay.

SettingsDelayBlocksCrystalsXPAll
FastUse.javaJava · Minecraft 26.2 · 35 lines · 1.3 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.player;
2
3
import net.minecraft.world.item.BlockItem;
4
import net.minecraft.world.item.Item;
5
import net.minecraft.world.item.Items;
6
import thunder.hack.features.modules.Module;
7
import thunder.hack.injection.accesors.IMinecraftClient;
8
import thunder.hack.setting.Setting;
9
10
public class FastUse extends Module {
11
    public FastUse() {
12
        super("FastUse", Category.PLAYER);
13
    }
14
15
    private final Setting<Integer> delay = new Setting<>("Delay", 0, 0, 5);
16
    public Setting<Boolean> blocks = new Setting<>("Blocks", false);
17
    public Setting<Boolean> crystals = new Setting<>("Crystals", false);
18
    public Setting<Boolean> xp = new Setting<>("XP", false);
19
    public Setting<Boolean> all = new Setting<>("All", true);
20
21
    @Override
22
    public void onUpdate() {
23
        assert mc.player != null;
24
        if (check(mc.player.getMainHandItem().getItem()) && ((IMinecraftClient) mc).getUseCooldown() > delay.getValue())
25
            ((IMinecraftClient) mc).setUseCooldown(delay.getValue());
26
    }
27
28
    public boolean check(Item item) {
29
        return (item instanceof BlockItem && blocks.getValue())
30
                || (item == Items.END_CRYSTAL && crystals.getValue())
31
                || (item == Items.EXPERIENCE_BOTTLE && xp.getValue())
32
                || (all.getValue());
33
    }
34
}
35
OfflineClientPLAYERsrc/main/java/com/jellypudding/offlineclient/modules/player/FastUse.javaJava · 102 lines · 4.5 KB

Removes the delay between right clicks for items.

SettingsModeFoodEnder pearlsSplash potionsExperience bottlesSnowballs and eggsItemsCooldown
FastUse.javaJava · Minecraft 26.2 · 102 lines · 4.5 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.player;
2
3
import com.jellypudding.offlineclient.OfflineClient;
4
import com.jellypudding.offlineclient.event.Subscribe;
5
import com.jellypudding.offlineclient.event.events.TickEvent;
6
import com.jellypudding.offlineclient.module.Category;
7
import com.jellypudding.offlineclient.module.Module;
8
import com.jellypudding.offlineclient.setting.BoolSetting;
9
import com.jellypudding.offlineclient.setting.EnumSetting;
10
import com.jellypudding.offlineclient.setting.NumberSetting;
11
import com.jellypudding.offlineclient.setting.RegistryListSetting;
12
import net.minecraft.core.component.DataComponents;
13
import net.minecraft.core.registries.BuiltInRegistries;
14
import net.minecraft.world.item.BlockItem;
15
import net.minecraft.world.item.EggItem;
16
import net.minecraft.world.item.EnderpearlItem;
17
import net.minecraft.world.item.ExperienceBottleItem;
18
import net.minecraft.world.item.Item;
19
import net.minecraft.world.item.ItemStack;
20
import net.minecraft.world.item.SnowballItem;
21
import net.minecraft.world.item.ThrowablePotionItem;
22
import net.minecraft.world.item.WindChargeItem;
23
24
import java.util.List;
25
26
// Cuts the four tick pause the game puts between right clicks. Blocks
27
// are left to FastPlace which shares the same delay cap.
28
public final class FastUse extends Module {
29
30
    public enum Mode { ALL_ITEMS, CHOSEN_ONLY }
31
32
    private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
33
        "What gets sped up.", Mode.ALL_ITEMS)
34
        .describe(Mode.ALL_ITEMS, "Speeds up everything you can use.")
35
        .describe(Mode.CHOSEN_ONLY, "Speeds up only the kinds ticked below.");
36
    private final BoolSetting food = new BoolSetting("Food",
37
        "Anything you can eat or drink.", true).under(mode, Mode.CHOSEN_ONLY);
38
    private final BoolSetting pearls = new BoolSetting("Ender pearls",
39
        "Throws ender pearls with no delay.", true).under(mode, Mode.CHOSEN_ONLY);
40
    private final BoolSetting potions = new BoolSetting("Splash potions",
41
        "Splash and lingering potions.", true).under(mode, Mode.CHOSEN_ONLY);
42
    private final BoolSetting experience = new BoolSetting("Experience bottles",
43
        "Bottles of enchanting.", true).under(mode, Mode.CHOSEN_ONLY);
44
    private final BoolSetting throwables = new BoolSetting("Snowballs and eggs",
45
        "Snowballs and eggs and wind charges.", false).under(mode, Mode.CHOSEN_ONLY);
46
    private final RegistryListSetting<Item> items = new RegistryListSetting<>("Items",
47
        "Any other items to speed up. Click to pick them.", BuiltInRegistries.ITEM, List.of())
48
        .under(mode, Mode.CHOSEN_ONLY);
49
    private final NumberSetting cooldown = new NumberSetting("Cooldown",
50
        "Ticks to keep between uses. 0 is one use every tick.", 0, 0, 4, 1, " ticks").max(4);
51
52
    public FastUse() {
53
        super("FastUse", "Removes the delay between right clicks for items.", Category.PLAYER);
54
        addSettings(mode, food, pearls, potions, experience, throwables, items, cooldown);
55
        searchTags("fast pearl", "fast eat", "fast throw", "right click delay");
56
    }
57
58
    // Shared cap on the vanilla right click delay. The game sets it to
59
    // four on every use and counts it down once a tick.
60
    public static void capUseDelay(int ticks) {
61
        OfflineClient.MC.rightClickDelay = Math.min(OfflineClient.MC.rightClickDelay, Math.max(0, ticks));
62
    }
63
64
    @Subscribe
65
    private void onTick(TickEvent event) {
66
        if (!inGame() || mc.player.isSpectator()) {
67
            return;
68
        }
69
        ItemStack held = mc.player.getMainHandItem();
70
        if (held.isEmpty()) {
71
            held = mc.player.getOffhandItem();
72
        }
73
        if (held.isEmpty() || held.getItem() instanceof BlockItem) {
74
            return;
75
        }
76
        if (mode.is(Mode.ALL_ITEMS) || wanted(held)) {
77
            capUseDelay(cooldown.getInt());
78
        }
79
    }
80
81
    private boolean wanted(ItemStack stack) {
82
        Item item = stack.getItem();
83
        if (items.contains(item)) {
84
            return true;
85
        }
86
        if (food.isOn() && (stack.has(DataComponents.FOOD) || stack.has(DataComponents.CONSUMABLE))) {
87
            return true;
88
        }
89
        if (pearls.isOn() && item instanceof EnderpearlItem) {
90
            return true;
91
        }
92
        if (potions.isOn() && item instanceof ThrowablePotionItem) {
93
            return true;
94
        }
95
        if (experience.isOn() && item instanceof ExperienceBottleItem) {
96
            return true;
97
        }
98
        return throwables.isOn()
99
            && (item instanceof SnowballItem || item instanceof EggItem || item instanceof WindChargeItem);
100
    }
101
}
102
LiquidBounce (Kotlin)PLAYERsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/ModuleFastUse.ktKotlin · 199 lines · 7.1 KB

Allows you to use items faster.

SettingsConditionsStopInputPacketTypeDelayTimerSpeedConsumeTimeTickCooldown
ModuleFastUse.ktKotlin · Minecraft 26.2 · 199 lines · 7.1 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.player
20
21
import net.ccbluex.liquidbounce.config.types.group.Mode
22
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
23
import net.ccbluex.liquidbounce.config.types.list.Tagged
24
import net.ccbluex.liquidbounce.event.events.GameTickEvent
25
import net.ccbluex.liquidbounce.event.events.MovementInputEvent
26
import net.ccbluex.liquidbounce.event.handler
27
import net.ccbluex.liquidbounce.event.tickHandler
28
import net.ccbluex.liquidbounce.event.waitTicks
29
import net.ccbluex.liquidbounce.features.module.ClientModule
30
import net.ccbluex.liquidbounce.features.module.ModuleCategories
31
import net.ccbluex.liquidbounce.features.module.modules.player.ModuleFastUse.Immediate.speed
32
import net.ccbluex.liquidbounce.utils.network.MovePacketType
33
import net.ccbluex.liquidbounce.utils.client.Timer
34
import net.ccbluex.liquidbounce.utils.entity.moving
35
import net.ccbluex.liquidbounce.utils.entity.opposite
36
import net.ccbluex.liquidbounce.utils.item.isConsumable
37
import net.ccbluex.liquidbounce.utils.kotlin.EventPriorityConvention.CRITICAL_MODIFICATION
38
import net.ccbluex.liquidbounce.utils.kotlin.Priority
39
import net.ccbluex.liquidbounce.utils.movement.DirectionalInput
40
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket
41
import net.minecraft.world.InteractionHand
42
import net.minecraft.world.effect.MobEffects
43
import net.minecraft.world.entity.player.Inventory
44
import net.minecraft.world.inventory.ContainerInput
45
import net.minecraft.world.item.Items
46
47
/**
48
 * FastUse module
49
 *
50
 * Allows you to use items faster on legacy servers.
51
 */
52
53
object ModuleFastUse : ClientModule("FastUse", ModuleCategories.PLAYER, aliases = listOf("FastEat")) {
54
55
    private val modes = choices("Mode", Immediate, arrayOf(Immediate, ItemUseTime, Crossbow)).apply { tagBy(this) }
56
57
    private val conditions by multiEnumChoice("Conditions", UseConditions.NOT_IN_THE_AIR)
58
    private val stopInput by boolean("StopInput", false)
59
60
    /**
61
     * The move packet type to send.
62
     *
63
     * @see MovePacketType
64
     * @see ServerboundMovePlayerPacket
65
     *
66
     * [MovePacketType.FULL] is the most likely to bypass, since vanilla 1.17+ clients
67
     * typically send those when using items. Most anticheats have excluded 1.17+ clients
68
     * from timer checks.
69
     *
70
     * AntiCheat: Grim (Tested 2.5.34), Vulcan, Vanilla
71
     * Tested on: eu.loyisa.cn, anticheat-test.com
72
     * Usable Client version: 1.17-1.20.4
73
     * Usable Server version: >=1.8.9
74
     * A: Legacy servers depend on the clientside tickrate to calculate eating speed.
75
     * Grim exemption: https://github.com/GrimAnticheat/Grim/blob/9660021d024a54634605fbcdf7ce1d631b442da1/src/main/java/ac/grim/grimac/checks/impl/movement/TimerCheck.java#L99
76
     */
77
    private val packetType by enumChoice("PacketType", MovePacketType.FULL)
78
79
    val accelerateNow: Boolean
80
        get() = if (conditions.any { it.meetsConditions() }) {
81
            false
82
        } else {
83
            player.isUsingItem && player.useItem.isConsumable
84
        }
85
86
    @Suppress("unused")
87
    private val movementInputHandler = handler<MovementInputEvent>(priority = CRITICAL_MODIFICATION) { event ->
88
        if (mc.options.keyUse.isDown && stopInput) {
89
            event.directionalInput = DirectionalInput.NONE
90
        }
91
    }
92
93
    private object Immediate : Mode("Immediate") {
94
95
        override val parent: ModeValueGroup<Mode>
96
            get() = modes
97
98
        val delay by int("Delay", 0, 0..10, "ticks")
99
        val timer by float("Timer", 1f, 0.1f..5f)
100
101
        /**
102
         * This is the amount of times the packet is sent per tick.
103
         *
104
         * Having [speed] as 20 means that the server will simulate eating process 20 times each tick.
105
         */
106
        val speed by int("Speed", 20, 1..35, "packets")
107
108
        @Suppress("unused")
109
        val repeatable = tickHandler {
110
            if (accelerateNow) {
111
                Timer.requestTimerSpeed(
112
                    timer, Priority.IMPORTANT_FOR_USAGE_1, ModuleFastUse,
113
                    resetAfterTicks = 1 + delay
114
                )
115
116
                waitTicks(delay)
117
                repeat(speed) {
118
                    network.send(packetType.generatePacket())
119
                }
120
                player.releaseUsingItem()
121
            }
122
        }
123
124
    }
125
126
    private object ItemUseTime : Mode("ItemUseTime") {
127
128
        override val parent: ModeValueGroup<Mode>
129
            get() = modes
130
131
        val consumeTime by int("ConsumeTime", 15, 0..20)
132
        val speed by int("Speed", 20, 1..35, "packets")
133
134
        @Suppress("unused")
135
        val repeatable = tickHandler {
136
            if (accelerateNow && player.ticksUsingItem >= consumeTime) {
137
                repeat(speed) {
138
                    network.send(packetType.generatePacket())
139
                }
140
141
                player.releaseUsingItem()
142
            }
143
        }
144
145
    }
146
147
    private object Crossbow : Mode("Crossbow") {
148
        override val parent: ModeValueGroup<Mode>
149
            get() = modes
150
151
        private val tickCooldown by int("TickCooldown", 1, 1..20)
152
153
        @Suppress("unused")
154
        val tickHandler = handler<GameTickEvent> {
155
            if (player.isUsingItem && player.activeItem.`is`(Items.CROSSBOW) && player.tickCount % tickCooldown == 0) {
156
                val hand = player.usedItemHand
157
                val containerId = player.inventoryMenu.containerId
158
                val slot = player.inventory.selectedSlot + Inventory.INVENTORY_SIZE
159
160
                interaction.handleContainerInput(
161
                    containerId,
162
                    slot,
163
                    Inventory.SLOT_OFFHAND,
164
                    ContainerInput.SWAP,
165
                    player
166
                )
167
168
                interaction.useItem(player, hand.opposite)
169
170
                interaction.handleContainerInput(
171
                    containerId,
172
                    slot,
173
                    Inventory.SLOT_OFFHAND,
174
                    ContainerInput.SWAP,
175
                    player
176
                )
177
178
                interaction.useItem(player, hand)
179
            }
180
        }
181
    }
182
183
    @Suppress("unused")
184
    private enum class UseConditions(
185
        override val tag: String,
186
        val meetsConditions: () -> Boolean
187
    ) : Tagged {
188
        NOT_IN_THE_AIR("NotInTheAir", {
189
            !player.onGround()
190
        }),
191
        NOT_DURING_MOVE("NotDuringMove", {
192
            player.moving
193
        }),
194
        NOT_DURING_REGENERATION("NotDuringRegeneration", {
195
            player.hasEffect(MobEffects.REGENERATION)
196
        })
197
    }
198
}
199