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

Event bus wip stuff #32

Merged
merged 22 commits into from
Aug 3, 2024
Merged

Event bus wip stuff #32

merged 22 commits into from
Aug 3, 2024

Conversation

MehVahdJukaar
Copy link
Contributor

This PR main goal is to get rid of zeta own dedicated bus implementation and instead delegate everything to the forge bus directly.
This should ideally cut of on some overhead of the previous impl where each event would get fired by forge, picked up by zeta, wrapped and re sent through zeta own event system.
To do so ive added an (arguably terribly hacky) class whose main purpose is to wrap and unwrap Zeta events automatically turning into Forge events.

Wrapper class must either:

  • wrap a forge Event, having a 1 argument constructor with it
  • wrap a Zeta event (likely a common type super class interface) and implement Event itself

these classes must be registered to that ForgeToZetaRemapper class that each ForgeZetaEvent has an instance of.
I made said class a singleton to try to cut back on reflections overhead. Might want to be looked at.
Each zeta event, be either of a "forge event" type of a new custom zeta event must have one of these class in the forge package for it to work properly as the mod needs to convert those common defined events into one that implements Event.

If only Event was an interface all this remapping bs wouldnt be that complicated. Might be worth researching into ways to inject it onto zeta events classes using ASM black magic.

To make this possible many minor refactors were also made, as well as some other stuff that i stumbled across.
Some things are removal of Phase enum, giving all tick events a Phase subclass, adding all needed wrapper event classes and turning some common events into interfaces, changing color registration code a bit, moved some from load to play bus to match whats on forge

I might write here more later

@MehVahdJukaar MehVahdJukaar requested a review from quat1024 August 1, 2024 00:14
@MehVahdJukaar MehVahdJukaar merged commit 6589ece into main Aug 3, 2024
2 checks passed
@MehVahdJukaar
Copy link
Contributor Author

I did enough testing and stuff seems to work. I'll merge. Feel free to have a look later incase some further changes need to be done

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.

1 participant