By default, Minecraft Forge does not load dependencies from the classpath unless they are explicitly declared as mods. These steps outline how to remedy this. This guide assumes that:
- You are on ForgeGradle 5 or higher.
- You are on Forge 1.17.1 (37.0.13) or higher.
To configure your Java libraries to be loaded by Forge, you should use the minecraftLibrary
configuration provided by ForgeGradle.
You now must make sure to declare your dependencies using minecraftLibrary
configuration.
For example, you may have a line in dependencies {}
that looks something like this:
minecraftLibrary 'com.example:examplething:1.0.0'
When using regular Java libraries not provided by Minecraft Forge, it is important to keep in mind that these libraries will disappear when you build your mod jar by default. This means the libraries will no longer exist when we try to use them from a normal Minecraft Forge installation. To fix this, you must set up either shading or Jar-in-Jar.
This can be done by configuring the gradle shadow plugin. See this guide which is specific to Minecraft Forge.
See this article on the Forge Community Wiki and consult the Forge discord for help.
@Hades32 Please use the forge discord at https://discord.gg/forge