Back to mods
SimpleModconfigPatch project artwork

Vintage Story Mod DB · Vintage Story mod

SimpleModconfigPatch

Simple modconfig patch Allows any dependant mod to easily json patch your mod config. They don't need to depend on this mod. Neither do you if you copy and paste a little bit of code. But it can still be used as a normal dependency as well. You can copy this

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which SimpleModconfigPatch release should I use?

Updated 3 months ago
Latest stable file 1.0.0
Game version 1.22.0
Loader Built-in Vintage Story mod system

SimpleModconfigPatch 1.0.0 targets 1.22.0. It must be installed on the client. Installation on the dedicated server is optional. No extra mods listed for this file.

Where it goes

Is SimpleModconfigPatch required on the client, server, or both?

It must be installed on the client. Installation on the dedicated server is optional.

Client Required
Dedicated server Optional
Loader for this release Built-in Vintage Story mod system
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

This release supports both sides, but the source does not require it on the server.

What else does SimpleModconfigPatch 1.0.0 need?

1.0.0. Change the file and its required mods may change too.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add SimpleModconfigPatch without breaking your instance.

Built for SimpleModconfigPatch 1.0.0. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use 1.0.0. It targets 1.22.0; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    It must be installed on the client. Installation on the dedicated server is optional.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside 1.0.0. It opens that exact file at the source.

About this project

What does SimpleModconfigPatch add?

Simple modconfig patch

Allows any dependant mod to easily json patch your mod config. They don't need to depend on this mod. Neither do you if you copy and paste a little bit of code. But it can still be used as a normal dependency as well.

You can copy this to your solution and just call it after you load your modconfig. 

NEEDS TO BE CALLED IN AssetsLoaded(ICoreApi api) in your ModSystem.

 

public static T PatchModConfig<T>(ICoreAPI api, T originalModConfig, string modConfigPatchFilePath)
{
    var modInfoPatchAsset = new AssetLocation(modConfigPatchFilePath);
    if (originalModConfig is null || modInfoPatchAsset is null)
    {
        return originalModConfig;
    }

    IAsset asset = api.Assets.TryGet(modInfoPatchAsset);
    if (asset is null)
    {
        return originalModConfig;
    }

    var modInfoPatch = asset.ToText();
    if (modInfoPatch is null)
    {
        return originalModConfig;
    }

    JsonConvert.PopulateObject(modInfoPatch, originalModConfig);

    return originalModConfig;
}

 

Then call like this:

try
{
    var fileName = $"{nameof(ModConfig)}.json";
    var loadedConfig = api.LoadModConfig<ModConfig>(fileName) ?? new ModConfig();
    loadedConfig = ModConfigPatcher.PatchModConfig(api, loadedConfig, "yourmodid:config/override/config.json");
    Config = loadedConfig;

    api.StoreModConfig(Config, fileName);
}
catch (Exception e)
{
    Mod.Logger.Error(e);
}

Project description from Vintage Story Mod DB.

Pick your setup

SimpleModconfigPatch releases for each Vintage Story version.

Choose the version and loader you play, then open the matching release.

1 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

SimpleModconfigPatch versions and loaders

1 of 1 releases match

Looking for an older file? The official Vintage Story Mod DB project page is in Resources.