step module

step: Minecraft 26.3 cheat module, full source for every implementation (5 clients: Meteor Client, MelaHack (ThunderHack fork), OfflineClient, …).

5 implementationsMovementMOVEMENT

Full module source: 5 implementations

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

Meteor ClientMovementsrc/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.javaJava · 163 lines · 5.7 KB

Allows you to walk up full blocks instantly.

Settingsheightactive-whensafe-stepstep-health
Step.javaJava · Minecraft 26.2 · 163 lines · 5.7 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.movement;
7
8
import com.google.common.collect.Streams;
9
import meteordevelopment.meteorclient.events.world.TickEvent;
10
import meteordevelopment.meteorclient.mixininterface.IVec3;
11
import meteordevelopment.meteorclient.pathing.PathManagers;
12
import meteordevelopment.meteorclient.settings.*;
13
import meteordevelopment.meteorclient.systems.modules.Categories;
14
import meteordevelopment.meteorclient.systems.modules.Module;
15
import meteordevelopment.meteorclient.utils.entity.DamageUtils;
16
import meteordevelopment.orbit.EventHandler;
17
import net.minecraft.world.entity.Entity;
18
import net.minecraft.world.entity.ai.attributes.Attributes;
19
import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
20
import net.minecraft.world.phys.AABB;
21
import net.minecraft.world.phys.Vec2;
22
import net.minecraft.world.phys.Vec3;
23
24
import java.util.OptionalDouble;
25
26
public class Step extends Module {
27
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
28
29
    public final Setting<Double> height = sgGeneral.add(new DoubleSetting.Builder()
30
        .name("height")
31
        .description("Step height.")
32
        .defaultValue(1.25)
33
        .min(0)
34
        .build()
35
    );
36
37
    private final Setting<ActiveWhen> activeWhen = sgGeneral.add(new EnumSetting.Builder<ActiveWhen>()
38
        .name("active-when")
39
        .description("Step is active when you meet these requirements.")
40
        .defaultValue(ActiveWhen.Always)
41
        .build()
42
    );
43
44
    private final Setting<Boolean> safeStep = sgGeneral.add(new BoolSetting.Builder()
45
        .name("safe-step")
46
        .description("Doesn't let you step out of a hole if you are low on health or there is a crystal nearby.")
47
        .defaultValue(false)
48
        .build()
49
    );
50
51
    private final Setting<Integer> stepHealth = sgGeneral.add(new IntSetting.Builder()
52
        .name("step-health")
53
        .description("The health you stop being able to step at.")
54
        .defaultValue(5)
55
        .range(1, 36)
56
        .sliderRange(1, 36)
57
        .visible(safeStep::get)
58
        .build()
59
    );
60
61
    private float prevStepHeight;
62
    private boolean prevPathManagerStep;
63
64
    public Step() {
65
        super(Categories.Movement, "step", "Allows you to walk up full blocks instantly.");
66
    }
67
68
    @Override
69
    public void onActivate() {
70
        prevStepHeight = mc.player.maxUpStep();
71
72
        prevPathManagerStep = PathManagers.get().getSettings().getStep().get();
73
        PathManagers.get().getSettings().getStep().set(true);
74
    }
75
76
    @EventHandler
77
    private void onTick(TickEvent.Post event) {
78
        boolean work = (activeWhen.get() == ActiveWhen.Always) || (activeWhen.get() == ActiveWhen.Sneaking && mc.player.isShiftKeyDown()) || (activeWhen.get() == ActiveWhen.NotSneaking && !mc.player.isShiftKeyDown());
79
        double height = getMaxSafeHeight();
80
        if (work && height > 0) {
81
            mc.player.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(height);
82
        } else {
83
            mc.player.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(prevStepHeight);
84
        }
85
    }
86
87
    @Override
88
    public void onDeactivate() {
89
        mc.player.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(prevStepHeight);
90
91
        PathManagers.get().getSettings().getStep().set(prevPathManagerStep);
92
    }
93
94
    private float getHealth() {
95
        return mc.player.getHealth() + mc.player.getAbsorptionAmount();
96
    }
97
98
    private double getExplosionDamage() {
99
        OptionalDouble crystalDamage = Streams.stream(mc.level.entitiesForRendering())
100
            .filter(EndCrystal.class::isInstance)
101
            .filter(Entity::isAlive)
102
            .mapToDouble(entity -> DamageUtils.crystalDamage(mc.player, entity.position()))
103
            .max();
104
        return crystalDamage.orElse(0.0);
105
    }
106
107
    private boolean isSafe() {
108
        return getHealth() > stepHealth.get() && getHealth() - getExplosionDamage() > stepHealth.get();
109
    }
110
111
    private boolean isSaferThanWith(double damage) {
112
        return isSafe() || getExplosionDamage() - damage <= 0;
113
    }
114
115
    private double getMaxSafeHeight() {
116
        if (!safeStep.get()) return height.get();
117
118
        double max = height.get();
119
        double h = 0;
120
        double currentDamage = getExplosionDamage();
121
        AABB initial = mc.player.getBoundingBox();
122
123
        // all of this is to avoid running into crystals which are behind
124
        // one block when holding a movement key because standing on the
125
        // near edge of that block is technically safe
126
127
        Vec3 inputOffset = mc.player.getLookAngle();
128
        Vec2 input = mc.player.input.getMoveVector();
129
        ((IVec3) inputOffset).meteor$setY(0);
130
        inputOffset = inputOffset.normalize().scale(1.2);
131
        double zdot = inputOffset.z;
132
        double xdot = inputOffset.x;
133
        inputOffset = new Vec3(input.y * xdot + input.x * zdot, 0, input.x * xdot + input.y * zdot);
134
135
        for (int i = 1; i < max; i++) {
136
            mc.player.setBoundingBox(initial.move(0, i, 0));
137
            if (!isSaferThanWith(currentDamage)) {
138
                mc.player.setBoundingBox(initial);
139
                return h;
140
            }
141
142
            mc.player.setBoundingBox(mc.player.getBoundingBox().move(inputOffset));
143
            if (!isSaferThanWith(currentDamage)) {
144
                mc.player.setBoundingBox(initial);
145
                return h;
146
            }
147
            h += 1;
148
        }
149
        mc.player.setBoundingBox(initial.move(0, max, 0));
150
151
        if (isSaferThanWith(currentDamage)) h = max;
152
153
        mc.player.setBoundingBox(initial);
154
        return h;
155
    }
156
157
    public enum ActiveWhen {
158
        Always,
159
        Sneaking,
160
        NotSneaking
161
    }
162
}
163
MelaHack (ThunderHack fork)MOVEMENTsrc/main/java/thunder/hack/features/modules/movement/Step.javaJava · 106 lines · 4.1 KB

Allows you to get on the blocks faster.

