Prickle 是一种基于 JSON 的配置格式。此模组允许在 Minecraft 中使用该格式!如需技术文档,请参阅 GitHub 页面。
常见问题
Prickle 提供哪些优势?
Prickle 基于 JSON,但增加了注释和装饰器(decorators)等实用功能。Prickle 与 JSON 完全向后兼容,并支持其所有特性、工具和语法高亮。
为什么叫 Prickle?
Prickle 是刺猬群的集体名词。刺猬是我最喜爱的动物之一,我认为它们是配置文件的一个恰当隐喻。例如,它们起初可能看起来令人生畏,但一旦你了解并理解它们,就会发现它们其实很友好。
为什么不使用现有的格式?
过去我曾为配置文件使用 JSON,但存在几个问题,比如缺少注释和默认值。Prickle 在保持与 JSON 100% 向后兼容的同时,添加了这些功能。我也尝试过其他格式如 TOML,但对它们的许多 Java 实现感到失望。它们往往缺乏我认为重要的功能,存在严重错误,且不再维护。Minecraft 已经对数据包和命令使用了 JSON,这对大多数玩家来说是一个熟悉的选择。
格式规范
在 Prickle 中,属性值被包裹在一个 JSON 对象内。这使得像注释这样的元数据可以归属于该属性。
例如,一个标准的 JSON 文件看起来是这样的:
{
"database_host": "192.168.1.222"
}
同样的 JSON 作为 Prickle 文件看起来是这样的:
{
"database_host": {
"//": "要连接的数据库的 IP 地址。",
"value": "192.168.1.222"
}
}
注释
// 键保留用于注释。注释仅用于为读者提供额外的上下文,绝不应影响文件的解析方式。注释可以是 JSON 字符串,也可以是用于多行注释的字符串数组。
{
"database_host": {
"//": [
"要连接的数据库的 IP 地址。",
"端口可以使用 : 定义在末尾"
],
"value": "192.168.1.222:1273"
}
}
装饰器
装饰器是传达属性特定属性的命名注释。一个常见的例子是 //default,可用于显示属性的默认值。与注释一样,装饰器不影响文件的解析方式,它们仅描述属性将被如何解析。
你可能会在 prickle 文件中遇到以下一些装饰器:
//default- 属性的默认值。//reference- 可用于了解更多详情的资源,例如指向维基页面的链接。//range- 值的可接受范围。例如 >=5。//regex- 值必须匹配的正则表达式模式。//empty-allowed- 值是否可以为空。(默认为 true)。
赞助商
本项目由 Nodecraft 赞助。使用代码 DARKHAX 可享受首月服务 30% 折扣!
Prickle is a JSON based config format. This mod allows the format to be used in Minecraft! For technical documentation please see the GitHub page.
FaQ
What benefits does Prickle offer?
Prickle is based on JSON but adds several useful features like comments and decorators. Prickle is 100% backwards compatible with JSON and supports all of its features, tools, and syntax highlighting.
Why is this called Prickle?
Prickle is the collective noun for a group of hedgehogs. Hedgehogs are one of my favourite animals and I think they are a fitting metaphor for config files. For example, they both may seen intimidating at first but can be nice once you get to know and understand them.
Why not use an existing format?
In the past I have used JSON for my config files but there were several issues such as the lack of comments and default values. Prickle adds these features to JSON while remaining 100% backwards compatible. I have tried other formats like TOML but was disappointed with a lot of their Java implementations. They often lack features I feel are important, have serious bugs, and are no longer being maintained. Minecraft already uses JSON for datapacks and commands, making it a familiar choice for most players.
Format Specifications
In Prickle property values are wrapped in a JSON object. This allows metadata like comments to be attributed to that property.
For example a standard JSON file would look like this.
{
"database_host": "192.168.1.222"
}
The same JSON as a Prickle file would look like this.
{
"database_host": {
"//": "The IP address of the database to connect to.",
"value": "192.168.1.222"
}
}
Comments
The // key is reserved for comments. Comments are only used to provide additional context to the reader and should never influence how the file is parsed. Comments can be a JSON string or an array of strings for multiline comments.
{
"database_host": {
"//": [
"The IP address of the database to connect to.",
"The port can be defined at the end using an :"
],
"value": "192.168.1.222:1273"
}
}
Decorators
Decorators are named comments that convey a specific attribute of the property. A common example of a decorator is //default which can be used to display the default value of the property. Like comments, decorators have no influence on how the file is parsed, they only describe how the property will be parsed.
You may encounter some of the following decorators in prickle files.
//default- The default value of the property.//reference- A resource that can be used to learn more, like a link to a wiki page.//range- The acceptable range for a value. For example >=5.//regex- A regex pattern that the value must match.//empty-allowed- If the value can be empty or not. (default is true).
Sponsors
This project is sponsored by Nodecraft. Use code DARKHAX for 30% off your first month of service!
下载 Prickle
下载 Prickle
下载 Prickle
下载 Prickle
下载 Prickle
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Prickle
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Prickle
下载 Prickle
下载 Prickle
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Prickle
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
这是 26.3 的第一个成功构建版本。你可以在这里了解更多详情。
本项目得以实现,离不开像您这样的玩家通过 Patreon 提供的支持!非常感谢!
- lothrazar
- techsquirrel
- Tobias Ward
- noobanidus
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器
评论 0
登录后参与评分
还没有评论,来抢沙发吧