Hello all! I've recently fell in love with JetBrains IntelliJ IDEA. However, getting Minecraft modding working with it is bit more difficult than eclipse modding, so I decided to make a tutorial on how I got my modding environment set up!
Within this tutorial you will be setting up modding the way I like it, you may need to modify this to your likings.
Note:
This isn't a modding tutorial! There are lots of them out there and I don't think we need another. However, using IntelliJ IDEA is normally not a topic, so I created this to help those who want to use it.
Step #1: Installation
Install JetBrains IntelliJ IDEA. Then, install MCP, and preferably Minecraft Forge into ".../<yourmodname>/mcp" If you dont know how, look at a modding tutorial.
Step #2: Setting up your modding folder
Locate ".../<yourmodname>"
Create a "source" folder
Create a "common" folder within source (This is where your mod source files go)
Create a "resources" folder within source (This is everything else goes)
Step #3: Setting up IntelliJ (Creating a project)
Open up intellij. If it's your first time, you will be prompted with a welcome screen, if not you will be inside the intellij environment right away. Either way, create a new project by going to File > New Project or simply clicking the new project button.
Once the new windows opens, select "Java Module" on the left side. Now it's time to fill in the fields. Name your project whatever you like, and select ".../<yourmodname>" as the project folder, not "...<yourmodname>/source"! Once thats done, select wherever your Java SDK is installed, Normally within "C:\Program Files (x86)\Java". Do not click "Next" yet! Drop down the "More Settings". For Module Name, input "common". for the content root, select ".../<yourmodname>/source/common". As for module file location, you will have to create a new folder called ".../<yourmodname>/.idea". Make sure project format is ".idea (directory based). Uncheck "Create source root:"!. Hit "Next".
If it prompts you saying ".idea does not exist, IntelliJ will create it", hit "Ok" or "Next"
Bam! You should have a new project! Don't move on to the next step yet though, you still need to set the folder as a source root. Right click in the project window Mark Directory As > Source Root.
Step #4: Setting up IntelliJ (Adding resources & the minecraft source)
Now that the main projects done, Go to File > New Module. For the module name, name it "resources". For content root, select ".../<yourmodname>/source/resources>". For module file location, select ".../<yourmodname>/.idea". Always uncheck "Create source root:"! Once the new module is added, mark it as a source root.
To add a minecraft source module, every step is the same except ofcourse the content root. For the content root, select ".../<yourmodname>/mcp/src/minecraft". Make sure to mark it as a source root, you won't be able to import anything from the minecraft source if you don't!
Now that thats done, lets make sure your mod files can read the minecraft source files & minecraft forge files!
Step #5: Setting up IntelliJ (Setting up dependencies)
Go to File > Project Structure. Within the new window, go to Modules under Project Settings. Select your the common module. Go to the dependencies tab and press the green plus. Select "module dependency", then select minecraft and resources, and click Ok. Next, select the minecraft module. Press the green plus again, and select "jars or directories", then navigate to ".../<yourmodname>/mcp/jars/bin" and select all 4 .jar files in there. Hit ok, and if you're using forge, then add a "library" as a dependency this time. If you already have some libraries, then click "New Library". Otherwise, just navigate to and select ".../<yourmodname>/mcp/lib".
Now that thats done, you can make your own mod classes now! But before you can test your mod, you need to edit your run configurations.
Step #6: Setting up IntelliJ (Editing Run Configurations)
Go to Run > Edit Configurations. Press the green plus and select "Java Application". Name it "Minecraft" or "Client" or anything you like! As the main class, use "Start.java". IntelliJ should notice it for you. For VM options, enter: "-Djava.library.path=bin/natives". For Working Directory, select ".../<yourmodname>/mcp/jars". For Use Classpath of Module, select your common module. Hit ok and everything should work!
And thats it!
Didnt work for you?
If theres anything that doesn't work for you - feel free to:
- Post a reply to the topic
- Ask me on irc, I normally hang out on #minecraftforge and #mcp, feel free to ask me there!
Within this tutorial you will be setting up modding the way I like it, you may need to modify this to your likings.
Note:
This isn't a modding tutorial! There are lots of them out there and I don't think we need another. However, using IntelliJ IDEA is normally not a topic, so I created this to help those who want to use it.
Step #1: Installation
Install JetBrains IntelliJ IDEA. Then, install MCP, and preferably Minecraft Forge into ".../<yourmodname>/mcp" If you dont know how, look at a modding tutorial.
Step #2: Setting up your modding folder
Locate ".../<yourmodname>"
Create a "source" folder
Create a "common" folder within source (This is where your mod source files go)
Create a "resources" folder within source (This is everything else goes)
Step #3: Setting up IntelliJ (Creating a project)
Open up intellij. If it's your first time, you will be prompted with a welcome screen, if not you will be inside the intellij environment right away. Either way, create a new project by going to File > New Project or simply clicking the new project button.
Once the new windows opens, select "Java Module" on the left side. Now it's time to fill in the fields. Name your project whatever you like, and select ".../<yourmodname>" as the project folder, not "...<yourmodname>/source"! Once thats done, select wherever your Java SDK is installed, Normally within "C:\Program Files (x86)\Java". Do not click "Next" yet! Drop down the "More Settings". For Module Name, input "common". for the content root, select ".../<yourmodname>/source/common". As for module file location, you will have to create a new folder called ".../<yourmodname>/.idea". Make sure project format is ".idea (directory based). Uncheck "Create source root:"!. Hit "Next".
If it prompts you saying ".idea does not exist, IntelliJ will create it", hit "Ok" or "Next"
Bam! You should have a new project! Don't move on to the next step yet though, you still need to set the folder as a source root. Right click in the project window Mark Directory As > Source Root.
Step #4: Setting up IntelliJ (Adding resources & the minecraft source)
Now that the main projects done, Go to File > New Module. For the module name, name it "resources". For content root, select ".../<yourmodname>/source/resources>". For module file location, select ".../<yourmodname>/.idea". Always uncheck "Create source root:"! Once the new module is added, mark it as a source root.
To add a minecraft source module, every step is the same except ofcourse the content root. For the content root, select ".../<yourmodname>/mcp/src/minecraft". Make sure to mark it as a source root, you won't be able to import anything from the minecraft source if you don't!
Now that thats done, lets make sure your mod files can read the minecraft source files & minecraft forge files!
Step #5: Setting up IntelliJ (Setting up dependencies)
Go to File > Project Structure. Within the new window, go to Modules under Project Settings. Select your the common module. Go to the dependencies tab and press the green plus. Select "module dependency", then select minecraft and resources, and click Ok. Next, select the minecraft module. Press the green plus again, and select "jars or directories", then navigate to ".../<yourmodname>/mcp/jars/bin" and select all 4 .jar files in there. Hit ok, and if you're using forge, then add a "library" as a dependency this time. If you already have some libraries, then click "New Library". Otherwise, just navigate to and select ".../<yourmodname>/mcp/lib".
Now that thats done, you can make your own mod classes now! But before you can test your mod, you need to edit your run configurations.
Step #6: Setting up IntelliJ (Editing Run Configurations)
Go to Run > Edit Configurations. Press the green plus and select "Java Application". Name it "Minecraft" or "Client" or anything you like! As the main class, use "Start.java". IntelliJ should notice it for you. For VM options, enter: "-Djava.library.path=bin/natives". For Working Directory, select ".../<yourmodname>/mcp/jars". For Use Classpath of Module, select your common module. Hit ok and everything should work!
And thats it!
Didnt work for you?
If theres anything that doesn't work for you - feel free to:
- Post a reply to the topic
- Ask me on irc, I normally hang out on #minecraftforge and #mcp, feel free to ask me there!