diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-29 11:57:33 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-29 11:57:33 +0200 |
commit | 28962efa38a5c259ce532d3b0d1b3d9b5cd79f93 (patch) | |
tree | b6f631da2aa5b52c4aef6451d8512637242bdadd /src/main/java/cc/polyfrost/oneconfig/hud | |
parent | 975826256806e19306987e05aa0e59f70d09b0b1 (diff) | |
download | OneConfig-28962efa38a5c259ce532d3b0d1b3d9b5cd79f93.tar.gz OneConfig-28962efa38a5c259ce532d3b0d1b3d9b5cd79f93.tar.bz2 OneConfig-28962efa38a5c259ce532d3b0d1b3d9b5cd79f93.zip |
Revert "unfinished stuff"
This reverts commit 975826256806e19306987e05aa0e59f70d09b0b1.
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/hud')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java b/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java index 013debb..4a1a765 100644 --- a/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java +++ b/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java @@ -2,9 +2,7 @@ package cc.polyfrost.oneconfig.hud; import cc.polyfrost.oneconfig.config.annotations.Color; import cc.polyfrost.oneconfig.config.annotations.Dropdown; -import cc.polyfrost.oneconfig.config.annotations.Switch; import cc.polyfrost.oneconfig.config.core.OneColor; -import cc.polyfrost.oneconfig.config.elements.BasicOption; import cc.polyfrost.oneconfig.events.EventManager; import cc.polyfrost.oneconfig.events.event.Stage; import cc.polyfrost.oneconfig.events.event.TickEvent; @@ -12,7 +10,6 @@ import cc.polyfrost.oneconfig.internal.hud.HudCore; import cc.polyfrost.oneconfig.libs.eventbus.Subscribe; import cc.polyfrost.oneconfig.libs.universal.UMinecraft; import cc.polyfrost.oneconfig.renderer.RenderManager; -import cc.polyfrost.oneconfig.utils.TickDelay; import java.util.ArrayList; import java.util.List; @@ -33,37 +30,13 @@ public abstract class TextHud extends Hud { ) public int textType = 0; - @Switch( - name = "Cache Text" - ) - public boolean cacheText; - - public TextHud(boolean enabled, int x, int y, boolean caching) { + public TextHud(boolean enabled, int x, int y) { super(enabled, x, y); - cacheText = caching; - new TickDelay(() -> { - try { - BasicOption option = BasicOption.getOption(getClass().getField("cacheText")); - option.addHideCondition(() -> !caching); - } catch (NoSuchFieldException e) { - e.printStackTrace(); - } - }, 3); - if (caching) { - EventManager.INSTANCE.register(new TickHandler()); - } - } - - public TextHud() { - this(true); + EventManager.INSTANCE.register(new TickHandler()); } public TextHud(boolean enabled) { - this(enabled, true); - } - - public TextHud(boolean enabled, boolean caching) { - this(enabled, 0, 0, caching); + this(enabled, 0, 0); } /** @@ -74,6 +47,15 @@ public abstract class TextHud extends Hud { protected abstract void getLines(List<String> lines); /** + * This function is called every frame + * + * @param lines The current lines of the hud + */ + protected void getLinesFrequent(List<String> lines) { + + } + + /** * This function is called every tick in the move GUI * * @param lines The current lines of the hud @@ -82,9 +64,21 @@ public abstract class TextHud extends Hud { getLines(lines); } + /** + * This function is called every frame in the move GUI + * + * @param lines The current lines of the hud + */ + protected void getExampleLinesFrequent(List<String> lines) { + getLinesFrequent(lines); + } + @Override public void draw(int x, int y, float scale) { -// todo + if (!HudCore.editing) getLinesFrequent(lines); + else getExampleLinesFrequent(lines); + if (lines == null) return; + int textY = y; width = 0; for (String line : lines) { @@ -109,7 +103,6 @@ public abstract class TextHud extends Hud { @Subscribe private void onTick(TickEvent event) { if (event.stage != Stage.START) return; - lines.clear(); if (!HudCore.editing) getLines(lines); else getExampleLines(lines); } |