Jump to content

[1.8.8] Questions about API creation for a mod


HappyKiller1O1
 Share

Recommended Posts

So, I understand that an API is just some classes for other mods to interact with mine. But, do I simply create a package for my API classes, compile my mod with it, and have people use the source of my mod for the API? Do I have to compile an API separately? Do I have to define a class or package as an API? I just want to make sure people won't have errors when attempting to interact with my mod.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

Yes, you should create a specific package for your API classes, if any, so that you can declare it as an API by including a package-info.java file:

@API(owner = "yourmodid", provides = "UniqueNameForAPI", apiVersion = "1.8-1.0")
package yourmod.api;

import net.minecraftforge.fml.common.API;

This lets FML / Forge know that this is an API package so that it prioritizes making the classes in it available sooner rather than later when loading mods (at least that's how I understand it - may not be 100% correct).

 

Whether you release that API package separately or include it in your mod is up to you; personally I tend to just include them with my mods, but if you plan on having lots of your own mods using the same API, it may be better to release it separately as a dependency, or you could shade it.

Link to comment
Share on other sites

One more question though, what if someone implements my API classes, and someone using that mod does not have my mod loaded? Wouldn't that crash the game?

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

Alright, would they put that annotation over their Item or Block class? (I created the weight limit mod , so they have to implement my interface in order to provide items with weight).

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

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
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.

 Share



×
×
  • Create New...

Important Information

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