Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Using an Api with forge


Recommended Posts

well I've done of modding in the past but I recently took an interest in using various api to interconnect one of the mods I have been working on since 1.3


I'm currently trying to use thaumcraft 3's api, and considering looking into industrial craft and such as well in the future but for now what I'm trying to figure out for either is the same


what is it that you must do in the setup to be able to use an external api


I know there is information on the tutorials page however it appears as though things are no longer the the same as they were, and I have yet to find a working guide for the current setup





Most people spend their time fearing what they already know, but unfortunately what they really have to fear is what they don't know

Link to comment
Share on other sites

After you install Forge, go to your MCP/src/Minecraft/ folder. Post the unzipped API in there. It's instantly accessible and usable within Eclipse or whichever other editor you use.


For Thaumcraft's API specifically (and GregTech's), there will be various errors within the API files themselves as you open Eclipse. Find any errored lines within the affected classes, and literally delete the lines/methods until there's no more errors. The API files themselves won't be included in your mod, so provided the methods themselves aren't deleted from the API, you should get no reobf errors and it should function correctly in-game.


Note that the APIs will be dumped into your reobf folder. Ignore them completely. This is because the updatemd5 script is being skipped because, meh, it's effort to make it work if you use any API outside of Forestry's.

Link to comment
Share on other sites

  • 2 weeks later...

Since I can't seem to find this anywhere, what about for APIs that don't distribute their source docs? Like RenderPlayer API and Player API? Obviously some people have used these in their mods already, but no reference on how to decompile them.


Far be it form me to complain about an API that someone is releasing for free out to the masses, but the installation instructions for modders is....lacking?


I'm a fairly new modder but a long-time programmer, and I'm finding myself less than gruntled on the modding documentation in general; but back to topic, does anyone know how to get these APIs into the project?

"The Gentle Way... My @$$!"

-average new judo student upon learning the meaning of the word Judo in Japanese

Link to comment
Share on other sites

I am also trying to make a mod with a parent mod - even having the source to the api does not make it possible to actually run the mod in the development client.  As far as I can tell, you need to decompile the mod with the minecraft source, but as Forge does all that for you in one step, I'm not sure how it is *supposed* to be done.


If you have the API, but not the API *source*, you should be able to include the API as an external jar using Eclipe's Project > Properties > Libraries menu.  This won't help you with getting your development client working, as below, but it should make it so you have access to the types and so forth provided by the API Jar file.


I have been collecting some information about how to do this at http://www.minecraftforge.net/wiki/Developing_Addons_for_Existing_Mods. Perhaps it will be of help to you.  If not, if you figure it out, perhaps you can add to this.


I agree about the state of the documentation, although the Generic Mod documentation was very helpful for getting started.  My impression is that the community is still very fractured.  Some of the major mod creators tend to look down on people who create mods that use their mods, and others get pissy about it.  Then there is BuildCraft!  But, I don't need pipes.  So.

Link to comment
Share on other sites

I'll dig into that info, I hadn't come across it yet. If I figure anything out here, I'll post my solution. If I didn't keep getting sidetracked with these nuisance issues... and all this trying has pretty much screwed up my development environment beyond repair. Probably going to have to begin at scratch again. :P

"The Gentle Way... My @$$!"

-average new judo student upon learning the meaning of the word Judo in Japanese

Link to comment
Share on other sites

Ok, I believe I've found the solution. I had figured out a little bit on my own, but then came across the APiI developer's FAQ on another API which filled in the holes for me. Here's the scoop.


1) install forge as usual

2) run install.bat(sh) etc...

3) rename /src to /src_forge

4) replace the minecraft.jar file located in the /mcp/jars directory with one modded with the API you need to decompile

5) run mcp/cleanup.bat(sh)

6) run mcp/decompile.bat(sh)

7) copy the appropriate source files to the correct /src_forge/ directory

8) rename or delete /src (to /src_decompile/ or something)

9) rename /src_forge back to /src


That's it.

Thank you to Divisor for producing these APIs as well as the instructions I've paraphrased above. I found these on his Player API forum post, though I do not believe they were on his RenderPlayer API forum post (which was the API I first targeted).


Some people may think, "well duh...." but my feeling is the more times it's spelled out online, the more likely someone will find it when they search.


I guess a similar process can be followed for other APIs when src is not included. Let me know if this hits the spot, I'll be testing the whole process tonight.

"The Gentle Way... My @$$!"

-average new judo student upon learning the meaning of the word Judo in Japanese

Link to comment
Share on other sites


Imported the files specified by Divisor in his instructions, but had so many errors in the java, I didn't know even where to start. over a hundred. a few looked like easy fixes, but the rest appeared to be too complicated for me as a mere mortal to attempt to fix.



API developers, please release the .java files if you intend to make your API widely used.


"The Gentle Way... My @$$!"

-average new judo student upon learning the meaning of the word Judo in Japanese

Link to comment
Share on other sites

I don't really understand step 4 of the instructions.  The external mod can't have modified minecraft.jar itself, right?  It should just add other jar files to the minecraft system.  Otherwise how could you have more than one mod at a time?

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.

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.


  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Here is my configuration: % java -version java version "18.0.2" 2022-07-19 Java(TM) SE Runtime Environment (build 18.0.2+9-61) Java HotSpot(TM) 64-Bit Server VM (build 18.0.2+9-61, mixed mode, sharing) forge-1.19-41.1.0-mdk on macOS Monterey 12.5 I ran the command: ./gradlew genEclipseRuns and was hoping it will generate the Eclipse project files for me. The run log is at https://gist.github.com/arun-gupta/06b983a6976b4c0a0f510d0dc225ddd3 and the generated directory structure is at https://gist.github.com/arun-gupta/3f5bfc70ec5d3d903b0f97d42840abda. In previous versions (1.12-ish), it used to generate an eclipse directory but 1.19 does not seem to have it. I tried opening the top-level forge directory but Eclipse does not recognize it as a project as well. How do I open this project in Eclipse now?  
    • I didn't put in credentials, I used it only for testing installing forge. But still the problem mentioned above.
    • I am trying to use Forge 1.18.2, I have checked my firewall, redownloaded Forge, deleted the fml.toml file (which keeps reappearing) and looked at countless help pages. I am just trying to download and use forge so that I can play with my friends and it will not download. It tells me there may be an issue with the Java runtime config and that the exit code is one, and I have copied the exit code.   
    • Okay, i think i understand but im getting issues, i create another packet to sync entity to another players like this package com.naim.belloto.networking.packet; import com.naim.belloto.networking.handler.ClientSyncHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.network.NetworkEvent; import java.util.Objects; import java.util.function.Supplier; public class ClientSyncPacket { public ClientSyncPacket() { } public ClientSyncPacket(FriendlyByteBuf buf) { } public void toBytes(FriendlyByteBuf buf) { } public boolean handle(Supplier<NetworkEvent.Context> ctx) { NetworkEvent.Context context = ctx.get(); context.enqueueWork(() -> { assert Minecraft.getInstance().player != null; int idplayer = Minecraft.getInstance().player.getId(); DistExecutor.unsafeCallWhenOn(Dist.CLIENT,() -> () -> ClientSyncHandler.handlePacket(ctx, idplayer)); }); return true; } } And in the handler: public class ClientSyncHandler { public static boolean handlePacket(Supplier<NetworkEvent.Context> ctx, int idPlayer) { Minecraft.getInstance().level.getEntity(idPlayer); return true; } } But is not working :// 
  • Topics

  • Create New...

Important Information

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