介绍
Codec2Schema
Through the power of mixins, sheer will, and unchecked type casts, this mod transforms codecs into (mostly) usable JSON schemas.
You can find the generated schemas for vanilla Minecraft here.
What is a Codec?
Codecs are Mojang’s way of easily serializing data to and from JSON. They define the structure of an object, meaning JSON schemas can be generated from them.
What is a JSON Schema?
A JSON schema is a file that describes how JSON files should be structured, and can be used by IDEs to provide autocomplete when creating or editing JSON files.
About This Mod
When installed, this mod exports JSON schemas for data and resource pack files to <YOUR GAME DIRECTORY>/codec2schema. You can use the API to export your own codecs as well!
The generated JSON schemas will have autocomplete for registries (items, blocks, etc), including modded content.
This mod is not perfect: there are many edge cases that aren’t or can’t be accounted for.
Example
The following is the generated JSON schema for regional compliancies warnings:
{
"$schema": "https://json-schema.org/draft-07/schema",
"$ref": "#/definitions/def",
"definitions": {
"def": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/def_1"
}
}
},
"def_1": {
"type": "object",
"properties": {
"delay": {
"type": "integer",
"minimum": -9223372036854775808,
"maximum": 9223372036854775807,
"default": 0
},
"period": {
"type": "integer",
"minimum": -9223372036854775808,
"maximum": 9223372036854775807
},
"title": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"period",
"title",
"message"
]
}
}
}
It’s not perfect, but it’s good enough.
常见问题
Codec2Schema 支持哪些 Minecraft 版本?
Codec2Schema 支持 Minecraft Java 版 1.21.11–26.3,共 6 个版本,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。
Codec2Schema 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端 / 服务端。
Tr100000 的其他作品
查看全部 →Codec2Schema
A tool to convert codecs to JSON schemas.
Text Randomizer
Randomizes all translated text in Minecraft.
TrUtils
A library mod with a bunch of random utilities.
Researcher
A data-driven research system inspired by Factorio.
评论
登录后评论和评分