EMI Accelerator
将 EMI 物品列表缓存至磁盘,并将搜索索引的构建推迟到后台线程,从而大幅缩短 EMI 重载时间。
概述
每次加入世界或重载资源时,EMI 都会重新构建整个物品堆叠列表和搜索索引。对于包含大量模组的整合包,此过程可能需要数十秒,且在构建搜索索引期间游戏界面会完全冻结。
EMI Accelerator 通过以下优化解决了这一问题:
- 堆叠缓存(Stack Caching):首次加载时将
EmiStackList.stacks序列化为 JSON 并缓存到磁盘。后续启动游戏时可跳过完整重载(耗时约 130 毫秒,而正常情况约为 40 秒)。 - 延迟搜索(Deferred Search):将
EmiSearch.bake()推迟到后台线程执行,消除了约 10 秒的界面阻塞。 - 自动刷新(Auto Refresh):后台索引完成后自动更新 EMI 搜索结果,无需手动重新输入。
使用方法
| 指令 | 描述 |
|---|---|
/emiacc status |
查看缓存状态、文件大小和命中次数 |
/emiacc clear |
删除缓存(下次启动时重建) |
/emiacc reload |
手动触发 EMI 重载 |
/emiacc reload --force |
清除缓存并强制进行完整的 EMI 重载 |
配置
配置文件路径:config/emi-accelerator/emi-accelerator.properties
| 选项 | 类型 | 默认值 | 描述 |
|---|---|---|---|
cacheEnabled |
布尔值 | true |
启用物品堆叠缓存 |
autoClearOnModChange |
布尔值 | true |
模组列表变更时自动清除缓存 |
maxFileSizeMb |
整数 | 100 |
最大缓存文件大小(MB) |
diagnosticsEnabled |
布尔值 | false |
将各阶段耗时写入 reload-timings.json |
deferredSearchEnabled |
布尔值 | true |
启用后台延迟搜索索引 |
工作原理
- EMI 标签同步触发 →
EmiReloadManager.reload()→ReloadWorker.run()开始运行 - 检查缓存是否存在且有效(通过 SHA-256 模组列表哈希值验证)
- 缓存命中:直接反序列化堆叠列表 → 跳过完整重载 → 在后台构建搜索索引 → 完成
- 缓存未命中:执行正常的 EMI 重载流程 → 完成后异步写入缓存
- 搜索构建完成后自动刷新 EMI 界面,显示
[EMI Accelerator] Search Ready
依赖项
| 模组 | 版本 | 必需 |
|---|---|---|
| EMI | 1.1.22+ | 是 |
- 加载器:NeoForge 21.1.228+
- 适用端:仅客户端
- 环境:Minecraft 1.21.1
编译
./gradlew build
许可证
GNU AGPL 3.0
EMI Accelerator
Caches the EMI item stack list to disk and defers search index building to a background thread, drastically reducing EMI reload time.
Overview
Every time you join a world or reload resources, EMI rebuilds the entire item stack list and search index. For modpacks with a large number of mods, this process can take tens of seconds, and the game UI freezes completely while the search index is being built.
EMI Accelerator solves this problem with the following optimizations:
- Stack Caching: Serializes
EmiStackList.stacksto JSON and caches it to disk on the first load. Subsequent game launches skip the full reload (around 130ms compared to ~40 seconds). - Deferred Search: Defers
EmiSearch.bake()to a background thread, eliminating roughly 10 seconds of UI blocking. - Auto Refresh: Automatically updates EMI search results once background indexing finishes, with no manual re-input required.
Usage
| Command | Description |
|---|---|
/emiacc status |
View cache status, file size, and hit count |
/emiacc clear |
Delete the cache (rebuilds on next launch) |
/emiacc reload |
Trigger an EMI reload manually |
/emiacc reload --force |
Clear cache and force a full EMI reload |
Configuration
Config file path: config/emi-accelerator/emi-accelerator.properties
| Option | Type | Default | Description |
|---|---|---|---|
cacheEnabled |
boolean | true |
Enable item stack caching |
autoClearOnModChange |
boolean | true |
Automatically clear cache when mod list changes |
maxFileSizeMb |
int | 100 |
Maximum cache file size (MB) |
diagnosticsEnabled |
boolean | false |
Write stage timings to reload-timings.json |
deferredSearchEnabled |
boolean | true |
Enable background deferred search indexing |
How It Works
- EMI tag sync triggers →
EmiReloadManager.reload()→ReloadWorker.run()starts - Check if the cache exists and is valid (SHA-256 mod list hash verification)
- Cache hit: Deserialize stack list directly → skip full reload → build search index in background → complete
- Cache miss: Proceed with normal EMI reload → asynchronously write cache after completion
- Automatically refresh the EMI UI after search build finishes, showing
[EMI Accelerator] Search Ready
Dependencies
| Mod | Version | Required |
|---|---|---|
| EMI | 1.1.22+ | Yes |
- Loader: NeoForge 21.1.228+
- Side: Client-only
- Environment: Minecraft 1.21.1
Build
./gradlew build
License
GNU AGPL 3.0
下载 EMIAccelerator
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 EMIAccelerator
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 EMIAccelerator
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 EMIAccelerator
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 EMIAccelerator
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 EMIAccelerator
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
更新日志
新增
- 为提升延迟搜索构建的安全性,新增了重载生成与过期结果丢弃逻辑
更改
- 缓存保存现先写入临时文件,再替换旧缓存,从而降低缓存损坏的风险
修复
- 修复了在 EMI 内部数据清理期间后台搜索仍在读取的问题:添加了 EMI 重载/后台搜索状态锁
- 修复了退出时后台搜索构建导致的错误刷屏问题:添加了客户端关闭处理
- 移除了对 EMI 私有
searchedStacks字段的直接写入,改为使用 EMI 原生流程来刷新搜索结果
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
缓冲的原始输入和线程化的事件轮询
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
可定制的鞘翅模组,支持装饰纹饰、旗帜图案等更多功能!
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
评论 0
登录后参与评分
还没有评论,来抢沙发吧