blob: 29c6d89d1dd0fb0156667da8bf3ff59543072753 (
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
|
package cc.polyfrost.oneconfig.hud;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import gg.essential.universal.UMinecraft;
import java.util.List;
public abstract class TextHud extends BasicHud {
private transient int width = 100;
private transient int height;
public TextHud(boolean enabled, int x, int y) {
super(enabled, x, y);
}
@Override
public int getWidth(float scale) {
return (int) (width * scale);
}
@Override
public int getHeight(float scale) {
return (int) (height * scale);
}
@Override
public void draw(int x, int y, float scale) {
int textY = y;
width = 0;
for (String line : getLines()) {
RenderManager.drawScaledString(line, x, textY, 0xffffff, false, scale);
width = Math.max(width, UMinecraft.getFontRenderer().getStringWidth(line));
textY += 12 * scale;
}
height = (int) ((textY - y) / scale - 3);
}
public abstract List<String> getLines();
}
|