I want to show you how to set up Forge with the advanced setup method.
3/10 - Relatively easy
The first things are pretty much the same as in the fast setup. First, we have to download the correct version of Minecraft Forge. To do this we go to files.minecraftforge.net. On this website we search for your MC version and choose the Forge version designated as recommended for this MC version. For MC 1.7.2 this would be Forge build 18.104.22.1680.
Now we click on the download button for the "source" of this Forge version. This will start the download of a .zip file. We extract it anywhere with WinRar or IzArc. This will be our root directory. We name it "Forge".
Now we have to open up a command prompt in this directory and type
This will run the Forge installer. If we now get an Error mentioning we haven't set the JAVA_HOME variable we have to create a new environment variable called "JAVA_HOME". The value of this variable is the path to the JDK directory, but without the \bin at the end.
Now we rerun and it should work.
When the downloads and the decompiling of Minecraft has finished (can take some minutes) we have to create the workspace for either Eclipse or IntelliJ IDEA.
If you want to use Eclipse you have to run this command:
If you are familiar with IntelliJ IDEA and want to use this IDE, type this command:
If you want to use IntelliJ IDEA because you have worked with it before, then just use it. For the ones who never worked with either Eclipse or IntelliJ, I recommend to use Eclipse because this is the IDE I will use in this tutorials.
Now we have to start Eclipse. In the workspace dialog we choose a folder for your modding workspace. For this tutorial I now have the following folder structure:
Forge\ (The Forge folder from the first step)
[all Forge stuff]
Tutorial\ (My eclipse workspace)
[all Eclipse stuff]
In Eclipse we first have to create your mod project. To do so, we click on File > New > Project and select "Java Project" in the pop-up window which will appear. Then we should
give your project a name and click finish. Now we have a blank Java project. We now have to add two source folders. One is named "src/java", the other one "src/resources". To add this source
folders we right-click on your project and choose "New source Folder". In the dialog we type the name for the folder in the "Name" field. It is very important that we checkmark "Update exclusion
filters in other source folders to solve nesting".
Don't forget to checkmark "Update exclusion filters in other source folders to solve nesting"!
If you have created the two source folders, you can delete the existing folder "src". We now have a new project with space for code and resources.
This is how the Package Explorer should look like:
(Don't worry if you have a few more folders under the JRE System Library, they are hidden in my screenshot)
Actually we have no access to Minecraft or MC Forge from our workspace. To change this we have to import Forge into your workspace. We click File > Import and choose "Existing Projects into workspace". In the dialog for the import we click the "Browse" button and select your Forge directory (or the eclipse folder inside it, doesn't really matter) as the source to import from. Then we click finish. We ensure that a project named "Forge" is in the list of projects and is checked. If so, we press OK, otherwise you probably chose a wrong directory.
By performing the import, Eclipse linked the Forge workspace to your mod's workspace. We now have access to Forge in your code.
But although Forge has been linked to the workspace it can't be used yet. This is because we have to add Forge to your project's buildpath first. This ensures that the Java compiler compiles your mod and Forge together. We right-click on your Project in the Package Explorer on the left. Then we click on Build Path > Configure. We go to the tab "Projects" and click "Add". We select Forge as the project and click OK.
Now, we could run Minecraft if Eclipse knew which class is the main class. But because Eclipse doesn't know this, we have to create Run Configurations. We select your project in the Package Explorer and click on the drop-down arrow next to the green "Run" button in the top tool bar. In the drop-down menu we click on "Run Configurations". In this dialog we can see all available types of run configurations on the left. We right-click on "Java Application" and click "Add". This creates a new Run Configuration of the type "Java Application", so it will be a program that runs on your local PC.
We name the Configuration "Launch Client".
The Following Run Configuration is suitable for Minecraft Forge Versions below Minecraft 1.7.10. If you have MC 1.7.10 or higher go down to this section.
For the main class in below 1.7.10 we have to write:
We switch to the "Arguments" tab and add the following as "VM Arguments":
For the "Program Arguments" we have to add a little bit more:
--version 1.6 --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --accessToken modstest
Note that "--version 1.6" doesn't define the Minecraft version, so never change it to 1.7.2 or anything else!
If you want to login into the modded Minecraft with your normal MC account you have to add these arguments to the Program Arguments:
Note that for some accounts the username must be replaced with the e-mail address.
Your Run Configuration should look like this:
If you use Minecraft Forge for 1.7.10 or higher there is a much easier Run Configuration:
Note that for some accounts you need to replace the Username with your e-mail address.
You do not need to set VM-Arguments.
Now everything is ready to launch Minecraft. We click in the Run Configuration dialog on "Apply", then on "Run". Now, Minecraft
should start with Minecraft Forge installed. If we get an error we probably have typed something wrong in the arguments tab. If we have run Minecraft once, we can run it again using the green Run
button in the top toolbar.
If Minecraft doesn’t have sound when we start it, we have to navigate to the "eclipse" folder inside of the forge folder and copy the "assets" directory. Then we paste it within the src folder of
your project and minecraft should have sounds. But be warned! This will add about 80 packages containing sounds and stuff to the workspace which makes the package explorer quite full. If you
really need sounds, do it, otherwise leave it. Another possibility would be to create a new source folder for the sounds (right-click on the project -> New... -> Source Folder)
The last thing to do is to add a Run Configuration to launch a Server. To do this, we add a new Run Configuration. We name it "Launch Server". The main class is this one:
For Minecraft 1.7.10 or higher you need to use this Main Class:
For the Server Configuration you don't need any arguments.
To launch a Server, no special arguments are needed. If we click "Apply" and "Run" it will start a MC Server with Forge installed.
When we start a server for the first time, it will crash immediately, because we need to agree to the minecraft EULA (End User Licence Agreement) first. To do this, open the file "eula.txt",
which is created when you run the server, and change the eula setting from false to true. The file is located in your main project folder (There where your src folder is located as well).
Your Run Configuration should look like this:
If you want to report modding problems, please make sure to include the code in a pastebin link or something else! Don't just write "It doesn't work", otherwise your post will be deleted. For more complicated problems, please use the troubleshooter form.