Thaumic Speedup
一款轻量级、即插即用的性能优化模组,适用于 Minecraft 1.12.2 的 Thaumcraft 6。它针对 Thaumcraft Aspect(方面)注册系统中那些缓慢且大量分配内存的路径进行优化。在包含数千个配方和物品的大型整合包中,其效果可能不佳。
功能说明
- 反向配方索引用于 Aspect 生成
- Thaumcraft 通过扫描整个合成注册表来推导物品的 Aspect:复杂度为 O(物品数量 * 配方数量),这完全无法良好扩展。
- Thaumic Speedup 构建了一个输出堆栈 -> 配方的索引,使得每次后续查找只需进行获取操作,而非遍历整个注册表。该索引仅在启动阶段构建,之后会被丢弃,如需则在运行时惰性重建。
- 无内存分配的 Item 标识哈希
- Thaumcraft 的
generateUniqueItemstackId 方法会在每次 Aspect 查找时复制 ItemStack,将其序列化为 NBT,转换为字符串,然后计算哈希值。
- Thaumic Speedup 使用 item id + item damage(必要时加上 NBT)的直接哈希来替代此过程,从而大幅减少内存分配。
- 更清晰的废弃 API 路由
- 将 Thaumcraft 的废弃静态
registerObjectTag 调用通过单例事件代理进行路由。
Thaumic Speedup
A lightweight, drop-in performance mod for Thaumcraft 6 on Minecraft 1.12.2. It targets the slow, allocation-heavy paths in Thaumcraft's aspect registration system. It scales badly in large modpacks with thousands of recipes and items.
What it does
- Reverse recipe index for aspect generation
- Thaumcraft derives an item's aspects by scanning the entire crafting registry once per item: O(items * recipes) and this does not scale well at all.
- Thaumic Speedup builds an output stack -> recipes index so each subsequent lookup is a fetch instead of a full-registry walk. The index is built only for the startup pass and dropped afterward, rebuilding lazily if needed at runtime.
- Allocation-free item identity hashing
- Thaumcraft's
generateUniqueItemstackId copies the ItemStack, serializes it to NBT, stringifies it, and hashes it on every aspect lookup.
- Thaumic Speedup replaces this with a direct hash of the item id + item damage (+ NBT when need be), allocating a lot less.
- Cleaner deprecated API routing
- Routes Thaumcraft's deprecated static
registerObjectTag calls through a singleton event proxy.
评论 0
登录后参与评分
还没有评论,来抢沙发吧