From 3e4ec7eaaa103201681a6a26f57ded423071b986 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Thu, 14 Sep 2023 01:03:05 +0200 Subject: [PATCH] fix drawing all tinkers' hearts on top of each others, and now only draw the top most hearts --- src/main/java/tconstruct/client/HealthBarRenderer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/client/HealthBarRenderer.java b/src/main/java/tconstruct/client/HealthBarRenderer.java index ae26d8f1da1..ad504f8ee98 100644 --- a/src/main/java/tconstruct/client/HealthBarRenderer.java +++ b/src/main/java/tconstruct/client/HealthBarRenderer.java @@ -154,13 +154,15 @@ public void renderHealthbar(RenderGameOverlayEvent.Pre event) { if (health > 20) { // Render tinkers' hearts mc.getTextureManager().bindTexture(TINKER_HEARTS); - for (int i = 0; i < health / 20; i++) { + for (int i = Math.max(0, health / 20 - 2); i < health / 20; i++) { final int heartIndexMax = Math.min(10, (health - 20 * (i + 1)) / 2); for (int j = 0; j < heartIndexMax; j++) { int y = 0; if (j == regen) y -= 2; - // full heart texture - this.drawTexturedModalRect(xBasePos + 8 * j, yBasePos + y, 18 * i, tinkerTextureY, 9, 9); + if ((i + 1) * 20 + j * 2 + 21 >= health) { + // full heart texture + this.drawTexturedModalRect(xBasePos + 8 * j, yBasePos + y, 18 * i, tinkerTextureY, 9, 9); + } } if (health % 2 == 1 && heartIndexMax < 10) { int y = 0;