Phase module

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

3 implementationsMOVEMENTEXPLOIT

Full module source: 3 implementations

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

MelaHack (ThunderHack fork)MOVEMENTsrc/main/java/thunder/hack/features/modules/movement/Phase.javaJava · 242 lines · 11.4 KB

Allows you to walk in the walls.

SettingsModeSilentWaitBreakOnlyOnGroundAutoDisableBreakTimeoutPearlTimeoutPitchStrict
Phase.javaJava · Minecraft 26.2 · 242 lines · 11.4 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.movement;
2
3
import meteordevelopment.orbit.EventHandler;
4
import net.minecraft.core.BlockPos;
5
import net.minecraft.core.Direction;
6
import net.minecraft.network.protocol.game.*;
7
import net.minecraft.world.InteractionHand;
8
import net.minecraft.world.item.Items;
9
import net.minecraft.world.level.ClipContext;
10
import net.minecraft.world.level.block.Blocks;
11
import net.minecraft.world.phys.AABB;
12
import net.minecraft.world.phys.HitResult;
13
import thunder.hack.core.manager.client.ModuleManager;
14
import thunder.hack.events.impl.EventBreakBlock;
15
import thunder.hack.events.impl.EventCollision;
16
import thunder.hack.events.impl.EventPostSync;
17
import thunder.hack.events.impl.EventSync;
18
import thunder.hack.features.modules.Module;
19
import thunder.hack.setting.Setting;
20
import thunder.hack.utility.player.InteractionUtility;
21
import thunder.hack.utility.player.InventoryUtility;
22
import thunder.hack.utility.player.MovementUtility;
23
24
import static thunder.hack.features.modules.player.AutoTool.getTool;
25
26
public class Phase extends Module {
27
    public Phase() {
28
        super("Phase", Category.MOVEMENT);
29
    }
30
31
    private final Setting<Mode> mode = new Setting<>("Mode", Mode.Vanilla);
32
    private final Setting<Boolean> silent = new Setting<>("Silent", false, v -> mode.getValue() == Mode.Sunrise);
33
    private final Setting<Boolean> waitBreak = new Setting<>("WaitBreak", true, v -> mode.getValue() == Mode.Sunrise);
34
    private final Setting<Boolean> onlyOnGround = new Setting<>("OnlyOnGround", false, v -> mode.is(Mode.Pearl));
35
    private final Setting<Boolean> autoDisable = new Setting<>("AutoDisable", false, v -> mode.getValue() == Mode.Pearl);
36
    private final Setting<Integer> afterBreak = new Setting<>("BreakTimeout", 4, 1, 20, v -> mode.getValue() == Mode.Sunrise && waitBreak.getValue());
37
    private final Setting<Integer> afterPearl = new Setting<>("PearlTimeout", 0, 0, 60, v -> mode.getValue() == Mode.Pearl);
38
    private final Setting<Float> pitch = new Setting<>("Pitch", 80f, 0f, 90f, v -> mode.getValue() == Mode.Pearl);
39
    private final Setting<Boolean> strict = new Setting<>("Strict", false, v -> mode.is(Mode.ForceMine));
40
41
    public int clipTimer;
42
    public int afterPearlTime;
43
44
    private enum Mode {
45
        Vanilla, Pearl, Sunrise, ForceMine, CCClip
46
    }
47
48
    @EventHandler
49
    public void onCollide(EventCollision e) {
50
        if (fullNullCheck())
51
            return;
52
        BlockPos playerPos = BlockPos.containing(mc.player.position());
53
54
        if (!mode.is(Mode.CCClip) && !mode.is(Mode.Pearl) && !mode.is(Mode.ForceMine) && canNoClip() || afterPearlTime > 0) {
55
            if (!e.getPos().equals(playerPos.below()) || mc.options.keyShift.isDown())
56
                e.setState(Blocks.AIR.defaultBlockState());
57
        }
58
59
        if (mode.is(Mode.ForceMine)) {
60
            float xDelta = Math.abs(playerPos.getX() - e.getPos().getX());
61
            float zDelta = Math.abs(playerPos.getZ() - e.getPos().getZ());
62
63
            if (xDelta != 0 && zDelta != 0 && strict.getValue())
64
                  return;
65
66
            if (!e.getPos().equals(playerPos.below()) || mc.options.keyShift.isDown())
67
                e.setState(Blocks.AIR.defaultBlockState());
68
        }
69
    }
70
71
    @Override
72
    public void onEnable() {
73
        afterPearlTime = 0;
74
        clipTimer = 0;
75
76
        if (mc.player.onGround() && mode.is(Mode.CCClip)) {
77
            double[] diagonalOffset = MovementUtility.forwardWithoutStrafe(0.44);
78
            boolean diagonal = mc.player.getYRot() % 90 > 35 && mc.player.getYRot() % 90 < 55;
79
80
            sendPacket(new ServerboundPlayerCommandPacket(mc.player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
81
82
            if (diagonal) {
83
                double[] directionVec = MovementUtility.forwardWithoutStrafe(0.51);
84
85
                int height = mc.level.clip(
86
                        new ClipContext(mc.player.getEyePosition(), mc.player.getEyePosition().add(diagonalOffset[0],0, diagonalOffset[1]), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, mc.player)
87
                ).getType().equals(HitResult.Type.MISS) ? 1 : 2;
88
89
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY() + height, mc.player.getZ() + directionVec[1]);
90
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
91
92
                height = mc.level.isEmptyBlock(BlockPos.containing(mc.player.position().add(diagonalOffset[0], -2, diagonalOffset[1]))) ? 2 : 1;
93
94
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY() - height, mc.player.getZ() + directionVec[1]);
95
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
96
                disable("diagonal");
97
98
            } else {
99
                double[] directionVec = MovementUtility.forwardWithoutStrafe(0.57);
100
101
                int height = mc.level.clip(
102
                        new ClipContext(mc.player.getEyePosition(), mc.player.getEyePosition().add(diagonalOffset[0],0, diagonalOffset[1]), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, mc.player)
103
                ).getType().equals(HitResult.Type.MISS) ? 1 : 2;
104
105
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY() + height, mc.player.getZ() + directionVec[1]);
106
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
107
108
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY(), mc.player.getZ() + directionVec[1]);
109
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
110
111
                height = mc.level.isEmptyBlock(BlockPos.containing(mc.player.position().add(diagonalOffset[0], -2, diagonalOffset[1]))) ? 2 : 1;
112
113
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY() - height, mc.player.getZ() + directionVec[1]);
114
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
115
                disable("normal");
116
            }
