本模组允许在资源包或数据包中使用 HOCON。
HOCON 的语法更加灵活,支持变量和 include 等高级语法,从而减少样板代码。
该模组会使用 HOCON 解析器加载以 .hocon 结尾的文件,并欺骗游戏使其认为这些文件是 JSON 文件。
因此,它不会与已使用 JSON 格式的资源包发生冲突。
需要在 pack.mcmeta 中启用如下配置:
{
"pack": {
"pack_format": 15,
"description": {
"translate": "settingsun.pack",
"fallback": "Assets of SettingSun"
},
"supported_formats": [15, 22]
},
"hoconresourceloader" : {
"enabled": true
}
}
HOCON 的优势
include支持 URL、文件(可用于资源/数据包的配置)以及通过标识符引用的 Minecraft 资源- 配合
include,你可以包含原始的 JSON 文件并仅修改其中的值,而无需编辑整个文件。这比 JsonPatch 方便得多 - 更多信息请见
示例
以下展示了位于 的资源包的效果:
-
# 当前读取相对文件的目录为 minecraft 运行目录。 # 通常为 `.minecraft` 或 `.minecraft/versions/{NAME}` 目录 # 此处为 `{PROJECT_DIR}/mod/run` include file("dirt.hocon")
-
parent: "minecraft:block/stone"
-
# 支持标识符 include "minecraft:models/item/dirt.json"
-
# 将尝试在传递给资源管理器的起始路径下查找。 # 此处为 `models/` include "minecraft:item/dirt.json"
-
# 具体来说,包含的 json 文件不会被解析为 hocon。 # 因此,你可以对 json 文件进行补丁处理,并将 hocon 文件作为 json 提供给游戏。 include "minecraft:models/item/torch.json" textures.layer0 = "minecraft:block/soul_torch"
鸣谢
图标来自
This mod is for using HOCON for resource packs or data packs
HOCON's syntax is more flexible and supports advanced syntax such as variables and include, which can reduce boilerplate code.
The mod will load any file in packs ends with .hocon with HOCON parser and trick the game to think it's a json file.
So that it shouldn't conflict with any packs that already use the json format.
Need to enable in pack.mcmeta lie below:
{
"pack": {
"pack_format": 15,
"description": {
"translate": "settingsun.pack",
"fallback": "Assets of SettingSun"
},
"supported_formats": [15, 22]
},
"hoconresourceloader" : {
"enabled": true
}
}
Advantage of HOCON
includeurl, file (Can be used for resource/data pack config), minecraft resource by identifier- With
include, you can include the origin json file and modify the value instead of edit the whole file. Far more convenient than the JsonPatch - See more on
Examples
The result of the resource pack at
-
# The current directory to read file relative is minecraft run dir. # `.minecraft` or `.minecraft/versions/{NAME}` dir in commonly # At here is `{PROJECT_DIR}/mod/run` include file("dirt.hocon")
-
parent: "minecraft:block/stone"
-
# Support identifier include "minecraft:models/item/dirt.json"
-
# Will try to find under the starting path that passed to resource manager. # It's `models/` here include "minecraft:item/dirt.json"
-
# Specifically, include json files won't be resolved to hocon. # So, you can do patch for the json file and provide the hocon file as json to the game. include "minecraft:models/item/torch.json" textures.layer0 = "minecraft:block/soul_torch"
Credit
Icon from
下载 Hocon Resource Loader
下载 Hocon Resource Loader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Hocon Resource Loader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Hocon Resource Loader
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Hocon Resource Loader
下载 Hocon Resource Loader
下载 Hocon Resource Loader
下载 Hocon Resource Loader
下载 Hocon Resource Loader
下载 Hocon Resource Loader
:recycle: 重构
2129c7a- 移植到 1.21 (由 @SettingDust 提交)
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