Jump to content

Gui window closes instantly [solved]


MFMods

Recommended Posts

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 by MFMods
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • MFMods changed the title to Gui window closes instantly [solved]

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.



×
×
  • Create New...

Important Information

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