Skip to content

Commit

Permalink
add block health feature (full)
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxADIxzx committed Mar 2, 2025
1 parent 9b52c0f commit 91842d2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/java/schema/tools/Overlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,31 @@ public void drawBars() {
Draw.color(Pal.darkerGray);
draw.get(x, y, width, radius);
draw.get(x, y, width, -radius);

Draw.color(Pal.remove);
float progress = 2f * width * (1f - t.build.healthf());
float middle = 2f * (width - radius), l;

l = Math.max(0, progress / radius);
if (l < 1) Fill.quad(
x + width - radius, y + radius,
x + width - radius * l, y + radius * l,
x + width - radius * l, y - radius * l,
x + width - radius, y - radius);

l = Math.max(0, (progress - radius) / middle);
if (l < 1) Fill.quad(
x - width + radius, y + radius,
x + width - radius - middle * l, y + radius,
x + width - radius - middle * l, y - radius,
x - width + radius, y - radius);

l = Math.max(0, (progress - radius - middle) / radius);
if (l < 1) Fill.quad(
x - width, y,
x - width + radius * (1f - l), y + radius * (1f - l),
x - width + radius * (1f - l), y - radius * (1f - l),
x - width, y);
});
});
}
Expand Down

0 comments on commit 91842d2

Please sign in to comment.