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
  • Loading branch information
rubensworks committed Aug 24, 2024
1 parent 4e78db8 commit 4ba04c8
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.cyclops.integrateddynamicscompat.modcompat.terrablender;

import net.minecraft.resources.ResourceLocation;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import org.cyclops.cyclopscore.modcompat.ICompatInitializer;
import org.cyclops.integrateddynamics.Reference;
import org.cyclops.integrateddynamicscompat.GeneralConfig;
import org.cyclops.integrateddynamicscompat.IntegratedDynamicsCompat;
import terrablender.api.Regions;

/**
Expand All @@ -13,7 +15,12 @@ public class TerrablenderCompatInitializer implements ICompatInitializer {
@Override
public void initialize() {
if (GeneralConfig.meneglinBiomeSpawnWeight > 0) {
Regions.register(new TestRegion(ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "overworld"), GeneralConfig.meneglinBiomeSpawnWeight));
IntegratedDynamicsCompat._instance.getModEventBus().addListener(this::commonSetup);
}
}

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

0 comments on commit 4ba04c8

Please sign in to comment.