diff --git a/src/main/java/com/aizistral/enigmaticlegacy/EnigmaticLegacy.java b/src/main/java/com/aizistral/enigmaticlegacy/EnigmaticLegacy.java index 41c7c923..923b3e47 100644 --- a/src/main/java/com/aizistral/enigmaticlegacy/EnigmaticLegacy.java +++ b/src/main/java/com/aizistral/enigmaticlegacy/EnigmaticLegacy.java @@ -90,6 +90,7 @@ import com.aizistral.enigmaticlegacy.registries.EnigmaticPotions; import com.aizistral.enigmaticlegacy.registries.EnigmaticRecipes; import com.aizistral.enigmaticlegacy.registries.EnigmaticSounds; +import com.aizistral.enigmaticlegacy.registries.EnigmaticTabs; import com.aizistral.enigmaticlegacy.registries.EnigmaticTiles; import com.aizistral.enigmaticlegacy.triggers.BeheadingTrigger; import com.aizistral.enigmaticlegacy.triggers.CursedInventoryChangedTrigger; @@ -221,6 +222,7 @@ public EnigmaticLegacy() { this.loadClass(EnigmaticEntities.class); this.loadClass(EnigmaticEnchantments.class); this.loadClass(EnigmaticLootModifiers.class); + this.loadClass(EnigmaticTabs.class); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); diff --git a/src/main/java/com/aizistral/enigmaticlegacy/registries/EnigmaticTabs.java b/src/main/java/com/aizistral/enigmaticlegacy/registries/EnigmaticTabs.java index cc40c44e..602d194b 100644 --- a/src/main/java/com/aizistral/enigmaticlegacy/registries/EnigmaticTabs.java +++ b/src/main/java/com/aizistral/enigmaticlegacy/registries/EnigmaticTabs.java @@ -4,6 +4,7 @@ import java.util.Map; import java.util.function.Supplier; +import com.aizistral.enigmaticlegacy.EnigmaticLegacy; import com.aizistral.enigmaticlegacy.blocks.BlockAstralDust; import com.aizistral.enigmaticlegacy.blocks.BlockBigLamp; import com.aizistral.enigmaticlegacy.blocks.BlockCosmicCake; @@ -14,6 +15,7 @@ import com.aizistral.enigmaticlegacy.items.generic.GenericBlockItem; import com.aizistral.etherium.blocks.BlockEtherium; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -23,24 +25,36 @@ import net.minecraft.world.level.block.Block; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; +import net.minecraftforge.registries.RegisterEvent; public class EnigmaticTabs extends AbstractRegistry { private static final EnigmaticTabs INSTANCE = new EnigmaticTabs(); - @ObjectHolder(value = MODID + ":tab_main", registryName = "creative_mode_tab") - public static final CreativeModeTab MAIN = null; + // Object holders don't work for creative tabs for some reason - @ObjectHolder(value = MODID + ":tab_potions", registryName = "creative_mode_tab") - public static final CreativeModeTab POTIONS = null; + // @ObjectHolder(value = MODID + ":tab_main", registryName = "creative_mode_tab") + public static final CreativeModeTab MAIN; + + // @ObjectHolder(value = MODID + ":tab_potions", registryName = "creative_mode_tab") + public static final CreativeModeTab POTIONS; + + static { + MAIN = CreativeModeTab.builder().title(Component.translatable("itemGroup.enigmaticCreativeTab")) + .icon(() -> new ItemStack(EnigmaticItems.ENIGMATIC_ITEM)).build(); + + POTIONS = CreativeModeTab.builder().title(Component.translatable("itemGroup.enigmaticPotionCreativeTab")) + .icon(() -> new ItemStack(EnigmaticItems.RECALL_POTION)).build(); + } private EnigmaticTabs() { super(Registries.CREATIVE_MODE_TAB); + this.register("tab_potions", () -> POTIONS); + this.register("tab_main", () -> MAIN); + } - this.register("tab_potions", () -> CreativeModeTab.builder().title(Component.translatable( - "itemGroup.enigmaticPotionCreativeTab")).icon(() -> new ItemStack(EnigmaticItems.RECALL_POTION)).build()); - - this.register("tab_main", () -> CreativeModeTab.builder().title(Component.translatable( - "itemGroup.enigmaticCreativeTab")).icon(() -> new ItemStack(EnigmaticItems.ENIGMATIC_ITEM)).build()); + @Override + protected void onRegister(RegisterEvent event) { + // NO-OP } }