Back to mods
HaydenAPI project artwork

CurseForge · Minecraft mod

HaydenAPI

An simple-yet-powerful API library for my own needs when doing Minecraft modding.

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which HaydenAPI release should I use?

Updated 1 year ago
Latest stable file [1.21.1] HaydenAPI v1.0.4
Game version 1.21, 1.21.1
Loader NeoForge

HaydenAPI [1.21.1] HaydenAPI v1.0.4 targets 1.21, 1.21.1 with NeoForge. The project page does not say whether this file belongs on the client, dedicated server, or both. No extra mods listed for this file.

Where it goes

Is HaydenAPI required on the client, server, or both?

The project page does not say whether this file belongs on the client, dedicated server, or both.

Client Source doesn’t say
Dedicated server Source doesn’t say
Loader for this release NeoForge
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source does not explicitly classify this release as client-only or server-only.

What else does HaydenAPI [1.21.1] HaydenAPI v1.0.4 need?

[1.21.1] HaydenAPI v1.0.4. Change the file and its required mods may change too.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add HaydenAPI without breaking your instance.

Built for HaydenAPI [1.21.1] HaydenAPI v1.0.4. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use [1.21.1] HaydenAPI v1.0.4. It targets 1.21, 1.21.1 with NeoForge; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    The project page does not say whether this file belongs on the client, dedicated server, or both.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside [1.21.1] HaydenAPI v1.0.4. It opens that exact file at the source.

About this project

What does HaydenAPI add?

HaydenAPI


An simple-yet-powerful API library for my own needs when doing Minecraft modding.

Current Features

  • Configuration API. Multi-loader compatible configuration system compatible both with Spigot/Paper, Fabric and NeoForge ecosystems.

Planned Features

  • Data Components API. Multi-loader compatible attribute and components API to handle item properties modifications to allow data-driven changes for both vanilla, plugin-handled and modded items.

For Users

This API is required for some of my future mods, so mods could be updated much easier each time the game version changes. Put the .jar file into the mods or plugins folder and you're ready to go!

For Developers

This API allows you to use different APIs for multi-loader solutions to handle problematic parts of the plugins or mods such as packets, configs, data attachments and components.

Configuration API

HaydenAPI provides annotation-driven configuration system with easy-to-use annotations.

To specify the configuration class, you should specify @Config before class instantiation. When the class is marked with the annotation, it will be recognized automatically.

Define the required variables in the class with respective types. To turn the variable into the config entry, you should use @Entry annotation.

You can also mark the variable with @Comment(String comment) to define a comment for it. If you need a variable that needs to be reloaded each time the user changed it without relaunching the game or server, you should mark the variable with @Reloadable

Example:

@Config
public class Configuration {
    @Entry
    @Comment("Which message you would like to show each time the player joins?")
    public static String welcomeMessage = "Welcome to the server!";

    @Entry
    @Reloadable
    @Comment("Which message you would like to show each time the player joins?")
    public static String messageOfTheDay = "Today is a cool day! :)";
}

To use the entry value from the config, just act as it is a default variable, the API will handle the changes.

Example: (Fabric)

    public static void onPlayerJoin() {
        ServerPlayConnectionEvents.JOIN.register((ServerPlayNetworkHandler player, PacketSender packetSender, MinecraftServer server) -> {
            if (player.player != null) {
                player.player.sendMessage(Text.of(Configuration.welcomeMessage), false);
            }
        });
    }

Need to mention, that you need to initialize the config file and reload it's values if the user changed them using a text editor.

ConfigurationAPI#createConfig(String path, Class<T> configClass) - creates (if not exists) a configuration file with specified path to place and filename and structure defined in the class with @Config annotation.

ConfigurationAPI#saveConfig(String path, Class<T> configClass) - save and reloads the values of the entries if they're was changed in your code and validates the data within the configuration file structure provided by the class.

ConfigurationAPI#reloadConfig(String path, Class<T> configClass) - reloads the config from the file system and validates the data within the configuration file structure provided by the class.

Example:

    public static void init() {
        try {
            ConfigurationAPI.createConfig(".\\config\\welcomeMessage.json5", Configuration.class);
            ConfigurationAPI.reloadConfig(".\\config\\welcomeMessage.json5", Configuration.class);
        } catch (ConfigurationException e) {
            // Here you can handle the validation errors or any other issues with the configuration file and use default values if you need to.
            e.printStackTrace();
        }
    }

Dependency Setup

In your build.gradle you need to declare HaydenAPI's maven (or CurseMaven, if you wish to) and use modImplementation dependency handler to load the library into your development environment.

repositories {
    maven {
        name = 'BehindTheScenery Team Maven'
        url = 'https://maven.behindthescenery.online/repository/maven-public/'
    }
}

dependencies {
    modImplementation "dev.denismasterherobrine:haydenapi-${rootProject.modloader}:${rootProject.haydenapi_version}@jar"
}

And in gradle.properties:

modloader = fabric
haydenapi_version = 1.0.2

Note, that you can change the fabric (Fabric/Quilt development environment) to neoforge (NeoForge development environment) or common (Paper/Spigot development environment)) to specify the required version of the HaydenAPI to be used in your development environment.

Project description from CurseForge.

Pick your setup

HaydenAPI by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

6 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

HaydenAPI versions and loaders

4 of 4 releases match

Looking for an older file? The official CurseForge project page is in Resources.