Skip to content

CreativeTabRegistryHelper

open class CreativeTabRegistryHelper<T : CreativeModeTab>(modId: String) : RegistryHelper<T> 

A RegistryHelper specialised for CreativeModeTab registration via Architectury's CreativeTabRegistry.

Example

object MyTabs : CreativeTabRegistryHelper<CreativeModeTab>(modId) {
    val MY_TAB by create("my_tab") {
        title(Component.translatable("itemGroup.mymod.my_tab"))
        icon { ItemStack(MyBlocks.MY_BLOCK) }
        displayItems { _, output ->
            output.accept(MyBlocks.MY_BLOCK)
        }
    }
}

// In mod init:
MyTabs.init()

Parameters

  • T: The creative tab type; must extend CreativeModeTab.

  • modId: The mod ID used as the namespace for registered entries.

Constructors

CreativeTabRegistryHelper

constructor(modId: String)

Parameters

  • T: The creative tab type; must extend CreativeModeTab.

  • modId: The mod ID used as the namespace for registered entries.

Properties

registry

val registry: DeferredRegister<T>

Functions

create

open fun <V : T> create(id: String, block: CreativeModeTab.Builder.() -> Unit): RegistrySupplier<V>

Registers a new CreativeModeTab using an Architectury CreativeTabRegistry builder.

Return

A RegistrySupplier for the registered creative tab.

Parameters

  • id: The registry name of the creative tab.

  • block: A builder lambda applied to CreativeModeTab.Builder to configure the tab.

getValue

operator fun <V : T> RegistrySupplier<V>.getValue(any: Any?, property: KProperty<*>): V

Kotlin property delegate operator that unwraps a RegistrySupplier to its concrete value.

This enables the idiomatic val MY_ENTRY by register(...) pattern.

init

open fun init()

Registers this helper's DeferredRegister with the game's registry system.

Must be called once during mod initialization.

register

open fun <V : T> register(id: String, supplier: () -> V): RegistrySupplier<V>

Registers a new entry and returns a RegistrySupplier for lazy access.

Return

A RegistrySupplier wrapping the registered entry.

Parameters

  • id: The entry's registry name (without namespace). The mod namespace is prepended automatically.

  • supplier: Factory producing the entry. Must not cache the returned instance.

open fun <V : T> register(id: ResourceLocation, supplier: () -> V): RegistrySupplier<V>

Registers a new entry using a fully-qualified ResourceLocation and returns a RegistrySupplier.

Return

A RegistrySupplier wrapping the registered entry.

Parameters

  • id: The fully-qualified ResourceLocation for the entry.

  • supplier: Factory producing the entry. Must not cache the returned instance.