
Ok so, I first thought that the ./gradlew clean and the ./gradlew genSources runClient command would fix the issue, just like one user commented in a reddit post of this subreddit, but the issue was far deeper than I thought. To not make make this longer than it should, I'll go step by step from the most important setup configurations to the VScode issues. I'm not an experienced programmer, so please don't laugh at me for explaining stuff that should be basic programming knowledge. I'll explain whatever I need to explain for a beginner like me to not fall into the same traps.
This manual is for Windows users, specifically people who want to use VScode to create a mod for the 26.1 version of Minecraft because that is what I'm trying to do, but maybe this manual could also help people trying to do mods with other versions.
Step 1: Install correct JDK
As of today, the latest version is JDK 25 LTS. I recommend you unninstall any other java versions to not have any possible conflicts.
Part of the problems I had were caused by me installing the JDK for my User instead of installing it for every user in the machine, so this manual is for those who don't want to install the JDK for every user in their machine and instead they want to keep it isolated inside their user.
Step 2: Checking System Variables
For this part it is important to understand the the CMD and the VScode terminal are NOT the same. The VScode terminal is a powershell, its syntax is different to the CDM. For this part please do NOT have VScode open, close it.
Open the cmd and run the command echo %JAVA_HOME%, it should return C:\Users\USER\AppData\Local\Programs\Eclipse Adoptium\jdk-25.0.2.10-hotspot. Now run the command where java, it should return to you a list of file paths that point to many different java.exe files, but it is important that the very first file path must be C:\Users\USER\AppData\Local\Programs\Eclipse Adoptium\jdk-25.0.2.10-hotspot\bin\java.exe.
If all these values are correct, feel free to skip to step 4. If any of those are wrong, please follow to the next step:
Step 3: Fixing System Variables
- Open Environment Variables (press Win key, type
Environment Variables). - In the User variables section (top half), check if the
JAVA_HOMEvariable exists.- If it does exist, double click it to change its value to
C:\Users\USER\AppData\Local\Programs\Eclipse Adoptium\jdk-25.0.2.10-hotspot*(Notice: no**\binat the end, just the JDK root folder. Also replaceUSERwith the username you're currently using in your machine.) - If it does Not exist, click the button New.
- Variable name:
JAVA_HOME - Variable value:
C:\Users\USER\AppData\Local\Programs\Eclipse Adoptium\jdk-25.0.2.10-hotspot(Notice: no\binat the end – just the JDK root folder. Also replaceUSERwith the username you're currently using in your machine.) - Click OK.
- Variable name:
- If it does exist, double click it to change its value to
- Now double-click the
Pathvariable in the User variables section to check its values. You will see that there are many file paths stored insidePath, but it is important that you don't touch ANY of them if it is not absolutely necessary. - Check every value inside
Pathto see ifC:\Users\USER\AppData\Local\Programs\Eclipse Adoptium\jdk-25.0.2.10-hotspot\binexists.- If it does exist, click it and press the Move Up button at the right side as much as needed until it is the very first value of the list.
- If it doesn't, click the button New and type
C:\Users\USER\AppData\Local\Programs\Eclipse Adoptium\jdk-25.0.2.10-hotspot\bin*(replace*USERwith the username you're currently using in your machine.). Then press the Move Up button at the right side as much as needed until it is the very first value of the list.
- Click OK on all windows.
Step 4: VScode and the Fabric Mod Template
Go to https://fabricmc.net/develop/template/ and follow the steps in the website until you download your mod template. Then extract the folder wherever you want >!(Obviously it should be somewhere that doesn't interfeer with other programs or somewhere you will remember where it is)!<. Now right-click that folder and open it using VScode.
Inside VScode, go to the extensions and install the ones that are listed inside this tutorial, but don't follow it any further than that.
As of today, It is important to point out that the Fabric Template HAS AN ERROR, and we're going to fix it:
In the side-panel file explorer, go to the build.gradle file. Inside it, scroll down until you stumble with the following code block:
tasks.withType(JavaCompile).configureEach {
it.options.release = 25
}
This code is WRONG. If you open a terminal and you run the ./gradlew genSources runClient command with this part of the code being wrong you'll be greeted by the following error message:
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':compileJava' (type 'JavaCompile').
- Gradle detected a problem with the following location: 'D:\yourfilepath\yourminecraftmod\.gradle\loom-cache\minecraftM
Reason: Task ':compileJava' uses this output of task ':genCommonSourcesWithVineflower' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':genCommonSourcesWithVineflower' as an input of ':compileJava'.
2. Declare an explicit dependency on ':genCommonSourcesWithVineflower' from ':compileJava' using Task#dependsOn.
3. Declare an explicit dependency on ':genCommonSourcesWithVineflower' from ':compileJava' using Task#mustRunAfter.
For more information, please refer to https://docs.gradle.org/9.4.1/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
* Try:
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
BUILD FAILED in 15s
3 actionable tasks: 3 executed
To prevent this, we need to change tasks.withType(JavaCompile).configureEach. Just copy the following code and replace that part of the code with:
tasks.withType(JavaCompile).configureEach {
it.options.release = 25
dependsOn 'genCommonSourcesWithVineflower'
dependsOn 'genClientOnlySourcesWithVineflower'
}
Step 5: Finally, we enjoy
Create a new terminal in VScode and run the command ./gradlew genSources runClient. Finally, Minecraft opens.
Some of my comments
>I hope this helps any beginners like me at the moment. I'm dissapointed that I had to heavily rely on stackoverflow, Deepseek, and my own research to fix my problem instead of getting sombody's help. Maybe this kind of tutorial can incentivize much more experienced modders to give more detailed answers by asking people in need any detail that they need to diagnose the problem and solve the issue. But anyway, I'm sure I'll stumble upon more problems as I keep developing my mod, and I'll keep trying to document my findings.