HaydenAPI

Quick rating

Community listing page, reviews here may not be monitored by the author.

HaydenAPI

No reviews yet

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

Mod Loaders
NeoForge
Fabric
Quilt
Minecraft

Community voices

Reviews

List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Show per page
10
25
50
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

About

Project Details

Type
Mod
Latest Version
[1.21.1] HaydenAPI v1.0.4

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

CurseForge ID

Resources

External Links

Source Issues Wiki Discord

About

Description

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.

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

~220,000
Downloads
Last Updated
Created
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works