---
title: Registrar System
---

<Callout variant="warning">
Registrars are currently experimental. Stable release is expected by 0.7.0.
</Callout>

<Callout>
Added in Fzzy Config 0.5.9
</Callout>

A simple registration system built into [`PlatformApi`](Platform-Utilities) for cross-platform access to built-in or modded `Registry` objects.

### Registrar Pieces and Parts
The system is built out of two basic parts

#### <a target="_blank" rel="noopener" href="https://fzzyhmstrs.github.io/fconfig/-fzzy%20-config/me.fzzyhmstrs.fzzy_config.util.platform/-registrar/index.html">`Registrar` 🗗</a>
The registration manager object for a particular `Registry`. Game objects are registered into this, much like a `DeferredRegister` from a (Neo)Forge modding context.

#### <a target="_blank" rel="noopener" href="https://fzzyhmstrs.github.io/fconfig/-fzzy%20-config/me.fzzyhmstrs.fzzy_config.util.platform/-registry-supplier/index.html">`RegistrySupplier` 🗗</a>
The output object of a `Registrar`, this supplier performs all the basic registry-reference actions you should need

`RegistrySupplier` provides:
- `get()` - The registered object; it is a `Supplier<T>` of the object type.
- `getKey()` - The `RegistryKey` the object is registered with.
- `getId()` - The `Identifier` the object is registered with.
- `getEntry()` - The `RegistryEntry` that stores the object in the registry.

<Callout variant="info">
As of 0.6.5, RegistrySupplier is itself an instance of RegistryEntry.
</Callout>

### Creating a Registrar
Create a new Registrar using the `PlatformApi` accessed through the `ConfigApi`.

<CodeTabs>

```java !!tabs Java
Registrar<Item> myItemRegistrar = ConfigApiJava.platform().createRegistrar(MOD_ID, Registries.ITEM);
```

```kotlin !!tabs Kotlin
val myItemRegistrar: Registrar<Item> = ConfigApi.platform().createRegistrar(MOD_ID, Registries.ITEM)
```

</CodeTabs>

### Using the Registrar
Once you have a registrar, there are two primary activities you need to do with it.
1. `register()` objects to it
2. `init()` the registrar to link it to the mod loading system

<CodeTabs>

```java !!tabs Java
Registrar<Item> myItemRegistrar = ConfigApiJava.platform().createRegistrar(MOD_ID, Registries.ITEM);

public RegistrySupplier<Item> ITEM_1  = myItemRegistrar.register("item_1", () -> new Item1());

//mod initializer, in your mod entrypoint or related initializer
public void myCommonInit() {
    myItemRegistrar.init();
}
```

```kotlin !!tabs Kotlin
val myItemRegistrar: Registrar<Item> = ConfigApi.platform().createRegistrar(MOD_ID, Registries.ITEM)

val ITEM_1: RegistrySupplier<Item> = myItemRegistrar.register("item_1", Supplier { Item1() })

//mod initializer, in your mod entrypoint or related initializer
fun myCommonInit() {
    myItemRegistrar.init()
}
```

</CodeTabs>

### Load Order
Fzzy Config doesn't currently have the ability to strictly work with load orders, so keep this in mind if you need to register in a certain order relative to another mod. On Fabric, load orders aren't even a concept.