117
        }
118
    }
119
120
    @EventHandler
121
    public void onSync(EventSync e) {
122
        if (fullNullCheck()) return;
123
        if (clipTimer > 0) clipTimer--;
124
        if (afterPearlTime > 0) afterPearlTime--;
125
126
        if (mode.getValue() == Mode.Sunrise && (mc.player.horizontalCollision || playerInsideBlock()) && !mc.player.isUnderWater() && !mc.player.isInLava() && clipTimer <= 0) {
127
            double[] dir = MovementUtility.forward(0.5);
128
129
            BlockPos blockToBreak = null;
130
131
            if (mc.options.keyJump.isDown()) {
132
                blockToBreak = BlockPos.containing(mc.player.getX() + dir[0], mc.player.getY() + 2, mc.player.getZ() + dir[1]);
133
            } else if (mc.options.keyShift.isDown()) {
134
                blockToBreak = BlockPos.containing(mc.player.getX() + dir[0], mc.player.getY() - 1, mc.player.getZ() + dir[1]);
135
            } else if (MovementUtility.isMoving()) {
136
                blockToBreak = BlockPos.containing(mc.player.getX() + dir[0], mc.player.getY(), mc.player.getZ() + dir[1]);
137
            }
138
139
            if (blockToBreak == null) return;
140
            int best_tool = getTool(blockToBreak);
141
            if (best_tool == -1) return;
142
143
            int prevItem = mc.player.getInventory().getSelectedSlot();
144
145
            InventoryUtility.switchTo(best_tool);
146
            mc.gameMode.continueDestroyBlock(blockToBreak, mc.player.getDirection());
147
            mc.player.swing(InteractionHand.MAIN_HAND);
148
            if (silent.getValue())
149
                InventoryUtility.switchTo(prevItem);
150
        }
151
152
        if (mode.getValue() == Mode.ForceMine && (mc.player.horizontalCollision || playerInsideBlock()) && !mc.player.isUnderWater() && !mc.player.isInLava())
153
            for (int x = -2; x < 2; x++)
154
                for (int y = -1; y < 3; y++)
155
                    for (int z = -2; z < 2; z++) {
156
                        if (((x == 0 && y == 0 && z == 0) || (x == 0 && y == 1 && z == 0)) && !mc.options.keyShift.isDown())
157
                            continue;
158
159
                        BlockPos bp = BlockPos.containing(mc.player.position()).offset(x, y, z);
160
                        if (mc.player.getBoundingBox().intersects(new AABB(bp)) && !mc.level.isEmptyBlock(bp))
161
                            sendPacket(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, bp, Direction.UP));
162
                    }
