Skip to content

Commit

Permalink
Start on ConfigGui v2
Browse files Browse the repository at this point in the history
  • Loading branch information
connorslade committed Jul 13, 2023
1 parent 057fa3a commit 342215b
Show file tree
Hide file tree
Showing 22 changed files with 78 additions and 31 deletions.
12 changes: 2 additions & 10 deletions src/main/java/com/connorcode/sigmautils/config/ConfigGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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();

Expand Down
50 changes: 50 additions & 0 deletions src/main/java/com/connorcode/sigmautils/config/ConfigGui2.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<K> extends Setting<DynamicListSetting<K>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<K> extends Setting<DynamicSelectorSetting<K>> {
ResourceManager<K> manager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<StringSetting> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> implements DynamicListSetting.ResourceManager<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> implements DynamicSelectorSetting.ResourceManager<T> {
protected Registry<T> registry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 =
Expand Down Expand Up @@ -48,4 +47,9 @@ protected void applyValue() {
}
});
}

public static int getPadding() {
if (!Config.getEnabled(Padding.class)) return 2;
return Padding.padding.intValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 342215b

Please sign in to comment.