Skip to content

Commit 1f44350

Browse files
committed
Revert to ms and not gui event
1 parent d106b6e commit 1f44350

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

common/src/main/kotlin/com/lambda/core/TimerManager.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ object TimerManager : Loadable {
2727
override fun load() = "Loaded Timer Manager"
2828

2929
private const val TICK_DELAY = 50L
30-
private const val TICK_DELAY_NANOS = TICK_DELAY * 1_000_000L
3130
private var start = 0L
32-
val fixedTickDelta get() = (System.nanoTime() - start).mod(TICK_DELAY_NANOS).toDouble() / TICK_DELAY_NANOS
31+
val fixedTickDelta get() = (System.currentTimeMillis() - start).mod(TICK_DELAY).toDouble() / TICK_DELAY
3332

3433
init {
3534
fixedRateTimer(
@@ -38,7 +37,7 @@ object TimerManager : Loadable {
3837
initialDelay = 0,
3938
period = TICK_DELAY
4039
) {
41-
if (start == 0L) start = System.nanoTime()
40+
if (start == 0L) start = System.currentTimeMillis()
4241
ClientEvent.FixedTick(this).post()
4342
}
4443
}

common/src/main/kotlin/com/lambda/graphics/animation/Animation.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
package com.lambda.graphics.animation
1919

20-
import com.lambda.core.TimerManager
20+
import com.lambda.Lambda.mc
21+
import com.lambda.util.extension.partialTicks
2122
import com.lambda.util.math.lerp
2223
import kotlin.math.abs
2324
import kotlin.reflect.KProperty
@@ -27,7 +28,7 @@ class Animation(initialValue: Double, val update: (Double) -> Double) {
2728
private var currValue = initialValue
2829

2930
operator fun getValue(thisRef: Any?, property: KProperty<*>) =
30-
lerp(TimerManager.fixedTickDelta, prevValue, currValue)
31+
lerp(mc.partialTicks, prevValue, currValue)
3132

3233
operator fun setValue(thisRef: Any?, property: KProperty<*>, valueIn: Double) = setValue(valueIn)
3334

common/src/main/kotlin/com/lambda/graphics/renderer/esp/impl/ESPRenderer.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package com.lambda.graphics.renderer.esp.impl
1919

2020
import com.lambda.Lambda.mc
21-
import com.lambda.core.TimerManager
2221
import com.lambda.graphics.buffer.VertexPipeline
2322
import com.lambda.graphics.buffer.vertex.attributes.VertexAttrib
2423
import com.lambda.graphics.buffer.vertex.attributes.VertexMode
@@ -48,7 +47,7 @@ abstract class ESPRenderer(tickedMode: Boolean) {
4847

4948
fun render() {
5049
shader.use()
51-
shader["u_TickDelta"] = TimerManager.fixedTickDelta
50+
shader["u_TickDelta"] = mc.partialTicks
5251
shader["u_CameraPosition"] = mc.gameRenderer.camera.pos
5352

5453
withFaceCulling(faces::render)

common/src/main/kotlin/com/lambda/gui/api/LambdaGui.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.lambda.Lambda.mc
2121
import com.lambda.event.Muteable
2222
import com.lambda.event.events.ClientEvent
2323
import com.lambda.event.events.RenderEvent
24+
import com.lambda.event.events.TickEvent
2425
import com.lambda.event.listener.SafeListener.Companion.listen
2526
import com.lambda.graphics.animation.AnimationTicker
2627
import com.lambda.gui.api.component.core.IComponent
@@ -56,7 +57,7 @@ abstract class LambdaGui(
5657
onEvent(GuiEvent.Render())
5758
}
5859

59-
listen<ClientEvent.FixedTick> {
60+
listen<TickEvent.Pre> {
6061
animation.tick()
6162
onEvent(GuiEvent.Tick())
6263
}

0 commit comments

Comments
 (0)