163
164
165
166
        if (mode.getValue() == Mode.Pearl && (mc.player.onGround() || !onlyOnGround.getValue())) {
167
            if (mc.player.horizontalCollision && !playerInsideBlock() && clipTimer <= 0 && mc.player.tickCount > 60) {
168
                double[] dir = MovementUtility.forward(0.5);
169
                BlockPos block = BlockPos.containing(mc.player.getX() + dir[0], mc.player.getY(), mc.player.getZ() + dir[1]);
170
171
                if (mc.options.keyShift.isDown())
172
                    return;
173
174
                float[] angle = InteractionUtility.calculateAngle(net.minecraft.world.phys.Vec3.atBottomCenterOf(block));
175
                int epSlot = findEPSlot();
176
177
                if (epSlot != -1) {
178
                    ModuleManager.autoCrystal.pause();
179
                    ModuleManager.aura.pause();
180
                    mc.player.setYRot(angle[0]);
181
                    mc.player.setXRot(pitch.getValue());
182
                }
183
            }
184
        }
185
    }
186
187
    @EventHandler
188
    public void onPostSync(EventPostSync e) {
189
        if (mode.getValue() == Mode.Pearl && (mc.player.onGround() || !onlyOnGround.getValue())) {
190
            if (mc.player.horizontalCollision && !playerInsideBlock() && clipTimer <= 0 && mc.player.tickCount > 60) {
191
                if (mc.options.keyShift.isDown())
192
                    return;
193
194
                int epSlot = findEPSlot();
195
                int prevItem = mc.player.getInventory().getSelectedSlot();
196
197
                if (epSlot != -1) {
198
                    InventoryUtility.switchTo(epSlot);
199
                    sendSequencedPacket(id -> new ServerboundUseItemPacket(InteractionHand.MAIN_HAND, id, mc.player.getYRot(), mc.player.getXRot()));
200
                    sendPacket(new ServerboundSwingPacket(InteractionHand.MAIN_HAND));
201
                    InventoryUtility.switchTo(prevItem);
202
                    if (autoDisable.getValue())
203
                        disable();
204
                }
205
                clipTimer = 20;
206
                afterPearlTime = afterPearl.getValue();
207
            }
208
        }
209
    }
210
211
    private int findEPSlot() {
212
        int epSlot = -1;
213
        if (mc.player.getMainHandItem().getItem() == Items.ENDER_PEARL) {
214
            epSlot = mc.player.getInventory().getSelectedSlot();
215
        }
216
        if (epSlot == -1) {
217
            for (int l = 0; l < 9; ++l) {
218
                if (mc.player.getInventory().getItem(l).getItem() == Items.ENDER_PEARL) {
219
                    epSlot = l;
220
                    break;
221
                }
222
            }
223
        }
224
        return epSlot;
225
    }
