Module provider

This commit is contained in:
2026-03-06 23:27:44 +01:00
parent 718d993368
commit 081bf9bfef
2 changed files with 11 additions and 28 deletions
@@ -3,39 +3,18 @@ package org.saturnclient.modules;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.saturnclient.modules.mods.*;
public class ModManager { public class ModManager {
public static final List<Module> ENABLED_MODS = new ArrayList<>(); public static List<Module> ENABLED_MODS = new ArrayList<>();
public static final Module[] ALL_MODS = { public static Module[] 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 void init() { public static void init(ModuleProvider provider) {
// Pre-filter enabled modules to avoid checking every tick MODS = provider.getMods();
updateEnabledModules(); updateEnabledModules();
} }
public static synchronized void updateEnabledModules() { public static synchronized void updateEnabledModules() {
ENABLED_MODS.clear(); ENABLED_MODS.clear();
for (Module m : ALL_MODS) { for (Module m : MODS) {
if (m.isEnabled()) { if (m.isEnabled()) {
ENABLED_MODS.add(m); ENABLED_MODS.add(m);
} }
@@ -43,6 +22,10 @@ public class ModManager {
} }
public static Module[] getAllMods() { 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 Property<Boolean> enabled = Property.bool(false);
private static ModDimensions dimensions = new ModDimensions(40, 75); 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; private final ArmorDisplayInterface minecraft;