SettingsStrictHeightTimerPauseIfShiftStepDelayHoleDisableMode
Step.javaJava · Minecraft 26.2 · 106 lines · 4.1 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.movement;
2
3
import meteordevelopment.orbit.EventHandler;
4
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
5
import net.minecraft.world.entity.ai.attributes.Attributes;
6
import thunder.hack.ThunderHack;
7
import thunder.hack.core.manager.client.ModuleManager;
8
import thunder.hack.events.impl.EventSync;
9
import thunder.hack.features.modules.Module;
10
import thunder.hack.setting.Setting;
11
import thunder.hack.utility.world.HoleUtility;
12
13
public class Step extends Module {
14
    private final Setting<Boolean> strict = new Setting<>("Strict", false);
15
    private final Setting<Float> height = new Setting<>("Height", 2.0F, 1F, 2.5F, v -> !strict.getValue());
16
    private final Setting<Boolean> useTimer = new Setting<>("Timer", true);
17
    private final Setting<Boolean> pauseIfShift = new Setting<>("PauseIfShift", false);
18
    private final Setting<Integer> stepDelay = new Setting<>("StepDelay", 200, 0, 1000);
19
    private final Setting<Boolean> holeDisable = new Setting<>("HoleDisable", false);
20
    private final Setting<Mode> mode = new Setting<>("Mode", Mode.NCP);
21
22
    private final thunder.hack.utility.Timer stepTimer = new thunder.hack.utility.Timer();
23
    private boolean alreadyInHole;
24
    private boolean timer;
25
26
    public Step() {
27
        super("Step", Category.MOVEMENT);
28
    }
29
30
    @Override
31
    public void onEnable() {
32
        alreadyInHole = mc.player != null && HoleUtility.isHole(mc.player.blockPosition());
33
    }
34
35
    @Override
36
    public void onDisable() {
37
        ThunderHack.TICK_TIMER = 1f;
38
        setStepHeight(0.6F);
39
    }
40
41
    @Override
42
    public void onUpdate() {
43
        if (holeDisable.getValue() && HoleUtility.isHole(mc.player.blockPosition()) && !alreadyInHole) {
44
            disable("Player in hole... Disabling...");
45
            return;
46
        }
47
        alreadyInHole = mc.player != null && HoleUtility.isHole(mc.player.blockPosition());
48
49
        if (pauseIfShift.getValue() && mc.options.keyShift.isDown()) {
50
            setStepHeight(0.6F);
51
            return;
52
        }
53
54
        if (mc.player.getAbilities().flying || ModuleManager.freeCam.isOn() || mc.player.isHandsBusy() || mc.player.isInWater()) {
55
            setStepHeight(0.6F);
56
            return;
57
        }
58
59
        if (timer && mc.player.onGround()) {
60
            ThunderHack.TICK_TIMER = 1f;
61
            timer = false;
62
        }
63
64
        if (mc.player.onGround() && stepTimer.passedMs(stepDelay.getValue())) setStepHeight(height.getValue());
65
        else setStepHeight(0.6F);
66
    }
67
68
    @EventHandler
69
    public void onStep(EventSync event) {
70
        if (mode.getValue() == Mode.NCP) {
71
            double stepHeight = mc.player.getY() - mc.player.yo;
72
73
            if (stepHeight <= 0.75 || stepHeight > height.getValue() || (strict.getValue() && stepHeight > 1)) return;
74
75
            double[] offsets = getOffset(stepHeight);
76
            if (offsets != null && offsets.length > 1) {
77
                if (useTimer.getValue()) {
78
                    ThunderHack.TICK_TIMER = 1F / offsets.length;
79
                    timer = true;
80
                }
81
                for (double offset : offsets)
82
                    sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.xo, mc.player.yo + offset, mc.player.zo, false, mc.player.horizontalCollision));
83
                if (strict.getValue())
84
                    sendPacket(new ServerboundMovePlayerPacket.Pos(mc.player.xo, mc.player.yo + stepHeight, mc.player.zo, false, mc.player.horizontalCollision));
85
            }
86
            stepTimer.reset();
87
        }
88
    }
89
90
    public double[] getOffset(double h) {
91
        return switch ((int) (h * 10000)) {
92
            case 7500, 10000 -> new double[]{0.42, 0.753};
93
            case 8125, 8750 -> new double[]{0.39, 0.7};
94
            case 15000 -> new double[]{0.42, 0.75, 1.0, 1.16, 1.23, 1.2};
95
            case 20000 -> new double[]{0.42, 0.78, 0.63, 0.51, 0.9, 1.21, 1.45, 1.43};
96
            case 250000 -> new double[]{0.425, 0.821, 0.699, 0.599, 1.022, 1.372, 1.652, 1.869, 2.019, 1.907};
97
            default -> null;
98
        };
99
    }
100
101
    private void setStepHeight(float v) {
102
        mc.player.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(v);
103
    }
104
105
    public enum Mode {NCP, VANILLA}
106
}
OfflineClientMOVEMENTsrc/main/java/com/jellypudding/offlineclient/modules/movement/Step.javaJava · 325 lines · 13.7 KB

Step up full blocks without jumping.

