Skip to content

Commit 642f448

Browse files
committed
improve canAccept and ignored block handling for break simulation / break manager
1 parent 0b8bdca commit 642f448

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.lambda.interaction.construction.simulation.checks
1919

2020
import com.lambda.context.AutomatedSafeContext
21+
import com.lambda.interaction.construction.simulation.BreakSimInfo
2122
import com.lambda.interaction.construction.simulation.Results
2223
import com.lambda.interaction.construction.simulation.SimDsl
2324
import com.lambda.interaction.construction.simulation.SimInfo
@@ -47,7 +48,7 @@ object BasicChecker : Results<PreSimResult> {
4748
}
4849

4950
// block should be ignored
50-
if (state.block in breakConfig.ignoredBlocks && targetState.isEmpty()) {
51+
if (state.block in breakConfig.ignoredBlocks && this@hasBasicRequirements is BreakSimInfo) {
5152
result(GenericResult.Ignored(pos))
5253
return false
5354
}
@@ -70,7 +71,7 @@ object BasicChecker : Results<PreSimResult> {
7071
return false
7172
}
7273

73-
// block is unbreakable, so it cant be broken or replaced
74+
// block is unbreakable, so it can't be broken or replaced
7475
if (state.getHardness(world, pos) < 0 && !gamemode.isCreative) {
7576
result(PreSimResult.Unbreakable(pos, state))
7677
return false

src/main/kotlin/com/lambda/interaction/managers/breaking/BreakManager.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,9 @@ object BreakManager : Manager<BreakRequest>(
425425
private fun SafeContext.canAccept(newCtx: BreakContext): Boolean {
426426
if (activeInfos.none { it.context.blockPos == newCtx.blockPos } && isPosBlocked(newCtx.blockPos)) return false
427427

428-
val blockState = blockState(newCtx.blockPos)
429428
val hardness = newCtx.cachedState.getHardness(world, newCtx.blockPos)
430429

431-
return blockState.isNotEmpty && hardness != 600f && hardness != -1f
430+
return newCtx.cachedState.isNotEmpty && (hardness != -1f || player.isCreative)
432431
}
433432

434433
/**

0 commit comments

Comments
 (0)