aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/lorenz/mod/utils/GuiRender.kt6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/at/lorenz/mod/utils/GuiRender.kt b/src/main/java/at/lorenz/mod/utils/GuiRender.kt
index 87c14df4a..f32b9bdf2 100644
--- a/src/main/java/at/lorenz/mod/utils/GuiRender.kt
+++ b/src/main/java/at/lorenz/mod/utils/GuiRender.kt
@@ -1,5 +1,6 @@
package at.lorenz.mod.utils
+import at.lorenz.mod.utils.LorenzUtils.removeColorCodes
import com.thatgravyboat.skyblockhud_2.core.config.Position
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.ScaledResolution
@@ -8,13 +9,14 @@ import net.minecraft.client.renderer.GlStateManager
object GuiRender {
fun Position.renderString(string: String) {
+ val textToRender = "§f$string"
GlStateManager.pushMatrix()
val resolution = ScaledResolution(Minecraft.getMinecraft())
val renderer = Minecraft.getMinecraft().renderManager.fontRenderer
- val offsetX = (200 - renderer.getStringWidth(string)) / 2
+ val offsetX = (200 - renderer.getStringWidth(textToRender.removeColorCodes())) / 2
val x = getAbsX(resolution, 200) + offsetX
val y = getAbsY(resolution, 16)
@@ -22,7 +24,7 @@ object GuiRender {
GlStateManager.translate(x + 1.0, y + 1.0, 0.0)
- renderer.drawStringWithShadow(string, 0f, 0f, 0)
+ renderer.drawStringWithShadow(textToRender, 0f, 0f, 0)
GlStateManager.popMatrix()