From 073bb8d1f139b98508cd21dae6fc377fcc7c9230 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 29 Mar 2023 21:27:47 +0200 Subject: Show a simple contest timer display when no exact calendar data is available --- .../skyhanni/features/garden/ComposterDisplay.kt | 2 -- .../features/garden/GardenNextJacobContest.kt | 24 ++++++++++++++-------- .../at/hannibal2/skyhanni/utils/TabListData.kt | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt index 7c2b92ebd..57cf15aa9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt @@ -34,7 +34,6 @@ class ComposterDisplay { if (!isEnabled()) return var next = false - println(" ") val data = mutableMapOf() for (line in event.tabList) { @@ -51,7 +50,6 @@ class ComposterDisplay { data[type] = matcher.group(1) } } - println("'$line'") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 9347cb488..675b30220 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderSingleLineWithItems +import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.TimeUtils import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -15,6 +16,7 @@ import java.util.regex.Pattern class GardenNextJacobContest { private var display = listOf() + private var simpleDisplay = listOf() private var tick = 0 private var contests = mutableMapOf() private var inCalendar = false @@ -27,12 +29,10 @@ class GardenNextJacobContest { @SubscribeEvent fun onTabListUpdate(event: TabListUpdateEvent) { - if (!isEnabled()) return - var next = false val newList = mutableListOf() for (line in event.tabList) { - if (line == "§b§lComposter:") { + if (line == "§e§lJacob's Contest:") { newList.add(line) next = true continue @@ -42,8 +42,10 @@ class GardenNextJacobContest { newList.add(line) } } + newList.add("§cOpen calendar for") + newList.add("§cmore exact data!") - display = newList + simpleDisplay = newList } @SubscribeEvent @@ -155,9 +157,7 @@ class GardenNextJacobContest { } if (contests.isEmpty()) { - - list.add("§cOpen calendar to read jacob contest times!") - return list + return emptyList() } val nextContest = @@ -201,7 +201,11 @@ class GardenNextJacobContest { fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return - config.nextJacobContestPos.renderSingleLineWithItems(display, 1.7, posLabel = "Garden Next Jacob Contest") + if (display.isEmpty()) { + config.nextJacobContestPos.renderStrings(simpleDisplay, posLabel = "Garden Next Jacob Contest") + } else { + config.nextJacobContestPos.renderSingleLineWithItems(display, 1.7, posLabel = "Garden Next Jacob Contest") + } } @SubscribeEvent @@ -209,7 +213,9 @@ class GardenNextJacobContest { if (!config.nextJacobContestDisplay) return if (!inCalendar) return - config.nextJacobContestPos.renderSingleLineWithItems(display, posLabel = "Garden Next Jacob Contest") + if (!display.isEmpty()) { + config.nextJacobContestPos.renderSingleLineWithItems(display, posLabel = "Garden Next Jacob Contest") + } } private fun isEnabled() = LorenzUtils.inSkyBlock && config.nextJacobContestDisplay diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt index 1907d5f8f..1e42054ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt @@ -48,7 +48,7 @@ class TabListData { val name = Minecraft.getMinecraft().ingameGUI.tabList.getPlayerName(info) result.add(LorenzUtils.stripVanillaMessage(name)) } - return result + return result.dropLast(1) } private var ticks = 0 -- cgit