Skip to content

Mod Integration for Developers

Ole Henrik Stabell edited this page Jan 30, 2022 · 3 revisions

Fog World for 1.18+ no longer provide APIs for setting the fog in a biome since it is now a lot easier to do this yourself using the Forge Fog events.

However there is a override system in place allowing mod developers to tell Fog World to not add fog to your mod's biomes. This override will mean that Fog World will completely ignore your biome(s) regardless of any user-configurable configs added by Fog World.

The override system uses the InterModComms (IMC) system added by Forge, which means you can integrate with Fog World without adding Fog World as a dependency in your project. Just make sure to check if Fog World is loaded before sending the IMC message.

Event Setup

In order to send your Biome Overrides to Fog World, you first need to setup an EventListener for the InterModEnqueue event on the Mod event bus.

public ExampleMod() {
  FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueue);
}

private void enqueue(final InterModEnqueueEvent evt) {

  if (ModList.get().isLoaded("fogworld")) { // Make sure Fog World is loaded before sending IMC message.
    // Send your IMC messages here
  }
}

Sending the IMC Method

To send the override you need to use the following method call inside the event:

InterModComms.sendTo("fogworld", "biome_override", () -> new ResourceLocation("minecraft", "plains"));

Where the ResourceLocation is a valid registered Biome ResourceLocation. It´s worth noting that the Biome in question does not need to be added by your mod. This means you could add overrides for vanilla biomes or even biomes from other mods. Just make sure that you only send a ResourceLocation, anything else is likely to crash the game during load.

Fog World will post any registered Biome Overrides to the console log during the FML Load Complete Event, allowing you to verify that your override has been registered.

If you have any other needs for integration with Fog World that you feel is not covered by the existing IMC system, let me know trough an issue here on Github and we can figure something out.

Clone this wiki locally