Add annotation-based plugin registration#1150
Conversation
|
I strongly disagree with annotation based stuff for discovery of entry points, It adds MASSIVE overhead (I'm a modpackdev of packs that contains ~400-500) for no real benefit Using .txt file you still need to query every pack entry to check if the resource is there, but at least scales better |
|
I don’t see how that would cause an issue. This is not using a library like |
really cringed it up |
What a really useful contribution to the conversation.
Do you have any specific reason to change this behavior apart from "other mods do this"? Or is this what your LLM suggested as a good contribution? |
Throwing an annotation on a class is much more obvious to developers rather than maintaining a separate plain text file, consisting of FQCNs with cryptic syntax for required mods and client only marker. Plus plain text files remain for backwards compatibility, annotations are opt-in.
Not sure how you came up with accusing someone of using LLMs, that’s not nice. No, this is my genuine proposal because I’ve made lots of KubeJS plugins and I saw adding an alternative way to register plugins as a nice addition. |
Description
Many mods utilize annotation-based registration of their extensions, e.g. EMI
@EmiEntrypoint, Jade@WailaPlugin, etc.KubeJS, on the other hand, uses .txt files with a special syntax.
This PR adds a new
@KubeJSEntrypointannotation. It supports file-based registration features too, e.g. client-only plugin marker and mods required to load a plugin.NeoForge provides tools for obtaining classes with annotations, and it uses those itself for
@Modand@EventBusdiscovery.Note
This PR targets 26.1, but I would very much like to see it on 1.21.1 as well. I can draft a backport PR - should be easy.
Examples
Regular plugin registration
Client-side only plugin registration
Requiring both JEI and Mekanism mods to be loaded
Other details