AHilyard / ItemBorders

A mod for Minecraft that shows colored borders around items to indicate their rarity.
Other
12 stars 1 forks source link

Keeps regenerating "broken" config #6

Open artemisSystem opened 1 year ago

artemisSystem commented 1 year ago

I constantly get this warning in the log: "Configuration file <my_instance>/config/itemborders-common.toml is not correct. Correcting"

But the "correcting" doesn't actually do anything, and ends up spitting out another config file that's exactly the same and still broken, according to the mod. This ends up both spamming the log, and generating 5 backup config files.

image

This also keeps happening if i delete all the junk configs.

I am on macOS. if this does not happen on windows i suspect it's related to / vs \ file separators.

MoupiPics commented 9 months ago

macOS user as well, polluting the log files at the same time causing high quanity mod debugging extremely difficult

murphy-slaw commented 6 months ago

I think I figured this out!

The default config does not include a key for [client.options.manual_borders].

So when ForgeConfigApiPortConfig.loadFrom() calls NightConfig's ConfigSpec.isCorrect(), it thinks the config is invalid due to a missing key. Then it tries ConfigSpec.correct(), but manual_borders has no default value, so it leaves the config unchanged, and saves it. Then it tries to load it again, and the same thing happens, over and over again.

This doesn't occur if the config has a value for manual_borders.

Perhaps add a default value for manual borders like this?

[client.options.manual_borders]
            red = []

Which does nothing because there are no selectors, but does satisfy the config validator that the key exists.

(#25 and #9 are duplicates of this issue)

sternschnaube commented 6 months ago

Thanks for this simple solution @murphy-slaw 😄