From 342215b5d6191a9a3d31d4f316e971ef03454173 Mon Sep 17 00:00:00 2001 From: Connor Slade Date: Wed, 12 Jul 2023 21:09:08 -0400 Subject: [PATCH] Start on ConfigGui v2 --- .../sigmautils/config/ConfigGui.java | 12 +---- .../sigmautils/config/ConfigGui2.java | 50 +++++++++++++++++++ .../sigmautils/config/ModuleConfigGui.java | 2 +- .../config/settings/DynamicListSetting.java | 2 +- .../settings/DynamicSelectorSetting.java | 2 +- .../config/settings/KeyBindSetting.java | 2 +- .../config/settings/StringSetting.java | 2 +- .../config/settings/list/SimpleList.java | 2 +- .../config/settings/list/SimpleSelector.java | 2 +- .../sigmautils/misc/Components.java | 2 +- .../sigmautils/mixin/TitleScreenMixin.java | 3 +- .../sigmautils/modules/hud/Hud.java | 2 +- .../modules/meta/Notifications.java | 2 +- .../sigmautils/modules/meta/Padding.java | 8 ++- .../sigmautils/modules/meta/Scale.java | 2 +- .../sigmautils/modules/misc/ForceWeather.java | 2 +- .../sigmautils/modules/misc/SoundControl.java | 2 +- .../sigmautils/modules/misc/TickSpeed.java | 2 +- .../modules/rendering/EntityHighlight.java | 2 +- .../sigmautils/modules/rendering/Zoom.java | 2 +- .../modules/server/PlayerHistory.java | 2 +- .../modules/server/VictoryMute.java | 2 +- 22 files changed, 78 insertions(+), 31 deletions(-) create mode 100644 src/main/java/com/connorcode/sigmautils/config/ConfigGui2.java diff --git a/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java b/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java index 1ba29f1..aa6b281 100644 --- a/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java +++ b/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java @@ -3,7 +3,6 @@ import com.connorcode.sigmautils.SigmaUtils; import com.connorcode.sigmautils.module.Category; import com.connorcode.sigmautils.module.Module; -import com.connorcode.sigmautils.modules.meta.Padding; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -17,6 +16,8 @@ import java.util.List; import java.util.Objects; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; + public class ConfigGui extends Screen { Screen _super; @@ -29,15 +30,6 @@ public ConfigGui(Screen screen) { this._super = screen; } - public static int getPadding() { - try { - if (!Config.getEnabled(Padding.class)) return 2; - } catch (Exception e) { - e.printStackTrace(); - } - return Padding.padding.intValue(); - } - protected void init() { int padding = getPadding(); diff --git a/src/main/java/com/connorcode/sigmautils/config/ConfigGui2.java b/src/main/java/com/connorcode/sigmautils/config/ConfigGui2.java new file mode 100644 index 0000000..0750dea --- /dev/null +++ b/src/main/java/com/connorcode/sigmautils/config/ConfigGui2.java @@ -0,0 +1,50 @@ +package com.connorcode.sigmautils.config; + +import com.connorcode.sigmautils.module.Category; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.text.Text; + +import java.util.Objects; + +public class ConfigGui2 extends Screen { + Screen _super; + Category category; + + public ConfigGui2(Screen _super) { + super(Text.of("Sigma Utils - Config")); + this._super = _super; + this.category = Category.Interface; + } + + public ConfigGui2(Screen _super, Category category) { + super(Text.of("Sigma Utils - Config")); + this._super = _super; + this.category = category; + } + + @Override + protected void init() { + // Category buttons + for (var i : Category.realValues()) { + var name = i.toString(); + if (i == category) name = "> " + name + " <"; + var button = ButtonWidget.builder(Text.of(name), + b -> Objects.requireNonNull(client).setScreen(new ConfigGui2(_super, i))) + .size(100, 20) + .position(4, 4 + i.ordinal() * 22) + .build(); + addDrawableChild(button); + } + + // Modules + } + + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + renderBackgroundTexture(context); + super.render(context, mouseX, mouseY, delta); + context.fill(22, 0, width, height, 0x00000017); + } +} \ No newline at end of file diff --git a/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java b/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java index 68dd7d3..24a52fe 100644 --- a/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java +++ b/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java @@ -15,7 +15,7 @@ import java.util.List; import java.util.Objects; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; public class ModuleConfigGui extends Screen { private final Module module; diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java index 6ba3a2e..6f4c0f4 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java @@ -16,7 +16,7 @@ import java.util.*; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; public class DynamicListSetting extends Setting> { diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/DynamicSelectorSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/DynamicSelectorSetting.java index 3fd8f31..7c6ce81 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/DynamicSelectorSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/DynamicSelectorSetting.java @@ -17,7 +17,7 @@ import java.util.*; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; public class DynamicSelectorSetting extends Setting> { ResourceManager manager; diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/KeyBindSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/KeyBindSetting.java index aa2ac60..96988b8 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/KeyBindSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/KeyBindSetting.java @@ -12,7 +12,7 @@ import java.util.Locale; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; import static net.minecraft.client.util.InputUtil.*; diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/StringSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/StringSetting.java index 796ea0c..da9f6ff 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/StringSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/StringSetting.java @@ -13,7 +13,7 @@ import java.util.Optional; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; import static com.mojang.brigadier.arguments.StringArgumentType.greedyString; public class StringSetting extends Setting { diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleList.java b/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleList.java index 7953d35..15e83d3 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleList.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleList.java @@ -19,7 +19,7 @@ import java.util.Objects; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; public abstract class SimpleList implements DynamicListSetting.ResourceManager { diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleSelector.java b/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleSelector.java index c5941e0..e04c4e6 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleSelector.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleSelector.java @@ -16,7 +16,7 @@ import java.util.Objects; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; public abstract class SimpleSelector implements DynamicSelectorSetting.ResourceManager { protected Registry registry; diff --git a/src/main/java/com/connorcode/sigmautils/misc/Components.java b/src/main/java/com/connorcode/sigmautils/misc/Components.java index 6de90ce..1576bdc 100644 --- a/src/main/java/com/connorcode/sigmautils/misc/Components.java +++ b/src/main/java/com/connorcode/sigmautils/misc/Components.java @@ -20,7 +20,7 @@ import net.minecraft.util.math.MathHelper; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; public class Components { diff --git a/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java index 9dacbc6..9b1c4bd 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java @@ -42,7 +42,8 @@ void init(CallbackInfo ci) { var y = screen.getHeight() / 4 + 48 + 24; if (UiTweaks.noRealms()) y += 24 * 2 - 20; Util.addChild(this, - ButtonWidget.builder(Text.of("Σ"), button -> Objects.requireNonNull(client).setScreen(new ConfigGui())) + ButtonWidget.builder(Text.of("Σ"), + button -> Objects.requireNonNull(client).setScreen(new ConfigGui(this))) .position(screen.getWidth() / 2 - 100 - 24, y) .size(20, 20) .tooltip(Tooltip.of(Text.of("Sigma Utils"))) diff --git a/src/main/java/com/connorcode/sigmautils/modules/hud/Hud.java b/src/main/java/com/connorcode/sigmautils/modules/hud/Hud.java index 2eefea4..7d20df5 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/hud/Hud.java +++ b/src/main/java/com/connorcode/sigmautils/modules/hud/Hud.java @@ -15,7 +15,7 @@ import java.util.*; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "The basic text hud that can be placed in the corners of the window") public class Hud extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/meta/Notifications.java b/src/main/java/com/connorcode/sigmautils/modules/meta/Notifications.java index 6a7d08a..dc43b7a 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/meta/Notifications.java +++ b/src/main/java/com/connorcode/sigmautils/modules/meta/Notifications.java @@ -12,7 +12,7 @@ import net.minecraft.text.Text; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Shows a message in the (C)hat, (A)ction bar or (T)oast for various events.") public class Notifications extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/meta/Padding.java b/src/main/java/com/connorcode/sigmautils/modules/meta/Padding.java index cfaacfe..7089f1e 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/meta/Padding.java +++ b/src/main/java/com/connorcode/sigmautils/modules/meta/Padding.java @@ -1,5 +1,6 @@ package com.connorcode.sigmautils.modules.meta; +import com.connorcode.sigmautils.config.Config; import com.connorcode.sigmautils.config.settings.NumberSetting; import com.connorcode.sigmautils.misc.Components; import com.connorcode.sigmautils.misc.util.Util; @@ -11,8 +12,6 @@ import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; - @ModuleInfo(description = "Sets the padding of Sigma Utils gui elements") public class Padding extends Module { public static NumberSetting padding = @@ -48,4 +47,9 @@ protected void applyValue() { } }); } + + public static int getPadding() { + if (!Config.getEnabled(Padding.class)) return 2; + return Padding.padding.intValue(); + } } diff --git a/src/main/java/com/connorcode/sigmautils/modules/meta/Scale.java b/src/main/java/com/connorcode/sigmautils/modules/meta/Scale.java index 4cea855..df9f724 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/meta/Scale.java +++ b/src/main/java/com/connorcode/sigmautils/modules/meta/Scale.java @@ -9,7 +9,7 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Sets the scale of gui elements on this screen. [EXPERIMENTAL]") public class Scale extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/misc/ForceWeather.java b/src/main/java/com/connorcode/sigmautils/modules/misc/ForceWeather.java index 6a93748..00ff13d 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/misc/ForceWeather.java +++ b/src/main/java/com/connorcode/sigmautils/modules/misc/ForceWeather.java @@ -7,7 +7,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Forces the weather of the client rendering. (C)lear, (R)ain, (T)hunder") public class ForceWeather extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/misc/SoundControl.java b/src/main/java/com/connorcode/sigmautils/modules/misc/SoundControl.java index 7bfb201..10ffa66 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/misc/SoundControl.java +++ b/src/main/java/com/connorcode/sigmautils/modules/misc/SoundControl.java @@ -23,8 +23,8 @@ import java.util.Objects; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; import static com.connorcode.sigmautils.config.settings.list.SimpleList.selector; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Lets you control the volume of every sound event.") public class SoundControl extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/misc/TickSpeed.java b/src/main/java/com/connorcode/sigmautils/modules/misc/TickSpeed.java index c11812c..b435959 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/misc/TickSpeed.java +++ b/src/main/java/com/connorcode/sigmautils/modules/misc/TickSpeed.java @@ -13,7 +13,7 @@ import net.minecraft.util.math.MathHelper; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Sets the clients tick speed in MSPT") public class TickSpeed extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java b/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java index 7a58379..db867ab 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java +++ b/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java @@ -31,7 +31,7 @@ import java.util.Optional; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Outlines entities through blocks") public class EntityHighlight extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/rendering/Zoom.java b/src/main/java/com/connorcode/sigmautils/modules/rendering/Zoom.java index 85e9eef..c353374 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/rendering/Zoom.java +++ b/src/main/java/com/connorcode/sigmautils/modules/rendering/Zoom.java @@ -15,7 +15,7 @@ import net.minecraft.util.math.MathHelper; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Zoom (Fov multiplier)") public class Zoom extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/server/PlayerHistory.java b/src/main/java/com/connorcode/sigmautils/modules/server/PlayerHistory.java index 17b3511..f9d5c69 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/server/PlayerHistory.java +++ b/src/main/java/com/connorcode/sigmautils/modules/server/PlayerHistory.java @@ -19,7 +19,7 @@ import java.util.UUID; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Logs every player you see on servers. Kinda cool.") public class PlayerHistory extends Module { diff --git a/src/main/java/com/connorcode/sigmautils/modules/server/VictoryMute.java b/src/main/java/com/connorcode/sigmautils/modules/server/VictoryMute.java index 0fe2b67..36acfd6 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/server/VictoryMute.java +++ b/src/main/java/com/connorcode/sigmautils/modules/server/VictoryMute.java @@ -15,7 +15,7 @@ import java.util.regex.Pattern; import static com.connorcode.sigmautils.SigmaUtils.client; -import static com.connorcode.sigmautils.config.ConfigGui.getPadding; +import static com.connorcode.sigmautils.modules.meta.Padding.getPadding; @ModuleInfo(description = "Automatically mute the game when you finish a game of bedwars on hypixel") public class VictoryMute extends Module {