Skip to content

Commit 8428ee2

Browse files
committed
change: assume fall distance is safe when ground proximity is not enabled
1 parent 52b29a2 commit 8428ee2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/main/kotlin/ru/octol1ttle/flightassistant/impl/computer/data/AirDataComputer.kt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ class AirDataComputer(computers: ComputerBus, private val mc: Minecraft) : Compu
4141
val voidY: Int
4242
get() = level.bottomY - 64
4343

44-
private val fallDistance: Double
44+
private val fallDistance: Double?
4545
get() =
46-
if (computers.gpws.groundY == null || computers.gpws.groundY!! == Double.MAX_VALUE) Double.MAX_VALUE
46+
if (computers.gpws.isDisabledOrFaulted()) null
47+
else if (computers.gpws.groundY == null) Double.MAX_VALUE
4748
//? if >=1.21.5 {
4849
/*else max(player.fallDistance, altitude - computers.gpws.groundY!!)
4950
*///?} else
5051
else max(player.fallDistance.toDouble(), altitude - computers.gpws.groundY!!)
5152

53+
// TODO: consider removing
5254
val fallDistanceSafe: Boolean
53-
get() = player.isInWater || fallDistance <= player.maxFallDistance || isInvulnerableTo(player.damageSources().fall())
55+
get() = player.isInWater || fallDistance == null || fallDistance!! <= player.maxFallDistance || isInvulnerableTo(player.damageSources().fall())
5456

5557
val velocity: Vec3
5658
get() = player.deltaMovement

0 commit comments

Comments
 (0)