Cleanroom icon indicating copy to clipboard operation
Cleanroom copied to clipboard

IClickEventAction and IHoverEventAction

Open Ecdcaeb opened this issue 1 year ago • 3 comments

What this pr brings

  • The new interfaces, IHoverEventAction and IClickEventAction, abstract action processing into methods.
  • Make ClickEvent.Action and HoverEvent.Action implement these interfaces and invoke them at the appropriate time.
  • They wrap a IHoverEventAction or IClickEventAction, which allows content to be added by an EnumHelper, just like an EnumEnchantmentType.
  • Dynamic NAME_MAPPING

What this pr leaves

  • The old NAME_MAPPING. It has not been removed directly to maintain compatibility with Actions added by past mods.

What this pr deletes

  • <clinit>s of Action, which simply implement NAME_MAPPING
  • cache the action in method, do not always if(event.getAction() == XXX)

What this pr could be used for

Enable the modder add some magically cool hover and click effects in a hackinless method!

Ecdcaeb avatar Apr 05 '24 02:04 Ecdcaeb

I noticed that you are modifying GuiScreen, how's this change's compatibility to current mod?

kappa-maintainer avatar Apr 05 '24 02:04 kappa-maintainer

I noticed that you are modifying GuiScreen, how's this change's compatibility to current mod?

I only modified the part that handles HoverEvent and ClickEvent. In theory, there will be no compatibility issues. I will do compatibility testing later.

Ecdcaeb avatar Apr 05 '24 02:04 Ecdcaeb

It seems OK.

Ecdcaeb avatar Apr 05 '24 06:04 Ecdcaeb