RubberHand module

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

1 implementationCOMBAT

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.

CombatantCOMBATsrc/main/java/combatant/client/features/module/modules/combat/RubberHand.javaJava · 127 lines · 4.0 KB

Allows attacking and module block-use actions while an item is actively being used.

Settingsrubberhand_actions
RubberHand.javaJava · Minecraft 26.2 · 127 lines · 4.0 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.combat;
9
10
import net.minecraft.client.Minecraft;
11
import net.minecraft.client.player.LocalPlayer;
12
import net.minecraft.world.InteractionHand;
13
import net.minecraft.world.entity.Entity;
14
import net.minecraft.world.item.Items;
15
import net.minecraft.world.phys.EntityHitResult;
16
import combatant.client.config.values.BooleanMapValue;
17
import combatant.client.events.EventHandler;
18
import combatant.client.events.impl.EventSync;
19
import combatant.client.features.module.Module;
20
import combatant.client.features.module.ModuleCategory;
21
import combatant.client.features.module.ModuleInfo;
22
import combatant.client.util.combat.AttackUtil;
23
import combatant.client.util.item.FoodUtil;
24
25
import java.util.LinkedHashMap;
26
27
@ModuleInfo(
28
        id = "rubberhand",
29
        displayName = "RubberHand",
30
        aliases = "MultiActions",
31
        category = ModuleCategory.COMBAT,
32
        description = "module.rubberhand.description"
33
)
34
public class RubberHand extends Module {
35
36
    private static final String SETTING_ACTIONS = "actions";
37
    private static final String ACTION_ATTACK_WHILE_SHIELD = "attack_while_shield";
38
    private static final String ACTION_ATTACK_WHILE_EATING = "attack_while_eating";
39
40
    private final Minecraft mc = Minecraft.getInstance();
41
    private final BooleanMapValue actions = group(
42
            "rubberhand_actions",
43
            SETTING_ACTIONS,
44
            new LinkedHashMap<>() {{
45
                put(ACTION_ATTACK_WHILE_SHIELD, true);
46
                put(ACTION_ATTACK_WHILE_EATING, false);
47
            }}
48
    );
49
    private boolean didAttackThisHold = false;
50
51
    public boolean canAttackWhileShield() {
52
        return isEnabled() && actions.get(ACTION_ATTACK_WHILE_SHIELD);
53
    }
54
55
    public boolean canAttackWhileEating() {
56
        return isEnabled() && actions.get(ACTION_ATTACK_WHILE_EATING);
57
    }
58
59
    public boolean canBypassShieldUse() {
60
        return canAttackWhileShield();
61
    }
62
63
    public boolean canBypassFoodUse() {
64
        return canAttackWhileEating();
65
    }
66
67
    @Override
68
    public void onTick() {
69
        if (!isEnabled()) return;
70
        if (mc.player == null) return;
71
72
        boolean attackPressed = mc.options.keyAttack.isDown();
73
74
        if (!attackPressed) {
75
            didAttackThisHold = false;
76
        }
77
    }
78
79
    @EventHandler
80
    private void onSync(EventSync event) {
81
        if (!isEnabled() || mc.player == null || mc.gameMode == null) return;
82
        if (didAttackThisHold) return;
83
        if (!mc.options.keyAttack.isDown() || !mc.options.keyUse.isDown()) return;
84
        if (!(mc.hitResult instanceof EntityHitResult ehr)) return;
85
86
        LocalPlayer player = mc.player;
87
        Entity target = ehr.getEntity();
88
89
        boolean usingShield = player.isUsingItem()
90
                && (player.getUseItem().is(Items.SHIELD) || player.getOffhandItem().is(Items.SHIELD));
91
        boolean usingFood = player.isUsingItem() && FoodUtil.isFood(player.getUseItem());
92
93
        if (usingFood) {
94
            if (!canAttackWhileEating()) {
95
                return;
96
            }
97
98
            if (target instanceof net.minecraft.world.entity.LivingEntity living) {
99
                AttackUtil.attackCurrentItem(mc, living, false);
100
                didAttackThisHold = true;
101
            }
102
            return;
103
        }
104
105
        if (!usingShield || !canAttackWhileShield()) {
106
            return;
107
        }
108
109
        boolean restoreUseKey = mc.options.keyUse.isDown();
110
111
        player.releaseUsingItem();
112
        mc.options.keyUse.setDown(false);
113
114
        performAttack(player, target);
115
116
        if (restoreUseKey) {
117
            event.addPostAction(() -> mc.options.keyUse.setDown(true));
118
        }
119
    }
120
121
    private void performAttack(LocalPlayer player, Entity target) {
122
        mc.gameMode.attack(player, target);
123
        player.swing(InteractionHand.MAIN_HAND);
124
        didAttackThisHold = true;
125
    }
126
}
127