Masas minecraft modding setup

Kulmapaikasta
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.11.x/
 minecraft_modding/1.11.x/eclipse
 minecraft_modding/1.11.x/forge
 minecraft_modding/1.11.x/minecraft
 minecraft_modding/1.11.x/mods
  1. After you have those 4 directories under the 1.11.x directory, then you can change to the minecraft_modding/1.11.x/forge directory, extract the forge mdk there and then run the ./gradlew setupDecompWorkspace and ./gradlew eclipse tasks
  2. Once those are finished, change to the workspace (what should be completely empty at this point) in minecraft_modding/1.11.x/eclipse
  3. 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
  4. Then goto File -> Import -> General -> Existing project into workspace -> Next
  5. Then in Select root directory select the minecraft_modding/1.11.x/forge directory (where your mdk stuff is) and click Finish
  6. That should have then added that forge project into your package explorer in Eclipse
  7. Then right click that forge project in the package explorer, select Build path -> Configure build path
  8. 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)
  9. Then go to the Order and Export tab, hit Select All and then Ok
  10. Then, assuming you have some mod code somewhere (ie. a mod project under the mods/ directory) ready to be added, do the following steps:
  11. In the package explorer, right click and select New -> Java project, give it a name and click Next
  12. 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
  13. Then from the package explorer, select the src directory under that new project, and hit delete to remove it completely
  14. Then right click that new project and select New -> Folder
  15. Then click Advanced -> Link to alternate location, and then browse to the minecraft_modding/1.11.x/mods/modnamehere/src/main/resources and hit Ok
  16. Then similarly to the above, right click the project and select New -> Folder
  17. Then click Advanced -> Link to alternate location, and then browse to the minecraft_modding/1.11.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
  18. 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
  19. 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
  20. From the top, beside Debug icon, click the down arrow -> Debug configurations
  21. Under Java applications you should see something like forge_Client and forge_Server
  22. Select the forge_Client one. You can rename it on the top in the Name field, I usually just call it Ender Utilities - Client for my main Ender Utilities debug configuration
  23. On the Main tab everything should be fine (Project: forge and Main class: GradleStart)
  24. On the Arguments tab, I have this in Program arguments: --width 1280 --height 720 --username=masa_
  25. In VM arguments, set the JVM memory as you wish: -Xms1024M -Xmx2048M
  26. Then in the Working directory, I have Other and browse that to the minecraft_modding/1.11.x/minecraft directory in your dir structure
  27. Then finally on the Classpath tab, you want to add all your mod projects to the User Entries section
  28. Click User Entries, then from the right, click Add projects, then make sure to unselect the two Add exported... and Add required... checkmarks on the bottom, select the project you want on the top, and hit Ok
  29. Then hit Apply on the run configurations window, and you can hit Debug to start minecraft for the first time
  30. 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