Amalgamation Wiki
Fabric + NeoForge
Library · Fabric & NeoForge

Custom Creative Mode Tabs

This cannot be explained in a simple form, so you will have to refer to the examples below. Each one shows how to make a colored section and a textured section.

Setup Tabs

package com.example.examplemod.init;

import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Items;
import org.mythic_goose.amalgamation.library.creative_tab_v1.CreativeTabRegistrar;
import org.mythic_goose.amalgamation.library.creative_tab_v1.SectionStyle;
import org.mythic_goose.amalgamation.library.creative_tab_v1.SectionTabBuilder;
import com.example.examplemod.ExampleMod;

import java.util.function.Supplier;

public class ExampleCreativeTabs {
    public static Supplier<CreativeModeTab> EXAMPLE_TAB;

    public static void init(CreativeTabRegistrar registrar) {
        EXAMPLE_TAB = registrar.register("example", ExampleCreativeTabs::buildTab);
    }

    private static CreativeModeTab buildTab() {
        SectionTabBuilder builder = SectionTabBuilder.create(
                        Identifier.fromNamespaceAndPath(ExampleMod.MOD_ID, "example"))
                .icon(Items.SNOWBALL)
                .title(Component.translatable("itemGroup.example"))
                .displaySection("example_section", SectionStyle.colored(0xaarrggbb, 0xffffffff /* Default */), output -> { // use your own color in hex (0xAARRGGBB), also in text color
                    output.add(ExampleItems.EXAMPLE_ITEM_2.get());
                    output.add(ExampleBlocks.EXAMPLE_BLOCK_2.get());
                })
                .emptySection(output -> { // Defaults to the top without a section header (Only Available in v1.4.0+)
                    output.add(ExampleItems.EXAMPLE_ITEM.get());
                    output.add(ExampleBlocks.EXAMPLE_BLOCK.get());
                })
                ;

        return builder.build();
    }
}

NeoForge Register

package com.example.example_mod;

import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.data.event.GatherDataEvent;
import org.mythic_goose.amalgamation.library.registry_v1.NeoForgeCreativeTabRegistrar;
import com.example.example_mod.init.ExampleCreativeTabs;

@Mod(ExampleMod.MOD_ID)
public class ExampleMod {

    public static final String MOD_ID = "examplemod";

    public ExampleMod(IEventBus eventBus) {
        ... // Other registration code

        var tabRegistrar = new NeoForgeCreativeTabRegistrar(ExampleMod.MOD_ID);
        ExampleCreativeTabs.init(tabRegistrar);
        tabRegistrar.registerToBus(eventBus);
    }
}

Fabric Register

package com.example.example_mod;

import net.fabricmc.api.ModInitializer;
import org.mythic_goose.amalgamation.library.registry_v1.FabricCreativeTabRegistrar;
import com.example.example_mod.init.ExampleCreativeTabs;

public class ExampleMod implements ModInitializer {

    public static final String MOD_ID = "examplemod";

    @Override
    public void onInitialize() {
        ... // Other registration code

        ExampleCreativeTabs.init(new FabricCreativeTabRegistrar(ExampleMod.MOD_ID));
    }
}