VazkiiMods / Zeta

Modular Mod development framework
Other
17 stars 4 forks source link

[1.20.1] Modernfix makes zeta's defective config system not work completely #21

Open qznfbnj opened 1 month ago

qznfbnj commented 1 month ago

Background: Zeta's configuration system seems to be imperfect. When editing Quark configuration through the q button in the game, it will take effect immediately, but an error will appear in the log. For information about the error, refer to https://github.com/VazkiiMods/Zeta/issues/3)

I found that when using the latest Modernfix, the in-game Quark configuration changes are invalid. Of course, the error in the log also disappears. Modernfix-5.5.0: Quark configuration can be reloaded Modernfix-5.6.0-5.14.0: Quark configuration can still be reloaded by executing /mf(s)rc manually Modernfix-5.15.0-5.17.0: Quark configuration cannot be reloaded even with /mf(s)rc (even if all features of Modernfix are disabled)

Then I asked in TauMC discord server and get response:

That sounds like Zeta is relying on saving the config file and then hoping it automatically reloads, rather than actually changing the config values in memory

ModernFix only controls watching the config file on disk, it shouldn't break any attempts to modify the config from the game itself, unless mods are doing weird things

Then I attach these information to #3 mentioned above, and get response:

That seems like a different problem btw

quat1024 commented 1 month ago

Could maybe be related to this crummy hack in the code that listens to ConfigChangedEvent?

https://github.com/VazkiiMods/Zeta/blob/d28024d28bd54e006eaa879b6455aba999fe5d0f/src/main/java/org/violetmoon/zetaimplforge/config/ConfigEventDispatcher.java#L9-L22

When you close the config GUI we call ForgeConfigSpec.ConfigValue.set a bunch of times in a row to commit all the changes, and I guess we wanted to ignore the event if it got fired midway through commiting those changes. Surely there is a more elegant way.