Radium (Re-Reforged) — 为 Forge 1.20.1 维护的 Radium 分支。
Radium 是 Lithium 的 Forge 移植版,后者是 CaffeineMC 出品的一款通用优化模组。它在不改变原版行为、玩法或世界生成的前提下,提升了服务器刻的性能。
此分支的存在是因为上游开发已停滞。它保留了相同的模组 ID,因此可以直接替换安装。
与上游版本的不同之处
已修复 — 复制 NBT 复合体时出现 NullPointerException(空指针异常)
NbtCompoundMixin 可能导致 fastutil 映射中留下一个内部列表为 null 的情况,因此任何对 CompoundTag 进行深拷贝或深度迭代的模组都会崩溃。已知的临时解决方案是设置 mixin.alloc.nbt=false,但这意味着完全放弃该优化。现在该映射会被预先填充,选项可以保持开启状态。
上游问题:Reforged-Hub/radium-upstream#52(在该处仍处于开放状态)。
已修复 — 实体状态变更期间出现 ConcurrentModificationException(并发修改异常)
在区块实体追踪状态变更时触发的回调可能会在遍历中途丢弃实体,从而破坏迭代过程。现在改为对副本进行迭代。
配置项:mixin.chunk.entity_status_iteration
新增 — 挤压测试中缓存可推动性
挤压测试的时间复杂度为二次方:区块中的每个实体都要询问其他所有实体是否可以被推动,而答案仅取决于被询问的实体。现在每个实体每刻只计算一次,将 N*N 次调用减少为 N 次。
这在整合包服务器上尤为关键。在原版中 isPushable() 很简单,但它会调用 isClimbing() —— 这是一个非常热门的 mixin 目标。对整合包服务器的分析显示,Botania 在此处挂钩以查找 Curios 槽位,并在每次调用时遍历能力分发器:仅挤压测试就占用了服务器线程约 0.6% 的时间,而 Pehkui 还在此基础上添加了自身的挂钩。
最多引入一倍的延迟——如果一个实体在一刻中间死亡,它将直到该刻结束前都仍被视为可推动。
配置项:mixin.entity.collisions.pushable_cache
移植 — 上游 Radium 未曾采纳的优化
从 CaffeineMC 的 Lithium 1.20.1 分支移植而来:
mixin.ai.useless_sensors —— 跳过那些结果从未被读取的大脑传感器(山羊物品传感器;非幼崽动物的父母动物传感器)
mixin.block.beehive —— 蜂巢在尝试退出时会先检查是否有遮挡物,而不是每次都执行昂贵的 NBT 复制操作
mixin.entity.sprinting_particles —— 跳过服务器端的冲刺粒子处理
这使得该分支在功能上与 Lithium 1.20.1 持平,除了一个实验性选项 experimental.entity.block_caching.fluid_pushing。它基于 Fabric 的 updateMovementInFluid 方法的 fluid-tag 参数作为缓存键,而 Forge 将该方法替换为了无参方法 —— 因此没有可用的缓存键。其底层逻辑已由 mixin.entity.collisions.fluid 覆盖。
兼容性
- Minecraft 1.20.1, Forge
- 模组 ID 为
radium —— 请勿与原版的 Radium 同时安装
- 每项优化都有独立的配置开关,详见
lithium-mixin-config.md
- Aperture Innovations:当安装此模组时,
mixin.entity.collisions.movement 会自动关闭 —— 若开启,则无法进入其传送门。您无需手动编辑配置。
更多优化
查看我的另一个模组:JEIOptimizer
致谢与许可证
Lithium 由 CaffeineMC 开发。Forge 移植版由 dima_dencep 和 NanoLive 完成。采用 LGPL-3.0-only 许可证。
源码:
Radium (Re-Reforged) — a maintained fork of Radium for Forge 1.20.1.
Radium is a Forge port of Lithium, CaffeineMC's general-purpose optimization mod. It improves server tick performance without changing vanilla behaviour, gameplay, or world generation.
This fork exists because upstream development has gone quiet. It carries the same mod id, so it is a drop-in replacement.
What's different from upstream
Fixed — NullPointerException when copying NBT compounds
NbtCompoundMixin could leave a fastutil map with a null internal list, so any mod doing a deep copy or deep iteration of a CompoundTag crashed. The known workaround was mixin.alloc.nbt=false, which meant giving up the optimization entirely. The map is now filled eagerly and the option can stay on.
Upstream issue: Reforged-Hub/radium-upstream#52 (still open there).
Fixed — ConcurrentModificationException during entity status changes
Callbacks fired while a section's entity tracking status changes could discard entities mid-traversal and break the iteration. The section's entity list is now iterated over a copy.
Config: mixin.chunk.entity_status_iteration
New — cached pushability for cramming tests
Cramming tests are quadratic: every entity in a section asks every other entity whether it can be pushed, while the answer depends only on the entity being asked. It is now computed once per entity per tick, turning N*N calls into N.
This matters most on modded servers. In vanilla isPushable() is trivial, but it calls isClimbing() — a popular mixin target. Profiling a modded server showed Botania hooking it to look up a Curios slot, walking the capability dispatcher on every single call: ~0.6% of the server thread spent inside cramming tests alone, with Pehkui adding its own hook on top.
Costs at most one tick of staleness — an entity dying partway through a tick stays pushable until the end of it.
Config: mixin.entity.collisions.pushable_cache
Ported — optimizations upstream Radium never picked up
Brought over from CaffeineMC's Lithium 1.20.1 branch:
mixin.ai.useless_sensors — skips brain sensors whose results are never read (goat item sensor; parent animal sensor on non-babies)
mixin.block.beehive — beehives check for obstruction before the expensive NBT copy they otherwise do on every exit attempt
mixin.entity.sprinting_particles — skips server-side sprinting particle work
This puts the fork at parity with Lithium 1.20.1 except for one experimental option, experimental.entity.block_caching.fluid_pushing. It keys its cache on the fluid-tag parameter of Fabric's updateMovementInFluid, and Forge replaced that method with a no-arg one — there is no key to cache by. Its ground is already covered by mixin.entity.collisions.fluid.
Compatibility
- Minecraft 1.20.1, Forge
- Mod id is
radium — do not install alongside the original
- Every optimization keeps its own config toggle, see
lithium-mixin-config.md
- Aperture Innovations:
mixin.entity.collisions.movement is switched off automatically when it is installed — with it on, its portals cannot be entered. No config editing needed on your side.
More optimizations
Check my other mod: JEIOptimizer
Credits and licence
Lithium by CaffeineMC. Forge port by dima_dencep and NanoLive. Licensed under LGPL-3.0-only.
Source:
评论 0
登录后参与评分
还没有评论,来抢沙发吧