aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorVixid <52578495+VixidDev@users.noreply.github.com>2024-08-08 19:09:52 +0100
committerGitHub <noreply@github.com>2024-08-08 20:09:52 +0200
commitd55688322b0a79adca15d9a3bb0bf66970293874 (patch)
tree708e08f26dc16ec325a20a52f8abefc945e563e8 /src/main
parentadbe86cf9e446e14a51eb72b695da8809fb4dd5b (diff)
downloadskyhanni-d55688322b0a79adca15d9a3bb0bf66970293874.tar.gz
skyhanni-d55688322b0a79adca15d9a3bb0bf66970293874.tar.bz2
skyhanni-d55688322b0a79adca15d9a3bb0bf66970293874.zip
Fix: Chroma Preview text showing in white (#2302)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt
index ad6232646..db9c1c07e 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.features.chroma.ChromaFontRenderer
import at.hannibal2.skyhanni.features.chroma.ChromaManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption
import net.minecraft.client.renderer.GlStateManager
/**
@@ -27,9 +28,17 @@ object FontRendererHook {
private var currentDrawState: ChromaFontRenderer? = null
private var previewChroma = false
+ private var chromaPreviewText: String
var cameFromChat = false
+ init {
+ // Get the description text from the ConfigOption annotation from the chromaPreview field to check against
+ val fields = config::class.java.declaredFields
+ val previewField = fields.first { it.name == "chromaPreview" } // Pls no one change the config field name
+ chromaPreviewText = previewField.getAnnotation(ConfigOption::class.java).desc
+ }
+
/**
* Setups the [ChromaFontRenderer][at.hannibal2.skyhanni.features.chroma.ChromaFontRenderer] for rendering text
* in chroma. This should only be used when you don't have control over the color code a string uses, or it
@@ -71,7 +80,7 @@ object FontRendererHook {
return
}
- if (text == "§fPlease star the mod on GitHub!") {
+ if (text == chromaPreviewText) {
previewChroma = true
setupChromaFont()
}