aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java
blob: 45fd243b18df914b90da009d827f6c9169f4f6a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package com.thatgravyboat.skyblockhud.overlay;

import com.thatgravyboat.skyblockhud.GuiTextures;
import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.core.util.render.RenderUtils;
import java.awt.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;

public class GenericOverlays extends Gui {

    public static void drawLargeBar(
        Minecraft mc,
        int x,
        int y,
        float percentage,
        float max,
        int fullColor,
        int loadingColor,
        int barStyle
    ) {
        if (SkyblockHud.hasSkyblockScoreboard()) {
            mc.renderEngine.bindTexture(GuiTextures.bars);
            Color color = new Color(
                percentage == max ? fullColor : loadingColor
            );

            RenderUtils.drawTexturedModalRect(x, y, 0, 0, 182, 5);
            GlStateManager.color(
                color.getRed() / 255f,
                color.getGreen() / 255f,
                color.getBlue() / 255f,
                color.getAlpha() / 255f
            );
            RenderUtils.drawTexturedModalRect(x, y, 0, 30, 182, 5);
            RenderUtils.drawTexturedModalRect(
                x,
                y,
                0,
                5,
                (int) (182 * percentage),
                5
            );
            if (barStyle != 0) {
                RenderUtils.drawTexturedModalRect(
                    x,
                    y,
                    0,
                    5 + (barStyle * 5),
                    182,
                    5
                );
            }
        }
    }

    public static void drawSmallBar(
        Minecraft mc,
        int x,
        int y,
        double percentage,
        double max,
        int fullColor,
        int loadingColor,
        int barStyle
    ) {
        if (SkyblockHud.hasSkyblockScoreboard()) {
            mc.renderEngine.bindTexture(GuiTextures.bars);
            Color color = new Color(
                percentage == max ? fullColor : loadingColor
            );
            GlStateManager.enableBlend();
            RenderUtils.drawTexturedModalRect(x, y, 0, 35, 62, 5);
            GlStateManager.color(
                color.getRed() / 255f,
                color.getGreen() / 255f,
                color.getBlue() / 255f,
                color.getAlpha() / 255f
            );
            RenderUtils.drawTexturedModalRect(x, y, 0, 65, 62, 5);
            RenderUtils.drawTexturedModalRect(
                x,
                y,
                0,
                40,
                (int) (62 * percentage),
                5
            );
            if (barStyle != 0) {
                RenderUtils.drawTexturedModalRect(
                    x,
                    y,
                    0,
                    45 + (barStyle * 5),
                    62,
                    5
                );
            }
        }
    }
}