How to get Spongeforge to find Forge packages


I’m working my way through figuring out how to make a Minecraft mod plugin using the Intelij Minecraft addon so bare with me.

I have created the project with Spongeforge and Forge, and both directories have been made. I have a directory in my project called ‘tools-sponge’ that has a src -> main -> java -> packages. I have an identical directory called ‘tools-forge’ that has a src -> main -> java -> packages. In Spongeforge, when a command is executed, I want it to call a function in the Forge package like: doThing(Player p). However, Spongeforge doesn’t know about the Forge side of things and I can’t import anything. How do I get the Forge packages to hook into the Spongforge side?

So the Minecraft Development addon for Intelij adds many things however it handles the code part of things using Gradle/Maven (depending on which you selected), meaning that importing and stuff is handled by Intelij, not SpongeForge or anything like that.

This means that your Forge API code cannot be found if I cannot be imported (If you can import Forge without SpongeForge then you can with SpongeForge). Because you selected Forge when creating the project, what should have happened is in your maven “POM.xml” file or Gradle “build.gradle” file should have added the forge dependancy (as well as what forge requires such as MCP) to that file. So that is the first thing I would check (maybe a error occured when creating the project and that part got skipped for XYZ reason).

After that I would refresh the dependencies of gradle/maven (right click the project and then select maven then select “refresh dependencies” ->gradle run the “build --refresh-dependencies” command) which will redownload Forge and all required stuff.

If thats still not working, go into “project settings” and select your projects module, then select the dependies tab and check for Forge in there, if its not there then gradle/maven is failing which there are many reason for that. However if it is there, make sure the tag next to all dependencies is “provided” (except the ones that your plugin requires to be built with)

Hope that helps.

Thank you, this pushed me in the right direction towards figuring the issue out

Hope its working

It might be. It complies but I don’t know if I hooked everything up right because I’m getting another issue with class not found at runtime. I’ve created another topic about it that has more information