Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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

  • 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.

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

  • 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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.