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 revision Previous revision
Next revision
Previous revision
tutorial:setup [2020/04/06 19:32]
2xsaiko add possibility for project output to be set already
tutorial:setup [2020/09/18 08:48] (current)
siglong Update Fabric API advice
Line 19: Line 19:
  
 You can generate the Minecraft sources for reference (since IDEA already has a decompiler this is only useful for searching through the code) : You can generate the Minecraft sources for reference (since IDEA already has a decompiler this is only useful for searching through the code) :
- Run the ''​genSources''​ Gradle task. If your IDE doesn'​t have Gradle integration,​ then run the following command in the terminal: ''​gradlew genSources''​ (or ''​.gradlew genSources''​ on Linux/​MacOS).+ Run the ''​genSources''​ Gradle task. If your IDE doesn'​t have Gradle integration,​ then run the following command in the terminal: ''​gradlew genSources''​ (or ''​./gradlew genSources''​ on Linux/​MacOS).
        
 === IntelliJ IDEA === === IntelliJ IDEA ===
Line 26: Line 26:
     - Select the project'​s build.gradle file to import the project.     - Select the project'​s build.gradle file to import 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.)
  
 //Optional, but recommended//:​ //Optional, but recommended//:​
Line 31: Line 32:
     - Open the '​Gradle Settings'​ dialog from the Gradle tab.     - Open the '​Gradle Settings'​ dialog from the Gradle tab.
     - Change the 'Build and run using' and 'Run tests using' fields to '​IntelliJ IDEA'.     - Change the 'Build and run using' and 'Run tests using' fields to '​IntelliJ IDEA'.
-    - Go to File -> Project Structure -> Project and set '​Project compiler output'​ to the '​out' ​subdirectory of your project, if it isn't set yet. This directory doesn'​t have to exist, IDEA will create it when compiling the project for the first time. (Tip: Use the '​Project Directory' ​button in the directory select dialog to quickly jump to your project directory.)+    - Go to File -> Project Structure -> Project and set '​Project compiler output'​ to ''​$PROJECT_DIR$/​out''​.
  
 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 ''​./​gradlew idea''​ as it messes up with gradle and breaks develop environment.
  
 === Eclipse === === Eclipse ===
Line 40: Line 43:
 === 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 by Microsoft, please follow [[tutorial:​vscode_setup|these instructions]]
 +
 +==== 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 copying Mixin Target References (JVM Descriptors).
 +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.
  
 ==== Generator ==== ==== Generator ====
-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:+If you are unable to use the MinecraftDev plugin or the [[https://​github.com/​FabricMC/​fabric-example-mod/​|fabric-example-mod]] repo, 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:
   - Download latest release of GeneratorFabricMod [[https://​github.com/​ExtraCrafTX/​GeneratorFabricMod/​releases|here]] and extract them.   - Download latest release of GeneratorFabricMod [[https://​github.com/​ExtraCrafTX/​GeneratorFabricMod/​releases|here]] and extract them.
   - Make a new directory, then run a command shell there and type ''​path/​to/​GeneratorFabricMod/​bin/​GeneratorFabricMod''​.   - Make a new directory, then run a command shell there and type ''​path/​to/​GeneratorFabricMod/​bin/​GeneratorFabricMod''​.
   - After letting it get its dependencies,​ follow the instructions and input required information.   - 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.   - You're now done, just open the project folder with in your IDE.
- 
-==== MinecraftDev IntelliJ IDEA Plugin ==== 
-If you are using IntelliJ IDEA you can use Earthcomputer'​s experimental fork of the MinecraftDev plugin. This fork adds support for automatically generating Fabric projects as well as some mixin related features like inspections and generating accessors. 
-You can follow [[https://​github.com/​Earthcomputer/​MinecraftDev/​blob/​dev_new/​readme.md#​installation|these instructions]] to install the plugin. 
- 
 ===== Getting started ===== ===== Getting started =====
 Try [[tutorial:​items|adding an item]] or [[tutorial:​blocks|a block]]. It's also a good idea to visit [[tutorial:​applychanges|Applying changes without restarting Minecraft]]. Try [[tutorial:​items|adding an item]] or [[tutorial:​blocks|a block]]. It's also a good idea to visit [[tutorial:​applychanges|Applying changes without restarting Minecraft]].
  
 ===== 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.
tutorial/setup.1586201542.txt.gz · Last modified: 2020/04/06 19:32 by 2xsaiko