ContextKeys
ContextKeys 允许一个键盘按键或鼠标按钮在 Minecraft 中执行不同的操作,具体取决于你当前的行为。它可以与 Minecraft 的标准操作以及已安装的 Fabric 模组配合使用。
首次设置
在首次打开 ContextKeys 之前:
- 打开 选项 → 控制 → 键位绑定。
- 找到 Open ContextKeys。
- 为其分配一个按键。
- 进入一个世界并按下该键以打开编辑器。
该绑定初始未分配,因此 ContextKeys 不会接管现有的控制功能。
智能键
智能键是由 ContextKeys 管理的键盘按键、鼠标按钮或修饰键组合。
要创建一个智能键:
- 打开 ContextKeys。
- 选择 创建智能键。
- 按下你想使用的按键或鼠标按钮。
- 添加一个或多个规则。
- 为不匹配任何规则的情况选择一个后备操作。
可以随时启用、禁用或删除智能键。
规则
每条规则遵循简单的结构:
当所有选定的条件匹配时,执行此操作。
规则从上到下进行检查。第一个匹配且启用的规则胜出,仅执行其操作。使用 上移 和 下移 来更改规则优先级。
没有条件的规则始终匹配,因此它非常适合作为列表底部的通用操作。规则也可以在不删除的情况下被禁用。
条件
规则可以检查以下内容:
- 主手持有的精确物品、命名空间或物品标签。
- 副手持有的精确物品、命名空间或物品标签。
- 你是否正在潜行。
- 你注视的精确方块或方块标签。
- 你注视的实体类型。
- 你是否正在骑乘任何东西。
- 你骑乘的精确实体类型。
- 是否处于无屏幕打开的正常游戏状态。
- 是否打开了特定的某个屏幕。
一条规则中的所有条件必须全部匹配。
选择 使用当前上下文 可以根据 ContextKeys 当前观察到的内容创建条件,例如你手持的物品、目标方块、目标实体、骑乘状态、潜行状态或打开的屏幕。你可以选择添加哪些建议的事实。
你也可以选择 条件 手动输入条件。
操作
ContextKeys 会发现由 Minecraft 和已安装的 Fabric 模组注册的正常按键操作。
你可以按名称、类别、来源、翻译键或当前绑定来搜索操作。
当你已知分配的按键但不知道操作名称时,选择 学习操作。按下该分配的按键,然后从匹配的操作中选择。
ContextKeys 仅针对所选的操作。其他共享相同原始绑定的操作不会有意触发。
操作模式
每个选定的按键操作可以使用三种模式之一。
自动 (AUTO) 使用安全默认行为并执行一次激活。
按下 (PRESS) 执行恰好一次激活。用于诸如丢弃物品、打开屏幕、切换视角或交换手的操作。
按住 (HOLD) 激活操作并保持按住状态,直到你释放智能键。用于依赖按住控制的操作,例如某些缩放或与移动相关的模组操作。
当按住开始时,ContextKeys 会将选定的操作锁定,直到释放。在按住智能键期间更改物品或上下文不会切换到另一个规则。
后备
后备操作在不匹配任何规则时运行。
你可以选择:
- 原始输入 以保留智能键的正常行为。
- 无操作 以抑制输入。
- 另一个发现的操作。
当你希望按键在你配置的情况之外表现正常时,原始输入通常是最佳选择。
冲突
冲突 屏幕查找当前由多个 Minecraft 操作共享的物理绑定。
选择一个冲突,为这些操作创建具有禁用规则候选项的智能键。然后你可以启用你想要的操作,添加条件,并安排它们的优先级。
HUD
启用 HUD 以查看每个智能键当前获胜的操作。
位置 (At) 按钮循环通过四个位置:
- 左上 (TL) 表示左上角。
- 右上 (TR) 表示右上角。
- 左下 (BL) 表示左下角。
- 右下 (BR) 表示右下角。
HUD 使用与实际输入处理相同的规则评估。
调试模式
当规则未按预期行为时,启用 调试 (Debug)。
调试显示会显示最新的智能键输入、相关上下文信息、规则结果、获胜操作以及选定的分发模式。
保存、导出和导入
更改会自动保存到 config/contextkeys.json。智能键、规则顺序、条件、操作、模式、后备选择、启用状态、HUD 设置和选定的 HUD 位置在重启 Minecraft 后保持不变。
导出 (Export) 将可读副本写入 config/contextkeys-export.json。
导入 (Import) 加载 config/contextkeys-import.json。文件在替换活动配置之前会经过验证。如果导入失败,当前配置将被保留。
缺失的操作或引用将以警告形式可见,而不会导致崩溃或静默删除你的设置。
安全的输入处理
ContextKeys 保留了在聚焦文本字段(如聊天、命令、告示牌、书籍、铁砧名称和搜索框)中的正常打字功能。
适当的时候会释放按住的操作,包括在释放智能键、更改屏幕、失去窗口焦点、断开连接、更改配置、禁用或删除相关设置或关闭客户端之后。
ContextKeys
ContextKeys lets one keyboard key or mouse button perform different actions depending on what you are doing in Minecraft. It works with standard actions from Minecraft and installed Fabric mods.
First setup
Before opening ContextKeys for the first time:
- Open Options → Controls → Key Binds.
- Find Open ContextKeys.
- Assign a key to it.
- Enter a world and press that key to open the editor.
The binding starts unassigned so ContextKeys does not take over an existing control.
Smart Keys
A Smart Key is a keyboard key, mouse button, or modifier combination managed by ContextKeys.
To create one:
- Open ContextKeys.
- Select Create Smart Key.
- Press the key or mouse button you want to use.
- Add one or more rules.
- Choose a fallback for situations where no rule matches.
Smart Keys can be enabled, disabled, or deleted at any time.
Rules
Each rule follows a simple structure:
WHEN all selected conditions match, run this action.
Rules are checked from top to bottom. The first matching enabled rule wins, and only its action runs. Use Up and Down to change rule priority.
A rule without conditions always matches, so it is useful as a general action at the bottom of the list. Rules can also be disabled without deleting them.
Conditions
Rules can check:
- The exact item, namespace, or item tag in your main hand.
- The exact item, namespace, or item tag in your off hand.
- Whether you are sneaking.
- The exact block or block tag you are looking at.
- The entity type you are looking at.
- Whether you are riding anything.
- The exact entity type you are riding.
- Whether normal gameplay is active with no screen open.
- Whether one specific screen is open.
All conditions in one rule must match.
Select Use Current Context to create conditions from what ContextKeys currently observes, such as your held item, targeted block, targeted entity, riding state, sneaking state, or open screen. You choose which suggested facts to add.
You can also select Condition to enter a condition manually.
Actions
ContextKeys discovers normal key actions registered by Minecraft and installed Fabric mods.
You can search for an action by its name, category, origin, translation key, or current binding.
Select Learn Action when you know the assigned key but not the action name. Press that assigned key, then choose from the matching actions.
ContextKeys targets only the selected action. Other actions sharing the same original binding are not intentionally triggered with it.
Action modes
Every selected key action can use one of three modes.
AUTO uses the safe default behavior and performs one activation.
PRESS performs exactly one activation. Use it for actions such as dropping an item, opening a screen, changing perspective, or swapping hands.
HOLD activates the action and keeps it held until you release the Smart Key. Use it for actions that depend on a held control, such as certain zoom or movement related mod actions.
When HOLD begins, ContextKeys keeps the selected action locked until release. Changing items or context while holding the Smart Key does not switch to another rule.
Fallback
The fallback runs when no rule matches.
You can choose:
- Original Input to preserve the normal behavior of the Smart Key.
- Do Nothing to suppress the input.
- Another discovered key action.
Original Input is usually the best choice when you want the key to behave normally outside your configured situations.
Conflicts
The Conflicts screen finds physical bindings currently shared by multiple Minecraft actions.
Select a conflict to create a Smart Key with disabled rule candidates for those actions. You can then enable the actions you want, add conditions, and arrange their priority.
HUD
Enable the HUD to see which action currently wins for each Smart Key.
The At button cycles through four positions:
- TL means top left.
- TR means top right.
- BL means bottom left.
- BR means bottom right.
The HUD uses the same rule evaluation as actual input handling.
Debug mode
Enable Debug when a rule does not behave as expected.
The debug display shows the latest Smart Key input, relevant context information, rule results, the winning action, and the selected dispatch mode.
Saving, export, and import
Changes are saved automatically to config/contextkeys.json. Smart Keys, rule order, conditions, actions, modes, fallback choices, enabled states, HUD settings, and the selected HUD position persist after restarting Minecraft.
Export writes a readable copy to config/contextkeys-export.json.
Import loads config/contextkeys-import.json. The file is validated before it replaces the active configuration. If importing fails, the current configuration is preserved.
Missing actions or references remain visible with warnings instead of crashing or silently deleting your setup.
Safe input handling
ContextKeys preserves normal typing in focused text fields such as chat, commands, signs, books, anvil names, and search boxes.
Held actions are released when appropriate, including after releasing the Smart Key, changing screens, losing window focus, disconnecting, changing the configuration, disabling or deleting the relevant setup, or closing the client.
下载 ContextKeys
下载 ContextKeys
下载 ContextKeys
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 ContextKeys
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 ContextKeys
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 ContextKeys
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 ContextKeys
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 ContextKeys
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 ContextKeys
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 ContextKeys
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
添加区块认领和玩家组队功能,并与 Xaero's Minimap 和 World Map 集成
模组
添加全屏世界地图,显示你在世界中已探索的区域。与 Xaero's Minimap 搭配使用效果极佳。
评论 0
登录后参与评分
还没有评论,来抢沙发吧