fix: null ptr, activemodules, service
modManager must be set during ModManager initialization. moved that part into a separate method. Activemodules had the check inverted. Abstract classes cannot be loaded (and thus should not be annotated)
This commit is contained in:
parent
930ccf34c7
commit
f4889c1ce2
4 changed files with 4 additions and 4 deletions
|
@ -47,6 +47,7 @@ public class BoSCoVicino implements ICommons {
|
|||
CommandDispatcher<CommandSource> dp = this.dispatcher;
|
||||
|
||||
BoSCoVicino.modManager = new ModManager(cfg, dp);
|
||||
BoSCoVicino.modManager.load();
|
||||
|
||||
BoSCoVicino.spec = cfg.build();
|
||||
|
||||
|
|
|
@ -8,11 +8,8 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
|
||||
import ftbsc.bscv.BoSCoVicino;
|
||||
import ftbsc.bscv.api.ILoadable;
|
||||
import com.google.auto.service.AutoService;
|
||||
|
||||
// TODO rename
|
||||
@AutoService(ILoadable.class)
|
||||
public abstract class QuickModule extends AbstractModule {
|
||||
|
||||
public static final int UNBOUND = InputMappings.UNKNOWN.getValue();
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ActiveModules extends HudModule implements ICommons {
|
|||
if (event.getType() == ElementType.TEXT) {
|
||||
int offset = 0;
|
||||
for (IModule m : BoSCoVicino.modManager.mods) {
|
||||
if (m.isEnabled() && m.getGroup().equalsIgnoreCase("HUD")) {
|
||||
if (m.isEnabled() && !m.getGroup().equalsIgnoreCase("HUD")) {
|
||||
TextBuilder()
|
||||
.txt(String.format("%s <", m.getName()))
|
||||
.anchor(this.anchor.get())
|
||||
|
|
|
@ -23,7 +23,9 @@ public class ModManager {
|
|||
this.dispatcher = Optional.of(dispatcher);
|
||||
this.mods = new HashSet<>();
|
||||
this.categories = new HashSet<>();
|
||||
}
|
||||
|
||||
public void load() {
|
||||
for (ILoadable module : ServiceLoader.load(ILoadable.class)) {
|
||||
if(module instanceof IModule) {
|
||||
IModule mod = (IModule) module;
|
||||
|
|
Loading…
Reference in a new issue