Skip to content

Commit 462f2e7

Browse files
committed
Fix collecting items
1 parent d15a366 commit 462f2e7

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

common/src/main/kotlin/com/lambda/interaction/construction/result/BreakResult.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ sealed class BreakResult : BuildResult() {
3030
private val color = Color(222, 0, 0, 100)
3131

3232
var collectDrop = false
33+
override val pausesParent get() = collectDrop
3334

3435
override fun SafeContext.onStart() {
3536
breakBlock(context, collectDrop = collectDrop).onSuccess { _, _ ->

common/src/main/kotlin/com/lambda/module/modules/player/HighwayTools.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object HighwayTools : Module(
2828
private val rimHeight by setting("Rim Height", 1, 0..6, 1)
2929
private val cornerBlock by setting("Corner Block", false, description = "Include corner blocks in the highway")
3030
private val ceiling by setting("Ceiling", false, description = "Smooth roof over the highway")
31-
private val ceilingMaterial by setting("Ceiling Material", Blocks.OBSIDIAN, description = "Material to build the ceiling with")
31+
private val ceilingMaterial by setting("Ceiling Material", Blocks.OBSIDIAN, description = "Material to build the ceiling with") { ceiling }
3232
private val distance by setting("Distance", -1, -1..1000000, 1, description = "Distance to build the highway (negative for infinite)")
3333
private val sliceSize by setting("Slice Size", 3, 1..5, 1, description = "Number of slices to build at once")
3434
private val material by setting("Highway Material", Blocks.OBSIDIAN, description = "Material to build the highway with")

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class BreakBlock @Ta5kBuilder constructor(
7676
listener<TickEvent.Pre> {
7777
drop?.let { itemDrop ->
7878
if (!world.entities.contains(itemDrop)) {
79+
BaritoneUtils.cancel()
7980
success(itemDrop)
8081
return@listener
8182
}
@@ -86,6 +87,7 @@ class BreakBlock @Ta5kBuilder constructor(
8687
}?.let {
8788
clickSlot(it.index, 1, SlotActionType.THROW)
8889
}
90+
return@listener
8991
}
9092

9193
BaritoneUtils.setGoalAndPath(GoalBlock(itemDrop.blockPos))
@@ -98,16 +100,17 @@ class BreakBlock @Ta5kBuilder constructor(
98100
if (done()) {
99101
state = State.COLLECTING
100102
if (!collectDrop) {
103+
BaritoneUtils.cancel()
101104
success(null)
102105
}
103106
}
104107
}
105108

109+
// ToDo: Find out when the stack entity is filled with the item
106110
listener<WorldEvent.EntityUpdate> {
107111
if (collectDrop
108112
&& it.entity is ItemEntity
109113
&& it.entity.pos.isInRange(blockPos.toCenterPos(), 0.5)
110-
111114
) {
112115
drop = it.entity
113116
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,11 @@ class PlaceContainer @Ta5kBuilder constructor(
3232
.simulate(player.getCameraPosVec(mc.tickDelta))
3333
}
3434

35-
// val res = results.sorted()
36-
// res
37-
3835
val succeeds = results.filterIsInstance<PlaceResult.Place>().filter {
3936
canBeOpened(stack, it.blockPos, it.context.result.side)
4037
}
4138
val wrongStacks = results.filterIsInstance<BuildResult.WrongStack>().filter {
42-
val result = (it.context as? PlaceContext)?.result ?: return@filter false
43-
canBeOpened(stack, it.blockPos, result.side)
39+
canBeOpened(stack, it.blockPos, it.context.result.side)
4440
}
4541
(succeeds + wrongStacks).minOrNull()?.let { result ->
4642
build {

common/src/main/kotlin/com/lambda/util/item/ItemUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ object ItemUtils {
5353

5454
val misc = setOf(
5555
Items.SHEARS,
56+
Items.FLINT_AND_STEEL,
5657
)
5758

5859
val tools = pickaxes + shovels + axes + hoes + swords + misc

0 commit comments

Comments
 (0)