HoleFill module

HoleFill: 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/HoleFill.javaJava · 356 lines · 16.8 KB

Fills safe holes.

SettingsRotateInteract ModeRangeWallRangeBLock Per TickDelayJump DisableBlocksFill HolesSelf FillSelf Fill ModeSingleDoubleQuadModeRange To TargetAuto DisablePlace ModeRenderRender ModeAnimation ModeRender Fill ColorRender Line ColorRender Line Width
HoleFill.javaJava · Minecraft 26.2 · 356 lines · 16.8 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.combat;
2
3
import meteordevelopment.orbit.EventHandler;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.core.Direction;
6
import net.minecraft.core.Vec3i;
7
import net.minecraft.world.entity.player.Player;
8
import net.minecraft.world.item.BlockItem;
9
import net.minecraft.world.item.Item;
10
import net.minecraft.world.item.ItemStack;
11
import net.minecraft.world.level.ClipContext;
12
import net.minecraft.world.level.block.Block;
13
import net.minecraft.world.level.block.Blocks;
14
import net.minecraft.world.phys.AABB;
15
import net.minecraft.world.phys.BlockHitResult;
16
import net.minecraft.world.phys.HitResult;
17
import org.jetbrains.annotations.NotNull;
18
import org.jetbrains.annotations.Unmodifiable;
19
import thunder.hack.core.Managers;
20
import thunder.hack.core.manager.client.ModuleManager;
21
import thunder.hack.events.impl.EventTick;
22
import thunder.hack.features.modules.Module;
23
import thunder.hack.features.modules.client.HudEditor;
24
import thunder.hack.setting.Setting;
25
import thunder.hack.setting.impl.ColorSetting;
26
import thunder.hack.setting.impl.SettingGroup;
27
import thunder.hack.utility.math.PredictUtility;
28
import thunder.hack.utility.player.InteractionUtility;
29
import thunder.hack.utility.Timer;
30
import thunder.hack.utility.render.BlockAnimationUtility;
31
import thunder.hack.utility.world.HoleUtility;
32
33
import java.util.*;
34
35
import static thunder.hack.features.modules.client.ClientSettings.isRu;
36
37
public final class HoleFill extends Module {
38
    private final Setting<InteractionUtility.Rotate> rotate = new Setting<>("Rotate", InteractionUtility.Rotate.None);
39
    private final Setting<InteractionUtility.Interact> interactMode = new Setting<>("Interact Mode", InteractionUtility.Interact.Vanilla);
40
    private final Setting<Float> placeRange = new Setting<>("Range", 5f, 1f, 6f);
41
    private final Setting<Float> placeWallRange = new Setting<>("WallRange", 5f, 1f, 6f);
42
    private final Setting<Integer> actionShift = new Setting<>("BLock Per Tick", 1, 1, 4);
43
    private final Setting<Integer> actionInterval = new Setting<>("Delay", 0, 0, 5);
44
    private final Setting<Boolean> jumpDisable = new Setting<>("Jump Disable", false);
45
    private final Setting<FillBlocks> blocks = new Setting<>("Blocks", FillBlocks.All);
46
47
    private final Setting<SettingGroup> fill = new Setting<>("Fill Holes", new SettingGroup(true, 0));
48
    private final Setting<Boolean> selfFill = new Setting<>("Self Fill", false).addToGroup(fill);
49
    private final Setting<SelfFillMode> selfFillMode = new Setting<>("Self Fill Mode", SelfFillMode.Burrow).addToGroup(fill);
50
    private final Setting<Boolean> fillSingle = new Setting<>("Single", true).addToGroup(fill);
51
    private final Setting<Boolean> fillDouble = new Setting<>("Double", false).addToGroup(fill);
52
    private final Setting<Boolean> fillQuad = new Setting<>("Quad", false).addToGroup(fill);
53
54
    private final Setting<Mode> mode = new Setting<>("Mode", Mode.Always);
55
    private final Setting<Float> rangeToTarget = new Setting<>("Range To Target", 2f, 1f, 5f, v -> mode.getValue() == Mode.Target);
56
    private final Setting<Boolean> autoDisable = new Setting<>("Auto Disable", false);
57
    private final Setting<InteractionUtility.PlaceMode> placeMode = new Setting<>("Place Mode", InteractionUtility.PlaceMode.Packet);
58
59
    private final Setting<SettingGroup> renderCategory = new Setting<>("Render", new SettingGroup(false, 0));
60
    private final Setting<BlockAnimationUtility.BlockRenderMode> renderMode = new Setting<>("Render Mode", BlockAnimationUtility.BlockRenderMode.All).addToGroup(renderCategory);
61
    private final Setting<BlockAnimationUtility.BlockAnimationMode> animationMode = new Setting<>("Animation Mode", BlockAnimationUtility.BlockAnimationMode.Fade).addToGroup(renderCategory);
62
    private final Setting<ColorSetting> renderFillColor = new Setting<>("Render Fill Color", new ColorSetting(HudEditor.getColor(0))).addToGroup(renderCategory);
63
    private final Setting<ColorSetting> renderLineColor = new Setting<>("Render Line Color", new ColorSetting(HudEditor.getColor(0))).addToGroup(renderCategory);
64
    private final Setting<Integer> renderLineWidth = new Setting<>("Render Line Width", 2, 1, 5).addToGroup(renderCategory);
65
66
    private enum Mode {
67
        Always,
68
        Target
69
    }
70
71
    private enum FillBlocks {
72
        All,
73
        Webs,
74
        Obsidian,
75
        Indestructible
76
    }
77
78
    private enum SelfFillMode {
79
        Burrow,
80
        Trap
81
    }
82
83
    private static final Vec3i[] HOLE_VECTORS = {
84
            new Vec3i(-1, 0, -1),
85
            new Vec3i(1, 0, -1),
86
            new Vec3i(-1, 0, 1),
87
            new Vec3i(1, 0, 1),
88
    };
89
90
    private boolean burrowWasEnabled = false;
91
    public static final Timer inactivityTimer = new Timer();
92
    private int tickCounter = 0;
93
    private boolean selfFillNeed = false;
94
95
    public HoleFill() {
96
        super("HoleFill", Category.COMBAT);
97
    }
98
99
    @Override
100
    public void onEnable() {
101
        burrowWasEnabled = false;
102
        selfFillNeed = false;
103
    }
104
105
    @EventHandler
106
    public void onTick(EventTick event) {
107
        if (fullNullCheck()) return;
108
        if (jumpDisable.getValue() && mc.player.yo < mc.player.getY())
109
            disable(isRu() ? "Вы прыгнули! Выключаю..." : "You jumped! Disabling...");
110
111
        if (tickCounter < actionInterval.getValue()) {
112
            tickCounter++;
113
            return;
114
        }
115
        if (HoleUtility.isHole(mc.player.blockPosition()) && mc.level.getBlockState(mc.player.blockPosition()).isAir()) {
116
            burrowWasEnabled = false;
117
        }
118
        int slot = getBlockSlot();
119
        if (slot == -1) return;
120
121
        List<BlockPos> holes = findHoles();
122
123
        Player target = Managers.COMBAT.getTargets(placeRange.getValue()).stream()
124
                .min(Comparator.comparing(e -> mc.player.distanceToSqr(e)))
125
                .orElse(null);
126
127
        if (mode.getValue() == Mode.Target && target == null)
128
            return;
129
130
        final Player predicted = PredictUtility.predictPlayer(target, 3);
131
132
        int blocksPlaced = 0;
133
134
        while (blocksPlaced < actionShift.getValue()) {
135
            BlockPos pos;
136
137
            if (mode.getValue() == Mode.Target) {
138
                pos = holes.stream()
139
                        .filter(this::isHole)
140
                        .filter(p -> mc.player.position().distanceTo(net.minecraft.world.phys.Vec3.atBottomCenterOf(p)) <= placeRange.getValue())
141
                        .filter(p -> predicted.position().distanceTo(net.minecraft.world.phys.Vec3.atBottomCenterOf(p)) <= rangeToTarget.getValue())
142
                        .filter(p -> {
143
                            if (p.equals(mc.player.blockPosition()) && selfFill.getValue()) {
144
                                selfFillNeed = true;
145
                                return true;
146
                            }
147
                            return InteractionUtility.canPlaceBlock(p, interactMode.getValue(), false);
148
                        })
149
                        .min(Comparator.comparing(p -> mc.player.position().distanceTo(net.minecraft.world.phys.Vec3.atBottomCenterOf(p))))
150
                        .orElse(null);
151
            } else {
152
                pos = holes.stream()
153
                        .filter(this::isHole)
154
                        .filter(p -> mc.player.position().distanceTo(net.minecraft.world.phys.Vec3.atBottomCenterOf(p)) <= placeRange.getValue())
155
                        .filter(p -> {
156
                            if (p.equals(mc.player.blockPosition()) && selfFill.getValue()) {
157
                                selfFillNeed = true;
158
                                return true;
159
                            }
160
                            return InteractionUtility.canPlaceBlock(p, interactMode.getValue(), false);
161
                        })
162
                        .min(Comparator.comparing(p -> mc.player.position().distanceTo(net.minecraft.world.phys.Vec3.atBottomCenterOf(p))))
163
                        .orElse(null);
164
            }
165
166
            if (pos != null) {
167
                List<BlockPos> poses = getHolePoses(pos).stream()
168
                        .filter(blockPos -> mc.player.position().distanceTo(net.minecraft.world.phys.Vec3.atBottomCenterOf(blockPos)) <= placeRange.getValue())
169
                        .toList();
170
                boolean broke = false;
171
172
                if (selfFillNeed && HoleUtility.isHole(mc.player.blockPosition())) {
173
                    switch (selfFillMode.getValue()) {
174
                        case Burrow -> {
175
                            if (ModuleManager.burrow.isEnabled() || burrowWasEnabled) {
176
                                return;
177
                            }
178
179
                            ModuleManager.burrow.enable();
180
                            selfFillNeed = false;
181
                            return;
182
                        }
183
                        case Trap -> {
184
                            BlockPos headPos = BlockPos.containing(mc.player.position()).above(2);
185
                            if (mc.level.getBlockState(headPos).canBeReplaced() && InteractionUtility.canPlaceBlock(headPos, interactMode.getValue(), false)) {
186
                                selfFillNeed = false;
187
                                InteractionUtility.placeBlock(headPos, rotate.getValue(), interactMode.getValue(), placeMode.getValue(), slot, true, false);
188
                                BlockAnimationUtility.renderBlock(headPos, renderLineColor.getValue().getColorObject(), renderLineWidth.getValue(), renderFillColor.getValue().getColorObject(), animationMode.getValue(), renderMode.getValue());
189
190
                                tickCounter = 0;
191
                                inactivityTimer.reset();
192
                                return;
193
                            } else {
194
                                boolean placed = false;
195
                                for (int i = 0; i < 3; i++) {
196
                                    for (Vec3i vecAdd : HoleUtility.VECTOR_PATTERN) {
197
                                        BlockPos checkPos = headPos.offset(vecAdd).below(i);
198
                                        if (!mc.level.getBlockState(checkPos).canBeReplaced()) {
199
                                            continue;
200
                                        }
201
                                        if (InteractionUtility.canPlaceBlock(checkPos, interactMode.getValue(), false)) {
202
                                            InteractionUtility.placeBlock(checkPos, rotate.getValue(), interactMode.getValue(), placeMode.getValue(), slot, true, false);
203
                                            blocksPlaced++;
204
                                            tickCounter = 0;
205
                                            inactivityTimer.reset();
206
                                            placed = true;
207
                                            break;
208
                                        }
209
                                    }
210
                                    if (placed) break;
211
                                }
212
                                if (placed) continue;
213
                            }
214
                        }
215
                    }
216
                }
217
218
                for (BlockPos blockPos : poses) {
219
                    if (InteractionUtility.placeBlock(blockPos, rotate.getValue(), interactMode.getValue(), placeMode.getValue(), slot, true, false)) {
220
                        blocksPlaced++;
221
                        tickCounter = 0;
222
                        BlockAnimationUtility.renderBlock(blockPos, renderLineColor.getValue().getColorObject(), renderLineWidth.getValue(), renderFillColor.getValue().getColorObject(), animationMode.getValue(), renderMode.getValue());
223
                        if (!mc.player.onGround()) return;
224
                        inactivityTimer.reset();
225
                    } else {
226
                        broke = true;
227
                        break;
228
                    }
229
                }
230
                if (broke)
231
                    break;
232
            } else {
233
                if (autoDisable.getValue()) {
234
                    disable(isRu() ? "Все холки заполнены!" : "All holes are filled!");
235
                }
236
                break;
237
            }
238
        }
239
    }
240
241
    private @NotNull @Unmodifiable List<BlockPos> getHolePoses(BlockPos fromPos) {
242
        if (HoleUtility.validQuadBedrock(fromPos) || HoleUtility.validQuadIndestructible(fromPos)) {
243
            for (Vec3i vec : HOLE_VECTORS) {
244
                if (mc.level.getBlockState(fromPos.offset(vec)).canBeReplaced()
245
                        && mc.level.getBlockState(fromPos.offset(vec.getX(), 0, 0)).canBeReplaced()
246
                        && mc.level.getBlockState(fromPos.offset(0, 0, vec.getZ())).canBeReplaced()) {
247
                    return List.of(
248
                            fromPos,
249
                            fromPos.offset(vec),
250
                            fromPos.offset(vec.getX(), 0, 0),
251
                            fromPos.offset(0, 0, vec.getZ())
252
                    );
253
                }
254
            }
255
        }
256
257
        if (HoleUtility.validTwoBlockBedrock(fromPos) || HoleUtility.validTwoBlockIndestructible(fromPos)) {
258
            for (Vec3i vec : HoleUtility.VECTOR_PATTERN) {
259
                if (mc.level.getBlockState(fromPos).canBeReplaced()
260
                        && mc.level.getBlockState(fromPos.offset(vec)).canBeReplaced()) {
261
                    return List.of(
262
                            fromPos,
263
                            fromPos.offset(vec)
264
                    );
265
                }
266
            }
267
        }
268
269
        return List.of(fromPos);
270
    }
271
272
    private @NotNull List<BlockPos> findHoles() {
273
        List<BlockPos> positions = new ArrayList<>();
274
        BlockPos centerPos = mc.player.blockPosition();
275
        int r = (int) Math.ceil(placeRange.getValue()) + 1;
276
        int h = placeRange.getValue().intValue();
277
278
        for (int i = centerPos.getX() - r; i < centerPos.getX() + r; i++) {
279
            for (int j = centerPos.getY() - h; j < centerPos.getY() + h; j++) {
280
                for (int k = centerPos.getZ() - r; k < centerPos.getZ() + r; k++) {
281
                    BlockPos pos = new BlockPos(i, j, k);
282
                    boolean foundEntity = false;
283
                    if (isHole(pos) && !isFillingNow(pos)) {
284
285
                        for (Player pe : Managers.ASYNC.getAsyncPlayers()) {
286
                            if (new AABB(pos).intersects(pe.getBoundingBox())) {
287
                                foundEntity = true;
288
                                break;
289
                            }
290
                        }
291
292
                        if (foundEntity)
293
                            continue;
294
295
                        BlockHitResult wallCheck = mc.level.clip(new ClipContext(InteractionUtility.getEyesPos(mc.player), net.minecraft.world.phys.Vec3.atBottomCenterOf(pos).relative(Direction.UP, 0.5f), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, mc.player));
296
                        if (wallCheck != null && wallCheck.getType() == HitResult.Type.BLOCK && wallCheck.getBlockPos() != pos)
297
                            if (InteractionUtility.squaredDistanceFromEyes(net.minecraft.world.phys.Vec3.atBottomCenterOf(pos)) > placeWallRange.getPow2Value())
298
                                continue;
299
                        positions.add(pos);
300
                    }
301
                }
302
            }
303
        }
304
305
        return positions;
306
    }
307
308
309
    private int getBlockSlot() {
310
        ItemStack stack = mc.player.getMainHandItem();
311
312
        if (!stack.isEmpty() && isValidItem(stack.getItem())) {
313
            return mc.player.getInventory().getSelectedSlot();
314
        } else {
315
            for (int i = 0; i < 9; ++i) {
316
                stack = mc.player.getInventory().getItem(i);
317
                if (!stack.isEmpty() && isValidItem(stack.getItem())) {
318
                    return i;
319
                }
320
            }
321
        }
322
323
        return -1;
324
    }
325
326
    private boolean isFillingNow(BlockPos pos) {
327
        return BlockAnimationUtility.isRendering(pos);
328
    }
329
330
    private boolean isValidItem(Item item) {
331
        if (item instanceof BlockItem) {
332
            Block block = ((BlockItem) item).getBlock();
333
            boolean isCorrectBlock;
334
335
            switch (blocks.getValue()) {
336
                case Webs -> isCorrectBlock = block == Blocks.COBWEB;
337
                case Obsidian -> isCorrectBlock = block == Blocks.OBSIDIAN;
338
                case Indestructible -> isCorrectBlock = block == Blocks.OBSIDIAN
339
                        || block == Blocks.CRYING_OBSIDIAN
340
                        || block == Blocks.NETHERITE_BLOCK
341
                        || block == Blocks.RESPAWN_ANCHOR;
342
                default -> isCorrectBlock = true;
343
            }
344
345
            return isCorrectBlock;
346
        }
347
348
        return false;
349
    }
350
351
    private boolean isHole(BlockPos pos) {
352
        return ((HoleUtility.validTwoBlockIndestructible(pos) || HoleUtility.validTwoBlockBedrock(pos)) && fillDouble.getValue())
353
                || ((HoleUtility.validQuadBedrock(pos) || HoleUtility.validQuadIndestructible(pos)) && fillQuad.getValue())
354
                || ((HoleUtility.validBedrock(pos) || HoleUtility.validIndestructible(pos)) && fillSingle.getValue());
355
    }
356
}