added a way to hide modules from gui
This commit is contained in:
10
README.md
10
README.md
@@ -23,7 +23,7 @@ An addon to Meteor Client that adds modules and commands that were too useless t
|
||||
- Put it in your `.minecraft/mods` folder where you have installed Meteor.
|
||||
|
||||
# Features
|
||||
### Modules
|
||||
## Modules
|
||||
- AntiBot (Removed from Meteor in [166fc](https://github.com/MeteorDevelopment/meteor-client/commit/166fccc73e53de6cfdbe41ea58dc593a2f5011f6#diff-05896d5a7f735a14ee8da5d12fbd24585862ca68efdf32b9401b3f4329d17c73))
|
||||
- AntiSpawnpoint
|
||||
- AntiVanish
|
||||
@@ -55,7 +55,7 @@ An addon to Meteor Client that adds modules and commands that were too useless t
|
||||
- SkeletonESP (Ported from [JexClient](https://github.com/DustinRepo/JexClient-main/blob/main/src/main/java/me/dustin/jex/feature/mod/impl/render/Skeletons.java))
|
||||
- SoundLocator
|
||||
|
||||
**Modifications**
|
||||
### Modifications
|
||||
- NoRender
|
||||
- `noCommandSuggestions` (Taken from an [unmerged PR](https://github.com/MeteorDevelopment/meteor-client/pull/1347))
|
||||
- Flight
|
||||
@@ -70,7 +70,7 @@ An addon to Meteor Client that adds modules and commands that were too useless t
|
||||
- `.teleport`
|
||||
- `.terrain-export` (Ported from [BleachHack](https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.17/src/main/java/bleach/hack/command/commands/CmdTerrain.java))
|
||||
|
||||
**Modifications**
|
||||
### Modifications
|
||||
- `.server`
|
||||
- `ports` (Ported from [Cornos](https://github.com/cornos/Cornos/blob/master/src/main/java/me/zeroX150/cornos/features/command/impl/Scan.java))
|
||||
- `.locate`
|
||||
@@ -84,3 +84,7 @@ An addon to Meteor Client that adds modules and commands that were too useless t
|
||||
## HUD
|
||||
- Apple, Exp & Crystal HUD (Taken from an [unmerged PR](https://github.com/MeteorDevelopment/meteor-client/pull/757))
|
||||
- CPS HUD (Ported from [AuroraKeystrokes](https://github.com/LambdAurora/AuroraKeystrokes/tree/1.16/src/main/java/me/lambdaurora/keystrokes))
|
||||
|
||||
## Config
|
||||
- `Http Allowed` - modify what http requests can be made with Meteor's http api
|
||||
- `Hidden Modules` - hide modules from module gui. **requires restart when unhiding**
|
||||
@@ -3,7 +3,15 @@ package cloudburst.rejects.mixin.meteor;
|
||||
import cloudburst.rejects.utils.RejectsConfig;
|
||||
import meteordevelopment.meteorclient.gui.tabs.builtin.ConfigTab;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ConfigTab.class)
|
||||
public class ConfigTabMixin {
|
||||
@@ -20,4 +28,19 @@ public class ConfigTabMixin {
|
||||
.onChanged(v -> RejectsConfig.get().httpAllowed = v)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<List<Module>> hiddenModules = sgRejects.add(new ModuleListSetting.Builder()
|
||||
.name("hidden-modules")
|
||||
.description("Which modules to hide.")
|
||||
.defaultValue(Arrays.asList())
|
||||
.defaultValue(RejectsConfig.get().getHiddenModules())
|
||||
.onChanged(v -> RejectsConfig.get().setHiddenModules(v))
|
||||
.build()
|
||||
);
|
||||
|
||||
// No idea why CallbackInfoReturnable, but fabric crashes otherwise lol
|
||||
@Inject(method = "createScreen", at=@At("HEAD"), remap = false)
|
||||
private void onCreateScreen(CallbackInfoReturnable<?> cir) {
|
||||
hiddenModules.set(RejectsConfig.get().getHiddenModules());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package cloudburst.rejects.mixin.meteor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import cloudburst.rejects.utils.RejectsConfig;
|
||||
import meteordevelopment.meteorclient.systems.modules.Category;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
|
||||
@Mixin(Modules.class)
|
||||
public class ModulesMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private Map<Category, List<Module>> groups;
|
||||
|
||||
@Inject(method = "getGroup", at=@At("HEAD"), cancellable = true, remap = false)
|
||||
private void onGetGroup(Category category, CallbackInfoReturnable<List<Module>> cir) {
|
||||
Set<String> hiddenModules = RejectsConfig.get().hiddenModules;
|
||||
if (hiddenModules.isEmpty()) return;
|
||||
|
||||
List<Module> foundModules = groups.computeIfAbsent(category, category1 -> new ArrayList<>());
|
||||
foundModules.removeIf(m -> hiddenModules.contains(m.name));
|
||||
|
||||
cir.setReturnValue(foundModules);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,20 @@
|
||||
package cloudburst.rejects.utils;
|
||||
|
||||
import meteordevelopment.meteorclient.systems.System;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
|
||||
public class RejectsConfig extends System<RejectsConfig> {
|
||||
private static final RejectsConfig INSTANCE = new RejectsConfig();
|
||||
@@ -15,6 +27,7 @@ public class RejectsConfig extends System<RejectsConfig> {
|
||||
}
|
||||
|
||||
public HttpAllowed httpAllowed = HttpAllowed.Everything;
|
||||
public Set<String> hiddenModules = new HashSet<String>();
|
||||
|
||||
public RejectsConfig() {
|
||||
super("rejects-config");
|
||||
@@ -26,16 +39,40 @@ public class RejectsConfig extends System<RejectsConfig> {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void setHiddenModules(List<Module> newList) {
|
||||
for (Module module : newList) {
|
||||
if (module.isActive()) module.toggle();
|
||||
hiddenModules.add(module.name);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Module> getHiddenModules() {
|
||||
Modules modules = Modules.get();
|
||||
if (modules == null) return Arrays.asList();
|
||||
return hiddenModules.stream().map(modules::get).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtCompound toTag() {
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putString("httpAllowed", httpAllowed.toString());
|
||||
|
||||
NbtList modulesTag = new NbtList();
|
||||
for (String module : hiddenModules) modulesTag.add(NbtString.of(module));
|
||||
tag.put("hiddenModules", modulesTag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RejectsConfig fromTag(NbtCompound tag) {
|
||||
httpAllowed = HttpAllowed.valueOf(tag.getString("httpAllowed"));
|
||||
|
||||
NbtList valueTag = tag.getList("hiddenModules", 8);
|
||||
for (NbtElement tagI : valueTag) {
|
||||
hiddenModules.add(tagI.asString());
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"CommandsMixin",
|
||||
"ConfigTabMixin",
|
||||
"GuiRendererAccessor",
|
||||
"HttpMixin"
|
||||
"HttpMixin",
|
||||
"ModulesMixin"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user