This is an example mod for minecraft forge 1.8.9 to create your first mod. It is directly taken from the official forge mod development kit.
- Install the code editor IntelliJ IDEA Community Edition
- Start IntelliJ, click
get from VCSand paste the git URL of this repository : https://github.com/Alexdoru/ExampleMod1.8.9.git and create a new project from that - (Optional) Open settings
Ctrl+Alt+S, searchPluginsand in the plugins marketplace search and install the Minecraft Development plugin, restart IntelliJ to complete installation - Once you are in the code editor, top left click
File>Project Structureor doCtrl+Alt+Maj+sand set the project SDK to a java version 8 JDK, Intellij should give you the option to download one - Open the gradle window on the right, click the wrench to open the
Build Tool Settings>Gradle settingsand set theGradle JVMto the same java 8 JDK you used above - In the gradle window under
Tasks>forgegradlerun thesetupDecompWorkspacetask, once it is done restart Intellij - Running the task
Tasks>forgegradle>runClientwill start a minecraft client to test your mod - Running the task
Tasks>build>buildwill compile your mod into a usable.jarfile that will be found in the folderExampleMod>build>libs - Running the task
Tasks>build>cleanwill clean a bunch of cached files allowing you to make a clean build afterward in case you have issues building
Congratulations! You built your first mod!
The source code of you mod in found under src>java. To make the mod your own, you need to edit the following files :
- in
ExampleMod.javaedit theMODID,MODNAME,VERSION - in
build.gradleedit theversion,group, andarchivesBaseName - in
mcmod.infoedit"modid","name", but don't touch"version"and"mcversion" - in the package explorer select the package
com.example.examplemodhitShift+F6to rename it
The modid and modname should be the same in all these files. I added a bunch of comments in all the files to guide you
Have fun!
Shift + Shiftopen the search everything boxCtrl+Nopen search box to browse java filesAlt+EnterShows code suggestions/fixes on the selected elementCtrl+Shift+Fopen search box to search text in all the filesCtrl+Alt+Sopen IntelliJ settingsCtrl+ClickorCtrl+Bto navigate to declaration of selected elementAlt+F7search usages of the selected elementShift+F6rename the selected elementCtrl+Alt+LReformat the code of the current file according to your code formatting settingsCtrl+Alt+Oreorganizes imports statements of your current java fileCtrl+/comment/uncomment to selected line(s) of codeAlt+Insershow suggestions of code generation