AntiBot module

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

2 implementationsCOMBATMISC

Full module source: 2 implementations

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

MelaHack (ThunderHack fork)COMBATsrc/main/java/thunder/hack/features/modules/combat/AntiBot.javaJava · 98 lines · 3.3 KB

Removes the bots created by Matrix.

SettingsRemoveOnlyAuraModecheckTicks
AntiBot.javaJava · Minecraft 26.2 · 98 lines · 3.3 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.combat;
2
3
import meteordevelopment.orbit.EventHandler;
4
import net.minecraft.client.player.RemotePlayer;
5
import net.minecraft.world.entity.Entity;
6
import net.minecraft.world.entity.player.Player;
7
import thunder.hack.events.impl.EventSync;
8
import thunder.hack.features.modules.Module;
9
import thunder.hack.features.modules.misc.FakePlayer;
10
import thunder.hack.features.modules.render.NameTags;
11
import thunder.hack.setting.Setting;
12
import thunder.hack.utility.Timer;
13
14
import java.nio.charset.StandardCharsets;
15
import java.util.ArrayList;
16
import java.util.UUID;
17
18
public final class AntiBot extends Module {
19
    public static ArrayList<Player> bots = new ArrayList<>();
20
    public Setting<Boolean> remove = new Setting<>("Remove", false);
21
    public Setting<Boolean> onlyAura = new Setting<>("OnlyAura", true);
22
    private final Setting<Mode> mode = new Setting<>("Mode", Mode.UUIDCheck);
23
    public Setting<Integer> checkticks = new Setting<>("checkTicks", 3, 0, 10, v -> mode.getValue() == Mode.MotionCheck);
24
    private final Timer clearTimer = new Timer();
25
    private int ticks = 0;
26
27
    public AntiBot() {
28
        super("AntiBot", Category.COMBAT);
29
    }
30
31
    @EventHandler
32
    public void onSync(EventSync e) {
33
        if (!onlyAura.getValue()) mc.level.players().forEach(this::markAsBot);
34
        else if (Aura.target instanceof Player ent) this.markAsBot(ent);
35
36
        bots.removeIf(Player::isCreative);
37
38
        if (remove.getValue())
39
            bots.forEach(b -> {
40
                    try {
41
                        mc.level.removeEntity(b.getId(), Entity.RemovalReason.KILLED);
42
                    } catch (Exception ignored) {
43
                    }
44
            });
45
46
        if (clearTimer.passedMs(10000)) {
47
            bots.clear();
48
            ticks = 0;
49
            clearTimer.reset();
50
        }
51
    }
52
53
    private void markAsBot(Player ent) {
54
        if (bots.contains(ent))
55
            return;
56
        if (ent.isCreative())
57
            return;
58
59
        switch (mode.getValue()) {
60
            case UUIDCheck -> {
61
                if (!ent.getUUID().equals(UUID.nameUUIDFromBytes(("OfflinePlayer:" + ent.getName().getString()).getBytes(StandardCharsets.UTF_8))) && ent instanceof RemotePlayer
62
                        && (FakePlayer.fakePlayer == null || ent.getId() != FakePlayer.fakePlayer.getId())
63
                        && !ent.getName().getString().contains("-")) {
64
                    this.addBot(ent);
65
                }
66
            }
67
            case MotionCheck -> {
68
                double diffX = ent.getX() - ent.xo;
69
                double diffZ = ent.getZ() - ent.zo;
70
                
71
                if ((diffX * diffX) + (diffZ * diffZ) > 0.5D) {
72
                    if (ticks >= checkticks.getValue())
73
                        this.addBot(ent);
74
                    ticks++;
75
                }
76
            }
77
            case ZeroPing -> {
78
                if (NameTags.getEntityPing(ent) <= 0)
79
                    this.addBot(ent);
80
            }
81
        }
82
    }
83
84
    private void addBot(Player entity) {
85
        this.sendMessage(entity.getName().getString() + " is a bot!");
86
        bots.add(entity);
87
    }
88
89
    @Override
90
    public String getDisplayInfo() {
91
        return String.valueOf(bots.size());
92
    }
93
94
    public enum Mode {
95
        UUIDCheck, MotionCheck, ZeroPing
96
    }
97
}
98
LiquidBounce (Kotlin)MISCsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/misc/antibot/ModuleAntiBot.ktKotlin · 115 lines · 3.8 KB

