Option to close GUI by button
Closed this issue · 5 comments
First of all, this GUI library is awesome! I cannot imagine the time spend to create something like this with the ability to compile AND decompile custom GUIs.
Now, i'm currently working on an adventure map where the player needs to make a correct input and then something happens around him. After this input, it should not be able to do other inputs. Currently i deal it with blocking any click by checking a scoreboard state (which is changed on correct input). But the player still needs to close the GUI self. Here it would be awesome if you could force close a GUI.
I'm not a professional datapack dev, but maybe this could be achieved by temp breaking and instantly replacing the UI block?
Thank you for the feedback. Temporarily replacing the container is exactly what I do in some projects to close the user interface for all players. This is something I will be implementing as a built-in functionality within the datapack in the future.
Oh yeah, i thought it would not be possible right now to do it, because cloning the GUI block to another location (as a buffer), replacing the source GUI block with air and then cloning it back does not work (all clicked items trigger but disappear).
But it seems that you just not can replace it with air. Replacing it with anything else works perfectly fine.
Replacing with air should also work if the block is retrieved in the same tick. Otherwise, the GUI would break as the GUI marker entities are programmed to be killed if their container is broken.
This feature has now been implemented as an NBT tag for GUI widgets.
Wow, that was quick. Thank you for your fast response and fast adding of the feature!