diff --git a/src/main/java/de/hysky/skyblocker/skyblock/HealthBars.java b/src/main/java/de/hysky/skyblocker/skyblock/HealthBars.java index 4a1820f5b0..082b214a0b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/HealthBars.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/HealthBars.java @@ -204,6 +204,8 @@ private static void render(WorldRenderContext context) { boolean hideFullHealth = SkyblockerConfigManager.get().uiAndVisuals.healthBars.hideFullHealth; float scale = SkyblockerConfigManager.get().uiAndVisuals.healthBars.scale; float tickDelta = context.tickCounter().getTickDelta(false); + float width = scale; + float height = scale * 0.1f; for (Object2FloatMap.Entry healthValue : healthValues.object2FloatEntrySet()) { //if the health bar is full and the setting is enabled to hide it stop rendering it @@ -213,11 +215,13 @@ private static void render(WorldRenderContext context) { } ArmorStandEntity armorStand = healthValue.getKey(); + //only render health bar if name is visible + if (!armorStand.shouldRenderName()) { + return; + } // Render the health bar texture with scaling based on health percentage - float width = scale; - float height = scale * 0.1f; - RenderHelper.renderTextureInWorld(context, armorStand.getCameraPosVec(tickDelta).add(0, 0.25 - height, 0), width, height, 1f, 1f, new Vec3d(width * -0.5f, 0, 0), HEALTH_BAR_BACKGROUND_TEXTURE, barColor, false); - RenderHelper.renderTextureInWorld(context, armorStand.getCameraPosVec(tickDelta).add(0, 0.25 - height, 0), width * health, height, health, 1f, new Vec3d(width * -0.5f, 0, 0.003f), HEALTH_BAR_TEXTURE, barColor, false); + RenderHelper.renderTextureInWorld(context, armorStand.getCameraPosVec(tickDelta).add(0, 0.25 - height, 0), width, height, 1f, 1f, new Vec3d(width * -0.5f, 0, 0), HEALTH_BAR_BACKGROUND_TEXTURE, barColor, true); + RenderHelper.renderTextureInWorld(context, armorStand.getCameraPosVec(tickDelta).add(0, 0.25 - height, 0), width * health, height, health, 1f, new Vec3d(width * -0.5f, 0, 0.003f), HEALTH_BAR_TEXTURE, barColor, true); } } } diff --git a/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java b/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java index 29ff52a537..8e6cdd91fa 100644 --- a/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java +++ b/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java @@ -311,7 +311,7 @@ public static void renderTextureInWorld(WorldRenderContext context, Vec3d pos, f RenderSystem.setShaderTexture(0, texture); RenderSystem.setShaderColor(shaderColor.getRed() / 255f, shaderColor.getGreen() / 255f, shaderColor.getBlue() / 255f, shaderColor.getAlpha() / 255f); - RenderSystem.setShader(GameRenderer::getPositionTexProgram); + RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.disableCull();