Bellows(原名为 Radon)
Bellows 是一款毫不妥协的即插即用 Fabric 模组,旨在为 Minecraft 命令提供针对性的优化——特别是在拥有大量大型数据包的运行环境中。由于 Bellows 的优化具有针对性,性能提升幅度会有所不同。大多数大型数据包在使用 Bellows 后,刻时间可减少 50-60%。某些数据包(如 Animated Java)的刻时间甚至可减少 70-90%。
采用的优化措施如下:
- 将 NBT 数据的序列化限制为仅请求的数据,而非所有数据,从而在
data get(等)操作上节省大量时间。例如,如果你执行data get entity @s Health来获取玩家的生命值,Minecraft 通常会复制并发送玩家的全部 NBT 数据,包括包含超过 1000 个已解锁配方的长数组。而使用 Bellows 时,它只会复制并发送Health,不会发送其他任何内容。 - NBT 数据的反序列化同样被限制为仅请求的数据。这一优化效果加倍,因为读取 NBT 数据需要先写入 NBT 数据,而这利用了上述优化。
- 实体根据其类型(支持类型标签)和选择器标签进行缓存。当使用
@e时,搜索功能会检查缓存中有效的类型和选择器标签,并在最小的缓存集合上执行@e搜索。也就是说,如果你选择@e[type=marker,tag=my_tag],且有 100 个 marker 实体,其中 50 个带有my_tag,那么@e将只搜索这 50 个带有my_tag的实体。目前,此功能不支持type=!和tag=!。注意:自 1.9.3 版本起,Minecraft 在使用distance=以及dx,dy,dz=时将@e搜索限制在特定的子区块内。Bellows 并未尝试优化这些搜索,它仅执行全局搜索。 - 修复了 MC-168596 “如果‘execute if block’在每个刻上在其上运行,渲染距离外的区块不会被卸载。”虽然在单人游戏中这可能不明显,但在服务器上,由于自定义方块接收频繁的
if block检查,可能导致数百个区块被强制加载到随机玩家的基地中。
特殊 NBT 案例处理:
- “快速数据(Quick Data)”:一种优化方式,可预编译 NBT 修改并直接更新实体,绕过正常的 NBT 流程(即使有其他 NBT 优化,这也能节省大量时间)。目前仅应用变换,但可以扩展到其他数据字段。
- 显示实体的“变换(Transformation)”字段在构建时始终计算矩阵形式,尽管服务器从不使用这种形式。Bellows 禁用了此构建过程。
- 实体上的“data”字段使用标准的深拷贝而非 Codec。时间减少约 50%。
用法
如果你正在设置一个拥有大量数据包的服务器,并且已经使用了性能优化模组(例如 Lithium),或者你的电脑配置极低(真的是一台“土豆机”),需要榨取每一滴性能,那么绝对值得尝试 Bellows。只需将其放入 mods 文件夹,数据包就会神奇地变得更好用。
虽然 Bellows 提供了即插即用的优化,但它改变了适用于原版的一些优化规则(例如不再需要激进地减少 @e 的使用)。通常来说,专门为 Bellows 开发优化被认为是不好的做法,但也有一些例外情况:
- 你处于受控环境中,即你自己的服务器且正在运行 Bellows
- 你使用的是预编译器,可以提供标准或 Bellows 构建目标
在测试中,Moonrise(将 Paper 的部分优化移植到 Fabric)似乎与 Bellows 协同工作,使刻时间的减少幅度远超两者单独使用时的总和。值得一试!
高级功能
想亲眼看看区别吗?Bellows 支持通过以下命令动态切换优化。你可以在 F3 界面中观察 mspt,或在单人游戏中使用 F3+L 进行分析,或在多人游戏中使用 /perf <start/stop>:
/bellows nbt-optimiations <true/false>/bellows selector-optimizations <true/false>/bellows fix-block-access-forceload <true/false>
Bellows 还具备调试模式,如果你发现命令没有变快反而变慢了,它可以向控制台打印潜在问题。
/bellows debug <command># 这将打印单个命令的调试信息/bellows debug-mode <true/false># 这将打印所有命令的调试信息(不要在运行频繁 tick 的命令时使用此选项)
Bellows (formally Radon)
Bellows is a no-compromises drop-in Fabric mod designed to apply targeted optimizations for Minecraft commands-- especially in environments with many large datapacks. Do to the targeted nature of Bellow's optimizations, performance gains are somewhat variable. Most large datapacks see a 50-60% reduction in tick time using Bellows. Certain packs like Animated Java can see a 70-90% reduction in tick time.
The following optimizations are used:
- Limiting serialization of NBT data to the requested data instead of all the data, saving massive time on
data get(etc.) operations. For example, if you dodata get entity @s Healthon a player, normally Minecraft would copy & send all of the player NBT data, including the +1000 long array of unlocked recipes. With Bellows, it will copy and send onlyHealthand nothing more. - Deserializing of NBT data is similarly limited to requested data only. This is twice as effective since reading NBT data requires first writing nbt data, which uses the above optimization.
- Entities are cached based on their type (supports type tags) and selector tags. When using @e, the search function will check the caches for valid types and selector tags, and will perform the @e search only on the smallest cache. That is, if you select
@e[type=marker,tag=my_tag]and there are 100 markers, 50 withmy_tag, then the @e will only search the 50 entities withmy_tag. Currently, this does not support type=! and tag=!. Note: As of 1.9.3, Minecraft limits @e searches to specific sub-chunks when using distance= and dx,dy,dz=. Bellows makes no attempt to optimize these searches, it only does global searches. - Fix for MC-168596 "Chunks outside of render distance are not unloaded if 'execute if block' runs on it every tick." While this may not be noticeable in single player, on a server hundreds of chunks can be force-loaded in random players' bases due to custom blocks receiving tickly
if blockchecks.
Special NBT cases:
- "Quick Data:" a type of optimization which pre-compiles an nbt modification and directly updates the entity, bypassing the normal NBT process (even with the other nbt optimization, this can save a lot of time). Currently only applies the transformations, but can be expanded to other data fields.
- The Transformation field on display entities always calculates the matrix form when built, even though the server never uses this form. Bellows disables this construction.
- "data" field on entities uses a standard deep copy instead of a Codec. Reduces time by ~50%.
Usage
If you're setting up a server with a lot of datapacks and you're already using performance mods (i.e. Lithium), or your computer is truly a potato and you need to squeeze out every drop of performance you can get, then definitely give Bellows a try. Just drop it in your mods folder and datapacks will magically perform better.
While Bellows provides drop-in optimizations, it changes optimization rules that apply in vanilla (like no longer needing to reduce @e usage aggressively). In general, it is considered bad practice to develop optimizations for Bellows specifically, but there are some exceptions like:
- You are in a controlled environment, i.e. your own server which is running Bellows
- You are using a pre-compiler which can provide a normal or Bellows build target
In testing, Moonrise (ports some of paper's optimizations to fabric) seems to synergize to Bellows, reducing tick time by significantly more than either alone. Give it a try!
Advanced Features
Want to see the difference for yourself? Bellows supports toggling optimizations on the fly using these commands. You can observe the mspt in f3, or run a profile with f3+L in single player and /perf <start/stop> in multiplayer:
/bellows nbt-optimiations <true/false>/bellows selector-optimizations <true/false>/bellows fix-block-access-forceload <true/false>
Bellows also has a debug mode, which can print potential problems to console if you find your commands aren't running faster or worse are running slower.
/bellows debug <command># this prints debug info from a single command/bellows debug-mode <true/false># this prints debug info for all commands (don't do this with ticking commands running)
下载 Bellows
下载 Bellows
下载 Bellows
下载 Bellows
下载 Bellows
下载 Bellows
下载 Bellows
修复了闪电无法通过 @e 选中的问题
修复了数据命令中某些 NBT 路径未正确更新 NBT 的问题
- 修复在对实体设置 active_effects 时崩溃的问题
- 修复当关闭“fix block access forceload”选项时方块访问无法正常工作的问题
- 修复顶级 NBT 数据(例如 Inventory[0])的列表索引无法使用的问题
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
评论 0
登录后参与评分
还没有评论,来抢沙发吧