diff options
author | NetheriteMiner <88792142+NetheriteMiner@users.noreply.github.com> | 2023-09-10 06:09:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-10 12:09:38 +0200 |
commit | 2e6660878df6054da93a0f96b857bf4cae31ef23 (patch) | |
tree | a6693ee074f77619d3dc1429221a5854754c1b78 /src/main/java/at/hannibal2 | |
parent | 92e88acb0e3c25730010f1092665769cd07cfe0c (diff) | |
download | skyhanni-2e6660878df6054da93a0f96b857bf4cae31ef23.tar.gz skyhanni-2e6660878df6054da93a0f96b857bf4cae31ef23.tar.bz2 skyhanni-2e6660878df6054da93a0f96b857bf4cae31ef23.zip |
Add Trapper Cooldown GUI (#416)
Add Trapper Cooldown GUI #416
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java | 8 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt | 25 |
2 files changed, 29 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index bef52f688..cd04d353e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -454,6 +454,14 @@ public class MiscConfig { @ConfigEditorBoolean @FeatureToggle public boolean trapperTalkCooldown = true; + + @Expose + @ConfigOption(name = "Trapper Cooldown GUI", desc = "Show the cooldown on screen in an overlay (intended for abiphone users)") + @ConfigEditorBoolean + public boolean trapperCooldownGui = false; + + @Expose + public Position trapperCooldownPos = new Position(10, 10, false, true); } @ConfigOption(name = "Teleport Pads On Private Island", desc = "") 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() = |