Jump to content

Using External JAR's or other API's in Minecraft Forge/Eclipse.. [Solved]


Recommended Posts

Posted

I want to include the source (or SDK) for the use of RF in my mod (Similar to other mods and cross mod compatibility)

In other words, I want to make my machines compatible with COFH's RF Energy.

 

How would I go about doing this?

 

I have tried already downloading cofhlib and I can't import it into my project, It says that there is no source linked, and as I can

Imagine, this is because the files are already compiled. (I even went to project settings and added it as an external JAR. No avail.)

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

I'm really tired and it's like 1 in the morn, so cya guys.

 

I'll be online tomorrow after about 1000 (UTC +0800).

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

I'm really tired and it's like 1 in the morn, so cya guys.

 

I'll be online tomorrow after about 1000 (UTC +0800).

 

This is a forum, not a chat room.

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.

Posted

I want to include the source (or SDK) for the use of RF in my mod (Similar to other mods and cross mod compatibility)

In other words, I want to make my machines compatible with COFH's RF Energy.

 

How would I go about doing this?

 

I have tried already downloading cofhlib and I can't import it into my project, It says that there is no source linked, and as I can

Imagine, this is because the files are already compiled. (I even went to project settings and added it as an external JAR. No avail.)

 

Refer to my post in your last thread. I accidentally replied there.

while(awake)

{

    coffee++;

}

Posted

Ok, yorkeMC,  I followed your advice, but I still can't get it to load.

I have the jar in the libs folder but when I try to acces it it says:

 

Source not found

The JAR file CoFHLib-[1.7.10]1.0.3-175.jar has no source attachment.

You can attach the source by clicking Attach Source below:

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

To add other mod's api to you workspace, you have 2 options.

-If you have java files in zip or simply in folder (unpacked) - in project folder, create folder src/api/java and drop apis (these files) in there. Then re-setup workspace (gradlew setupDecompWorkspace/setupDevWorkspace) .

-If you have mods in jars, verify that you have dev verion of jars, then put jars in projectFolder/libs (crete one, if it does not exist) and re-setup your worspace.

Posted

Ok, Will do. Thanks for your help everyone!

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

It didn't work, I ended up with 3000+ Errors in the package files and some java files.

I also tried the jar method, but eclipse wouldn't recognize it.

Am I doing something wrong?

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

Ok. Here you go.

In the screenshot it shows my use of the COFH libraries and they are imported.

Maybe you can spot something out of place?

 

Image Link:

 

Error 1

 

Description

Resource Path

Location

Type

 

Array constants can only be used in initializers

BlockHelper.java

/.org.eclipse.jdt.core.external.folders/src/main/java/cofh/lib/util/helpers line 45

Java Problem

 

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

Array constants can only be used in initializers

BlockHelper.java

/.org.eclipse.jdt.core.external.folders/src/main/java/cofh/lib/util/helpers line 45

Java Problem

Is that one of errors?

Try to: reinstall your workspace anв refresh project. There's something strange with it...

Posted

I found the Issue, It was me using the incorrect COFH lib for the version of forge. I will upgrade to the latest and see what happens.

Or.. I could downgrade COFH.

I'm getting weird errors.

 

BiMap map = ((BiMap) registry.registryObjects);

RegistryNamespaced.underlyingIntegerMap.func_148746_a(object, id);

 

1.

 

The field RegistrySimple.registryObjects is not visible

RegistryUtils.java

/.org.eclipse.jdt.core.external.folders/src/main/java/cofh/lib/util line 43

Java Problem

 

 

Image Link:

 

I found where these are declared, but I'm not sure how to access them. I've never had to deal with such tight coding before.

Private, Protected, Inheritance. I hate 'em all. Too complicated.

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

No. What you're doing is very, very bad. You are copying the entirety of CoFH Lib, not just the API. This not only goes against the wishes of the CoFH team, but will likely cause many crashes. In order to use CoFH mods in the dev environment, you must copy the CoFH AT into src/api/resource/CoFH_at.cfg and re-setup your workspace.

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

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

Developer of many mods

Posted

@shadowfacts

Ok, Thanks.

I copied the text from the site (CoFH_at.cfg) and created a .cfg file and pasted it at the location.

So this should work? I only want the API so machines and stuff can work properly.

Also the Rand() function looks like fun.

 

I've added a Thanks to you.

 

UPDATE:

It didn't work. I copied the text into C:\Test_Mod\src\api\java\resource\CoFH_at.cfg

There is text in the file and no other CoFH libraries present in the project.

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

So... Copy the CoFH Lib files to my directory?

I don't understand what to do.

All I have is the Config file, the CoFH lib file and the CoFH jar file.

Only the CoFH config file is where it's supposed to be.

I'm preparing a Dropbox link to my entire project file.

There is no src code at the moment until this cofh stuff

is setup properly.

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

What are you guys even doing?

 

Make a new folder called

api

inside the

src

folder. Inside that, make a folder called

java

. This is where the API code goes. Now copy the API (e.g. the RF API) to that folder. It will result in a structure like this:

 

- src

    - main

        - java

            - [your own source code]

    - api

        - java

            - cofh

                - ...

 

Why use the API folder? Gradle will compile your code with the API, but not include it in your own source.

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/

Posted

That would work, but if OP's project is going to be standalone, the RF API would need to be included in his jar.

 

OP: Create a fresh project. Copy the source code of the RF API into src/main/java. Then write your mod.

 

You only need to include the CoFH AT if you are using CoFH mods in your development environment.

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

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

Developer of many mods

Posted

Okay, I only want my project to use the machines from thermal expansion, though it will not be a requirement for the mod to have thermal expansion installed.

Users should be able to play the mod regardless of whether or not any CoFH mod is installed.

Here is a Link to my current workspace:

https://www.dropbox.com/s/xy6n1f0xtikov23/EpicFoodMod.zip?dl=0

It is a zip file and contains my active project, minus src code, cause I haven't written any.

 

So yes @shadowfacts, that would make my project standalone I guess.

The only question I have left is,

Will it cause issues for someone who actually has CoFH installed?

 

Update: All is working fine, though my question above still stands.

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

Posted

No it will not cause issues if someone has CoFH mods installed alongside yours, presuming you included the RF API correctly.

 

In your case, you will need to add the CoFH AT to src/api/resources otherwise any CoFH mods you put in your dev env will crash.

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

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

Developer of many mods

Posted

Ok then.

Thanks to everyone for your help.

Watch out for my mod hitting the forums soon.

It'll be a big one.

Now, I've got a lot of work to do.

 

CausticLasagne.

Keep it Real!

▒█▀▀▀█ █░░█ █▀▀█ █▀▀ █▀▀█ ▒█░▒█ █░░ ▀▀█▀▀ █▀▀█ █▀▀█ ▒█▀▄▀█ █▀▀ █▀▀▀ █▀▀█ ░█▀▀█ █░░░█ █▀▀ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █

░▀▀▀▄▄ █░░█ █░░█ █▀▀ █▄▄▀ ▒█░▒█ █░░ ░░█░░ █▄▄▀ █▄▄█ ▒█▒█▒█ █▀▀ █░▀█ █▄▄█ ▒█▄▄█ █▄█▄█ █▀▀ ▀▀█ █░░█ █░▀░█ █▀▀ ▀

▒█▄▄▄█ ░▀▀▀ █▀▀▀ ▀▀▀ ▀░▀▀ ░▀▄▄▀ ▀▀▀ ░░▀░░ ▀░▀▀ ▀░░▀ ▒█░░▒█ ▀▀▀ ▀▀▀▀ ▀░░▀ ▒█░▒█ ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▄

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.