Jump to content

Recommended Posts

Posted

I have not made an api before and I'm not really finding anything useful for what kind of things need to be availabe and how to make them available.

In my case I have a few interfaces and classes that I want an addon to be able to interact with.

//implement or extend these
abstract class PartType
interface IDraftable
interface ILuxin

//use static methods from these classes
PartReg#RegisterPart(PartType part)
CoreReg#RegisterCore(IDraftable core)
LuxinReg#RegisterLuxin(ILuxin newLuxin)

 

What would I need to do to make these available?

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

I don't know why I always assume things must be more complicated than my first impression. Since the library isn't getting built into their mod I assume I can just do something like github.com/UberAffe/Light-Drafter/API/LightDrafter-1.9-1.0-api.jar and as long as I don't change those classes then anything they build against that jar will work with the current version of my mod.

 

Do I need to do anything to check for a minimum api version?

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

An API is nothing special. An API is simply a set of classes / methods that you agree to not change.

 

Unless you're Rieka.

 

Or unless there's a good reason, in which case:

1) Mark them @Deprecated for at least 1 version and throw a warning to the console/log

2) Do your best to handle the old way if you can (e.g. if a method name, location, or paramters changed, create the new method and have the old, deprecated version point to it with a best-guess default for new parameters).

 

I've got a few of these, from when I went "this class is handling more than it should be, I'm creating a new API interface for these" and moved them.

 

https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/hardlib/api/interfaces/IHardRecipes.java#L58-L66

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.