Oushii
一款 Minecraft 爆炸引擎,用直接在方块网格上求解的爆炸场替代了原版的射线投射。它能处理大型 TNT 链式爆炸而不会导致服务器卡顿,并保持坑洞形状与原版的相似。
为什么选择 Oushii?
在原版 Minecraft 中,大型 TNT 爆炸会因爆炸采样使用 1352 条射线而导致服务器过载,每条射线都会重新遍历其邻居已经遍历过的方块,一次只调用一个 getBlockState。即使有 Lithium 等性能优化模组,链式爆炸仍会导致严重的 TPS 下降。
Oushii 在方块网格上解决相同的能量预算,而不是沿射线进行。每个方块最多被访问一次,直接从内存中的区块部分获取:它接受邻居从中心方向一步传来的剩余能量,支付自身的防爆值消耗,并将剩余能量传递下去。无法穿透的方块会在其后方形成阴影,就像一条耗尽的射线一样。
这保留了原版坑洞的可识别特征——在石头中较浅,在泥土中较深,会被黑曜石和水阻挡——而从未到达方块的爆炸部分则无需成本地跳过。在同一刻发生的邻近爆炸会被合并为一个,且穿过空区块部分的 TNT 将完全跳过碰撞检测。
兼容性
Oushii 与 Lithium 兼容,并且应该也与其他优化模组兼容。
爆炸场通过原版使用的相同钩子,因此调整爆炸行为的模组会被读取而非忽略:
- 防爆值覆盖 通过原版的爆炸伤害计算器,这也是 NeoForge 转发给
IBlockExtension#getExplosionResistance的方式。TNT Breaks Bedrock 和 TNTUtils 等模组可以正常工作。防爆值针对每个方块状态解析一次,因此如果某个模组按 位置 变化防爆值,它将被读取一次并应用于该位置的方块。 - 方块可以否决自身的破坏 (
shouldBlockExplode) 和 自身的掉落 (dropFromExplosion)。 - 模组化 TNT 方块链式引爆:每个被摧毁的方块都会触发原版的
wasExploded反应,这是 TNT 方块引燃自身实体的地方。 - 模组化 TNT 实体保留其自身行为:Oushii 仅接管原版
PrimedTnt的 tick,因此使用自定义爆炸子类化的模组(如 Lucky TNT、Insane TNT 等)不受影响且不会被加速。
尚未涵盖:Oushii 通过其自己的引擎引爆,而不是 Level#explode,因此挂钩该调用或监听爆炸事件的模组将无法看到 Oushii 的爆炸。
性能对比(使用 Spark)
测试环境:26.2 superflat 世界,无生物或未预生成的物品实体。 分析对象:30×30×30 TNT 立方体(27,000 个方块)的引爆。
| 指标 (Spark) | 原版 | Lithium | Oushii | Lithium + Oushii | 最佳 vs 原版 |
|---|---|---|---|---|---|
PrimedTnt.tick 执行时间 |
150,808 ms |
39,940 ms |
3,572 ms |
2,996 ms |
快 50.3 倍 |
| 服务器 TPS (1分钟窗口) | 5.93 |
12.80 |
19.30 |
19.35 |
+226% |
| 中位 MSPT | 4.33 ms |
3.64 ms |
3.74 ms |
2.38 ms |
+45% |
| MSPT (95% 分位数) | 164 ms |
82.6 ms |
88.8 ms |
33.8 ms |
+79% |
| RAM 占用 | 739.9 MB |
939.8 MB |
757.8 MB |
485.1 MB |
-34% |
Oushii
An explosion engine for Minecraft that replaces vanilla raycasting with a blast field solved directly on the block grid. It handles large TNT chain explosions without stalling the server, and keeps craters shaped the way vanilla shapes them.
Why Oushii?
In vanilla Minecraft, large TNT detonations overload the server because the blast is sampled with 1352 rays that each re-walk the blocks their neighbours already walked, one getBlockState at a time. Even with performance mods like Lithium, chain explosions cause significant TPS drops.
Oushii solves the same energy budget on the block grid instead of along rays. Every block is visited at most once, straight out of the chunk sections in memory: it takes the energy left by the neighbours one step closer to the centre, pays for its own blast resistance, and passes on what is left. Blocks the blast cannot get through cast a shadow behind them, exactly like a ray that ran out.
That keeps what makes a vanilla crater recognisable — shallow in stone, deep in dirt, stopped by obsidian and by water — while the blast that never reaches a block costs nothing to skip. Explosions going off in the same tick close to each other are merged into one, and TNT flying through empty chunk sections skips collision checks entirely.
Compatibility
Oushii is compatible with Lithium, and should also be with other optimization mods.
The blast field goes through the same hooks vanilla does, so mods that retune explosions are read rather than ignored:
- Blast resistance overrides go through vanilla's explosion damage calculator, which is
also what NeoForge forwards to
IBlockExtension#getExplosionResistance. Mods such as TNT Breaks Bedrock and TNTUtils work. Resistance is resolved once per block state, so a mod that varies it per position is read once and applied to that block everywhere. - Blocks may veto their own destruction (
shouldBlockExplode) and their own drops (dropFromExplosion). - Modded TNT blocks chain: every destroyed block gets its vanilla
wasExplodedreaction, which is where a TNT block primes its own entity. - Modded TNT entities keep their own behaviour: Oushii only takes over the tick of vanilla
PrimedTnt, so mods that subclass it with their own explosion (Lucky TNT, Insane TNT and the like) are left alone and are not accelerated.
Not covered yet: Oushii detonates through its own engine instead of Level#explode, so mods
that hook that call or listen for an explosion event will not see Oushii's blasts.
Performance Comparison (with Spark)
Tested on a 26.2 superflat world with no mobs or pre-spawned item entities. Profiled on a detonation of a 30×30×30 TNT cube (27,000 blocks).
| Metric (Spark) | Vanilla | Lithium | Oushii | Lithium + Oushii | Best vs Vanilla |
|---|---|---|---|---|---|
PrimedTnt.tick Execution |
150,808 ms |
39,940 ms |
3,572 ms |
2,996 ms |
50.3× faster |
| Server TPS (1m window) | 5.93 |
12.80 |
19.30 |
19.35 |
+226% |
| Median MSPT | 4.33 ms |
3.64 ms |
3.74 ms |
2.38 ms |
+45% |
| MSPT (95th percentile) | 164 ms |
82.6 ms |
88.8 ms |
33.8 ms |
+79% |
| RAM Footprint | 739.9 MB |
939.8 MB |
757.8 MB |
485.1 MB |
-34% |
下载 Oushii
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Oushii
下载 Oushii
下载 Oushii
下载 Oushii
下载 Oushii
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Oushii
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Oushii
下载 Oushii
下载 Oushii
Oushii 1.2.0
新增
- 支持 Minecraft 26.4(Fabric;NeoForge 将在 26.4 版本构建发布后跟进)
与爆炸和 TNT 模组的兼容性
- 爆炸抗性现在通过原版的爆炸伤害计算器进行计算,而不是直接读取方块的原始值,因此尊重那些调整该值的模组——包括 TNT Breaks Bedrock 和 TNTUtils。在 NeoForge 上,这也对应于转发至
IBlockExtension#getExplosionResistance。 - 方块可以否决自身的破坏(
shouldBlockExplode)以及自身的掉落物(dropFromExplosion)。 - 模组化的 TNT 方块现在支持连锁反应:每个被摧毁的方块都会触发其原版
wasExploded反应,TNT 方块在此处引燃其自身实体。 - 模组化的 TNT 实体保留其自身行为。Oushii 仅接管原版 PrimedTnt 的 tick 逻辑,因此那些通过子类化实现自定义爆炸效果的模组不受影响。
修复
- 许可证头检查从未实际运行:其目标路径将通配符传入 File 路径,而 Spotless 完全无法从版本节点读取共享源代码。现在改为仅在根项目中运行一次。
内部改动
- 替换了已移除的
Mth.clamp调用以及 26.4 中删除的四参数Block.getDrops
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
缓冲的原始输入和线程化的事件轮询
模组
一个用于收集生物掉落物的多区块模组。
模组
原版世界生成优化模组
模组
AE2:一款流行的自动化与存储模组
模组
基于 GTCEu 1.12.2 的现代 GregTech
模组
让你能够在世界中的任何位置定位结构。
评论 0
登录后参与评分
还没有评论,来抢沙发吧