public void LoadConfig() { if (sapi.LoadModConfig <PhysicsModConfig>("blockphysicsmod.json") == null) { SaveConfig(); return; } Config = sapi.LoadModConfig <PhysicsModConfig>("blockphysicsmod.json"); SaveConfig(); }
public void GetWorldConfig() { byte[] configBytes = (sapi.WorldManager.SaveGame.GetData("ImmersionWorldGen")); ImmersionWorldgenConfig storedConfig = null; if (configBytes != null) { storedConfig = JsonUtil.FromBytes <ImmersionWorldgenConfig>(configBytes); } string wPath = Path.Combine("immersion", "worldgen.json"); try { ImmersionWorldgenConfig config = sapi.LoadModConfig <ImmersionWorldgenConfig>(wPath); GenAquifers = genAquifers = config?.genAquifers ?? true; GenRivers = genRivers = config?.genRivers ?? true; GenPalms = genPalms = config?.genPalms ?? true; GenDeepOreBits = genDeepOreBits = config?.genDeepOreBits ?? true; } catch (Exception) { } sapi.StoreModConfig(this, wPath); GenAquifers = genAquifers = sapi.World.Config.TryGetBool("genAquifers") ?? storedConfig?.genAquifers ?? true; GenRivers = genRivers = sapi.World.Config.TryGetBool("genRivers") ?? storedConfig?.genRivers ?? true; GenPalms = genPalms = sapi.World.Config.TryGetBool("genPalms") ?? storedConfig?.genPalms ?? true; GenDeepOreBits = genDeepOreBits = sapi.World.Config.TryGetBool("genDeepOreBits") ?? storedConfig?.genDeepOreBits ?? true; SaveWorldConfig(); }
private static MeteorConfig LoadConfig(ICoreServerAPI api) { return(api.LoadModConfig <MeteorConfig>("MeteoricExpansionConfig.json")); }