Skip to content

Commit

Permalink
fix tinker's half heart not moving with regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru committed Sep 13, 2023
1 parent 9e2687f commit a832242
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/main/java/tconstruct/client/HealthBarRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,24 @@ public void renderHealthbar(RenderGameOverlayEvent.Pre event) {
// Render tinkers' hearts
mc.getTextureManager().bindTexture(TINKER_HEARTS);
for (int i = 0; i < health / 20; i++) {
final int renderHearts = Math.min(10, (health - 20 * (i + 1)) / 2);
for (int j = 0; j < renderHearts; j++) {
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;
this.drawTexturedModalRect(xBasePos + 8 * j, yBasePos + y, 18 * i, tinkerTextureY, 9, 9); // full heart texture
// full heart texture
this.drawTexturedModalRect(xBasePos + 8 * j, yBasePos + y, 18 * i, tinkerTextureY, 9, 9);
}
if (health % 2 == 1 && renderHearts < 10) {
this.drawTexturedModalRect(xBasePos + 8 * renderHearts, yBasePos, 9 + 18 * i, tinkerTextureY, 9, 9); // half heart texture
if (health % 2 == 1 && heartIndexMax < 10) {
int y = 0;
if (heartIndexMax == regen) y -= 2;
// half heart texture
this.drawTexturedModalRect(
xBasePos + 8 * heartIndexMax,
yBasePos + y,
9 + 18 * i,
tinkerTextureY,
9,
9);
}
}
mc.getTextureManager().bindTexture(icons);
Expand Down

0 comments on commit a832242

Please sign in to comment.