Line 6: |
Line 6: |
| {{Tree list}} | | {{Tree list}} |
| * '''The Mod Development Kit''' | | * '''The Mod Development Kit''' |
− | ** <code>gradle/wrapper/</code> - The folder containing the [https://docs.gradle.org/current/userguide/gradle_wrapper.html Gradle wrapper]'', Forge uses Gradle '''6.9''''' | + | ** <code>gradle/wrapper/</code> - The folder containing the [https://docs.gradle.org/7.4.2/userguide/gradle_wrapper.html Gradle wrapper]'', Forge uses Version '''7.4.2''''' |
| ** <code>src</code> - The sources folder | | ** <code>src</code> - The sources folder |
| *** <code>main</code> - The <code>main</code> source set | | *** <code>main</code> - The <code>main</code> source set |
Line 12: |
Line 12: |
| ***** ... | | ***** ... |
| **** <code>resources</code> - The resources for the <code>main</code> source set | | **** <code>resources</code> - The resources for the <code>main</code> source set |
− | ***** <code>META-INF</code> - The folder for '''metadata inf'''ormation files<ref>[https://stackoverflow.com/a/6075320/14416954 StackOverflow answer]: ''... Basically, if it was stored in META-INF, it was Meta-data Information...''</ref> | + | ***** <code>META-INF</code> - The folder for '''meta'''data '''inf'''ormation files<ref>[https://stackoverflow.com/a/6075320/14416954 StackOverflow answer]: ''... Basically, if it was stored in META-INF, it was Meta-data Information...''</ref> |
− | ****** <code>mods.toml</code> - The [[Proper Mod Structuring#The mods.toml file|<tt>mods.toml</tt> file]], where mods are declared | + | ****** <code>mods.toml</code> - The [[Mods.toml file|<tt>mods.toml</tt> file]], where mods are declared |
| ***** <code>pack.mcmeta</code> - File used by Minecraft to [[mc:Data Pack#pack.mcmeta|identify data and resource packs]] | | ***** <code>pack.mcmeta</code> - File used by Minecraft to [[mc:Data Pack#pack.mcmeta|identify data and resource packs]] |
| ** <code>.gitattributes</code> - Used by [[wikipedia:Git|Git]] for specifying attributes for files<ref>[https://git-scm.com/docs/gitattributes Official git documentation on <tt>.gitattributes</tt>]</ref> | | ** <code>.gitattributes</code> - Used by [[wikipedia:Git|Git]] for specifying attributes for files<ref>[https://git-scm.com/docs/gitattributes Official git documentation on <tt>.gitattributes</tt>]</ref> |
| ** <code>.gitignore</code> - Used by Git for specifying intentionally untracked/ignored files<ref>[https://git-scm.com/docs/gitignore Official git documentation on <tt>.gitignore</tt>]</ref> | | ** <code>.gitignore</code> - Used by Git for specifying intentionally untracked/ignored files<ref>[https://git-scm.com/docs/gitignore Official git documentation on <tt>.gitignore</tt>]</ref> |
− | ** <code>build.gradle</code> - The Gradle buildscript, which defines the project and tasks<ref>[https://docs.gradle.org/6.9/userguide/tutorial_using_tasks.html Gradle User Guide for 6.9: ''Build Script Basics'']</ref> | + | ** <code>build.gradle</code> - The Gradle buildscript, which defines the project and tasks<ref>[https://docs.gradle.org/7.4.2/userguide/tutorial_using_tasks.html Gradle User Guide for 7.4.2: ''Build Script Basics'']</ref> |
| ** <code>changelog.txt</code> - The Forge version changelog | | ** <code>changelog.txt</code> - The Forge version changelog |
| ** <code>CREDITS.txt</code> - Forge's credits/''thank you'' file | | ** <code>CREDITS.txt</code> - Forge's credits/''thank you'' file |
− | ** <code>gradle.properties</code> - The Gradle properties file, for defining additional variables and options<ref>[https://docs.gradle.org/6.9/userguide/build_environment.html#sec:gradle_configuration_properties Gradle User Guide for 6.9: ''Build Environment § Gradle properties'']</ref> | + | ** <code>gradle.properties</code> - The Gradle properties file, for defining additional variables and options<ref>[https://docs.gradle.org/7.4.2/userguide/build_environment.html#sec:gradle_configuration_properties Gradle User Guide for 7.4.2: ''Build Environment § Gradle properties'']</ref> |
| ** <code>gradlew</code> - The *nix shell file for executing the Gradle wrapper | | ** <code>gradlew</code> - The *nix shell file for executing the Gradle wrapper |
| ** <code>gradlew.bat</code> - The Windows batch file for executing the Gradle wrapper | | ** <code>gradlew.bat</code> - The Windows batch file for executing the Gradle wrapper |
| ** <code>LICENSE.txt</code> - File containing the licensing information for Forge and libraries | | ** <code>LICENSE.txt</code> - File containing the licensing information for Forge and libraries |
− | ** <code>README.txt</code> - Readme file with basic setup instructions | + | ** <code>README.txt</code> - Readme file with the basic setup instructions |
| {{Tree list/end}} | | {{Tree list/end}} |
| | | |
Line 32: |
Line 32: |
| #* For '''Eclipse''': <tt>File > Import > Gradle > Existing Gradle Project</tt>, select the folder for the <tt>Project root directory</tt>, click <tt>Finish</tt> | | #* For '''Eclipse''': <tt>File > Import > Gradle > Existing Gradle Project</tt>, select the folder for the <tt>Project root directory</tt>, click <tt>Finish</tt> |
| #* For '''IntelliJ IDEA''': <tt>File > Open</tt>, select and open the folder, select the <tt>build.gradle</tt> file, click <tt>OK</tt>, click <tt>Open as Project</tt> | | #* For '''IntelliJ IDEA''': <tt>File > Open</tt>, select and open the folder, select the <tt>build.gradle</tt> file, click <tt>OK</tt>, click <tt>Open as Project</tt> |
| + | #* For '''Visual Studio Code''': Run <code>./gradlew buildNeeded</code> and then <code>./gradlew eclipse</code>, then <tt>File > Open Folder...</tt> and select the folder |
| # Wait for the setup process to complete and the Minecraft sources are decompiled. | | # Wait for the setup process to complete and the Minecraft sources are decompiled. |
− | # Generate the run configurations for your IDE using the appropriate Gradle task. <br>These tasks can be run on the command line using ''(Windows)'' <code>gradlew gen***Runs</code> or ''(*nix)'' <code>./gradlew gen***Runs</code>. | + | #* For '''Visual Studio Code''': This step can be skipped as it was already done in the previous step |
− | #* For ''Eclipse'': the task is <code>genEclipseRuns</code>; to run in the IDE directly, open the <tt>Gradle Tasks</tt> tab on the bottom panel, ''wait until the tasks have loaded'' then expand the folder, expand the <tt>fg_runs</tt> folder, then double-click <tt>genEclipseRuns</tt>. | + | # Generate the run configurations for your IDE using the appropriate Gradle task. <br>These tasks can be run in the terminal using <code>./gradlew gen***Runs</code>. |
− | #* For ''IntelliJ IDEA'': the task is <code>genIntellijRuns</code>; to run in the IDE directly, open the <tt>Gradle</tt> on the right, expand the project folder, double-click <tt>Tasks > fg_runs > genIntellijRuns</tt>. | + | #* For '''Eclipse''': the task is <code>genEclipseRuns</code>; to run in the IDE directly, open the <tt>Gradle Tasks</tt> tab on the bottom panel, ''wait until the tasks have loaded'' then expand the folder, expand the <tt>fg_runs</tt> folder, then double-click <tt>genEclipseRuns</tt>. |
− | #* For ''Visual Studio Code'': the task is <code>genVSCodeRuns</code> | + | #* For '''IntelliJ IDEA''': the task is <code>genIntellijRuns</code>; to run in the IDE directly, open the <tt>Gradle</tt> on the right, expand the project folder, double-click <tt>Tasks > fg_runs > genIntellijRuns</tt>. |
| + | #* For '''Visual Studio Code''': the task is <code>genVSCodeRuns</code>; the [https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack Extension Pack for Java] and [https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle Gradle for Java plugin] should both be installed for smoother integration. |
| | | |
| {{Tip|The most popular IDEs used by Forge and mod developers are [https://www.eclipse.org/eclipseide/ Eclipse] and [https://www.jetbrains.com/idea/ IntelliJ IDEA]. While Visual Studio Code has a run generation task, because of its relative unpopularity as an IDE for Minecraft modding, the user will have to self-diagnose any issues that may arise from their use of it.}} | | {{Tip|The most popular IDEs used by Forge and mod developers are [https://www.eclipse.org/eclipseide/ Eclipse] and [https://www.jetbrains.com/idea/ IntelliJ IDEA]. While Visual Studio Code has a run generation task, because of its relative unpopularity as an IDE for Minecraft modding, the user will have to self-diagnose any issues that may arise from their use of it.}} |
Line 43: |
Line 45: |
| The MDK provides default values for the buildscript and <tt>mods.toml</tt> file. These values should be replaced with your own mod's information. | | The MDK provides default values for the buildscript and <tt>mods.toml</tt> file. These values should be replaced with your own mod's information. |
| | | |
− | All edits should be done below the <code>apply plugin: 'net.minecraftforge.gradle'</code> line. The lines above it are required for the Forge MDK to work correctly, and should not be modified without proper knowledge. | + | All edits should be done below the <code>id 'net.minecraftforge.gradle'</code> line. The lines above it are required for the Forge MDK to work correctly, and should not be modified without proper knowledge. |
| * All references to <code>examplemod</code> in the buildscript should be replaced with your modid. | | * All references to <code>examplemod</code> in the buildscript should be replaced with your modid. |
| ** Use your IDE's find-and-replace function to quickly replace these values. | | ** Use your IDE's find-and-replace function to quickly replace these values. |
Line 55: |
Line 57: |
| You can test your mod in the development environment using either your IDE's run configurations and built-in debugging utilities, or by running the <code>run*</code> task as defined by the buildscript's run configurations. | | You can test your mod in the development environment using either your IDE's run configurations and built-in debugging utilities, or by running the <code>run*</code> task as defined by the buildscript's run configurations. |
| | | |
− | There are three default run configurations with the MDK: | + | There are four default run configurations with the MDK: |
| * <code>runClient</code>, for starting the client. | | * <code>runClient</code>, for starting the client. |
| * <code>runServer</code>, for starting the dedicated server. ''You will need to accept the EULA through the <tt>eula.txt</tt> after running the server for the first time.'' | | * <code>runServer</code>, for starting the dedicated server. ''You will need to accept the EULA through the <tt>eula.txt</tt> after running the server for the first time.'' |
| * <code>runData</code>, for starting the client in [[Datageneration|data generation]] mode. | | * <code>runData</code>, for starting the client in [[Datageneration|data generation]] mode. |
| + | * <code>runGameTestServer</code>, for starting a build server to run [[Game_Tests|game tests]]. |
| | | |
| {{Tip|Always test your mod in both the client and the dedicated server, even if you are making a one-sided mod. Mods should not crash when running on both sides, and one-sided mods should not crash if they run on the wrong side.}} | | {{Tip|Always test your mod in both the client and the dedicated server, even if you are making a one-sided mod. Mods should not crash when running on both sides, and one-sided mods should not crash if they run on the wrong side.}} |