SettingsModeHeightActive whenWhilst swimmingSafe stepLow healthHealth limitCrystalsStep downDown distanceDown speedEdgeGuard winsVehicles
Step.javaJava · Minecraft 26.2 · 325 lines · 13.7 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.movement;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.TickEvent;
5
import com.jellypudding.offlineclient.event.events.VehicleTickEvent;
6
import com.jellypudding.offlineclient.module.Category;
7
import com.jellypudding.offlineclient.module.Module;
8
import com.jellypudding.offlineclient.setting.BoolSetting;
9
import com.jellypudding.offlineclient.setting.EnumSetting;
10
import com.jellypudding.offlineclient.setting.NumberSetting;
11
import com.jellypudding.offlineclient.util.BlockUtil;
12
import com.jellypudding.offlineclient.util.EntityUtil;
13
import com.jellypudding.offlineclient.util.ExplosionUtil;
14
import com.jellypudding.offlineclient.util.Modules;
15
import com.jellypudding.offlineclient.util.MovementUtil;
16
import net.minecraft.core.BlockPos;
17
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
18
import net.minecraft.world.entity.Entity;
19
import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
20
import net.minecraft.world.level.block.BedBlock;
21
import net.minecraft.world.phys.AABB;
22
import net.minecraft.world.phys.Vec3;
23
import net.minecraft.world.phys.shapes.VoxelShape;
24
25
// Simple mode raises the step height. Legit mode sends the packets of a real jump.
26
// A step under a low ceiling fails because the server refuses to move through a block.
27
public final class Step extends Module {
28
29
    public enum Mode { SIMPLE, LEGIT }
30
31
    public enum ActiveWhen { ALWAYS, SNEAKING, NOT_SNEAKING }
32
33
    // The two heights a real jump passes through on its way up one block.
34
    private static final double FIRST_JUMP_POINT = 0.42;
35
    private static final double SECOND_JUMP_POINT = 0.753;
36
37
    // The most a legit step can climb. Any higher is not a jump the server believes.
38
    private static final double LEGIT_LIMIT = 1;
39
40
    // Clears the ledge top by a hair. The box lands on it rather than in it.
41
    private static final double LEDGE_CLEARANCE = 0.001;
42
43
    // How far onto the ledge the box is probed. A wall taller than the step fails this.
44
    private static final double LEDGE_PROBE = 0.1;
45
46
    // A stride onto the ledge. A crystal hidden behind the edge counts from there.
47
    private static final double LEDGE_STRIDE = 1.2;
48
49
    private final EnumSetting<Mode> mode = new EnumSetting<>("Mode",
50
        "How the step is done.", Mode.SIMPLE)
51
        .describe(Mode.SIMPLE, "Raises the step height. You walk straight up any height.")
52
        .describe(Mode.LEGIT, "Sends the packets of a real jump. Anti cheats see nothing odd. One block only.");
53
    private final NumberSetting height = new NumberSetting("Height",
54
        "How high you can step up without jumping.", 1, 0.6, 3, 0.1, " blocks")
55
        .under(mode, Mode.SIMPLE);
56
    private final EnumSetting<ActiveWhen> activeWhen = new EnumSetting<>("Active when",
57
        "When the step is allowed.", ActiveWhen.NOT_SNEAKING)
58
        .describe(ActiveWhen.ALWAYS, "Steps up sneaking or not.")
59
        .describe(ActiveWhen.SNEAKING, "Only steps up whilst you sneak.")
60
        .describe(ActiveWhen.NOT_SNEAKING, "Never steps up whilst you sneak.");
61
    private final BoolSetting inWater = new BoolSetting("Whilst swimming",
62
        "Lifts you onto a bank you swim into. Reaches as high as the step does on land.", true);
63
    private final BoolSetting safeStep = new BoolSetting("Safe step",
64
        "Stays in a hole whilst leaving it would be dangerous.", false);
65
    private final BoolSetting safeHealth = new BoolSetting("Low health",
66
        "Stays down whilst your health is low.", true)
67
        .under(safeStep);
68
    private final NumberSetting healthLimit = new NumberSetting("Health limit",
69
        "Hearts at or below which the step stays off.", 5, 0.5, 10, 0.5, " hearts")
70
        .under(safeHealth);
71
    private final BoolSetting safeCrystals = new BoolSetting("Crystals",
72
        "Only steps as high as an end crystal nearby could not hurt you past the health limit.", true)
73
        .under(safeStep);
74
    private final BoolSetting stepDown = new BoolSetting("Step down",
75
        "Snaps you down small drops instead of letting you fall.", false);
76
    private final NumberSetting downDistance = new NumberSetting("Down distance",
77
        "Longest drop that is snapped.", 3, 0.5, 10, 0.5, " blocks")
78
        .under(stepDown);
79
    private final NumberSetting downSpeed = new NumberSetting("Down speed",
80
        "How hard the snap pulls down.", 3, 0.5, 10, 0.5, "x")
81
        .under(stepDown);
82
    private final BoolSetting edgeGuardWins = new BoolSetting("EdgeGuard wins",
83
        "An edge EdgeGuard is holding you on is never snapped down from.", true)
84
        .under(stepDown);
85
    private final BoolSetting downVehicles = new BoolSetting("Vehicles",
86
        "Also snaps the boat or mount you ride down small drops.", false)
87
        .under(stepDown);
88
89
    // The step height the crystals around allow this tick. Worked out once a tick
90
    // because the game asks for the step height several times in one move.
91
    private double safeHeight;
92
93
    public Step() {
94
        super("Step", "Step up full blocks without jumping.", Category.MOVEMENT);
95
        addSettings(mode, height, activeWhen, inWater, safeStep, safeHealth, healthLimit,
96
            safeCrystals, stepDown, downDistance, downSpeed, edgeGuardWins,
97
            downVehicles);
98
        searchTags("reverse step", "step down");
99
    }
100
101
    @Override
102
    public String getSuffix() {
103
        return mode.is(Mode.LEGIT) ? "Legit" : height.getValueString();
104
    }
105
106
    @Override
107
    protected void onEnable() {
108
        safeHeight = height.getValue();
109
    }
110
111
    // Called from LocalPlayerMixin.maxUpStep().
112
    public float adjustStepHeight(float vanilla) {
113
        if (!raisesStepHeight()) {
114
            return vanilla;
115
        }
116
        return Math.max(vanilla, (float) safeHeight);
117
    }
118
119
    // True whilst simple mode hands the game a taller step.
120
    // EntityMixin reads this. A bouncy block must not read a step up as a huge bounce.
121
    public boolean raisesStepHeight() {
122
        return isEnabled() && mc.player != null && mode.is(Mode.SIMPLE) && allowed()
123
            && safeHeight > 0;
124
    }
125
126
    private boolean allowed() {
127
        boolean sneaking = mc.player.isShiftKeyDown();
128
        if (activeWhen.is(ActiveWhen.SNEAKING) && !sneaking) {
129
            return false;
130
        }
131
        // The sneak edge check uses the step height as its drop probe.
132
        if (activeWhen.is(ActiveWhen.NOT_SNEAKING) && sneaking) {
133
            return false;
134
        }
135
        return !safeStep.isOn() || !inDanger();
136
    }
137
138
    private boolean inDanger() {
139
        return safeHealth.isOn() && healthAfter(0) <= healthLimit.getFloat();
140
    }
141
142
    // Hearts left once the damage has landed.
143
    private float healthAfter(double damage) {
144
        return (float) ((EntityUtil.totalHealth(mc.player) - damage) / 2);
145
    }
146
147
    // The worst a crystal around could do with the player's box moved by the offset.
148
    // The box is put back before anything else can read it.
149
    private double crystalDamageAt(Vec3 offset) {
150
        AABB box = mc.player.getBoundingBox();
151
        mc.player.setBoundingBox(box.move(offset));
152
        try {
153
            double worst = 0;
154
            for (Entity entity : mc.level.entitiesForRendering()) {
155
                if (entity instanceof EndCrystal && entity.isAlive()) {
156
                    worst = Math.max(worst,
157
                        ExplosionUtil.crystalDamage(mc.player, entity.position(), offset));
158
                }
159
            }
160
            return worst;
161
        } finally {
162
            mc.player.setBoundingBox(box);
163
        }
164
    }
165
166
    // True when standing at the offset is no worse than where the player is now.
167
    private boolean saferThan(double current, Vec3 offset) {
168
        double there = crystalDamageAt(offset);
169
        return healthAfter(there) > healthLimit.getFloat() || there <= current;
170
    }
171
172
    // The tallest step that keeps the crystals around from hurting past the limit.
173
    // Each block up is tested where the player is and a stride onto the ledge.
174
    private double crystalSafeHeight() {
175
        double max = height.getValue();
176
        if (!safeStep.isOn() || !safeCrystals.isOn()) {
177
            return max;
178
        }
179
        double current = crystalDamageAt(Vec3.ZERO);
180
        Vec3 stride = MovementUtil.inputDirection().scale(LEDGE_STRIDE);
181
        double allowed = 0;
182
        for (int up = 1; up < max; up++) {
183
            if (!saferThan(current, new Vec3(0, up, 0))
184
                || !saferThan(current, stride.add(0, up, 0))) {
185
                return allowed;
186
            }
187
            allowed = up;
188
        }
189
        return saferThan(current, new Vec3(0, max, 0)) ? max : allowed;
190
    }
191
192
    @Subscribe
193
    private void onTick(TickEvent event) {
194
        if (!inGame() || mc.player.isPassenger()) {
195
            return;
196
        }
197
        safeHeight = crystalSafeHeight();
198
        if (allowed()) {
199
            if (mc.player.isInWater()) {
200
                if (inWater.isOn()) {
201
                    stepFromWater();
202
                }
203
            } else if (mode.is(Mode.LEGIT)) {
204
                stepLegit();
205
            }
206
        }
207
        if (stepDown.isOn()) {
208
            snapDown();
209
        }
210
    }
211
212
    // A ridden vehicle is snapped right before its own tick moves it.
213
    @Subscribe
214
    private void onVehicleTick(VehicleTickEvent event) {
215
        Entity vehicle = event.getVehicle();
216
        if (!stepDown.isOn() || !downVehicles.isOn() || !inGame()
217
            || !vehicle.isLocalInstanceAuthoritative() || !vehicle.onGround()
218
            || vehicle.isInWater() || vehicle.isInLava() || vehicle.noPhysics
219
            || mc.options.keyJump.isDown() || !dropAhead(vehicle)) {
220
            return;
221
        }
222
        Vec3 velocity = vehicle.getDeltaMovement();
223
        vehicle.setDeltaMovement(velocity.x, -downSpeed.getValue(), velocity.z);
224
    }
225
226
    // True whilst the keys push the player somewhere.
227
    private static boolean pushing() {
228
        return mc.player.input.getMoveVector().lengthSquared() >= 1.0E-6f;
229
    }
230
231
    // How far up the ledge under the player sits. Zero when there is no ledge to climb.
232
    // The move check tells a ledge from a wall that carries on upward.
233
    private double ledgeRise() {
234
        AABB box = mc.player.getBoundingBox();
235
        AABB probe = box.move(0, 0.05, 0).inflate(0.05);
236
        double top = Double.NEGATIVE_INFINITY;
237
        for (VoxelShape shape : mc.level.getBlockCollisions(mc.player, probe)) {
238
            top = Math.max(top, shape.bounds().maxY);
239
        }
240
        double rise = top - mc.player.getY();
241
        if (rise <= 0) {
242
            return 0;
243
        }
244
        Vec3 ahead = MovementUtil.inputDirection().scale(LEDGE_PROBE);
245
        boolean fits = mc.level.noCollision(mc.player, box.move(0, rise + LEDGE_CLEARANCE, 0))
246
            && mc.level.noCollision(mc.player, box.move(ahead.x, rise + LEDGE_CLEARANCE, ahead.z));
247
        return fits ? rise : 0;
248
    }
249
250
    // Walking into a block edge sends the two positions a jump would pass through.
251
    // Then puts the player on top. The server sees a normal jump.
252
    private void stepLegit() {
253
        if (!mc.player.horizontalCollision || !mc.player.onGround()) {
254
            return;
255
        }
256
        if (mc.player.onClimbable() || mc.player.isInLava()
257
            || mc.player.input.keyPresses.jump() || !pushing()) {
258
            return;
259
        }
260
        double rise = ledgeRise();
261
        if (rise <= 0 || rise > LEGIT_LIMIT) {
262
            return;
263
        }
264
        double x = mc.player.getX();
265
        double y = mc.player.getY();
266
        double z = mc.player.getZ();
267
        boolean onGround = mc.player.onGround();
268
        boolean collided = mc.player.horizontalCollision;
269
        mc.player.connection.send(new ServerboundMovePlayerPacket.Pos(
270
            x, y + FIRST_JUMP_POINT * rise, z, onGround, collided));
271
        mc.player.connection.send(new ServerboundMovePlayerPacket.Pos(
272
            x, y + SECOND_JUMP_POINT * rise, z, onGround, collided));
273
        mc.player.setPos(x, y + rise, z);
274
    }
275
276
    // The game only steps whilst the feet are on the ground.
277
    // A swimmer pushing against a bank is given the lift as speed instead.
278
    private void stepFromWater() {
279
        if (!mc.player.horizontalCollision || mc.player.input.keyPresses.jump() || !pushing()) {
280
            return;
281
        }
282
        double rise = ledgeRise();
283
        double limit = mode.is(Mode.LEGIT) ? LEGIT_LIMIT : height.getValue();
284
        if (rise <= 0 || rise > limit) {
285
            return;
286
        }
287
        Vec3 velocity = mc.player.getDeltaMovement();
288
        mc.player.setDeltaMovement(velocity.x, rise + LEDGE_CLEARANCE, velocity.z);
289
    }
290
291
    private void snapDown() {
292
        if (!mc.player.onGround() || mc.player.isInWater() || mc.player.isInLava()
293
            || mc.player.noPhysics || mc.options.keyJump.isDown()
294
            || mc.player.isShiftKeyDown()) {
295
            return;
296
        }
297
        if (MovementUtil.inputDirection().lengthSqr() == 0) {
298
            return;
299
        }
300
        if (edgeGuardWins.isOn()) {
301
            EdgeGuard edgeGuard = Modules.get(EdgeGuard.class);
302
            if (edgeGuard != null && edgeGuard.shouldGuard()) {
303
                return;
304
            }
305
        }
306
        // A bed edge would bounce the snap straight back up.
307
        BlockPos feet = mc.player.blockPosition();
308
        if (BlockUtil.state(feet).getBlock() instanceof BedBlock
309
            || BlockUtil.state(feet.below()).getBlock() instanceof BedBlock) {
310
            return;
311
        }
312
        if (!dropAhead(mc.player)) {
313
            return;
314
        }
315
        Vec3 velocity = mc.player.getDeltaMovement();
316
        mc.player.setDeltaMovement(velocity.x, -downSpeed.getValue(), velocity.z);
317
    }
318
319
    // True when ground sits within the down distance below the entity.
320
    private boolean dropAhead(Entity entity) {
321
        double drop = downDistance.getValue() + 0.01;
322
        return !mc.level.noCollision(entity, entity.getBoundingBox().move(0, -drop, 0));
323
    }
324
}
325
CombatantMOVEMENTsrc/main/java/combatant/client/features/module/modules/movement/Step.javaJava · 487 lines · 21.0 KB
SettingsstepModestepHeightstepTrimstepSimulateJumpOrderStartstepSimulateJumpOrderEndstepWaitTicksstepPacketModestepVulcan297FlightExempts
Step.javaJava · Minecraft 26.2 · 487 lines · 21.0 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.movement;
9
10
import net.minecraft.client.Minecraft;
11
import net.minecraft.client.player.LocalPlayer;
12
import net.minecraft.core.BlockPos;
13
import net.minecraft.network.protocol.Packet;
14
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
15
import net.minecraft.stats.Stats;
16
import net.minecraft.world.effect.MobEffects;
17
import net.minecraft.world.level.block.Block;
18
import net.minecraft.world.level.block.Blocks;
19
import net.minecraft.world.phys.AABB;
20
import net.minecraft.world.phys.Vec2;
21
import net.minecraft.world.phys.Vec3;
22
import combatant.client.config.values.BooleanMapValue;
23
import combatant.client.config.values.BooleanValue;
24
import combatant.client.config.values.EnumValue;
25
import combatant.client.config.values.NumberValue;
26
import combatant.client.events.EventHandler;
27
import combatant.client.events.impl.GameTickEvent;
28
import combatant.client.events.impl.MovementInputEvent;
29
import combatant.client.events.impl.PlayerStepEvent;
30
import combatant.client.events.impl.PlayerStepSuccessEvent;
31
import combatant.client.features.module.Module;
32
import combatant.client.features.module.ModuleCategory;
33
import combatant.client.features.module.ModuleInfo;
34
import combatant.client.util.player.MovementUtil;
35
36
import java.util.LinkedHashMap;
37
import java.util.Map;
38
39
//todo 297 vulcan step remove goofy ass shit
40
//todo Description
41
@ModuleInfo(
42
        id = "step",
43
        displayName = "Step",
44
        category = ModuleCategory.MOVEMENT
45
)
46
public final class Step extends Module {
47
48
    private static final double[] JUMP_ORDER = {
49
            0.0,
50
            0.41999998688698,
51
            0.7531999805212,
52
            1.00133597911215,
53
            1.166109260938214,
54
            1.24918707874468,
55
            1.25220334025373,
56
            1.17675927506424,
57
            1.024424088213685
58
    };
59
    private static final String STEP_FLIGHT_EXEMPT_LIQUID = "liquid";
60
    private static final String STEP_FLIGHT_EXEMPT_WALL = "wall";
61
    private static final String STEP_FLIGHT_EXEMPT_CONDUIT = "conduit";
62
    private static final String STEP_FLIGHT_EXEMPT_FARMLAND = "farmland";
63
    private static final String STEP_FLIGHT_EXEMPT_SLOW_FALLING = "slow_falling";
64
    private static final String STEP_FLIGHT_EXEMPT_LEVITATION = "levitation";
65
    private static final String STEP_FLIGHT_EXEMPT_RIPTIDE = "riptide";
66
    private static final String STEP_FLIGHT_EXEMPT_WEB = "web";
67
    private static final String STEP_FLIGHT_EXEMPT_WATERLOGGED = "waterlogged";
68
    private static final String STEP_FLIGHT_EXEMPT_SHULKER_BOX = "shulker_box";
69
    private static final String STEP_FLIGHT_EXEMPT_SPECTATOR = "spectator";
70
    private static final String STEP_FLIGHT_EXEMPT_SLEEPING = "sleeping";
71
    private static final String STEP_FLIGHT_EXEMPT_SLIME = "slime";
72
    private static final String STEP_FLIGHT_EXEMPT_POWDER_SNOW = "powder_snow";
73
    private static final String STEP_FLIGHT_EXEMPT_SEAGRASS = "seagrass";
74
    private static final String STEP_FLIGHT_EXEMPT_SCAFFOLDING = "scaffolding";
75
    private static final String STEP_FLIGHT_EXEMPT_CLIMBABLE = "climbable";
76
    private static final String STEP_FLIGHT_EXEMPT_SWIMMING = "swimming";
77
    private static final String STEP_FLIGHT_EXEMPT_HONEY = "honey";
78
    private static final String STEP_FLIGHT_EXEMPT_SEA_PICKLE = "sea_pickle";
79
    private static final String STEP_FLIGHT_EXEMPT_BUBBLE_COLUMN = "bubble_column";
80
    private static final String STEP_FLIGHT_EXEMPT_VEHICLE = "vehicle";
81
    private static final String STEP_FLIGHT_EXEMPT_KELP = "kelp";
82
    private static final String STEP_FLIGHT_EXEMPT_GLIDING = "gliding";
83
    private static final String STEP_FLIGHT_EXEMPT_CHUNK = "chunk";
84
    private static final double VULCAN_297_FLIGHT_F_DECAY = 0.04;
85
    private static final double VULCAN_297_JUMP_A_DECAY = 0.15;
86
    private static final double VULCAN_297_STEP_JUMP_COST = 0.65;
87
    private static final double VULCAN_297_VERTICAL_RECOVERY_COST = 1.0;
88
    private static final double VULCAN_297_FLIGHT_F_LIMIT = 1.6;
89
    private static final double VULCAN_297_JUMP_A_LIMIT = 1.7;
90
    private final Minecraft mc = Minecraft.getInstance();
91
    private final EnumValue<Mode> mode = enumSetting("stepMode", "mode", Mode.INSTANT, Mode.values());
92
    private final NumberValue<Float> height = visibleWhen(num("stepHeight", "height", 1.0f, 0.6f, 5.0f), () -> mode.get() == Mode.INSTANT);
93
    private final BooleanValue trim = visibleWhen(bool("stepTrim", "trim", false), () -> mode.get() == Mode.INSTANT);
94
    private final NumberValue<Integer> simulateJumpOrderStart =
95
            visibleWhen(num("stepSimulateJumpOrderStart", "simulate_jump_order_start", 0, 0, JUMP_ORDER.length - 1), () -> mode.get() == Mode.INSTANT);
96
    private final NumberValue<Integer> simulateJumpOrderEnd =
97
            visibleWhen(num("stepSimulateJumpOrderEnd", "simulate_jump_order_end", 2, 0, JUMP_ORDER.length - 1), () -> mode.get() == Mode.INSTANT);
98
    private final NumberValue<Integer> waitTicks = visibleWhen(num("stepWaitTicks", "wait_ticks", 0, 0, 60), () -> mode.get() == Mode.INSTANT);
99
    private final EnumValue<PacketMode> packetMode =
100
            visibleWhen(enumSetting("stepPacketMode", "packet_mode", PacketMode.FULL, PacketMode.values()), () -> mode.get() == Mode.INSTANT);
101
    private final BooleanMapValue vulcan297FlightExempts =
102
            visibleWhen(group("stepVulcan297FlightExempts", "vulcan297_flight_exempts", vulcan297FlightExemptDefaults()), () -> mode.get() == Mode.VULCAN_297);
103
    private int ticksWait;
104
    private int vulcanStepCounter;
105
    private int vulcanSequenceTicks;
106
    private boolean vulcanStepping;
107
    private boolean vulcanEvenStep;
108
    private boolean vulcan297Aggressive;
109
    private double vulcan297FlightFRisk;
110
    private double vulcan297JumpARisk;
111
112
    private static Map<String, Boolean> vulcan297FlightExemptDefaults() {
113
        Map<String, Boolean> defaults = new LinkedHashMap<>();
114
        defaults.put(STEP_FLIGHT_EXEMPT_LIQUID, true);
115
        defaults.put(STEP_FLIGHT_EXEMPT_WALL, true);
116
        defaults.put(STEP_FLIGHT_EXEMPT_CONDUIT, true);
117
        defaults.put(STEP_FLIGHT_EXEMPT_FARMLAND, true);
118
        defaults.put(STEP_FLIGHT_EXEMPT_SLOW_FALLING, true);
119
        defaults.put(STEP_FLIGHT_EXEMPT_LEVITATION, true);
120
        defaults.put(STEP_FLIGHT_EXEMPT_RIPTIDE, true);
121
        defaults.put(STEP_FLIGHT_EXEMPT_WEB, true);
122
        defaults.put(STEP_FLIGHT_EXEMPT_WATERLOGGED, true);
123
        defaults.put(STEP_FLIGHT_EXEMPT_SHULKER_BOX, true);
124
        defaults.put(STEP_FLIGHT_EXEMPT_SPECTATOR, true);
125
        defaults.put(STEP_FLIGHT_EXEMPT_SLEEPING, true);
126
        defaults.put(STEP_FLIGHT_EXEMPT_SLIME, true);
127
        defaults.put(STEP_FLIGHT_EXEMPT_POWDER_SNOW, true);
128
        defaults.put(STEP_FLIGHT_EXEMPT_SEAGRASS, true);
129
        defaults.put(STEP_FLIGHT_EXEMPT_SCAFFOLDING, true);
130
        defaults.put(STEP_FLIGHT_EXEMPT_CLIMBABLE, true);
131
        defaults.put(STEP_FLIGHT_EXEMPT_SWIMMING, true);
132
        defaults.put(STEP_FLIGHT_EXEMPT_HONEY, true);
133
        defaults.put(STEP_FLIGHT_EXEMPT_SEA_PICKLE, true);
134
        defaults.put(STEP_FLIGHT_EXEMPT_BUBBLE_COLUMN, true);
135
        defaults.put(STEP_FLIGHT_EXEMPT_VEHICLE, true);
136
        defaults.put(STEP_FLIGHT_EXEMPT_KELP, true);
137
        defaults.put(STEP_FLIGHT_EXEMPT_GLIDING, true);
138
        defaults.put(STEP_FLIGHT_EXEMPT_CHUNK, true);
139
        return defaults;
140
    }
141
142
    @Override
143
    public void onDisable() {
144
        ticksWait = 0;
145
        resetVulcan();
146
        vulcan297FlightFRisk = 0.0;
147
        vulcan297JumpARisk = 0.0;
148
    }
149
150
    @EventHandler
151
    private void onGameTick(GameTickEvent event) {
152
        if (!isEnabled()) return;
153
154
        if (ticksWait > 0) {
155
            ticksWait--;
156
        }
157
        decayVulcan297Risk();
158
159
        if (mode.get() == Mode.VULCAN_286) {
160
            tickVulcan286();
161
        } else if (mode.get() == Mode.VULCAN_297) {
162
            tickVulcan297();
163
        }
164
    }
165
166
    @EventHandler
167
    private void onMovementInput(MovementInputEvent event) {
168
        if (!isEnabled() || mc.player == null || mc.level == null) return;
169
170
        LocalPlayer player = mc.player;
171
        boolean manualJump = isManualJump(event, player);
172
        if (mode.get() == Mode.LEGIT) {
173
            if (canStep(player, 1.0) && !manualJump) {
174
                event.setJump(true);
175
            }
176
            return;
177
        }
178
179
        if ((mode.get() != Mode.VULCAN_286 && mode.get() != Mode.VULCAN_297) || vulcanStepping) return;
180
        if (mode.get() == Mode.VULCAN_297 && manualJump) return;
181
        if (mode.get() == Mode.VULCAN_297 && isVulcan297PredictionRiskHigh()) return;
182
        if (!canStep(player, 1.0)) return;
183
184
        event.setJump(true);
185
        if (mode.get() == Mode.VULCAN_297) {
186
            vulcan297JumpARisk += VULCAN_297_STEP_JUMP_COST;
187
            vulcan297FlightFRisk += VULCAN_297_STEP_JUMP_COST * 0.5;
188
        }
189
        vulcanStepCounter++;
190
        vulcan297Aggressive = mode.get() == Mode.VULCAN_297 && isVulcan297FlightExempt(player);
191
        vulcanEvenStep = vulcanStepCounter % 2 == 0;
192
        vulcanSequenceTicks = 0;
193
        vulcanStepping = true;
194
    }
195
196
    @EventHandler
197
    private void onPlayerStep(PlayerStepEvent event) {
198
        if (!isEnabled() || mode.get() != Mode.INSTANT || ticksWait > 0) return;
199
        event.setHeight(height.get());
200
    }
201
202
    @EventHandler
203
    private void onPlayerStepSuccess(PlayerStepSuccessEvent event) {
204
        if (!isEnabled() || mode.get() != Mode.INSTANT) return;
205
        if (ticksWait > 0 || mc.player == null || mc.getConnection() == null) return;
206
207
        LocalPlayer player = mc.player;
208
        double stepHeight = event.getAdjustedVec().y;
209
        if (stepHeight <= 0.5) return;
210
211
        int start = Math.min(simulateJumpOrderStart.get(), simulateJumpOrderEnd.get());
212
        int end = Math.max(simulateJumpOrderStart.get(), simulateJumpOrderEnd.get());
213
        if (start == 0 && end == 0) {
214
            ticksWait = waitTicks.get();
215
            return;
216
        }
217
218
        player.awardStat(Stats.JUMP);
219
220
        double maxY = player.getY();
221
        double baseY = player.getY() - stepHeight;
222
        for (int i = start; i <= end && i < JUMP_ORDER.length; i++) {
223
            double additionalY = JUMP_ORDER[i];
224
            if (additionalY == 0.0) continue;
225
226
            double y = baseY + additionalY;
227
            if (trim.get()) {
228
                y = Math.min(y, maxY);
229
            }
230
            mc.getConnection().send(movePacket(player, y));
231
        }
232
233
        ticksWait = waitTicks.get();
234
    }
235
236
    private void tickVulcan286() {
237
        if (!vulcanStepping || mc.player == null) return;
238
239
        vulcanSequenceTicks++;
240
        LocalPlayer player = mc.player;
241
        tickVulcan286Sequence(player);
242
    }
243
244
    private void tickVulcan286Sequence(LocalPlayer player) {
245
246
        if (vulcanSequenceTicks == 2) {
247
            if (vulcanEvenStep) {
248
                Vec3 velocity = player.getDeltaMovement();
249
                player.setDeltaMovement(withStrafe(new Vec3(velocity.x, 0.24680001947880004, velocity.z), player, 0.2));
250
                vulcan297FlightFRisk += VULCAN_297_VERTICAL_RECOVERY_COST;
251
            }
252
            return;
253
        }
254
255
        if (vulcanSequenceTicks == 3) {
256
            if (vulcanEvenStep) {
257
                Vec3 velocity = player.getDeltaMovement();
258
                player.setDeltaMovement(velocity.x, 0.0, velocity.z);
259
                vulcan297FlightFRisk += VULCAN_297_VERTICAL_RECOVERY_COST * 0.5;
260
            }
261
            return;
262
        }
263
264
        if (vulcanSequenceTicks >= 4) {
265
            Vec3 velocity = player.getDeltaMovement();
266
            player.setDeltaMovement(velocity.x, -0.17, velocity.z);
267
            resetVulcan();
268
        }
269
    }
270
271
    private void tickVulcan297AggressiveSequence(LocalPlayer player) {
272
        if (isVulcan297StepCExempt(player)) {
273
            tickVulcan286Sequence(player);
274
            return;
275
        }
276
277
        if (vulcanSequenceTicks == 2) {
278
            if (vulcanEvenStep) {
279
                Vec3 velocity = player.getDeltaMovement();
280
                player.setDeltaMovement(withStrafe(new Vec3(velocity.x, 0.24680001947880004, velocity.z), player, 0.2));
281
            }
282
            return;
283
        }
284
285
        if (vulcanSequenceTicks == 3) {
286
            if (vulcanEvenStep) {
287
                Vec3 velocity = player.getDeltaMovement();
288
                player.setDeltaMovement(velocity.x, 0.0, velocity.z);
289
            }
290
            return;
291
        }
292
293
        if (vulcanSequenceTicks >= 4) {
294
            resetVulcan();
295
        }
296
    }
297
298
    private void tickVulcan297() {
299
        if (!vulcanStepping || mc.player == null) return;
300
301
        vulcanSequenceTicks++;
302
        LocalPlayer player = mc.player;
303
304
        if (vulcan297Aggressive && isVulcan297FlightExempt(player)) {
305
            tickVulcan297AggressiveSequence(player);
306
            return;
307
        }
308
309
        if (player.onGround() && vulcanSequenceTicks > 1 || vulcanSequenceTicks >= 10) {
310
            resetVulcan();
311
        }
312
    }
313
314
    private Packet<?> movePacket(LocalPlayer player, double y) {
315
        return switch (packetMode.get()) {
316
            case FULL -> new ServerboundMovePlayerPacket.PosRot(
317
                    player.getX(),
318
                    y,
319
                    player.getZ(),
320
                    player.getYRot(),
321
                    player.getXRot(),
322
                    false,
323
                    player.horizontalCollision
324
            );
325
            case POSITION_AND_ON_GROUND -> new ServerboundMovePlayerPacket.Pos(
326
                    player.getX(),
327
                    y,
328
                    player.getZ(),
329
                    false,
330
                    player.horizontalCollision
331
            );
332
        };
333
    }
334
335
    private boolean canStep(LocalPlayer player, double stepHeight) {
336
        if (player == null || mc.level == null) return false;
337
        if (!player.onGround() || player.isShiftKeyDown() || player.isSpectator()) return false;
338
        if (player.isInWater() || player.isInLava() || player.onClimbable() || player.isPassenger()) return false;
339
        if (!MovementUtil.isMoving()) return false;
340
341
        Vec3 offset = horizontalInputOffset(player, 0.36);
342
        if (offset.horizontalDistanceSqr() < 1.0E-7) return false;
343
344
        AABB box = player.getBoundingBox();
345
        AABB forwardBox = box.move(offset.x, 0.0, offset.z);
346
        if (mc.level.noCollision(player, forwardBox)) return false;
347
348
        AABB steppedBox = box.move(offset.x, stepHeight, offset.z);
349
        return mc.level.noCollision(player, steppedBox);
350
    }
351
352
    private boolean isManualJump(MovementInputEvent event, LocalPlayer player) {
353
        return event.isJump()
354
                || mc.options != null && mc.options.keyJump.isDown()
355
                || player.input != null && player.input.keyPresses.jump();
356
    }
357
358
    private boolean isVulcan297FlightExempt(LocalPlayer player) {
359
        if (player == null || mc.level == null) return false;
360
361
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_LIQUID) && (player.isInWater() || player.isInLava()))
362
            return true;
