User Tools

Site Tools


tutorial:setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:setup [2020/07/27 23:18] – [MinecraftDev IntelliJ IDEA Plugin] Upstream now supports Fabric comp500tutorial:setup [2021/09/17 14:46] – some tweaks siglong
Line 2: Line 2:
  
 ===== Prerequisites ===== ===== Prerequisites =====
- +   * A Java Development Kit (JDK) for Java 16 (recommended) or newer. Visit [[https://adoptopenjdk.net/]] for installers. 
-   * A Java Development Kit (JDK) for Java (recommended) or newer [[https://adoptopenjdk.net/]]+       * If you are professional, you can obtain a JDK from [[http://jdk.java.net/]], which needs to be extracted and have system variables set up manually.
    * Any Java IDE, for example [[https://www.jetbrains.com/idea/download/#section=windows|Intellij IDEA]] and [[https://www.eclipse.org/downloads/|Eclipse]]. You may also use any other code editors, such as [[https://code.visualstudio.com/|Visual Studio Code]].    * Any Java IDE, for example [[https://www.jetbrains.com/idea/download/#section=windows|Intellij IDEA]] and [[https://www.eclipse.org/downloads/|Eclipse]]. You may also use any other code editors, such as [[https://code.visualstudio.com/|Visual Studio Code]].
 +       * 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  ====
 +If you are using IntelliJ IDEA you can use the [[https://plugins.jetbrains.com/plugin/8327|MinecraftDev plugin]].
 +This plugin adds support for automatically generating Fabric projects as well as some mixin related features like inspections,
 +generating accessors/shadow fields, and copying Mixin Target References (JVM Descriptors).
 +You can install it using IntelliJ's internal plugin browser by navigating to File → Settings → Plugins,
 +then clicking the Marketplace tab and searching for Minecraft.
  
 ===== Mod Startup ===== ===== Mod Startup =====
-There are two main ways to make a new mod for Minecraft based on Fabric. You can either manually download fabric-example-mod and setup by yourself, or use automatic tools for you.+There are two main ways to make a new mod for Minecraft based on Fabric. 
 +You can either manually download fabric-example-mod and setup by yourself, or use automatic tools for you
 + 
 +**NOTE:** The template in the mcdev plugin blindly uses the latest unstable version of the loom. Use with caution.
  
 ==== Manual Steps ==== ==== Manual Steps ====
-   - Copy the starting files from [[https://github.com/FabricMC/fabric-example-mod/|fabric-example-mod]] (or from [[https://github.com/natanfudge/fabric-example-mod-kotlin|the Kotlin version]], if you wish to use Kotlin,) excluding the ''LICENSE'' and ''README.md'' files - as those apply to the template itself, not necessarily to your mod.+   - Copy the starting files from [[https://github.com/FabricMC/fabric-example-mod/|fabric-example-mod]] (or from [[https://github.com/SmushyTaco/Example-Mod/|the Kotlin version]], if you wish to use Kotlin,) excluding the ''LICENSE'' and ''README.md'' files - as those apply to the template itself, not necessarily to your mod.
    - Edit ''gradle.properties'':    - Edit ''gradle.properties'':
        * Make sure to set ''archives_base_name'' and ''maven_group'' to your preferred values.        * Make sure to set ''archives_base_name'' and ''maven_group'' to your preferred values.
-       * Make sure to update the versions of Minecraft, the mappings and the loader - all of which can be queried through [[https://modmuss50.me/fabric.html|this website]] - to match the versions you wish to target.+       * Make sure to update the versions of Minecraft, the mappingsthe loader and the loom - all of which can be queried through https://fabricmc.net/versions.html - to match the versions you wish to target.
        * Add any other dependencies you plan to use in ''build.gradle''.        * Add any other dependencies you plan to use in ''build.gradle''.
    - Import the build.gradle file to your IDE. You may refer to the next section for specific IDE's.    - Import the build.gradle file to your IDE. You may refer to the next section for specific IDE's.
    - Happy modding!    - Happy modding!
  
-You can generate the Minecraft sources for reference (since IDEA already has a decompiler this is only useful for searching through the code) +If you are unable to use the mc plugin or the fabric-example-mod, you may also use [[https://github.com/ExtraCrafTX/GeneratorFabricMod|GeneratorFabricMod]] by ExtraCrafTX, a convenient tool to automatically generate new fabric mods from template. Follow these steps
- Run the ''genSources'' Gradle taskIf your IDE doesn't have Gradle integration, then run the following command in the terminal: ''gradlew genSources'' (or ''./gradlew genSources'' on Linux/MacOS)+  - Download latest release of GeneratorFabricMod [[https://github.com/ExtraCrafTX/GeneratorFabricMod/releases|here]] and extract them. 
-   +  - Make a new directory, then run command shell there and type ''path/to/GeneratorFabricMod/bin/GeneratorFabricMod''. 
 +  - After letting it get its dependencies, follow the instructions and input required information. 
 +  - You're now done, just open the project folder with in your IDE
 === IntelliJ IDEA === === 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:
Line 35: Line 49:
  
 Unfortunately, it is currently impossible to set an IDE-wide default for the 'Build and run using' and 'Run tests using' options, so these steps have to be repeated for every new project. Unfortunately, it is currently impossible to set an IDE-wide default for the 'Build and run using' and 'Run tests using' options, so these steps have to be repeated for every new project.
 +
 +**NOTE:** Don't run the ''idea'' gradle task. It is known to break development environment.
  
 === Eclipse === === Eclipse ===
-If you are using Eclipse and you would like to have the IDE run configs you can run ''gradlew eclipse''.+If you are using Eclipse and you would like to have the IDE run configs you can run ''gradlew eclipse''. The project can then be imported as a normal (non-gradle) Eclipse project into your workspace using the 'File' - 'Import...' menu, then 'General' -> 'Existing Projects into Workspace'.
  
 === Visual Studio Code === === Visual Studio Code ===
-If you are using VSCode by Microsoft, please follow [[tutorial:vscode_setup|these instructions]]+If you are using VSCode, please follow [[tutorial:vscode_setup|these instructions]].
  
-==== Generator ==== +===== Generating Minecraft Sources ===== 
-You may also use [[https://github.com/ExtraCrafTX/GeneratorFabricMod|GeneratorFabricMod]] by ExtraCrafTXa convenient tool to automatically generate new fabric mods from templateFollow these steps: +Reading the Minecraft source is an essential part of modding. 
-  - Download latest release of GeneratorFabricMod [[https://github.com/ExtraCrafTX/GeneratorFabricMod/releases|here]] and extract them+Unfortunatelywe can't publish the Minecraft source because it violates the Minecraft EULA. 
-  - Make a new directorythen run command shell there and type ''path/to/GeneratorFabricMod/bin/GeneratorFabricMod''+You need to generate the Minecraft yourself
-  - After letting it get its dependencies, follow the instructions and input required information+ 
-  You're now done, just open the project folder with in your IDE.+To generate the Minecraft sourcerun the ''genSources'' gradle task
 +If your IDE doesn't have gradle integration, run the following command in the terminal: ''gradlew genSources'' (or ''./gradlew genSources'' on Linux/MacOS)
 +It can take a while depends on your computer power
 +You may need to refresh gradle after running the task.
  
-==== MinecraftDev IntelliJ IDEA Plugin ==== 
-If you are using IntelliJ IDEA you can use the MinecraftDev plugin. This plugin adds support for automatically generating Fabric projects as well as some mixin related features like inspections, generating accessors/shadow fields, and the Copy Mixin Target Reference context menu option. 
-The plugin can be found [[https://plugins.jetbrains.com/plugin/8327|in the IntelliJ plugin repository]] so you can install it using IntelliJ's internal plugin browser, by navigating to File → Settings → Plugins, then clicking the Marketplace tab and searching for Minecraft. 
  
 ===== Getting started ===== ===== Getting started =====
Line 57: Line 73:
  
 ===== 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!+  * 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, with development of fabric-loom (our Gradle build plugin) issues may crop up which require resetting the cache files. This can be done by running ''gradlew cleanloom''. Running ''gradlew %%--%%stop'' can also help with a few rare issues.   * Occasionally, with development of fabric-loom (our Gradle build plugin) issues may crop up which require resetting the cache files. This can be done by running ''gradlew cleanloom''. Running ''gradlew %%--%%stop'' can also help with a few rare issues.
   * 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.
Line 64: Line 80:
  
 ==== Missing sounds ==== ==== Missing sounds ====
- 
 Sometimes, when importing the Gradle project into an IDE, the assets might not download correctly. In this case, run the ''downloadAssets'' task manually - either using IDE's built-in menu or by simply running ''gradlew downloadAssets''. Sometimes, when importing the Gradle project into an IDE, the assets might not download correctly. In this case, run the ''downloadAssets'' task manually - either using IDE's built-in menu or by simply running ''gradlew downloadAssets''.
  
tutorial/setup.txt · Last modified: 2024/06/30 00:02 by 2600:387:c:6c19::9