Skip to content

Commit 26b2d68

Browse files
committed
apply fudge factor to all breaks
1 parent 40f56ab commit 26b2d68

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BreakSettings(
3131
override val breakMode by c.setting("Break Mode", BreakMode.Packet, visibility = vis)
3232
override val reBreak by c.setting("ReBreak", true, "Re-breaks blocks after they've been broken once", visibility = vis)
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", visibility = vis)
34-
override val breakThreshold by c.setting("Break Threshold", 0.75f, 0.1f..1.0f, 0.01f, "The break amount at which the block is considered broken", visibility = vis)
34+
override val breakThreshold by c.setting("Break Threshold", 0.70f, 0.1f..1.0f, 0.01f, "The break amount at which the block is considered broken", visibility = vis)
3535
override val doubleBreak by c.setting("Double Break", true, "Allows breaking two blocks at once", visibility = vis)
3636
override val fudgeFactor by c.setting("Fudge Factor", 2, 0..5, 1, "The amount of ticks to give double, aka secondary breaks extra for the server to recognise the break", visibility = vis)
3737
override val breakDelay by c.setting("Break Delay", 0, 0..6, 1, "The delay between breaking blocks", " ticks", visibility = vis)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ import net.minecraft.entity.ItemEntity
5858
import net.minecraft.sound.SoundCategory
5959
import net.minecraft.util.Hand
6060
import net.minecraft.util.math.BlockPos
61+
import kotlin.math.abs
6162
import kotlin.math.ceil
62-
import kotlin.math.max
6363

6464
object BreakManager : RequestHandler<BreakRequest>(
6565
0,
@@ -570,7 +570,7 @@ object BreakManager : RequestHandler<BreakRequest>(
570570
val serverBreakTicks = ceil(1.0 / breakDelta).toInt()
571571
val clientBreakTicks = ceil(config.breakThreshold / breakDelta).toInt()
572572
val diff = serverBreakTicks - clientBreakTicks
573-
info.breakingTicks - max(config.fudgeFactor - diff, 0)
573+
info.breakingTicks - config.fudgeFactor.coerceAtMost(abs(diff))
574574
}
575575
}
576576

0 commit comments

Comments
 (0)