Blocker module

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

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.

MelaHack (ThunderHack fork)COMBATsrc/main/java/thunder/hack/features/modules/combat/Blocker.javaJava · 170 lines · 6.8 KB

Protects your surround from cev, civ, and others.

SettingsPlace Per TickDelayLogicAnti CevAnti CivExpandAnti TNTAnti AnchorDetectOn Break PacketOn Attack BlockOn Break
Blocker.javaJava · Minecraft 26.2 · 170 lines · 6.8 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.combat;
2
3
import meteordevelopment.orbit.EventHandler;
4
import net.minecraft.ChatFormatting;
5
import net.minecraft.core.BlockPos;
6
import net.minecraft.core.Vec3i;
7
import net.minecraft.network.protocol.game.ClientboundBlockDestructionPacket;
8
import net.minecraft.world.entity.player.Player;
9
import net.minecraft.world.level.block.Blocks;
10
import net.minecraft.world.phys.AABB;
11
import org.jetbrains.annotations.NotNull;
12
import thunder.hack.events.impl.*;
13
import thunder.hack.features.modules.base.PlaceModule;
14
import thunder.hack.setting.Setting;
15
import thunder.hack.setting.impl.SettingGroup;
16
import thunder.hack.utility.player.InteractionUtility;
17
import thunder.hack.utility.player.PlayerUtility;
18
import thunder.hack.utility.world.HoleUtility;
19
20
import java.util.Comparator;
21
import java.util.List;
22
import java.util.concurrent.CopyOnWriteArrayList;
23
24
import static thunder.hack.features.modules.client.ClientSettings.isRu;
25
26
public final class Blocker extends PlaceModule {
27
    private final Setting<Integer> actionShift = new Setting<>("Place Per Tick", 1, 1, 5);
28
    private final Setting<Integer> actionInterval = new Setting<>("Delay", 0, 0, 5);
29
30
    private final Setting<SettingGroup> logic = new Setting<>("Logic", new SettingGroup(false, 0));
31
    private final Setting<Boolean> antiCev = new Setting<>("Anti Cev", true).addToGroup(logic);
32
    private final Setting<Boolean> antiCiv = new Setting<>("Anti Civ", true).addToGroup(logic);
33
    private final Setting<Boolean> expand = new Setting<>("Expand", true).addToGroup(logic);
34
    private final Setting<Boolean> antiTntAura = new Setting<>("Anti TNT", false).addToGroup(logic);
35
    private final Setting<Boolean> antiAutoAnchor = new Setting<>("Anti Anchor", false).addToGroup(logic);
36
37
    private final Setting<SettingGroup> detect = new Setting<>("Detect", new SettingGroup(false, 1)).addToGroup(logic);
38
    private final Setting<Boolean> onPacket = new Setting<>("On Break Packet", true).addToGroup(detect);
39
    private final Setting<Boolean> onAttackBlock = new Setting<>("On Attack Block", false).addToGroup(detect);
40
    private final Setting<Boolean> onBreak = new Setting<>("On Break", true).addToGroup(detect);
41
42
    private final List<BlockPos> placePositions = new CopyOnWriteArrayList<>();
43
    private int tickCounter = 0;
44
45
    public Blocker() {
46
        super("Blocker", Category.COMBAT);
47
    }
48
49
    @Override
50
    public void onEnable() {
51
        tickCounter = 0;
52
        sendMessage(ChatFormatting.RED + (isRu() ?
53
                "ВНИМАНИЕ!!! " + ChatFormatting.RESET + "Использование блокера на серверах осуждается игроками, а в некоторых странах карается набутыливанием!" :
54
                "WARNING!!! " + ChatFormatting.RESET + "The use of blocker on servers is condemned by players, and in some countries is punishable by jail!"
55
        ));
56
    }
57
58
    @EventHandler
59
    public void onPostSync(EventPostSync event) {
60
        if (tickCounter < actionInterval.getValue()) {
61
            tickCounter++;
62
            return;
63
        }
64
        if (tickCounter >= actionInterval.getValue()) {
65
            tickCounter = 0;
66
        }
67
68
        if (!getBlockResult().found() || placePositions.isEmpty())
69
            return;
70
71
        placePositions.removeIf(b -> PlayerUtility.squaredDistanceFromEyes(net.minecraft.world.phys.Vec3.atBottomCenterOf(b)) > range.getPow2Value());
72
73
        int blocksPlaced = 0;
74
75
        while (blocksPlaced < actionShift.getValue()) {
76
            BlockPos pos = placePositions.stream()
77
                    .filter(p -> InteractionUtility.canPlaceBlock(p, interact.getValue(), true))
78
                    .min(Comparator.comparing(p -> mc.player.position().distanceTo(net.minecraft.world.phys.Vec3.atBottomCenterOf(p))))
79
                    .orElse(null);
80
81
            if (pos != null && mc.player.onGround() && placeBlock(pos)) {
82
                blocksPlaced++;
83
                tickCounter = 0;
84
                placePositions.remove(pos);
85
                inactivityTimer.reset();
86
            } else break;
87
        }
88
    }
89
90
    @EventHandler
91
    @SuppressWarnings("unused")
92
    private void onPacketReceive(PacketEvent.@NotNull Receive event) {
93
        if (event.getPacket() instanceof ClientboundBlockDestructionPacket && onPacket.getValue()) {
94
            ClientboundBlockDestructionPacket packet = event.getPacket();
95
            doLogic(packet.getPos());
96
        }
97
    }
98
99
    @EventHandler
100
    @SuppressWarnings("unused")
101
    private void onAttackBlock(EventAttackBlock event) {
102
        if (!onAttackBlock.getValue()) return;
103
        doLogic(event.getBlockPos());
104
    }
105
106
    @EventHandler
107
    @SuppressWarnings("unused")
108
    private void onBreak(EventBreakBlock event) {
109
        if (!onBreak.getValue()) return;
110
        doLogic(event.getPos());
111
    }
112
113
    @EventHandler
114
    @SuppressWarnings("unused")
115
    private void onPlaceBlock(@NotNull EventPlaceBlock event) {
116
        if (event.getBlockPos().equals(mc.player.blockPosition().above(2))
117
                && event.getBlock().equals(Blocks.TNT)
118
                && antiTntAura.getValue()) {
119
            placePositions.add(event.getBlockPos());
120
        }
121
        if (event.getBlockPos().equals(mc.player.blockPosition().above(2))
122
                && event.getBlock().equals(Blocks.RESPAWN_ANCHOR)
123
                && antiAutoAnchor.getValue()) {
124
            placePositions.add(event.getBlockPos());
125
        }
126
    }
127
128
    private void doLogic(BlockPos pos) {
129
        if (mc.level == null || mc.player == null || !HoleUtility.isHole(mc.player.blockPosition()))
130
            return;
131
132
        if (antiCev.getValue()) {
133
            for (BlockPos checkPos : HoleUtility.getHolePoses(mc.player.position())) {
134
                if (pos.equals(checkPos.above(2))) {
135
                    placePositions.add(checkPos.above(3));
136
                    return;
137
                }
138
            }
139
        }
140
141
        if (HoleUtility.getSurroundPoses(mc.player.position()).contains(pos)) {
142
            if (mc.level.getBlockState(pos).getBlock() == Blocks.BEDROCK || mc.level.getBlockState(pos).canBeReplaced())
143
                return;
144
145
            placePositions.add(pos.above());
146
147
            if (expand.getValue()) {
148
                for (Vec3i vec : HoleUtility.VECTOR_PATTERN) {
149
                    BlockPos checkPos = pos.offset(vec);
150
                    if (canPlaceBlock(checkPos, true)) {
151
                        if (mc.level.getEntitiesOfClass(Player.class, new AABB(checkPos)).isEmpty())
152
                            placePositions.add(checkPos);
153
                    }
154
                }
155
            }
156
157
            return;
158
        }
159
160
        if (antiCiv.getValue()) {
161
            for (BlockPos checkPos : HoleUtility.getSurroundPoses(mc.player.position())) {
162
                if (pos.equals(checkPos.above())) {
163
                    placePositions.add(checkPos.above(2));
164
                    return;
165
                }
166
            }
167
        }
168
    }
169
}
170