Skip to content

Registration

Lumii edited this page Nov 24, 2026 · 3 revisions

Overview

This page covers Citrine's Registrants and how to use them. Currently, Citrine has four registrants for Items, Sound Events, Item Groups, and Status Effects.

Package:

org.carpentry.citrine.api.registration

What is a Registrant?

A Registrant is a much easier way of registering things. All registrants generally work the same way.

Registrants don't require an initialization method, so any settings given to a registered object will automatically be applied.

Class registry example:

import org.carpentry.citrine.api.registration.ItemRegistrant;

public class TestItemRegistry {
    static ItemRegistrant ITEMS = new ItemRegistrant(TestMod.MOD_ID);
    // Creates a basic item with the given settings.
    public static final Item TEST = ITEMS.register("test", Item::new, new Item.Settings().maxCount(1));
    
    public static void init(){}
}

Interface registry example:

import org.carpentry.citrine.api.registration.ItemRegistrant;

public interface TestItemRegistry {
    ItemRegistant ITEMS = new ItemRegistrant(TestMod.MOD_ID);

    Item TEST = ITEMS.register("test", Item::new, new Item.Settings().maxCount(1));
    
    static void init(){}
}

All objects in a registry (using Registrants) will be automatically registered in the toRegister list, allowing easy usage of all objects in a registry.

TestItemRegistry.ITEMS.toRegister

Clone this wiki locally