HITWtimer
纯客户端 Fabric + Kotlin 模组 · Minecraft 26.1.2 · 作者 KCl · 许可证 CC0-1.0
面向 HITW(Hole in the Wall) 等小游戏:根据屏幕字幕 / 标题或聊天自动识别陷阱(trap),并在 HUD 上显示多阶段倒计时(含可选 Preparation 准备阶段、颜色与音效提示)。
本模组不修改服务端玩法,只在客户端读取字幕/聊天并绘制 HUD,可在 Hypixel 等服务器正常使用。
English documentation: jump to English Documentation at the end of this file.
目录
- 功能一览
- 安装与依赖
- 快速开始
- 快捷键
- 命令
- HUD 说明
- 使用案例:Falling Sand
- 配置系统总览
- overallconfig.txt(全局配置)
- traplist 文件(陷阱列表)
- 怎么写一个 Trap
- 检测匹配详解
- Preparation 准备阶段
- 事件(events)格式
- 调试技巧
- 构建
- 文件结构
- 常见问题
功能一览
| 模块 | 说明 |
|---|---|
| 字幕 / 聊天检测 | 通过 Title/Subtitle Mixin + 聊天事件匹配 trap;可按 trap 指定 SUBTITLE / CHAT / BOTH |
| 多阶段计时 | 每个 trap 配置多个阶段;HUD 显示当前阶段倒计时 + 后续阶段预览 |
| Preparation | 字幕触发时可自动在阶段列表第一行插入英文 Preparation 倒计时(chat 触发永不插入) |
| HUD | 深色半透明背景、多 trap 同时显示、颜色可配 |
| HUD 编辑 | 按 K 打开编辑层:拖动位置、滚轮缩放、Esc/K 保存 |
| 三级配置 | overall(全局)→ traplist 头部默认 → 单个 trap 覆盖 |
| 多列表 | 多个 traplist*.txt,命令运行时 enable/disable |
| 热重载 | 按 L 或 /hitwtimer reload 即时生效 |
| 按键绑定 | 出现在原版「控制 → 按键绑定」的 HITWtimer / HITW 计时器 分类下 |
| 双语 | en_us / zh_cn 语言文件;配置模板中英注释 |
安装与依赖
| 依赖 | 版本要求 |
|---|---|
| Minecraft | ~26.1.2 |
| Fabric Loader | ≥ 0.19.2 |
| Fabric API | 与 26.1.2 匹配 |
| Fabric Language Kotlin | 与环境匹配 |
| Java | ≥ 25 |
将构建产物 hitwtimer-*.jar 放入 .minecraft/mods/,与 Fabric 一起启动客户端即可。
首次启动会自动在:
.minecraft/config/hitwtimer/
生成示例配置(overallconfig.txt、traplist1.txt 等)。
快速开始
- 安装模组并进入游戏。
- 确认
config/hitwtimer/overallconfig.txt里:enabled=true enabled_lists=traplist1 detect_subtitle=true - 编辑
config/hitwtimer/traplist1.txt,写好 trap 的pattern=(必须与游戏实际字幕/聊天文字匹配)。 - 游戏内按 L 热重载(或
/hitwtimer reload)。 - 进入 HITW;当字幕出现匹配文字时,HUD 自动开始计时。
- 按 K 调整 HUD 位置与大小,再按 Esc/K 保存。
建议调试时临时打开:
debug=true
匹配时会在控制台打日志,触发时聊天也会有提示。
快捷键
均可在 选项 → 控制 → 按键绑定 → HITW 计时器 / HITWtimer 中修改。
| 默认键 | 名称 | 功能 |
|---|---|---|
| H | 切换 HUD 显示 | 显示 / 隐藏计时 HUD(不清除正在跑的计时器逻辑,只控制是否绘制) |
| K | HUD 编辑模式 | 打开半透明编辑层:左键拖动移动、滚轮缩放;Esc 或再按 K 保存并退出 |
| L | 重载配置 | 重新加载 overallconfig + 所有启用的 traplist,并清空检测去重缓存 |
HUD 编辑模式细节
- 必须打开编辑 Screen 才能拖动(游戏内鼠标锁定时无法自由拖拽,因此用 Screen 释放光标)。
- 编辑时即使没有激活 trap,也会显示占位面板,方便定位。
- 退出时写入
overallconfig.txt的hud_x/hud_y/hud_scale。
命令
客户端命令(聊天中输入):
/hitwtimer
/hitwtimer list
/hitwtimer reload
/hitwtimer enable <name>
/hitwtimer disable <name>
/hitwtimer settings
| 命令 | 作用 |
|---|---|
/hitwtimer |
显示可用子命令 |
list |
列出当前启用的 traplist(绿字名称 + 灰字 description) |
reload |
等同按 L:重载配置与列表 |
enable <name> |
启用名为 name 的列表(文件名不含 .txt,如 traplist1),并自动 reload |
disable <name> |
禁用该列表并 reload |
settings |
打开简易设置界面(预览全局配置等) |
列表文件必须先存在于 config/hitwtimer/。enable/disable 会改运行时启用集合;若要长期固定,请同步改 overallconfig.txt 的 enabled_lists=。
HUD 说明
显示结构
每个激活的 trap 大致如下:
falling sand 18.0s ← trap 名 + 总剩余时间
Preparation 3.0s ← 自动插入的第一阶段(仅字幕+允许时)
stop falling ← 后续阶段(未到则灰色预览)
sands gone
准备结束后:
falling sand 15.0s
Preparation ← 已过:灰色、无倒计时
stop falling 10.0s ← 当前阶段:彩色 + 倒计时
sands gone ← 未到:灰色预览
- Preparation 标签固定为英文
Preparation,作为 trap 阶段列表的第一行(与其它事件同一列)。 - 不要在
events=里手动写 Preparation 行。 - 多个 trap 同时触发时会纵向排列,中间空行分隔。
外观相关配置(overallconfig)
| 键 | 默认 | 说明 |
|---|---|---|
hud_x / hud_y |
10 / 10 | 左上角位置(GUI 坐标,可用 K 编辑) |
hud_scale |
1.0 | 缩放 0.4~4.0 |
render_background |
true | 是否画深色半透明底 |
hud_horizontal_padding |
8 | 背景水平内边距 |
hud_vertical_padding |
6 | 背景垂直内边距 |
使用案例:Falling Sand
以 HITW 常见陷阱 Falling Sand(落沙) 为例,完整走通「配置 → 检测 → 显示」。
1. 场景
游戏字幕/标题出现类似:
Falling Sand
或聊天/其它文案含 sand。你希望:
- 先有 3 秒 Preparation(站位准备)
- 再倒计时 10 秒 到「stop falling」
- 再 5 秒 到「sands gone」
2. 在 traplist1.txt 中写入
# 列表头部默认(第一个 name= 之前)
enabled=true
description=Classic HITW traps
subtitle_preparation=true
preparation_time=3.0
preparation_color=#55FF55
main_color=#FFFFFF
source=SUBTITLE
match_mode=CONTAINS
case_sensitive=false
# ---------- 单个 trap ----------
name=falling sand
enabled=true
source=SUBTITLE
subtitle_preparation=true
main_color=#FFAA00
preparation_time=3.0
preparation_color=#55FF55
start_sound=block.note_block.pling
end_sound=block.note_block.bell
pattern=falling sand|sand
match_mode=CONTAINS
case_sensitive=false
events=
stop falling|10|#FF5500|entity.blaze.shoot
sands gone|15|
关于 events 时间:实现里各阶段的时间为相对「主阶段开始」(Preparation 结束后)的绝对偏移秒数,按数值排序。
上例中stop falling在 prep 结束后 10s 处,sands gone在 15s 处(即 stop falling 后再约 5s)。
若写成sands gone|5,会排在 10 之前,顺序会与预期相反。
3. 确保列表已启用
overallconfig.txt:
enabled=true
enabled_lists=traplist1
detect_subtitle=true
subtitle_preparation=true
preparation_time=3.0
游戏内执行:
/hitwtimer reload
或按 L。
4. 时间线(字幕触发)
| 时刻 | HUD 表现 |
|---|---|
| t=0 字幕匹配 | 出现 falling sand,第一行 Preparation 3.0s…,下面灰色预览两个事件 |
| t=3 | Preparation 结束,播放 start_sound,进入 stop falling 倒计时 |
| t=13 | 到达 stop falling 节点(可播事件音),进入下一阶段 |
| t=18 | 到达 sands gone,计时结束,播放 end_sound |
5. 若字幕对不上
- 设
debug=true,重载后看控制台匹配日志。 - 把
pattern改成字幕实际原文(可先用CONTAINS缩短关键词)。 - 确认语言/大小写:
case_sensitive=false时不区分大小写。 - 确认
source与检测源一致(字幕用SUBTITLE或BOTH)。
6. 若不想要 Preparation
name=falling sand
subtitle_preparation=false
pattern=falling sand
events=
stop falling|10
sands gone|15
subtitle_preparation=false 在 trap(陷阱)级具有严格优先级:即使列表或全局设置为 true,该 trap 也绝无准备阶段。
7. 若只想从聊天触发、不要准备
name=falling sand
source=CHAT
pattern=falling sand
events=
stop falling|10
sands gone|15
Chat(聊天)来源永远不会插入 Preparation(准备阶段)。
配置系统总览
config/hitwtimer/
├── overallconfig.txt # 全局 / 模组级
├── traplist1.txt # 列表 1(头部 = 列表默认 + 多个 name= trap)
├── traplist2.txt # 你可自建更多
└── ...
三级优先级(高 → 低)
- trapconfig:某个
name=块内的字段 - traplistconfig:该 txt 里第一个
name=之前的头部默认值 - overallconfig:全局回退值
特例:trap 级 subtitle_preparation=false 严格无准备,不回退列表或全局的 true。
解析时键名大小写不敏感,下划线可省略(如 preparation_time / preparationtime)。
overallconfig.txt(全局配置)
完整示例
# HITWtimer Overall Config
# --- Master ---
enabled=true
# --- Lists(要加载的列表文件名,逗号分隔,不要写 .txt)---
enabled_lists=traplist1
# enabled_lists=traplist1,pvp,custom
# --- Detection ---
detect_subtitle=true
detect_chat=true
# --- Preparation defaults(可被 list/trap 覆盖)---
subtitle_preparation=true
preparation_time=3.0
preparation_color=#55FF55
main_color=#FFFFFF
# --- HUD(可用游戏内 K 编辑后自动写回)---
hud_x=10
hud_y=10
hud_scale=1.0
render_background=true
hud_horizontal_padding=8
hud_vertical_padding=6
# --- Behavior ---
auto_reload_keywords=hitw,hole in the wall,游戏开始
# --- Misc ---
debug=false
键说明
| 键 | 默认 | 说明 |
|---|---|---|
enabled |
true | 模组总开关 |
enabled_lists |
traplist1 | 启动时加载的列表 |
detect_subtitle |
true | 是否检测字幕/标题 |
detect_chat |
true | 是否检测聊天 |
subtitle_preparation |
true | 全局:字幕是否默认带 Preparation(准备阶段) |
preparation_time |
3.0 | 默认准备秒数 |
preparation_color |
#55FF55 | 准备阶段颜色 |
main_color |
#FFFFFF | 默认事件颜色 |
hud_* |
见上 | HUD 位置/缩放/背景 |
auto_reload_keywords |
… | 预留关键词(部分逻辑) |
debug |
false | 详细匹配日志 + 触发聊天提示 |
颜色支持 #RRGGBB 或 RRGGBB。
traplist 文件(陷阱列表)
文件命名
- 任意名,如
traplist1.txt、pvp.txt、mytraps.txt - 在
enabled_lists或/hitwtimer enable <name>中用不带扩展名的名字
文件结构
# 注释任意
# ===== traplistconfig:头部默认(必须在第一个 name= 之前)=====
enabled=true
description=经典 HITW 列表
subtitle_preparation=true
preparation_time=3.0
...
# ===== 一个或多个 trap =====
name=trap_a
pattern=...
events=
...
name=trap_b
pattern=...
events=
...
头部常用键
| 键 | 说明 |
|---|---|
enabled |
列表是否启用(列表本身) |
description |
/hitwtimer list 里显示的说明 |
subtitle_preparation |
本列表 trap 的默认是否准备 |
preparation_time / preparation_color |
本列表准备默认值 |
main_color |
本列表默认主色 |
start_sound / end_sound |
默认开始/结束音效 ID |
source |
默认检测源 |
match_mode / case_sensitive |
默认匹配方式 |
怎么写一个 Trap
必填
| 字段 | 说明 |
|---|---|
name= |
唯一 ID,也作 HUD 标题回退 |
pattern= |
匹配字幕/聊天的关键词(支持 a|b|c OR) |
events= + 至少一行阶段 |
阶段列表 |
可选(不写则 list → overall)
| 字段 | 说明 |
|---|---|
enabled |
true/false |
source |
SUBTITLE / CHAT / BOTH |
subtitle_preparation |
true/false(false = 严格无准备) |
preparation_time |
秒 |
preparation_color |
#RRGGBB |
main_color |
事件默认色 |
start_sound / end_sound |
原版音效 ID,如 block.note_block.pling |
match_mode |
CONTAINS / EQUALS / STARTS_WITH / REGEX |
case_sensitive |
默认 false |
最小可用示例
name=my_trap
pattern=关键词
events=
phase1|5
phase2|10
完整示例模板(可复制)
name=your_trap_id
enabled=true
source=SUBTITLE
subtitle_preparation=true
preparation_time=3.0
preparation_color=#55FF55
main_color=#FFFFFF
start_sound=block.note_block.pling
end_sound=block.note_block.bell
pattern=english text|中文关键词
match_mode=CONTAINS
case_sensitive=false
events=
stage one|5.0|#FFAA00|entity.experience_orb.pickup
stage two|12.0|
stage three|20.0|#55FFFF|
检测匹配详解
匹配在 SubtitleDetector 中进行:对每个启用 trap,用其 pattern + match_mode + case_sensitive 测试 component.string。
pattern
- 必填
- 非 REGEX 时:
a|b|c表示 OR(任一命中即可) - REGEX 时:整段作正则,
|为正则语法
match_mode
| 模式 | 行为 |
|---|---|
CONTAINS(默认) |
文本包含 pattern |
EQUALS |
整段相等 |
STARTS_WITH |
以 pattern 开头 |
REGEX |
正则 containsMatchIn |
示例
| pattern | mode | 能匹配的例子 |
|---|---|---|
falling sand|sand |
CONTAINS | Falling Sand!、sand is coming |
Falling Sand |
EQUALS | 仅整段等于(受 case_sensitive 影响) |
anvil.*fall |
REGEX | Anvil is falling |
来源过滤
source=SUBTITLE:只响应字幕/标题source=CHAT:只响应聊天source=BOTH:两者皆可
全局还需 detect_subtitle / detect_chat 为 true。
去重
短时间内相同消息 / 同名 trap 不会重复狂触发,避免字幕刷新刷屏。
Preparation 准备阶段
| 规则 | 行为 |
|---|---|
字幕触发 + subtitle_preparation 解析为 true |
自动插入 Preparation |
字幕触发 + trap 级 subtitle_preparation=false |
严格无准备 |
| 聊天触发 | 永远无准备 |
| HUD 文案 | 固定英文 Preparation,作为阶段列表第一行 |
| 时长 / 颜色 | trap → list → overall 的 preparation_time / preparation_color |
start_sound |
在 Preparation 结束、进入主阶段时播放 |
不要在 events= 里写 Preparation 行。
事件(events)格式
events=
显示名|偏移秒数|颜色(可选)|声音(可选)
| 段 | 必填 | 说明 |
|---|---|---|
| 显示名 | 是 | HUD 上显示的阶段名 |
| 偏移秒数 | 是 | 相对 Preparation 结束后(无 prep 则相对触发时刻)的绝对时间点(秒) |
| 颜色 | 否 | #RRGGBB;缺省用 trap main_color → list → overall → 白 |
| 声音 | 否 | 原版 namespace:path 风格音效 ID |
多行缩进写在 events= 下方。实现会按偏移秒数排序。
颜色回退顺序
事件指定 → trap main_color → list 默认 → overall main_color → 白色。
编写建议
- 用递增的时间点表示阶段边界,例如
5、12、20,而不是把「每段时长」写成乱序小数。 - 事件名用你容易看懂的英文/中文均可(Preparation 本身除外,那是自动的)。
调试技巧
-
打开 debug
debug=true然后按 L。控制台会打印每次字幕/聊天匹配尝试;触发时聊天有
trap started类信息。 -
先放宽 pattern
用短关键词 +CONTAINS,确认能触发后再收紧。 -
确认字幕原文
不同服务器/语言的 Title 文本不同,以你屏幕上实际为准。 -
确认列表启用
/hitwtimer list -
改完必重载
改 txt 后按 L 或/hitwtimer reload。 -
HUD 看不见
按 H 确认未隐藏;按 K 看是否移出屏幕外;检查enabled=true。
构建
# Windows
.\gradlew.bat build -x test
# Linux / macOS
./gradlew build -x test
产物:build/libs/hitwtimer-*.jar(另有 sources jar 可忽略)。
开发调试:
.\gradlew.bat runClient
配置会写在运行目录 run/config/hitwtimer/。
文件结构
hitwtimer/
├── src/
│ ├── main/ # 模组入口、fabric.mod.json、语言文件
│ └── client/
│ ├── kotlin/... # 配置、检测、计时、HUD、命令、编辑屏
│ └── java/.../mixin/ # Options / Gui / Title 等 Mixin
├── config/hitwtimer/ # 运行时配置(首次启动生成,不在源码树)
├── README.md
├── build.gradle.kts
└── gradle.properties
核心逻辑入口:
| 路径 | 职责 |
|---|---|
HITWtimerClient.kt |
客户端初始化、按键、tick |
SubtitleDetector.kt |
字幕/聊天匹配与启动计时 |
ActiveTimer.kt / TimerManager.kt |
阶段推进与音效 |
HudRenderer.kt + GuiHudRenderMixin |
HUD 数据与绘制 |
HudEditScreen.kt |
编辑模式 |
ConfigLoader.kt |
配置解析与模板生成 |
HitwCommands.kt |
/hitwtimer 命令 |
常见问题
Q: Controls 里找不到按键?
A: 打开「控制 → 按键绑定」,找分类 HITW 计时器(中文)或 HITWtimer(英文)。
Q: 按 K 没反应 / 拖不动?
A: 编辑必须进入 HudEditScreen(按 K 后应有顶部黄字提示)。在菜单界面时不会打开;请在世界内、无其它界面时按 K。
Q: 字幕出了但不计时?
A: 查 pattern、source、enabled、列表是否在 enabled_lists、是否 detect_subtitle=true,并开 debug=true。
Q: Preparation 不出现?
A: 是否 chat 触发?是否 subtitle_preparation=false?全局/列表是否关闭?
Q: 改了配置没变化?
A: 必须 L 或 /hitwtimer reload。
Q: 音效没声音?
A: 确认音效 ID 合法(原版注册表内),且游戏音量/UI 音量未关。
Q: 能多个列表同时用吗?
A: 可以。enabled_lists=traplist1,pvp 或多次 enable。
License
CC0-1.0 — 可自由使用、修改与再分发。
提示:首次运行生成的 config/hitwtimer/ 与 generated-config-examples/(若有)含带注释的模板。最稳妥的路径是:复制 falling sand 示例 → 改 pattern 为你服字幕原文 → debug=true 验证 → 关掉 debug 日常使用。
如需扩展(多 HUD 并列布局、更多命令、配置 GUI 完整编辑 trap 等),可在此模组结构上继续迭代。
English Documentation
Client-only Fabric + Kotlin mod · Minecraft 26.1.2 · Author KCl · License CC0-1.0
HITWtimer is for HITW (Hole in the Wall) and similar minigames. It watches subtitles / titles and chat, matches configurable traps, and shows a multi-stage countdown HUD (optional auto Preparation stage, colors, and sounds).
This mod does not change server gameplay. It only reads client subtitle/chat text and draws a HUD. Safe for servers such as Hypixel.
Table of contents
- Features
- Install and dependencies
- Quick start
- Keybinds
- Commands
- HUD
- Worked example: Falling Sand
- Config system
- overallconfig.txt
- Trap list files
- Writing a trap
- Matching
- Preparation
- Events format
- Debugging
- Build
- FAQ
- License
Features {#features-en}
| Area | Description |
|---|---|
| Subtitle / chat detection | Title/subtitle mixin + chat events; per-trap SUBTITLE / CHAT / BOTH |
| Multi-stage timers | Each trap defines stages; HUD shows current countdown and upcoming stages |
| Preparation | On subtitle triggers, can auto-insert English Preparation as the first stage row (never for chat) |
| HUD | Semi-transparent background, multi-trap layout, colors |
| HUD modes | ALWAYS / ON_TRAP / DISABLED (H cycles; DISABLED = no HUD, no detect, no sound) |
| Background opacity | Configurable; default 50%; editable in HUD edit mode |
| HUD edit | K opens free-cursor editor: drag, scroll scale, Shift+scroll opacity |
| 3-level config | overall → traplist header defaults → per-trap override |
| Multiple lists | Several traplist*.txt; enable/disable at runtime |
| Hot reload | L or /hitwtimer reload |
| Keybinds | Shown under Controls → HITWtimer |
| i18n | en_us / zh_cn lang files |
Install and dependencies {#install-and-dependencies-en}
| Dependency | Requirement |
|---|---|
| Minecraft | ~26.1.2 |
| Fabric Loader | ≥ 0.19.2 |
| Fabric API | Matching 26.1.2 |
| Fabric Language Kotlin | Matching your stack |
| Java | ≥ 25 |
Put hitwtimer-*.jar in .minecraft/mods/ and launch with Fabric.
First run creates:
.minecraft/config/hitwtimer/
with sample overallconfig.txt and traplist1.txt.
Quick start {#quick-start-en}
- Install the mod and enter a world.
- Check
config/hitwtimer/overallconfig.txt:enabled=true enabled_lists=traplist1 detect_subtitle=true hud_mode=ON_TRAP hud_bg_opacity=0.5 - Edit
traplist1.txtso each trappattern=matches real subtitle/chat text. - Press L (or
/hitwtimer reload). - Play HITW; matching text starts the HUD timer.
- Press K to move/scale/opacity the HUD; Esc/K to save.
For debugging:
debug=true
Keybinds {#keybinds-en}
Change under Options → Controls → Key Binds → HITWtimer.
| Default | Name | Action |
|---|---|---|
| H | Cycle HUD mode | ALWAYS → ON_TRAP → DISABLED → … (saves to config) |
| K | HUD edit mode | Drag move, scroll scale, Shift+scroll opacity, M mode, B background, Esc/K save |
| L | Reload configs | Reload overall + enabled lists; clear match dedup |
HUD modes
| Mode | Behavior |
|---|---|
| ALWAYS | HUD always drawn (placeholder when no trap) |
| ON_TRAP | HUD only while a trap timer is active (default) |
| DISABLED | No HUD, no detection, no sounds/timers |
HUD edit mode
- Requires an open edit screen so the mouse is free (in-game grab cannot drag UI).
- Placeholder panel appears while editing even with no trap.
- Saves
hud_x,hud_y,hud_scale, opacity, mode, etc. tooverallconfig.txton exit.
命令 {#commands-en}
客户端命令:
/hitwtimer
/hitwtimer list
/hitwtimer reload
/hitwtimer enable <name>
/hitwtimer disable <name>
/hitwtimer settings
| 命令 | 效果 |
|---|---|
/hitwtimer |
列出子命令 |
list |
已启用的陷阱列表(名称 + 描述) |
reload |
同 L |
enable <name> |
启用名为 name.txt 的列表文件并重新加载 |
disable <name> |
禁用列表并重新加载 |
settings |
简易设置预览界面 |
列表文件必须存在于 config/hitwtimer/ 目录下。对于永久启用的列表,还需在 overallconfig.txt 中编辑 enabled_lists=。
HUD 界面 {#hud-en}
布局
falling sand 18.0s
Preparation 3.0s
stop falling
sands gone
准备阶段后:
falling sand 15.0s
Preparation
stop falling 10.0s
sands gone
- 标签始终为英文 Preparation,作为第一行阶段显示。
- 请勿将 Preparation 放入
events=中。 - 多个陷阱垂直堆叠,中间以空白行分隔。
外观键值 (overallconfig)
| 键值 | 默认值 | 含义 |
|---|---|---|
hud_x / hud_y |
10 / 10 | 左上角坐标(GUI 坐标) |
hud_scale |
1.0 | 缩放比例 0.4–4.0 |
hud_mode |
ON_TRAP | ALWAYS / ON_TRAP / DISABLED |
render_background |
true | 绘制面板背景 |
hud_bg_opacity |
0.5 | 透明度 0.0–1.0(默认 50%) |
hud_horizontal_padding |
8 | 水平内边距 |
hud_vertical_padding |
6 | 垂直内边距 |
示例:下落沙子 {#worked-example-falling-sand-en}
场景
副标题如 Falling Sand。你需要:
- 3秒 Preparation
- 10秒阶段:
stop falling - 15秒阶段:
sands gone(停止下落后约 5 秒)
traplist1.txt
enabled=true
description=Classic HITW traps
subtitle_preparation=true
preparation_time=3.0
preparation_color=#55FF55
main_color=#FFFFFF
source=SUBTITLE
match_mode=CONTAINS
case_sensitive=false
name=falling sand
enabled=true
source=SUBTITLE
subtitle_preparation=true
main_color=#FFAA00
preparation_time=3.0
preparation_color=#55FF55
start_sound=block.note_block.pling
end_sound=block.note_block.bell
pattern=falling sand|sand
match_mode=CONTAINS
case_sensitive=false
events=
stop falling|10|#FF5500|entity.blaze.shoot
sands gone|15|
事件时间是相对于 Preparation 结束后的绝对偏移秒数(如果没有准备阶段,则是相对于触发时间),按数值排序。
stop falling|10然后sands gone|15是正确的。sands gone|5会排在 10 之前。
overallconfig 片段
enabled=true
enabled_lists=traplist1
detect_subtitle=true
subtitle_preparation=true
preparation_time=3.0
hud_mode=ON_TRAP
hud_bg_opacity=0.5
然后执行 /hitwtimer reload 或按 L。
时间轴(副标题)
| 时间 | HUD |
|---|---|
| t=0 匹配 | falling sand + Preparation 倒计时 |
| t=3 | 准备结束,播放 start_sound,进入 stop falling |
| t=13 | stop falling 节点 |
| t=18 | sands gone,结束,播放 end_sound |
无准备阶段
name=falling sand
subtitle_preparation=false
pattern=falling sand
events=
stop falling|10
sands gone|15
陷阱级别的 subtitle_preparation=false 是严格模式(忽略列表或全局的 true 设置)。
仅聊天信息(永不准备)
name=falling sand
source=CHAT
pattern=falling sand
events=
stop falling|10
sands gone|15
配置系统 {#config-system-en}
config/hitwtimer/
├── overallconfig.txt
├── traplist1.txt
└── ...
优先级(高 → 低)
- trapconfig —
name=块下的字段 - traplistconfig — 第一个
name=之前的头部 - overallconfig — 全局回退
例外: 陷阱 subtitle_preparation=false 为严格无准备模式。
键值不区分大小写;下划线可以省略。
overallconfig.txt {#overallconfigtxt-en}
enabled=true
enabled_lists=traplist1
detect_subtitle=true
detect_chat=true
subtitle_preparation=true
preparation_time=3.0
preparation_color=#55FF55
main_color=#FFFFFF
hud_x=10
hud_y=10
hud_scale=1.0
hud_mode=ON_TRAP
render_background=true
hud_bg_opacity=0.5
hud_horizontal_padding=8
hud_vertical_padding=6
auto_reload_keywords=hitw,hole in the wall,游戏开始
debug=false
| 键值 | 默认值 | 含义 |
|---|---|---|
enabled |
true | 总开关 |
enabled_lists |
traplist1 | 要加载的列表(不带 .txt 后缀) |
detect_subtitle / detect_chat |
true | 检测来源 |
subtitle_preparation |
true | 副标题的默认准备阶段 |
preparation_time / preparation_color |
3.0 / #55FF55 | 准备阶段的默认时间和颜色 |
main_color |
#FFFFFF | 默认事件颜色 |
hud_mode |
ON_TRAP | ALWAYS / ON_TRAP / DISABLED |
hud_bg_opacity |
0.5 | 背景透明度 0–1(也接受 % 或 0–255) |
debug |
false | 详细的匹配日志和聊天输出 |
颜色格式:#RRGGBB 或 RRGGBB。
陷阱列表文件 {#trap-list-files-en}
- 任意名称:
traplist1.txt、pvp.txt… - 在
enabled_lists或/hitwtimer enable <name>中引用时不带扩展名。
# traplistconfig 头部(在第一个 name= 之前)
enabled=true
description=Classic HITW list
...
name=trap_a
pattern=...
events=
...
头部键值:enabled、description、准备阶段/颜色/声音/来源/匹配默认值等。
编写陷阱 {#writing-a-trap-en}
必填字段
| 字段 | 含义 |
|---|---|
name= |
唯一 ID / HUD 标题回退 |
pattern= |
匹配文本(a|b 或非 REGEX 模式) |
events= + ≥1 阶段 |
阶段列表 |
可选字段(否则继承自列表 → 全局)
enabled、source、subtitle_preparation、preparation_time、preparation_color、main_color、start_sound、end_sound、match_mode、case_sensitive
最小配置
name=my_trap
pattern=keyword
events=
phase1|5
phase2|10
完整模板
name=your_trap_id
enabled=true
source=SUBTITLE
subtitle_preparation=true
preparation_time=3.0
preparation_color=#55FF55
main_color=#FFFFFF
start_sound=block.note_block.pling
end_sound=block.note_block.bell
pattern=english text|other keyword
match_mode=CONTAINS
case_sensitive=false
events=
stage one|5.0|#FFAA00|entity.experience_orb.pickup
stage two|12.0|
stage three|20.0|#55FFFF|
匹配规则 {#matching-en}
| 模式 | 行为 |
|---|---|
CONTAINS (默认) |
子串匹配 |
EQUALS |
完全字符串匹配 |
STARTS_WITH |
前缀匹配 |
REGEX |
正则表达式匹配 |
非 REGEX 模式下,pattern=a|b|c 表示 OR(或)关系。在 REGEX 模式中,| 被视为正则运算符。
source 可设为 SUBTITLE / CHAT / BOTH。全局设置中的 detect_* 必须允许所选的数据源。
去重机制可避免同一文本/陷阱触发器在短时间内重复触发。
准备阶段 {#preparation-en}
| 规则 | 结果 |
|---|---|
| 字幕 + 允许准备阶段 | 自动插入 Preparation |
陷阱配置 subtitle_preparation=false |
严格禁止准备阶段 |
| 聊天框触发 | 永远不会进入准备阶段 |
| HUD 标签 | 第一行始终显示英文 Preparation |
start_sound |
当准备阶段结束时播放 |
请勿将 Preparation 添加到 events= 列表中。
事件格式 {#events-format-en}
events=
label|offsetSeconds|color(optional)|sound(optional)
偏移量是相对于准备阶段结束(或触发时刻)的绝对秒数,按升序排列。
颜色回退逻辑:事件指定颜色 → 陷阱 main_color → 列表级颜色 → 全局颜色 → 白色。
调试指南 {#debugging-en}
- 设置
debug=true然后按下 L — 控制台将输出匹配日志。 - 放宽
pattern并优先使用CONTAINS模式。 - 复制屏幕上实际显示的字幕文本。
- 使用
/hitwtimer list查看已启用的列表。 - 编辑文件后务必重新加载配置。
- HUD 缺失?检查 H 模式、K 位置、
enabled状态及hud_mode是否未设为 DISABLED。
构建 {#build-en}
# Windows
.\gradlew.bat build -x test
# Linux / macOS
./gradlew build -x test
输出路径:build/libs/hitwtimer-*.jar
开发调试:运行 .\gradlew.bat runClient → 配置文件位于 run/config/hitwtimer/ 下。
常见问题 {#faq-en}
控制键在“按键绑定”中找不到?
请在分类 HITWtimer 下查找。
K 键无反应 / 无法拖动?
必须处于游戏世界中且没有其他界面遮挡;此时应出现黄色编辑横幅提示。
显示了字幕但没有计时器?
请检查 pattern、source、列表是否启用、detect_subtitle 设置、hud_mode 是否未被设为 DISABLED,以及是否开启了 debug=true。
没有准备阶段?
数据源是否为聊天框?陷阱配置中 subtitle_preparation=false?全局或列表级别关闭了该功能?
配置更改未生效?
按下 L 键或使用命令 /hitwtimer reload 进行重载。
没有声音?
确保使用了有效的原版音效 ID,并检查主音量/UI 音量是否开启。
支持多个列表吗?
是的:可通过 enabled_lists=traplist1,pvp 或重复配置 enable 来实现。
不适用于 Minecraft 26.2 吗?
本模组基于 ~26.1.2 版本构建。26.2 需要更新依赖项和 GUI API(不能直接替换)。
许可证 {#license-en}
CC0-1.0 — 可免费使用、修改和再分发。
提示: 复制示例中的下落沙块配置 → 将 pattern 设置为你服务器实际的字幕文本 → 开启 debug=true 直到成功触发 → 正常游玩时关闭调试模式。
你是这个资源的作者?登录后可认领此资源。
相似资源
让你能够在世界中的任何位置定位结构。
一堆修复
TerraFirmaCraft (TFC) 是一个全面转换模组,对生存模式进行了彻底的改造与重新设计。
所有本应存在的事物
为 Cobblemon 添加 Mega 进化、Z 招式、太晶化、超极巨化/超巨大化、究极爆击与融合!
一款适用于你选择的加载器的 Minecraft VR 模组!
评论 0
登录后参与评分
还没有评论,来抢沙发吧