Closed Mantarri closed 4 years ago
You are using getConfigHolder before register
What could cause that though? I try to read the config in a Mixin to theregister
method inItems
, and I register the config in my Mod's onInitialize
, so the config should be registered before that Mixin is even loaded, if I understand how this works correctly.
Items register is done before mod init
Ah, that explains it. Is there some way to open the config at that point then? If I'm correct, I could just register it there, but I assume that doing it there isn't the best idea.
you could unify the get config method with register, with a boolean flag to know if it has been registered, if not, register it before getting the config object
When I try to read my config with
ModConfig config = AutoConfig.getConfigHolder(ModConfig.class).getConfig();
I get a crash when trying to start Minecraft log
I do register the config in my mod's
onInitialize
method.AutoConfig.register(ModConfig.class, Toml4jConfigSerializer::new);