226
227
    public boolean canNoClip() {
228
        if (mode.is(Mode.Vanilla)) return true;
229
        if (!waitBreak.getValue()) return true;
230
        return clipTimer != 0;
231
    }
232
233
    public boolean playerInsideBlock() {
234
        return !mc.level.isEmptyBlock(BlockPos.containing(mc.player.position()));
235
    }
236
237
    @EventHandler
238
    public void onBreakBlock(EventBreakBlock e) {
239
        clipTimer = afterBreak.getValue();
240
    }
241
}
242
CombatantMOVEMENTsrc/main/java/combatant/client/features/module/modules/movement/Phase.javaJava · 368 lines · 16.1 KB
Settingsmodesilentwait_breakbreak_timeoutonly_on_groundauto_disablepearl_timeoutpitchstrict
Phase.javaJava · Minecraft 26.2 · 368 lines · 16.1 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Combatant Client distribution.
3
 * Copyright (c) 2026 pivosos2007.
4
 * Portions derived from ThunderHack Recode, copyright (c) 2023-2024 Pan4ur & 06ED.
5
 * Upstream: https://github.com/Pan4ur/ThunderHack-Recode
6
 *
7
 * Licensed under the GNU General Public License v3.0.
8
 */
9
10
package combatant.client.features.module.modules.movement;
11
12
import net.minecraft.client.Minecraft;
13
import net.minecraft.core.BlockPos;
14
import net.minecraft.core.Direction;
15
import net.minecraft.core.Holder;
16
import net.minecraft.core.Registry;
17
import net.minecraft.core.registries.Registries;
18
import net.minecraft.network.protocol.Packet;
19
import net.minecraft.network.protocol.game.*;
20
import net.minecraft.resources.ResourceKey;
21
import net.minecraft.world.InteractionHand;
22
import net.minecraft.world.item.ItemStack;
23
import net.minecraft.world.item.enchantment.Enchantment;
24
import net.minecraft.world.item.enchantment.EnchantmentHelper;
25
import net.minecraft.world.item.enchantment.Enchantments;
26
import net.minecraft.world.level.ClipContext;
27
import net.minecraft.world.level.block.Blocks;
28
import net.minecraft.world.level.block.state.BlockState;
29
import net.minecraft.world.phys.AABB;
30
import net.minecraft.world.phys.HitResult;
31
import net.minecraft.world.phys.Vec3;
32
import combatant.client.config.values.BooleanValue;
33
import combatant.client.config.values.EnumValue;
34
import combatant.client.config.values.NumberValue;
35
import combatant.client.events.EventHandler;
36
import combatant.client.events.impl.EventBreakBlock;
37
import combatant.client.events.impl.EventCollision;
38
import combatant.client.events.impl.EventPostSync;
39
import combatant.client.events.impl.EventSync;
40
import combatant.client.features.module.Module;
41
import combatant.client.features.module.ModuleCategory;
42
import combatant.client.features.module.ModuleInfo;
43
import combatant.client.mixins.accessors.PlayerInventoryAccessor;
44
import combatant.client.util.player.InteractionUtil;
45
import combatant.client.util.player.MovementUtil;
46
import combatant.client.util.player.inventory.InventorySwap;
47
48
@Deprecated
49
//todo Description
50
//работает только на ванилах без ач
51
@ModuleInfo(
52
        id = "phase",
53
        displayName = "Phase",
54
        category = ModuleCategory.MOVEMENT
55
)
56
public class Phase extends Module {
57
58
    private final EnumValue<Mode> mode =
59
            enumSetting("mode", "mode", Mode.VANILLA, Mode.values());
60
    private final BooleanValue silent =
61
            visibleWhen(bool("silent", false), () -> mode.get() == Mode.BREAK_ASSIST);
62
    private final BooleanValue waitBreak =
63
            visibleWhen(bool("wait_break", true), () -> mode.get() == Mode.BREAK_ASSIST);
64
    private final NumberValue<Integer> afterBreak =
65
            visibleWhen(num("break_timeout", 4, 1, 20), () -> mode.get() == Mode.BREAK_ASSIST && waitBreak.get());
66
    private final BooleanValue onlyOnGround =
67
            visibleWhen(bool("only_on_ground", false), () -> mode.get() == Mode.PEARL);
68
    private final BooleanValue autoDisable =
69
            visibleWhen(bool("auto_disable", false), () -> mode.get() == Mode.PEARL);
70
    private final NumberValue<Integer> afterPearl =
71
            visibleWhen(num("pearl_timeout", 0, 0, 60), () -> mode.get() == Mode.PEARL);
72
    private final NumberValue<Float> pitch =
73
            visibleWhen(num("pitch", 80f, 0f, 90f), () -> mode.get() == Mode.PEARL);
74
    private final BooleanValue strict =
75
            visibleWhen(bool("strict", false), () -> mode.get() == Mode.FORCE_MINE);
76
    public int clipTimer;
77
    public int afterPearlTime;
78
79
    @Override
80
    public void onEnable() {
81
        afterPearlTime = 0;
82
        clipTimer = 0;
83
84
        Minecraft mc = Minecraft.getInstance();
85
        if (mc == null || mc.player == null || mc.level == null) return;
86
87
        if (mc.player.onGround() && mode.get() == Mode.CC_CLIP) {
88
            double[] diagonalOffset = MovementUtil.forwardWithoutStrafe(0.44);
89
            boolean diagonal = mc.player.getYRot() % 90 > 35 && mc.player.getYRot() % 90 < 55;
90
91
            sendPacket(new ServerboundPlayerCommandPacket(mc.player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
92
93
            if (diagonal) {
94
                double[] directionVec = MovementUtil.forwardWithoutStrafe(0.51);
95
96
                int height = mc.level.clip(
97
                        new ClipContext(
98
                                mc.player.getEyePosition(),
99
                                mc.player.getEyePosition().add(diagonalOffset[0], 0, diagonalOffset[1]),
100
                                ClipContext.Block.COLLIDER,
101
                                ClipContext.Fluid.NONE,
102
                                mc.player
103
                        )
104
                ).getType().equals(HitResult.Type.MISS) ? 1 : 2;
105
106
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY() + height, mc.player.getZ() + directionVec[1]);
107
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
108
109
                height = mc.level.isEmptyBlock(BlockPos.containing(mc.player.position().add(diagonalOffset[0], -2, diagonalOffset[1]))) ? 2 : 1;
110
111
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY() - height, mc.player.getZ() + directionVec[1]);
112
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
113
                setEnabled(false);
114
            } else {
115
                double[] directionVec = MovementUtil.forwardWithoutStrafe(0.57);
116
117
                int height = mc.level.clip(
118
                        new ClipContext(
119
                                mc.player.getEyePosition(),
120
                                mc.player.getEyePosition().add(diagonalOffset[0], 0, diagonalOffset[1]),
121
                                ClipContext.Block.COLLIDER,
122
                                ClipContext.Fluid.NONE,
123
                                mc.player
124
                        )
125
                ).getType().equals(HitResult.Type.MISS) ? 1 : 2;
126
127
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY() + height, mc.player.getZ() + directionVec[1]);
128
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
129
130
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY(), mc.player.getZ() + directionVec[1]);
131
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
132
133
                height = mc.level.isEmptyBlock(BlockPos.containing(mc.player.position().add(diagonalOffset[0], -2, diagonalOffset[1]))) ? 2 : 1;
134
135
                mc.player.setPos(mc.player.getX() + directionVec[0], mc.player.getY() - height, mc.player.getZ() + directionVec[1]);
136
                sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.getX(), mc.player.getY(), mc.player.getZ(), true, mc.player.horizontalCollision));
