architectury-api icon indicating copy to clipboard operation
architectury-api copied to clipboard

[Feature] Event priorities

Open MaxNeedsSnacks opened this issue 1 year ago • 0 comments

With Fabric's events supporting "phases" and Forge having their priority enum, we could probably introduce a primitve event priority system to Architectury events as well.

This would most likely include just copying the Forge enum ourselves (HIGHEST - LOWEST in five steps in total), and then registering with corresponding event phases on Fabric to mimic these Architectury ones, which would then have to be ordered something like this:

event.addPhaseOrdering("architectury:highest", "architectury:high");
event.addPhaseOrdering("architectury:high", "fabric:default");
event.addPhaseOrdering("fabric:default", "architectury:low");
event.addPhaseOrdering("architectury:low", "architectury:lowest");

(Alternatively, we could throw an additional architectury:normal either before or after fabric:default, since our current priority on forge is HIGH we might want to do this?)

Registering to an Architectury event with a priority would function similarly to how Fabric does it, albeit using the priority enum mentioned above instead of arbitrary phase IDs, i.e. for instance event.register(HIGHEST, listener)

Because this would constitute a major new feature, I suggest we only add this system to the more recent versions of Arch, namely 1.19.2 and 1.20.1 (1.19.3 and 1.19.4 do not strike me as particularly worth maintaining atm)

MaxNeedsSnacks avatar Jul 24 '23 16:07 MaxNeedsSnacks