env.json
支持
依赖
概念
env.json 是一个 Minecraft 库,引入了一种新的子 JSON 文件扩展名格式,旨在根据环境上下文将 Minecraft 资源重定向到其他资源。
实现
env.json 不直接提供这些重定向功能,而是仅负责处理 env.json 文件及其资源重载管理的相关操作。
目前有两个官方实现的 env.json:
模组标识符:env-driven-assets。
适用环境:客户端 (Client)
将 env.json 操作应用于 Minecraft 原版资产类型。
- Environment Driven Data (EDD)
模组标识符:env-driven-data。
适用环境:通用 & 服务端 (Common & Server)
将 env.json 操作应用于 Minecraft 原版数据包类型。
env.json 格式
[
{
"rules": [ // 主要规则集,属于 "any" 类型
{
"type": "sequence", // 序列中的所有规则都必须通过
"rule": [] // 规则列表
},
{
"type": "any", // 只要至少有一条规则通过即生效
"rule": [] // 规则列表
},
{
"type": "not", // 反转规则结果
"rule": { // 被反转的规则
"type": "...",
"rule": "..."
}
},
{
"type": "dimension", // 如果当前维度与此匹配则通过
"rule": "minecraft:overworld" // 维度,也可以是标签 (tag)
},
{
"type": "biome", // 如果当前生物群系与此匹配则通过
"rule": "minecraft:plains" // 生物群系,也可以是标签 (tag)
},
{
"type": "x_coord", // 如果对 X 轴的操作有效则通过
"rule": {
"comparator": "==", // 必须是 <, >, ==, <=, >=, =< 或 =>
"value": "100" // 必须是整数
}
},
{
"type": "y_coord", // 如果对 Y 轴的操作有效则通过
"rule": {
"comparator": "==", // 必须是 <, >, ==, <=, >=, =< 或 =>
"value": "100" // 必须是整数
}
},
{
"type": "z_coord", // 如果对 Z 轴的操作有效则通过
"rule": {
"comparator": "==", // 必须是 <, >, ==, <=, >=, =< 或 =>
"value": "100" // 必须是整数
}
},
{
"type": "submerged", // 如果当前上下文被水包围或未包围则通过
"rule": true // true 表示“如果被水包围”,false 表示“如果未被水包围”
},
{
"type": "sky", // 如果上下文在天空限制之上、等于或之下则通过
"rule": "at" // 必须是 "above"(之上)、"at"(等于)或 "below"(之下)
},
{
"type": "water", // 如果上下文在水位之上、等于或之下则通过
"rule": "at" // 必须是 "above"(之上)、"at"(等于)或 "below"(之下)
},
{
"type": "void", // 如果上下文在虚空限制之上、等于或之下则通过
"rule": "at" // 必须是 "above"(之上)、"at"(等于)或 "below"(之下)
}
],
"result": "minecraft:block/stone" // 重定向的目标资源
}
]
该文件必须按以下格式注册:redirected_resource_name-redirected_resource_extension.env.json。
开发者用法
在你的 build.gradle 中:
repositories {
// ...
maven { url 'https://jitpack.io' }
}
// ...
dependencies {
// ...
modImplementation "com.mmodding:env.json:${theMostBeautifulVersionYouCanFind}"
}
你现在可以通过 ExtendedResource#of(Resource)#getEnvJson 从 Resource 对象获取你的 EnvJson 对象,或者使用 EnvJson#parse(Path) 或 EnvJson#parse(InputStream) 进行解析。
开发者徽章
[<img src="https://github.com/MModding/art/blob/main/mods/env_json/requires_env_json.png?raw=true" width="256" alt="Requires env.json">](https://modrinth.com/mod/env.json)
推广
env.json
Supports
Requirements
Concept
env.json is a Minecraft Library introducing a new sub json file extension format, with the goal of redirecting minecraft resources to other ones based on the environment context.
Implementations
env.json doesn't provide these redirections directly, but only the operations around env.json files and their resource reload management.
There is currently two official implementations of env.json:
Mod Identifier: env-driven-assets.
Environments: Client
Applies env.json operations to Minecraft Vanilla asset types.
- Environment Driven Data (EDD)
Mod Identifier: env-driven-data.
Environments: Common & Server
Applies env.json operations to Minecraft Vanilla data types.
The env.json Format
[
{
"rules": [ // the primary set of rules, is an "any" type
{
"type": "sequence", // all rules in the sequence must pass
"rule": [] // the rules
},
{
"type": "any", // passes if at least one rule passes
"rule": [] // the rules
},
{
"type": "not", // reverses the rule
"rule": { // the rule
"type": "...",
"rule": "..."
}
},
{
"type": "dimension", // passes if the current dimension matches this one
"rule": "minecraft:overworld" // the dimension, can also be a tag
},
{
"type": "biome", // passes if the current biome matches this one
"rule": "minecraft:plains" // the biome, can also be a tag
},
{
"type": "x_coord", // passes if the following operations on the x-axis are valid
"rule": {
"comparator": "==", // must be <, >, ==, <=, >=, =< or =>
"value": "100" // must be an integer
}
},
{
"type": "y_coord", // passes if the following operations on the y-axis are valid
"rule": {
"comparator": "==", // must be <, >, ==, <=, >=, =< or =>
"value": "100" // must be an integer
}
},
{
"type": "z_coord", // passes if the following operations on the z-axis are valid
"rule": {
"comparator": "==", // must be <, >, ==, <=, >=, =< or =>
"value": "100" // must be an integer
}
},
{
"type": "submerged", // passes if the current context is surrounded by water or not
"rule": true // true for "if it is submerged" and false for "if it is not submerged"
},
{
"type": "sky", // passes if the context is above the sky limit, at or below
"rule": "at" // must be "above", "at" or "below"
},
{
"type": "water", // passes if the context is above the water level, at or below
"rule": "at" // must be "above", "at" or "below"
},
{
"type": "void", // passes if the context is above the void limit, at or below
"rule": "at" // must be "above", "at" or "below"
}
],
"result": "minecraft:block/stone" // the redirected resource
}
]
The file must be registered under this format: redirected_resource_name-redirected_resource_extension.env.json.
Usage For Developers
In your build.gradle
repositories {
// ...
maven { url 'https://jitpack.io' }
}
// ...
dependencies {
// ...
modImplementation "com.mmodding:env.json:${theMostBeautifulVersionYouCanFind}"
}
You can now get your EnvJson object from a Resource object thanks to ExtendedResource#of(Resource)#getEnvJson
or parse it with EnvJson#parse(Path) or EnvJson#parse(InputStream).
Badge For Developers
[<img src="https://github.com/MModding/art/blob/main/mods/env_json/requires_env_json.png?raw=true" width="256" alt="Requires env.json">](https://modrinth.com/mod/env.json)
Promotion
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 env.json
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
添加 1.21 支持。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
可定制的鞘翅模组,支持装饰纹饰、旗帜图案等更多功能!
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!







评论 0
登录后参与评分
还没有评论,来抢沙发吧