363
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_WALL) && player.horizontalCollision) return true;
364
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_CONDUIT) && player.hasEffect(MobEffects.CONDUIT_POWER))
365
            return true;
366
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SLOW_FALLING) && player.hasEffect(MobEffects.SLOW_FALLING))
367
            return true;
368
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_LEVITATION) && player.hasEffect(MobEffects.LEVITATION))
369
            return true;
370
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_RIPTIDE) && player.isAutoSpinAttack()) return true;
371
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SPECTATOR) && player.isSpectator()) return true;
372
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SLEEPING) && player.isSleeping()) return true;
373
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_CLIMBABLE) && player.onClimbable()) return true;
374
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SWIMMING) && player.isSwimming()) return true;
375
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_VEHICLE) && player.isPassenger()) return true;
376
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_GLIDING) && player.isFallFlying()) return true;
377
        if (vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_CHUNK) && player.tickCount < 100) return true;
378
379
        BlockPos feet = player.blockPosition();
380
        return isVulcan297FlightExemptBlock(feet)
381
                || isVulcan297FlightExemptBlock(feet.below())
382
                || isVulcan297FlightExemptBlock(feet.above());
383
    }
384
385
    private boolean isVulcan297FlightExemptBlock(BlockPos pos) {
386
        if (mc.level == null) return false;
387
388
        Block block = mc.level.getBlockState(pos).getBlock();
389
        return vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_FARMLAND) && block == Blocks.FARMLAND
