Here's my code:
public TitleChanger() {
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, TConfig.COMMON_CONFIG,"TitleChanger.toml");
try {TitleIcon.createFolders();}
catch (IOException e) {throw new RuntimeException(e);}
random = new Random().nextInt(TConfig.RandomMax.get());
date = new Date();
if(TConfig.isGetSentencesFromHitokoto.get()){
Sentence = getSentenceFromHitokoto();
}else{
Sentence = getSentence();
}
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (a, b) -> true));
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
LOGGER.info("TitleChanger is loaded!");
}
When I run the client,it throws:
Caused by: java.lang.IllegalStateException: Cannot get config value before config is loaded.
Who can help me?