Skip to content

Commit f396c1e

Browse files
committed
add double break fudge factor setting
1 parent 1288503 commit f396c1e

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class BreakSettings(
3333
override val unsafeCancels by c.setting("Unsafe Cancels", true, "Allows cancelling block breaking even if the server might continue breaking sever side, potentially causing unexpected state changes") { vis() }
3434
override val breakThreshold by c.setting("Break Threshold", 0.7f, 0.1f..1.0f, 0.02f, "The break amount at which the block is considered broken") { vis() }
3535
override val doubleBreak by c.setting("Double Break", true, "Allows breaking two blocks at once") { vis() }
36+
override val doubleBreakFudgeFactor by c.setting("Double Break Fudge Factor", 1, 0..3, 1, "The amount of ticks to give double, aka secondary breaks extra for the server to recognise the break") { doubleBreak && vis() }
3637
override val breakDelay by c.setting("Break Delay", 0, 0..6, 1, "The delay between breaking blocks", " ticks") { vis() }
3738
override val breakStageMask by c.setting("Break Stage Mask", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Input.Post, TickEvent.Player.Post), "The sub-tick timing at which break actions can be performed", vis)
3839
override val swing by c.setting("Swing Mode", SwingMode.Constant, "The times at which to swing the players hand") { vis() }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ abstract class BreakConfig(
3131
abstract val unsafeCancels: Boolean
3232
abstract val breakThreshold: Float
3333
abstract val doubleBreak: Boolean
34+
abstract val doubleBreakFudgeFactor: Int
3435
abstract val breakDelay: Int
3536
abstract val breakStageMask: Set<Event>
3637
abstract val swing: SwingMode

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,9 @@ object BreakManager : RequestHandler<BreakRequest>(
550550
world,
551551
ctx.expectedPos,
552552
player.mainHandStack
553-
) * info.breakingTicks
553+
) * if (info.isSecondary) {
554+
info.breakingTicks - info.breakConfig.doubleBreakFudgeFactor
555+
} else info.breakingTicks
554556

555557
val overBreakThreshold = progress >= info.getBreakThreshold()
556558

0 commit comments

Comments
 (0)