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 :
| Mod | Desc |
|---|---|
| Normal | a basic example mod |
| Mixins | an example mod with mixins ready |
| MWE Addon | an addon for my mod MWE |
- Install IntelliJ IDEA Community Edition.
- In IntelliJ, click Get from VCS and paste this repo's URL:
https://github.com/Alexdoru/ExampleMod1.8.9.git. - (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 a.jarintoExampleMod/build/libsbuild > clean– clear cached build files if you run into issues
Source code lives in src/java. Update these files:
| File | Edit |
|---|---|
ExampleMod.java |
MODID, MODNAME, VERSION |
gradle.properties |
Edit all the fields |
Package com.example.examplemod |
Rename via Shift+F6 |
Keep modid/modname consistent across all files. Each file has comments to guide you.
| 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 |