Deimos - Data Generation and Configuration Library
Deimos is a powerful library for Minecraft designed for generating configuration files and data. This library enables developers to create customizable configurations that can be viewed directly in-game on Forge and Neoforge platforms. For Fabric, additional integration with Mod Menu is used.
Key Features
The Deimos library opens up extensive possibilities for developers to create dynamic crafting recipes that generate when the game starts. This means you no longer need to work with JSON files manually, significantly simplifying the mod development process and updating mods for different Minecraft versions.
Technical Features
The foundation of the configuration part is built on MidnightLib by Motschen. Deimos was created to unify the mod development process and allows using a single configuration library for all mod loaders and game versions.
For Developers
Project Setup
You can use ready-made IntelliJ templates to create multi-loader projects with pre-configured Deimos or set up the library manually.
Adding Repository to build.gradle
repositories {
maven {
url = "https://api.modrinth.com/maven"
}
}
Dependencies for Forge and Neoforge
dependencies {
implementation "maven.modrinth:deimos:${project.deimos_version}"
}
Dependencies for Fabric
dependencies {
modImplementation "maven.modrinth:deimos:${project.deimos_version}"
// for using modmenu
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
}
To work with Mod Menu, you need to add an additional repository:
repositories {
maven {
name = "Terraformers"
url = "https://maven.terraformersmc.com/"
}
}
Working with Configurations
Creating configuration files is done through a class that inherits from DeimosConfig:
public class TestConfig extends DeimosConfig {
@Entry public static int test_int = 6;
@Entry public static List<String> test_string_list = Lists.newArrayList(
"minecraft:acacia_planks", "minecraft:andesite");
}
Configuration initialization in the initialize method:
DeimosConfig.init(MOD_ID, TestConfig.class);
Recipe Generation
DeimosRecipeGenerator provides methods for creating various types of recipes:
// Creating smelting recipe
DeimosRecipeGenerator.createSmeltingJson(TestConfig.test_string_list.get(0), TestConfig.test_string_list.get(1), TestConfig.test_int, 0.5F);
// Creating shaped crafting recipe
DeimosRecipeGenerator.createShapedRecipeJson(
Lists.newArrayList('#'),
Lists.newArrayList(ResourceLocation.parse("sand")),
Lists.newArrayList("item"),
Lists.newArrayList(
"# ",
" #"
),
ResourceLocation.parse("stone"), 1);
An important feature is the ability to use values from configuration files. When players change settings and restart the game, recipes automatically update, including working with modded items.