390
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_WEB) && block == Blocks.COBWEB
391
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_WATERLOGGED) && mc.level.getBlockState(pos).getFluidState().isSource()
392
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SHULKER_BOX) && block == Blocks.SHULKER_BOX
393
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SLIME) && block == Blocks.SLIME_BLOCK
394
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_POWDER_SNOW) && block == Blocks.POWDER_SNOW
395
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SEAGRASS) && (block == Blocks.SEAGRASS || block == Blocks.TALL_SEAGRASS)
396
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SCAFFOLDING) && block == Blocks.SCAFFOLDING
397
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_HONEY) && block == Blocks.HONEY_BLOCK
398
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_SEA_PICKLE) && block == Blocks.SEA_PICKLE
399
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_BUBBLE_COLUMN) && block == Blocks.BUBBLE_COLUMN
400
                || vulcan297FlightExempts.get(STEP_FLIGHT_EXEMPT_KELP) && (block == Blocks.KELP || block == Blocks.KELP_PLANT);
401
    }
402
403
    private boolean isVulcan297StepCExempt(LocalPlayer player) {
404
        if (player == null || mc.level == null) return false;
405
406
        if (player.getAbilities().instabuild || player.getAbilities().flying) return true;
407
        if (player.isFallFlying() || player.isInWater() || player.isInLava()) return true;
408
        if (player.isPassenger() || player.isAutoSpinAttack() || player.isSleeping()) return true;
409
        if (player.hurtTime > 0 || player.hasEffect(MobEffects.JUMP_BOOST) || player.onClimbable()) return true;
410
411
        BlockPos feet = player.blockPosition();
412
        return isVulcan297StepCExemptBlock(feet)
413
                || isVulcan297StepCExemptBlock(feet.below())
414
                || isVulcan297StepCExemptBlock(feet.above());
415
    }
