Skip to content

Commit ff95112

Browse files
committed
update request before and include custom break threshold in break texture overlay stage
1 parent 819f02e commit ff95112

File tree

1 file changed

+14
-16
lines changed
  • common/src/main/kotlin/com/lambda/interaction/request/breaking

1 file changed

+14
-16
lines changed

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,19 @@ object BreakManager : RequestHandler<BreakRequest>() {
5959

6060
init {
6161
listen<TickEvent.Pre>(Int.MIN_VALUE) {
62-
val updated = updateRequest(true) { true }
62+
if (updateRequest(true) { true }) {
63+
currentRequest?.contexts?.forEach { requestCtx ->
64+
if (requestCtx == null) return@forEach
65+
if (!canAccept(requestCtx)) return@forEach
66+
67+
primaryBreakingInfo?.let { primaryInfo ->
68+
if (primaryInfo.startedWithSecondary) return@let
69+
secondaryBreakingInfo = BreakInfo.SecondaryBreakInfo(requestCtx)
70+
} ?: run {
71+
primaryBreakingInfo = BreakInfo.PrimaryBreakInfo(requestCtx)
72+
}
73+
}
74+
}
6375

6476
for (it in breakingInfos.reversed()) {
6577
if (interaction.blockBreakingCooldown > 0) {
@@ -73,20 +85,6 @@ object BreakManager : RequestHandler<BreakRequest>() {
7385
primaryBreakingInfo?.startedWithSecondary = true
7486
}
7587
}
76-
77-
if (!updated) return@listen
78-
79-
currentRequest?.contexts?.forEach { requestCtx ->
80-
if (requestCtx == null) return@forEach
81-
if (!canAccept(requestCtx)) return@forEach
82-
83-
primaryBreakingInfo?.let { primaryInfo ->
84-
if (primaryInfo.startedWithSecondary) return@let
85-
secondaryBreakingInfo = BreakInfo.SecondaryBreakInfo(requestCtx)
86-
} ?: run {
87-
primaryBreakingInfo = BreakInfo.PrimaryBreakInfo(requestCtx)
88-
}
89-
}
9088
}
9189

9290
listen<WorldEvent.BlockUpdate.Server>(alwaysListen = true) { event ->
@@ -326,7 +324,7 @@ object BreakManager : RequestHandler<BreakRequest>() {
326324
player.mainHandStack
327325
)
328326

329-
val progress = breakDelta * breakingTicks
327+
val progress = (breakDelta * breakingTicks) / buildConfig.breakSettings.breakThreshold
330328
return if (progress > 0.0f) (progress * 10.0f).toInt() else -1
331329
}
332330

0 commit comments

Comments
 (0)