Setting up a Mod Development Environment

From Ornithe Wiki
Jump to navigation Jump to search

This article is a guide on how to set up an Ornithe mod development environment.

Before You Get Started

If you have no prior experience with programming in Java, it is strongly recommended you learn at least the basics first. Here are some resources to help you on your way:

Ornithe modding is essentially the same as Fabric/Quilt modding. There are, however, a few key differences. If you are not familiar with Fabric/Quilt modding, you may peruse their documentation (here for Fabric, here for Quilt), though it is not required to follow this guide.

The Mod Template

The mod template is a bare bones mod development project. It has all the necessary elements, and can be customized to suit your own needs. You can visit the repository on GitHub at https://github.com/OrnitheMC/ornithe-mod-template/.

Using the Template

The first step is to create a new repository from the template. In the Create a new repository dialog, make sure to select the Include all branches option.

Next, you must choose the correct branch for your project. Which branch to choose depends on the mod loader of your choice, and the Minecraft version your mod will be targeting.

  • fabric/merged for a Fabric mod for Minecraft 1.3 or later.
  • fabric/split for a Fabric mod for Minecraft 12w30e or earlier.
  • quilt/merged for a Quilt mod for Minecraft 1.3 or later.
  • quilt/split for a Quilt mod for Minecraft 12w30e or earlier.

You may rename the chosen branch to main (or otherwise as you see fit) and discard the others.

Setting up the Project

Once you have prepared your new repository, you can clone it to your computer and import the project into your IDE.

Next, it's time to configure the project for the target Minecraft version. The gradle.properties file contains the versions for key dependencies. Visit https://ornithemc.net/develop/ to look up the latest versions. Then edit the values for the following fields.

  • minecraft_version: the Minecraft version your mod will be targeting.
  • loader_version: the version of the mod loader.
  • osl_version: the version of OSL (Ornithe Standard Libraries).

Some dependencies are different for Minecraft versions before 1.3 compared to 1.3 and later. These dependencies may also not be available at all for the Minecraft version your mod is targeting. In that case you will also need to make changes to the build.gradle file.

Dependencies for Minecraft 1.3 or Later

Edit the values for the following fields in the gradle.properties file.

  • feather_build: the build number of the Feather mappings.
  • raven_build: the build number for Raven.
  • sparrow_build: the build number for Sparrow.
  • nests_build: the build number for Nests.

If Raven is not avaliable, remove the following line from the dependencies { } block in the build.gradle file.

	exceptions ploceus.raven(project.raven_build)

If Sparrow is not avaliable, remove the following line from the dependencies { } block in the build.gradle file.

	signatures ploceus.sparrow(project.sparrow_build)

If Nests are not avaliable, remove the following line from the dependencies { } block in the build.gradle file.

	nests ploceus.nests(project.nests_build)

Dependencies for Minecraft 12w30e or Earlier

Edit the values for the following fields in the client/gradle.properties and server/gradle.properties files.

  • feather_build: the build number of the Feather mappings.
  • raven_build: the build number for Raven.
  • sparrow_build: the build number for Sparrow.
  • nests_build: the build number for Nests.

If Raven is not avaliable, remove the following line from the project.dependencies { } block in the build.gradle file.

	exceptions project.ploceus.raven(project.raven_build)

If Sparrow is not avaliable, remove the following line from the project.dependencies { } block in the build.gradle file.

	signatures project.ploceus.sparrow(project.sparrow_build)

If Nests are not avaliable, remove the following line from the project.dependencies { } block in the build.gradle file.

	nests project.ploceus.nests(project.nests_build)

Updating Mod Metadata

The last step is to update the mod metadata to make it your own.

In the gradle.properties file, update the value of the archives_base_name field. This will be used to construct file name of the compiled mod jar.

In the src/main/resources/ folder, update the mod.json file. This step differs slightly depending on the mod loader you chose to use.

Updating fabric.mod.json

In the fabric.mod.json file, update the following fields.

  • id: the mod id. This ought to be a unique identifier for your mod. It should have only lowercase letters and underscores. Generally, you can use your mod's name, turned all lowercase, and replacing any spaces with underscores. For example, for a mod named My Cool Mod, the mod id could be my_cool_mod.
  • name: the name of your mod.
  • description: a short description of your mod, what it's for and/or what it does.
  • authors: a list of people who made the mod. Add your name(s) to this list.

There are other fields in the mod.json that may be relevant to your mod. Feel free to fill those in or remove them as you see fit.

Updating quilt.mod.json

In the quilt.mod.json file, update the following fields.

  • id: the mod id. This ought to be a unique identifier for your mod. It should have only lowercase letters and underscores. Generally, you can use your mod's name, turned all lowercase, and replacing any spaces with underscores. For example, for a mod named My Cool Mod, the mod id could be my_cool_mod.
  • name: the name of your mod.
  • description: a short description of your mod, what it's for and/or what it does.
  • contributors: a list of people who made the mod. Add your name(s) to this list.

There are other fields in the mod.json that may be relevant to your mod. Feel free to fill those in or remove them as you see fit.

Almost Done!

With the mod template set up and configured, you are almost ready to start working on your mod. You may have to refresh your IDE for the changes to take effect. After that, it's time to write some code!