416
417
    private boolean isVulcan297StepCExemptBlock(BlockPos pos) {
418
        if (mc.level == null) return false;
419
420
        Block block = mc.level.getBlockState(pos).getBlock();
421
        return block == Blocks.SLIME_BLOCK
422
                || block == Blocks.ANVIL
423
                || block == Blocks.END_ROD
424
                || block == Blocks.IRON_CHAIN
425
                || block == Blocks.POINTED_DRIPSTONE
426
                || block == Blocks.SCAFFOLDING
427
                || block == Blocks.POWDER_SNOW
428
                || block == Blocks.SNOW;
429
    }
430
431
    private boolean isVulcan297PredictionRiskHigh() {
432
        return vulcan297FlightFRisk >= VULCAN_297_FLIGHT_F_LIMIT
433
                || vulcan297JumpARisk >= VULCAN_297_JUMP_A_LIMIT;
434
    }
435
436
    private void decayVulcan297Risk() {
437
        if (vulcan297FlightFRisk > 0.0) {
438
            vulcan297FlightFRisk = Math.max(0.0, vulcan297FlightFRisk - VULCAN_297_FLIGHT_F_DECAY);
439
        }
440
        if (vulcan297JumpARisk > 0.0) {
441
            vulcan297JumpARisk = Math.max(0.0, vulcan297JumpARisk - VULCAN_297_JUMP_A_DECAY);
442
        }
443
    }
