Iron's Spells: Incantation
说出法术名称。施展它。
Incantation 直接捕获你的麦克风音频,通过离线语音识别器(Vosk)进行处理,并施展你刚刚说出的 Iron's Spells 中的法术。无需进行声音训练,语音模型会在首次启动时自动安装。
工作原理
Incantation 会自行打开你的麦克风——不涉及任何语音聊天模组——并将音频直接输入到一个 Vosk 识别器中,该识别器的语法基于已安装的模组实际注册的法术名称构建。封闭式语法的唯一“拒绝”方式是其 [unk] 标记,因此它往往会优先选择最接近的正确法术名称而非该标记——所以 0.10.6 版本增加了确保安全性的防御机制:匹配到的发音必须持续足够长的时间,从而合理地被认定为该短语;并且对于在 perSpellMinConfidence 中列出的任何法术,它会等待完整的 utterance(发声片段)及其自身的置信度阈值达标后才会触发。
施法随后取决于你实际装备的内容:Curios 栏位中的法术书、手持的附魔武器或穿戴的附魔护甲。如果你没有某个法术却念出它的名字,则不会发生任何效果。如果服务器希望允许玩家手持法术书进行施法,可以设置 castMode = ANY_SPELLBOOK。
识别过程完全在你的本地机器上运行。无需账户,无遥测数据,且你的麦克风音频永远不会被传输、录制或写入磁盘。Incantation 唯一接触网络的时刻是首次启动时下载语音模型;如果你不希望如此,可以设置 autoDownloadModel = false 并手动安装模型。
监听时机
默认情况下,仅当你持有法术书、法杖、附魔武器或附魔护甲——无论是在手中、穿戴状态或 Curios 栏位中——麦克风才会保持开启。 收起或移除这些物品时,麦克风将关闭。无需按键绑定。
这意味着当你的法术书收起时,与它的对话永远无法施放任何法术,这一点很重要,因为很多人会在同一个麦克风上使用语音聊天模组。但是,如果你始终将法术书保留在 Curios 栏位中,这在实践中接近于 ALWAYS_ON(常开模式)——因此如果你在战斗中途与朋友交谈,请使用 HOLD_KEY_AND_ITEM(按住键+物品)。携带法术书本身并不能证明你有施法意图;此模式还需要按住按键,因此除非你明确要求,否则语音永远不会到达识别器。
可根据喜好设置 gatingMode:
| 模式 |
麦克风开启条件 |
HOLD_ITEM |
当法术焦点位于手中、穿戴状态 或 Curios 栏位中时 (默认) |
HOLD_KEY_AND_ITEM |
当按住施法键 且 持有法术焦点时 |
HOLD_KEY |
当按住施法键时 |
ALWAYS_ON |
只要你在世界中——完全免提 |
这些门控机制控制的是音频捕获,而非识别:在所有非 ALWAYS_ON 模式下,识别器接收不到音频,设备处于关闭状态而非仅仅被忽略。当游戏失去焦点或暂停时,麦克风也会被释放。
HUD 上的麦克风芯片让你一目了然地知晓当前状态——点状指示灯在麦克风关闭时暗淡,开启时亮起,而在实际拾取声音时会闪烁,旁边还有实时的电平表。
功能特性
-
朗读任意索引法术 —— 适用于 Iron's Spells、其所有扩展包以及任何通过 Iron's API 注册法术的模组。
-
仅限装备施法 (默认开启) —— 只有当你身上确实拥有该法术时,它才会触发。其他情况会在离开客户端之前被拒绝。
-
支持附魔武器和护甲 —— 手持附魔剑或法杖,或穿戴附魔胸甲,说出其承载的法术名称,即可通过与普通右键点击相同的机制进行施法。
-
HUD 芯片 —— 角落锚定的芯片显示实时麦克风指示器和电平表,以及上次施法、近期施法历史、队列中的法术、未命中提示、最后听到的短语以及“你是想说……?”的同义词建议。
-
原版进度系统 —— 语音施法里程碑(1、10、50、200、1000次)和连击施法会以标准进度提示的形式呈现。
-
法术列表界面 —— 浏览注册表暴露的所有法术,查看 Vosk 监听的确切短语,以及每个法术的施法次数和学校筛选功能。
-
语音法典 —— 个人统计数据(最常施放的法术、每日连续天数、中位延迟时间)。
-
测试竞技场 —— 安全的练习模式,记录本应施放的法术而不实际触发任何东西。适合调整同义词或学习难以发音的法术。
-
首次启动欢迎向导 —— 引导你完成麦克风、模型配置及首次施法。
-
同义词 & 自定义短语 —— 将模型能够发音的词语绑定到任意法术 ID。
-
使用你自己的语言游玩 —— 西班牙语、俄语和法语的语音模型只需更改一行配置(modelId),并且 config/voicespells/phrasebook.json 会根据每个已安装的法术生成,并包含一个可编辑的 override 字段,因此你可以在一个文件中翻译整个法术列表,而不是逐个添加同义词。你的覆盖内容在更新后会保留,新安装的法术会自动追加。
模型只是其中一半。 识别器只听取其模型所知的单词,因此法术短语也必须被翻译——使用俄语模型去听英语法术名称只会听到一片寂静。仓库的 contrib/ 文件夹中包含社区贡献的西班牙语短语簿,已翻译并可直接使用。俄语版本是一个空白模板:包含 294 个条目,每个 override 均为空,因为曾经填充它的机器翻译版本从未对着麦克风说过,而错误的短语会被信任,导致需要填写的地方却被忽略。因此,俄语识别需要先填充该文件。/voicespells vocab 命令会告诉你加载的模型实际上能发音哪些短语。
德语尚不支持,并非因为没有模型:Iron's Spells 本身并未提供德语翻译,因此没有现成的德语法术名称可供参考。这需要手动编写短语包。如果你会说德语并愿意编写一个,请联系作者。
-
快捷施法 — 说一个词,即可从列表中施放第一个可施法的法术(已考虑冷却与法力)。
-
语音指令 — 说 no 以清除等待队列中的法术,或说 yes 以接受“你是想说……?”的别名建议(需先启用 handsFreeConfirm)。
-
语音奖励 (服务器端,默认关闭) — 通过语音施法的法术可以恢复得更快、伤害更高,或两者兼有:voiceCooldownPercent 用于缩放冷却时间,voiceLevelBonus 用于增加法术等级,且额外获得的等级按法术原本的法力消耗计费,而非更高的消耗。你可以为每个玩家单独设置这些值,使用 playerAdvantages:
playerAdvantages = [
"Steve=cooldown:50,level:2", # Steve 施法更快且更强
"!Alex", # Alex 遵循 Iron's Spells 的常规规则
]
开箱即用状态下没有任何改变——默认即为标准的 Iron's Spells 行为。开启 voiceVolumeScaling 后,奖励必须通过努力获得:你的物品本身能施放的法术等级——即法术书、附魔物品或卷轴,包含亲和加成(FREE 模式下为 1 级)——始终是保底等级,而一次施法能叠加多少 voiceLevelBonus 取决于你说话的音量:低语无法获得加成,正常说话声可获得约一半,大声喊叫则可获得全部加成——结果会四舍五入到整数等级,并根据你自己校准的说话声音进行判定。
-
仅吟唱模式 (服务器端,默认关闭) — 要求必须通过语音施法。FIRST_CAST 模式下,玩家在点击法术之前必须先通过语音施放一次该法术,从而解锁该法术;ALWAYS 模式下,法术只能通过语音施放。
-
服务器端控制 — 支持按玩家设置的白名单、黑名单、速率限制、附近广播以及施法日志记录。
依赖项
- Minecraft 1.21.1 (NeoForge 21.1.x) 或 1.20.1 (Forge 47.x)
- Iron's Spells 'n Spellbooks,由 iron431 制作
- Curios API —— 推荐使用,同时也是 Iron's Spells 的必要依赖
- 麦克风
- 无需安装语音聊天模组。 Incantation 会直接捕获麦克风音频,如果你安装了 Simple Voice Chat 用于和朋友交谈,它也能与之共存。
安装步骤
- 将 Incantation 的 jar 文件放入
mods/ 文件夹中,与 Iron's Spells 放在一起。
- 启动游戏。首次运行时,Incantation 会自动下载
vosk-model-small-en-us-0.15(约 40 MB)至 config/voicespells/ 目录。
- 进入世界,装备法术书(手持或使用 Curios 槽位),然后说出其中携带的一个法术名称。
希望自行安装模型?请设置 autoDownloadModel = false,从 alphacephei.com/vosk/models 获取模型,并将其内容解压到 config/voicespells/model/ 目录下,最终确保拥有 config/voicespells/model/am/、config/voicespells/model/conf/ 等结构。
对于难以识别的法术名称(如 Traveloptics、Cataclysm 或任何发音特殊的名称),请在 config/voicespells-client.toml 中映射别名:
customPhrases = [ "dark beam=traveloptics:abyssal_blast" ]
然后使用 More… → Reload grammar now —— 无需重启游戏。
配置
大多数设置可在游戏内通过 Mods → Iron's Spells: Incantation → Config 访问。
- Recognition tab(识别选项卡) — 门控模式、仅限装备物品限制、模糊容差、子串匹配、去重窗口、调试监控器。
- HUD tab(界面选项卡) — 角落位置、偏移量、不透明度。
- More menu(更多菜单) — 欢迎向导、Voice Codex、Diagnostics(诊断)、Test Arena(测试竞技场)、重新加载语法、配置文件导出/导入、麦克风校准。
客户端命令:/voicespells devices 列出游戏能检测到的所有捕获设备以及当前选中的设备——如果麦克风看似无响应,请从这里开始排查。
服务器设置 (config/voicespells-server.toml):施法模式 (CURIO_SPELLBOOK / ANY_SPELLBOOK / FREE)、按玩家白名单、黑名单、速率限制、附近广播半径。
故障排除
- 说话时毫无反应 — 首先检查门控模式。默认情况下,只有当法术书、法杖、附魔武器或附魔护甲处于你的手部、穿戴状态或 Curios 槽位中时,麦克风才会开启。HUD 上的麦克风圆点会提示你状态:变暗表示麦克风关闭。
- 聊天栏显示 "Vosk model not found" (或诊断界面显示
Vosk model: FAIL)—— config/voicespells/model/ 目录下缺少模型。请重新检查目录结构:am/、conf/、graph/ 应直接位于该路径下。
- 麦克风看似失效 — 运行
/voicespells devices 查看游戏能发现哪些设备,如果默认设备不是你想要的那个,请设置 captureDevice。
- 识别感觉缓慢 — 打开 More → Calibrate mic 并说几个法术名称进行校准。或者使用 Diagnostics 屏幕验证各项前置条件。
- Test Arena 无法施法 — 这是设计使然。它只会记录本应发生的施法动作,以便你安全地进行练习。
许可证
MIT。
鸣谢
- Vosk — Alpha Cephei (Apache 2.0)
- Iron's Spells 'n Spellbooks — iron431
- Spanish phrasebook(西班牙语短语集) — NeoTargetStudios (Spidercat0926),他翻译了跨九个法术模组的近 300 个法术名称,并为模组开发提供了帮助
Iron's Spells: Incantation
Say a spell's name. Cast it.
Incantation captures your microphone directly, runs the audio through an offline speech
recognizer (Vosk), and casts whichever Iron's Spells 'n Spellbooks spell you just said. No voice
training, and the speech model installs itself on first launch.
How it works
Incantation opens your microphone itself — no voice-chat mod involved — and feeds the audio
straight to a Vosk recognizer whose grammar is built from the spell names your installed mods
actually register. A closed grammar's only way to say no is its [unk] token, and it will often
prefer the least-bad spell name over it - so 0.10.6 adds the defences that make that safe: a match
has to have been spoken long enough to plausibly be that phrase, and any spell you list in
perSpellMinConfidence waits for the complete utterance and its own confidence bar before it
will fire.
Casting is then gated on what you actually have equipped: a spellbook in your Curios slot, an
imbued weapon you're holding, or imbued armor you're wearing. Saying the name of a spell you don't
have does nothing. Servers that would rather let you cast from a spellbook held in hand can set
castMode = ANY_SPELLBOOK.
Recognition runs entirely on your machine. No accounts, no telemetry, and your microphone audio is
never transmitted, never recorded, never written to disk. The one time Incantation touches the
network is the speech-model download on first launch; set autoDownloadModel = false and install
the model yourself if you would rather it didn't.
When it listens
By default the microphone is only open while you have a spellbook, staff, imbued weapon or
imbued armor — in either hand, worn, or in your Curios slot. Stow or remove it and the mic
closes. No keybind involved.
That means conversation with your spellbook stowed can never cast anything, which matters because
a lot of people run a voice-chat mod on the same microphone. But if you keep a spellbook in your
Curios slot permanently, this is close to ALWAYS_ON in practice — so if you talk to friends
mid-fight, use HOLD_KEY_AND_ITEM. Carrying a spellbook isn't on its own evidence you meant to
cast; that mode requires a held key too, so speech never reaches the recognizer unless you asked.
Set gatingMode to taste:
| Mode |
Microphone is open |
HOLD_ITEM |
while a spell focus is in your hands, worn, or in your Curios slot (default) |
HOLD_KEY_AND_ITEM |
while holding the cast key and a spell focus |
HOLD_KEY |
while holding the cast key |
ALWAYS_ON |
whenever you are in a world — fully hands-free |
These gate capture, not recognition: in every mode but ALWAYS_ON the recognizer never
receives the audio, and the device is closed rather than merely ignored. The mic is also released
whenever the game is unfocused or paused.
The HUD's mic chip tells you which state you're in at a glance — the dot is dim when the mic is
closed, lit when it's open, and pulses while it's actually hearing you, with a live level meter
beside it.
Features
-
Speak any indexed spell — works with Iron's Spells, all its addons, and any mod that
registers spells through Iron's API.
-
Equipped-only casting (default ON) — a spell only fires if you actually have it on you.
Anything else is rejected before it leaves your client.
-
Imbued weapons and armor supported — hold an imbued sword or staff, or wear an imbued
chestplate, say the spell it carries, it casts via the same mechanism as right-clicking.
-
HUD chip — corner-anchored chips showing a live mic indicator and level meter, plus last
cast, recent cast history, queued spells, miss toast, the last phrase heard, and "did you
mean…?" alias suggestions.
-
Vanilla advancements — voice-cast milestones (1, 10, 50, 200, 1000) and combo casts surface
as standard advancement toasts.
-
Spell List screen — browse every spell the registry exposed with the exact phrase Vosk
listens for, plus per-spell cast counts and school filtering.
-
Voice Codex — personal stats (top-cast spell, daily streak, median latency).
-
Test Arena — safe practice mode that records what would have cast without firing anything.
Useful for tuning aliases or learning a tricky spell's pronunciation.
-
Welcome wizard on first launch — walks you through mic + model + first cast.
-
Aliases & custom phrases — bind words the model can pronounce to any spell id.
-
Play in your own language — Spanish, Russian and French speech models are one config line
away (modelId), and config/voicespells/phrasebook.json is generated with every installed
spell and an editable override field, so you can translate the whole spell list in one file
instead of adding aliases one at a time. Your overrides survive updates, and newly installed
spells are appended automatically.
The model is only half of it. The recogniser only listens for words its model knows, so the
spell phrases have to be translated too — a Russian model against English spell names hears
nothing at all. The repository's contrib/ folder has a Spanish phrasebook contributed by the
community, translated and ready to use. The Russian one is a blank template: 294 entries with
every override empty, because the machine-translated version that used to fill it had never been
spoken into a microphone, and a wrong phrase gets trusted where a blank one asks to be filled.
Russian recognition therefore needs that file filled in first. /voicespells vocab tells you
which of your phrases the loaded model can actually pronounce.
German does not work yet, and not for want of a model: Iron's Spells ships no German
translation, so there are no German spell names to start from. It needs a hand-written phrase
pack. If you speak German and fancy writing one, please get in touch.
-
Loadout shortcuts — say one word, cast the first castable spell from a list (cooldown + mana
aware).
-
Voice commands — say no to clear spells waiting in the cast queue, or yes to accept a
"did you mean…?" alias suggestion (enable handsFreeConfirm first).
-
Reward speaking (server, off by default) — voice casts can come back faster, hit harder,
or both: voiceCooldownPercent scales the cooldown, voiceLevelBonus adds spell levels, and the
extra levels are charged at the spell's ordinary mana cost rather than the higher one. Set them
per player if you want, with playerAdvantages:
playerAdvantages = [
"Steve=cooldown:50,level:2", # Steve casts faster and harder
"!Alex", # Alex plays by ordinary Iron's Spells rules
]
Out of the box nothing is changed — the defaults are plain Iron's Spells. Turn on
voiceVolumeScaling and the bonus has to be earned: the level your item itself would cast at —
the spellbook, the imbued item, or the scroll, affinity bonus included (level 1 under FREE) — is
always the floor, and how much of voiceLevelBonus a cast adds on top depends on how loudly you
said it: a whisper earns none, your normal speaking voice about half, a raised voice all of it —
rounded to a whole level, judged against your own calibrated speaking voice.
-
Incantation-only mode (server, off by default) — require spells to be spoken. FIRST_CAST
makes a player voice-cast a spell once before they can click it, so learning the incantation
unlocks it; ALWAYS means spells can only ever be spoken.
-
Server-side controls — per-player whitelist, blocklist, rate limit, broadcast-nearby, cast
logging.
Requirements
- Minecraft 1.21.1 (NeoForge 21.1.x) or 1.20.1 (Forge 47.x)
- Iron's Spells 'n Spellbooks by iron431
- Curios API — recommended, and an Iron's Spells dependency anyway
- A microphone
- No voice-chat mod required. Incantation captures the microphone itself, and coexists with
Simple Voice Chat if you use one to talk to friends.
Setup
- Drop the Incantation jar in your
mods/ folder alongside Iron's Spells.
- Launch the game. On first run Incantation downloads
vosk-model-small-en-us-0.15 (~40 MB) into
config/voicespells/ for you.
- Join a world, equip a spellbook (hand or Curios slot), and say a spell it carries.
Prefer to install the model yourself? Set autoDownloadModel = false, grab one from
alphacephei.com/vosk/models, and unzip its contents into
config/voicespells/model/ so you end up with config/voicespells/model/am/,
config/voicespells/model/conf/, etc.
For tricky spell names (Traveloptics, Cataclysm, anything with unusual phonetics), map an alias in
config/voicespells-client.toml:
customPhrases = [ "dark beam=traveloptics:abyssal_blast" ]
then use More… → Reload grammar now — no restart needed.
Configuration
Most settings are accessible in-game from Mods → Iron's Spells: Incantation → Config.
- Recognition tab — gating mode, equipped-only restriction, fuzzy tolerance, substring match,
dedup window, debug monitor.
- HUD tab — corner, offset, opacity.
- More menu — welcome wizard, Voice Codex, Diagnostics, Test Arena, reload grammar, profile
export/import, calibrate mic.
Client commands: /voicespells devices lists every capture device the game can see and which one
is selected — start there if the microphone looks dead.
Server settings (config/voicespells-server.toml): cast mode (CURIO_SPELLBOOK / ANY_SPELLBOOK
/ FREE), per-player whitelist, blocklist, rate limit, broadcast-nearby radius.
Troubleshooting
- Nothing happens when you speak — check the gating mode first. By default the mic is only
open while a spellbook, staff, imbued weapon or imbued armor is in your hands, worn, or in your
Curios slot. The HUD mic dot tells you: dim means closed.
- Chat says "Vosk model not found" (or Diagnostics shows
Vosk model: FAIL) — no model under
config/voicespells/model/. Recheck the layout: am/, conf/, graph/ should sit directly
under that path.
- Microphone looks dead — run
/voicespells devices to see what the game can find, and set
captureDevice if the default isn't the one you want.
- Recognition feels slow — open More → Calibrate mic and say a few spell names.
Or use the Diagnostics screen to verify each prerequisite.
- Test Arena doesn't cast — by design. It records would-be casts so you can practice safely.
License
MIT.
Credits
- Vosk — Alpha Cephei (Apache 2.0)
- Iron's Spells 'n Spellbooks — iron431
- Spanish phrasebook — NeoTargetStudios (Spidercat0926), who translated close to 300 spell
names across nine spell mods and helped with the mod itself
评论 0
登录后参与评分
还没有评论,来抢沙发吧