Skip to content

Commit

Permalink
Delay Terrablender registration
Browse files Browse the repository at this point in the history
This fixes rare crashes when Terrablender was not yet fully initialized.

CyclopsMC/IntegratedDynamics#1385
Closes CyclopsMC/IntegratedDynamics#1388
  • Loading branch information
rubensworks committed Sep 2, 2024
1 parent b662708 commit 2eed029
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.cyclops.integrateddynamicscompat.modcompat.terrablender;

import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.cyclops.cyclopscore.modcompat.ICompatInitializer;
import org.cyclops.integrateddynamics.Reference;
import org.cyclops.integrateddynamics.world.biome.BiomeMeneglinConfig;
Expand All @@ -13,7 +15,11 @@ public class TerrablenderCompatInitializer implements ICompatInitializer {
@Override
public void initialize() {
if (BiomeMeneglinConfig.spawnWeight > 0) {
Regions.register(new TestRegion(new ResourceLocation(Reference.MOD_ID, "overworld"), BiomeMeneglinConfig.spawnWeight));
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
}
}

private void commonSetup(final FMLCommonSetupEvent event) {
event.enqueueWork(() -> Regions.register(new TestRegion(new ResourceLocation(Reference.MOD_ID, "overworld"), BiomeMeneglinConfig.spawnWeight)));
}
}

0 comments on commit 2eed029

Please sign in to comment.