neoforged / Bus

Event firing and listening framework, based on the event bus concept

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Event`s should be resettable to a state where they can be posted again

Technici4n opened this issue · comments

As far as I can tell it's just a matter of adding such a method to Event:

    protected void reset() {
        isCanceled = false;
        result = Result.DEFAULT;
        phase = null;
    }

(event.setCanceled(false).setResult(Result.DEFAULT).setPhase(null) will not work due to setPhase)

Of course, this should come with a nice test too.

There is no phase tracking anymore, so .setCanceled(false).setResult(Result.DEFAULT) can be used to reset events.