Make EventBusSubscriber
automatically look up and dispatch mod bus events as necessary
#140
Labels
EventBusSubscriber
automatically look up and dispatch mod bus events as necessary
#140
@EventBusSubscriber
has the capacity to be provided amodid
argument, which will be used to lookup the mod bus for the target class. We should leverage this functionality to permit automatic dispatch of mod bus and non-mod bus events to the correct bus within a single class as long as the modid is present. This would also mean we can remove theBus
argument and enum.We should also consider adding a non-static method for doing so (though this may need to be in NeoForge, and not here). Potentially
NeoForge.registerEventSubscriber(modid, Object / Class)
, mimicking this new functionality but withIEventBus#register
semantics.The current paradigm requires separation of mod bus and non-mod bus events at the
class
level, ex:This approach does not provide meaningful separation (there is no reason that these must be separated at the
class
level, aside from the current EBS implementation), and unifying these events in the same class can readily be achieved viaIEventBus#addListener
.Further, implementing such a feature will reduce the need to answer support questions about registering events to the correct event bus.
The text was updated successfully, but these errors were encountered: