Skip to content

Commit e254283

Browse files
committed
only process new breaks on a matched tick stage. Should fix swap spam when instamining different blocks that require different tools
1 parent b98ed2b commit e254283

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/main/kotlin/com/lambda/config/groups/BreakSettings.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ open class BreakSettings(
7474

7575
// Pending / Post
7676
override val breakConfirmation by c.setting("${prefix}Break Confirmation", BreakConfirmationMode.BreakThenAwait, "The style of confirmation used when breaking", visibility = visibility).group(*baseGroup, Group.General).index()
77-
override val breaksPerTick by c.setting("${prefix}Breaks Per Tick", 5, 1..30, 1, "Maximum instant block breaks per tick", visibility = visibility).group(*baseGroup, Group.General).index()
77+
override val breaksPerTick by c.setting("${prefix}Breaks Per Tick", 30, 1..30, 1, "Maximum instant block breaks per tick", visibility = visibility).group(*baseGroup, Group.General).index()
7878

7979
// Block
8080
override val ignoredBlocks by c.setting("${prefix}Ignored Blocks", emptySet<Block>(), description = "Blocks that wont be broken", visibility = visibility).group(*baseGroup, Group.General).index()

src/main/kotlin/com/lambda/interaction/managers/breaking/BreakManager.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -462,17 +462,20 @@ object BreakManager : Manager<BreakRequest>(
462462
*
463463
* @see initNewBreak
464464
*/
465-
private fun SafeContext.processNewBreak(request: BreakRequest): Boolean = request.runSafeAutomated {
466-
breaks.forEach { ctx ->
467-
if (breaksThisTick >= maxBreaksThisTick) return false
468-
if (!currentStackSelection.filterStack(player.inventory.getStack(ctx.hotbarIndex))) return@forEach
465+
private fun SafeContext.processNewBreak(request: BreakRequest): Boolean =
466+
request.runSafeAutomated {
467+
if (tickStage !in request.breakConfig.tickStageMask) return false
469468

470-
initNewBreak(ctx, request) ?: return false
471-
breaks.remove(ctx)
472-
return true
469+
breaks.forEach { ctx ->
470+
if (breaksThisTick >= maxBreaksThisTick) return false
471+
if (!currentStackSelection.filterStack(player.inventory.getStack(ctx.hotbarIndex))) return@forEach
472+
473+
initNewBreak(ctx, request) ?: return false
474+
breaks.remove(ctx)
475+
return true
476+
}
477+
return false
473478
}
474-
return false
475-
}
476479

477480
/**
478481
* Attempts to accept the [requestCtx] into the [breakInfos].

0 commit comments

Comments
 (0)