Today, I wanted to add a mod for development purposes without manually placing it in the run folder. I discovered that I could use Gradle to add mods more easily. This should work on Intellij IDEA and Eclipse.
Steps to Add Mods for Development Purposes (or Mods your Mod Depends on)
1. Locate your build.gradle file:
In your build.gradle
file, look for a section called dependencies
. If it’s not there, you can add it manually:
dependencies {
runtimeOnly "curse.maven:item-collectors-395620:6018121"
}
In this example we added the Item Collectors mod. https://www.curseforge.com/minecraft/mc-mods/item-collectors
Here’s what each part means:
curse.maven
is the repository for downloading mods from CurseForge.item-collectors
is the mod’s name, taken from the URL.395620
is the mod’s ID, found on the mod page’s right sidebar underProject ID
6018121
is the file ID, specific to the version we need. For example, selecting Game Version 1.21.4 and NeoForgeItem Collectors 1.1.10 for NeoForge 1.21.4
gives ushttps://www.curseforge.com/minecraft/mc-mods/item-collectors/files/6018121
, where 6018121 is the file ID.
2. Refresh Gradle in your IDE:
After adding the dependency, an option to refresh Gradle should appear in your IDE. Click on it to refresh.
3. Launch your client:
Once Gradle is refreshed, you can launch your client, and the mod should be available.
This method is not only useful for adding mods for development purposes but also for adding dependencies your mod needs.
I hope this guide helps you!