src/main/java/codes/biscuit/skyblockaddons/listeners/RenderListener.java
/**
     * This renders both the bars.
     */
This renders both the bars.
This renders both the bars .
public void drawBar(Feature feature, float scale, Minecraft mc, ButtonLocation buttonLocation) {
        mc.getTextureManager().bindTexture(BARS);
        if (main.getUtils().isUsingOldSkyBlockTexture()) {
            mc.getTextureManager().bindTexture(IMPERIAL_BARS_FIX);
        }
        int barHeightExpansion = 2 * main.getConfigValues().getSizes(feature).getY();
        int height = 3 + barHeightExpansion;
        int barWidthExpansion = 10 * main.getConfigValues().getSizes(feature).getX();
        int width = 22 + barWidthExpansion;
        float fill;
        if (feature == Feature.MANA_BAR) {
            fill = (float) getAttribute(Attribute.MANA) / getAttribute(Attribute.MAX_MANA);
        } else {
            fill = (float) getAttribute(Attribute.HEALTH) / getAttribute(Attribute.MAX_HEALTH);
        }
        if (fill > 1) fill = 1;
        int filled = Math.round(fill * width);
        float x = main.getConfigValues().getActualX(feature);
        float y = main.getConfigValues().getActualY(feature);
        Color color = main.getConfigValues().getColor(feature);
        if (feature == Feature.HEALTH_BAR && main.getConfigValues().isEnabled(Feature.CHANGE_BAR_COLOR_FOR_POTIONS)) {
            if (mc.thePlayer.isPotionActive(19/* Poison */)) {
                color = ChatFormatting.DARK_GREEN.getColor();
            } else if (mc.thePlayer.isPotionActive(20/* Wither */)) {
                color = ChatFormatting.DARK_GRAY.getColor();
            }
        }
        x /= scale;
        y /= scale;
        x -= (float) width / 2;
        y -= (float) height / 2;
        int intX = Math.round(x);
        int intY = Math.round(y);
        if (buttonLocation == null) {
            drawModularBar(mc, color, false, intX, intY + barHeightExpansion / 2, null, feature, filled, width);
            if (filled > 0) {
                drawModularBar(mc, color, true, intX, intY + barHeightExpansion / 2, null, feature, filled, width);
            }
        } else {
            int boxXOne = intX - 4;
            int boxXTwo = intX + width + 5;
            int boxYOne = intY - 3;
            int boxYTwo = intY + height + 4;
            buttonLocation.checkHoveredAndDrawBox(boxXOne, boxXTwo, boxYOne, boxYTwo, scale);
            drawModularBar(mc, color, false, intX, intY + barHeightExpansion / 2, buttonLocation, feature, filled, width);
            if (filled > 0) {
                drawModularBar(mc, color, true, intX, intY + barHeightExpansion / 2, buttonLocation, feature, filled, width);
            }
        }
    }
public void drawBar ( Feature feature , float scale , Minecraft mc , ButtonLocation buttonLocation ) { mc . getTextureManager ( ) . bindTexture ( BARS ) ; if ( main . getUtils ( ) . isUsingOldSkyBlockTexture ( ) ) { mc . getTextureManager ( ) . bindTexture ( IMPERIAL_BARS_FIX ) ; } int barHeightExpansion = 2 * main . getConfigValues ( ) . getSizes ( feature ) . getY ( ) ; int height = 3 + barHeightExpansion ; int barWidthExpansion = 10 * main . getConfigValues ( ) . getSizes ( feature ) . getX ( ) ; int width = 22 + barWidthExpansion ; float fill ; if ( feature == Feature . MANA_BAR ) { fill = ( float ) getAttribute ( Attribute . MANA ) / getAttribute ( Attribute . MAX_MANA ) ; } else { fill = ( float ) getAttribute ( Attribute . HEALTH ) / getAttribute ( Attribute . MAX_HEALTH ) ; } if ( fill > 1 ) fill = 1 ; int filled = Math . round ( fill * width ) ; float x = main . getConfigValues ( ) . getActualX ( feature ) ; float y = main . getConfigValues ( ) . getActualY ( feature ) ; Color color = main . getConfigValues ( ) . getColor ( feature ) ; if ( feature == Feature . HEALTH_BAR && main . getConfigValues ( ) . isEnabled ( Feature . CHANGE_BAR_COLOR_FOR_POTIONS ) ) { if ( mc . thePlayer . isPotionActive ( 19 /* Poison */ ) ) { color = ChatFormatting . DARK_GREEN . getColor ( ) ; } else if ( mc . thePlayer . isPotionActive ( 20 /* Wither */ ) ) { color = ChatFormatting . DARK_GRAY . getColor ( ) ; } } x /= scale ; y /= scale ; x -= ( float ) width / 2 ; y -= ( float ) height / 2 ; int intX = Math . round ( x ) ; int intY = Math . round ( y ) ; if ( buttonLocation == null ) { drawModularBar ( mc , color , false , intX , intY + barHeightExpansion / 2 , null , feature , filled , width ) ; if ( filled > 0 ) { drawModularBar ( mc , color , true , intX , intY + barHeightExpansion / 2 , null , feature , filled , width ) ; } } else { int boxXOne = intX - 4 ; int boxXTwo = intX + width + 5 ; int boxYOne = intY - 3 ; int boxYTwo = intY + height + 4 ; buttonLocation . checkHoveredAndDrawBox ( boxXOne , boxXTwo , boxYOne , boxYTwo , scale ) ; drawModularBar ( mc , color , false , intX , intY + barHeightExpansion / 2 , buttonLocation , feature , filled , width ) ; if ( filled > 0 ) { drawModularBar ( mc , color , true , intX , intY + barHeightExpansion / 2 , buttonLocation , feature , filled , width ) ; } } }
This renders both the bars.
This renders both the bars .
// The height and width of this element (box not included) // The fill of the bar from 0 to 1 // Put the x & y to scale, remove half the width and height to center this element.