Skip to content

Commit 97ff0d2

Browse files
committed
step held ticks in pre-processing when the current stack is updated
1 parent 2e9744c commit 97ff0d2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ object BreakManager : RequestHandler<BreakRequest>(
176176
listen<TickEvent.Post>(priority = Int.MIN_VALUE) {
177177
if (!swappedThisTick) {
178178
currentStack = player.mainHandStack
179+
heldTicks++
179180
}
180181
swappedThisTick = false
181-
heldTicks++
182182
if (breakCooldown > 0) {
183183
breakCooldown--
184184
}
@@ -430,8 +430,11 @@ object BreakManager : RequestHandler<BreakRequest>(
430430
val minSwapTicks = max(info.swapInfo.minKeepTicks, last.swapInfo.minKeepTicks)
431431
if (!info.context.requestSwap(info.request, minSwapTicks))
432432
return false
433-
if (minSwapTicks > 0)
433+
if (minSwapTicks > 0) {
434+
val alreadySwapped = swappedThisTick
434435
currentStack = info.swapStack
436+
if (!alreadySwapped) heldTicks++
437+
}
435438
}
436439
}
437440
}

src/main/kotlin/com/lambda/interaction/request/breaking/SwapInfo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ data class SwapInfo(
3333
val minKeepTicks: Int = 0,
3434
) {
3535
val canCompleteBreak
36-
get() = (BreakManager.heldTicks + 1) >= if (type == Primary || type == Rebreak) breakConfig.serverSwapTicks
36+
get() = BreakManager.heldTicks >= if (type == Primary || type == Rebreak) breakConfig.serverSwapTicks
3737
else breakConfig.serverSwapTicks.coerceAtLeast(3)
3838

3939
companion object {

0 commit comments

Comments
 (0)