Update RegularSlider.java

This commit is contained in:
kirillsaint 2023-08-15 01:55:46 +06:00
parent d1f740d0d5
commit 81f4ff0fd5

View File

@ -13,9 +13,9 @@ public class RegularSlider {
public static void render(float x, float y, int width, String name, double max, double value) {
Client.getInstance().getSilentFontRenderer().drawString(name, x, y, 12, SilentFontRenderer.FontType.TITLE);
RenderUtil.drawRoundedRect(x, y + 15, 144, 9, 3, Color.black.getRGB());
RenderUtil.drawRoundedRect(x, y + 15, width, 9, 3, Color.black.getRGB());
if(value != 0) {
RenderUtil.drawRoundedRect(x, y + 15, 144F * (float) (value / max), 9, 3, -1);
RenderUtil.drawRoundedRect(x, y + 15, width * (float) (value / max), 9, 3, -1);
}
float textLeft = x + width - Client.getInstance().getSilentFontRenderer().getStringWidth(new DecimalFormat("0.00").format(value), 12, SilentFontRenderer.FontType.TITLE);
@ -23,6 +23,6 @@ public class RegularSlider {
}
public static boolean isDrag(int mouseX, int mouseY, float x, float y, int width) {
return MouseUtils.isInside(mouseX, mouseY, x, y + 15, 144, 9) && Mouse.isButtonDown(0);
return MouseUtils.isInside(mouseX, mouseY, x, y + 15, width, 9) && Mouse.isButtonDown(0);
}
}