OptimizeMod
保持远距离模拟静音,以便让活跃的游戏玩法获得更多 CPU 时间。
OptimizeMod 是一款轻量级的 Fabric Minecraft 1.21.1 优化模组。
它的目标很简单:减少玩家未主动交互的实体和特效的工作量。
OptimizeMod 更改内容
1. 基于距离的移动刻节流 (EntityTickMixin)
钩子:LivingEntity.tickMovement()
- 玩家被排除在外。
- 如果在睡眠距离内(默认为
96 格)找不到玩家,非玩家活体会跳过移动刻(ENTITY_TICK_SKIP = 4,默认值)。
- 如果存在玩家但距离超过缩减距离(
48 格),移动更新会被节流(大约每隔一个刻执行一次)。
2. 基于距离的 AI 节流 (MobEntityAIMixin)
钩子:LivingEntity.tickNewAi()(适用于 MobEntity)
- 如果在缩减距离内(
48 格)找不到玩家,该刻的 AI 更新将被取消。
- 在中距离范围内,AI 更新会部分节流(每隔一个刻执行一次)。
- 在节流/取消期间,
despawnCounter 会被重置,以避免不需要的消失副作用。
3. 粒子吞吐量上限 (ParticleManagerMixin, 客户端)
钩子:ParticleManager.addParticle(...)
- 使用本地计数器限制粒子生成(
MAX_PARTICLES_LIMIT = 4000)。
- 当超过上限时,多余的粒子生成请求会被丢弃。
- 旨在减少极端粒子爆发导致的客户端卡顿。
重要准确性说明
- OptimizeMod 不保证固定的 FPS/TPS/MSPT 提升。
- 实际影响取决于怪物密度、玩家分布、区块活动、整合包组成、JVM/运行时设置以及测试场景。
- 对远处生物/实体的行为更改是出于设计意图。
可复现评估(推荐)
为了验证对您设置的影響,请在相同条件下比较基准状态与启用 OptimizeMod 的状态:
- 相同的 Java 版本、JVM 参数、模组列表、种子和配置。
- 相同的场景和持续时间(建议每次运行 20-30 分钟)。
- 至少 3 次基准运行 + 3 次 OptimizeMod 运行。
- 收集可比指标:
- p50/p95 MSPT(
spark 或等效工具)
- CPU 使用率(进程/系统)
- FPS/帧时间(客户端测试)
- 比较分布情况(中位数/p95),而非一次性峰值。
安装
- 为 Minecraft 1.21.1 安装 Fabric Loader
- 安装 Fabric API
- 将 OptimizeMod jar 文件放入
mods/ 目录
兼容性
- 旨在与其他优化模组互补。
- 与任何基于 mixin 的模组一样,在生产部署前请测试您的确切整合包。
OptimizeMod
Keep distant simulation quiet so active gameplay gets more CPU time.
OptimizeMod is a lightweight Fabric optimization mod for Minecraft 1.21.1.
Its goal is simple: reduce work on entities and effects that players are not actively interacting with.
What OptimizeMod changes
1. Distance-based movement tick throttling (EntityTickMixin)
Hook: LivingEntity.tickMovement()
- Players are excluded.
- If no player is found within sleep distance (
96 blocks by default), non-player living entities skip movement ticks (ENTITY_TICK_SKIP = 4 by default).
- If a player is present but farther than reduce distance (
48 blocks), movement updates are throttled (roughly every other tick).
2. Distance-based AI throttling (MobEntityAIMixin)
Hook: LivingEntity.tickNewAi() (for MobEntity)
- If no player is found within reduce distance (
48 blocks), AI updates are cancelled for that tick.
- In mid-distance ranges, AI updates are partially throttled (every other tick).
- While throttled/cancelled,
despawnCounter is reset to avoid unwanted despawn side effects.
3. Particle throughput cap (ParticleManagerMixin, client)
Hook: ParticleManager.addParticle(...)
- Particle creation is capped with a local counter (
MAX_PARTICLES_LIMIT = 4000).
- Excess particle spawn requests are dropped when the cap is exceeded.
- Intended to reduce client stutter from extreme particle bursts.
Important accuracy notes
- OptimizeMod does not guarantee fixed FPS/TPS/MSPT improvements.
- Real impact depends on mob density, player spread, chunk activity, modpack composition, JVM/runtime settings, and test scenario.
- Behavior changes for distant mobs/entities are intentional by design.
Reproducible evaluation (recommended)
To validate impact on your setup, compare baseline vs. OptimizeMod with identical conditions:
- Same Java version, JVM args, mod list, seed, and config.
- Same scenario and duration (recommended: 20-30 minutes per run).
- At least 3 baseline runs + 3 OptimizeMod runs.
- Collect comparable metrics:
- p50/p95 MSPT (
spark or equivalent)
- CPU usage (process/system)
- FPS/frame-time (client tests)
- Compare distributions (median/p95), not one-off spikes.
Installation
- Install Fabric Loader for Minecraft 1.21.1
- Install Fabric API
- Place the OptimizeMod jar in
mods/
Compatibility
- Designed to complement other optimization mods.
- As with any mixin-based mod, test your exact modpack before production deployment.
评论 0
登录后参与评分
还没有评论,来抢沙发吧