Skip to content
This repository was archived by the owner on May 26, 2018. It is now read-only.

Added extra priorities to support Sponge #518

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/cpw/mods/fml/common/eventhandler/EventBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ public boolean post(Event event)
return (event.isCancelable() ? event.isCanceled() : false);
}

public int getBusID() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? ListenerLists are internal structures. Sponge should not be firing things on them manually.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you support direct listener registration (and unregistration), rather than passing the object?

private void register(Class<?> eventType, IEventListener listener, EventPriority priority, ModContainer owner)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, what are you wanting to do specifically. There should be nothing wrong with passing listeners in via the normal register function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sponge uses a different subscription marker for example. I guess at minimum, there would need to be a way to specify how methods are marked as handler methods.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, and there is/will be. I've already spoken with blood and sk about this.

return busID;
}

@Override
public void handleException(EventBus bus, Event event, IEventListener[] listeners, int index, Throwable throwable)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ public enum EventPriority implements IEventListener
* Due to using a ArrayList in the ListenerList,
* these need to stay in a contiguous index starting at 0. {Default ordinal}
*/
HIGHEST, //First to execute
PRE, //First to execute. Cancellation is not allowed
AFTER_PRE, //Cancellation is not allowed
HIGHEST, //First standard priority to execute
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still dont agree with adding this new things. It gives no extra functionality besides 'I wanna have more!'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means we can do a one to one mapping of the priorities.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that is your intention, however, I've had discussions about this. As i said, Sponge shouldn't be adding more for the sake of having more...

HIGH,
NORMAL,
LOW,
LOWEST //Last to execute
LOWEST, //Last standard priority to execute
BEFORE_POST, //Cancellation is not allowed
POST //Last to execute. Cancellation is not allowed
;

@Override
Expand Down