Skip to content

Commit fca8b54

Browse files
committed
auto takeoff
1 parent dd762a6 commit fca8b54

File tree

1 file changed

+16
-3
lines changed
  • src/main/kotlin/com/lambda/module/modules/movement

1 file changed

+16
-3
lines changed

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import com.lambda.event.events.TickEvent
2525
import com.lambda.event.listener.SafeListener.Companion.listen
2626
import com.lambda.interaction.managers.rotating.IRotationRequest.Companion.rotationRequest
2727
import com.lambda.module.Module
28+
import com.lambda.module.modules.movement.BetterFirework.canOpenElytra
29+
import com.lambda.module.modules.movement.BetterFirework.canTakeoff
2830
import com.lambda.module.tag.ModuleTag
2931
import com.lambda.threading.runSafe
3032
import com.lambda.util.extension.isElytraFlying
@@ -40,7 +42,7 @@ object ElytraFly : Module(
4042
@JvmStatic val mode by setting("Mode", FlyMode.Bounce)
4143

4244
//ToDo: Implement these commented out settings
43-
// private val takeoff by setting("Takeoff", true, "Automatically jumps and initiates gliding") { mode == FlyMode.Bounce }
45+
private val takeoff by setting("Takeoff", true, "Automatically jumps and initiates gliding") { mode == FlyMode.Bounce }
4446
private val autoPitch by setting("Auto Pitch", true, "Automatically pitches the players rotation down to bounce at faster speeds") { mode == FlyMode.Bounce }
4547
private val pitch by setting("Pitch", 70, 0..90, 1) { autoPitch && mode == FlyMode.Bounce }
4648
private val jump by setting("Jump", true, "Automatically jumps") { mode == FlyMode.Bounce }
@@ -52,6 +54,8 @@ object ElytraFly : Module(
5254

5355
private val mute by setting("Mute Elytra", false, "Mutes the elytra sound when gliding")
5456

57+
var jumpThisTick = false
58+
5559
init {
5660
setDefaultAutomationConfig {
5761
applyEdits {
@@ -67,13 +71,22 @@ object ElytraFly : Module(
6771
}.submit()
6872
}
6973

70-
if (mode == FlyMode.Bounce && player.isGliding)
74+
if (!player.isGliding) {
75+
if (takeoff && player.canTakeoff) {
76+
if (player.canOpenElytra) player.startGliding();
77+
else jumpThisTick = true
78+
}
79+
return@listen
80+
}
81+
82+
if (mode == FlyMode.Bounce)
7183
connection.sendPacket(ClientCommandC2SPacket(player, ClientCommandC2SPacket.Mode.START_FALL_FLYING))
7284
}
7385

7486
listen<MovementEvent.InputUpdate> { event ->
75-
if (player.isGliding && mode == FlyMode.Bounce && jump) {
87+
if (mode == FlyMode.Bounce && ((player.isGliding && jump) || jumpThisTick)) {
7688
event.input.jump()
89+
jumpThisTick = false
7790
}
7891
}
7992

0 commit comments

Comments
 (0)