aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-07 12:12:35 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-07 12:12:35 +0200
commit5d2f4ea1989b1a3077a26fa7f9fd2935daf9d1bb (patch)
tree21a9b4eb213f1c71921a9c7069abe947c3c9911a /src/main/java/at/hannibal2
parente80f769ed326f546de62c4755b3d0f74c3e89006 (diff)
downloadskyhanni-5d2f4ea1989b1a3077a26fa7f9fd2935daf9d1bb.tar.gz
skyhanni-5d2f4ea1989b1a3077a26fa7f9fd2935daf9d1bb.tar.bz2
skyhanni-5d2f4ea1989b1a3077a26fa7f9fd2935daf9d1bb.zip
removing milliseconds from the format, loading the display item only once instead of every tick, changing the display from "list of list of any" to "list of any"
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/anniversary/ActivePlayerTimer.kt19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/ActivePlayerTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/ActivePlayerTimer.kt
index 94b3e2141..a83def532 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/ActivePlayerTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/anniversary/ActivePlayerTimer.kt
@@ -6,10 +6,11 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
-import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
+import at.hannibal2.skyhanni.utils.RenderUtils.renderSingleLineWithItems
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import at.hannibal2.skyhanni.utils.TimeMark
+import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.renderables.Renderable
import io.github.moulberry.notenoughupdates.util.SkyBlockTime
import net.minecraft.init.Items
@@ -20,11 +21,12 @@ import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
object ActivePlayerTimer {
+ val displayItem by lazy { NEUItems.getItemStackOrNull("EPOCH_CAKE_ORANGE") ?: ItemStack(Items.clock) }
private var lastTimerReceived = TimeMark.never()
private var lastTimeAlerted = TimeMark.never()
- private var overlay: List<List<Any?>>? = null
+ private var overlay: List<Any>? = null
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
@@ -42,7 +44,7 @@ object ActivePlayerTimer {
@SubscribeEvent
fun onRender(event: GuiRenderEvent.GameOverlayRenderEvent) {
- SkyHanniMod.feature.misc.century.activeTimerPosition.renderStringsAndItems(
+ SkyHanniMod.feature.misc.century.activeTimerPosition.renderSingleLineWithItems(
overlay ?: return,
posLabel = "300þ Anniversary Active Timer"
)
@@ -64,13 +66,10 @@ object ActivePlayerTimer {
SoundUtils.centuryActiveTimerAlert.playSound()
lastTimeAlerted = TimeMark.now()
}
- overlay =
- listOf(
- listOf(
- Renderable.itemStack(NEUItems.getItemStackOrNull("EPOCH_CAKE_ORANGE") ?: ItemStack(Items.clock)),
- Renderable.string("§eTime Left: $timeLeft")
- )
- )
+ overlay = listOf(
+ Renderable.itemStack(displayItem),
+ Renderable.string("§eTime Left: ${timeLeft.format()}")
+ )
}