Skip to content

Commit f47349b

Browse files
committed
fix partial ticks, and subsequentially, dynamic renders
1 parent 622e69e commit f47349b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,10 @@ object BreakManager : RequestHandler<BreakRequest>(
271271
info.context.cachedState.getOutlineShape(world, info.context.blockPos).boundingBoxes.map {
272272
it.offset(info.context.blockPos)
273273
}.forEach boxes@ { box ->
274-
val dynamicAABB = DynamicAABB()
275-
val interpolated = interpolateBox(box, interpolatedProgress, info.breakConfig)
276-
dynamicAABB.update(interpolated)
274+
val animationMode = info.breakConfig.animation
275+
val currentProgress = interpolateBox(box, currentProgress, animationMode)
276+
val nextProgress = interpolateBox(box, nextTicksProgress, animationMode)
277+
val dynamicAABB = DynamicAABB().update(currentProgress).update(nextProgress)
277278
if (config.fill) render.filled(dynamicAABB, fillColor)
278279
if (config.outline) render.outline(dynamicAABB, outlineColor)
279280
}
@@ -883,9 +884,9 @@ object BreakManager : RequestHandler<BreakRequest>(
883884
return inRange && correctMaterial
884885
}
885886

886-
private fun interpolateBox(box: Box, progress: Double, config: BreakConfig): Box {
887+
private fun interpolateBox(box: Box, progress: Double, animationMode: BreakConfig.AnimationMode): Box {
887888
val boxCenter = Box(box.center, box.center)
888-
return when (config.animation) {
889+
return when (animationMode) {
889890
BreakConfig.AnimationMode.Out -> lerp(progress, boxCenter, box)
890891
BreakConfig.AnimationMode.In -> lerp(progress, box, boxCenter)
891892
BreakConfig.AnimationMode.InOut ->

src/main/kotlin/com/lambda/util/extension/Mixin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ val MinecraftClient.partialTicks
2323
get() = tickDelta.toDouble()
2424

2525
val MinecraftClient.tickDelta
26-
get() = renderTickCounter.dynamicDeltaTicks
26+
get() = renderTickCounter.getTickProgress(true)

0 commit comments

Comments
 (0)