137
                setEnabled(false);
138
            }
139
        }
140
    }
141
142
    @EventHandler
143
    public void onCollide(EventCollision e) {
144
        Minecraft mc = Minecraft.getInstance();
145
        if (mc == null || mc.player == null || mc.level == null) return;
146
147
        BlockPos playerPos = BlockPos.containing(mc.player.position());
148
149
        if ((!isMode(Mode.CC_CLIP) && !isMode(Mode.PEARL) && !isMode(Mode.FORCE_MINE) && canNoClip()) || afterPearlTime > 0) {
150
            if (!e.getPos().equals(playerPos.below()) || mc.options.keyShift.isDown()) {
151
                e.setState(Blocks.AIR.defaultBlockState());
152
            }
153
        }
154
155
        if (isMode(Mode.FORCE_MINE)) {
156
            float xDelta = Math.abs(playerPos.getX() - e.getPos().getX());
157
            float zDelta = Math.abs(playerPos.getZ() - e.getPos().getZ());
158
159
            if (xDelta != 0 && zDelta != 0 && strict.get()) {
160
                return;
161
            }
162
163
            if (!e.getPos().equals(playerPos.below()) || mc.options.keyShift.isDown()) {
164
                e.setState(Blocks.AIR.defaultBlockState());
165
            }
166
        }
167
    }
