| 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 meteordevelopment.meteorclient.events.world.TickEvent;
|
| 9 | import meteordevelopment.meteorclient.mixininterface.IVec3;
|
| 10 | import meteordevelopment.meteorclient.settings.DoubleSetting;
|
| 11 | import meteordevelopment.meteorclient.settings.EnumSetting;
|
| 12 | import meteordevelopment.meteorclient.settings.Setting;
|
| 13 | import meteordevelopment.meteorclient.settings.SettingGroup;
|
| 14 | import meteordevelopment.meteorclient.systems.modules.Categories;
|
| 15 | import meteordevelopment.meteorclient.systems.modules.Module;
|
| 16 | import meteordevelopment.orbit.EventHandler;
|
| 17 |
|
| 18 | public class AutoJump extends Module {
|
| 19 | private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
| 20 |
|
| 21 | private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
|
| 22 | .name("mode")
|
| 23 | .description("The method of jumping.")
|
| 24 | .defaultValue(Mode.Jump)
|
| 25 | .build()
|
| 26 | );
|
| 27 |
|
| 28 | private final Setting<JumpWhen> jumpIf = sgGeneral.add(new EnumSetting.Builder<JumpWhen>()
|
| 29 | .name("jump-if")
|
| 30 | .description("Jump if.")
|
| 31 | .defaultValue(JumpWhen.Always)
|
| 32 | .build()
|
| 33 | );
|
| 34 |
|
| 35 | private final Setting<Double> velocityHeight = sgGeneral.add(new DoubleSetting.Builder()
|
| 36 | .name("velocity-height")
|
| 37 | .description("The distance that velocity mode moves you.")
|
| 38 | .defaultValue(0.25)
|
| 39 | .min(0)
|
| 40 | .sliderMax(2)
|
| 41 | .build()
|
| 42 | );
|
| 43 |
|
| 44 | public AutoJump() {
|
| 45 | super(Categories.Movement, "auto-jump", "Automatically jumps.");
|
| 46 | }
|
| 47 |
|
| 48 | private boolean jump() {
|
| 49 | return switch (jumpIf.get()) {
|
| 50 | case Sprinting -> mc.player.isSprinting() && (mc.player.zza != 0 || mc.player.xxa != 0);
|
| 51 | case Walking -> mc.player.zza != 0 || mc.player.xxa != 0;
|
| 52 | case Always -> true;
|
| 53 | };
|
| 54 | }
|
| 55 |
|
| 56 | @EventHandler
|
| 57 | private void onTick(TickEvent.Pre event) {
|
| 58 | if (!mc.player.onGround() || mc.player.isShiftKeyDown() || !jump()) return;
|
| 59 |
|
| 60 | if (mode.get() == Mode.Jump) mc.player.jumpFromGround();
|
| 61 | else ((IVec3) mc.player.getDeltaMovement()).meteor$setY(velocityHeight.get());
|
| 62 | }
|
| 63 |
|
| 64 | public enum JumpWhen {
|
| 65 | Sprinting,
|
| 66 | Walking,
|
| 67 | Always
|
| 68 | }
|
| 69 |
|
| 70 | public enum Mode {
|
| 71 | Jump,
|
| 72 | LowHop
|
| 73 | }
|
| 74 | }
|
| 75 |
|