Skip to content

Tutorial: Contributing

Martijn edited this page Dec 27, 2022 · 25 revisions

This tutorial quickly shows you how to set up a fork of Gale so that you can make a pull request that modifies existing patches or adds new patches.


    ℹ️    This tutorial is written for Gale,    
             but you can follow the same steps on any other fork!    
 

Requirements beforehand

    ✔  You need to know how to open a command terminal and run commands

    ✔  You need to know how to use Git.
           If you don't know Git, check out a tutorial online (for example this one).
           Specifically, you should know how to do an interactive rebase in Git: git rebase -i
           (Check out this video, for example)

    ✔  You will need 6+ GB of free RAM

    ✔  You must have installed Java JDK 17 or higher

    ✔  You must have installed IntelliJ IDEA
           (Other IDEs are much harder to use for this project)

    ✔  (Windows only) On Windows: you should install WSL:

          ●   Open PowerShell and type wsl --install
          ●   Open a wsl command line (type wsl into Start and press Enter)
          ●  Install Java JDK 17 on WSL by running this command in the WSL command window:
              sudo apt-get update && sudo apt-get upgrade && sudo apt install openjdk-17-jdk openjdk-17-jre
          ●   Do everything in this tutorial on WSL

          (It is possible without WSL, but 100 things can go wrong, so I don't recommend it)

1. Fork the project

Setting up the project is not a one-click step, but it's pretty easy.

1.1. Create a fork of the GitHub project

  • Click Fork in the top-right corner of the Gale project page

    Click "Fork" in the top-right corner of the Gale project page

  • Click Create a new fork

    Click "Create a new fork" from the dropdown menu

  • Click Create fork

    Click "Create fork"

    You will now be on the repository page for your own fork of Gale,
    (for example: on https://github.com/<username>/Gale)

1.2. Clone the repository to your machine

  • On your own fork's page, click the green Code button

    TODO IMAGE

  • Copy the URL shown
    (which will be something like https://github.com/<username>/Gale)

    TODO IMAGE

  • Open IntelliJ IDEA

  • File > New > Project from Version Control...

  • In the URL field, paste the URL you copied earlier
    (for example, I would paste https://github.com/MartijnMuijsers/Gale.git)

  • Choose the directory to place Gale in


        ℹ️    (Windows only) Remember that you should use a WSL directory like    
                 \\wsl$\Ubuntu-20.04\home\martijn\minecraft_stuff\Gale    
     
  • Clone

2. Learn how Paperweight works

Now, if you don't know how Paperweight works yet, read through this simple explanation. Then, continue with the next step.

3. Get the full editable server code

3.1. Apply the patches

To apply the patches, you can use the command line, or you can use the Gradle functions in IntelliJ (by default, there is a vertical Gradle button on the right).
Normally, I use the command line, because we also need to do interactive rebases in Git anyway.
I will primarily use the command line below, except when setting up IntelliJ properly (because IntelliJ sometimes only understands Gradle projects when you build the project from within IntelliJ at least once).

  • In a command terminal, navigate to the Gale folder you just created
    (if you type ls and you see a file called .editorconfig and a file called gradlew, you are in the right folder)


        ℹ️    (Windows only) Remember that you should use a WSL command window    
     
  • Run the following command: ./gradlew applyPatches


        ⚠️   This step needs a lot of memory!    

    For some systems, you need at least 6+ GB of free RAM, but on other systems,
    you need at least 10+ GB of free RAM!
    If you do not have enough memory, you will get a very vague error saying the task failed, without an explanation.

    This happens because decompiling the vanilla and Spigot jars takes a lot of memory.
    Every time Minecraft or Spigot is updated, the jars need to be decompiled one time.

    The code should now be ready to use in the gale-server and gale-api folders.

3.1. Set up the IntelliJ project

  • We need to make sure the project is properly set up in IntelliJ. Maybe it immediately works on your machine.

4. Brand your fork

Clone this wiki locally