168
169
    @EventHandler
170
    public void onSync(EventSync e) {
171
        Minecraft mc = Minecraft.getInstance();
172
        if (mc == null || mc.player == null || mc.level == null) return;
173
174
        if (clipTimer > 0) clipTimer--;
175
        if (afterPearlTime > 0) afterPearlTime--;
176
177
        if (isMode(Mode.BREAK_ASSIST)
178
                && (mc.player.horizontalCollision || playerInsideBlock())
179
                && !mc.player.isUnderWater()
180
                && !mc.player.isInLava()
181
                && clipTimer <= 0) {
182
            double[] dir = MovementUtil.forward(0.5);
183
184
            BlockPos blockToBreak = null;
185
186
            if (mc.options.keyJump.isDown()) {
187
                blockToBreak = BlockPos.containing(mc.player.getX() + dir[0], mc.player.getY() + 2, mc.player.getZ() + dir[1]);
188
            } else if (mc.options.keyShift.isDown()) {
189
                blockToBreak = BlockPos.containing(mc.player.getX() + dir[0], mc.player.getY() - 1, mc.player.getZ() + dir[1]);
190
            } else if (MovementUtil.isMoving()) {
191
                blockToBreak = BlockPos.containing(mc.player.getX() + dir[0], mc.player.getY(), mc.player.getZ() + dir[1]);
192
            }
193
194
            if (blockToBreak == null) return;
195
            int bestTool = findBestTool(blockToBreak);
196
            if (bestTool == -1) return;
197
198
            int prevItem = ((PlayerInventoryAccessor) mc.player.getInventory()).combatant$getSelectedSlot();
199
            InventorySwap.INSTANCE.selectHotbar(bestTool);
200
            final BlockPos target = blockToBreak;
201
            final Direction face = mc.player.getDirection();
202
            InteractionUtil.sendSequencedPacket(id ->
203
                    new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, target, face, id));
204
            InteractionUtil.sendSequencedPacket(id ->
205
                    new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, target, face, id));
206
            mc.player.swing(InteractionHand.MAIN_HAND);
207
            if (silent.get()) InventorySwap.INSTANCE.selectHotbar(prevItem);
208
        }
