blob: 99df46bedefb8a5a8e8c416769b30b88b8ceb62e (
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
|
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;
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);
}
public abstract List<String> getLines();
}
|