? 简介:
Extended Interactions 为所有填充你世界的方块和实体添加了径向菜单。该菜单允许你在不手持正确物品、不按 Shift 键等情况下执行操作。只需按住 Tab 键并选择你想要执行的操作即可。
❓ 为什么制作这个模组?
目前已有许多径向(或类似)菜单模组,但它们大多解决的是不同的问题。
诸如 Radial Macros 和 Radial 这类模组主要用于客户端操作,例如按下快捷键。本质上,它们用于创建小型宏或脚本。
另一方面,EI 同时在客户端和服务器端运行,以实现如原版机制般的交互/径向菜单按钮/动作——拥有独立的服务器端代码和客户端代码。EI 能够触发快捷键并执行其他由径向菜单宏/脚本模组完成的操作,但这仅作为支持那些未提供适当 EI 集成的模组的权宜之计。
在客户端和服务器端同时运行使我们能够绕过原版(或非 EI)服务器的限制。例如,剪羊毛等操作通常要求玩家在手中持有特定物品。若要在没有服务器端支持的情况下实现此功能,我们需要快速将正确的物品放入玩家手中,执行所需操作,然后再将物品恢复原状。通过集成服务器端支持,我们无需进行此类操作,可以直接剪羊毛。这改善了高网络延迟下的性能以及整体用户体验。
? 兼容性:
EI 内置支持以下游戏内文档模组:Oracle Index、Pathouli。
EI 允许使用径向菜单打开上述模组的相关文章。
EI 还提供了大量原版交互功能。完整的功能列表见下方折叠部分。
完整模组兼容性
| 交互 / MC 版本 |
1.21.1 |
1.21.11 |
MC 剪羊毛 |
✅ |
✅ |
MC 挤牛奶 |
✅ |
✅ |
MC 收集蘑菇汤 |
✅ |
✅ |
MC 拴绳连接 |
✅ |
✅ |
MC 拴绳解除连接 |
✅ |
✅ |
MC 放置鞍具 |
✅ |
✅ |
MC 与村民交易 |
✅ |
✅ |
MC 与流浪商人交易 |
✅ |
✅ |
MC 配置红石比较器 |
✅ |
✅ |
MC 从熔炉中取出结果 |
✅ |
✅ |
MC 将植物放入堆肥桶 |
✅ |
✅ |
MC 将钥匙插入保险箱 |
✅ |
✅ |
OI 根据目标方块查阅条目 |
✅ |
⛔ |
PTO 根据目标方块查阅条目 |
✅ |
⛔ |
? MFG 在自定义交互中激活 lib 键绑定 |
✅ |
✅ |
? MLL 在自定义交互中激活 lib 键绑定 |
✅ |
✅ |
表格符号说明
|
|
MC - Minecraft 原版交互 |
✅ - 当前 EI 最新版本支持 |
OI - Oracle Index 交互 |
⛔ - 第三方模组不支持此 Minecraft 版本 |
其他:左侧列中的灰色 方框 表示该交互所针对的模组。点击灰色方框可打开模组页面 |
⚠️ - EI 尚未实现此交互! |
|
⏳ - 已在未发布的 EI 版本中实现 |
|
? - 仅限 Fabric |
|
? - 仅限 NeoForge |
?? 面向整合包作者和模组开发者
对于模组开发,EI 提供了 Java API 用于创建自定义交互。整合包作者可以使用 <.minecraft>/config/extended-interactions/custom 目录来创建自定义交互。
教程:使用配置文件创建自定义交互
所有自定义交互均以 JSON 文件的形式存在于 <.minecraft>/config/extended-interactions/custom 目录中。只需在该目录中创建一个文件并填入以下内容即可:
{
"icon": {
"id": "minecraft:diamond"
},
"blocks": [],
"entities": [],
"actions": []
}
文件名必须符合 [a-z][a-z0-9_]+\.json 正则表达式。该交互的 ID 将为文件名去掉 .json 后缀后的部分。
交互的图标由 icon 属性定义。其格式与 配方结果 相同。
该交互可用的时机由以下格式的 blocks 和 entities 属性定义:
{
"subject": "<方块/实体标识符>",
"if": [<条件列表>]
}
对于此类目标,需满足 if 属性中的所有条件。条件的格式如下:
// 方块的条件
{
// 可选。方块状态属性到值的映射
"state": {
"waterlogged": "true"
},
// 可选。用于匹配的 NBT
```json
{
"nbt": {
"CustomName": "有趣的方块"
},
// 可选。如果此条件未满足,则显示的聊天组件(https://minecraft.wiki/w/Text_component_format)
"message": "方块必须被水填充"
}
// 实体的条件
{
// 可选。要匹配的 NBT 数据
"nbt": {
"Sitting": true
},
// 可选。如果此条件未满足,则显示的聊天组件(https://minecraft.wiki/w/Text_component_format)
"message": "狐狸必须处于坐下状态"
}
如果此交互被触发,将会发生什么由 `actions` 属性定义。以下是所有支持的操作:
```json
// 自 1.1.0 起
// 在服务器端执行聊天命令
// 命令将作为交互目标执行。(@s - 是打开径向菜单时玩家注视的方块或实体)
// 若要针对运行交互的玩家使用 @ei:user
{
"type": "extended_interactions:command",
"cmd": "item replace entity @s weapon.mainhand with minecraft:totem_of_undying"
}
// 自 1.1.0 起
// 手持物品右键点击
// 此操作会自动检查玩家是否拥有匹配所提供谓词的物品。如果玩家没有,则会显示以下消息
// {"translate":"extinter.extended_interactions.custom/<interaction id>.no_item"}
{
"type": "extended_interactions:use_item",
// 物品谓词 (https://minecraft.wiki/w/Advancement/Conditions/item)
"item": {
"items": ["minecraft:shears"]
}
}
// 自 1.1.0 起
// 在客户端触发 Minecraft 键绑定
{
"type": "extended_interactions:key",
// 键绑定标识符 (https://minecraft.wiki/w/Controls#Configurable_controls)
"key": "key.drop"
}
// 自 1.1.0 起。需要 MaFgLib
// 触发 MaFgLib 键绑定
{
"type": "extended_interactions:mafglib",
// 该键绑定所属类别的名称
"category": "Generic hotkeys",
// MaFgLib 键绑定的标识符
"keybind": "openGuiConfigs"
}
// 自 1.1.0 起。需要 MaLiLib
// 触发 MaLiLib 键绑定
{
"type": "extended_interactions:malilib",
// 该键绑定所属类别的名称
"category": "Generic hotkeys",
// MaLiLib 键绑定的标识符
"keybind": "openGuiConfigs"
}
自定义交互的名称为 语言键:extinter.extended_interactions.custom/<interaction id>。
示例。剪羊毛
<.minecraft>/config/extended-interactions/custom/shearing.json:
{
"icon": {
"id": "minecraft:shears"
},
"blocks": [],
"entities": [
{
"subject": "minecraft:sheep",
"if": [
{
"nbt": {"Sheared": false},
"message": {"translate": "extinter.extended_interactions.custom/shearing.no_wool"}
}
]
}
],
"actions": [
{
"type": "extended_interactions:use_item",
"item": {
"items": ["minecraft:shears"]
}
}
]
}
<resource-pack>/assets/lang/en_us.json:
{
"extinter.extended_interactions.custom/shearing": "Collect wool",
"extinter.extended_interactions.custom/shearing.no_item": "You need a shears",
"extinter.extended_interactions.custom/shearing.no_wool": "No wool to collect"
}
? About:
Extended Interactions adds radial menu for all blocks and entities that fill your world. This menu allows doing stuff without holding correct item in hand, without holding shift, etc. Just hold Tab and choose what you want to do.
❓ Why this mod exists?
There are a lot of radial(or similar) menu mods already, but most of them solve different problem.
These mods like Radial Macros and Radial are used for client-side actions like pressing keybinds. Basically create small macroses/scripts.
On other hand EI operates on both client and server to implement interactions/radial menu buttons/actions like vanilla mechanics - with own server code and client code. EI has ability to trigger keybinds and do other stuff radial menu macros/script mods does, but only as a workaround to support mods that don't have proper EI integration in them.
Running both on server and client gives us ability to ignore restrictions vanilla(or non-EI) servers have. For example actions like sheep shearing require holding specific items in player's hand. To implement this without server we would need to quickly put correct item in player's hand, do the required thing, and put items how they were originally. With server integrated we don't need to do anything like this, we can just shear the sheep directly. This improves performance with big network latency and UX in general.
? Compatibility:
EI has builtin support for following ingame docs mods: Oracle Index, Pathouli.
EI allows openning related articles from mentioned mod using radial menu.
EI also has a lot of vanilla interactions available. There is full list of features in in collapsed section below.
Full mod compatibility
| Interaction / MC version |
1.21.1 |
1.21.11 |
MC Sheep shearing |
✅ |
✅ |
MC Cow milking |
✅ |
✅ |
MC Mooshroom soup collection |
✅ |
✅ |
MC Attaching leashes |
✅ |
✅ |
MC Detaching leashes |
✅ |
✅ |
MC Putting saddles |
✅ |
✅ |
MC Trading with villagers |
✅ |
✅ |
MC Trading with wandering traders |
✅ |
✅ |
MC Configuring repeaters |
✅ |
✅ |
MC Take result from furnaces |
✅ |
✅ |
MC Insert plants into composters |
✅ |
✅ |
MC Insert keys into vaults |
✅ |
✅ |
OI Looking up articles based on target block |
✅ |
⛔ |
PTO Looking up articles based on target block |
✅ |
⛔ |
? MFG Activating lib keybinds in custom interactions |
✅ |
✅ |
? MLL Activating lib keybinds in custom interactions |
✅ |
✅ |
Table symbols
|
|
MC - Vanilla Minecraft interactions |
✅ - Supported on latest EI version |
OI - Oracle Index interaction |
⛔ - Third party mod is does not support this minecraft version |
Etc. All gray boxes in left column indicate mod interaction is for. Press on gray box to open mod's page |
⚠️ - Interaction isn't implmented by EI yet! |
|
⏳ - Implemented on unreleased EI version |
|
? - Only on fabric |
|
? - Only on neoforge |
?? For modpack and mod developers
For mod development EI has Java API for creating custom interactions. Modpack devs can create custom interactions using <.minecraft>/config/extended-interactions/custom directory.
Tutorial: Creating custom interactions using config
All custom interactions are represented by json files in <.minecraft>/config/extended-interactions/custom directory. Just create a file there and fill it with following:
{
"icon": {
"id": "minecraft:diamond"
},
"blocks": [],
"entities": [],
"actions": []
}
File name must match [a-z][a-z0-9_]+\.json regex. ID of this interaction will be file's name without .json suffix.
Interaction's icon is defined in icon property. It uses same format as recipe result does.
Times when this interaction is available are defined by blocks and entities properties in following format:
{
"subject": "<block/entity identifier>".
"if": [<list of conditions>]
}
For this kind of target to match all conditions in if property need to match. Conditions are formatted like so:
// Conditions for blocks
{
// Optional. Map of blockstate properties to values
"state": {
"waterlogged": "true"
},
// Optional. NBT to match
"nbt": {
"CustomName": "Intersting block"
},
// Optional. Chat component (https://minecraft.wiki/w/Text_component_format) to show if this condition has failed
"message": "Block must be waterlogged"
}
// Conditions for entities
{
// Optional. NBT to match
"nbt": {
"Sitting": true
},
// Optional. Chat component (https://minecraft.wiki/w/Text_component_format) to show if this condition has failed
"message": "Fox must be sitting"
}
Stuff that will happen if this interaction in triggered is defined by actions property. This are all supported actions:
// Since 1.1.0
// Execute chat command server-side
// Command is executed as interaction target. (@s - is block or entity player looked at when openning radial menu)
// To target player who is running the interaction use @ei:user
{
"type": "extended_interactions:command",
"cmd": "item replace entity @s weapon.mainhand with minecraft:totem_of_undying"
}
// Since 1.1.0
// Right click with item is hand
// This action automatically checks that player has item that
// matches provided predicate. If player doesn't following message is displayed
// {"translate":"extinter.extended_interactions.custom/<interaction id>.no_item"}
{
"type": "extended_interactions:use_item",
// Item predicate (https://minecraft.wiki/w/Advancement/Conditions/item)
"item": {
"items": ["minecraft:shears"]
}
}
// Since 1.1.0
// Trigger minecraft keybind client-side
{
"type": "extended_interactions:key",
// Keybind identifier (https://minecraft.wiki/w/Controls#Configurable_controls)
"key": "key.drop"
}
// Since 1.1.0. MaFgLib required
// Trigger MaFgLib keybind
{
"type": "extended_interactions:mafglib",
// Name of category this keybind belongs to
"category": "Generic hotkeys",
// Identifier of MaFgLib keybind
"keybind": "openGuiConfigs"
}
// Since 1.1.0. MaLiLib required
// Trigger MaLiLib keybind
{
"type": "extended_interactions:malilib",
// Name of category this keybind belongs to
"category": "Generic hotkeys",
// Identifier of MaLiLib keybind
"keybind": "openGuiConfigs"
}
Custom interactions are named as a language key: extinter.extended_interactions.custom/<interaction id>.
Example. Sheep shearing
<.minecraft>/config/extended-interactions/custom/shearing.json:
{
"icon": {
"id": "minecraft:shears"
},
"blocks": [],
"entities": [
{
"subject": "minecraft:sheep",
"if": [
{
"nbt": {"Sheared": false},
"message": {"translate": "extinter.extended_interactions.custom/shearing.no_wool"}
}
]
}
],
"actions": [
{
"type": "extended_interactions:use_item",
"item": {
"items": ["minecraft:shears"]
}
}
]
}
<resource-pack>/assets/lang/en_us.json:
{
"extinter.extended_interactions.custom/shearing": "Collect wool",
"extinter.extended_interactions.custom/shearing.no_item": "You need a shears",
"extinter.extended_interactions.custom/shearing.no_wool": "No wool to collect"
}
评论 0
登录后参与评分
还没有评论,来抢沙发吧