@@ -661,23 +661,27 @@ object BreakManager : RequestHandler<BreakRequest>(
661661 *
662662 * @see net.minecraft.client.network.ClientPlayerInteractionManager.updateBlockBreakingProgress
663663 */
664- private fun SafeContext.updateBreakProgress (info : BreakInfo ): Boolean {
664+ private fun SafeContext.updateBreakProgress (info : BreakInfo ) {
665665 val config = info.breakConfig
666666 val ctx = info.context
667667
668668 info.progressedThisTick = true
669669
670+ val swapMode = info.breakConfig.swapMode
671+
670672 if (! info.breaking) {
671- return if (startBreaking(info)) true
672- else {
673+ if (swapMode.isEnabled() &&
674+ (swapMode != BreakConfig .SwapMode .End ||
675+ info.context.instantBreak ||
676+ info.rebreakPotential.isPossible()) &&
677+ ! swapped) return
678+ if (! startBreaking(info)) {
673679 info.nullify()
674680 info.request.onCancel?.invoke(ctx.blockPos)
675- false
676681 }
682+ return
677683 }
678684
679- if (config.swapMode == BreakConfig .SwapMode .Constant && ! swapped) return true
680-
681685 val hitResult = ctx.result
682686
683687 if (gamemode.isCreative && world.worldBorder.contains(ctx.blockPos)) {
@@ -686,17 +690,19 @@ object BreakManager : RequestHandler<BreakRequest>(
686690 onBlockBreak(info)
687691 info.startBreakPacket(world, interaction)
688692 if (config.swing.isEnabled()) swingHand(config.swingType, Hand .MAIN_HAND )
689- return true
693+ return
690694 }
691695
692696 val blockState = blockState(ctx.blockPos)
693697 if (blockState.isEmpty) {
694698 info.nullify()
695699 info.request.onCancel?.invoke(ctx.blockPos)
696700 logger.warning(" Block state was unexpectedly empty" , info)
697- return false
701+ return
698702 }
699703
704+ if (swapMode.isEnabled() && swapMode == BreakConfig .SwapMode .Constant && ! swapped) return
705+
700706 info.breakingTicks++
701707 val breakDelta = blockState.calcBreakDelta(player, world, ctx.blockPos, config)
702708 val progress = breakDelta * (info.breakingTicks - config.fudgeFactor)
@@ -728,7 +734,9 @@ object BreakManager : RequestHandler<BreakRequest>(
728734 }
729735
730736 val swing = config.swing
731- if (progress >= info.getBreakThreshold() && swapped) {
737+ if (progress >= info.getBreakThreshold()) {
738+ if (swapMode.isEnabled() && swapMode != BreakConfig .SwapMode .Start && ! swapped) return
739+
732740 logger.success(" Breaking" , info)
733741 if (info.type == Primary ) {
734742 onBlockBreak(info)
@@ -742,7 +750,7 @@ object BreakManager : RequestHandler<BreakRequest>(
742750 if (swing == BreakConfig .SwingMode .Constant ) swingHand(config.swingType, Hand .MAIN_HAND )
743751 }
744752
745- return true
753+ return
746754 }
747755
748756 /* *
@@ -808,12 +816,10 @@ object BreakManager : RequestHandler<BreakRequest>(
808816
809817 val progress = blockState.calcBreakDelta(player, world, ctx.blockPos, info.breakConfig)
810818
811- if (! swapped) return true
812-
813- val instantBreakable = progress >= info.getBreakThreshold() && swapped
819+ val instantBreakable = progress >= info.getBreakThreshold()
814820 if (instantBreakable) {
815821 logger.success(" Instant breaking" , info)
816- info.vanillaInstantBreakable = progress >= 1 && swapped
822+ info.vanillaInstantBreakable = progress >= 1
817823 onBlockBreak(info)
818824 if (! info.vanillaInstantBreakable) breakCooldown = info.breakConfig.breakDelay
819825 } else {
0 commit comments