Skip to content

Commit 063701c

Browse files
committed
keep firework velocity when moving from still
1 parent 89b9d72 commit 063701c

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ object ElytraFly : Module(
105105
}
106106
}
107107

108+
@JvmStatic
109+
fun getFireworkTargetVelocity(rotPitch: Float, rotYaw: Float): Vec3d {
110+
var targetSpeed = 1.5 * rocketSpeed
111+
if (angledRocketBoost) {
112+
val scale = sin(Math.toRadians(abs(rotPitch) * 2.0))
113+
targetSpeed = (1.5 * rocketSpeed) + (maxAngledBoost * scale)
114+
}
115+
val vec = Vec3d.fromPolar(rotPitch, rotYaw)
116+
val d = targetSpeed
117+
val e = 0.1 * rocketSpeed
118+
return vec.multiply(d + e * 2)
119+
}
120+
108121
@JvmStatic
109122
fun boostRocket() =
110123
runSafe {

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import com.lambda.interaction.managers.rotating.IRotationRequest.Companion.rotat
2727
import com.lambda.interaction.managers.rotating.RotationManager
2828
import com.lambda.interaction.material.StackSelection.Companion.select
2929
import com.lambda.module.modules.movement.BetterFirework.startFirework
30+
import com.lambda.module.modules.movement.elytrafly.ElytraFly
3031
import com.lambda.module.modules.movement.elytrafly.ElytraFly.FlyMode
3132
import com.lambda.module.modules.movement.elytrafly.ElytraFlyMode
3233
import com.lambda.module.modules.render.Freecam
@@ -121,7 +122,10 @@ class GrimControlElytraFly(
121122
rotationRequest { rotation(rot.y, rot.x) }.submit()
122123
if (hasFirework) {
123124
moving = true
124-
if (prevStill) player.velocity = Vec3d.ZERO
125+
if (prevStill) {
126+
val activeRot = RotationManager.activeRotation
127+
player.velocity = ElytraFly.getFireworkTargetVelocity(activeRot.pitchF, activeRot.yawF)
128+
}
125129
}
126130
}
127131

0 commit comments

Comments
 (0)