Skip to content

Commit

Permalink
Allow Forge's native modlist to open the config window
Browse files Browse the repository at this point in the history
  • Loading branch information
Protonull authored and Gjum committed Apr 18, 2024
1 parent 801badb commit c97b3c9
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down

0 comments on commit c97b3c9

Please sign in to comment.