AntMCDev / MCSkyblock

The Official MCSkyblock repository
MIT License
6 stars 2 forks source link

Forge: can not save config file #71

Closed JosephMillsAtWork closed 1 year ago

JosephMillsAtWork commented 1 year ago

Branch develop-1.19-crossplatform Platform Forge

When testing a mixin for icebergs on the new platforms. I noticed that the icebergs did not generate even though I set to true. Something is not saving the data nor changing the values even for runtime. I am not sure if this effects fabric.

JosephMillsAtWork commented 1 year ago

More digging shows that it is not the save of the file but the

Config.INSTANCE

that is not getting updated when changing the values

JosephMillsAtWork commented 1 year ago

image

JosephMillsAtWork commented 1 year ago
            Config.INSTANCE.updateToPreset();

is what is causing this. It is updating to defaults in the call. Conifig,INSTANCE just gets reset at this point.


Config.save()

After changing the preset all is fine and it saves correctly. We need a better way to disable the presets if the user changes the settings. (change to Custom or something of the sort)

AntMCDev commented 1 year ago

Yeah, can do - quickest way would be to serialize the config to bytes - and compare to the INSTANCE bytes, and if there's a mismatch, assume there's a change, set the preset to Custom and then let it continue with it's logic

AntMCDev commented 1 year ago

Should just be a couple of lines tops

JosephMillsAtWork commented 1 year ago

Or if we could just disable the tabs somehow if preset is not custom

AntMCDev commented 1 year ago

Probably more intuitive to have it update to custom. If they change properties, it's pretty much a given they want custom options

JosephMillsAtWork commented 1 year ago

I consider this to be closed. But that said lets add something. I mean I helped write the mod and didn't get the preset deal.