@@ -50,7 +50,7 @@ import com.lambda.interaction.construction.verify.TargetState
5050import com.lambda.interaction.request.breaking.BreakRequest.Companion.breakRequest
5151import com.lambda.interaction.request.interacting.InteractRequest
5252import com.lambda.interaction.request.inventory.InventoryRequest.Companion.inventoryRequest
53- import com.lambda.interaction.request.placing.PlaceRequest
53+ import com.lambda.interaction.request.placing.PlaceRequest.Companion.placeRequest
5454import com.lambda.task.Task
5555import com.lambda.task.tasks.EatTask.Companion.eat
5656import com.lambda.threading.runSafeAutomated
@@ -168,32 +168,19 @@ class BuildTask private constructor(
168168 is Contextual -> {
169169 if (atMaxPendingInteractions) return
170170 when (result) {
171- is BreakResult .Break -> {
172- val breakResults = allResults
173- .map { if (it is Dependent ) it.lastDependency else it }
174- .filterIsInstance<BreakResult .Break >()
175- .map { it.context }
176-
177- breakRequest(breakResults, pendingInteractions) {
171+ is BreakResult .Break ->
172+ allResults.breakRequest(pendingInteractions) {
178173 onStop { breaks++ }
179174 onItemDrop?.let { onItemDrop ->
180175 onItemDrop { onItemDrop(it) }
181176 }
182- }.submit(queueIfMismatchedStage = true )
183- return
184- }
185- is PlaceResult .Place -> {
186- val placeResults = allResults
187- .map { if (it is Dependent ) it.lastDependency else it }
188- .filterIsInstance<PlaceResult .Place >()
189- .map { it.context }
177+ }?.submit()
178+
179+ is PlaceResult .Place ->
180+ allResults.placeRequest(pendingInteractions, false ) {
181+ onPlace { placements++ }
182+ }?.submit()
190183
191- PlaceRequest (
192- placeResults,
193- pendingInteractions,
194- this @BuildTask
195- ) { placements++ }.submit(queueIfMismatchedStage = true )
196- }
197184 is InteractResult .Interact -> {
198185 val interactResults = allResults
199186 .map { if (it is Dependent ) it.lastDependency else it }
@@ -258,7 +245,7 @@ class BuildTask private constructor(
258245 @Ta5kBuilder
259246 fun Automated.build (
260247 finishOnDone : Boolean = true,
261- collectDrops : Boolean = DEFAULT . buildConfig.collectDrops,
248+ collectDrops : Boolean = buildConfig.collectDrops,
262249 lifeMaintenance : Boolean = false,
263250 blueprint : () -> Blueprint
264251 ) = BuildTask (blueprint(), finishOnDone, collectDrops, lifeMaintenance, this )
@@ -267,15 +254,15 @@ class BuildTask private constructor(
267254 context(automated: Automated )
268255 fun Structure.build (
269256 finishOnDone : Boolean = true,
270- collectDrops : Boolean = DEFAULT .buildConfig.collectDrops,
257+ collectDrops : Boolean = automated .buildConfig.collectDrops,
271258 lifeMaintenance : Boolean = false
272259 ) = BuildTask (toBlueprint(), finishOnDone, collectDrops, lifeMaintenance, automated)
273260
274261 @Ta5kBuilder
275262 context(automated: Automated )
276263 fun Blueprint.build (
277264 finishOnDone : Boolean = true,
278- collectDrops : Boolean = DEFAULT .buildConfig.collectDrops,
265+ collectDrops : Boolean = automated .buildConfig.collectDrops,
279266 lifeMaintenance : Boolean = false
280267 ) = BuildTask (this , finishOnDone, collectDrops, lifeMaintenance, automated)
281268
@@ -289,16 +276,5 @@ class BuildTask private constructor(
289276 blockPos.toStructure(TargetState .Air ).toBlueprint(),
290277 finishOnDone, collectDrops, lifeMaintenance, this
291278 )
292-
293- @Ta5kBuilder
294- fun Automated.breakBlock (
295- blockPos : BlockPos ,
296- finishOnDone : Boolean = true,
297- collectDrops : Boolean = DEFAULT .buildConfig.collectDrops,
298- lifeMaintenance : Boolean = false
299- ) = BuildTask (
300- blockPos.toStructure(TargetState .Air ).toBlueprint(),
301- finishOnDone, collectDrops, lifeMaintenance, this
302- )
303279 }
304280}
0 commit comments