An example mod for Minecraft Forge 1.8.9, based on the official Forge Mod Development Kit.
This example mod comes in 3 flavors, each in a separate branch, change branch to see the other examples :
| Branch | Description |
|---|---|
| master | a basic example mod |
| mixins | an example mod with mixins ready |
| mwe-addon | an addon for my mod MWE |
- Install IntelliJ IDEA Community Edition.
- Download the source code of this branch as a zip : master.
- Create a folder that will contain your project and extract the contents of the zip in it.
- In IntelliJ, click New project from existing sources and select the
build.gradlefile. - (Optional) Install the Minecraft Development plugin via
Ctrl+Alt+S > Plugins, then restart IntelliJ. - Set the project SDK to Java 8 via
File > Project Structure(Ctrl+Alt+Shift+S). IntelliJ can download one for you. - In the Gradle panel, open
Build Tool Settings > Gradle Settings(wrench icon) and set Gradle JVM to the same Java 8 JDK. - Under
Tasks > forgegradle, runsetupDecompWorkspace, then restart IntelliJ.
Common tasks:
forgegradle > runClient– launch a Minecraft client to test your modbuild > build– compile your mod into a usable.jarfound intoExampleMod/build/libsbuild > clean– clear cached build files if you run into issues
To make the mod your own you need to update these files:
| File | Edit |
|---|---|
gradle.properties | Edit all the fields |
Package com.example.examplemod | Rename via Shift+F6 |
The modid should never change, it is used as a unique identifier by forge.
| Keybind | Action |
|---|---|
Shift Shift | Search everything |
Ctrl+N | Search Java files |
Ctrl+Shift+F | Search text in all files |
Ctrl+Click / Ctrl+B | Go to declaration |
Alt+Enter | Show fixes/suggestions |
Alt+F7 | Find usages |
Shift+F6 | Rename element |
Ctrl+Alt+L | Reformat code |
Ctrl+Alt+O | Optimize imports |
Ctrl+/ | Toggle comment |
Alt+Insert | Generate code |
Ctrl+Alt+S | Open settings |