Masas minecraft modding setup
Siirry navigaatioon
Siirry hakuun
Summary / description
The basic idea of my eclipse workspace setup is this:
- I start with a clean, empty workspace.
- I then import the 'forge' directory (inside where the mdk was extracted to, and where ./gradlew setupDecompWorkspace and ./gradlew eclipse were run) into it
- In the 'forge' project's build path configuration, I hit 'Select all' on the 'Order and Export' tab, so that the mods can use the libraries too, when they have this 'forge' project as a dependency
- Then I create a new 'Java project' for each of the mods that I want to have in the workspace, and I select the 'forge' project as a dependency (from the Projects tab in the "New Java Project" menu), so that the mods can see and access the minecraft and forge code and libraries
- For each of those mods/java projects, I add the 'resources' (from modname/src/main/resources) and 'src' (from modname/src/main/java) folders
- I add those 'resources' and 'src' folders as 'source folders' so that the code is visible on the class path (or whatever...)
- And finally all the mods that I want to be loaded with Minecraft, I add in the run configuration Classpath, User Entries section
Step-by-step setup
- I have my directory structure like so:
minecraft_modding minecraft_modding/1.9.x/ minecraft_modding/1.9.x/eclipse minecraft_modding/1.9.x/forge minecraft_modding/1.9.x/minecraft minecraft_modding/1.9.x/mods
- After you have those 4 directories under the 1.9.x directory, then you can change to the minecraft_modding/1.9.x/forge directory, extract the forge mdk there and then run the "gradlew setupDecompWorkspace" and "gradlew eclipse" tasks
- Once those are finished, change to the workspace (what should be completely empty at this point) in minecraft_modding/1.9.x/eclipse
- You can close the welcome screen/tab in Eclipse and change to the Java perspective from the top right, and close the Resources perspective or whatever the default is
- Then goto File -> Import -> General -> Existing project into workspace -> Next
- Then in "Select root directory" select the minecraft_modding/1.9.x/forge directory (where your mdk stuff is) and click Finish
- That should have then added that 'forge' project into your package explorer in Eclipse
- Then right click that forge project in the package explorer, select Build path -> Configure build path
- On the Libraries tab, check that you have 'JRE System Library' in the list only once (in the past it appeared twice at least for me, and that caused problems, so I had to remove one, save, then they would both vanish, so then I would go back and add it back in once)
- Then go to the "Order and Export" tab, hit Select All and then Ok
- Then, assuming you have some mod code somewhere (ie. a mod project under the mods/ directory) ready to be added, do the following steps:
- In the package explorer, right click and select New -> "Java project", give it a name and click Next
- Then on the "Source" tab right click on the 'src' dir it has added and select "Remove from build path", then on the Projects tab click "Add" and select the 'forge' project, then click Finish
- Then from the package explorer, select the src directory under that new project, and hit delete to remove it completely
- Then right click that new project and select New -> Folder
- Then click Advanced -> Link to alternate location, and then browse to the minecraft_modding/1.9.x/mods/modnamehere/src/main/resources and hit Ok
- Then similarly to the above, right click the project and select New -> Folder
- Then click Advanced -> Link to alternate location, and then browse to the minecraft_modding/1.9.x/mods/modnamehere/src/main/java directory, but this time name it 'src' in the "Folder name" field in the eclipse dialog, so that it appears as 'src' in the package explorer too
- Then in the package explorer for both the newly added 'resources' and the 'src' directories, right click them and select "Build path" -> "Use as source folder"
- At this point you should have all the code stuff set up in eclipse, the final step is editing the run configuration so that you can actually launch the game with the mods
- From the top, beside Debug icon, click the down arrow -> Debug configurations
- Under "Java applications" you should see something like forge_Client and forge_Server
- Select the forge_Client one, you can rename it on the top in the Name field, I usually call it 'Ender Utilities - Client' for mine
- On the Main tab everything should be fine (Project: forge and Main class: GradleStart)
- On the Arguments tab, I have this in Program arguments: --width 1280 --height 720 --username=masa_
- In VM arguments, set the JVM memory as you wish, plus the forge argument: -Xms512M -Xmx1024M -DFORGE_FORCE_FRAME_RECALC=true
- Then in the "Working directory", I have "Other" and browse that to the minecraft_modding/1.9.x/minecraft directory in your dir structure
- Then finally on the Classpath tab, you want to add all your mod projects to the User Entries section
- Click "User Entries", then from the right "Add projects", then make sure to unselect the two "Add exported..." and "Add required..." marks on the bottom, select the project you want on the top, and hit Ok
- Then hit Apply on the run configurations window, and you can hit Debug to start minecraft for the first time
- After the first time you run the game through that menu, it should then appear under the little down arrow menu next to the Debug icon where you opened that dialog earlier