Setting up workspace | mcmod.dev

Tutorials CustomQuests Generator (1.x.x) CustomQuests Wiki (2.x.x)

Introduction

Hello, I'm vincentmet. I've been playing minecraft since the beta 1.8, playing modded since 1.4.7, and starting making minecraft mods myself since 1.6.4. But now I have decided I want to give some of the modding knowledge back to the new modders under us.

In this Modding tutorial for 1.14.4 we will making a mod called "Randomly Creative". Almost all tutorials in this 1.14.4 series will be created in this mod's environment.

Downloading the IDE

Before we start making mods, we first need to setup a development environment. The easiest way to do this is to use an IDE called 'Intellij IDEA'.

To download Intellij IDEA, go here!

Downloading Forge

After installing the IDE, go here and download either the latest or the recommended build of the version you want to mod (I'll be using version 28.2.0 for now).
(Note: You need the MDK download here, not one of the others.)

Create a new folder in which you want to create your workspace, then unzip the file you just downloaded into this folder. It should look something like this:

To clean the folder up a bit, we can remove some of the credits files, license files, etc. But make sure to read them first before deleting.

Editing the build.gradle

Before we start, we also need to edit one or two files. First, open the 'build.gradle' file with a regular text editor, i.e. Notepad++, Sublime text (or Vim 😏). As you can see there's a lot of stuff to look at. First I like to remove a lot of the comments and unnecessary newlines, so the file is more readable. The files looks like this now:


        

As you can see, I also removed the

property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

and the

property 'forge.logging.console.level', 'debug'

lines, which basically dumps registry information that just fills up the log and makes it hard to debug the mod.

The first variable you should probably change is 'version'. When I start of a new project I usually set it to '1.14.4-0.0.1'; the '1.14.4' being the minecraft version, and the '0.0.1' being my mod version. I would really recommend you putting the minecraft version in the version, so that when people look at the mod's jar file, they see your mod's name, the minecraft version and your mod's version in one blink of an eye.
(More information can be found here)

For the 'group', you should put you domain + an unique identifier for the mod, to make sure you won't have duplicate packages/files when launching the game. In my mods, I use 'com.vincentmet.*' (the astrix being the modid for the specific mod) because I own the domain 'vincentmet.com'. But for the sake of this tutorial I'll be using the domain 'dev.mcmod.randomlycreative'.
(Note: mod id should be all lowercase, and can only contain a-z, 0-9 and _; and be max 63 characters; although keeping it short and just all lowercase letters and nothing else, is convention)

The 'archivesBaseName' is relatively simple, since it's basically the piece of text that goes in front of the version in the final mod jar. Usually this is the modid or the name of the mod without spaces, but it can be whatever you want.

So far we have:


        

Inside 'minecraft > mappings' we will update the mappings the the latest build, by updating the date in the version to today. (Note: today's snapshot might not always be available because of timezones, use the one from yesterday in that case)

Next up we change inside 'minecraft > runs > * > mods' the 'examplemod' to your modid you chose before.

It'll look something like this now:


        

Last part of the editing the 'build.gradle' file is changing the attributes inside 'jar > manifest > attributes'. It doesn't really matter what you change it to, but I just like to change it to my modid and name.


        

And that's it for editing the gradle file.

Editing the .gitignore

This part isn't required if you'll not be using git, but these are some entries I like to block to prevent some shenanigans when other users clone your mod from git. These files and folders are mainly project files, output files and files the others will get anyway when setting up their forge environment. This is by no means a full list, but just some for starting out.
The '.gitignore' file looks like this now:


        

Importing the project into Intellij IDEA

Open Intellij IDEA, and click on 'Import Project', then navigate to the 'build.gradle' you just edited and click on it. You don't need to change any of the settings that appear, just click 'OK' to continue. IDEA will open, and will start setting up the project for you, wait till it has finished. After it has, click on the 'Gradle' tab on the right side of the window, and navigate to 'Tasks > fg_runs > genIntellijRuns' and click it. Once it has finished, the workspace has been set up.
(For the next tutorials, a handy shortcut for IDEA: Hover over a not yet imported class and press 'Alt'+'Enter' to import the class)