Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IClickEventAction and IHoverEventAction #107

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Ecdcaeb
Copy link
Contributor

@Ecdcaeb Ecdcaeb commented Apr 5, 2024

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!

@kappa-maintainer
Copy link
Collaborator

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

@Ecdcaeb
Copy link
Contributor Author

Ecdcaeb commented Apr 5, 2024

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
Copy link
Contributor Author

Ecdcaeb commented Apr 5, 2024

It seems OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants