HaydenAPI
A multi-purpose API library for Minecraft mod and plugin development with universal compatibility for various loaders.
Key Features
- Configuration API: Universal settings system compatible with Spigot/Paper, Fabric and NeoForge, allowing unified approach for different platforms.
Planned Features
- Data Components API: Multi-functional system for modifying item properties, providing flexible attribute management for both vanilla and modified objects.
For Users
This library is essential for proper functioning of the author's future modifications. The main advantage is simplified updates when Minecraft versions change. Installation requires placing the .jar file in the mods or plugins directory.
For Developers
HaydenAPI provides tools for solving common problems when creating multi-platform solutions, including work with data packets, configurations, and components.
Configuration System
Simple annotation-based system allows quick parameter setup for your project.
To create a configuration class, mark it with @Config annotation, after which the system will automatically recognize the configuration.
Class variables become configuration parameters using the @Entry annotation. Additional features:
@Comment(String comment)- adding explanations for parameters@Reloadable- changes apply instantly without reload
Usage example:
@Config
public class Configuration {
@Entry
@Comment("Player join message")
public static String welcomeMessage = "Welcome to the server!";
@Entry
@Reloadable
@Comment("Message of the day")
public static String messageOfTheDay = "Today is a great day! :)";
}
Access to values works like regular variables. API automatically manages changes.
Fabric usage:
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);
}
});
}
Configuration file management methods:
ConfigurationAPI#createConfig(String path, Class<T> configClass)- creates configuration file if not existsConfigurationAPI#saveConfig(String path, Class<T> configClass)- saves and reloads valuesConfigurationAPI#reloadConfig(String path, Class<T> configClass)- reloads from file system Implementation example:
public static void init() {
try {
ConfigurationAPI.createConfig(".\config\welcomeMessage.json5", Configuration.class);
ConfigurationAPI.reloadConfig(".\config\welcomeMessage.json5", Configuration.class);
} catch (ConfigurationException e) {
e.printStackTrace();
}
}
Dependency Setup
Add to build.gradle:
repositories {
maven {
name = 'BehindTheScenery Team Maven'
url = '<a href="" target="_blank" rel="nofollow">https://maven.behindthescenery.online/repository/maven-public/'</a>
}
}
dependencies {
modImplementation "dev.denismasterherobrine:haydenapi-${rootProject.modloader}:${rootProject.haydenapi_version}@jar"
}
In gradle.properties:
modloader = fabric
haydenapi_version = 1.0.2
Available loader options: fabric (Fabric/Quilt), neoforge (NeoForge), common (Paper/Spigot).