aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTrương Hoàng Long <longtruong2411@gmail.com>2022-10-24 03:40:48 +0200
committerTrương Hoàng Long <longtruong2411@gmail.com>2022-10-24 03:43:00 +0200
commitb7f3f933bffdb07172c3e957002dbcae39371fbb (patch)
tree2036b8cfea3f8f3cc36143c413aec99ef67a2d8b /src
parentd5715454feb746850c242421bfd3be1bc06cf0ca (diff)
downloadSkyblocker-b7f3f933bffdb07172c3e957002dbcae39371fbb.tar.gz
Skyblocker-b7f3f933bffdb07172c3e957002dbcae39371fbb.tar.bz2
Skyblocker-b7f3f933bffdb07172c3e957002dbcae39371fbb.zip
Fix FancyStatusBar impacting performance
Fix #83
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java17
-rw-r--r--src/main/resources/assets/skyblocker/textures/gui/bars.pngbin8158 -> 9288 bytes
2 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java
index dfaeebd0..15a45e2e 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java
@@ -153,16 +153,19 @@ public class FancyStatusBars extends DrawableHelper {
// Draw the background for the bar
drawTexture(matrices, anchorsX[anchorNum] + offsetX + 10, anchorsY[anchorNum], 10, v, 2, 9);
- for (int i = 2; i < bar_width - 2; i++)
- drawTexture(matrices, anchorsX[anchorNum] + offsetX + 10 + i, anchorsY[anchorNum], 12, v, 1, 9);
- drawTexture(matrices, anchorsX[anchorNum] + offsetX + 10 + bar_width - 2, anchorsY[anchorNum], 41, v, 2, 9);
+ for (int i = 2; i < bar_width - 2; i += 58)
+ drawTexture(matrices, anchorsX[anchorNum] + offsetX + 10 + i, anchorsY[anchorNum], 12, v, Math.min(58, bar_width - 2 - i), 9);
+ drawTexture(matrices, anchorsX[anchorNum] + offsetX + 10 + bar_width - 2, anchorsY[anchorNum], 70, v, 2, 9);
// Draw the filled part of the bar
for (int i = 0; i < fill.length; i++) {
- for (int j = (bar_width - 3); j >= 0; j--) {
- if ( Math.max((j * 100)/(bar_width - 3), 1) > fill[i]) continue;
- drawTexture(matrices, anchorsX[anchorNum] + offsetX + 11 + j, anchorsY[anchorNum], ((j == 0 || j == bar_width - 3) ? 43 : 44) + i * 31, v, 1, 9);
- }
+ int fill_width = this.fill[i] * (bar_width - 2) / 100;
+ if (fill_width >= 1)
+ drawTexture(matrices, anchorsX[anchorNum] + offsetX + 11, anchorsY[anchorNum], 72 + i*60, v, 1, 9);
+ for (int j = 1; j < fill_width - 1; j += 58)
+ drawTexture(matrices, anchorsX[anchorNum] + offsetX + 11 + j, anchorsY[anchorNum], 73 + i*60, v, Math.min(58, fill_width - 1 - j), 9);
+ if (fill_width == bar_width - 2)
+ drawTexture(matrices, anchorsX[anchorNum] + offsetX + 11 + fill_width - 1, anchorsY[anchorNum], 131 + i*60, v, 1, 9);
}
}
diff --git a/src/main/resources/assets/skyblocker/textures/gui/bars.png b/src/main/resources/assets/skyblocker/textures/gui/bars.png
index 8b5ca33d..5ea1f830 100644
--- a/src/main/resources/assets/skyblocker/textures/gui/bars.png
+++ b/src/main/resources/assets/skyblocker/textures/gui/bars.png
Binary files differ