tutorial:setup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:setup [2022/01/30 03:49] – Added What's Next Section outercloudstudio | tutorial:setup [2024/10/29 14:30] (current) – [Minecraft game provider couldn't locate the game] solidblock | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~REDIRECT> | ||
+ | |||
====== Setting up a mod development environment ====== | ====== Setting up a mod development environment ====== | ||
===== Prerequisites ===== | ===== Prerequisites ===== | ||
- | * A Java Development Kit (JDK) for Java 17 (recommended) or newer. Visit [[https:// | ||
- | * If you are professional, | ||
- | * Any Java IDE, for example [[https:// | ||
- | * If you are not familiar with any of these, we recommend to use Intellij IDEA as that is what most people choose for modding. | ||
- | ==== Minecraft Development (mcdev) IntelliJ IDEA Plugin | + | ==== Installing JDK ==== |
- | If you are using IntelliJ IDEA you can use the [[https://plugins.jetbrains.com/plugin/ | + | To develop mods, a Java Development Kit (JDK) is required. Visit [[https:// |
- | This plugin adds support for automatically generating Fabric projects as well as some mixin related features like inspections, | + | * Since 1.20.5, Java 21 or newer is required. |
- | generating accessors/ | + | * Since 1.18, Java 17 or newer is required. |
- | You can install it using IntelliJ' | + | * Since 1.17, Java 16 or newer is required. |
- | then clicking the Marketplace tab and searching for Minecraft. | + | * For older Minecraft |
- | ===== Mod Startup ===== | + | More information about installing Java can be found: |
- | There are two main ways to make a new mod for Minecraft based on Fabric. | + | * Fabric Wiki's player tutorial of installing Java for [[player: |
- | You can either manually download fabric-example-mod and setup by yourself, or use automatic tools for you. | + | * Fabric |
- | **NOTE:** The default template in the mcdev plugin blindly uses the latest unstable version of the loom. Use with caution. | + | ==== Installing an IDE ==== |
- | ==== Manual Steps ==== | + | Before writing your code, you install have any Java IDE installed, for example [[https:// |
- | - Copy the starting files from [[https://github.com/FabricMC/fabric-example-mod/|fabric-example-mod]] (or from [[https:// | + | |
- | - Edit '' | + | If you are not familiar with any of these, we recommend to use Intellij IDEA as that is what most people choose for modding. |
+ | |||
+ | ===== Creatng the project ===== | ||
+ | > Detailed tutorial can be found on [[https://docs.fabricmc.net/develop/getting-started/creating-a-project|Fabric Documentation]] | ||
+ | |||
+ | There are multiple ways to create a project: | ||
+ | * copy template project | ||
+ | * use template generator at [[https:// | ||
+ | * use Intellij IDEA's generator, which requires installing Intellij IDEA's Minecraft Development plugin. | ||
+ | |||
+ | After creating a project, please edit some key files as you wish: | ||
+ | * Edit '' | ||
* Make sure to set '' | * Make sure to set '' | ||
* Make sure to update the versions of Minecraft, the mappings, the loader and the loom - all of which can be queried through https:// | * Make sure to update the versions of Minecraft, the mappings, the loader and the loom - all of which can be queried through https:// | ||
* Add any other dependencies you plan to use in '' | * Add any other dependencies you plan to use in '' | ||
- | - Import the build.gradle file to your IDE. You may refer to the next section for specific IDE's. | + | * Edit '' |
- | - Happy modding! | + | * Change the versions |
- | If you are unable to use the mc plugin or the fabric-example-mod, | + | > :!: As of Minecraft 1.19.2, Fabric API's mod ID has changed from '' |
- | - Download latest release | + | |
- | - Make a new directory, then run a command shell there and type '' | + | |
- | | + | |
- | - You're now done, just open the project folder with in your IDE. | + | |
- | === IntelliJ IDEA === | + | ===== Configuring the project ===== |
+ | |||
+ | ==== IntelliJ IDEA ==== | ||
If you are using IntelliJ IDEA by JetBrains, please follow these steps: | If you are using IntelliJ IDEA by JetBrains, please follow these steps: | ||
- In the IDEA main menu, select ' | - In the IDEA main menu, select ' | ||
- | - Select the project' | + | - Select the project' |
- | - After Gradle is done setting up, close (File -> Close Project) and re-open the project to fix run configurations not displaying correctly. | + | - After Gradle is done setting up, close (File -> Close Project) and re-open the project to fix run configurations not displaying correctly. If the run configurations still don't show up, try reimporting the Gradle project from the Gradle tab in IDEA. You can also manually run '' |
- | - (If the run configurations still don't show up, try reimporting the Gradle project from the Gradle tab in IDEA.) | + | |
- | //Optional, but recommended// | + | **NOTE:** Don't run the '' |
- | By default, IntelliJ delegates to Gradle to build the project. This is unnecessary for Fabric and causes longer build times and hotswapping related weirdness, among other problems. To make it use the builtin compiler: | + | |
- | - Open the 'Gradle Settings' | + | |
- | - Change | + | |
- | - Go to File -> Project Structure -> Project and set ' | + | |
- | Unfortunately, it is currently impossible | + | === Installing Minecraft Developent plugin === |
+ | If you are using IntelliJ IDEA, it is highly recommended | ||
- | **NOTE:** Don't run the '' | + | You can install it using IntelliJ's internal plugin browser by navigating to File → Settings → Plugins, then clicking |
+ | |||
+ | For launching Minecraft and start debugging, see [[https:// | ||
- | === Eclipse === | + | ==== Eclipse |
If you are using Eclipse and you would like to have the IDE run configs you can run '' | If you are using Eclipse and you would like to have the IDE run configs you can run '' | ||
- | === Visual Studio Code === | + | ==== Visual Studio Code ==== |
- | If you are using VSCode, please follow [[tutorial:vscode_setup|these instructions]]. | + | If you are using VSCode, please follow [[tutorial:setup: |
===== Generating Minecraft Sources ===== | ===== Generating Minecraft Sources ===== | ||
Line 64: | Line 69: | ||
To generate the Minecraft source. run the '' | To generate the Minecraft source. run the '' | ||
- | If your IDE doesn' | + | If your IDE doesn' |
It can take a while depending on your computer power. | It can take a while depending on your computer power. | ||
You may need to refresh gradle after running the task. | You may need to refresh gradle after running the task. | ||
See [[tutorial: | See [[tutorial: | ||
- | |||
- | ===== Getting started ===== | ||
- | Try [[tutorial: | ||
===== Advice ===== | ===== Advice ===== | ||
* While Fabric API is not strictly necessary for developing mods, its primary goal is to provide cross-compatibility and hooks where the game engine does not, and as such it is highly recommended! Even some of the tutorials on the wiki implicitly require Fabric API. | * While Fabric API is not strictly necessary for developing mods, its primary goal is to provide cross-compatibility and hooks where the game engine does not, and as such it is highly recommended! Even some of the tutorials on the wiki implicitly require Fabric API. | ||
* Occasionally, | * Occasionally, | ||
+ | * Keep up with the latest Loom version (which is defined in '' | ||
+ | * Keep up with the latest Gradle version, which can be defined in '' | ||
+ | * Different Gradle versions require different Java versions. | ||
+ | * If you're developing mods for old version Minecraft, besides changing '' | ||
* Don't hesitate to ask questions! We're here to help you and work with you to make your dream mod a reality. | * Don't hesitate to ask questions! We're here to help you and work with you to make your dream mod a reality. | ||
===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
+ | |||
+ | ==== "no usages" | ||
+ | After running the '' | ||
==== Missing sounds ==== | ==== Missing sounds ==== | ||
Sometimes, when importing the Gradle project into an IDE, the assets might not download correctly. In this case, run the '' | Sometimes, when importing the Gradle project into an IDE, the assets might not download correctly. In this case, run the '' | ||
+ | |||
+ | ==== Could not find or load class / no JDK module specified | ||
+ | Sometimes the run config may be invalid, reporting errors such as: | ||
+ | * '' | ||
+ | * "no JDK module specified" | ||
+ | |||
+ | There are several fixes, among which one may be a potential fix: | ||
+ | * If you're using Intellij IDEA, go to " | ||
+ | * It seems to be a bug of Intellij IDEA since a recent update 2023.2. To fix, just delete the '' | ||
+ | * If you have subprojects, | ||
+ | * If the issue still happens, edit the run config, and try modifying the module (the value for parameter '' | ||
+ | |||
+ | ==== Minecraft game provider couldn' | ||
+ | Sometimes you may come with some error like: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | This may be because the project path contains non-ASCII characters that may cause incompatibility. Try move the project to paths without non-ASCII characters, or in the run config of " | ||
+ | |||
+ | Another potential fix, is to go to Region Settings in the Settings or Contral Panel of Windows, go to Region Settings, and enable "Beta: Use Unicode UTF-8 for worldwide language support", | ||
+ | ==== " | ||
+ | |||
+ | That may be because you're using Intellij IDEA to build and run. If issue happens, try open the ' | ||
===== What's Next? ===== | ===== What's Next? ===== | ||
- | Create your first [[tutorial:items|item]] | + | Try [[items|adding an item]] |
tutorial/setup.1643514561.txt.gz · Last modified: 2022/01/30 03:49 by outercloudstudio