Skip to content

Commit 97c60d2

Browse files
committed
check break cooldown before accepting contexts and set cooldown if not vanilla instant breakable
1 parent b4a0e13 commit 97c60d2

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ object BreakManager : RequestHandler<BreakRequest>(
429429
requestCtx: BreakContext,
430430
request: BreakRequest
431431
): BreakInfo? {
432+
if (breakCooldown > 0) return null
433+
432434
val breakInfo = BreakInfo(requestCtx, Primary, request)
433435
primaryBreak?.let { primaryInfo ->
434436
if (!breakInfo.breakConfig.doubleBreak || secondaryBreak != null) {
@@ -526,7 +528,7 @@ object BreakManager : RequestHandler<BreakRequest>(
526528
runSafe {
527529
setBreakingTextureStage(player, world, -1)
528530
if (isPrimary) {
529-
abortBreakPacket(world, interaction)
531+
if (breaking) abortBreakPacket(world, interaction)
530532
nullify()
531533
} else if (isSecondary && breakConfig.unsafeCancels) {
532534
makeRedundant()
@@ -606,7 +608,6 @@ object BreakManager : RequestHandler<BreakRequest>(
606608
}
607609
else -> {}
608610
}
609-
if (breakCooldown > 0) return false
610611
if (!startBreaking(info)) {
611612
info.nullify()
612613
info.internalOnCancel()
@@ -718,8 +719,10 @@ object BreakManager : RequestHandler<BreakRequest>(
718719
}
719720

720721
val breakDelta = blockState.calcBreakDelta(player, world, ctx.blockPos, info.breakConfig)
722+
info.vanillaInstantBreakable = breakDelta >= 1
721723
if (notEmpty && breakDelta >= info.getBreakThreshold()) {
722724
onBlockBreak(info)
725+
if (!info.vanillaInstantBreakable) breakCooldown = info.breakConfig.breakDelay
723726
} else {
724727
info.apply {
725728
breaking = true
@@ -736,7 +739,6 @@ object BreakManager : RequestHandler<BreakRequest>(
736739
}
737740

738741
info.startBreakPacket(world, interaction)
739-
info.vanillaInstantBreakable = breakDelta >= 1
740742

741743
if (info.isSecondary || (!info.vanillaInstantBreakable && breakDelta >= info.breakConfig.breakThreshold)) {
742744
info.stopBreakPacket(world, interaction)

common/src/main/kotlin/com/lambda/module/modules/player/Nuker.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,5 @@ object Nuker : Module(
8383
onDisable {
8484
task?.cancel()
8585
}
86-
87-
// listener<TickEvent.Pre> {
88-
// task?.let {
89-
// if (!it.isRunning) return@listener
90-
//
91-
// info(it.info)
92-
// }
93-
// }
9486
}
9587
}

common/src/main/kotlin/com/lambda/module/modules/player/PacketMine.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ object PacketMine : Module(
6868
private val queue by setting("Queue", false, "Queues blocks to break so you can select multiple at once")
6969
.onValueChange { _, to -> if (!to) queuePositions.clear() }
7070
private val queueOrder by setting("Queue Order", QueueOrder.Standard, "Which end of the queue to break blocks from") { queue }
71-
private val renderQueue by setting("Render Queue", true, "Adds renders to signify what block positions are queued") { queue }
72-
private val renderSize by setting("Render Size", 0.3f, 0.01f..1f, 0.01f, "The scale of the queue renders") { queue && renderQueue }
73-
private val renderMode by setting("Render Mode", RenderMode.State, "The style of the queue renders") { queue && renderQueue }
74-
private val dynamicColor by setting("Dynamic Color", true, "Interpolates the color between start and end") { queue && renderQueue }
75-
private val staticColor by setting("Color", Color(255, 0, 0, 60).brighter()) { queue && renderQueue && !dynamicColor }
76-
private val startColor by setting("Start Color", Color(255, 255, 0, 60).brighter(), "The color of the start (closest to breaking) of the queue") { queue && renderQueue && dynamicColor }
77-
private val endColor by setting("End Color", Color(255, 0, 0, 60).brighter(), "The color of the end (farthest from breaking) of the queue") { queue && renderQueue && dynamicColor }
71+
private val renderQueue by setting("Render Queue", true, "Adds renders to signify what block positions are queued")
72+
private val renderSize by setting("Render Size", 0.3f, 0.01f..1f, 0.01f, "The scale of the queue renders") { renderQueue }
73+
private val renderMode by setting("Render Mode", RenderMode.State, "The style of the queue renders") { renderQueue }
74+
private val dynamicColor by setting("Dynamic Color", true, "Interpolates the color between start and end") { renderQueue }
75+
private val staticColor by setting("Color", Color(255, 0, 0, 60).brighter()) { renderQueue && !dynamicColor }
76+
private val startColor by setting("Start Color", Color(255, 255, 0, 60).brighter(), "The color of the start (closest to breaking) of the queue") { renderQueue && dynamicColor }
77+
private val endColor by setting("End Color", Color(255, 0, 0, 60).brighter(), "The color of the end (farthest from breaking) of the queue") { renderQueue && dynamicColor }
7878

7979

8080
private val pendingInteractions = ConcurrentLinkedQueue<BuildContext>()

0 commit comments

Comments
 (0)