summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/nether
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-06-14 05:58:40 +1000
committerGitHub <noreply@github.com>2024-06-13 21:58:40 +0200
commitb48e43dff9baf2710809debe47a4bd5b329d70a0 (patch)
treed6470d8e3f41ae3982cecab685ca034318397196 /src/main/java/at/hannibal2/skyhanni/features/nether
parent31344fc364cde2cef243a49f1e7d4c4fbb390699 (diff)
downloadskyhanni-b48e43dff9baf2710809debe47a4bd5b329d70a0.tar.gz
skyhanni-b48e43dff9baf2710809debe47a4bd5b329d70a0.tar.bz2
skyhanni-b48e43dff9baf2710809debe47a4bd5b329d70a0.zip
Backend: Remove deprecated time utils format (#1898)
* remove deprecated time utils format * cleanup file * mix merge * make it default to right amount * fix merge * fix merge * revert 2 changes * revert other thing --------- Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/nether')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
index f4061033a..98b2d52a0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
@@ -11,16 +11,18 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.TimeUnit
-import at.hannibal2.skyhanni.utils.TimeUtils
+import at.hannibal2.skyhanni.utils.TimeUtils.format
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
@SkyHanniModule
object AshfangNextResetCooldown {
private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang
- private var spawnTime = 1L
+ private var spawnTime = SimpleTimeMark.farPast()
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
@@ -29,30 +31,30 @@ object AshfangNextResetCooldown {
if (EntityUtils.getEntities<EntityArmorStand>().any {
it.posY > 145 && (it.name.contains("§c§9Ashfang Acolyte§r") || it.name.contains("§c§cAshfang Underling§r"))
}) {
- spawnTime = System.currentTimeMillis()
+ spawnTime = SimpleTimeMark.now()
}
}
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!isEnabled()) return
- if (spawnTime == -1L) return
+ if (spawnTime.isFarPast()) return
- val remainingTime = spawnTime + 46_100 - System.currentTimeMillis()
- if (remainingTime > 0) {
- val format = TimeUtils.formatDuration(remainingTime, TimeUnit.SECOND, showMilliSeconds = true)
+ val passedSince = spawnTime.passedSince()
+ if (passedSince < 46.1.seconds) {
+ val format = passedSince.format(TimeUnit.SECOND, showMilliSeconds = true)
config.nextResetCooldownPos.renderString(
"§cAshfang next reset in: §a$format",
posLabel = "Ashfang Reset Cooldown"
)
} else {
- spawnTime = -1
+ spawnTime = SimpleTimeMark.farPast()
}
}
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
- spawnTime = -1
+ spawnTime = SimpleTimeMark.farPast()
}
@SubscribeEvent