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)

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...

Important Information

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