Skip to content

Commit e82bb80

Browse files
committed
post-processing property checks on break manager block updates and added ignore drop warnings setting in task flow debug
1 parent 196c979 commit e82bb80

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

common/src/main/kotlin/com/lambda/interaction/request/breaking/BreakManager.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import com.lambda.event.listener.UnsafeListener.Companion.listenUnsafe
3131
import com.lambda.graphics.renderer.esp.builders.buildFilled
3232
import com.lambda.graphics.renderer.esp.builders.buildOutline
3333
import com.lambda.interaction.construction.context.BreakContext
34+
import com.lambda.interaction.construction.processing.ProcessorRegistry
3435
import com.lambda.interaction.request.ManagerUtils.isPosBlocked
3536
import com.lambda.interaction.request.PositionBlocking
3637
import com.lambda.interaction.request.Priority
@@ -55,6 +56,7 @@ import com.lambda.util.BlockUtils.emptyState
5556
import com.lambda.util.BlockUtils.isEmpty
5657
import com.lambda.util.BlockUtils.isNotBroken
5758
import com.lambda.util.BlockUtils.isNotEmpty
59+
import com.lambda.util.BlockUtils.matches
5860
import com.lambda.util.Communication.warn
5961
import com.lambda.util.item.ItemUtils.block
6062
import com.lambda.util.math.lerp
@@ -151,9 +153,12 @@ object BreakManager : RequestHandler<BreakRequest>(
151153
.filterNotNull()
152154
.firstOrNull { it.context.blockPos == event.pos }
153155
?.let { info ->
156+
val currentState = info.context.cachedState
154157
// if not broken
155-
if (isNotBroken(info.context.cachedState, event.newState)) {
156-
this@BreakManager.warn("Break at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${info.context.cachedState.emptyState}")
158+
if (isNotBroken(currentState, event.newState)) {
159+
// check to see if its just some small property changes, e.g. redstone ore changing the LIT property
160+
if (!currentState.matches(event.newState, ProcessorRegistry.postProcessedProperties))
161+
this@BreakManager.warn("Break at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${info.context.cachedState.emptyState}")
157162
// update the checked state
158163
info.context.cachedState = event.newState
159164
return@listen

common/src/main/kotlin/com/lambda/interaction/request/breaking/BrokenBlockHandler.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.lambda.event.events.EntityEvent
2424
import com.lambda.event.events.WorldEvent
2525
import com.lambda.event.listener.SafeListener.Companion.listen
2626
import com.lambda.event.listener.UnsafeListener.Companion.listenUnsafe
27+
import com.lambda.interaction.construction.processing.ProcessorRegistry
2728
import com.lambda.interaction.request.breaking.BreakConfig.BreakConfirmationMode
2829
import com.lambda.interaction.request.breaking.BreakManager.lastPosStarted
2930
import com.lambda.interaction.request.breaking.BreakManager.matchesBlockItem
@@ -58,7 +59,7 @@ object BrokenBlockHandler {
5859
if (!loaded) return@let
5960

6061
if (!info.broken) warn("${info::class.simpleName} at ${info.context.blockPos.toShortString()} timed out")
61-
else warn("${info::class.simpleName}'s item drop at ${info.context.blockPos.toShortString()} timed out")
62+
else if (!TaskFlowModule.ignoreItemDropWarnings) warn("${info::class.simpleName}'s item drop at ${info.context.blockPos.toShortString()} timed out")
6263

6364
if (!info.broken && info.breakConfig.breakConfirmation != BreakConfirmationMode.AwaitThenBreak) {
6465
world.setBlockState(info.context.blockPos, info.context.cachedState)
@@ -75,12 +76,13 @@ object BrokenBlockHandler {
7576
?: if (reBreak?.context?.blockPos == event.pos) reBreak
7677
else null
7778
}?.let { pending ->
78-
// return if the state hasn't changed
79-
if (event.newState.matches(pending.context.cachedState))
80-
return@listen
81-
79+
val currentState = pending.context.cachedState
8280
// return if the block's not broken
83-
if (isNotBroken(pending.context.cachedState, event.newState)) {
81+
if (isNotBroken(currentState, event.newState)) {
82+
// return if the state hasn't changed
83+
if (event.newState.matches(currentState, ProcessorRegistry.postProcessedProperties))
84+
return@listen
85+
8486
if (!pending.isReBreaking) {
8587
this@BrokenBlockHandler.warn("Broken block at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${pending.context.cachedState.emptyState}")
8688
pending.stopPending()

common/src/main/kotlin/com/lambda/module/modules/client/TaskFlowModule.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818
package com.lambda.module.modules.client
1919

20-
import com.lambda.config.groups.*
20+
import com.lambda.config.groups.BuildSettings
21+
import com.lambda.config.groups.HotbarSettings
22+
import com.lambda.config.groups.InteractionSettings
23+
import com.lambda.config.groups.InventorySettings
24+
import com.lambda.config.groups.RotationSettings
2125
import com.lambda.event.events.RenderEvent
2226
import com.lambda.event.listener.SafeListener.Companion.listen
2327
import com.lambda.interaction.construction.result.Drawable
@@ -43,6 +47,7 @@ object TaskFlowModule : Module(
4347

4448
val showAllEntries by setting("Show All Entries", false, "Show all entries in the task tree") { page == Page.Debug }
4549
val shrinkFactor by setting("Shrink Factor", 0.001, 0.0..1.0, 0.001) { page == Page.Debug }
50+
val ignoreItemDropWarnings by setting("Ignore Drop Warnings", false, "Hides the item drop warnings from the break manager") { page == Page.Debug }
4651

4752
@Volatile
4853
var drawables = listOf<Drawable>()

0 commit comments

Comments
 (0)