diff --git a/src/main/java/dev/stardust/mixin/MinecraftClientMixin.java b/src/main/java/dev/stardust/mixin/MinecraftClientMixin.java index 57ae320..06417a8 100644 --- a/src/main/java/dev/stardust/mixin/MinecraftClientMixin.java +++ b/src/main/java/dev/stardust/mixin/MinecraftClientMixin.java @@ -61,7 +61,7 @@ private void mixinRender(CallbackInfo ci) { RocketMan.RocketMode mode = rocketMan.usageMode.get(); switch (mode) { - case OnForwardKey -> { + case OnKey -> { if (mc.player.input.sneaking) { changeLookDirection(mc.player, 0.0f, rocketMan.getPitchSpeed() * deltaTime); } else if (mc.player.input.jumping) { diff --git a/src/main/java/dev/stardust/modules/RocketMan.java b/src/main/java/dev/stardust/modules/RocketMan.java index 6d89f17..d49dae5 100644 --- a/src/main/java/dev/stardust/modules/RocketMan.java +++ b/src/main/java/dev/stardust/modules/RocketMan.java @@ -49,7 +49,7 @@ public RocketMan() { public enum KeyModifiers { Alt, Ctrl, Shift, None } public enum HoverMode { Off, Hold, Toggle, Creative } - public enum RocketMode { OnForwardKey, Static, Dynamic, Speed } + public enum RocketMode {OnKey, Static, Dynamic, Speed } private final SettingGroup sgRockets = settings.createGroup("Rocket Usage"); private final SettingGroup sgBoosts = settings.createGroup("Rocket Boosts"); @@ -62,7 +62,15 @@ public enum RocketMode { OnForwardKey, Static, Dynamic, Speed } new EnumSetting.Builder() .name("Usage Mode") .description("Which mode to operate in.") - .defaultValue(RocketMode.OnForwardKey) + .defaultValue(RocketMode.OnKey) + .build() + ); + + public final Setting usageKey = sgRockets.add( + new KeybindSetting.Builder() + .name("Rocket Key") + .description("The key you want to press to use a rocket.") + .defaultValue(Keybind.fromKey(GLFW.GLFW_KEY_W)) .build() ); @@ -71,7 +79,7 @@ public enum RocketMode { OnForwardKey, Static, Dynamic, Speed } .name("Rocket Usage Cooldown") .description("How often (in ticks) to allow using firework rockets.") .range(1, 10000).sliderRange(2, 100).defaultValue(40) - .visible(() -> usageMode.get().equals(RocketMode.OnForwardKey) || usageMode.get().equals(RocketMode.Speed)) + .visible(() -> usageMode.get().equals(RocketMode.OnKey) || usageMode.get().equals(RocketMode.Speed)) .build() ); @@ -197,7 +205,7 @@ public enum RocketMode { OnForwardKey, Static, Dynamic, Speed } .name("Invert Pitch") .description("Invert pitch control for W & S keys.") .defaultValue(false) - .visible(() -> keyboardControl.get() && !usageMode.get().equals(RocketMode.OnForwardKey)) + .visible(() -> keyboardControl.get() && !usageMode.get().equals(RocketMode.OnKey)) .build() ); @@ -686,6 +694,7 @@ public boolean shouldMuteElytra() { // See FireworkRocketEntityMixin.java public double getRocketBoostAcceleration() { + if (isHovering) return 0.0; double maxSpeed = speedSetting.get(); double currentBps = Math.round(Utils.getPlayerSpeed().length() * 100) * .01; double increment = shouldLockYLevel() ? accelerationSetting.get() * 2 : accelerationSetting.get(); @@ -869,6 +878,7 @@ private void onTick(TickEvent.Pre event) { ++timer; ++hoverTimer; ++ticksFlying; + firstRocket = true; ++rocketStockTicks; ++durabilityCheckTicks; if (hoverTimer == 2 && (!hasActiveRocket || durationBoosted)) { @@ -899,8 +909,8 @@ private void onTick(TickEvent.Pre event) { case Dynamic -> { if (!hasActiveRocket) useFireworkRocket("dynamic usage"); } - case OnForwardKey -> { - if (mc.player.input.pressingForward && !justUsed) { + case OnKey -> { + if (usageKey.get().isPressed() && !justUsed) { justUsed = true; useFireworkRocket("forward key usage"); }