跳到正文

Capability Fix

作者:lcy0x1

Improve capability searching performance on entities

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Discord: https://discord.gg/BCHNhsDMXz

This mod improves one key part of lags in 1.20.1 Forge/NeoForge: Capability fetching on entities. The implementation used on 1.20.1 searches across all capability providers to find one capability on one entity. This is extremely inefficient when there are many mods adding capability providers.

The approach this mod takes is to have a whitelist of capabilities to be cached. It stores a cache of capabilities on every entity. Capabilities that are whitelisted will be cached when it’s fetched the first time and later it will not go through the list of capability providers but fetched from the cache directly.

This method is safe only for capabilities that is available on entities since its first fetch and never removed or re-attached later. One example would be Curios API’s capability. Thus, this mod is whitelist-based by default. You can take the risk and make it apply to all capabilities on entities via config, or manually add all capabilities to the whitelist in config. By default, only Curios API’s capability is in the whitelist.

You are recommended to use this mod only when you confirmed with spark that capability fetch on entity costs at least 4% of server mspt. This mod fully deployed would reduce capability fetching cost by 75%, tested on a modpack which original capability fetching cost is 8% of server mspt.

The correct way to use this mod is:

  • After the game runs a while, run /capabilityfix gather_others. It will tell you how many times each capability is fetched.
  • Open your latest.log and find that chat message. Copy the capability ID into your config capabilityfix-common.toml.
  • Run /capabilityfix reload_config ingame to apply the whitelist.
  • Test functionalities related to that capability to see if it would cause any bug. If it does, remove it from the whitelist.

常见问题

Capability Fix 支持哪些 Minecraft 版本?

Capability Fix 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge / NeoForge。下载时注意选择和你游戏版本一致的文件。

Capability Fix 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

lcy0x1 的其他作品

查看全部 →