How settings are converted

The form a profile keeps your mod's settings in, the version record next to them, and the exact order mod version fixes and Minecraft fixes run in.

Last updated

On this page

One profile is shared by instances that run different versions of your mod and of Minecraft. Settings Saver keeps the profile's copy in one fixed form and converts with your fixes whenever settings go in or come out.

The profile's form#

The profile's copy of your settings is always in:

A file in an instance is in the running mod version's format, on that instance's Minecraft version.

The version record#

Next to your files, the profile has a module.txt:

profiles/default/mymod/module.txt
modVersion:2.1.0
dataVersion:<the newest Minecraft DataVersion Settings Saver knows>

It records which mod version and which Minecraft DataVersion the copy was saved in. Settings Saver writes it with every save. Without a record (files copied in by hand), the settings count as saved by the running version.

The three conversions#

Reading the profile#

profile's copy
   |  mod version fixes: upgrade, from the recorded mod version to the running one
   v
   |  Minecraft fixes: upgrade, from the recorded DataVersion to the newest
   v
settings in the profile's form

Normally only the first step does anything: the copy was saved by an older version of your mod.

Writing into an instance (restore, Load)#

settings in the profile's form
   |  Minecraft fixes: downgrade, from the newest version to the instance's
   v
instance file

Only fixes newer than the instance's Minecraft version are downgraded through. An instance on the newest version gets the settings unchanged.

Reading an instance file (Save, auto sync)#

instance file
   |  Minecraft fixes: upgrade, from the instance's version to the newest
   v
settings in the profile's form  -->  compared with the profile, changed keys saved

The order of fixes#

Rule
Between kinds For one file, mod version fixes run before Minecraft fixes.
Mod version fixes Sorted by version, compared like semantic versions. Oldest first when upgrading.
Minecraft fixes Sorted by DataVersion. Oldest first when upgrading, newest first when downgrading.
Same version In the order they were added when upgrading, in reverse when downgrading.
Which ones run Those after the "from" version, up to and including the "to" version.

A worked example#

My Mod 3.1.0 registers these fixes. Version 1.4.0 already had the Minecraft fix:

.modVersionFix("2.0.0", SettingsFix.renameKey("renderDist", "renderDistance"))
.modVersionFix("3.0.0", new ZoomPercentFix())       // zoom 1.5 -> 150
.minecraftFix("1.13", new ZoomKeyFix())             // zoomKey 46 -> key.keyboard.c
Step What happens Settings
1. My Mod 1.4.0 on Minecraft 1.12.2 saves Minecraft fix upgrades the key code profile: renderDist=12, zoom=1.5, zoomKey=key.keyboard.c, record modVersion:1.4.0
2. My Mod 3.1.0 on Minecraft 26.3 starts a new instance mod fixes 2.0.0 and 3.0.0 upgrade; no Minecraft downgrade needed instance file: renderDistance=12, zoom=150, zoomKey=key.keyboard.c
3. The player changes zoom to 200 and saves only zoom changed; the record becomes modVersion:3.1.0 profile: renderDistance=12, zoom=200, zoomKey=key.keyboard.c
4. My Mod 3.1.0 on Minecraft 1.8.9 starts a new instance Minecraft fix downgrades the key name instance file: renderDistance=12, zoom=200, zoomKey=46

What older versions of your mod see#

Mod version fixes only go forward. Settings saved by a newer version of your mod are handed to an older version as they are, because the older version doesn't have the newer fixes.

Running Profile saved by Result
newer mod older mod upgraded through the fixes in between
same version same version unchanged
older mod newer mod taken as they are; the older mod must ignore keys and values it doesn't know

When an older version then saves into that profile, the record names the older version, and a newer version will run its fixes again over settings that are partly converted. That is why a fix must leave converted values alone. See Newer and older versions together.

What an older game can't express#

A downgrade may be lossy. That doesn't damage the profile: downgraded settings are only written into the older instance's file. When that instance saves, its settings are compared with the profile as that version sees it, so a value the old version could only approximate doesn't count as a change and is not written back.

Fixes run on partial maps#

Settings Saver doesn't only convert whole files. It also runs fixes over maps with just the keys a profile has saved, and over a file with one setting removed (to see which settings depend on it). So a fix must leave a map without its keys unchanged, and must give the same output for the same input every time.