Mrbysco / Spoiled

Spoiling the end of your food supply since 2020
https://www.curseforge.com/minecraft/mc-mods/spoiled
MIT License
7 stars 5 forks source link

[Bug]: Config resets after restart #37

Closed xyxt1c closed 1 year ago

xyxt1c commented 1 year ago

General Info

Forge version

Fabric Loader 0.14.21, Fabric API tested on v0.85 and 0.86

Minecraft version

1.20.1

Mod version

Spoiled-fabric-1.20.1-2.0.0

Java version

graalvm-ee-java17-22.3.1

Issue Description

When editing the config ingame via ModMenu the changes are set to default after restarting minecraft. When editing the config file directly the first startup if fine, then after a restart the config resets.

I use a fair bit of mods so I'll have to test a bit more on a separated instance, but since there are no config related mods involved I think it's most likely a bug in Spoiled.

I only add the fridge of cookingforblockheads and edit the spoil timers (via file since the sliders ingame are bugged, maybe just a missing max Int)

Spoiled sliders

Additional Information

No response

xyxt1c commented 1 year ago

I also noticed, at the very first clean start the config file looks like this:

[client] showPercentage = false

But after editing an option ingame the client settings getting removed in the file (and generally don't show up in ModMenu):

[general] containerModifier = ["minecraft:shulker_box,0"] spoilRate = 30 initializeSpoiling = true mergeSpoilingFood = true spoilEverything = true spoilBlacklist = ["minecraft:rotten_flesh", "minecraft:enchanted_golden_apple"] defaultSpoilTime = 40 defaultSpoilItem = "minecraft:rotten_flesh"

xyxt1c commented 1 year ago

Okay tested it on a minimal install (only libs, sodium). It's somehow realated with the config processing/initialisation. Everytime when starting minecraft, the config file spoiled.toml resets to

[client] showPercentage = false

during initialisation, but the ingame values from before the last restart (like containerModifier) are kept within ModMenu. Changing any value there again overwrites the client config like in my comment above.

Seems like the [general] part of the config is getting read (client values don't) and then completely overwritten by default [client]-options during initialisation, and ingame changes overwrite with only [general] values.

Suggested fix: fixing the processing of spoiled.toml or separate the client and general configs into separate files.

Mrbysco commented 1 year ago

I had forgotten to change the name the client config file uses so they were both fighting over the same toml file

Mrbysco commented 1 year ago

A new version is being uploaded that fixes the issue