Skip to content

Commit a7e1245

Browse files
committed
angled rocket boost option in ElytraFly
1 parent af92600 commit a7e1245

3 files changed

Lines changed: 26 additions & 12 deletions

File tree

src/main/kotlin/com/lambda/module/modules/client/AutoUpdater.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ object AutoUpdater : Module(
7272
ImGuiWindowFlags.NoScrollWithMouse
7373

7474
init {
75-
onEnable {
75+
onEnableUnsafe {
7676
if (mc.currentScreen is LambdaScreen && !showUninstallModal)
7777
showInstallModal = true
7878
showUninstallModal = false
7979
}
8080

81-
onDisable {
81+
onDisableUnsafe {
8282
if (mc.currentScreen is LambdaScreen && !showInstallModal)
8383
showUninstallModal = true
8484
showInstallModal = false
@@ -266,8 +266,8 @@ object AutoUpdater : Module(
266266

267267
if (debug) debug("Downloading client for MC $mcVersion from ${branch.name} branch")
268268

269-
var version: String? = null
270-
var baseUrl: String? = null
269+
var version: String?
270+
var baseUrl: String?
271271

272272
when (branch) {
273273
Branch.Stable -> {
@@ -305,7 +305,7 @@ object AutoUpdater : Module(
305305
try {
306306
val xml = URI(url).toURL().readText()
307307
parseLatestVersion(xml, mcVersion)
308-
} catch (e: java.io.FileNotFoundException) {
308+
} catch (_: java.io.FileNotFoundException) {
309309
if (debug) warn("Metadata not found at $url (repo might be empty)")
310310
null
311311
} catch (e: Exception) {

src/main/kotlin/com/lambda/module/modules/movement/ElytraAltitudeControl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object ElytraAltitudeControl : Module(
5050
}
5151

5252
val controlValue by setting("Control Value", Mode.Altitude)
53-
val targetAltitude by setting("Target Altitude", 120, 0..256, 10, unit = " blocks", description = "Adjusts pitch to control altitude") { controlValue == Mode.Altitude }
53+
val targetAltitude by setting("Target Altitude", 319, 0..1500, 10, unit = " blocks", description = "Adjusts pitch to control altitude") { controlValue == Mode.Altitude }
5454
val targetSpeed by setting("Target Speed", 20.0, 0.1..50.0, 0.1, unit = " m/s", description = "Adjusts pitch to control speed") { controlValue == Mode.Speed }
5555

5656
val horizontalSpeed by setting("Horizontal Speed", false, description = "Uses horizontal speed instead of total speed for speed control") { controlValue == Mode.Speed }
@@ -59,7 +59,7 @@ object ElytraAltitudeControl : Module(
5959
val disableOnFirework by setting("Disable On Firework", false, description = "Disables the module when a firework is used")
6060

6161
val useFireworkOnHeight by setting("Use Firework On Height", false, "Use fireworks when below a certain height")
62-
val minHeight by setting("Min Height", 150, 0..256, 10, unit = " blocks", description = "Minimum height to use firework") { useFireworkOnHeight }
62+
val minHeight by setting("Min Height", 230, 0..1500, 10, unit = " blocks", description = "Minimum height to use firework") { useFireworkOnHeight }
6363

6464
val useFireworkOnSpeed by setting("Use Firework On Speed", false, "Use fireworks based on speed")
6565
val minSpeed by setting("Min Speed", 20.0, 0.1..50.0, 0.1, unit = " m/s", description = "Minimum speed to use fireworks") { useFireworkOnSpeed }

src/main/kotlin/com/lambda/module/modules/movement/elytrafly/ElytraFly.kt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import com.lambda.event.events.MovementEvent
2929
import com.lambda.event.events.PacketEvent
3030
import com.lambda.event.events.TickEvent
3131
import com.lambda.event.listener.SafeListener.Companion.listen
32+
import com.lambda.interaction.managers.rotating.RotationManager
3233
import com.lambda.module.Module
3334
import com.lambda.module.modules.movement.elytrafly.modes.BounceElytraFly
3435
import com.lambda.module.modules.movement.elytrafly.modes.GeneralElytraFly
@@ -39,6 +40,9 @@ import com.lambda.util.extension.isElytraFlying
3940
import com.lambda.util.player.MovementUtils.addSpeed
4041
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket
4142
import net.minecraft.sound.SoundEvents
43+
import net.minecraft.util.math.Vec3d
44+
import kotlin.math.abs
45+
import kotlin.math.sin
4246

4347
object ElytraFly : Module(
4448
name = "ElytraFly",
@@ -51,15 +55,17 @@ object ElytraFly : Module(
5155
to.elytraFly.onEnableListeners.forEach { it() }
5256
}
5357

54-
private val boostSpeed by setting("Boost", 0.00, 0.0..0.5, 0.005, description = "Speed to add when flying")
58+
private val boostSpeed by setting("Boost", 0.0, 0.0..0.5, 0.005, description = "Speed to add when flying")
5559
private val rocketSpeed by setting("Rocket Speed", 1.0, 0.0..2.0, 0.01, description = "Speed multiplier that the rocket gives you")
60+
private val angledRocketBoost by setting("Angled Rocket Boost", true, description = "Automatically scale the firework rocket boost based on your pitch angle")
61+
private val maxAngledBoost by setting("Max Angled Boost", 0.75, 0.0..5.0, 0.05, description = "Additional speed added on top of your base rocket speed when flying diagonally at exactly 45 degrees") { angledRocketBoost }
5662
private val mute by setting("Mute Elytra", false, "Mutes the elytra sound when gliding")
5763
@JvmStatic val fakeFly by setting("Fake Fly", false, "Rapidly swaps the chestplate and elytra to give the appearance the player is flying without an elytra. May also reduce durability loss")
5864

5965
private const val BOUNCE_TAB = "Bounce"
60-
private const val CONTROL_TAB = "Control"
66+
// private const val CONTROL_TAB = "Control"
6167
private const val GRIM_CONTROL_TAB = "Grim Control"
62-
private const val PACKET_TAB = "Packet"
68+
// private const val PACKET_TAB = "Packet"
6369
private const val GENERAL_TAB = "None"
6470

6571
@Tab(GENERAL_TAB) @JvmStatic val generalMode by configBlock(GeneralElytraFly(this))
@@ -101,10 +107,18 @@ object ElytraFly : Module(
101107

102108
@JvmStatic
103109
fun boostRocket() = runSafe {
104-
val vec = player.rotationVector
110+
val rot = RotationManager.activeRotation
111+
112+
var targetSpeed = 1.5 * rocketSpeed
113+
if (angledRocketBoost) {
114+
val scale = sin(Math.toRadians(abs(rot.pitch) * 2.0))
115+
targetSpeed = (1.5 * rocketSpeed) + (maxAngledBoost * scale)
116+
}
117+
118+
val vec = Vec3d.fromPolar(rot.pitchF, rot.yawF)
105119
val velocity = player.velocity
106120

107-
val d = 1.5 * rocketSpeed
121+
val d = targetSpeed
108122
val e = 0.1 * rocketSpeed
109123

110124
player.velocity = velocity.add(

0 commit comments

Comments
 (0)