Skip to content

Using dependencies

Leaxx edited this page Nov 26, 2023 · 2 revisions

Introduction

Dependencies refer to other mods or specific JaLoader versions that your mod relies on to function correctly. Specifying dependencies is crucial for ensuring that your mod works seamlessly in conjunction with other mods or required frameworks. This guide will walk you through the process of declaring dependencies in your mod.

Dependency declaration & format

In your mod's code, you can declare dependencies by overriding the Dependencies property. The format for declaring dependencies is a list of tuples, each containing three elements: ModID, ModAuthor, and ModVersion.

public override List<(string, string, string)> Dependencies => new List<(string, string, string)>()
{
    ("ModID", "ModAuthor", "ModVersion")
};

For specifying JaLoader versions, you need to use this format: ("JaLoader", "Leaxx", "{version}"), where {version} is the required version (for example, 1.2.0).

How do I find the ModID, ModAuthor & ModVersion?

You can find the ModAuthor & ModVersion variables by looking in the mods list. For the ModID, you need to enable Debug Mode from the Modloader settings, restart the game - this makes the mods list show the ModIDs instead of ModNames.

Adding multiple dependencies

If your mod requires more dependencies, you can add more by just adding a comma at the end, like this:

public override List<(string, string, string)> Dependencies => new List<(string, string, string)>()
{
    ("ExampleID", "ExampleAuthor", "1.0.0"),
    ("AnotherExampleID", "AnotherExampleAuthor", "1.1.0")
};

No dependencies

If your mod doesn't have any dependencies, simply return an empty list:

public override List<(string, string, string)> Dependencies => new List<(string, string, string)>()
{
    // No dependencies
};

Clone this wiki locally