Module provider
This commit is contained in:
@@ -3,39 +3,18 @@ package org.saturnclient.modules;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.saturnclient.modules.mods.*;
|
||||
|
||||
public class ModManager {
|
||||
public static final List<Module> ENABLED_MODS = new ArrayList<>();
|
||||
public static final Module[] ALL_MODS = {
|
||||
// new Crosshair(),
|
||||
// new AutoSprint(),
|
||||
new ArmorDisplay(),
|
||||
// new Fps(),
|
||||
// new StatusEffects(),
|
||||
// new Coordinates(),
|
||||
// new Freelook(),
|
||||
// new Keystrokes(),
|
||||
// new Fullbright(),
|
||||
// new NoFog(),
|
||||
// new DayCounter(),
|
||||
// new Speedometer(),
|
||||
// new Zoom(),
|
||||
// new HealthDisplay(),
|
||||
// new Nametags(),
|
||||
// new Ping(),
|
||||
// new Tps(),
|
||||
// new Clock()
|
||||
};
|
||||
public static List<Module> ENABLED_MODS = new ArrayList<>();
|
||||
public static Module[] MODS = {};
|
||||
|
||||
public static void init() {
|
||||
// Pre-filter enabled modules to avoid checking every tick
|
||||
public static void init(ModuleProvider provider) {
|
||||
MODS = provider.getMods();
|
||||
updateEnabledModules();
|
||||
}
|
||||
|
||||
public static synchronized void updateEnabledModules() {
|
||||
ENABLED_MODS.clear();
|
||||
for (Module m : ALL_MODS) {
|
||||
for (Module m : MODS) {
|
||||
if (m.isEnabled()) {
|
||||
ENABLED_MODS.add(m);
|
||||
}
|
||||
@@ -43,6 +22,10 @@ public class ModManager {
|
||||
}
|
||||
|
||||
public static Module[] getAllMods() {
|
||||
return ALL_MODS;
|
||||
return MODS;
|
||||
}
|
||||
|
||||
public interface ModuleProvider {
|
||||
Module[] getMods();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ArmorDisplay extends Module implements HudMod {
|
||||
|
||||
private static Property<Boolean> enabled = Property.bool(false);
|
||||
private static ModDimensions dimensions = new ModDimensions(40, 75);
|
||||
private static Property<Boolean> useMainHand = Property.bool(false);
|
||||
private static Property<Boolean> useMainHand = Property.bool(true);
|
||||
|
||||
private final ArmorDisplayInterface minecraft;
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.saturnclient.impl;
|
||||
|
||||
import org.saturnclient.impl.modules.ArmorDisplayFabric;
|
||||
import org.saturnclient.modules.Module;
|
||||
import org.saturnclient.modules.ModManager.ModuleProvider;
|
||||
import org.saturnclient.modules.mods.*;
|
||||
|
||||
public class FabricModuleProvider implements ModuleProvider {
|
||||
public static Module[] MODS = {
|
||||
new ArmorDisplay(new ArmorDisplayFabric())
|
||||
};
|
||||
|
||||
@Override
|
||||
public Module[] getMods() {
|
||||
return MODS;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.saturnclient.cosmetics.Emotes;
|
||||
import org.saturnclient.cosmetics.cloak.Cloaks;
|
||||
import org.saturnclient.cosmetics.hat.Hats;
|
||||
import org.saturnclient.impl.FabricModuleProvider;
|
||||
import org.saturnclient.impl.SaturnClientProvider;
|
||||
import org.saturnclient.modules.ModManager;
|
||||
import org.saturnclient.saturnclient.client.ServiceClient;
|
||||
@@ -48,7 +49,7 @@ public class SaturnClient implements ModInitializer {
|
||||
ElementRenderer.INSTANCE = new ElementRendererImpl();
|
||||
|
||||
Config.init();
|
||||
ModManager.init();
|
||||
ModManager.init(new FabricModuleProvider());
|
||||
|
||||
client.execute(() -> {
|
||||
SaturnScreen.preload(client);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ModMenu extends SaturnScreen {
|
||||
|
||||
AnimationStagger moduleStagger = new AnimationStagger(AnimationConfig.modMenu);
|
||||
|
||||
for (Module mod : ModManager.ALL_MODS) {
|
||||
for (Module mod : ModManager.MODS) {
|
||||
moduleStagger.draw(
|
||||
new SaturnModule(mod)
|
||||
.position((160 + g) * col, (50 + g) * row)
|
||||
|
||||
Reference in New Issue
Block a user