Skip to content

Commit 57409c9

Browse files
committed
only take first placement as other valid placements wont have the correct simulation immediately after one is placed.
1 parent 563137a commit 57409c9

File tree

1 file changed

+8
-4
lines changed
  • src/main/kotlin/com/lambda/module/modules/player

1 file changed

+8
-4
lines changed

src/main/kotlin/com/lambda/module/modules/player/Scaffold.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import com.lambda.module.Module
3737
import com.lambda.module.tag.ModuleTag
3838
import com.lambda.util.BlockUtils.blockPos
3939
import com.lambda.util.BlockUtils.blockState
40+
import com.lambda.util.BlockUtils.isNotEmpty
4041
import com.lambda.util.KeyCode
4142
import com.lambda.util.KeyboardUtils.isKeyPressed
4243
import com.lambda.util.NamedEnum
@@ -81,11 +82,12 @@ object Scaffold : Module(
8182
.simulate(player.eyePos, interactionConfig, rotationConfig, inventoryConfig, buildConfig)
8283
.filterIsInstance<PlaceResult.Place>()
8384
.let { results ->
84-
val contexts = results
85+
val context = results
8586
.map { it.context }
8687
.distinctBy { it.blockPos }
8788
.sortedWith { o1, o2 -> getBridgeCompareBy(beneath).compare(o1, o2) }
88-
submit(PlaceRequest(contexts, pendingActions, buildConfig, hotbarConfig, rotationConfig))
89+
.firstOrNull() ?: return@listen
90+
submit(PlaceRequest(setOf(context), pendingActions, buildConfig, hotbarConfig, rotationConfig))
8991
}
9092
}
9193
}
@@ -115,9 +117,11 @@ object Scaffold : Module(
115117
Direction.entries.forEach { direction ->
116118
val offset = blockPos.offset(direction)
117119
val offsetState = blockState(offset)
118-
if (!offsetState.isReplaceable) potentials.add(offset)
120+
if (offsetState.isNotEmpty) potentials.add(offset)
119121
}
120122
val trueCenter = center.toCenterPos()
121-
return potentials.any { it.toCenterPos() distSq trueCenter > blockPos.toCenterPos() distSq trueCenter }
123+
return potentials.isEmpty() || potentials.any {
124+
it.toCenterPos() distSq trueCenter > blockPos.toCenterPos() distSq trueCenter
125+
}
122126
}
123127
}

0 commit comments

Comments
 (0)