Skip to content

Commit 41f69ef

Browse files
committed
tick stage check and abort packet when cancelling primary breaks
1 parent 7928d32 commit 41f69ef

File tree

1 file changed

+3
-4
lines changed
  • common/src/main/kotlin/com/lambda/interaction/request/breaking

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import com.lambda.interaction.request.breaking.BreakManager.activeRequest
4545
import com.lambda.interaction.request.breaking.BreakManager.breakInfos
4646
import com.lambda.interaction.request.breaking.BreakManager.breaks
4747
import com.lambda.interaction.request.breaking.BreakManager.canAccept
48-
import com.lambda.interaction.request.breaking.BreakManager.cancelBreak
4948
import com.lambda.interaction.request.breaking.BreakManager.checkForCancels
5049
import com.lambda.interaction.request.breaking.BreakManager.initNewBreak
5150
import com.lambda.interaction.request.breaking.BreakManager.instantBreaks
@@ -347,7 +346,6 @@ object BreakManager : RequestHandler<BreakRequest>(
347346
* value is set.
348347
*
349348
* @see canAccept
350-
* @see cancelBreak
351349
*/
352350
private fun SafeContext.populateFrom(request: BreakRequest) {
353351
// Sanitize the new breaks
@@ -361,7 +359,7 @@ object BreakManager : RequestHandler<BreakRequest>(
361359
}
362360
.toMutableList()
363361

364-
// Update the current break infos or cancel if abandoned
362+
// Update the current break infos
365363
breakInfos
366364
.filterNotNull()
367365
.forEach { info ->
@@ -469,7 +467,7 @@ object BreakManager : RequestHandler<BreakRequest>(
469467
val breakInfo = BreakInfo(requestCtx, Primary, request)
470468
primaryBreak?.let { primaryInfo ->
471469
if (!breakInfo.breakConfig.doubleBreak || secondaryBreak != null) {
472-
if (!primaryInfo.updatedThisTick) {
470+
if (!primaryInfo.updatedThisTick && tickStage in primaryInfo.breakConfig.breakStageMask) {
473471
primaryInfo.cancelBreak()
474472
return@let
475473
} else return null
@@ -563,6 +561,7 @@ object BreakManager : RequestHandler<BreakRequest>(
563561
if (isPrimary) {
564562
nullify()
565563
setBreakingTextureStage(player, world, -1)
564+
abortBreakPacket(world, interaction)
566565
request.onCancel?.invoke(context.blockPos)
567566
} else if (isSecondary) {
568567
if (breakConfig.unsafeCancels) {

0 commit comments

Comments
 (0)