fix config bugs

This commit is contained in:
C10udburst
2022-02-02 11:30:51 +01:00
parent 99a473f463
commit 4eec0c00e3
5 changed files with 17 additions and 25 deletions

View File

@@ -13,6 +13,6 @@ public class ConfigTabMixin {
// No idea why CallbackInfoReturnable, but fabric crashes otherwise lol // No idea why CallbackInfoReturnable, but fabric crashes otherwise lol
@Inject(method = "createScreen", at=@At("HEAD"), remap = false) @Inject(method = "createScreen", at=@At("HEAD"), remap = false)
private void onCreateScreen(CallbackInfoReturnable<?> cir) { private void onCreateScreen(CallbackInfoReturnable<?> cir) {
ConfigModifier.INSTANCE.hiddenModules.set(RejectsConfig.get().getHiddenModules()); ConfigModifier.get().hiddenModules.set(RejectsConfig.get().getHiddenModules());
} }
} }

View File

@@ -1,17 +0,0 @@
package anticope.rejects.mixin.meteor;
import anticope.rejects.utils.ConfigModifier;
import meteordevelopment.meteorclient.systems.Systems;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Systems.class)
public class SystemsMixin {
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lmeteordevelopment/meteorclient/systems/System;load()V"), remap = false)
private static void onInitializeConfig(CallbackInfo ci) {
// adds the reject settings
new ConfigModifier();
}
}

View File

@@ -12,11 +12,7 @@ import java.util.List;
public class ConfigModifier { public class ConfigModifier {
public static ConfigModifier INSTANCE; private static ConfigModifier INSTANCE;
public ConfigModifier() {
INSTANCE = this;
}
public final SettingGroup sgRejects = Config.get().settings.createGroup("Rejects"); public final SettingGroup sgRejects = Config.get().settings.createGroup("Rejects");
@@ -36,4 +32,9 @@ public class ConfigModifier {
.onChanged(v -> RejectsConfig.get().setHiddenModules(v)) .onChanged(v -> RejectsConfig.get().setHiddenModules(v))
.build() .build()
); );
public static ConfigModifier get() {
if (INSTANCE == null) INSTANCE = new ConfigModifier();
return INSTANCE;
}
} }

View File

@@ -4,6 +4,7 @@ import meteordevelopment.meteorclient.systems.System;
import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.utils.render.prompts.OkPrompt;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@@ -40,6 +41,14 @@ public class RejectsConfig extends System<RejectsConfig> {
} }
public void setHiddenModules(List<Module> newList) { public void setHiddenModules(List<Module> newList) {
if (newList.size() < hiddenModules.size()) {
OkPrompt.create()
.title("Hidden Modules")
.message("In order to see the modules you have removed from the list you need to restart Minecraft.")
.id("hidden-modules-unhide")
.show();
}
hiddenModules.clear();
for (Module module : newList) { for (Module module : newList) {
if (module.isActive()) module.toggle(); if (module.isActive()) module.toggle();
hiddenModules.add(module.name); hiddenModules.add(module.name);

View File

@@ -9,7 +9,6 @@
"HttpMixin", "HttpMixin",
"ModulesMixin", "ModulesMixin",
"modules.FlightMixin", "modules.FlightMixin",
"modules.NoRenderAccessor", "modules.NoRenderAccessor"
"SystemsMixin"
] ]
} }