aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-28 17:29:26 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-28 17:29:26 +0700
commite85b11665a92e8a6bffb11b76b45ee3c97138bd2 (patch)
tree1e85d3673d6511df53b96deb8fc23989cd304722 /src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java
parent61861be3663dc05883c387070c81eae9154444ef (diff)
downloadOneConfig-e85b11665a92e8a6bffb11b76b45ee3c97138bd2.tar.gz
OneConfig-e85b11665a92e8a6bffb11b76b45ee3c97138bd2.tar.bz2
OneConfig-e85b11665a92e8a6bffb11b76b45ee3c97138bd2.zip
revert funny diamond hud stuff
add ExcludeType again fix INSTANCE field stuff
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java80
1 files changed, 2 insertions, 78 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java b/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java
index 7895f26..74a7602 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java
@@ -3,17 +3,8 @@ package cc.polyfrost.oneconfig.hud;
import cc.polyfrost.oneconfig.config.annotations.Color;
import cc.polyfrost.oneconfig.config.annotations.Dropdown;
import cc.polyfrost.oneconfig.config.core.OneColor;
-import cc.polyfrost.oneconfig.internal.hud.HudCore;
-import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
-import cc.polyfrost.oneconfig.renderer.RenderManager;
-
-import java.util.List;
-
-public abstract class TextHud extends Hud {
- protected transient List<String> lines = null;
- private transient int width;
- private transient int height;
+abstract class TextHud extends Hud {
@Color(
name = "Text Color"
)
@@ -25,75 +16,8 @@ public abstract class TextHud extends Hud {
)
public int textType = 0;
+
public TextHud(boolean enabled, int x, int y) {
super(enabled, x, y);
}
- public TextHud(boolean enabled) {
- this(enabled, 0, 0);
- }
-
- /**
- * This function is called every tick
- *
- * @return The new lines
- */
- protected abstract List<String> update();
-
- /**
- * This function is called every frame
- *
- * @return The new lines, null if you want to use the cached lines
- */
- protected List<String> updateFrequent() {
- return null;
- }
-
- /**
- * This function is called every tick in the move GUI
- *
- * @return The new lines
- */
- protected List<String> updateExample() {
- return update();
- }
-
- /**
- * This function is called every frame in the move GUI
- *
- * @return The new lines, null if you want to use the cached lines
- */
- protected List<String> updateExampleFrequent() {
- return updateFrequent();
- }
-
- @Override
- public void draw(int x, int y, float scale) {
- List<String> frequentLines = HudCore.editing ? updateExampleFrequent() : updateFrequent();
- if (frequentLines != null) lines = frequentLines;
- if (lines == null) return;
-
- int textY = y;
- width = 0;
- for (String line : lines) {
- RenderManager.drawScaledString(line, x, textY, color.getRGB(), RenderManager.TextType.toType(textType), scale);
- width = Math.max(width, UMinecraft.getFontRenderer().getStringWidth(line));
- textY += 12 * scale;
- }
- height = (int) ((textY - y) / scale - 3);
- }
-
- @Override
- public int getWidth(float scale) {
- return (int) (width * scale);
- }
-
- @Override
- public int getHeight(float scale) {
- return (int) (height * scale);
- }
-
- public void tick() {
- if (!HudCore.editing) lines = update();
- else lines = updateExample();
- }
}