Jump to content

[1.18.1] How can I make a chest gui/selection menu?


Recommended Posts

Hello all,

I currently I looking to make something like this in forge.


However, I am unsure how to listen for click events(if that is even possible). Is there a way to prevent items from being removed from container and perform action on click? Currently I am using ContainerListener to listen to slotChanged. This is okay but still allows player to remove items. Is there anyway I can stop this and use less logic by listening for some slot clicked event?


Link to comment
Share on other sites

8 hours ago, diesieben07 said:

These plugins will use the "generic" menus (MenuType.GENERIC_9x1 - GENERIC_9x6). These are used in vanilla for chests. As the client has no idea that it must not remove items from such a menu, it will happily do so and there is no way to prevent it. You have to detect it removing something (i.e. the player picking something up) and undo the action server side immediately.

However because Forge allows client side mods there are much better options using a custom GUI.

I can detect when a slot is changed to air(item is removed), I don’t know how to remove the item from player cursor before they place it. Is there a solution to this?


If I wanted to go down the custom GUI route, how would I do so? What classes do I need to make a custom GUI?

Link to comment
Share on other sites

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.

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.