diff --git a/src/main/java/anticope/rejects/modules/Boost.java b/src/main/java/anticope/rejects/modules/Boost.java index 0b8f06c..1b2581a 100644 --- a/src/main/java/anticope/rejects/modules/Boost.java +++ b/src/main/java/anticope/rejects/modules/Boost.java @@ -1,38 +1,67 @@ package anticope.rejects.modules; import anticope.rejects.MeteorRejectsAddon; +import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.settings.*; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.orbit.EventHandler; import net.minecraft.util.math.Vec3d; -import meteordevelopment.meteorclient.settings.DoubleSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.systems.modules.Module; - public class Boost extends Module { - private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final Setting strength = sgGeneral.add(new DoubleSetting.Builder() - .name("strength") - .description("Strength to yeet you with.") - .defaultValue(4.0) - .min(0.5) - .sliderMax(10) - .build() + .name("strength") + .description("Strength to yeet you with.") + .defaultValue(4.0) + .sliderMax(10) + .build() ); + private final Setting autoBoost = sgGeneral.add(new BoolSetting.Builder() + .name("auto-boost") + .description("Automatically boosts you.") + .defaultValue(false) + .build() + ); + + private final Setting interval = sgGeneral.add(new IntSetting.Builder() + .name("interval") + .description("Boost interval in ticks.") + .visible(autoBoost::get) + .defaultValue(20) + .sliderMax(120) + .build() + ); + + private int timer = 0; + public Boost() { super(MeteorRejectsAddon.CATEGORY, "boost", "Works like a dash move."); } - + @Override public void onActivate() { - if (mc.player == null) { + timer = interval.get(); + if (!autoBoost.get()) { + if (mc.player != null) boost(); this.toggle(); - return; } + } + + @EventHandler + private void onTick(TickEvent.Pre event) { + if (!autoBoost.get()) return; + if (timer < 1) { + boost(); + timer = interval.get(); + } else { + timer--; + } + } + + private void boost() { Vec3d v = mc.player.getRotationVecClient().multiply(strength.get()); mc.player.addVelocity(v.getX(), v.getY(), v.getZ()); - this.toggle(); } }