209
210
        if (isMode(Mode.FORCE_MINE)
211
                && (mc.player.horizontalCollision || playerInsideBlock())
212
                && !mc.player.isUnderWater()
213
                && !mc.player.isInLava()) {
214
            for (int x = -2; x < 2; x++) {
215
                for (int y = -1; y < 3; y++) {
216
                    for (int z = -2; z < 2; z++) {
217
                        if (((x == 0 && y == 0 && z == 0) || (x == 0 && y == 1 && z == 0)) && !mc.options.keyShift.isDown()) {
218
                            continue;
219
                        }
220
221
                        BlockPos bp = BlockPos.containing(mc.player.position()).offset(x, y, z);
222
                        if (mc.player.getBoundingBox().intersects(new AABB(bp)) && !mc.level.isEmptyBlock(bp)) {
223
                            sendPacket(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.STOP_DESTROY_BLOCK, bp, Direction.UP));
224
                        }
225
                    }
226
                }
227
            }
228
        }
229
230
        if (isMode(Mode.PEARL) && (mc.player.onGround() || !onlyOnGround.get())) {
231
            if (mc.player.horizontalCollision && !playerInsideBlock() && clipTimer <= 0 && mc.player.tickCount > 60) {
232
                double[] dir = MovementUtil.forward(0.5);
233
                BlockPos block = BlockPos.containing(mc.player.getX() + dir[0], mc.player.getY(), mc.player.getZ() + dir[1]);
234
235
                if (mc.options.keyShift.isDown()) return;
236
237
                float[] angle = InteractionUtil.calculateAngle(Vec3.atCenterOf(block));
238
                int epSlot = findEPSlot();
239
240
                if (epSlot != -1) {
241
                    mc.player.setYRot(angle[0]);
242
                    mc.player.setXRot(pitch.get());
243
                }
244
            }
245
        }
246
    }
247
248
    @EventHandler
249
    public void onPostSync(EventPostSync e) {
250
        Minecraft mc = Minecraft.getInstance();
251
        if (mc == null || mc.player == null || mc.level == null) return;
252
253
        if (isMode(Mode.PEARL) && (mc.player.onGround() || !onlyOnGround.get())) {
254
            if (mc.player.horizontalCollision && !playerInsideBlock() && clipTimer <= 0 && mc.player.tickCount > 60) {
255
                if (mc.options.keyShift.isDown()) return;
256
257
                int epSlot = findEPSlot();
258
                int prevItem = ((PlayerInventoryAccessor) mc.player.getInventory()).combatant$getSelectedSlot();
259
260
                if (epSlot != -1) {
261
                    InventorySwap.INSTANCE.selectHotbar(epSlot);
262
                    InteractionUtil.sendSequencedPacket(id ->
263
                            new ServerboundUseItemPacket(InteractionHand.MAIN_HAND, id, mc.player.getYRot(), mc.player.getXRot()));
264
                    sendPacket(new ServerboundSwingPacket(InteractionHand.MAIN_HAND));
265
                    InventorySwap.INSTANCE.selectHotbar(prevItem);
266
                    if (autoDisable.get()) {
267
                        setEnabled(false);
268
                    }
269
                }
270
                clipTimer = 20;
271
                afterPearlTime = afterPearl.get();
272
            }
273
        }
274
    }
275
276
    @EventHandler
277
    public void onBreakBlock(EventBreakBlock e) {
278
        clipTimer = afterBreak.get();
279
    }
280
281
    public boolean canNoClip() {
282
        if (isMode(Mode.VANILLA)) return true;
283
        if (!waitBreak.get()) return true;
284
        return clipTimer != 0;
285
    }
286
287
    public boolean playerInsideBlock() {
288
        Minecraft mc = Minecraft.getInstance();
289
        if (mc == null || mc.player == null || mc.level == null) return false;
290
        return !mc.level.isEmptyBlock(BlockPos.containing(mc.player.position()));
291
    }
