From e4bd69a0569b4ccc49b9e4b89998220bf4bfe25a Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 14 Jun 2024 18:34:40 +0200 Subject: Add shiny pig tracker --- src/main/kotlin/moe/nea/firmament/gui/BarComponent.kt | 2 +- src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin/moe/nea/firmament/gui') diff --git a/src/main/kotlin/moe/nea/firmament/gui/BarComponent.kt b/src/main/kotlin/moe/nea/firmament/gui/BarComponent.kt index a1eb23c..91b5735 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/BarComponent.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/BarComponent.kt @@ -58,7 +58,7 @@ class BarComponent( ScreenDrawing.texturedRect(context, x, y, 4, 8, texture, emptyColor.color) return } - val increasePerPixel = (sectionEnd - sectionStart / 4) + val increasePerPixel = (sectionEnd - sectionStart) / width var valueAtPixel = sectionStart for (i in (0 until width)) { ScreenDrawing.texturedRect( diff --git a/src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt b/src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt index ec884bb..afc8740 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt @@ -30,11 +30,16 @@ abstract class MoulConfigHud( private var fragment: GuiContext? = null + fun forceInit() { + + } + open fun shouldRender(): Boolean { return true } init { + require(name.matches("^[a-z_/]+$".toRegex())) HudRenderEvent.subscribe { if (!shouldRender()) return@subscribe val renderContext = componentWrapper.createContext(it.context) -- cgit