From d55688322b0a79adca15d9a3bb0bf66970293874 Mon Sep 17 00:00:00 2001 From: Vixid <52578495+VixidDev@users.noreply.github.com> Date: Thu, 8 Aug 2024 19:09:52 +0100 Subject: Fix: Chroma Preview text showing in white (#2302) --- .../at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/at') 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() } -- cgit