Jump to content

[1.9.4] Using the Mekanism API


GreatBlitz

Recommended Posts

I have envisioned a mod that requires Mekanism to run, for 1.9.4. I downloaded the devkit from the official website: http://aidancbrady.com/mekanism/download/ [version 9.1.0.282] and I dropped it into my src\api\java folder. I added the java folder as a source folder in Eclipse, and saw that there were errors in the files. Turns out, some classes were attempting to import files not even in the api folder. For example, one of the files tried to import from mekanism.common, which isn't present in the api. Now, I'm not sure if this is a fault of the mod, or if I just imported my folders wrong. In any case, I created an issue on GitHub, there are more details there: https://github.com/aidancbrady/Mekanism/issues/3896 . Would appreciate any help I could get. Thanks.

Link to comment
Share on other sites

Are the files your files or files in the API?

 

This file: https://github.com/aidancbrady/Mekanism/blob/master/src/main/java/mekanism/api/gas/Gas.java is in the API. On line 3 and 4, it tries to access files in mekanism.client, which are present in Mekanism, but not in the API.

 

To clarify, those are both Mekanism's files, neither of them is mine. However, the first (Gas.java) is in the API whereas the files being referenced on lines 3 and 4 (MekanismRenderer.java and FluidType.java) are not in the API, but in the main mod Mekanism.

Link to comment
Share on other sites

Are the files your files or files in the API?

 

This file: https://github.com/aidancbrady/Mekanism/blob/master/src/main/java/mekanism/api/gas/Gas.java is in the API. On line 3 and 4, it tries to access files in mekanism.client, which are present in Mekanism, but not in the API.

 

Then their API violates the contract of an API and therefor sucks.

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.

Link to comment
Share on other sites

Are the files your files or files in the API?

 

This file: https://github.com/aidancbrady/Mekanism/blob/master/src/main/java/mekanism/api/gas/Gas.java is in the API. On line 3 and 4, it tries to access files in mekanism.client, which are present in Mekanism, but not in the API.

 

Then their API violates the contract of an API and therefor sucks.

 

Is there nothing I can do on my side to fix it? Couldn't I simply download the missing files from the repository and add them to the api folder?

 

Say I ended up doing that. Something you should know :my mod has a hard dependency on Mekanism as I wanted to make an addon for it. The end user down loads both mekanism, which has the unmodified version of the api, and my mod, which has the modified api. Would this cause incompatibility/crashes?

Link to comment
Share on other sites

Is there nothing I can do on my side to fix it? Couldn't I simply download the missing files from the repository and add them to the api folder?

 

Say I ended up doing that. Something you should know :my mod has a hard dependency on Mekanism as I wanted to make an addon for it. The end user down loads both mekanism, which has the unmodified version of the api, and my mod, which has the modified api. Would this cause incompatibility/crashes?

 

If you can get their source code, yes, that would fix it.

As your mod has a hard dependency on Mekanism it won't matter to the end user.  Mekanism should still fix their shit though.  Seems to me that

MekanismRenderer.FluidType

should be in the API package.

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.

Link to comment
Share on other sites

Is there nothing I can do on my side to fix it? Couldn't I simply download the missing files from the repository and add them to the api folder?

 

Say I ended up doing that. Something you should know :my mod has a hard dependency on Mekanism as I wanted to make an addon for it. The end user down loads both mekanism, which has the unmodified version of the api, and my mod, which has the modified api. Would this cause incompatibility/crashes?

 

If you can get their source code, yes, that would fix it.

As your mod has a hard dependency on Mekanism it won't matter to the end user.  Mekanism should still fix their shit though.  Seems to me that

MekanismRenderer.FluidType

should be in the API package.

 

The source for the mod is public so I can get the files. But then wouldn't the mekanism api in my mod differ from the mekanism api in the actual mekanism jar file, thus causing conflicts for the end user?

Link to comment
Share on other sites

You don't ship APIs with your mod.

You should not be altering any code inside the Mekanism packages.

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.

Link to comment
Share on other sites

You don't ship APIs with your mod.

You should not be altering any code inside the Mekanism packages.

 

