Register creative tab registrar
This commit is contained in:
parent
926b9a2a17
commit
cc9f87b352
@ -8,6 +8,7 @@ import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.level.material.Fluids
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent
|
||||
import net.minecraftforge.eventbus.api.IEventBus
|
||||
import net.minecraftforge.fluids.FluidStack
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
@ -262,6 +263,7 @@ object MCreativeTabs {
|
||||
.icon { ItemStack(BATTERY_CREATIVE, 1) }
|
||||
.build()
|
||||
}
|
||||
|
||||
val DECORATIVE: CreativeModeTab by registry.register("decorative") {
|
||||
CreativeModeTab.builder()
|
||||
.title(TranslatableComponent("itemGroup.otm_decorative"))
|
||||
@ -269,14 +271,16 @@ object MCreativeTabs {
|
||||
.build()
|
||||
}
|
||||
|
||||
internal fun initialize(bus: IEventBus) {
|
||||
registry.register(bus)
|
||||
}
|
||||
|
||||
fun register(event: BuildCreativeModeTabContentsEvent) {
|
||||
CreativeMenuComparator.invalidate()
|
||||
|
||||
if (event.tab == MAIN) {
|
||||
addMainCreativeTabItems(event)
|
||||
}
|
||||
if (event.tab == DECORATIVE) {
|
||||
addDecorativeTabItems(event)
|
||||
when (event.tab) {
|
||||
MAIN -> addMainCreativeTabItems(event)
|
||||
DECORATIVE -> addDecorativeTabItems(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,6 +205,8 @@ object MRegistry {
|
||||
bus.addListener(this::initializeCommon)
|
||||
bus.addListener(MStats::registerVanilla)
|
||||
|
||||
MCreativeTabs.initialize(bus)
|
||||
|
||||
DecimalProvider.register(bus)
|
||||
|
||||
MBlocks.register(bus)
|
||||
|
Loading…
Reference in New Issue
Block a user