Fix stuff being broke in IntelliJ
This article was formerly published on my Github account here. It was during a time when ForgeGradle didn't work well with 1.12 mods. Since most users don't mod 1.12 anymore, it's mostly historical information, but I'll leave it up in case someone finds a use for it.
When compiling mods in recent versions of IntelliJ, weird things start happening:
- With ForgeGradle 2 (1.12-), none of the assets show up in-game (language keys, models, textures etc)
- Broken hotswapping.
- Potentially other Bad, Terrible Things that are yet to be discovered.
Hotswapping is broken / Resources are broken
- Open Settings (head to File -> Settings).
- Expand "Build, Execution, Deployment".
- Expand "Build Tools".
- Expand "Gradle".
- Under the right pane, under "Build and Run", change both from "Gradle" to "IntelliJ Idea".
- Restart IntelliJ (quick way: is File -> Invalidate Caches / Restart -> Just Restart)
You will need to change this once for every project.
You also may have to set the project build directory after configuring this, since IntelliJ forgot; just use the
build/ directory (in the root of your project, adjacent to
src/, probably already exists if you compiled it before).
genIntelliJRuns-generated run configs are erroring
(This probably doesn't happen in 1.13+, but it certainly does in 1.12-)
- Open the Run/Debug configurations dialog (expand the run configs dropdown -> Edit Configurations...)
- Under "Use classpath of module", change it to the one that ends in ".main"
- Do this for each run configuration.
IntelliJ changed its model of how Gradle tasks are executed. Resources get put in a different folder from where ForgeGradle expects to find them, hot-swapping doesn't work, etc.
Thanks to Tama for figuring out the resources issue on MMD. Thanks to Paul Fulham for pointing out that it also breaks hotswapping and by "pointing out" I mean that he found out the hard way and had to find out how to fix it. I'm just posting this somewhere I can link to it.