Skip to content

Commit a5dc330

Browse files
committed
fix impossible failure and use the accurate wrong stack result
1 parent 5bc4afd commit a5dc330

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

common/src/main/kotlin/com/lambda/interaction/construction/simulation/BuildSimulator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ object BuildSimulator {
496496
return@forEach
497497
}
498498
false
499-
} ?: true
499+
} != false
500500

501501
run rotate@ {
502502
if (!place.axisRotate) {

common/src/main/kotlin/com/lambda/task/tasks/PlaceContainer.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class PlaceContainer @Ta5kBuilder constructor(
6363
val succeeds = results.filterIsInstance<PlaceResult.Place>().filter {
6464
canBeOpened(startStack, it.blockPos, it.context.result.side)
6565
}
66-
val wrongStacks = results.filterIsInstance<BuildResult.WrongStack>().filter {
66+
val wrongStacks = results.filterIsInstance<BuildResult.WrongItemSelection>().filter {
6767
canBeOpened(startStack, it.blockPos, it.context.result.side)
6868
}
6969
(succeeds + wrongStacks).minOrNull()?.let { result ->
@@ -79,9 +79,10 @@ class PlaceContainer @Ta5kBuilder constructor(
7979
}.finally {
8080
success(result.blockPos)
8181
}.execute(this@PlaceContainer)
82-
} ?: {
83-
failure("No valid placement found")
82+
return
8483
}
84+
85+
failure("No valid placement found")
8586
}
8687

8788
private fun SafeContext.canBeOpened(

0 commit comments

Comments
 (0)