diff options
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/internal')
4 files changed, 50 insertions, 3 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java index 3a00e06..7f0882a 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java @@ -1,10 +1,10 @@ package cc.polyfrost.oneconfig.internal; -import cc.polyfrost.oneconfig.config.core.ConfigCore; +import cc.polyfrost.oneconfig.internal.config.ConfigCore; import cc.polyfrost.oneconfig.config.data.Mod; import cc.polyfrost.oneconfig.config.data.ModType; import cc.polyfrost.oneconfig.events.EventManager; -import cc.polyfrost.oneconfig.hud.HudCore; +import cc.polyfrost.oneconfig.internal.hud.HudCore; import cc.polyfrost.oneconfig.internal.config.OneConfigConfig; import cc.polyfrost.oneconfig.internal.command.OneConfigCommand; import cc.polyfrost.oneconfig.internal.gui.BlurHandler; diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/config/ConfigCore.java b/src/main/java/cc/polyfrost/oneconfig/internal/config/ConfigCore.java new file mode 100644 index 0000000..f41b74e --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/internal/config/ConfigCore.java @@ -0,0 +1,25 @@ +package cc.polyfrost.oneconfig.internal.config; + +import cc.polyfrost.oneconfig.config.data.Mod; +import cc.polyfrost.oneconfig.internal.hud.HudCore; + +import java.util.ArrayList; + +public class ConfigCore { + public static ArrayList<Mod> oneConfigMods = new ArrayList<>(); + + public static void saveAll() { + for (Mod modData : oneConfigMods) { + modData.config.save(); + } + } + + public static void reInitAll() { + ArrayList<Mod> data = new ArrayList<>(oneConfigMods); + oneConfigMods.clear(); + HudCore.huds.clear(); + for (Mod modData : data) { + modData.config.init(modData); + } + } +} diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/hud/HudCore.java b/src/main/java/cc/polyfrost/oneconfig/internal/hud/HudCore.java new file mode 100644 index 0000000..7c92799 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/internal/hud/HudCore.java @@ -0,0 +1,22 @@ +package cc.polyfrost.oneconfig.internal.hud; + +import cc.polyfrost.oneconfig.events.event.HudRenderEvent; +import cc.polyfrost.oneconfig.hud.BasicHud; +import gg.essential.universal.UResolution; +import me.kbrewster.eventbus.Subscribe; + +import java.util.ArrayList; + +public class HudCore { + public static ArrayList<BasicHud> huds = new ArrayList<>(); + public static boolean editing = false; + + @Subscribe + public void onRender(HudRenderEvent event) { + if (editing) return; + for (BasicHud hud : huds) { + if (hud.enabled) + hud.drawAll(hud.getXScaled(UResolution.getScaledWidth()), hud.getYScaled(UResolution.getScaledHeight()), hud.scale, true); + } + } +} diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java index f241c74..09f40e7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java @@ -1,7 +1,7 @@ package cc.polyfrost.oneconfig.internal.plugin.asm.tweakers; import cc.polyfrost.oneconfig.config.compatibility.vigilance.VigilanceConfig; -import cc.polyfrost.oneconfig.config.core.ConfigCore; +import cc.polyfrost.oneconfig.internal.config.ConfigCore; import cc.polyfrost.oneconfig.config.data.Mod; import cc.polyfrost.oneconfig.config.data.ModType; import cc.polyfrost.oneconfig.internal.plugin.asm.ITransformer; |