Posted October 17, 20213 yr 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: @Mod(MiniTech.MODID) 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( ModBlocks::register, ModItems::register, ModBlockEntities::register, ModMenus::register, __ -> ModScreens.register() ); public MiniTech() { IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); for (var registrationFunction : registrationFunctions) { registrationFunction.accept(eventBus); } } } Edited October 24, 20213 yr by Majd123mc Closed
October 17, 20213 yr Author 2 minutes ago, diesieben07 said: That's what MenuScreens.register is. You need to call it during FMLCLientSetupEvent#enqueueWork, not your mod constructor. Okay, thank you!
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.