Skip to content

Commit 79799aa

Browse files
committed
remove problematic return if current dir was valid
1 parent 7dd5283 commit 79799aa

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

common/src/main/kotlin/com/lambda/interaction/construction/context/PlaceContext.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ data class PlaceContext(
4141
override val expectedState: BlockState,
4242
val sneak: Boolean,
4343
val insideBlock: Boolean,
44-
val currentDirIsInvalid: Boolean = false
44+
val currentDirIsValid: Boolean = false
4545
) : BuildContext() {
4646
private val baseColor = Color(35, 188, 254, 25)
4747
private val sideColor = Color(35, 188, 254, 100)
@@ -75,7 +75,7 @@ data class PlaceContext(
7575
fun requestDependencies(request: PlaceRequest): Boolean {
7676
val hotbarRequest = request.hotbar.request(HotbarRequest(hotbarIndex, request.hotbar), false)
7777
val validRotation = if (request.build.placing.rotateForPlace) {
78-
request.rotation.request(rotation, false).done && !currentDirIsInvalid
78+
request.rotation.request(rotation, false).done && currentDirIsValid
7979
} else true
8080
return hotbarRequest.done && validRotation
8181
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,12 @@ object BuildSimulator {
534534
}
535535
}
536536

537-
val currentDirIsInvalid = simulatePlaceState()?.let { basePlaceResult ->
537+
val currentDirIsValid = simulatePlaceState()?.let { basePlaceResult ->
538538
if (!place.rotateForPlace) {
539539
return basePlaceResult
540540
}
541-
true
542-
} ?: false
541+
false
542+
} ?: true
543543

544544
run rotate@ {
545545
if (!place.axisRotate) {
@@ -557,8 +557,6 @@ object BuildSimulator {
557557
return@rotate
558558
}
559559

560-
if (!currentDirIsInvalid) return@rotate
561-
562560
PlaceDirection.entries.asReversed().forEachIndexed direction@ { index, direction ->
563561
fakePlayer.rotation = direction.rotation
564562
when (val placeResult = simulatePlaceState()) {
@@ -596,7 +594,7 @@ object BuildSimulator {
596594
resultState,
597595
shouldSneak,
598596
false,
599-
currentDirIsInvalid
597+
currentDirIsValid
600598
)
601599

602600
val currentHandStack = player.getStackInHand(Hand.MAIN_HAND)

0 commit comments

Comments
 (0)