Well so I decided to download the required files, but then I realized that THOSE files will have to import even more files. What should I do? Am I helpless in this scenario or should I just download like literally every file from the Mekanism repo?

Link to comment
Share on other sites

The Mekanism API is broken, so you'd have to make your mod a hard dependency and put the Mekanism jar inside the libs/ folder and rerun

gradlew setupDecompWorkspace eclipse

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

The Mekanism API is broken, so you'd have to make your mod a hard dependency and put the Mekanism jar inside the libs/ folder and rerun

gradlew setupDecompWorkspace eclipse

.

 

Two questions:

 

1. Where exactly is the libs/ folder?

 

2. If I do it this way, will I be able to use files from Mekanism and create my own gases etc?

Link to comment
Share on other sites

The Mekanism API is broken, so you'd have to make your mod a hard dependency and put the Mekanism jar inside the libs/ folder and rerun

gradlew setupDecompWorkspace eclipse

.

 

Two questions:

 

1. Where exactly is the libs/ folder?

 

2. If I do it this way, will I be able to use files from Mekanism and create my own gases etc?

you need to create it inside the root project folder so it ould look like pathtoyourdevenv/modname/libs

Link to comment
Share on other sites

The Mekanism API is broken, so you'd have to make your mod a hard dependency and put the Mekanism jar inside the libs/ folder and rerun

gradlew setupDecompWorkspace eclipse

.

 

Two questions:

 

1. Where exactly is the libs/ folder?

 

2. If I do it this way, will I be able to use files from Mekanism and create my own gases etc?

you need to create it inside the root project folder so it ould look like pathtoyourdevenv/modname/libs

 

Thanks! and if I do it this way, will I be able to use files from Mekanism and create my own gases etc?

Link to comment
Share on other sites

The Mekanism API is broken, so you'd have to make your mod a hard dependency and put the Mekanism jar inside the libs/ folder and rerun

gradlew setupDecompWorkspace eclipse

.

 

Actually can you run me through the whole process? I'm new to this "libs" method. Can you list all the steps required?

 

1. I'm guessing libs will be alongside the src and other folders?

 

2. Is listing Mekanism as a hard dep. in my mod file enough?

 

3. How do I add the jar to my workspace?

 

4. What modifications do I need to make to my build.gradle?

 

5. What does it mean for my end users? How do they install my mod?

Link to comment
Share on other sites

1) make libs folder along source folder.

2) put Mekanism jar in the libs folder.

3) run

gradlew setupDecompWorkspace eclipse

 

This makes the Mekanism jar available to you as a modder. The user will get a crash if they install your mod without Mekanism, but since it is an add-on, that doesn't matter. They'll install your mod just like every other mod.

 

You don't need to change your

build.gradle

at all.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

1) make libs folder along source folder.

2) put Mekanism jar in the libs folder.

3) run

gradlew setupDecompWorkspace eclipse

 

This makes the Mekanism jar available to you as a modder. The user will get a crash if they install your mod without Mekanism, but since it is an add-on, that doesn't matter. They'll install your mod just like every other mod.

 

You don't need to change your

build.gradle

at all.

 

Just did it, appears in my Referenced Libraries.

 

1. Up till now, since I was trying out things in absence of Mekanism, I had placed the RF API by CoFH in my src\main\java folder. So now that I have loaded up Mekanism (which contains the RF API as well) as a library, do I need to anything about MY RF API folder? Or can it stay where it is?

 

2. Code in the jar file appears as .class files, which do not have sources attached. Anything I can do about that?

 

3. Does using this "libs" method allow me to access all the files of the mod? Is it safe practice to be doing so? Or am I still confined to the API folder?

Link to comment
Share on other sites

1. Your RF API is fine. You may want to remove it so the copy in the Mekanism jar is used so there's 1 less copy of the API floating around.

2. You can clone the repository from GitHub and attach the sources to the jar.

3. You'll be able to access any of the classes in the jar, so all of them. It's perfectly safe to do so, however, you should avoid using internal Mekanism classes as they are more likely to change and break your mod.

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

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.



×
×
  • Create New...

Important Information

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