added WorldEvent listener to ForgeEventProcessor.kt #284
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the pull
ForgeEventProcessor.kt will forward every WorldEvent and the respective subclass-events to the LambdaEventBus.
The listener for ChunkEvent.Unload must be removed since it extends WorldEvent and thus will be forwarded by its listener.
Describe how this pull is helpful
WorldEvent and its subclasses include a bunch of useful events like ChunkEvent, ChunkDataEvent, BlockEvent, NoteBlockEvent, GetCollisionBoxesEvent. Just adding the listener for WorldEvent instead of all subclasses individually saves a lot of code lines and works just as well with the listeners inside the modules (I tested that). I also made sure to check if there are any other listeners in the ForgeEventProcessor that might inherit from WorldEvent and thus would fire twice. But there are none except for ChunkEvent.Unload.
The reason I want to have this event on the bus is because I need to listen for WorldEvent, ChunkEvent and NoteBlockEvent for a plugin I am working on right now.
If you have any questions, please feel free to contact me here or on Discord: Simon#4530
Thank you very much!