vectorwing / FarmersDelight

[Forge] A lightweight farming expansion for Minecraft.
MIT License
292 stars 174 forks source link

vectorwing/farmersdelight/common/Configuration will never receive config events #879

Closed TsXor closed 2 months ago

TsXor commented 7 months ago

https://github.com/vectorwing/FarmersDelight/blob/1.19/src/main/java/vectorwing/farmersdelight/common/Configuration.java#L9

I was writing some mods when referring to code stucture Farmer's Delight on "how should I do this" questions.
However, I found my configuration handler never receives configuration event.
After some looking around, I found configuration events are fired on mod event bus, and annotation @Mod.EventBusSubscriber by default makes the class listen to forge event bus, so current code (and possibly all code since 1.16.5) never receive config events.
To make it really receive events, annotation should be written like this.

@Mod.EventBusSubscriber(modid = FarmersDelight.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)

It seems that Farmer's delight never really do something on these events, but I think it important to point it out.

vectorwing commented 7 months ago

Thanks for pointing this out!

Turns out that this @Mod.EventBusSubscriber is completely unnecessary, and likely a leftover from when I was following outdated modding tutorials. Since I'm using the config objects directly, I can just remove the annotation. 👍

vectorwing commented 2 months ago

Line removed on commit 3a9c108.