Skip to content

Commit 3d7a602

Browse files
committed
fix cave air edge case in isEmpty check
1 parent 54ee6e7 commit 3d7a602

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/kotlin/com/lambda/interaction/construction/simulation/checks/BreakChecker.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ class BreakChecker @SimCheckerDsl private constructor(simInfo: SimInfo)
119119
}
120120

121121
private suspend fun AutomatedSafeContext.checkBreaks(): Boolean {
122+
if (state.isEmpty) return false
123+
122124
if (breakConfig.avoidSupporting) player.supportingBlockPos.getOrNull()?.let { support ->
123125
if (support != pos) return@let
124126
result(BreakResult.PlayerOnTop(pos, state))
@@ -130,8 +132,6 @@ class BreakChecker @SimCheckerDsl private constructor(simInfo: SimInfo)
130132
return simInfo(pos, state, TargetState.Solid(emptySet()))?.checkPlacements() ?: true
131133
}
132134

133-
if (state.isEmpty) return false
134-
135135
if (breakConfig.avoidLiquids && affectsFluids()) return true
136136

137137
val swapStack = getSwapStack() ?: return true

src/main/kotlin/com/lambda/util/BlockUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ object BlockUtils {
305305
return speedMultiplier
306306
}
307307

308-
val BlockState.isEmpty get() = matches(emptyState)
308+
val BlockState.isEmpty get() = isAir || matches(emptyState)
309309
val BlockState.isNotEmpty get() = !isEmpty
310310
val BlockState.hasFluid get() = !fluidState.isEmpty
311311
val BlockState.emptyState: BlockState get() = fluidState.blockState

0 commit comments

Comments
 (0)