-
Notifications
You must be signed in to change notification settings - Fork 4
Mod Integration for Developers
Fog Tweaker 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 Tweaker to not add fog to your mod's biomes. This override will mean that Fog Tweaker will completely ignore your biome(s) regardless of any user-configurable configs.
The override system uses the InterModComms (IMC) system added by Forge, which means you can integrate with Fog Tweaker without adding it as a dependency in your project. Just make sure to check if Fog Tweaker is loaded before sending the IMC message.
In order to send your Biome Overrides to Fog Tweaker, 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("fogtweaker")) { // Make sure Fog Tweaker is loaded before sending IMC message.
// Send your IMC messages here
}
}
To send the override you need to use the following method call inside the event:
InterModComms.sendTo("fogtweaker", "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 Tweaker 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 Tweaker 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.