-
Notifications
You must be signed in to change notification settings - Fork 5
Extensions
CompleteConfig provides a powerful extension system to support more types, add additional annotations or even implement custom features. To use an extension, subclass the proper extension interface.
DataExtension will be applied in both client and server environment, while the other ones will only be applied in their respective environment.
| Method | Description |
|---|---|
getTypeSerializers |
Registers global type serializers. |
getTransformations |
Registers global entry transformations. |
This extensions will only be applied when the associated module and library is installed.
| Method | Description |
|---|---|
getProviders |
Registers global GUI providers. |
To register extensions, create a class that implements CompleteConfigExtender:
public class MyCompleteConfigExtender implements CompleteConfigExtender {
@Override
public Collection<Class<? extends Extension>> getExtensions() {
return List.of(MyDataExtension.class, MyClothConfigGuiExtension.class);
}
}Now add the completeconfig-extender entrypoint to your fabric.mod.json and add the path to your created extender class:
"entrypoints": {
"completeconfig-extender": [
"path.to.MyCompleteConfigExtender"
]
}Every extension type has a children method which can be overriden to register child extensions. Only valid child extensions will be registered at runtime.
public final class MyDataExtension implements DataExtension {
@Override
public Set<Class<? extends Extension>> children() {
return Set.of(MyClientDataExtension.class, MyServerDataExtension.class);
}
}