From 2e6660878df6054da93a0f96b857bf4cae31ef23 Mon Sep 17 00:00:00 2001 From: NetheriteMiner <88792142+NetheriteMiner@users.noreply.github.com> Date: Sun, 10 Sep 2023 06:09:38 -0400 Subject: Add Trapper Cooldown GUI (#416) Add Trapper Cooldown GUI #416 --- .../features/misc/trevor/TrevorFeatures.kt | 25 ++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index c1b4ee3fc..779bb2d3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.drawString +import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.Minecraft @@ -106,6 +107,22 @@ class TrevorFeatures { } } + @SubscribeEvent(priority = EventPriority.LOWEST) + fun renderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { + if (!config.trapperCooldownGui) return + if (!onFarmingIsland()) return + + val cooldownMessage = if (timeUntilNextReady <= 0) "Trapper Ready" + else if (timeUntilNextReady == 1) "1 second left" + else "$timeUntilNextReady seconds left" + + config.trapperCooldownPos.renderString( + "${currentStatus.colorCode}Trapper Cooldown: $cooldownMessage", + posLabel = "Trapper Cooldown GUI" + ) + } + + private fun updateTrapper() { timeUntilNextReady -= 1 if (trapperReady && timeUntilNextReady > 0) { @@ -228,10 +245,10 @@ class TrevorFeatures { currentLabel = "§2Ready" } - enum class TrapperStatus(val color: Int) { - READY(LorenzColor.DARK_GREEN.toColor().withAlpha(75)), - WAITING(LorenzColor.DARK_AQUA.toColor().withAlpha(75)), - ACTIVE(LorenzColor.DARK_RED.toColor().withAlpha(75)), + enum class TrapperStatus(val color: Int, val colorCode: String) { + READY(LorenzColor.DARK_GREEN.toColor().withAlpha(75), "§2"), + WAITING(LorenzColor.DARK_AQUA.toColor().withAlpha(75), "§3"), + ACTIVE(LorenzColor.DARK_RED.toColor().withAlpha(75), "§4"), } private fun onFarmingIsland() = -- cgit