Creating and modifying creative tabs
Information on this page only applies to Minecraft 1.20.1 and newer due to the Creative Tab rework in vanilla.
#Add / Remove items from a tab or search
StartupEvents.modifyCreativeTab('minecraft:redstone_blocks', event => {
// Adds example item after redstone
event.addAfter('minecraft:redstone', 'kubejs:example_item')
// Removes redstone from this tab's display, but leaves it visible when using search
event.removeDisplay('minecraft:redstone')
// Removes redstone from this tab's search stacks
// (note that this does NOT remove it from search entirely if another tab still has the item in its search stacks)
event.removeSearch('minecraft:redstone')
// Fully removes redstone from both this tab's display and search stacks
event.remove('minecraft:redstone')
})#Change icon and display name of tab
StartupEvents.modifyCreativeTab('minecraft:functional_blocks', event => {
// Change tab icon
event.icon = 'kubejs:example_block'
// Change display name. Technically supports formatting, but it's not recommended
event.displayName = Text.darkRed('Functional Blocks!')
})#Create a new tab and all dirt blocks to it
StartupEvents.registry('creative_mode_tab', event => {
event.create('dirt').icon(() => 'minecraft:dirt').content(() => [
'minecraft:dirt',
'minecraft:grass_block',
'minecraft:podzol',
'minecraft:coarse_dirt',
'minecraft:rooted_dirt'
])
})