Kotlin for Forge

Kotlin for Forge

81M Downloads

[1.21.1-Neoforge] EventBusSubscriber Annotation doesn't work on Java class

alegian opened this issue ยท 2 comments

commented

I want to integrate KFF into a large codebase incrementally. I was happy to see that the @Mod annotation works for my main Java mod class, even when using KFF loader.

I expected the @EventBusSubscriber annotation to do the same on my events class (uses static methods), but it doesn't. It doesn't even complain, Neo just crashes because of unregistered stuff. Switching my event class to Kotlin object immediately solved it.

I don't know how KFF works, so I dont know if this is feasible, but it should definitely be documented somewhere. I spent hours debugging it, since there is no visible KFF error. The skeleton projects have no dedicated event file example.

To be clear, the issue is: Following the steps in README for an existing mod, the resulting setup may sometimes crash, due to events not being loaded.

commented

This is the code where @EventBusSubscriber classes are loaded. I'll add documentation for where exactly EventBusSubscriber is applicable (since you can even use it as a file: annotation)

commented

thank you :)