diff options
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig')
66 files changed, 0 insertions, 5317 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/OneConfig.java b/src/main/java/io/polyfrost/oneconfig/OneConfig.java deleted file mode 100644 index dedf6b8..0000000 --- a/src/main/java/io/polyfrost/oneconfig/OneConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -package io.polyfrost.oneconfig; - -import io.polyfrost.oneconfig.command.OneConfigCommand; -import io.polyfrost.oneconfig.config.OneConfigConfig; -import io.polyfrost.oneconfig.config.core.ConfigCore; -import io.polyfrost.oneconfig.config.data.Mod; -import io.polyfrost.oneconfig.config.data.ModType; -import io.polyfrost.oneconfig.hud.HudCore; -import io.polyfrost.oneconfig.lwjgl.BlurHandler; -import io.polyfrost.oneconfig.lwjgl.RenderManager; -import io.polyfrost.oneconfig.lwjgl.font.Fonts; -import io.polyfrost.oneconfig.lwjgl.image.Images; -import io.polyfrost.oneconfig.test.TestConfig; -import net.minecraft.client.Minecraft; -import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.ModMetadata; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - -import java.io.File; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; - -@net.minecraftforge.fml.common.Mod(modid = "@ID@", name = "@NAME@", version = "@VER@") -public class OneConfig { - private static final Minecraft mc = Minecraft.getMinecraft(); - public static File jarFile; - public static File oneConfigDir = new File(mc.mcDataDir, "OneConfig/"); - public static File themesDir = new File(oneConfigDir, "themes/"); - public static OneConfigConfig config; - public static TestConfig testConfig; - public static List<Mod> loadedMods = new ArrayList<>(); - public static List<ModMetadata> loadedOtherMods = new ArrayList<>(); - - @net.minecraftforge.fml.common.Mod.EventHandler - public void onPreFMLInit(FMLPreInitializationEvent event) { - jarFile = event.getSourceFile(); - oneConfigDir.mkdirs(); - themesDir.mkdirs(); - config = new OneConfigConfig(); - } - - @net.minecraftforge.fml.common.Mod.EventHandler - public void onFMLInitialization(FMLInitializationEvent event) { - BlurHandler.INSTANCE.load(); - testConfig = new TestConfig(); - ClientCommandHandler.instance.registerCommand(new OneConfigCommand()); - MinecraftForge.EVENT_BUS.register(this); - MinecraftForge.EVENT_BUS.register(new HudCore()); - RenderManager.setupAndDraw((vg) -> { - RenderManager.drawRoundedRect(vg, -100, -100, 50, 50, -1, 12f); - RenderManager.drawString(vg, "OneConfig loading...", -100, -100, -1, 12f, Fonts.INTER_MEDIUM); - RenderManager.drawImage(vg, Images.LOGO, -100, -100, 50, 50); - }); - } - - @net.minecraftforge.fml.common.Mod.EventHandler - public void onPostFMLInit(FMLPostInitializationEvent event) { - reloadModsList(); - } - - public static void reloadModsList() { - loadedMods.addAll(ConfigCore.oneConfigMods); - LinkedHashSet<Mod> modData = new LinkedHashSet<>(ConfigCore.oneConfigMods); - for (ModContainer mod : Loader.instance().getActiveModList()) { - ModMetadata metadata = mod.getMetadata(); - loadedOtherMods.add(metadata); - String author = metadata.authorList.size() > 0 ? metadata.authorList.get(0) : ""; - Mod newMod = new Mod(metadata.name, ModType.OTHER, author, metadata.version); - if (newMod.name.equals("Minecraft Coder Pack") || newMod.name.equals("Forge Mod Loader") || newMod.name.equals("Minecraft Forge")) { // TODO add oneconfig - continue; - } - if (modData.add(newMod)) loadedMods.add(newMod); // anti duplicate fix - } - } -} diff --git a/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java b/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java deleted file mode 100644 index f792ee7..0000000 --- a/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java +++ /dev/null @@ -1,55 +0,0 @@ -package io.polyfrost.oneconfig.command; - -import io.polyfrost.oneconfig.gui.HudGui; -import io.polyfrost.oneconfig.gui.OneConfigGui; -import io.polyfrost.oneconfig.test.TestNanoVGGui; -import io.polyfrost.oneconfig.utils.TickDelay; -import net.minecraft.client.Minecraft; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; - -import java.util.ArrayList; -import java.util.List; - -public class OneConfigCommand extends CommandBase { - - private static final Minecraft mc = Minecraft.getMinecraft(); - - @Override - public String getCommandName() { - return "oneconfig"; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "oneconfig <>"; - } - - @Override - public List<String> getCommandAliases() { - return new ArrayList<String>() {{ - add("oneconfig"); - add("ocfg"); - }}; - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (args.length == 0) new TickDelay(() -> mc.displayGuiScreen(new OneConfigGui()), 1); - else { - switch (args[0]) { - case "hud": - new TickDelay(() -> mc.displayGuiScreen(new HudGui()), 1); - break; - case "lwjgl": - new TickDelay(() -> mc.displayGuiScreen(new TestNanoVGGui()), 1); - break; - } - } - } - - @Override - public int getRequiredPermissionLevel() { - return -1; - } -} diff --git a/src/main/java/io/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/io/polyfrost/oneconfig/config/OneConfigConfig.java deleted file mode 100644 index a772a23..0000000 --- a/src/main/java/io/polyfrost/oneconfig/config/OneConfigConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -package io.polyfrost.oneconfig.config; - -import com.google.gson.JsonParser; -import io.polyfrost.oneconfig.config.data.Mod; -import io.polyfrost.oneconfig.config.interfaces.Config; - -import java.awt.*; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; - -public class OneConfigConfig extends Config { - - public static String currentProfile = "Default Profile"; - - // TODO i dont know how this works so this is just gonna be here for now - public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB(); // Transparent // button sidebar normal - - public static final int GRAY_900 = new Color(13, 14, 15, 255).getRGB(); // Gray 900 - public static final int GRAY_900_80 = new Color(13, 14, 15, 204).getRGB(); // Gray 900 80% - public static final int GRAY_800 = new Color(21, 22, 23, 255).getRGB(); // Gray 800 - public static final int GRAY_700 = new Color(34, 35, 38, 255).getRGB(); // Gray 700 - public static final int GRAY_600 = new Color(42, 44, 48, 255).getRGB(); // Gray 600 - public static final int GRAY_500 = new Color(49, 51, 56, 255).getRGB(); // Gray 500 // button sidebar hover, button gray normal - public static final int GRAY_500_80 = new Color(49, 51, 56, 204).getRGB(); // Gray 500 80% // button sidebar pressed - - public static final int GRAY_400 = new Color(55, 59, 69, 255).getRGB(); // Gray 400 - public static final int GRAY_300 = new Color(73, 79, 92, 255).getRGB(); // Gray 300 // button gray hover - public static final int GRAY_200 = new Color(100, 107, 125, 255).getRGB(); // Gray 200 - public static final int GRAY_400_80 = new Color(55, 59, 69, 204).getRGB(); // Gray 400 80% // button gray pressed - public static final int BLUE_800 = new Color(13, 51, 128, 255).getRGB(); // Blue 800 - public static final int BLUE_700 = new Color(18, 71, 178, 255).getRGB(); // Blue 700 - public static final int BLUE_700_80 = new Color(18, 71, 178, 204).getRGB(); // Blue 700 80% - public static final int BLUE_600 = new Color(20, 82, 204, 255).getRGB(); // Blue 600 // button blue normal - public static final int BLUE_600_80 = new Color(20, 82, 204, 204).getRGB(); // Blue 600 80% // button blue click - public static final int BLUE_500 = new Color(25, 103, 255, 255).getRGB(); // Blue 500 // button blue hover - public static final int BLUE_400 = new Color(48, 129, 242, 255).getRGB(); - public static final int BLUE_400_80 = new Color(48, 129, 242, 204).getRGB(); - public static final int WHITE_50 = new Color(255, 255, 255, 127).getRGB(); // White 60% - public static final int WHITE_60 = new Color(255, 255, 255, 153).getRGB(); // White 60% - public static final int WHITE_80 = new Color(255, 255, 255, 204).getRGB(); // White 80% - public static final int WHITE_90 = new Color(255, 255, 255, 229).getRGB(); // White 90% - public static final int WHITE_95 = new Color(255, 255, 255, 242).getRGB(); // White 90% - public static final int WHITE = new Color(255, 255, 255, 255).getRGB(); // White 100% - - public static final int ERROR_700 = new Color(180, 24, 24, 255).getRGB(); // Red 700 - - public static boolean ROUNDED_CORNERS = true; - public static float CORNER_RADIUS_WIN = 20f; - public static float CORNER_RADIUS = 12f; - - - public OneConfigConfig() { - super(null, "OneConfig.json"); - } - - @Override - public void init(Mod mod) { - if (new File("OneConfig/" + configFile).exists()) load(); - else save(); - } - - @Override - public void save() { - try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) { - writer.write(gson.toJson(this.getClass())); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public void load() { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) { - deserializePart(new JsonParser().parse(reader).getAsJsonObject(), this.getClass()); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/io/polyfrost/oneconfig/config/annotations/ConfigPage.java b/src/main/java/io/polyfrost/oneconfig/config/annotations/ConfigPage.java deleted file mode 100644 index c0a4169..0000000 --- a/src/main/java/io/polyfrost/oneconfig/config/annotations/ConfigPage.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.polyfrost.oneconfig.config.annotations; - -import io.polyfrost.oneconfig.config.data.PageLocation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface ConfigPage { - /** - * The name of the page that will be displayed to the user - */ - String name(); - - /** - * If the page button is at the top or bottem of the page - */ - PageLocation location(); - - /** - * The description of the page that will be displayed to the user - */ - String description() default ""; - - /** - * The category of the page - */ - String category() default "General"; -} diff --git a/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java b/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java deleted file mode 100644 index 9955c17..0000000 --- a/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java +++ /dev/null @@ -1,85 +0,0 @@ -package io.polyfrost.oneconfig.config.annotations; - -import io.polyfrost.oneconfig.config.data.InfoType; -import io.polyfrost.oneconfig.config.data.OptionType; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Option { - /** - * The name of the option that will be displayed to the user - */ - String name(); - - /** - * The type of the option - */ - OptionType type(); - - /** - * The category of the component - */ - String category() default "General"; - - /** - * The subcategory of the component (displayed as header) - */ - String subcategory(); - - /** - * The width of the option (1 = half width, 2 = full width) - */ - int size() default 1; - - /** - * A String array of all the possible values for the UniSelector, dropdownList, and ComboBox. - * Also used in the DualOption slider, index 0 is the left, index 1 is the right; for example: - * {"Option 1", "Option 2"} - */ - String[] options() default {}; - - /** - * The places you want dividers to be in a dropdown - */ - int[] dividers() default {}; - - /** - * The placeholder in the text field - */ - String placeholder() default ""; - - /** - * If the text field is secure or not - */ - boolean secure() default false; - - /** - * If the text field is multi line or not - */ - boolean multiLine() default false; - - /** - * Minimum value of slider - */ - float min() default 0; - - /** - * The maximum value of the slider - */ - float max() default 0; - - /** - * Steps of slider (0 for no steps) - */ - int step() default 0; - - /** - * Option for info option type - */ - InfoType infoType() default InfoType.INFO; -} diff --git a/src/main/java/io/polyfrost/oneconfig/config/core/ConfigCore.java b/src/main/java/io/polyfrost/oneconfig/config/core/ConfigCore.java deleted file mode 100644 index 6cce197..0000000 --- a/src/main/java/io/polyfrost/oneconfig/config/core/ConfigCore.java +++ /dev/null @@ -1,25 +0,0 @@ -package io.polyfrost.oneconfig.config.core; - -import io.polyfrost.oneconfig.config.data.Mod; -import io.polyfrost.oneconfig.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/io/polyfrost/oneconfig/config/data/InfoType.java b/src/main/java/io/polyfrost/oneconfig/config/data/InfoType.java deleted file mode 100644 index 1b96161..0000000 --- a/src/main/java/io/polyfrost/oneconfig/config/data/InfoType.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.polyfrost.oneconfig.config.data; - -public enum InfoType { - INFO, - WARNING, - ERROR, - SUCCESS -} diff --git a/src/main/java/io/polyfrost/oneconfig/config/data/Mod.java b/src/main/java/io/polyfrost/oneconfig/config/data/Mod.java deleted file mode 100644 index 095dded..0000000 --- a/src/main/java/io/polyfrost/oneconfig/config/data/Mod.java +++ /dev/null @@ -1,26 +0,0 @@ -package io.polyfrost.oneconfig.config.data; - -import io.polyfrost.oneconfig.config.interfaces.Config; - -public class Mod { - public final String name; - public final ModType modType; - public final String creator; - public final String version; - public Config config; - public final OptionPage defaultPage; - - /** - * @param name Friendly name of the mod - * @param modType Type of the mod (for example ModType.QOL) - * @param creator Creator of the mod - * @param version Version of the mod - */ - public Mod(String name, ModType modType, String creator, String version) { - this.name = name; - this.modType = modType; - this.creator = creator; - this.version = version; - this.defaultPage = |
