Jump to content

How does the Forge @Mod annotation actually WORK?


AleXndrTheGr8st

Recommended Posts

Don't take this question the wrong way. I know how to USE the @Mod annotation. I'm looking for a proper explanation of how the @Mod annotation actually works.

 

I've researched a bit into annotations, but have found nothing about using it in yet-unloaded classes. I could create a random class randomClass, and as long as it's never called from any other class, it would never be loaded. But if I add the @Mod annotation to it, it will be loaded. Does Forge load and scan all the classes in a certain class path, searching for any that implement the @Mod annotation, and then loads them? Is there some really easy way to get all the classes that contain a certain annotation WITHOUT having to load every class in a certain path? Am I just missing something extremely obvious?

 

I'm not a pro Java coder, but I have a few years experience with some of the more basic/intermediate stuff. It's always been a hobby and never something serious, so there's things I don't know that someone who studied the language properly for a few years would. I only ask this because I'm messing around with my own annotation similar to @Mod, however I can't find any way of loading the classes that contain it without loading all within a certain path.

 

Thanks for any help guys :) I've been getting a lot more serious about programming recently (though less Minecraft stuff really), and this has been really frustrating me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.