#SpruceUI v8 Screen Events API

4 messages · Page 1 of 1 (latest)

wicked fern
#

So, with 1.21.6 being an update reworking GUI stuff, it's a good occasion to rework SpruceUI too! (I mean, if I don't have a choice, let's make it worth it)

While waiting on the refactors to stabilize, I've started work on the stuff that should be relatively stable like screen events!
This is using the Yumi Commons event framework, and this API will be multiloader!

This is heavily inspired from Fabric API's Screen Events API, but thanks to Yumi Commons' Filtered Events, global and contextualized listeners can be both registered very easily and in a standardized way!

Here you can see two contextualized listeners:

  • the first one uses a predicate to only select TitleScreens (on other screens when the event is contextualized the listener will just not be called)
  • the second one uses directly the contextualized event to register the listener which will be GC-ed as soon as the contextualized event ceases to exist (which it will since it is reset every time the screen is initialized (and it is automatically GC-ed when the screen gets GC-ed))
kindred nest
#

cya later title screen

woven warren
#

So long gay bowser

silent wind
#

FancyMenu alternative 🤔