Jump to content

[1.18.x-1.19.x] How to create the GuiConfig from back in 1.12 and older versions


Recommended Posts

Posted

I haven't been updating mods in a while but I remember back in 1.12.2 and older versions there was a "GuiConfig" that we could extend and together with a "IModGuiFactory" that was enough to register the in-game Config GUI from @Mod passing the guiFactory in question.

All that to get the "Config" button working in-game.

What is the method to achieve this in newer versions like 1.18.x and 1.19.x - I couldn't find anything in the Documentation (Or maybe I missed it)

Posted (edited)

Something like:

@EventBusSubscriber(modid = MODID, bus = Bus.MOD, value = Dist.CLIENT)
public class ConfigScreenTest {

    @SubscribeEvent
    public static void clientSetupEvent(FMLClientSetupEvent event) {
        event.enqueueWork(() -> {
            ModLoadingContext.get().registerExtensionPoint(ConfigScreenFactory.class, () -> new ConfigScreenFactory(ConfigScreenTest::createConfigScreen));
        });
    }

    public static Screen createConfigScreen(Minecraft minecraft, Screen mainConfigScreen) {
        return new ErrorScreen(Component.literal("Title"), Component.literal("Error"));
    }
}

Obviously you should minecraft.setScreen(mainConfigScreen) when you are done, unlike my stupid example. 🙂 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted (edited)

Thanks will give it a go.

PS: Do I need to manually build the screen items by item, or is there something built in that can handle it, like in the past we had GuiConfig?

 

Edited by American2050
I missed something.
Posted

Maybe this if you don't want to write it yourself? https://www.curseforge.com/minecraft/mc-mods/configured

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.