Package commoble.databuddy.config

# Class ConfigHelper

java.lang.Object
commoble.databuddy.config.ConfigHelper

public class ConfigHelper extends Object
Config helper for automatically subscribing forge configs to config reload events as you build them. See DataBuddyExampleMod and ExampleServerConfig in the examplemod for usage examples.

Example mod on github

Example config class on github

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`ConfigHelper.ConfigObjectListener<T>`
A config-reload-sensitive wrapper around a config field for a complex object
`static class`
`ConfigHelper.ConfigValueListener<T>`
A config-reload-sensitive wrapper around your config value
`static class`
`ConfigHelper.Subscriber`
Subscriber instances are given to your config class's constructor
`static class`
`ConfigHelper.TomlConfigOps`

## Constructor Summary

Constructors
Constructor
Description
`ConfigHelper()`

## Method Summary

Modifier and Type
Method
Description
`static <T> T`
`register​(net.minecraftforge.fml.config.ModConfig.Type configType, BiFunction<net.minecraftforge.common.ForgeConfigSpec.Builder,​ConfigHelper.Subscriber,​T> configBuilder)`
As with the other register method, but the contexts are assumed
`static <T> T`
`register​(net.minecraftforge.fml.ModLoadingContext modContext, net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext fmlContext, net.minecraftforge.fml.config.ModConfig.Type configType, BiFunction<net.minecraftforge.common.ForgeConfigSpec.Builder,​ConfigHelper.Subscriber,​T> configBuilder)`
Call this in your @Mod class constructor.

### 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​(net.minecraftforge.fml.config.ModConfig.Type configType, BiFunction<net.minecraftforge.common.ForgeConfigSpec.Builder,​ConfigHelper.Subscriber,​T> configBuilder)
As with the other register method, but the contexts are assumed

Type Parameters:
  `T` - The class of your config implementation
Parameters:
  `configType` - Forge config type:
  - SERVER configs are defined by the server and synced to clients
  - 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
  `configBuilder` - Typically the constructor for your config class
Returns:
  An instance of your config class

### register

public static <T> T register​(net.minecraftforge.fml.ModLoadingContext modContext, net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext fmlContext, net.minecraftforge.fml.config.ModConfig.Type configType, BiFunction<net.minecraftforge.common.ForgeConfigSpec.Builder,​ConfigHelper.Subscriber,​T> configBuilder)
Call this in your @Mod class constructor.

Type Parameters:
  `T` - Your config class
Parameters:
  `modContext` - mod context from ModLoadingContext.get()
  `fmlContext` - mod context from FMLJavaModLoadingContext.get()
  `configType` - Forge config type:
  - SERVER configs are defined by the server and synced to clients
  - 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
  `configBuilder` - Typically the constructor for your config class
Returns:
  An instance of your config class