Jump to content

[SOLVED] [1.17.1] How to register a Screen to a Menu (Container)


Recommended Posts

Hello, I am trying to make my own furnace. But I have ran into an issue. How am I supposed to register a Screen?

In the vanilla implementation, it uses "MenuScreen.register", but it does not accept a supplier, and by the time I am registering it the blocks and menu haven't been registered yet.

I have heard to use ScreenManager.registerFactory, but it seems that method doesn't exist anymore.

Where/when/how should I register the screen? Thanks a lot.

Code for ModScreens.java:

public class ModScreens {
    public static void register() {
        MenuScreens.register(ModMenus.REFINERY_FURNACE.get(), RefineryFurnaceScreen::new);
        // Doesn't work because ModMenus.REFINERY_FURNACE is not initialized until registry.

Code for MiniTech.java:

public class MiniTech
    // Directly reference a log4j logger.
    public static final Logger LOGGER = LogManager.getLogger();

    public static final String MODID = "minitech";

    private static final List<Consumer<IEventBus>> registrationFunctions = Arrays.asList(
            __ -> ModScreens.register()

    public MiniTech() {
        IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();

        for (var registrationFunction : registrationFunctions) {


Edited by Majd123mc
Link to comment
Share on other sites

  • Majd123mc changed the title to [SOLVED] [1.17.1] How to register a Screen to a Menu (Container)

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.

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.


  • Create New...

Important Information

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