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/02/21 11:42]
mkpoli fix typo and add instruction
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 ===
 If you are using IntelliJ IDEA by JetBrains, please follow these steps: If you are using IntelliJ IDEA by JetBrains, please follow these steps:
-    - Run ''​gradlew idea'' ​first, then import the Project to IDEA+    - In the IDEA main menu, select ​'Import Project' ​(or File -> Open... if you already have a project open). 
-    - In order to run/debug your project, ​go to menu ''​Run -> Edit Configurations...''​. ​In ''​Run/Debug Configuration'' ​dialog, find ''​Application ​Minecraft Client'' ​and change ​''​Use classpath of module'' ​form ''​[ProjectName]''​ to ''​[ProjectName].main'', ​then change ​for ''​Application > Minecraft Server''​ as well. After pressing OK, you will know see Minecraft Client ​and Minecraft Server now showing up at Run/Debug Toolbar.+    - 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
 +    - (If the run configurations still don't show up, try reimporting the Gradle ​project ​from the Gradle tab in IDEA.) 
 + 
 +//Optionalbut recommended//:​ 
 +By default, IntelliJ delegates ​to Gradle to build the projectThis is unnecessary for Fabric and causes longer build times and hotswapping related weirdness, among other problemsTo make it use the builtin compiler: 
 +    - Open the 'Gradle Settings' ​dialog from the Gradle tab. 
 +    - 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 ''​$PROJECT_DIR$/​out''​
 + 
 +Unfortunately,​ it is currently impossible ​to set an IDE-wide default for the 'Build and run using' ​and 'Run tests using' ​optionsso 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 31: 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.
- 
- 
 ===== 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. 
-  * As Fabric is in early development,​ occasionally, with development of fabric-loom (our Gradle build plugin) issues may crop up which require ​a manual clearing (deleting) of the cache (which ​can be found in ''​.gradle/​caches/​fabric-loom''​). Those will generally be announced as they are identified.+  * 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.1582285342.txt.gz · Last modified: 2020/02/21 11:42 by mkpoli