Modding:ModConfig
This page was last verified for Vintage Story version 1.15.
The game provides the following convenience methods for saving and loading mod configuration data by serializing the data into JSON format.
StoreModConfig()
will save your mod's configuration file to the Vintage Story app data folder within a "ModConfig" subdirectory. LoadModConfig
will load the same file from that directory back into the data structure class you've defined. You can use standard JSON.NET features, such as using the [JsonIgnore]
attribute for certain fields or properties that you do not wish to be serialized to file.
/// <summary>
/// Milo kept asking for a standardized way to load and store mod configuration data, so here you go :P
/// For T just make a class with all fields public - this is your configuration class. Be sure to set useful default values for your settings
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="jsonSerializeableData"></param>
/// <param name="filename"></param>
void StoreModConfig<T>(T jsonSerializeableData, string filename);
/// <summary>
/// Milo kept asking for a standardized way to load and store mod configuration data, so here you go :P
/// Recommendation: Surround this call with a try/catch in case the user made a typo while changing the configuration
/// Returns null if the file does not exist
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="filename"></param>
/// <returns></returns>
T LoadModConfig<T>(string filename);
Code Modding | |||||||
---|---|---|---|---|---|---|---|
Basics | Code Mods • Preparing For Code Mods • Creating A Code Mod | ||||||
Tutorials |
|
||||||
Advanced | Server-Client Considerations • Setting up your Development Environment • Advanced Blocks • Advanced Items • Block and Item Interactions • Block Behavior • Block Entity • Particle Effects • World Access • Inventory Handling • Commands • GUIs • Network API • Monkey patching (Harmony) | ||||||
Data Management | VCDBS format • Savegame Moddata • ModConfig File • Chunk Moddata • Serialization Formats • TreeAttribute | ||||||
Worldgen | WorldGen API • NatFloat • EvolvingNatFloat | ||||||
Rendering | Shaders and Renderers |
Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.
Modding | |
---|---|
Modding Introduction | Getting Started • Theme Pack |
Content Modding | Content Mods • Developing a Content Mod • Basic Tutorials • Intermediate Tutorials • Advanced Tutorials • Content Mod Concepts |
Code Modding | Code Mods • Setting up your Development Environment |
Property Overview | Item • Entity • Entity Behaviors • Block • Block Behaviors • Block Classes • Block Entities • Block Entity Behaviors • Collectible Behaviors • World properties |
Workflows & Infrastructure | Modding Efficiency Tips • Mod-engine compatibility • Mod Extensibility • VS Engine |
Additional Resources | Community Resources • Modding API Updates • Programming Languages • List of server commands • List of client commands • Client startup parameters • Server startup parameters Example Mods • API Docs • GitHub Repository |