Skip to content

Commit d15a805

Browse files
committed
server swap setting while using hotbar manager logic behind the scenes
1 parent 3aecab9 commit d15a805

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class BreakSettings(
5151
// Fixes / Delays
5252
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).group(groupPath, Group.General)
5353
override val fudgeFactor by c.setting("Fudge Factor", 1, 0..5, 1, "The number of ticks to add to the break time, usually to account for server lag", visibility = vis).group(groupPath, Group.General)
54+
override val serverSwapTicks by c.setting("Server Swap", 2, 0..5, 1, "The number of ticks to give the server time to recognize the player attributes on the swapped item", " tick(s)", visibility = vis).group(groupPath, Group.General)
5455
// override val desyncFix by c.setting("Desync Fix", false, "Predicts if the players breaking will be slowed next tick as block break packets are processed using the players next position") { vis() && page == Page.General }
5556
override val breakDelay by c.setting("Break Delay", 0, 0..6, 1, "The delay between breaking blocks", " tick(s)", visibility = vis).group(groupPath, Group.General)
5657

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ interface BreakConfig : RequestConfig {
3535

3636
val breakThreshold: Float
3737
val fudgeFactor: Int
38+
val serverSwapTicks: Int
3839
//ToDo: Needs a more advanced player simulation implementation to predict the next ticks onGround / submerged status
3940
// abstract val desyncFix: Boolean
4041
val breakDelay: Int

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ object BreakManager : RequestHandler<BreakRequest>(
435435
context.hotbarIndex,
436436
request.hotbar,
437437
request.hotbar.keepTicks.coerceAtLeast(minSwapTicks),
438-
request.hotbar.swapPause - 1
438+
request.config.serverSwapTicks - 1
439439
).submit(false)
440440
}
441441
logger.debug("Submitted hotbar request", hotbarRequest)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ data class SwapInfo(
6060

6161
val minKeepTicks = run {
6262
if (type == Primary) {
63-
val swapTickProgress = breakDelta * (breakTicks + request.hotbar.swapPause - 1).coerceAtLeast(1)
64-
if (swapTickProgress >= threshold && request.hotbar.swapPause > 0) 1
63+
val swapTickProgress = breakDelta * (breakTicks + request.config.serverSwapTicks - 1).coerceAtLeast(1)
64+
if (swapTickProgress >= threshold && request.config.serverSwapTicks > 0) 1
6565
else 0
6666
} else {
6767
val serverSwapTicks = request.hotbar.swapPause.coerceAtLeast(3)

0 commit comments

Comments
 (0)