From 99dc5787c6277b916d4f69326176773f508e3693 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 16 Apr 2024 14:08:15 +0100 Subject: [PATCH] Allow Forge's native modlist to open the config window --- .../gjum/minecraft/mapsync/forge/ForgeMapSyncMod.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mod/forge/src/main/java/gjum/minecraft/mapsync/forge/ForgeMapSyncMod.java b/mod/forge/src/main/java/gjum/minecraft/mapsync/forge/ForgeMapSyncMod.java index 9e09e0c..d601617 100644 --- a/mod/forge/src/main/java/gjum/minecraft/mapsync/forge/ForgeMapSyncMod.java +++ b/mod/forge/src/main/java/gjum/minecraft/mapsync/forge/ForgeMapSyncMod.java @@ -1,11 +1,14 @@ package gjum.minecraft.mapsync.forge; import gjum.minecraft.mapsync.common.MapSyncMod; +import gjum.minecraft.mapsync.common.ModGui; import net.minecraft.client.KeyMapping; import net.minecraftforge.client.ClientRegistry; +import net.minecraftforge.client.ConfigGuiHandler; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -30,6 +33,14 @@ public boolean isDevMode() { public void clientSetup(FMLClientSetupEvent event) { init(); + + // Register hook for the mod list + ModLoadingContext.get().registerExtensionPoint( + ConfigGuiHandler.ConfigGuiFactory.class, + () -> new ConfigGuiHandler.ConfigGuiFactory( + (minecraft, previousScreen) -> new ModGui(previousScreen) + ) + ); } @SubscribeEvent