aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorErymanthus | RayDeeUx <51521765+RayDeeUx@users.noreply.github.com>2024-01-22 13:56:13 -0500
committerGitHub <noreply@github.com>2024-01-22 19:56:13 +0100
commit822913b506c63f8a322af76d3460a961e22b845c (patch)
tree3ff42b679f08cfc2786ad2c73b83570b6b3d8eac /src/main/java/at/hannibal2/skyhanni/features/garden
parentb75ba0014350e4cf6880e481a24398da906b978d (diff)
downloadskyhanni-822913b506c63f8a322af76d3460a961e22b845c.tar.gz
skyhanni-822913b506c63f8a322af76d3460a961e22b845c.tar.bz2
skyhanni-822913b506c63f8a322af76d3460a961e22b845c.zip
Feature: Atmospheric Filter Display (#916)
Added Atmospheric Filter Display. #916
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt
new file mode 100644
index 000000000..73fd9804c
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt
@@ -0,0 +1,45 @@
+package at.hannibal2.skyhanni.features.garden
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.Season
+import io.github.moulberry.notenoughupdates.util.SkyBlockTime
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class AtmosphericFilterDisplay {
+
+ private val config get() = SkyHanniMod.feature.garden.atmosphericFilterDisplay
+
+ private var display = ""
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!isEnabled()) return
+ if (!GardenAPI.inGarden() && !config.everywhere) return
+ if (!event.repeatSeconds(1)) return
+ display = drawDisplay(Season.getCurrentSeason() ?: return)
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
+ if (!isEnabled()) return
+ if (!GardenAPI.inGarden() && config.everywhere) {
+ config.positionOutside.renderString(display, posLabel = "Atmospheric Filter Perk Display")
+ } else if (GardenAPI.inGarden()) {
+ config.position.renderString(display, posLabel = "Atmospheric Filter Perk Display")
+ }
+ }
+
+ private fun drawDisplay(season: Season): String = buildString {
+ if (!config.onlyBuff) {
+ append(season.getSeason(config.abbreviateSeason))
+ append("ยง7: ")
+ }
+ append(season.getPerk(config.abbreviatePerk))
+ }
+
+ private fun isEnabled(): Boolean = LorenzUtils.inSkyBlock && config.enabled
+}