Simple Config
⚪ Last updated 2024⚠️ Install Order · 2 steps
Install in this order, then this mod last — most mods fail to load without their framework and dependencies in place.
🖼️ Gallery (1 images)
🔍 Analysis
- 🏆 #782 of 909 fabric mods in this game by downloads
📋 About This Mod
# Simple Config Simple Config is a Kotlin Fabric Minecraft mod that allows you to easily manage your mod's configuration. It provides a simple and intuitive API to read and write configuration data. The data will be serialized with the `JSON`format. ## Usage Here's a basic example of how to use Simple Config: ``` kotlin object TutorialMod : ModInitializer { private val logger = LoggerFactory.getLogger("tutorialmod") override fun onInitialize() { //Access Data MyConfig.data.someNestedObject.someData MyConfig.data.someString // returns "hello" //write Data MyConfig.patch { someString = "Hello World!" someNumber = 0.07 } MyConfig.data.someString // returns "Hello World!" logger.info("Hello I am using Simple Config!") } } ``` When you write data using the `patch` method, it will automatically be written to the file. ### Command You can also reload your config with `/simpleconfig ` command or you can reload all Simple Config's with the `/simpleconfig all` command. ## Configuration To create a config, you need to create an `object` that extends `SimpleConfig<T>`. `T` can be any class as long as it has the `@Serializable` annotation. You must override `fileName`! Here's an example: ``` kotlin object MyConfig: SimpleConfig<SomeDataClass>(defaultValue = SomeDataClass()) { override var fileName = "tutorialmod_config" } @Serializable data class SomeDataClass( var someNumber: Double = 2.0, var someString: String = "hello", var someNestedObject: SomeNestedClass = SomeNestedClass() ) @Serializable class SomeNestedClass { var someData = LocalDate.parse("2024-01-01") } ``` Optional values you can override: | Options | Description | default | |--------------------------|------------------------------------------------|------------------------------------------------------| | fileEnding | The file extension that should be used | ".json" | | path | The path the config will be written to | FabricLoader.getInstance().configDir | | createReloadCommand | Should Simple Config register a reload command | true | | json | The Json settings used for the serialization | Json { prettyPrint = true; encodeDefaults = true } | ## Gradle Setup To set up Simple Config via Gradle, add the following to your `build.gradle` file: ``` gradle plugins { id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.22' } repositories { maven { url 'https://jitpack.io' } } dependencies { modImplementation 'com.github.JonasSeifried:SimpleConfig:1623553e8f' } ``` ## Troubleshooting If you encounter any issues while using Simple Config, please check the (https://github.com/JonasSeifried/SimpleConfig/issues) page. If your issue is not listed there, feel free to open a new issue. ## License Simple Config is licensed under the (https://github.com/JonasSeifried/SimpleConfig/blob/main/LICENSE).
# Simple Config
Simple Config is a Kotlin Fabric Minecraft mod that allows you to easily manage your mod's configuration. It provides a simple and intuitive API to read and write configuration data. The data will be serialized with the `JSON`format.
Here's a basic example of how to use Simple Config: ``` kotlin object TutorialMod : ModInitializer { private val logger = LoggerFactory.getLogger("tutorialmod")
override fun onInitialize() { //Access Data MyConfig.data.someNestedObject.someData MyConfig.data.someString // returns "hello" //write Data MyConfig.patch { someString = "Hello World!" someNumber = 0. 07 } MyConfig.data.someString // returns "Hello World!" logger.info("Hello I am using Simple Config!") } } ``` When you write data using the `patch` method, it will automatically be written to the file.
### Command
You can also reload your config with `/simpleconfig ` command or you can reload all Simple Config's with the `/simpleconfig all` command.
## Configuration
To create a config, you need to create an `object` that extends `SimpleConfig
Here's an example:
``` kotlin
object MyConfig: SimpleConfig
@Serializable data class SomeDataClass( var someNumber: Double = 2. 0, var someString: String = "hello", var someNestedObject: SomeNestedClass = SomeNestedClass() )
@Serializable class SomeNestedClass { var someData = LocalDate.parse("2024-01-01") } ``` Optional values you can override: | Options | Description | default | |--------------------------|------------------------------------------------|------------------------------------------------------| | fileEnding | The file extension that should be used | ".json" | | path | The path the config will be written to | FabricLoader.getInstance().configDir | | createReloadCommand | Should Simple Config register a reload command | true | | json | The Json settings used for the serialization | Json { prettyPrint = true; encodeDefaults = true } |
## Gradle Setup To set up Simple Config via Gradle, add the following to your `build.gradle` file: ``` gradle
plugins { [...] id 'org.jetbrains.kotlin.plugin.serialization' version '1. 9. 22' }
repositories { [...] maven { url 'https://jitpack.io' } }
dependencies { [...] modImplementation 'com.github. JonasSeifried:SimpleConfig:1623553e8f' } ```
## Troubleshooting If you encounter any issues while using Simple Config, please check the (https://github.com/JonasSeifried/SimpleConfig/issues) page. If your issue is not listed there, feel free to open a new issue.
## License Simple Config is licensed under the (https://github.com/JonasSeifried/SimpleConfig/blob/main/LICENSE).
📊 Mod Details
- Game
- Minecraft Mods
- Author
- Tondoa
- Version
- 1.0.0
- Downloads
- 248
- Endorsements
- 0
- Category
- fabric
- Created
- 2/19/2024
- Updated
- 2/9/2024
- Game Versions
- 1.20.4
- Tags
- utility
🔧 How to Install Minecraft Mods Mods
Download from Modrinth. Use Prism Launcher or drop into your mods folder.
📖 Full step-by-step install guide for Minecraft Mods →
Visit the official mod page for specific installation instructions for this mod.
🎮 Need cheat codes or console commands? Check ur gaming wiki for Minecraft Mods commands, item IDs, and more.
❓ Frequently Asked Questions
Which Minecraft Mods versions does Simple Config support?
The author lists 1.20.4. Other versions may work but are untested by the author.
What is the latest version of Simple Config?
Version 1.0.0, published 2024-02-09 with 248 downloads recorded at the source.
Keep browsing — more Minecraft Mods mods await
