Skip to content

Commit

Permalink
Add Config setting to hide modules in the ClickGUI (#5081)
Browse files Browse the repository at this point in the history
  • Loading branch information
machiecodes authored Feb 3, 2025
1 parent d350421 commit ba3660e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void init() {

// Category

protected WWindow createCategory(WContainer c, Category category) {
protected WWindow createCategory(WContainer c, Category category, List<Module> moduleList) {
WWindow w = theme.window(category.name);
w.id = category.name;
w.padding = 0;
Expand All @@ -68,7 +68,7 @@ protected WWindow createCategory(WContainer c, Category category) {
w.view.hasScrollBar = false;
w.view.spacing = 0;

for (Module module : Modules.get().getGroup(category)) {
for (Module module : moduleList) {
w.add(theme.module(module)).expandX();
}

Expand Down Expand Up @@ -202,8 +202,19 @@ protected class WCategoryController extends WContainer {

@Override
public void init() {
List<Module> moduleList = new ArrayList<>();
for (Category category : Modules.loopCategories()) {
windows.add(createCategory(this, category));
for (Module module : Modules.get().getGroup(category)) {
if (!Config.get().hiddenModules.get().contains(module)) {
moduleList.add(module);
}
}

// Ensure empty categories are not shown
if (!moduleList.isEmpty()) {
windows.add(createCategory(this, category, moduleList));
moduleList.clear();
}
}

windows.add(createSearch(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public static void addPreLoadTask(Runnable task) {
}

public static void init() {
// Has to be loaded first so the hidden modules list in config tab can load modules
add(new Modules());

Config config = new Config();
System<?> configSystem = add(config);
configSystem.init();
Expand All @@ -42,7 +45,6 @@ public static void init() {
// Registers the colors from config tab. This allows rainbow colours to work for friends.
config.settings.registerColorSettings(null);

add(new Modules());
add(new Macros());
add(new Friends());
add(new Accounts());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.systems.System;
import meteordevelopment.meteorclient.systems.Systems;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
Expand All @@ -26,6 +27,7 @@ public class Config extends System<Config> {
public final Settings settings = new Settings();

private final SettingGroup sgVisual = settings.createGroup("Visual");
private final SettingGroup sgModules = settings.createGroup("Modules");
private final SettingGroup sgChat = settings.createGroup("Chat");
private final SettingGroup sgMisc = settings.createGroup("Misc");

Expand Down Expand Up @@ -94,6 +96,29 @@ public class Config extends System<Config> {
.build()
);

// Modules

public final Setting<List<Module>> hiddenModules = sgModules.add(new ModuleListSetting.Builder()
.name("hidden-modules")
.description("Prevent these modules from being rendered as options in the clickgui.")
.build()
);

public final Setting<Integer> moduleSearchCount = sgModules.add(new IntSetting.Builder()
.name("module-search-count")
.description("Amount of modules and settings to be shown in the module search bar.")
.defaultValue(8)
.min(1).sliderMax(12)
.build()
);

public final Setting<Boolean> moduleAliases = sgModules.add(new BoolSetting.Builder()
.name("search-module-aliases")
.description("Whether or not module aliases will be used in the module search bar.")
.defaultValue(true)
.build()
);

// Chat

public final Setting<String> prefix = sgChat.add(new StringSetting.Builder()
Expand Down Expand Up @@ -134,21 +159,6 @@ public class Config extends System<Config> {
.build()
);

public final Setting<Integer> moduleSearchCount = sgMisc.add(new IntSetting.Builder()
.name("module-search-count")
.description("Amount of modules and settings to be shown in the module search bar.")
.defaultValue(8)
.min(1).sliderMax(12)
.build()
);

public final Setting<Boolean> moduleAliases = sgMisc.add(new BoolSetting.Builder()
.name("search-module-aliases")
.description("Whether or not module aliases will be used in the module search bar.")
.defaultValue(true)
.build()
);

public List<String> dontShowAgainPrompts = new ArrayList<>();

public Config() {
Expand Down

0 comments on commit ba3660e

Please sign in to comment.