Data components can be registered using a BalmDataComponentTypeRegistrar.
public class ModDataComponents {
public static Holder<DataComponentType<Unit>> yourDataComponent;
public static void initialize(BalmDataComponentTypeRegistrar dataComponentTypes) {
yourDataComponent = dataComponentTypes.register("your_data_component", Codec.unit(Unit.INSTANCE)).asHolder();
}
}
You can obtain a BalmDataComponentTypeRegistrar either through Balm.dataComponentTypes(MOD_ID, ModDataComponents::initialize) or by registering your mod as a BalmModule.
public class YourMod {
public static void initialize() {
Balm.dataComponentTypes(MOD_ID, ModDataComponents::initialize);
}
}
BalmModulepublic class YourMod implements BalmModule {
@Override
public void registerDataComponents(BalmDataComponentTypeRegistrar dataComponentTypes) {
ModDataComponents.initialize(dataComponentTypes);
}
}