Detects bots spawned by Anti-Cheats and prevents you from attacking them.

SettingsLiteralNPCNotInTabList
ModuleAntiBot.ktKotlin · Minecraft 26.2 · 115 lines · 3.8 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.misc.antibot
20
21
import com.mojang.authlib.GameProfile
22
import net.ccbluex.liquidbounce.event.events.TagEntityEvent
23
import net.ccbluex.liquidbounce.event.events.WorldChangeEvent
24
import net.ccbluex.liquidbounce.event.handler
25
import net.ccbluex.liquidbounce.features.module.ClientModule
26
import net.ccbluex.liquidbounce.features.module.ModuleCategories
27
import net.ccbluex.liquidbounce.features.module.modules.misc.antibot.modes.CustomAntiBotMode
28
import net.ccbluex.liquidbounce.features.module.modules.misc.antibot.modes.HorizonAntiBotMode
29
import net.ccbluex.liquidbounce.features.module.modules.misc.antibot.modes.IntaveHeavyAntiBotMode
30
import net.ccbluex.liquidbounce.features.module.modules.misc.antibot.modes.MatrixAntiBotMode
31
import net.minecraft.world.entity.Entity
32
import net.minecraft.world.entity.player.Player
33
34
object ModuleAntiBot : ClientModule("AntiBot", ModuleCategories.MISC) {
35
36
    val modes = choices("Mode", CustomAntiBotMode, arrayOf(
37
        CustomAntiBotMode,
38
        MatrixAntiBotMode,
39
        IntaveHeavyAntiBotMode,
40
        HorizonAntiBotMode
41
    ))
42
43
    private val literalNPC by boolean("LiteralNPC", false)
44
    private val notInTabList by boolean("NotInTabList", false)
45
46
    @Suppress("unused")
47
    private val tagHandler = handler<TagEntityEvent> {
48
        if (it.entity === player) {
49
            return@handler
50
        }
51
52
        if (isBot(it.entity)) {
53
           it.ignore()
54
        }
55
    }
56
57
    private fun reset() = this.modes.modes.forEach {
58
        it.reset()
59
    }
60
61
    override fun onDisabled() {
62
        reset()
63
    }
64
65
    @Suppress("unused")
66
    private val handleWorldChange = handler<WorldChangeEvent> {
67
        reset()
68
    }
69
70
    fun isADuplicate(profile: GameProfile): Boolean {
71
        return network.onlinePlayers.count { it.profile.name == profile.name && it.profile.id != profile.id } == 1
72
    }
73
74
    /**
75
     * Checks if the game profile is known at most once in the player list.
76
     *
77
     * Used to prevent false positives when a player is on a minigame such as Practice and joins a duel
78
     */
79
    fun isGameProfileUnique(profile: GameProfile): Boolean {
80
        return network.onlinePlayers.count { it.profile.name == profile.name && it.profile.id == profile.id } == 1
81
    }
82
83
    /**
84
     * Check if player might be a bot
85
     */
86
    fun isBot(player: Entity): Boolean {
87
        if (!running || player === mc.player) {
88
            return false
89
        }
90
91
        if (player !is Player) {
92
            return false
93
        }
94
95
        if (literalNPC && !network.onlinePlayerIds.contains(player.uuid)) {
96
            return true
97
        }
98
99
        if (notInTabList && isMissingFromTabList(player)) {
100
            return true
101
        }
102
103
        return this.modes.activeMode.isBot(player)
104
    }
105
106
    /**
107
     * @see net.minecraft.client.multiplayer.ClientPacketListener.getListedOnlinePlayers
108
     * @see net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED
109
     */
110
    private fun isMissingFromTabList(player: Player): Boolean {
111
        return network.listedOnlinePlayers.none { it.profile.id == player.uuid }
112
    }
113
114
}
115