-
Notifications
You must be signed in to change notification settings - Fork 0
Configurable API
Configurable provides an api for various other tasks
Inside your fabric.mod.json
you will need to add the following entrypoint:
"entrypoints": {
"configurable": [
"com.example.mod.YourModConfigurableApiImpl"
]
}
You will need to declare a service called com.bawnorton.configurable.api.ConfigurableApi
inside the META-INF/services/
directory.
The content of this file will need to be a reference to your ConfigurableApi
implementation(s):
com.example.mod.YourModConfigurableApiImpl
Registering additional type adapters may be desired for serialising and deserialising complex objects, such as Block
s. Implementing
getTypeAdapters()
allows you to provide additional type adapters to the internal serialiser.
You can modify the saved / loaded config by implementing beforeSave
or afterLoad
which both accept and return the generated config.
You can also apply datafixing to the config that is about to be loaded by implementing beforeLoad
You can override serverEnforces
to set the default value for all @Configurable
's serverEnforces
attribute.
Implementing defaultFieldNamingStrategy
allows you to change how field names map to keys by default
Configurable cannot tell which mod a service is provided from, thus, non-fabric users must implement getConfigName()
in their api impl and return the name of their config (Should be your modid on NeoForge)