Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

Are you sure it's a .info file? Wouldn't you need to do a .java to use the @API annotation?

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.

Posted

I tried creating that, but it says you can't use a dash in your class name. O.o

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.

Posted

Silly me, just had to create the file outside of eclipse. :P Thanks!

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.

Posted

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.

Posted

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.

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.

×
×
  • Create New...

Important Information

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