From a65daa79814446cf338094f138404d91dcef0f68 Mon Sep 17 00:00:00 2001 From: L3cache <85846799+level3cache@users.noreply.github.com> Date: Sun, 29 Sep 2024 00:14:33 +0200 Subject: [PATCH] fix: spider's den rain time Actually fix spider's den rain time feature not showing correct time. Added new variables to make future changes easier with additional helpful comments to further clarify, what each value has to be set to. Signed-off-by: L3cache <85846799+level3cache@users.noreply.github.com> --- .../skytilsmod/features/impl/spidersden/RainTimer.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/spidersden/RainTimer.kt b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/spidersden/RainTimer.kt index 0a0b0f64b..6a8227ce1 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/spidersden/RainTimer.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/spidersden/RainTimer.kt @@ -28,18 +28,20 @@ import gg.skytils.skytilsmod.utils.graphics.colors.CommonColors * @link https://github.com/PikaFan123/rain-timer */ object RainTimer { - var nextRain = 1727548440000 + var nextRain = 1727548440000 // Unix-Time of a past rain event start in milliseconds + var eventCycleTime = 3600000 // Time between two rain event starts in milliseconds + var eventCooldownTime = 2400000 // Time between rain event end and start in milliseconds init { RainTimerGuiElement() - while (nextRain < System.currentTimeMillis()) nextRain += 4850000 + while (nextRain < System.currentTimeMillis()) nextRain += eventCycleTime } class RainTimerGuiElement : GuiElement(name = "Rain Timer", x = 10, y = 10) { override fun render() { if (Utils.inSkyblock && toggled) { - if (nextRain < System.currentTimeMillis()) nextRain += 4850000 - val remainingRain = ((nextRain - System.currentTimeMillis()) - 3850000) / 1000L + if (nextRain < System.currentTimeMillis()) nextRain += eventCycleTime + val remainingRain = ((nextRain - System.currentTimeMillis()) - eventCooldownTime) / 1000L if (remainingRain > 0) { fr.drawString( "${remainingRain / 60}:${"%02d".format(remainingRain % 60)}",