444
445
    private Vec3 horizontalInputOffset(LocalPlayer player, double length) {
446
        if (player.input == null) return Vec3.ZERO;
447
448
        Vec2 input = player.input.getMoveVector();
449
        if (input.lengthSquared() <= 1.0E-7f) return Vec3.ZERO;
450
451
        float yaw = player.getYRot();
452
        double rad = Math.toRadians(yaw);
453
        double sin = Math.sin(rad);
454
        double cos = Math.cos(rad);
455
        double x = input.x * cos - input.y * sin;
456
        double z = input.y * cos + input.x * sin;
457
        Vec3 out = new Vec3(x, 0.0, z);
458
        return out.lengthSqr() > 1.0 ? out.normalize().scale(length) : out.scale(length);
459
    }
460
461
    private Vec3 withStrafe(Vec3 velocity, LocalPlayer player, double speed) {
462
        if (player.input == null) return velocity;
463
        Vec2 input = player.input.getMoveVector();
464
        Vec3 movementInput = new Vec3(input.x, 0.0, input.y);
465
        return MovementUtil.withStrafe(velocity, movementInput, player.getYRot(), speed, 1.0);
466
    }
467
468
    private void resetVulcan() {
469
        vulcanStepping = false;
470
        vulcanSequenceTicks = 0;
471
        vulcanEvenStep = false;
472
        vulcan297Aggressive = false;
473
    }
474
475
    public enum Mode {
476
        INSTANT,
477
        LEGIT,
478
        VULCAN_286,
479
        VULCAN_297
480
    }
481
482
    public enum PacketMode {
483
        FULL,
484
        POSITION_AND_ON_GROUND
485
    }
486
}
487
LiquidBounce (Kotlin)MOVEMENTsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/step/ModuleStep.ktKotlin · 340 lines · 11.9 KB

Allows you to step up blocks faster.

SettingsHeightTrimSimulateJumpOrderWaitPacketTypeBaseTimerRecoveryTimerAlternateBypassSpoof
ModuleStep.ktKotlin · Minecraft 26.2 · 340 lines · 11.9 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.movement.step
20
21
import net.ccbluex.fastutil.enumSetOf
22
import net.ccbluex.liquidbounce.config.types.group.Mode
23
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
24
import net.ccbluex.liquidbounce.event.events.AllowAutoJumpEvent
25
import net.ccbluex.liquidbounce.event.events.BlinkPacketEvent
26
import net.ccbluex.liquidbounce.event.events.GameTickEvent
27
import net.ccbluex.liquidbounce.event.events.MovementInputEvent
28
import net.ccbluex.liquidbounce.event.events.PlayerNetworkMovementTickEvent
29
import net.ccbluex.liquidbounce.event.events.PlayerStepEvent
30
import net.ccbluex.liquidbounce.event.events.PlayerStepSuccessEvent
31
import net.ccbluex.liquidbounce.event.events.TransferOrigin
32
import net.ccbluex.liquidbounce.event.handler
33
import net.ccbluex.liquidbounce.event.sequenceHandler
34
import net.ccbluex.liquidbounce.event.waitTicks
35
import net.ccbluex.liquidbounce.features.blink.BlinkManager
36
import net.ccbluex.liquidbounce.features.module.ClientModule
37
import net.ccbluex.liquidbounce.features.module.ModuleCategories
38
import net.ccbluex.liquidbounce.features.module.modules.movement.speed.ModuleSpeed
39
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleDebug
40
import net.ccbluex.liquidbounce.utils.network.MovePacketType
41
import net.ccbluex.liquidbounce.utils.client.Timer
42
import net.ccbluex.liquidbounce.utils.entity.airTicks
43
import net.ccbluex.liquidbounce.utils.entity.canStep
44
import net.ccbluex.liquidbounce.utils.entity.withStrafe
45
import net.ccbluex.liquidbounce.utils.kotlin.Priority
46
import net.minecraft.stats.Stats
47
48
/**
49
 * Step module
50
 *
51
 * Allows you to step up blocks.
52
 */
