diff --git a/forge/src/main/java/net/blay09/mods/balm/forge/ForgeBalm.java b/forge/src/main/java/net/blay09/mods/balm/forge/ForgeBalm.java index 817e544d..020c8176 100644 --- a/forge/src/main/java/net/blay09/mods/balm/forge/ForgeBalm.java +++ b/forge/src/main/java/net/blay09/mods/balm/forge/ForgeBalm.java @@ -7,6 +7,7 @@ import net.blay09.mods.balm.config.ExampleConfig; import net.blay09.mods.balm.forge.client.ForgeBalmClient; import net.blay09.mods.balm.forge.provider.ForgeBalmProviders; +import net.blay09.mods.balm.forge.world.ForgeBalmWorldGen; import net.minecraft.world.Container; import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.energy.IEnergyStorage; @@ -23,6 +24,7 @@ public ForgeBalm() { ((AbstractBalmConfig) Balm.getConfig()).initialize(); ExampleConfig.initialize(); + FMLJavaModLoadingContext.get().getModEventBus().addListener(ForgeBalmWorldGen::initializeBalmBiomeModifiers); FMLJavaModLoadingContext.get().getModEventBus().addListener(ForgeBalmClient::onInitializeClient); ForgeBalmProviders providers = (ForgeBalmProviders) Balm.getProviders(); diff --git a/forge/src/main/java/net/blay09/mods/balm/forge/world/ForgeBalmWorldGen.java b/forge/src/main/java/net/blay09/mods/balm/forge/world/ForgeBalmWorldGen.java index 3744529a..a792f1fa 100644 --- a/forge/src/main/java/net/blay09/mods/balm/forge/world/ForgeBalmWorldGen.java +++ b/forge/src/main/java/net/blay09/mods/balm/forge/world/ForgeBalmWorldGen.java @@ -55,13 +55,6 @@ public void commonSetup(FMLCommonSetupEvent event) { private final Map registrations = new ConcurrentHashMap<>(); public ForgeBalmWorldGen() { - // Mod loading context may be null if something in load process errored before // TODO can we move this to FMLCommonLoadEvent to avoid this null check? - if (FMLJavaModLoadingContext.get() != null) { - var registry = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, "balm"); - registry.register("balm", () -> BALM_BIOME_MODIFIER_CODEC); - registry.register(FMLJavaModLoadingContext.get().getModEventBus()); - } - MinecraftForge.EVENT_BUS.register(this); } @@ -113,4 +106,12 @@ public void register() { private Registrations getActiveRegistrations() { return registrations.computeIfAbsent(ModLoadingContext.get().getActiveNamespace(), it -> new Registrations()); } + + public static void initializeBalmBiomeModifiers(FMLCommonSetupEvent event) { + event.enqueueWork(() -> { + var registry = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, "balm"); + registry.register("balm", () -> BALM_BIOME_MODIFIER_CODEC); + registry.register(FMLJavaModLoadingContext.get().getModEventBus()); + }); + } }