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 VCS
and 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
, searchPlugins
and 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 Structure
or doCtrl+Alt+Maj+s
and 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 settings
and set theGradle JVM
to the same java 8 JDK you used above - In the gradle window under
Tasks>forgegradle
run thesetupDecompWorkspace
task, once it is done restart Intellij - Running the task
Tasks>forgegradle>runClient
will start a minecraft client to test your mod - Running the task
Tasks>build>build
will compile your mod into a usable.jar
file that will be found in the folderExampleMod>build>libs
- Running the task
Tasks>build>clean
will 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.java
edit theMODID
,MODNAME
,VERSION
- in
build.gradle
edit theversion
,group
, andarchivesBaseName
- in
mcmod.info
edit"modid"
,"name"
, but don't touch"version"
and"mcversion"
- in the package explorer select the package
com.example.examplemod
hitShift+F6
to 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 + Shift
open the search everything boxCtrl+N
open search box to browse java filesAlt+Enter
Shows code suggestions/fixes on the selected elementCtrl+Shift+F
open search box to search text in all the filesCtrl+Alt+S
open IntelliJ settingsCtrl+Click
orCtrl+B
to navigate to declaration of selected elementAlt+F7
search usages of the selected elementShift+F6
rename the selected elementCtrl+Alt+L
Reformat the code of the current file according to your code formatting settingsCtrl+Alt+O
reorganizes imports statements of your current java fileCtrl+/
comment/uncomment to selected line(s) of codeAlt+Inser
show suggestions of code generation