From 027b317cc23fbc55dd9c62bd706173cc5aded691 Mon Sep 17 00:00:00 2001 From: desyncfy Date: Thu, 15 Aug 2024 20:43:40 -0700 Subject: [PATCH] Maybe fix missing textures on health bar bug? Untested --- src/client/kotlin/chickenmanfy/scify/modules/Bars.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/kotlin/chickenmanfy/scify/modules/Bars.kt b/src/client/kotlin/chickenmanfy/scify/modules/Bars.kt index a641d2f..2576c01 100644 --- a/src/client/kotlin/chickenmanfy/scify/modules/Bars.kt +++ b/src/client/kotlin/chickenmanfy/scify/modules/Bars.kt @@ -26,11 +26,11 @@ class Bars { lastSecondNumber = matcher.group(2).toInt() } - // Calculate finale for the last detected numbers + // Final mana value if (lastSecondNumber != 0) { val divided = lastSecondNumber.toFloat() / 20 val final = Math.round(lastFirstNumber.toFloat() / divided) - mana = final + mana = if (final <= 20) final else 20 } } @@ -79,7 +79,7 @@ class Bars { buffer.vertex(positionMatrix, xHealth+width, yHealth+height, 0f).color(1f, 1f, 1f, 1f).texture(1f, 1f).next() buffer.vertex(positionMatrix, xHealth+width, yHealth, 0f).color(1f, 1f, 1f, 1f).texture(1f, 0f).next() val maxHealthDivided = MinecraftClient.getInstance().player?.maxHealth?.div(20)?.toInt() - val health = MinecraftClient.getInstance().player?.health?.toInt()?.div(maxHealthDivided!!) + val health = if (MinecraftClient.getInstance().player?.health?.toInt()?.div(maxHealthDivided!!)!! <= 20) MinecraftClient.getInstance().player?.health?.toInt()?.div(maxHealthDivided!!) else 20 RenderSystem.setShader { GameRenderer.getPositionColorTexProgram() } RenderSystem.setShaderTexture(0, Identifier("scify", "healthmana/health/health_${health}.png")) RenderSystem.setShaderColor(1f, 1f, 1f, 1f)