Cadiboo / Example-Mod

An example mod created to try and get new modders to use good code practices
GNU Lesser General Public License v3.0
196 stars 41 forks source link

ClientEventSubscriber is subscribed on both sides #2

Closed V0idWa1k3r closed 5 years ago

V0idWa1k3r commented 5 years ago

When using the @Mod.EventBusSubscriber it subscribes the class to the bus on both sides. You can however specify the side it is subscribed on using the value property of the annotation(example). Without specifying it the class will be subscribed on both sides which may lead to issues. While ClientEventSubscriber in your case doesn't load any client-only classes when loaded it gives modmakers a false impression that it will only be loaded on the client(because of the name). They may then decide to expose client-only classes in it(by making their methods return/take them as parameters, or by specifying fields of those types) and thus crashing the server. I recommend you specify the side in your EventBusSubscriber annotation to avoid those issues. Edit: The same appies to the ServerEventSubscriber class actually.