From 79731b2cae7405244e1ca305a0ca3de5754fabea Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Fri, 10 Jun 2022 19:18:10 +0200 Subject: make test stuff not be in final build --- .../java/cc/polyfrost/oneconfig/gui/SideBar.java | 2 - .../cc/polyfrost/oneconfig/internal/OneConfig.java | 13 +-- .../polyfrost/oneconfig/test/ButtonTestPage.java | 70 ------------ .../oneconfig/test/ButtonTestPage_Test.java | 70 ++++++++++++ .../cc/polyfrost/oneconfig/test/TestCommand.java | 39 ------- .../polyfrost/oneconfig/test/TestCommand_Test.java | 39 +++++++ .../cc/polyfrost/oneconfig/test/TestConfig.java | 126 --------------------- .../polyfrost/oneconfig/test/TestConfig_Test.java | 126 +++++++++++++++++++++ .../java/cc/polyfrost/oneconfig/test/TestHud.java | 33 ------ .../cc/polyfrost/oneconfig/test/TestHud_Test.java | 33 ++++++ .../cc/polyfrost/oneconfig/test/TestMod_Test.java | 14 +++ .../java/cc/polyfrost/oneconfig/test/TestPage.java | 11 -- .../cc/polyfrost/oneconfig/test/TestPage_Test.java | 11 ++ 13 files changed, 297 insertions(+), 290 deletions(-) delete mode 100644 src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java create mode 100644 src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java delete mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestCommand.java create mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestCommand_Test.java delete mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java create mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java delete mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestHud.java create mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java create mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java delete mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestPage.java create mode 100644 src/main/java/cc/polyfrost/oneconfig/test/TestPage_Test.java (limited to 'src/main/java/cc/polyfrost') diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index 5678189..bda24a2 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -10,7 +10,6 @@ import cc.polyfrost.oneconfig.internal.assets.Colors; import cc.polyfrost.oneconfig.renderer.RenderManager; import cc.polyfrost.oneconfig.renderer.font.Fonts; import cc.polyfrost.oneconfig.internal.assets.SVGs; -import cc.polyfrost.oneconfig.test.ButtonTestPage; import cc.polyfrost.oneconfig.utils.gui.GuiUtils; import cc.polyfrost.oneconfig.utils.color.ColorPalette; @@ -41,7 +40,6 @@ public class SideBar { public SideBar() { buttons.get(0).setClickAction(new CreditsPage()); buttons.get(2).setClickAction(new ModsPage()); - buttons.get(8).setClickAction(new ButtonTestPage()); HUDButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui())); CloseButton.setClickAction(GuiUtils::closeScreen); for (BasicButton button : buttons) { diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java index 948f4ec..389e200 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java @@ -1,17 +1,15 @@ package cc.polyfrost.oneconfig.internal; -import cc.polyfrost.oneconfig.internal.config.core.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.internal.hud.HudCore; -import cc.polyfrost.oneconfig.internal.config.OneConfigConfig; import cc.polyfrost.oneconfig.internal.command.OneConfigCommand; +import cc.polyfrost.oneconfig.internal.config.OneConfigConfig; +import cc.polyfrost.oneconfig.internal.config.core.ConfigCore; import cc.polyfrost.oneconfig.internal.gui.BlurHandler; -import cc.polyfrost.oneconfig.test.TestCommand; -import cc.polyfrost.oneconfig.test.TestConfig; -import cc.polyfrost.oneconfig.utils.gui.GuiUtils; +import cc.polyfrost.oneconfig.internal.hud.HudCore; import cc.polyfrost.oneconfig.utils.commands.CommandManager; +import cc.polyfrost.oneconfig.utils.gui.GuiUtils; import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils; import net.minecraftforge.fml.common.DummyModContainer; import net.minecraftforge.fml.common.Loader; @@ -32,7 +30,6 @@ public class OneConfig { public static final List loadedMods = new ArrayList<>(); public static final List loadedOtherMods = new ArrayList<>(); public static OneConfigConfig config; - public static TestConfig testConfig; private static boolean preLaunched = false; private static boolean initialized = false; @@ -60,9 +57,7 @@ public class OneConfig { if (initialized) return; GuiUtils.getDeltaTime(); // called to make sure static initializer is called BlurHandler.INSTANCE.load(); - testConfig = new TestConfig(); CommandManager.INSTANCE.registerCommand(OneConfigCommand.class); - CommandManager.INSTANCE.registerCommand(TestCommand.class); EventManager.getEventManager().register(new HudCore()); EventManager.getEventManager().register(HypixelUtils.INSTANCE); reloadModsList(); diff --git a/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java b/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java deleted file mode 100644 index d7575ce..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java +++ /dev/null @@ -1,70 +0,0 @@ -package cc.polyfrost.oneconfig.test; - -import cc.polyfrost.oneconfig.gui.elements.BasicButton; -import cc.polyfrost.oneconfig.gui.pages.Page; -import cc.polyfrost.oneconfig.internal.assets.SVGs; -import cc.polyfrost.oneconfig.utils.color.ColorPalette; - -import java.util.ArrayList; - -public class ButtonTestPage extends Page { - private final ArrayList row1 = new ArrayList() {{ - add(new BasicButton(254, 48, "Primary", BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "Primary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY_DESTRUCTIVE)); - add(new BasicButton(254, 48, "Secondary", BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY)); - add(new BasicButton(254, 48, "Secondary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY_DESTRUCTIVE)); - add(new BasicButton(254, 48, "Tertiary", BasicButton.ALIGNMENT_LEFT, ColorPalette.TERTIARY)); - add(new BasicButton(254, 48, "Tertiary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.TERTIARY_DESTRUCTIVE)); - add(new BasicButton(254, 48, "LeftIconLA", SVGs.BOX, null, BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY)); - add(new BasicButton(254, 48, "RightIconLA", null, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY)); - add(new BasicButton(254, 48, "LeftIconCA", SVGs.BOX, null, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY)); - add(new BasicButton(254, 48, "RightIconCA", null, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY)); - }}; - - private final ArrayList row2 = new ArrayList() {{ - add(new BasicButton(170, 32, "32", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); - add(new BasicButton(193, 36, "36", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); - add(new BasicButton(208, 40, "40", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "48", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "JustifiedRight", null, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.SECONDARY_DESTRUCTIVE)); - add(new BasicButton(254, 48, "JustifiedLeft", SVGs.BOX, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.SECONDARY_DESTRUCTIVE)); - add(new BasicButton(254, 48, "JustifiedNoIcon", null, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "TertiaryIcon", SVGs.BOX, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.TERTIARY_DESTRUCTIVE)); - - }}; - - private final ArrayList row3 = new ArrayList() {{ - add(new BasicButton(254, 48, "Left", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "Center", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "Justified", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY)); - add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY)); - }}; - - public ButtonTestPage() { - super("Buttons"); - row3.get(3).disable(true); - row3.get(4).disable(true); - row3.get(5).disable(true); - } - - @Override - public void draw(long vg, int x, int y) { - int buttonY = y + 16; - for (BasicButton button : row1) { - button.draw(vg, x + 16, buttonY); - buttonY += 64; - } - buttonY = y + 16; - for (BasicButton button : row2) { - button.draw(vg, x + 286, buttonY); - buttonY += 64; - } - buttonY = y + 16; - for (BasicButton button : row3) { - button.draw(vg, x + 556, buttonY); - buttonY += 64; - } - } -} diff --git a/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java new file mode 100644 index 0000000..fe25477 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java @@ -0,0 +1,70 @@ +package cc.polyfrost.oneconfig.test; + +import cc.polyfrost.oneconfig.gui.elements.BasicButton; +import cc.polyfrost.oneconfig.gui.pages.Page; +import cc.polyfrost.oneconfig.internal.assets.SVGs; +import cc.polyfrost.oneconfig.utils.color.ColorPalette; + +import java.util.ArrayList; + +public class ButtonTestPage_Test extends Page { + private final ArrayList row1 = new ArrayList() {{ + add(new BasicButton(254, 48, "Primary", BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "Primary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY_DESTRUCTIVE)); + add(new BasicButton(254, 48, "Secondary", BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY)); + add(new BasicButton(254, 48, "Secondary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY_DESTRUCTIVE)); + add(new BasicButton(254, 48, "Tertiary", BasicButton.ALIGNMENT_LEFT, ColorPalette.TERTIARY)); + add(new BasicButton(254, 48, "Tertiary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.TERTIARY_DESTRUCTIVE)); + add(new BasicButton(254, 48, "LeftIconLA", SVGs.BOX, null, BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY)); + add(new BasicButton(254, 48, "RightIconLA", null, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY)); + add(new BasicButton(254, 48, "LeftIconCA", SVGs.BOX, null, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY)); + add(new BasicButton(254, 48, "RightIconCA", null, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY)); + }}; + + private final ArrayList row2 = new ArrayList() {{ + add(new BasicButton(170, 32, "32", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); + add(new BasicButton(193, 36, "36", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); + add(new BasicButton(208, 40, "40", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "48", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "JustifiedRight", null, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.SECONDARY_DESTRUCTIVE)); + add(new BasicButton(254, 48, "JustifiedLeft", SVGs.BOX, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.SECONDARY_DESTRUCTIVE)); + add(new BasicButton(254, 48, "JustifiedNoIcon", null, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "TertiaryIcon", SVGs.BOX, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.TERTIARY_DESTRUCTIVE)); + + }}; + + private final ArrayList row3 = new ArrayList() {{ + add(new BasicButton(254, 48, "Left", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "Center", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "Justified", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY)); + add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY)); + }}; + + public ButtonTestPage_Test() { + super("Buttons"); + row3.get(3).disable(true); + row3.get(4).disable(true); + row3.get(5).disable(true); + } + + @Override + public void draw(long vg, int x, int y) { + int buttonY = y + 16; + for (BasicButton button : row1) { + button.draw(vg, x + 16, buttonY); + buttonY += 64; + } + buttonY = y + 16; + for (BasicButton button : row2) { + button.draw(vg, x + 286, buttonY); + buttonY += 64; + } + buttonY = y + 16; + for (BasicButton button : row3) { + button.draw(vg, x + 556, buttonY); + buttonY += 64; + } + } +} diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestCommand.java b/src/main/java/cc/polyfrost/oneconfig/test/TestCommand.java deleted file mode 100644 index b757c73..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -package cc.polyfrost.oneconfig.test; - -import cc.polyfrost.oneconfig.utils.commands.annotations.Command; -import cc.polyfrost.oneconfig.utils.commands.annotations.Main; -import cc.polyfrost.oneconfig.utils.commands.annotations.Name; -import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand; -import gg.essential.universal.UChat; - -@Command(value = "test", aliases = {"t"}) -public class TestCommand { - - @Main - private static void main() { // /test - UChat.chat("Main command"); - } - - @SubCommand(value = "subcommand", aliases = {"s"}) - private static class TestSubCommand { - - @Main(priority = 999) - private static void main(int a, float b, @Name("named c") String c) { // /test subcommand - UChat.chat("Integer main: " + a + " " + b + " " + c); - } - - @Main(priority = 10001) - private static void main(double a, double b, @Name("named c") String c) { // /test subcommand - UChat.chat("Double main: " + a + " " + b + " " + c); - } - - @SubCommand(value = "subsubcommand", aliases = {"ss"}) - private static class TestSubSubCommand { - - @Main - private static void main(String a, String b, @Name("named c") String c) { // /test subcommand subsubcommand - UChat.chat(a + " " + b + " " + c); - } - } - } -} diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestCommand_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/TestCommand_Test.java new file mode 100644 index 0000000..31a503b --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestCommand_Test.java @@ -0,0 +1,39 @@ +package cc.polyfrost.oneconfig.test; + +import cc.polyfrost.oneconfig.utils.commands.annotations.Command; +import cc.polyfrost.oneconfig.utils.commands.annotations.Main; +import cc.polyfrost.oneconfig.utils.commands.annotations.Name; +import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand; +import gg.essential.universal.UChat; + +@Command(value = "test", aliases = {"t"}) +public class TestCommand_Test { + + @Main + private static void main() { // /test + UChat.chat("Main command"); + } + + @SubCommand(value = "subcommand", aliases = {"s"}) + private static class TestSubCommand { + + @Main(priority = 999) + private static void main(int a, float b, @Name("named c") String c) { // /test subcommand + UChat.chat("Integer main: " + a + " " + b + " " + c); + } + + @Main(priority = 10001) + private static void main(double a, double b, @Name("named c") String c) { // /test subcommand + UChat.chat("Double main: " + a + " " + b + " " + c); + } + + @SubCommand(value = "subsubcommand", aliases = {"ss"}) + private static class TestSubSubCommand { + + @Main + private static void main(String a, String b, @Name("named c") String c) { // /test subcommand subsubcommand + UChat.chat(a + " " + b + " " + c); + } + } + } +} diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java deleted file mode 100644 index dc3babd..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java +++ /dev/null @@ -1,126 +0,0 @@ -package cc.polyfrost.oneconfig.test; - -import cc.polyfrost.oneconfig.config.annotations.*; -import cc.polyfrost.oneconfig.config.core.OneColor; -import cc.polyfrost.oneconfig.config.core.OneKeyBind; -import cc.polyfrost.oneconfig.config.data.*; -import cc.polyfrost.oneconfig.config.Config; -import cc.polyfrost.oneconfig.config.data.ModType; -import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator; -import gg.essential.universal.UKeyboard; -import net.minecraftforge.fml.common.FMLCommonHandler; - -public class TestConfig extends Config { - - @Switch( - name = "Test Switch", - size = OptionSize.DUAL - ) - public boolean testSwitch = false; - - @Checkbox( - name = "Check box", - size = OptionSize.DUAL - ) - public static boolean testCheckBox = true; - - @Info( - text = "Test Info", - type = InfoType.ERROR, - size = OptionSize.DUAL - ) - boolean ignored; - - @Header( - text = "Test Header", - size = OptionSize.DUAL - ) - boolean ignored1; - - @Dropdown( - name = "Test Dropdown", - options = {"option1", "option2", "option3"}, - size = OptionSize.DUAL - ) - private int testDropdown = 0; - - @Color( - name = "Test Color", - size = OptionSize.DUAL - ) - OneColor testColor = new OneColor(0, 255, 255); - - @Text( - name = "Test Text", - size = OptionSize.DUAL - ) - private static String testText = "Epic Text"; - - @Button( - name = "Test Button", - text = "Crash game" - ) - Runnable runnable = () -> FMLCommonHandler.instance().exitJava(69, false); - - @Slider( - name = "Test Slider", - min = 25, - max = 50 - ) - float testSlider = 50; - - @KeyBind( - name = "Test KeyBind", - size = OptionSize.DUAL - ) - OneKeyBind testKeyBind = new OneKeyBind(UKeyboard.KEY_LSHIFT, UKeyboard.KEY_S); - - @DualOption( - name = "Test Dual Option", - left = "YES", - right = "NO", - size = OptionSize.DUAL - ) - boolean testDualOption = false; - - @Page( - name = "Test Page", - location = PageLocation.TOP - - ) - public TestPage testPage = new TestPage(); - - @Page( - name = "Test Page", - description = "Test Description", - location = PageLocation.BOTTOM - - ) - public TestPage testPage2 = new TestPage(); - - @Switch( - name = "Test Switch", - size = OptionSize.DUAL, - category = "Category 2" - ) - boolean testSwitch1 = false; - - @Switch( - name = "Test Switch", - size = OptionSize.DUAL, - category = "Category 2", - subcategory = "Test Subcategory" - ) - boolean testSwitch2 = false; - - @HUD( - name = "Test HUD", - category = "HUD" - ) - public TestHud hud = new TestHud(false, 0, 0); - - public TestConfig() { - super(new Mod("Test Mod", ModType.UTIL_QOL, new VigilanceMigrator("./config/testConfig.toml")), "hacksConfig.json"); - } -} - diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java new file mode 100644 index 0000000..aee6d6b --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java @@ -0,0 +1,126 @@ +package cc.polyfrost.oneconfig.test; + +import cc.polyfrost.oneconfig.config.annotations.*; +import cc.polyfrost.oneconfig.config.core.OneColor; +import cc.polyfrost.oneconfig.config.core.OneKeyBind; +import cc.polyfrost.oneconfig.config.data.*; +import cc.polyfrost.oneconfig.config.Config; +import cc.polyfrost.oneconfig.config.data.ModType; +import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator; +import gg.essential.universal.UKeyboard; +import net.minecraftforge.fml.common.FMLCommonHandler; + +public class TestConfig_Test extends Config { + + @Switch( + name = "Test Switch", + size = OptionSize.DUAL + ) + public boolean testSwitch = false; + + @Checkbox( + name = "Check box", + size = OptionSize.DUAL + ) + public static boolean testCheckBox = true; + + @Info( + text = "Test Info", + type = InfoType.ERROR, + size = OptionSize.DUAL + ) + boolean ignored; + + @Header( + text = "Test Header", + size = OptionSize.DUAL + ) + boolean ignored1; + + @Dropdown( + name = "Test Dropdown", + options = {"option1", "option2", "option3"}, + size = OptionSize.DUAL + ) + private int testDropdown = 0; + + @Color( + name = "Test Color", + size = OptionSize.DUAL + ) + OneColor testColor = new OneColor(0, 255, 255); + + @Text( + name = "Test Text", + size = OptionSize.DUAL + ) + private static String testText = "Epic Text"; + + @Button( + name = "Test Button", + text = "Crash game" + ) + Runnable runnable = () -> FMLCommonHandler.instance().exitJava(69, false); + + @Slider( + name = "Test Slider", + min = 25, + max = 50 + ) + float testSlider = 50; + + @KeyBind( + name = "Test KeyBind", + size = OptionSize.DUAL + ) + OneKeyBind testKeyBind = new OneKeyBind(UKeyboard.KEY_LSHIFT, UKeyboard.KEY_S); + + @DualOption( + name = "Test Dual Option", + left = "YES", + right = "NO", + size = OptionSize.DUAL + ) + boolean testDualOption = false; + + @Page( + name = "Test Page", + location = PageLocation.TOP + + ) + public TestPage_Test testPage = new TestPage_Test(); + + @Page( + name = "Test Page", + description = "Test Description", + location = PageLocation.BOTTOM + + ) + public TestPage_Test testPage2 = new TestPage_Test(); + + @Switch( + name = "Test Switch", + size = OptionSize.DUAL, + category = "Category 2" + ) + boolean testSwitch1 = false; + + @Switch( + name = "Test Switch", + size = OptionSize.DUAL, + category = "Category 2", + subcategory = "Test Subcategory" + ) + boolean testSwitch2 = false; + + @HUD( + name = "Test HUD", + category = "HUD" + ) + public TestHud_Test hud = new TestHud_Test(false, 0, 0); + + public TestConfig_Test() { + super(new Mod("Test Mod", ModType.UTIL_QOL, new VigilanceMigrator("./config/testConfig.toml")), "hacksConfig.json"); + } +} + diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java deleted file mode 100644 index 023ae43..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java +++ /dev/null @@ -1,33 +0,0 @@ -package cc.polyfrost.oneconfig.test; - -import cc.polyfrost.oneconfig.config.annotations.Switch; -import cc.polyfrost.oneconfig.config.annotations.Text; -import cc.polyfrost.oneconfig.hud.TextHud; -import net.minecraft.client.Minecraft; - -import java.util.ArrayList; -import java.util.List; - -public class TestHud extends TextHud { - public TestHud(boolean enabled, int x, int y) { - super(enabled, x, y); - } - - @Override - public List getLines() { - ArrayList lines = new ArrayList<>(); - lines.add("FPS: " + Minecraft.getDebugFPS()); - if (hasSecondLine) lines.add(secondLine); - return lines; - } - - @Switch( - name = "Has Second Line" - ) - public boolean hasSecondLine = false; - - @Text( - name = "Second Line Text" - ) - public String secondLine = "Epic text"; -} diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java new file mode 100644 index 0000000..0de9d65 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java @@ -0,0 +1,33 @@ +package cc.polyfrost.oneconfig.test; + +import cc.polyfrost.oneconfig.config.annotations.Switch; +import cc.polyfrost.oneconfig.config.annotations.Text; +import cc.polyfrost.oneconfig.hud.TextHud; +import net.minecraft.client.Minecraft; + +import java.util.ArrayList; +import java.util.List; + +public class TestHud_Test extends TextHud { + public TestHud_Test(boolean enabled, int x, int y) { + super(enabled, x, y); + } + + @Override + public List getLines() { + ArrayList lines = new ArrayList<>(); + lines.add("FPS: " + Minecraft.getDebugFPS()); + if (hasSecondLine) lines.add(secondLine); + return lines; + } + + @Switch( + name = "Has Second Line" + ) + public boolean hasSecondLine = false; + + @Text( + name = "Second Line Text" + ) + public String secondLine = "Epic text"; +} diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java new file mode 100644 index 0000000..98537f7 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java @@ -0,0 +1,14 @@ +package cc.polyfrost.oneconfig.test; + +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; + +@net.minecraftforge.fml.common.Mod(modid = "oneconfig-test-mod", name = "Test Mod", version = "0") +public class TestMod_Test { + TestConfig_Test config; + + @Mod.EventHandler + public void init(FMLInitializationEvent event) { + config = new TestConfig_Test(); + } +} diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java b/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java deleted file mode 100644 index 54a775a..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestPage.java +++ /dev/null @@ -1,11 +0,0 @@ -package cc.polyfrost.oneconfig.test; - -import cc.polyfrost.oneconfig.config.annotations.Switch; - -public class TestPage { - - @Switch( - name = "Epic Test Switch" - ) - boolean test = false; -} diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestPage_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/TestPage_Test.java new file mode 100644 index 0000000..0f8f692 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestPage_Test.java @@ -0,0 +1,11 @@ +package cc.polyfrost.oneconfig.test; + +import cc.polyfrost.oneconfig.config.annotations.Switch; + +public class TestPage_Test { + + @Switch( + name = "Epic Test Switch" + ) + boolean test = false; +} -- cgit