-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
roidrole edited this page May 31, 2026
·
14 revisions
Allows access to other mods' config and creation of config files.
A class used to read a config file. It is recommended to save the file in a value if to be used again
importing class :
import mods.roidtweaker.forge.config.Reader;Only has a single method :
| Method | Description | Return Type |
|---|---|---|
| getConfigFile(String path) | gets or creates a config file, starting from the instance folder. If you want to target a file in the config folder, you must prepent config/. The file must end in .cfg |
IConfigFile |
| getConfig(String path) | exactly the same, but a different name | IConfigFile |
Gets the config file located in myPack/config/coolmod/type1.cfg
val file as IConfigFile = Reader.getConfigFile("config/coolmod/type1.cfg");The file in which the config is stored. It targets an actual file
importing class:
import mods.roidtweaker.forge.config.IConfigFile;All methods get a value from the config file. They all share the same parameters, with a few extra optional ones appended.
Here are the base parameters :
file.getString(category as string, name as string, @Optional defaultvalue as [Insert Return Type], @Optional comment as string)| Method | Return Type | Extra Optional Parameters |
|---|---|---|
| getBool | bool | none |
| getBoolean | bool | none |
| getString | string | none |
| getInt | int | min as int, max as int |
| getDouble | double | min as double, max as double |
| getLong | long | min as long, max as long |
| getBooleanArray | bool[] | isLengthFixed as bool, maxLength as int |
| getStringArray | string[] | isLengthFixed as bool, maxLength as int |
| getIntArray | int[] | min as int, max as int, isLengthFixed as bool, maxLength as int |
Here is what they mean :
| Parameter | Description |
|---|---|
| category | The category of the config you are looking for. Separate subcategories by .
|
| name | The name of the config option |
| ----- | Starting here, the parameters are all optional and may not be allowed on all types. They are only used when creating a config value |
| defaultValue | If there is no config option already, will set this one |
| comment | When creating a config option, the comment to use |
| min | Minimal value |
| max | Maximal value |
| isLengthFixed | Whether the array is required to be the default length |
| maxLength | Max length of the array |
nice_category{
subcat1{
#Useful Comment
name="Value we want to see"
}
subcat2{
}
}To access the value, you must call file.getString("nice_category.subcat1", "name")
To create the value, you must call file.getString("nice_category.subcat1", "name", "Value we want to see", "Useful Comment")