@@ -40,6 +40,7 @@ import com.lambda.util.Timer
4040import com.lambda.util.extension.isElytraFlying
4141import com.lambda.util.extension.prevPos
4242import com.lambda.util.player.MovementUtils.addSpeed
43+ import com.lambda.util.player.PlayerUtils.hasFirework
4344import net.minecraft.component.DataComponentTypes
4445import net.minecraft.entity.MovementType
4546import net.minecraft.item.Items
@@ -116,14 +117,13 @@ object ElytraFly : Module(
116117 }
117118 onDisable { mode.elytraFly.onDisableListeners.forEach { it() } }
118119
119- listen<TickEvent .Pre >(priority = { 1 }) {
120+ listen<TickEvent .Pre >(priority = { 2 }) {
120121 if (! player.isGliding) {
121122 hasFirework = false
122123 return @listen
123124 }
124- if (fireworkTimer.timePassed((lastFireworkDuration - safetyMargin).seconds)) {
125- hasFirework = false
126- }
125+ if (! withinFireworkTimeframe()) hasFirework = false
126+ hasFirework = hasFirework || player.hasFirework
127127 }
128128
129129 listen<PacketEvent .Send .Pre > { event ->
@@ -133,7 +133,6 @@ object ElytraFly : Module(
133133 if (stack.item != Items .FIREWORK_ROCKET ) return @listen
134134 fireworkTimer.reset()
135135 lastFireworkDuration = (stack.get(DataComponentTypes .FIREWORKS )?.flightDuration ? : 1 ) * 0.5 + 0.5
136- hasFirework = true
137136 }
138137
139138 listen<TickEvent .Pre > {
@@ -219,6 +218,8 @@ object ElytraFly : Module(
219218 )
220219 }
221220
221+ fun withinFireworkTimeframe () = ! fireworkTimer.timePassed((lastFireworkDuration - safetyMargin).seconds)
222+
222223 private fun farthestPointInBox (bounds : DoubleArray , aim : Vec3d ): Vec3d ? {
223224 val center = Vec3d (
224225 (bounds[0 ] + bounds[3 ]) / 2.0 ,
0 commit comments