File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
common/src/main/kotlin/com/lambda/interaction/request/breaking Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import com.lambda.interaction.construction.context.BreakContext
2121import com.lambda.interaction.request.ActionInfo
2222import com.lambda.threading.runSafe
2323import com.lambda.util.BlockUtils.calcItemBlockBreakingDelta
24+ import com.lambda.util.collections.updatableLazy
2425import net.minecraft.client.network.ClientPlayerEntity
2526import net.minecraft.client.network.ClientPlayerInteractionManager
2627import net.minecraft.client.world.ClientWorld
@@ -42,7 +43,7 @@ data class BreakInfo(
4243 var progressedThisTick = false
4344 var serverBreakTicks = 0
4445
45- var couldReBreak = lazy {
46+ var couldReBreak = updatableLazy {
4647 runSafe {
4748 ReBreakManager .couldReBreak(this @BreakInfo, player, world)
4849 } == true
@@ -107,7 +108,7 @@ data class BreakInfo(
107108 val breakProgress = breakDelta * ((breakingTicks + 1 ) - breakConfig.fudgeFactor).let {
108109 if (isSecondary) it + 1 else it
109110 }
110- return if (couldReBreak.value)
111+ return if (couldReBreak.value == true )
111112 breakConfig.swapMode.isEnabled()
112113 else when (breakConfig.swapMode) {
113114 BreakConfig .SwapMode .None -> false
Original file line number Diff line number Diff line change @@ -297,6 +297,9 @@ object BreakManager : RequestHandler<BreakRequest>(
297297 if (instantBreaks.isEmpty()) rotation.submit(false ) else rotation
298298 }
299299 }
300+ .also {
301+ it.forEach { it.couldReBreak.update() }
302+ }
300303 .also {
301304 if (breakInfos.none { it?.shouldSwap(player, world) == true }) return @also
302305
@@ -329,7 +332,7 @@ object BreakManager : RequestHandler<BreakRequest>(
329332 if (tickStage !in info.breakConfig.breakStageMask) return @forEach
330333 if (! rotated && info.isPrimary) return @run
331334
332- if (info.couldReBreak.value) when (val reBreakResult = ReBreakManager .handleUpdate(info.context, info.request)) {
335+ if (info.couldReBreak.value == true ) when (val reBreakResult = ReBreakManager .handleUpdate(info.context, info.request)) {
333336 is ReBreakResult .StillBreaking -> {
334337 primaryBreak = reBreakResult.breakInfo.apply {
335338 type = Primary
You can’t perform that action at this time.
0 commit comments