Skip to content

Commit 165bf0c

Browse files
committed
use main hand stack if viable for scaffold
1 parent 81db64e commit 165bf0c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • src/main/kotlin/com/lambda/module/modules/world

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import net.minecraft.block.Block
4242
import net.minecraft.util.math.BlockPos
4343
import java.util.concurrent.ConcurrentLinkedQueue
4444

45+
@Suppress("unused")
4546
object Scaffold : Module(
4647
name = "Scaffold",
4748
description = "Places blocks under the player",
@@ -77,9 +78,11 @@ object Scaffold : Module(
7778
}
7879

7980
listen<TickEvent.Pre> {
80-
val stack = selectStack {
81+
val selection = selectStack {
8182
{ it.blockItem.let { blockItem -> blockItem != null && blockItem.block !in blacklistedBlocks } }
82-
}.filterStacks(HotbarContainer.stacks).firstOrNull() ?: return@listen
83+
}
84+
val stack = player.mainHandStack.takeIf { selection.filterStack(it) }
85+
?: selection.filterStacks(HotbarContainer.stacks).firstOrNull() ?: return@listen
8386
val playerSupport = player.blockPos.down()
8487
val alreadySupported = blockState(playerSupport).hasSolidTopSurface(world, playerSupport, player)
8588
if (alreadySupported) return@listen

0 commit comments

Comments
 (0)