Skip to content

Commit 653e71c

Browse files
committed
Proper drop collection
1 parent c14bd87 commit 653e71c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import java.util.concurrent.ConcurrentLinkedQueue
5252
class BuildTask @Ta5kBuilder constructor(
5353
private val blueprint: Blueprint,
5454
private val finishOnDone: Boolean = true,
55+
private val collectDrops: Boolean = TaskFlowModule.build.collectDrops,
5556
private val build: BuildConfig = TaskFlowModule.build,
5657
private val rotation: RotationConfig = TaskFlowModule.rotation,
5758
private val interact: InteractionConfig = TaskFlowModule.interact,
@@ -141,7 +142,7 @@ class BuildTask @Ta5kBuilder constructor(
141142
LOG.info("Resolving: ${result.name}")
142143

143144
if (result is BreakResult.Break) {
144-
result.collectDrop = build.collectDrops
145+
result.collectDrop = collectDrops
145146
}
146147

147148
result.resolve().execute(this@BuildTask, pauseParent = result.pausesParent)
@@ -180,50 +181,55 @@ class BuildTask @Ta5kBuilder constructor(
180181
@Ta5kBuilder
181182
fun build(
182183
finishOnDone: Boolean = true,
184+
collectDrops: Boolean = TaskFlowModule.build.collectDrops,
183185
build: BuildConfig = TaskFlowModule.build,
184186
rotation: RotationConfig = TaskFlowModule.rotation,
185187
interact: InteractionConfig = TaskFlowModule.interact,
186188
blueprint: () -> Blueprint,
187-
) = BuildTask(blueprint(), finishOnDone, build, rotation, interact)
189+
) = BuildTask(blueprint(), finishOnDone, collectDrops, build, rotation, interact)
188190

189191
@Ta5kBuilder
190192
fun Structure.build(
191193
finishOnDone: Boolean = true,
194+
collectDrops: Boolean = TaskFlowModule.build.collectDrops,
192195
build: BuildConfig = TaskFlowModule.build,
193196
rotation: RotationConfig = TaskFlowModule.rotation,
194197
interact: InteractionConfig = TaskFlowModule.interact
195-
) = BuildTask(toBlueprint(), finishOnDone, build, rotation, interact)
198+
) = BuildTask(toBlueprint(), finishOnDone, collectDrops, build, rotation, interact)
196199

197200
@Ta5kBuilder
198201
fun Blueprint.build(
199202
finishOnDone: Boolean = true,
203+
collectDrops: Boolean = TaskFlowModule.build.collectDrops,
200204
build: BuildConfig = TaskFlowModule.build,
201205
rotation: RotationConfig = TaskFlowModule.rotation,
202206
interact: InteractionConfig = TaskFlowModule.interact
203-
) = BuildTask(this, finishOnDone, build, rotation, interact)
207+
) = BuildTask(this, finishOnDone, collectDrops, build, rotation, interact)
204208

205209
@Ta5kBuilder
206210
fun breakAndCollectBlock(
207211
blockPos: BlockPos,
208212
finishOnDone: Boolean = true,
213+
collectDrops: Boolean = true,
209214
build: BuildConfig = TaskFlowModule.build,
210215
rotation: RotationConfig = TaskFlowModule.rotation,
211216
interact: InteractionConfig = TaskFlowModule.interact
212217
) = BuildTask(
213218
blockPos.toStructure(TargetState.Air).toBlueprint(),
214-
finishOnDone, build, rotation, interact
219+
finishOnDone, collectDrops, build, rotation, interact
215220
)
216221

217222
@Ta5kBuilder
218223
fun breakBlock(
219224
blockPos: BlockPos,
220225
finishOnDone: Boolean = true,
226+
collectDrops: Boolean = TaskFlowModule.build.collectDrops,
221227
build: BuildConfig = TaskFlowModule.build,
222228
rotation: RotationConfig = TaskFlowModule.rotation,
223229
interact: InteractionConfig = TaskFlowModule.interact
224230
) = BuildTask(
225231
blockPos.toStructure(TargetState.Air).toBlueprint(),
226-
finishOnDone, build, rotation, interact
232+
finishOnDone, collectDrops, build, rotation, interact
227233
)
228234
}
229235
}

0 commit comments

Comments
 (0)