@@ -56,7 +56,7 @@ import com.lambda.interaction.request.breaking.BreakManager.breaks
5656import com.lambda.interaction.request.breaking.BreakManager.canAccept
5757import com.lambda.interaction.request.breaking.BreakManager.checkForCancels
5858import com.lambda.interaction.request.breaking.BreakManager.initNewBreak
59- import com.lambda.interaction.request.breaking.BreakManager.maxBreaksThisTick
59+ import com.lambda.interaction.request.breaking.BreakManager.maxInstantBreaksThisTick
6060import com.lambda.interaction.request.breaking.BreakManager.processNewBreak
6161import com.lambda.interaction.request.breaking.BreakManager.processRequest
6262import com.lambda.interaction.request.breaking.BreakManager.simulateAbandoned
@@ -156,8 +156,8 @@ object BreakManager : RequestHandler<BreakRequest>(
156156 var heldTicks = 0
157157 var swappedThisTick = false
158158 private var breakCooldown = 0
159- var breaksThisTick = 0
160- private var maxBreaksThisTick = 0
159+ var instantBreaksThisTick = 0
160+ private var maxInstantBreaksThisTick = 0
161161
162162 private var breaks = mutableListOf<BreakContext >()
163163
@@ -188,7 +188,7 @@ object BreakManager : RequestHandler<BreakRequest>(
188188 }
189189 activeRequest = null
190190 breaks = mutableListOf ()
191- breaksThisTick = 0
191+ instantBreaksThisTick = 0
192192 }
193193
194194 listen<WorldEvent .BlockUpdate .Server >(priority = Int .MIN_VALUE ) { event ->
@@ -355,15 +355,15 @@ object BreakManager : RequestHandler<BreakRequest>(
355355 if (activeRequest != null ) logger.debug(" Clearing active request" , activeRequest)
356356 activeRequest = null
357357 }
358- if (breaksThisTick > 0 || activeInfos.isNotEmpty()) {
358+ if (instantBreaksThisTick > 0 || activeInfos.isNotEmpty()) {
359359 activeThisTick = true
360360 }
361361 }
362362
363363 /* *
364364 * Filters the requests [BreakContext]s, and iterates over the [breakInfos] collection looking for matches
365365 * in positions. If a match is found, the [BreakInfo] is updated with the new context. Otherwise, the break is cancelled.
366- * The [instantBreaks] and [breaks] collections are then populated with the new appropriate contexts, and the [maxBreaksThisTick ]
366+ * The [instantBreaks] and [breaks] collections are then populated with the new appropriate contexts, and the [maxInstantBreaksThisTick ]
367367 * value is set.
368368 *
369369 * @see canAccept
@@ -406,7 +406,7 @@ object BreakManager : RequestHandler<BreakRequest>(
406406
407407 val breakConfig = request.config
408408 val pendingLimit = (breakConfig.maxPendingBreaks - pendingBreakCount).coerceAtLeast(0 )
409- maxBreaksThisTick = breakConfig.breaksPerTick.coerceAtMost(pendingLimit)
409+ maxInstantBreaksThisTick = breakConfig.breaksPerTick.coerceAtMost(pendingLimit)
410410 }
411411
412412 /* *
@@ -415,6 +415,8 @@ object BreakManager : RequestHandler<BreakRequest>(
415415 private fun SafeContext.canAccept (newCtx : BreakContext ): Boolean {
416416 if (activeInfos.none { it.context.blockPos == newCtx.blockPos } && isPosBlocked(newCtx.blockPos)) return false
417417
418+ if (newCtx.instantBreak && instantBreaksThisTick > maxInstantBreaksThisTick) return false
419+
418420 if (! currentStackSelection.filterStack(player.inventory.getStack(newCtx.hotbarIndex)))
419421 return false
420422
@@ -595,7 +597,7 @@ object BreakManager : RequestHandler<BreakRequest>(
595597 info.startPending()
596598 }
597599 }
598- breaksThisTick ++
600+ instantBreaksThisTick ++
599601 info.nullify()
600602 }
601603
@@ -822,6 +824,7 @@ object BreakManager : RequestHandler<BreakRequest>(
822824 logger.success(" Instant breaking" , info)
823825 onBlockBreak(info)
824826 if (! info.vanillaInstantBreakable) breakCooldown = info.breakConfig.breakDelay
827+ instantBreaksThisTick++
825828 } else {
826829 logger.debug(" Starting break" , info)
827830 info.apply {
0 commit comments