Getting started - FloppaCoding/AtonAddons GitHub Wiki
Getting started
On this page i will guide you through the first steps you need to take before you can start coding.
There are two things you need to be able to do. First you need to be able to build the mod, second you will need an IDE to help you with coding.
The first thing you will need is the source code for the mod. Get the latest stable version here.
There just click on either of the Source code downloads which look like this.
Unpack the archive to your preferred working directory.
Setting up the IDE
The IDE will be the tool you use to do basically all the work on the mod and it will do a ton of the work for you. There is really only one good choice when it comes to the IDE and that is IntelliJ IDEA. From there download the latest version of the Community Edition for your operating system and install it.
Once that is done open IDEA and from the top left corner select File -> Open...
.
In the window that then opens navigate to the directory to which you unpacked the Source code earlier and click
OK
.
After you opened the project IDEA will take some time to scan project structure and set itself up.
During that it might run into an error that looks like this.
That is caused by a wrong java version. To resolve it open File -> Project Structure...
.
And select a Java 17 SDK from the dropdown in
Project Settings -> Project
. If there is none directly avaliable
there is also an option to download one. It should not matter which one you choose as long as it is Java 17.
But make sure that you select language level 8 in the dropdown below.
Now hit Apply
and it might already resolve the error.
If you still get the error you need to also change your Gradle JVM.
To do so press shift twice and type Gradle JVM
then click the top result or manually navigate to it in the
settings File -> Settings...
.
You should end up with a window looking like the following image.
In the highlighted dropdown select
Project SDK
and hit Apply
.
Now the error should be gone.
Building the mod
There are two ways of building the mod. First I will talk about using a gradle task from within IDEA. This requires you to have done the set-up from the last section. The other option is to build the mod from the command line.
Building the mod from IDEA
In IDEA there is a Gradle tab on the top right of the screen. Expand it and locate
Tasks -> build -> build
. You can then build the mod just by double-clicking that.
Doing so will produce two jar packages, that can be found in ./build/libs/
in your project directory.
The one which ends in dev.jar
is not mapped and will not run. You can just ignore that.
Building the mod from the command line
This way of building the mod does not require you to set up any IDE. But you will need a java 17 JDK added to your path. You can get that here. If you don't already know how to add it to your path or are not familiar with the command line I would not advise going this way.
To build the mod you simply open a command line in the directory where you unpacked the source code and run . /gradlew build
.
This will build the jar, which you can then find in ./build/libs/
.