Posted May 29, 20223 yr I'm making my first gui window for a block entity. Really, I would have been surprised if things just worked on the first try... what i have: DeferredRegister<MenuType<?>> in registration class and... RegistryObject<MenuType<my thing Menu>> below with a register call. (i assume these two are okay because this menu type is used in inherited constructor of my Container/Menu) event.enqueueWork(() -> MenuScreens.register inside the FMLClientSetupEvent in client setup class. the handler is called, i checked. overridden getMenuProvider in my block class. returns a SimpleMenuProvider which just creates an instance of my menu/container class. overridden use in my block class that calls player.openMenu(state.getMenuProvider(level, pos)); that part is the same as vanilla crafting table and should work. The gui window does open when i right click the block, but it closes instantly. Any ideas? Edited May 29, 20223 yr by MFMods
May 29, 20223 yr 1 hour ago, MFMods said: The gui window does open when i right click the block, but it closes instantly. Any ideas? show your Menu class
May 29, 20223 yr Author 3 minutes ago, Luis_ST said: show your Menu class Literally identical to CraftingMenu (one used by crafting table). Copy and paste. I'll trim it and change it to what I need once we get the window to stay on screen instead of just flashing.
May 29, 20223 yr you need to return true in #stillValid for your own Block, since the vanilla Menus does only support one Block you can copy the vanilla logic but you need to use your own Block instead of Blocks.CRAFTING_TABLE
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.