config file load order

Started by TalkingScribe on

Topic category: Help with modding (Java Edition)

Last seen on 11:11, 12. Jul 2024
Joined May 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
config file load order

I'm trying to make a set of armor with increased knockback resistance that can be disabled in the config files. 

@Override
Public float getKnockbackResistance() {
	if (GildedSmithingConfigConfiguration.GRAVITYWELLRESIST.get()) {
		return 0.2f;
	} else {
		return 0f;
	}
}

This works with a simple If (true) or If (false), but crashes when I try to use the config variable, because the config hasn't loaded when it tries to register the items.

§7java.lang.IllegalStateException: Cannot get config value before config is loaded.

Is there a way to get the config to load earlier, or to change the properties of an item with a procedure?