FarmersDelight icon indicating copy to clipboard operation
FarmersDelight copied to clipboard

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

Open TsXor opened this issue 1 year ago • 1 comments

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.

TsXor avatar Feb 12 '24 13:02 TsXor

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 avatar Feb 12 '24 14:02 vectorwing