292
293
    private int findEPSlot() {
294
        Minecraft mc = Minecraft.getInstance();
295
        if (mc == null || mc.player == null) return -1;
296
        int epSlot = -1;
297
        if (mc.player.getMainHandItem().getItem() == net.minecraft.world.item.Items.ENDER_PEARL) {
298
            epSlot = ((PlayerInventoryAccessor) mc.player.getInventory()).combatant$getSelectedSlot();
299
        }
300
        if (epSlot == -1) {
301
            for (int i = 0; i < 9; ++i) {
302
                if (mc.player.getInventory().getItem(i).getItem() == net.minecraft.world.item.Items.ENDER_PEARL) {
303
                    epSlot = i;
304
                    break;
305
                }
306
            }
307
        }
308
        return epSlot;
309
    }
310
311
    private boolean isMode(Mode target) {
312
        return mode.get() == target;
313
    }
314
315
    private void sendPacket(Packet<?> packet) {
316
        Minecraft mc = Minecraft.getInstance();
317
        if (mc == null || mc.getConnection() == null || packet == null) return;
318
        mc.getConnection().send(packet);
319
    }
320
321
    private int findBestTool(BlockPos pos) {
322
        Minecraft mc = Minecraft.getInstance();
323
        if (mc == null || mc.player == null || mc.level == null) return -1;
324
325
        BlockState state = mc.level.getBlockState(pos);
326
        if (state.isAir()) return -1;
327
328
        int slot = -1;
329
        float best = 1.0f;
330
        for (int i = 0; i < 9; i++) {
331
            ItemStack stack = mc.player.getInventory().getItem(i);
332
            if (stack == null || stack.isEmpty()) continue;
333
334
            int level = 0;
335
            Holder<Enchantment> entry = entryOf(Enchantments.EFFICIENCY);
336
            if (entry != null) {
337
                level = EnchantmentHelper.getItemEnchantmentLevel(entry, stack);
338
            }
339
            float digSpeed = level;
340
            float destroySpeed = stack.getDestroySpeed(state);
341
            float score = digSpeed + destroySpeed;
342
            if (score > best) {
343
                best = score;
344
                slot = i;
345
            }
346
        }
347
        return slot;
348
    }
349
350
    private Holder<Enchantment> entryOf(ResourceKey<Enchantment> key) {
351
        Minecraft mc = Minecraft.getInstance();
352
        if (mc == null || mc.level == null || key == null) return null;
353
        Registry<Enchantment> registry =
354
                mc.level.registryAccess().lookupOrThrow(Registries.ENCHANTMENT);
355
        Enchantment value = registry.getValue(key);
356
        if (value == null) return null;
357
        return registry.wrapAsHolder(value);
358
    }
359
360
    public enum Mode {
361
        VANILLA,
362
        PEARL,
363
        BREAK_ASSIST,
364
        FORCE_MINE,
365
        CC_CLIP
366
    }
367
}
368
LiquidBounce (Kotlin)EXPLOITsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/exploit/phase/ModulePhase.ktKotlin · 41 lines · 1.6 KB

Allows you to phase through blocks by exploiting the anti-cheat.

ModulePhase.ktKotlin · Minecraft 26.2 · 41 lines · 1.6 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.exploit.phase
20
21
import net.ccbluex.liquidbounce.features.module.ClientModule
22
import net.ccbluex.liquidbounce.features.module.ModuleCategories
23
import net.ccbluex.liquidbounce.features.module.modules.exploit.phase.modes.PhaseBlink
24
import net.ccbluex.liquidbounce.features.module.modules.exploit.phase.modes.PhaseBlocksMC
25
import net.ccbluex.liquidbounce.features.module.modules.exploit.phase.modes.PhaseHypixel
26
import net.ccbluex.liquidbounce.features.module.modules.exploit.phase.modes.PhaseIntave
27
28
/**
29
 * Module Phase.
30
 *
31
 * Phases you through blocks.
32
 */
33
object ModulePhase : ClientModule("Phase", ModuleCategories.EXPLOIT) {
34
35
    val mode = choices(
36
        "Mode", PhaseHypixel, arrayOf(
37
            PhaseHypixel, PhaseIntave, PhaseBlink, PhaseBlocksMC
38
        )
39
    ).apply { tagBy(this) }
40
}
41