Page 1 of 1
How to make a simple GUI
Posted: Wed Oct 19, 2016 6:15 am
by Neel
I have added a special entity. When the entity is clicked, I want to prompt the user with a simple prompt dialog to show a number associated with the entity and allow the user to change the number. How do I go about doing this? So just like the way to specify the number of items requested by a requester chest.
Re: How to make a simple GUI
Posted: Wed Oct 19, 2016 11:41 am
by MrDoomah
Re: How to make a simple GUI
Posted: Wed Oct 19, 2016 2:38 pm
by DedlySpyder
There still isn't any proper way to handle players clicking on an entity to fire an event (unless they changed recently). I think your best bet is to make a custom keyboard shortcut that checks the player's selected entity for your entity and handle the GUI from there. (although I believe some people use an on tick event to check constantly, I like to avoid on tick as much as possible)
Re: How to make a simple GUI
Posted: Wed Oct 19, 2016 3:12 pm
by aubergine18
DedlySpyder wrote:There still isn't any proper way to handle players clicking on an entity to fire an event (unless they changed recently). I think your best bet is to make a custom keyboard shortcut that checks the player's selected entity for your entity and handle the GUI from there. (although I believe some people use an on tick event to check constantly, I like to avoid on tick as much as possible)
Correct.
Also, the .operable property of an entity can be set to false to prevent default entity GUI opening when its clicked: listen for built events, if it's your entity then set event.created_entity.operable = false