Package commoble.morered.util

# Class ConfigHelper

java.lang.Object
commoble.morered.util.ConfigHelper

public class ConfigHelper extends Object
Helper for creating configs and defining complex objects in configs

## Constructor Summary

Constructors
Constructor
Description
`ConfigHelper()`

## Method Summary

Modifier and Type
Method
Description
`static <T> T`
`register(String modid, net.neoforged.fml.config.ModConfig.Type configType, Function<net.neoforged.neoforge.common.ModConfigSpec.Builder,T> configFactory)`
Register a config using a default config filename for your mod.
`static <T> T`
`register(String modid, net.neoforged.fml.config.ModConfig.Type configType, Function<net.neoforged.neoforge.common.ModConfigSpec.Builder,T> configFactory, String configName)`
Register a config using a custom filename.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ConfigHelper

public ConfigHelper()

## Method Details

### register

public static <T> T register(String modid, net.neoforged.fml.config.ModConfig.Type configType, Function<net.neoforged.neoforge.common.ModConfigSpec.Builder,T> configFactory)
Register a config using a default config filename for your mod.

Type Parameters:
  `T` - The class of your config implementation
Parameters:
  `modid` - String of your modid
  `configType` - Forge config type:
  - SERVER configs are defined by the server and synced to clients; individual configs are generated per-save. Filename will be modid-server.toml
  - COMMON configs are definable by both server and clients and not synced (they may have different values). Filename will be modid-client.toml
  - CLIENT configs are defined by clients and not used on the server. Filename will be modid-client.toml.
  `configFactory` - A constructor or factory for your config class
Returns:
  An instance of your config class

### register

public static <T> T register(String modid, net.neoforged.fml.config.ModConfig.Type configType, Function<net.neoforged.neoforge.common.ModConfigSpec.Builder,T> configFactory, @Nullable String configName)
Register a config using a custom filename.

Type Parameters:
  `T` - Your config class
Parameters:
  `modid` - String of your modid
  `configType` - Forge config type:
  - SERVER configs are defined by the server and synced to clients; individual configs are generated per-save.
  - COMMON configs are definable by both server and clients and not synced (they may have different values)
  - CLIENT configs are defined by clients and not used on the server
  `configFactory` - A constructor or factory for your config class
  `configName` - Name of your config file. Supports subfolders, e.g. "yourmod/yourconfig".
Returns:
  An instance of your config class