Open GUI on right click #561
-
Hello, Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It is possible to open GUIs like that, however keeping them open is much more difficult. That said, here is an example from the Discord for opening a GUi (it is on world login, but swapping it for block right click would be easy enough). Note that the classpath
|
Beta Was this translation helpful? Give feedback.
It is possible to open GUIs like that, however keeping them open is much more difficult.
Most GUIs that are attached to blocks include checks to make sure the block is still in range and hasn't been destroyed. Of course if there's no such valid block in the first place, the check fails immediately and the GUI never opens.
That said, here is an example from the Discord for opening a GUi (it is on world login, but swapping it for block right click would be easy enough). Note that the classpath
(here its
com.wildfire.gui.screen.WildfirePlayerListScreen
) needs to be set to the classpath of the screen you want to open. Have a look at the mods source for that. The Screen constructor (thenew Wi…