Deimos 是一个用于数据生成和配置的 Minecraft 库。借助它,你可以在 Forge 和 Neoforge 上原生地生成配置文件并在游戏内显示,或者在 Fabric 上使用 Mod Menu 来显示。Deimos 允许你在游戏启动时创建新的配方,从而使它们可配置。这也意味着你无需使用 JSON 文件,升级 Minecraft 版本变得更容易且更省心。
本库的配置部分基于 MidnightLib,由 Motschen 开发。
我制作这个模组是为了简化我的模组开发,并让我能够在所有加载器和 Minecraft 版本中使用同一个配置库。因此,如果你想查看如何在实际项目中使用该库的示例,可以查看我制作的 模组。
面向开发者
以下是设置和使用 Deimos 的说明。有关此库的更多详细信息,请务必查阅其 GitHub 页面。
设置
你可以使用我的 IntelliJ 模板,它会生成一个预配置了 Deimos 的新 MultiLoader 项目;或者按照以下说明手动进行设置:
在 build.gradle 中
repositories {
maven {
url = "https://api.modrinth.com/maven"
}
}
Forge 和 Neoforge:
dependencies {
implementation "maven.modrinth:deimos:${project.deimos_version}"
}
Fabric:
dependencies {
modImplementation "maven.modrinth:deimos:${project.deimos_version}"
//如果你希望使用 Mod Menu
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
}
如果你希望使用 Mod Menu 功能,则需要添加一个新的仓库:
repositories {
maven {
name = "Terraformers"
url = "https://maven.terraformersmc.com/"
}
}
你可以在 Modrinth 上找到你需要使用的具体 Deimos 版本。
使用方法
创建配置文件
你可以在继承自 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");
}
然后在你的初始化方法中,你需要这样调用 DeimosConfig.init:
DeimosConfig.init(MOD_ID, TestConfig.class);
添加新配方
要添加新配方,请在你的初始化方法中调用 DeimosRecipeGenerator 的方法。你可以添加无形状合成、有形状合成、熔炼、烟熏、高炉冶炼、营火烹饪和切石机配方。以下是一些示例:
DeimosRecipeGenerator.createSmeltingJson(TestConfig.test_string_list.get(0), TestConfig.test_string_list.get(1), TestConfig.test_int, 0.5F);
DeimosRecipeGenerator.createShapedRecipeJson(
Lists.newArrayList('#'),
Lists.newArrayList(ResourceLocation.parse("sand")),
Lists.newArrayList("item"),
Lists.newArrayList(
"# ",
" #"
),
ResourceLocation.parse("stone"), 1);
请注意,您可以使用配置文件中的值。如果玩家更改这些值并重新启动游戏,配方也会随之改变。
这也适用于模组物品。
Deimos is a data generation and configuration Minecraft library. With it, you can generate config files and display them in-game natively on Forge and Neoforge or with the help of Mod Menu on Fabric. Deimos allows you to create new recipes when the game starts, which makes them configurable. This also means you don't have to use JSON files, and changing Minecraft versions becomes significantly easier and less painful.
The configuration part of this library is based on MidnightLib by Motschen.
I made this mod to simplify my mods' development and allow me to use just one config library across all mod loaders and Minecraft versions. So if you want to see some examples of how to use this library in the wild you can check out the mods I made.
For developers
Below are the instructions for setting up and using Deimos. For more details about this library, be sure to check out its GitHub page.
Setup
You can either use my IntelliJ templates which generate a new MultiLoader project with Deimos preconfigured, or follow these instructions to set it up manually:
In build.gradle
repositories {
maven {
url = "https://api.modrinth.com/maven"
}
}
Forge and Neoforge:
dependencies {
implementation "maven.modrinth:deimos:${project.deimos_version}"
}
Fabric:
dependencies {
modImplementation "maven.modrinth:deimos:${project.deimos_version}"
//if you want to use modmenu
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
}
if you want to use the mod menu functionality you need to add a new repository:
repositories {
maven {
name = "Terraformers"
url = "https://maven.terraformersmc.com/"
}
}
You can find the specific Deimos version you need on Modrinth
How to use it
Creating configs
You can add configs in a class that extends 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");
}
And then in your initialize method you need to call DeimosConfig.init like this:
DeimosConfig.init(MOD_ID, TestConfig.class);
Adding new recipes
To add new recipes you call methods from DeimosRecipeGenerator in your initialize method. You can add shapeless crafting, shaped crafting, smelting, smoking, blasting, campfire and stone cutting recipes. Here are some examples:
DeimosRecipeGenerator.createSmeltingJson(TestConfig.test_string_list.get(0), TestConfig.test_string_list.get(1), TestConfig.test_int, 0.5F);
DeimosRecipeGenerator.createShapedRecipeJson(
Lists.newArrayList('#'),
Lists.newArrayList(ResourceLocation.parse("sand")),
Lists.newArrayList("item"),
Lists.newArrayList(
"# ",
" #"
),
ResourceLocation.parse("stone"), 1);
Notice that you can use values from your config file. If the player changes them and restarts the game, the recipes will also change. This even works with modded items.
下载 Deimos
下载 Deimos
下载 Deimos
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Deimos
下载 Deimos
下载 Deimos
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Deimos
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Deimos
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Deimos
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Deimos
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
添加了 source 和 issues 属性
修复了与 Fabric 序列化器的冲突
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
适用于 MC 1.18+ 的 Effekseer 加载器
模组
添加区块认领和玩家组队功能,并与 Xaero's Minimap 和 World Map 集成
评论 0
登录后参与评分
还没有评论,来抢沙发吧