Skip to content

Commit

Permalink
Fix ListenerList not firing when parent has a listener before child i…
Browse files Browse the repository at this point in the history
…s created.
  • Loading branch information
LexManos committed Jan 29, 2025
1 parent 49c8162 commit bb81df7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/net/minecraftforge/eventbus/ListenerList.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ private ListenerListInst() {}
private ListenerListInst(ListenerListInst parent) {
this.parent = parent;
this.parent.addChild(this);
// We set the NO_LISTENERS so we don't have to rebuild the listener list if nobody registers
// However the parent can have a listener registered before we know about the sub-class
if (this.parent.listeners != NO_LISTENERS)
this.listeners = null;
}

public void dispose() {
Expand Down

0 comments on commit bb81df7

Please sign in to comment.