基于 Camera Overhaul 模组的分支版本,包含性能优化、错误修复以及更小的文件体积。
结构
文件数量从 20 个减少到 10 个!移除了多加载器相关内容、ModMenu 集成、abstractions/、MixinPlugin(它原本只是跳过了 stonecutter 已经注释掉的 mixins)、Transform、CameraContext、TimeSystem、VectorUtils、MathUtils、toml4j 以及其他更多内容。
已修复的错误
- 修复了与震动相关的崩溃问题。
- 由于某些原因,爆炸和闪电震动的竞争逻辑在服务器线程中创建……现在仅保留客户端逻辑。
- 闪电震动 spam 被挂钩到
spawnFire,服务器只调用一次,而客户端每次闪光都会调用一次。多人游戏中出现了 1-3 次震动,单人游戏则因错误的线程产生了额外的震动。
性能
逐帧分配已消除。上游代码每帧都要构建一个 CameraContext、两个 Transform、大约 10 个 Vector3d 以及两个 Quaternionf/Vector3f,仅仅为了读取每个对象的一个字段;此外 bobHurt 内部还有三个额外的 Transform,而 bobHurt 每帧运行 3-4 次。所有这些现在都直接使用了原始的双精度浮点数。发现了一个计算后每帧都被添加但从未被写入的相机偏移量,因此将其删除。Sway(摇摆)功能正在采样 3D 噪声并将第三个轴乘以零,毫无理由地丢弃了一个样本。getForwardRelativeVelocity() 每帧也运行两次,现在改为只运行一次。虽然这些改动本身不会提升 FPS 计数器的数值,但它们减轻了宝贵的垃圾回收器(GC)的压力。
清理
Perspective 和 Movement 枚举替代了六个布尔值和一个 if-else 链……部分代码经检查发现字节完全相同,因此予以移除。删除了约 25 个未使用的工具方法。八行数学运算代码也被合并简化。
配置
toml4j 不在 Forge 的类路径中,因此将其移除,替换为 NightConfig,这是 Forge 已经内置的配置库。添加了 displayTest = "IGNORE_ALL_VERSION",以便在不匹配版本的情况下加入服务器。
致谢
原始项目:CameraOverhaul
A fork of camera overhaul mod with performance improvements bug fixes and lowered file size.
Structure
20 files to 10! Ripped out the multiloader stuff, ModMenu integration, abstractions/, MixinPlugin (it only skipped mixins stonecutter had already commented out), Transform, CameraContext, TimeSystem, VectorUtils, MathUtils, toml4j and sum more stuff.
Bugs Fixed
- Crash related to shakes are fixed.
- Explosion and lightning shakes race got created from the server thread for some reason.. now only client.
- Lightning shake spam hooked into
spawnFire, which the server calls once but the client calls once per flash. Multiplayer got 1-3 shakes, singleplayer got extras from the wrong thread entirely.
Performance
Per-frame allocations are gone. Upstream built a CameraContext, 2 Transforms, roughly 10 Vector3d, and 2 Quaternionf/Vector3f every single dam frame, plus 3 more Transforms inside bobHurt just to read one field off each, bobHurt runs 3-4 times a frame. All of that is plain doubles now. Found a camera offset that got computed and added every frame while nothing ever wrote to it, so shi just got deleted. Sway was sampling 3D noise and multiplying the third axis by zero, throwing away a sample for no reason at all. getForwardRelativeVelocity() ran twice a frame as well. Now it runs once. None of this moves the FPS counter in the first place but it just hurts your precious GC.
Cleanups
Perspective and Movement enums replace six booleans and an if-chain.. some stuff turned out to be byte-identical, so free w. Cutted about 25 unused util methods. Eight lines of math collapsed as well.
Config
toml4j wasn't on Forge's classpath, so it's out, replaced with NightConfig. Which Forge already has. Added displayTest = "IGNORE_ALL_VERSION" so you can join servers without version-matching.
Credits
Original Project: CameraOverhaul
评论 0
登录后参与评分
还没有评论,来抢沙发吧