aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rwxr-xr-xsrc/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
index ee80ab77b..342812c39 100755
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
@@ -6,12 +6,14 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.round
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
class GardenYawAndPitch {
private val config get() = SkyHanniMod.feature.garden.yawPitchDisplay
- private var lastChange = 0L
+ private var lastChange = SimpleTimeMark.farPast()
private var lastYaw = 0f
private var lastPitch = 0f
@@ -30,12 +32,12 @@ class GardenYawAndPitch {
val pitch = player.rotationPitch
if (yaw != lastYaw || pitch != lastPitch) {
- lastChange = System.currentTimeMillis()
+ lastChange = SimpleTimeMark.now()
}
lastYaw = yaw
lastPitch = pitch
- if (!config.showAlways && System.currentTimeMillis() > lastChange + (config.timeout * 1000)) return
+ if (!config.showAlways && lastChange.passedSince() > config.timeout.seconds) return
val displayList = listOf(
"§aYaw: §f${yaw.round(config.yawPrecision)}",
@@ -50,6 +52,6 @@ class GardenYawAndPitch {
@SubscribeEvent
fun onGardenToolChange(event: GardenToolChangeEvent) {
- lastChange = System.currentTimeMillis()
+ lastChange = SimpleTimeMark.farPast()
}
} \ No newline at end of file