Compare commits

..
1 Commits
Author SHA1 Message Date
MalTeeezandgithub-actions[bot] ef0f8b5329 Prevent overflowing of bars in tooltip renderers (#66)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-11 18:50:24 +02:00
2 changed files with 2 additions and 2 deletions

No files matched your search

@@ -83,7 +83,7 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
tessellator.startDrawingQuads();
// Intentionally draw 2 pixels taller than needed than cover with the border to make the texture more
// visible
int i = (int) ((double) (maxStringW - 2) * amount / capacity);
int i = (int) ((double) (maxStringW - 2) * (amount / Math.max(capacity, amount)));
int j = 0;
for (; i > height; i = i - height) {
drawRectFromIcon(tessellator, 1 + (j * height), 0, 0, icon, height, height);
@@ -50,7 +50,7 @@ public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
drawRect(tessellator, 1 + i, 0, 0, width, height, 0.0, 0.0, 0.5, 1.0);
}
double i = (double) (maxStringW - 2) * amount / capacity;
double i = (double) (maxStringW - 2) * ((double) amount / Math.max(capacity, amount));
int drawnRects = 0;
for (; i > width; i -= width) {
drawRect(tessellator, 1 + (drawnRects * width), 0, 0, width, height, 0.5, 0.0, 1.0, 1.0);