E-Utils: Utility Library for Mod Development
A utility for Fabric mod developers that provides ready-made solutions for common tasks:
They can access pre-existing rather than re-creating them from scratch
- Configuration file management with real-time reloading
- Command system with permission handling
- Framework for creating inventory interfaces
- Additional useful functions and extensions
Including giving access to these classes \ main These functionalities can directly interact, reducing redundant code
Main Features
Configuration Files
Settings support JSONC format with comments, automatic version updates, real-time change tracking, and convenient type handling through Kotlin classes.
Example of configuration:
data class MyConfig(
override val version: String = "1.0.0",
override val configId: String = "mymod"
// Add your parameters here
) : ConfigData
Manager initialization:
val configManager = ConfigManager(
currentVersion = "1.0.0",
defaultConfig = MyConfig(),
configClass = MyConfig::class
)
Command System
Flexible command builder with built-in permission handling, subcommand support, and aliases.
commandManager.command("mycommand", permission = "mymod.command") {
executes { context ->
// Command logic
1
}
subcommand("subcommand") {
executes { context ->
// Subcommand logic
1
}
}
}
UI Components
Simple creation of custom inventory interfaces with buttons, active slots, and dynamic content updates.
CustomGui.openGui(
player = player,
title = "My Interface",
layout = listOf(/ Interface elements /),
onInteract = { context ->
// Handle interactions
}
)
Technical Requirements
Required dependencies:
- Kotlin
- Fabric API
- Fabric Language Kotlin
Usage Examples
Configuration Settings:
data class MyConfig(
override val version: String = "1.0.0",
override val configId: String = "mymod",
var debugMode: Boolean = false
) : ConfigData
val configManager = ConfigManager(
currentVersion = "1.0.0",
defaultConfig = MyConfig(),
configClass = MyConfig::class,
metadata = ConfigMetadata(
headerComments = listOf("My mod settings")
)
)
Command Registration:
val commandManager = CommandManager("mymod")
commandManager.command("hello", permission = "mymod.hello") {
executes { context ->
val source = context.source
CommandManager.sendSuccess(source, "Hello, World!")
1
}
}
Interface Creation:
CustomGui.openGui(
player = player,
title = "My GUI",
layout = listOf(
CustomGui.createNormalButton(
ItemStack(Items.DIAMOND),
"Click me!",
listOf("Button description")
)
),
onInteract = { context ->
// Handle button clicks
}
)