@@ -32,7 +32,6 @@ import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket
3232import net.minecraft.registry.tag.FluidTags
3333import net.minecraft.screen.slot.SlotActionType
3434import net.minecraft.state.property.Properties
35- import net.minecraft.text.Text
3635import net.minecraft.util.Hand
3736import net.minecraft.util.hit.BlockHitResult
3837import net.minecraft.util.hit.HitResult
@@ -1152,7 +1151,7 @@ object PacketMine : Module(
11521151 var additiveBreakDelta = currentBreakDelta
11531152 var timeCompleted: Long = - 1
11541153 var previousBreakDelta = 0f
1155- var lastLerpBox : Box ? = null
1154+ var lastLerpedBoxes : HashSet < Box > = hashSetOf()
11561155 var lastLerpFillColour: Color ? = null
11571156 var lastLerpOutlineColour: Color ? = null
11581157
@@ -1192,64 +1191,83 @@ object PacketMine : Module(
11921191 }
11931192
11941193 fun updateRenders () {
1195- boxList = lastNonEmptyState?.getOutlineShape(mc.world, pos)?.boundingBoxes?.toSet()
1194+ boxList = if (breakType.isPrimary()) {
1195+ lastNonEmptyState?.getOutlineShape(mc.world, pos)?.boundingBoxes?.toSet()
1196+ } else {
1197+ state.getOutlineShape(mc.world, pos)?.boundingBoxes?.toSet()
1198+ }
11961199 }
11971200
11981201 fun SafeContext.buildRenders () {
11991202 if (! renderIfEmpty && isStateEmpty(state)) return
12001203
1201- boxList?.forEach { box ->
1202- val threshold = if (breakType.isPrimary()) {
1203- 2f - breakThreshold
1204- } else {
1205- 1f
1206- }
1207- val previousFactor = previousMiningProgress * threshold
1208- val nextFactor = miningProgress * threshold
1209- val currentFactor = lerp(previousFactor, nextFactor, mc.tickDelta)
1204+ val threshold = if (breakType.isPrimary()) {
1205+ 2f - breakThreshold
1206+ } else {
1207+ 1f
1208+ }
1209+ val previousFactor = previousMiningProgress * threshold
1210+ val nextFactor = miningProgress * threshold
1211+ val currentFactor = lerp(previousFactor, nextFactor, mc.tickDelta)
12101212
1211- val paused = (pauseWhileUsingItems && player.isUsingItem) || pausedForRotation || awaitingQueueBreak
1213+ val paused = (pauseWhileUsingItems && player.isUsingItem) || pausedForRotation || awaitingQueueBreak
12121214
1213- val fillColour = if (fillColourMode == ColourMode .Dynamic ) {
1214- val lerpColour = lerp(startFillColour, endFillColour, currentFactor.toDouble())
1215- if (! paused) {
1216- lastLerpFillColour = lerpColour
1217- lerpColour
1218- } else {
1219- lastLerpFillColour ? : startFillColour
1220- }
1215+ val fillColour = if (fillColourMode == ColourMode .Dynamic ) {
1216+ val lerpColour = lerp(startFillColour, endFillColour, currentFactor.toDouble())
1217+ if (! paused) {
1218+ lastLerpFillColour = lerpColour
1219+ lerpColour
12211220 } else {
1222- staticFillColour
1221+ lastLerpFillColour ? : startFillColour
12231222 }
1223+ } else {
1224+ staticFillColour
1225+ }
12241226
1225- val outlineColour = if (outlineColourMode == ColourMode .Dynamic ) {
1226- val lerpColour = lerp(startOutlineColour, endOutlineColour, currentFactor.toDouble())
1227- if (! paused) {
1228- lastLerpOutlineColour = lerpColour
1229- lerpColour
1230- } else {
1231- lastLerpOutlineColour ? : startOutlineColour
1232- }
1227+ val outlineColour = if (outlineColourMode == ColourMode .Dynamic ) {
1228+ val lerpColour = lerp(startOutlineColour, endOutlineColour, currentFactor.toDouble())
1229+ if (! paused) {
1230+ lastLerpOutlineColour = lerpColour
1231+ lerpColour
12331232 } else {
1234- staticOutlineColour
1233+ lastLerpOutlineColour ? : startOutlineColour
12351234 }
1235+ } else {
1236+ staticOutlineColour
1237+ }
12361238
1237- val renderBox = if (renderMode != RenderMode .Static ) {
1238- val lerpBox = getLerpBox(box, currentFactor).offset(pos)
1239- if (! paused) {
1240- lastLerpBox = lerpBox
1241- lerpBox
1242- } else {
1243- lastLerpBox
1239+ if (paused) {
1240+ lastLerpedBoxes.forEach { box ->
1241+ val dynamicAABB = DynamicAABB ()
1242+ dynamicAABB.update(box)
1243+
1244+ if (renderSetting != RenderSetting .Outline ) {
1245+ renderer.buildFilled(dynamicAABB, fillColour)
1246+ }
1247+
1248+ if (renderSetting != RenderSetting .Fill ) {
1249+ renderer.buildOutline(dynamicAABB, outlineColour)
12441250 }
1251+ }
1252+
1253+ return
1254+ }
1255+
1256+ lastLerpedBoxes.clear()
1257+
1258+ boxList?.forEach { box ->
1259+ val positionedBox = box.offset(pos)
1260+
1261+ val renderBox = if (renderMode == RenderMode .Static ) {
1262+ positionedBox
12451263 } else {
1246- box.offset(pos )
1264+ getLerpBox(positionedBox, currentFactor )
12471265 }
12481266
1267+ lastLerpedBoxes.add(renderBox)
1268+
12491269 val dynamicAABB = DynamicAABB ()
1250- renderBox?.apply {
1251- dynamicAABB.update(this )
1252- }
1270+ dynamicAABB.update(renderBox)
12531271
12541272 if (renderSetting != RenderSetting .Outline ) {
12551273 renderer.buildFilled(dynamicAABB, fillColour)
0 commit comments