To define a custom creative tab, define a static final field as follows.
The first argument is the id of the new tab, which will be used to define the translation key.
The second argument is the icon of the new tab, which is a supplier to a ItemStack
instance.
1.20
public static final DeferredRegister<CreativeModeTab> TABS = DeferredRegister.create("modid", Registries.CREATIVE_MODE_TAB); public static final RegistrySupplier<CreativeModeTab> MY_TAB = TABS.register( "test_tab", // Tab ID () -> CreativeTabRegistry.create( Component.translatable("category.architectury_test"), // Tab Name () -> new ItemStack(TestRegistries.TEST_ITEM.get()) // Icon ) );
1.19.3 to 1.19.4
public static final CreativeTabRegistry.TabSupplier MY_TAB = CreativeTabRegistry.create( new ResourceLocation("modid", "test_tab"), // Tab ID () -> new ItemStack(Items.STONE) // Icon );
1.19.2 or below
public static final CreativeModeTab MY_TAB = CreativeTabsRegistry.create( new ResourceLocation("modid", "my_tab"), // Tab ID () -> new ItemStack(Items.STONE) // Icon );
To add an item to the tab, you can use the `tab` method in Item.Properties, since this method has been removed by Mojang in 1.19.3 in favour for a more manual setup, Architectury includes a custom `arch$tab` method for you.
1.19.3 or above
new Item.Properties().arch$tab(MY_TAB);
1.19.2 or below
new Item.Properties().tab(MY_TAB);