53
54
object ModuleStep : ClientModule("Step", ModuleCategories.MOVEMENT) {
55
56
    private val modes = choices("Mode", Instant, arrayOf(
57
        Instant,
58
        Legit,
59
        Vulcan286,
60
        BlocksMC,
61
        Hypixel
62
    )).apply { tagBy(this) }
63
64
    private object Legit : Mode("Legit") {
65
        override val parent: ModeValueGroup<Mode>
66
            get() = modes
67
68
        @Suppress("unused")
69
        private val autoJumpHandler = handler<AllowAutoJumpEvent> { event ->
70
            event.isAllowed = true
71
        }
72
73
    }
74
75
    private object Instant : Mode("Instant") {
76
77
        override val parent: ModeValueGroup<Mode>
78
            get() = modes
79
80
        /**
81
         * A common jump looks like this:
82
         * PlayerMoveC2SPacket 207.30000001192093 62.0 149.86302076816213 0.0 0.0 true
83
         * PlayerMoveC2SPacket 207.30000001192093 62.41999998688698 149.86517219525172 0.0 0.0 false
84
         * PlayerMoveC2SPacket 207.30000001192093 62.7531999805212 149.8656024806536 0.0 0.0 false
85
         * PlayerMoveC2SPacket 207.28040473521648 63.00133597911215 149.86603276605547 0.0 0.0 false
86
         * PlayerMoveC2SPacket 207.23709917391574 63.166109260938214 149.8665921370619 0.0 0.0 false
87
         * PlayerMoveC2SPacket 207.17221725301053 63.24918707874468 149.86715150806833 0.0 0.0 false
88
         * PlayerMoveC2SPacket 207.0877008442994 63.25220334025373 149.86771087907476 0.0 0.0 false
89
         * PlayerMoveC2SPacket 206.98531705116994 63.17675927506424 149.8682702500812 0.0 0.0 false
90
         * PlayerMoveC2SPacket 206.86667393775122 63.024424088213685 149.86882962108763 0.0 0.0 false
91
         * PlayerMoveC2SPacket 206.73323484244284 63.0 149.86938899209406 0.0 0.0 true
92
         */
93
        private val jumpOrder = doubleArrayOf(
94
            0.0, // This is for the sake of configuration simplicity. A normal human considers 0 to be NOTHING.
95
            0.41999998688698,
96
            0.7531999805212,
97
            1.00133597911215,
98
            1.166109260938214,
99
            1.24918707874468,
100
            1.25220334025373,
101
            1.17675927506424,
102
            1.024424088213685
103
        )
104
105
        private val height by float("Height", 1.0F, 0.6F..5.0F)
106
        private val trim by boolean("Trim", false)
107
108
        /**
109
         * Simulates a jump by sending multiple packets. The range of the jump order is configured by the user.
110
         * 0..2 is the default - it bypasses common anti-cheats like NoCheatPlus.
111
         */
112
        private val simulateJumpOrder by intRange("SimulateJumpOrder", 0..2,
113
            jumpOrder.indices)
114
        private val wait by intRange("Wait", 0..0, 0..60, "ticks")
115
        private val packetType by enumChoice("PacketType", MovePacketType.FULL,
116
            enumSetOf(MovePacketType.FULL, MovePacketType.POSITION_AND_ON_GROUND)
117
        )
118
119
        private var ticksWait = 0
120
121
        @Suppress("unused")
122
        private val tickHandler = handler<GameTickEvent> {
123
            if (ticksWait > 0) {
124
                ticksWait--
125
            }
126
        }
127
128
        @Suppress("unused")
129
        private val stepHandler = handler<PlayerStepEvent> {
130
            if (ticksWait > 0) {
131
                return@handler
132
            }
133
134
            it.height = height
135
        }
136
137
        @Suppress("unused")
138
        private val stepSuccessEvent = handler<PlayerStepSuccessEvent> { event ->
139
            val stepHeight = event.adjustedVec.y
140
141
            ModuleDebug.debugParameter(ModuleStep, "StepHeight", stepHeight)
142
143
            if (stepHeight <= 0.5) {
144
                return@handler
145
            }
146
147
            // If we have configured 0..0 then we will send nothing.
148
            // That makes sense because the first entry of the array is 0.0
149
            // @see jumpOrder
150
            if (simulateJumpOrder == 0..0) {
151
                return@handler
152
            }
153
154
            player.awardStat(Stats.JUMP)
155
156
            // Used to trim the additional height to the maximum step height
157
            val trimHeight = player.y + stepHeight
158
159
            // Slice the array to the specified range and send the packets
160
            jumpOrder.sliceArray(simulateJumpOrder)
161
                .filter { it != 0.0 } // This should not happen, but just in case.
162
                .map { additionalY ->
163
                    val destinationY = player.y + additionalY
164
165
                    packetType.generatePacket().apply {
166
                        this.x = player.x
167
                        this.y = destinationY.let { y ->
168
                            if (trim) y.coerceAtMost(trimHeight) else y
169
                        }
170
                        this.z = player.z
171
                    }
172
                }.forEach(network::send)
173
            ticksWait = wait.random()
174
        }
175
176
    }
177
178
    /**
179
     * InspectorBoat Vulcan Step
180
     *
181
     * @author InspectorBoat (and translated by 1zuna)
182
     */
183
    private object Vulcan286 : Mode("Vulcan286") {
184
185
        override val parent: ModeValueGroup<Mode>
186
            get() = modes
187
188
        private var stepCounter = 0
189
        private var stepping = false
190
191
        @Suppress("unused")
192
        private val movementInputHandler = sequenceHandler<MovementInputEvent> { event ->
193
            if (player.canStep(1.0) && !stepping) {
194
                event.jump = true
195
                stepCounter++
196
197
                stepping = true
198
                waitTicks(2)
199
                if (stepCounter % 2 == 0) {
200
                    player.deltaMovement.y = 0.24680001947880004
201
                    player.deltaMovement = player.deltaMovement.withStrafe(speed = 0.2)
202
                }
203
                waitTicks(1)
204
                if (stepCounter % 2 == 0) {
205
                    player.deltaMovement.y = 0.0
206
                }
207
                waitTicks(1)
208
                player.deltaMovement.y = -0.17
209
                stepping = false
210
            }
211
        }
212
213
        override fun disable() {
214
            stepping = false
215
            stepCounter = 0
216
            super.disable()
217
        }
218
219
220
    }
221
222
    /**
223
     * BlocksMC Step
224
     * for 1.9+
225
     *
226
     * @author @liquidsquid1
227
     */
228
    private object BlocksMC : Mode("BlocksMC") {
229
230
        override val parent: ModeValueGroup<Mode>
231
            get() = modes
232
233
        private var baseTimer by float("BaseTimer", 3.0f, 0.1f..5.0f)
234
        private var recoveryTimer by float("RecoveryTimer", 0.6f, 0.1f..5.0f)
235
236
        private var stepping = false
237
238
        @Suppress("unused")
239
        private val movementInputHandler = sequenceHandler<MovementInputEvent> { event ->
240
            if (player.canStep(1.0) && !stepping) {
241
                event.jump = true
242
243
                stepping = true
244
                Timer.requestTimerSpeed(baseTimer, Priority.IMPORTANT_FOR_USAGE_1, ModuleStep, 3)
245
                player.deltaMovement.y = 0.42
246
                waitTicks(1)
247
                player.deltaMovement.y = 0.33
248
                waitTicks(1)
249
                player.deltaMovement.y = 0.25
250
                waitTicks(2)
251
                player.deltaMovement = player.deltaMovement.withStrafe(speed = 0.281)
252
                player.deltaMovement.y -= player.y % 1.0
253
                Timer.requestTimerSpeed(recoveryTimer, Priority.IMPORTANT_FOR_USAGE_1, ModuleStep, 2)
254
                stepping = false
255
            }
256
        }
257
258
        @Suppress("unused")
259
        private val fakeLagHandler = handler<BlinkPacketEvent> { event ->
260
            if (event.origin == TransferOrigin.OUTGOING && stepping) {
261
                event.action = BlinkManager.Action.QUEUE
262
            }
263
        }
264
265
        override fun disable() {
266
            stepping = false
267
            super.disable()
268
        }
269
270
        override val running: Boolean
271
            get() = super.running && !ModuleSpeed.running
272
273
    }
274
275
    /**
276
     * does not seem to work above a certain y level for some reason
277
     */
278
    private object Hypixel : Mode("Hypixel") {
279
280
        override val parent: ModeValueGroup<Mode>
281
            get() = modes
282
283
        private val alternateBypass by boolean("AlternateBypass", false)
284
        private val spoof by boolean("Spoof", false)
285
286
        private var stepping = false
287
288
        private val stepHeight get() = when {
289
            player.canStep(1.0) -> 1.0
290
            player.canStep(1.25) -> 1.25
291
            else -> 1.5
292
        }
293
294
        @Suppress("unused")
295
        private val movementInputHandler = sequenceHandler<MovementInputEvent> { event ->
296
            if (player.canStep(1.5) && !stepping) {
297
                val currentStepHeight = stepHeight
298
                event.jump = true
299
300
                stepping = true
301
                player.deltaMovement.y = 0.42
302
                waitTicks(1)
303
                if (currentStepHeight > 1.0) {
304
                    player.deltaMovement.y += 0.061
305
                }
306
                waitTicks(2)
307
                if (currentStepHeight == 1.0) {
308
                    player.deltaMovement.y -= 0.14
309
                } else {
310
                    player.deltaMovement.y -= 0.095
311
                    if (currentStepHeight > 1.25) {
312
                        waitTicks(5)
313
                        if (alternateBypass) {
314
                            player.setOnGround(true)
315
                        } else {
316
                            player.deltaMovement.y = 0.42
317
                        }
318
                    }
319
                }
320
                stepping = false
321
                player.deltaMovement = player.deltaMovement.withStrafe(speed = 0.1838601407459074)
322
            }
323
        }
324
325
        @Suppress("unused")
326
        private val networkTickHandler = handler<PlayerNetworkMovementTickEvent> { event ->
327
            if (spoof && player.airTicks == 8) {
328
                event.ground = true
329
            }
330
        }
331
332
        override fun disable() {
333
            stepping = false
334
            super.disable()
335
        }
336
337
    }
338
339
}
340