NoInteract module

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

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/NoInteract.javaJava · 13 lines · 332 B

Allows you to avoid opening containers.

SettingsOnlyAura
NoInteract.javaJava · Minecraft 26.2 · 13 lines · 332 B · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.player;
2
3
import thunder.hack.features.modules.Module;
4
import thunder.hack.setting.Setting;
5
6
public class NoInteract extends Module {
7
    public NoInteract() {
8
        super("NoInteract", Category.PLAYER);
9
    }
10
11
    public static Setting<Boolean> onlyAura = new Setting<>("OnlyAura", false);
12
}
13
OfflineClientPLAYERsrc/main/java/com/jellypudding/offlineclient/modules/player/NoInteract.javaJava · 231 lines · 10.4 KB

Stops clicks on the things you choose to protect.

SettingsExplosivesNo useNo use handNo mineNo hitNo entity useNo entity use hand
NoInteract.javaJava · Minecraft 26.2 · 231 lines · 10.4 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.player;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.RightClickEvent;
5
import com.jellypudding.offlineclient.module.Category;
6
import com.jellypudding.offlineclient.module.Module;
7
import com.jellypudding.offlineclient.setting.BoolSetting;
8
import com.jellypudding.offlineclient.setting.EnumSetting;
9
import com.jellypudding.offlineclient.setting.RegistryListSetting;
10
import com.jellypudding.offlineclient.util.EntityUtil;
11
import net.minecraft.core.BlockPos;
12
import net.minecraft.core.registries.BuiltInRegistries;
13
import net.minecraft.world.InteractionHand;
14
import net.minecraft.world.attribute.EnvironmentAttributes;
15
import net.minecraft.world.entity.Entity;
16
import net.minecraft.world.entity.EntityType;
17
import net.minecraft.world.entity.LivingEntity;
18
import net.minecraft.world.entity.OwnableEntity;
19
import net.minecraft.world.entity.player.Player;
20
import net.minecraft.world.item.Items;
21
import net.minecraft.world.level.block.BedBlock;
22
import net.minecraft.world.level.block.Block;
23
import net.minecraft.world.level.block.RespawnAnchorBlock;
24
import net.minecraft.world.level.block.state.BlockState;
25
import net.minecraft.world.phys.BlockHitResult;
26
import net.minecraft.world.phys.EntityHitResult;
27
import net.minecraft.world.phys.HitResult;
28
29
import java.util.List;
30
31
public final class NoInteract extends Module {
32
33
    public enum ListMode { WHITELIST, BLACKLIST }
34
35
    public enum Hand { NONE, MAIN_HAND, OFF_HAND, BOTH }
36
37
    // Which clicks a protected kind of entity is spared.
38
    public enum Protect { NONE, HIT, USE, BOTH }
39
40
    private final BoolSetting explosives = new BoolSetting("Explosives",
41
        "Block right clicks on beds and respawn anchors where they detonate.", true);
42
    private final RegistryListSetting<Block> useBlocks = new RegistryListSetting<>("No use",
43
        "Blocks that never take a right click. Click to pick them.",
44
        BuiltInRegistries.BLOCK, List.of());
45
    private final EnumSetting<ListMode> useBlocksMode = listMode("No use list mode",
46
        "Only the listed blocks take a right click.",
47
        "Every block except the listed ones takes a right click.");
48
    private final EnumSetting<Hand> useHand = new EnumSetting<>("No use hand",
49
        "A hand whose right clicks on blocks are all dropped.", Hand.NONE)
50
        .describe(Hand.NONE, "Both hands click blocks as normal.")
51
        .describe(Hand.MAIN_HAND, "The main hand never right clicks a block.")
52
        .describe(Hand.OFF_HAND, "The off hand never right clicks a block.")
53
        .describe(Hand.BOTH, "Neither hand right clicks a block.");
54
    private final RegistryListSetting<Block> mineBlocks = new RegistryListSetting<>("No mine",
55
        "Blocks that never get broken. Click to pick them.",
56
        BuiltInRegistries.BLOCK, List.of());
57
    private final EnumSetting<ListMode> mineBlocksMode = listMode("No mine list mode",
58
        "Only the listed blocks get broken.",
59
        "Every block except the listed ones gets broken.");
60
    private final RegistryListSetting<EntityType<?>> hitEntities = new RegistryListSetting<>("No hit",
61
        "Entities that never take a hit. Click to pick them.",
62
        BuiltInRegistries.ENTITY_TYPE, List.of());
63
    private final EnumSetting<ListMode> hitEntitiesMode = listMode("No hit list mode",
64
        "Only the listed entities take a hit.",
65
        "Every entity except the listed ones takes a hit.");
66
    private final RegistryListSetting<EntityType<?>> useEntities = new RegistryListSetting<>(
67
        "No entity use", "Entities that never take a right click. Click to pick them.",
68
        BuiltInRegistries.ENTITY_TYPE, List.of());
69
    private final EnumSetting<ListMode> useEntitiesMode = listMode("No entity use list mode",
70
        "Only the listed entities take a right click.",
71
        "Every entity except the listed ones takes a right click.");
72
    private final EnumSetting<Hand> useEntityHand = new EnumSetting<>("No entity use hand",
73
        "A hand whose right clicks on entities are all dropped.", Hand.NONE)
74
        .describe(Hand.NONE, "Both hands click entities as normal.")
75
        .describe(Hand.MAIN_HAND, "The main hand never right clicks an entity.")
76
        .describe(Hand.OFF_HAND, "The off hand never right clicks an entity.")
77
        .describe(Hand.BOTH, "Neither hand right clicks an entity.");
78
    private final EnumSetting<Protect> friends = protect("Friends", "a friend", Protect.BOTH);
79
    private final EnumSetting<Protect> babies = protect("Babies", "a baby animal", Protect.HIT);
80
    private final EnumSetting<Protect> pets = protect("Pets", "a tamed animal", Protect.HIT);
81
    private final EnumSetting<Protect> named = protect("Named", "anything wearing a name tag",
82
        Protect.NONE);
83
84
    public NoInteract() {
85
        super("NoInteract", "Stops clicks on the things you choose to protect.", Category.PLAYER);
86
        addSettings(explosives, useBlocks, useBlocksMode, useHand, mineBlocks, mineBlocksMode,
87
            hitEntities, hitEntitiesMode, useEntities, useEntitiesMode, useEntityHand,
88
            friends, babies, pets, named);
89
        searchTags("no click", "protect", "anti bed");
90
    }
91
92
    private static EnumSetting<ListMode> listMode(String name, String whitelist, String blacklist) {
93
        return new EnumSetting<>(name, "What the list means.", ListMode.BLACKLIST)
94
            .describe(ListMode.WHITELIST, whitelist)
95
            .describe(ListMode.BLACKLIST, blacklist);
96
    }
97
98
    private static EnumSetting<Protect> protect(String name, String what, Protect defaultValue) {
99
        return new EnumSetting<>(name, "Which clicks " + what + " is spared.", defaultValue)
100
            .describe(Protect.NONE, "Hits and right clicks land on " + what + ".")
101
            .describe(Protect.HIT, "Never hit " + what + ".")
102
            .describe(Protect.USE, "Never right click " + what + ".")
103
            .describe(Protect.BOTH, "Never hit or right click " + what + ".");
104
    }
105
106
    @Subscribe
107
    private void onRightClick(RightClickEvent event) {
108
        if (!inGame() || mc.hitResult == null) {
109
            return;
110
        }
111
        if (mc.hitResult instanceof BlockHitResult hit && hit.getType() == HitResult.Type.BLOCK
112
            && blocksUse(hit.getBlockPos())) {
113
            event.cancel();
114
        }
115
        if (mc.hitResult instanceof EntityHitResult hit && blocksEntityUse(hit.getEntity())) {
116
            event.cancel();
117
        }
118
    }
119
120
    private boolean blocksUse(BlockPos pos) {
121
        BlockState state = mc.level.getBlockState(pos);
122
        Block block = state.getBlock();
123
        if (listed(useBlocks, useBlocksMode, block)) {
124
            return true;
125
        }
126
        if (!explosives.isOn()) {
127
            return false;
128
        }
129
        // Whether a bed or an anchor goes off is an environment attribute of the position.
130
        if (block instanceof BedBlock) {
131
            return mc.level.environmentAttributes()
132
                .getValue(EnvironmentAttributes.BED_RULE, pos).explodes();
133
        }
134
        return block instanceof RespawnAnchorBlock && anchorDetonates(state, pos);
135
    }
136
137
    // True for an anchor that blows up. A charge or a spawn set means false.
138
    private boolean anchorDetonates(BlockState state, BlockPos pos) {
139
        if (mc.level.environmentAttributes()
140
            .getValue(EnvironmentAttributes.RESPAWN_ANCHOR_WORKS, pos)) {
141
            return false;
142
        }
143
        int charge = state.getValue(RespawnAnchorBlock.CHARGE);
144
        if (charge == 0) {
145
            return false;
146
        }
147
        return charge >= RespawnAnchorBlock.MAX_CHARGES || !holdingGlowstone();
148
    }
149
150
    // Glowstone tops an anchor up instead of setting it off.
151
    private boolean holdingGlowstone() {
152
        return mc.player.getMainHandItem().is(Items.GLOWSTONE)
153
            || mc.player.getOffhandItem().is(Items.GLOWSTONE);
154
    }
155
156
    // Called from the game mode mixin for each hand that tries a block.
157
    public boolean blocksUseWith(InteractionHand hand) {
158
        return isEnabled() && covers(useHand.getValue(), hand);
159
    }
160
161
    // Called from the game mode mixin for each hand that tries an entity.
162
    public boolean blocksEntityUseWith(InteractionHand hand) {
163
        return isEnabled() && covers(useEntityHand.getValue(), hand);
164
    }
165
166
    private static boolean covers(Hand chosen, InteractionHand hand) {
167
        return switch (chosen) {
168
            case NONE -> false;
169
            case MAIN_HAND -> hand == InteractionHand.MAIN_HAND;
170
            case OFF_HAND -> hand == InteractionHand.OFF_HAND;
171
            case BOTH -> true;
172
        };
173
    }
174
175
    public boolean blocksMining(BlockPos pos) {
176
        if (!isEnabled() || !inGame()) {
177
            return false;
178
        }
179
        return listed(mineBlocks, mineBlocksMode, mc.level.getBlockState(pos).getBlock());
180
    }
181
182
    private boolean blocksHit(Entity entity) {
183
        if (!isEnabled() || entity == null) {
184
            return false;
185
        }
186
        return listed(hitEntities, hitEntitiesMode, entity.getType())
187
            || protects(entity, Protect.HIT);
188
    }
189
190
    private boolean blocksEntityUse(Entity entity) {
191
        if (!isEnabled() || entity == null) {
192
            return false;
193
        }
194
        return listed(useEntities, useEntitiesMode, entity.getType())
195
            || protects(entity, Protect.USE);
196
    }
197
198
    // True when one of the kinds the entity belongs to is spared this click.
199
    private boolean protects(Entity entity, Protect click) {
200
        if (entity instanceof Player player && EntityUtil.isFriend(player)
201
            && spared(friends, click)) {
202
            return true;
203
        }
204
        if (entity instanceof LivingEntity living && living.isBaby() && spared(babies, click)) {
205
            return true;
206
        }
207
        // An untamed wolf is ownable but has no owner.
208
        if (entity instanceof OwnableEntity ownable && ownable.getOwnerReference() != null
209
            && spared(pets, click)) {
210
            return true;
211
        }
212
        return entity.hasCustomName() && spared(named, click);
213
    }
214
215
    private static boolean spared(EnumSetting<Protect> setting, Protect click) {
216
        return setting.is(click) || setting.is(Protect.BOTH);
217
    }
218
219
    private static <T> boolean listed(RegistryListSetting<T> list, EnumSetting<ListMode> mode,
220
                                      T entry) {
221
        return list.contains(entry) == mode.is(ListMode.BLACKLIST);
222
    }
223
224
    public boolean blocksAttack(HitResult result) {
225
        if (result instanceof EntityHitResult hit) {
226
            return blocksHit(hit.getEntity());
227
        }
228
        return result instanceof BlockHitResult hit && blocksMining(hit.getBlockPos());
229
    }
230
}
231
CombatantPLAYERsrc/main/java/combatant/client/features/module/modules/player/NoInteract.javaJava · 43 lines · 1.3 KB
Settingsonly_kill_aura
NoInteract.javaJava · Minecraft 26.2 · 43 lines · 1.3 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.values.BooleanValue;
11
import combatant.client.features.module.Module;
12
import combatant.client.features.module.ModuleCategory;
13
import combatant.client.features.module.ModuleInfo;
14
import combatant.client.features.module.Modules;
15
import combatant.client.features.module.modules.combat.KillAura;
16
17
//todo Description
18
@ModuleInfo(
19
        id = "nointeract",
20
        displayName = "NoInteract",
21
        category = ModuleCategory.PLAYER
22
)
23
public final class NoInteract extends Module {
24
    private final BooleanValue onlyKillAura = bool("only_kill_aura", true);
25
26
    public boolean shouldBlockBlockInteraction() {
27
        KillAura killAura = Modules.get(KillAura.class);
28
        return shouldBlockBlockInteraction(
29
                isEnabled(),
30
                onlyKillAura.get(),
31
                killAura != null && killAura.isEnabled()
32
        );
33
    }
34
35
    static boolean shouldBlockBlockInteraction(
36
            boolean noInteractEnabled,
37
            boolean onlyKillAura,
38
            boolean killAuraEnabled
39
    ) {
40
        return noInteractEnabled && (!onlyKillAura || killAuraEnabled);
41
    }
42
}
43