HotbarReplenish module

HotbarReplenish: Minecraft 26.3 cheat module, full source for every implementation (1 client: MelaHack (ThunderHack fork)).

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.

MelaHack (ThunderHack fork)PLAYERsrc/main/java/thunder/hack/features/modules/player/HotbarReplenish.javaJava · 60 lines · 2.0 KB

Refills your items in the hotbar.

SettingsModeDelayThresholdPearlsThreshold
HotbarReplenish.javaJava · Minecraft 26.2 · 60 lines · 2.0 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.player;
2
3
import net.minecraft.world.inventory.ContainerInput;
4
import net.minecraft.world.item.ItemStack;
5
import thunder.hack.features.modules.Module;
6
import thunder.hack.setting.Setting;
7
import thunder.hack.utility.Timer;
8
9
public class HotbarReplenish extends Module {
10
    public HotbarReplenish() {
11
        super("HotbarReplenish", Category.PLAYER);
12
    }
13
14
    private final Setting<Mode> mode = new Setting<>("Mode", Mode.SWAP);
15
    private final Setting<Integer> delay = new Setting<>("Delay", 2, 0, 10);
16
    private final Setting<Integer> refillThr = new Setting<>("Threshold", 16, 1, 63);
17
    private final Setting<Integer> refillSmallThr = new Setting<>("PearlsThreshold", 4, 1, 15);
18
19
    private final Timer timer = new Timer();
20
21
    private enum Mode {
22
        QUICK_MOVE, SWAP
23
    }
24
25
    @Override
26
    public void onUpdate() {
27
        if (mc.gui.screen() != null) return;
28
        if (!timer.passedMs(delay.getValue() * 1000)) return;
29
        for (int i = 0; i < 9; ++i) {
30
            if (!need(i)) continue;
31
            timer.reset();
32
            return;
33
        }
34
    }
35
36
    private boolean need(int slot) {
37
        ItemStack stack = mc.player.getInventory().getItem(slot);
38
        if (stack.isEmpty() || !stack.isStackable()) return false;
39
40
        if (stack.getMaxStackSize() == 16 && stack.getCount() > refillSmallThr.getValue()) return false;
41
42
        if (stack.getMaxStackSize() == 64 && stack.getCount() > refillThr.getValue()) return false;
43
44
        for (int i = 9; i < 36; ++i) {
45
            ItemStack item = mc.player.getInventory().getItem(i);
46
            if (item.isEmpty() || !canMerge(stack, item)) continue;
47
48
            boolean swap = mode.is(Mode.QUICK_MOVE);
49
50
            clickSlot(i, swap ? slot : 0, swap ? ContainerInput.SWAP : ContainerInput.QUICK_MOVE);
51
            return true;
52
        }
53
        return false;
54
    }
55
56
    private boolean canMerge(ItemStack source, ItemStack stack) {
57
        return source.getItem() == stack.getItem() && source.getHoverName().equals(stack.getHoverName());
58
    }
59
}
60