本项目是面向 TooBee 生存服务器的公开 Minecraft 优化模组,涵盖多个方面,每个部分均针对特定场景设计。
服务器 IP:2ob.top
该模组目前处于非常早期的开发阶段,请注意它仅适用于专用服务器。
对最新版本 Minecraft 的支持仅在 TooBee 服务器更新时才会同步更新,且不支持旧版 Minecraft。
如需了解更多详细信息,请阅读本项目 GitHub 仓库中的 README.md。
已完成的功能
大部分修改均已确保线程安全。
生物堆叠优化
缓存大量同类实体在同一位置堆叠时的部分计算结果。我尝试将此类计算的时间复杂度从 O(n^2 * log n) 优化至 O(n),这意味着由 3000 个监守者引起的 MSPT(每刻毫秒数)可从超过 700 降低至不到 15。但请注意,本模组仅限服务端使用,因此对客户端无效。
建议这些生物满足以下条件:
- 为相同类型;
- 在同一维度及区块坐标内堆叠;
- 稳定站立在实心方块上;
- 活动范围受限;
- 其脚部位置有可攀爬的方块,以防止被压碎。
受影响的生物
- 监守者:通常用于服务器中的伪和平农场。
- 猪灵:通常用于交易农场。
原理与注意事项
每刻缓存此类生物的计算结果:一个生物经历完整的计算过程并缓存其结果,其他在同一位置堆叠的生物则共享该结果。以这种方式处理,原本在同一方块内堆叠的生物行为会受到轻微影响,但影响不大,且绝大多数玩家并不在意,因为几乎没有任何玩家会与这些成千上万的实体进行交互。
更合理的消失条件
如果生物拾取了物品,它们将永久存活直至被杀死。然而,这些生物不计入生成上限,导致其数量无限增长并最终引发严重卡顿。当敌对生物(末影人除外)持有以下无附魔组件的物品时,仍会消失:
箭、骨头、棕色蘑菇、深板岩圆石、圆石、泥土、鸡蛋、草方块、砂砾、火药、尖锥滴石、红色蘑菇、腐肉、蜘蛛眼、线、火把、小麦种子。
末影人持有以下物品时也会消失:
棕色蘑菇、绯红菌、绯红菌核、绯红根须、泥土、草方块、砂砾、红色蘑菇、沙子、诡异菌、诡异菌核、诡异根须。
This project is a public minecraft optimization mod for TooBee survival server, including a variety of aspects where each one is designed for a specific occasion.
Server IP: 2ob.top
The mod is at a very early stage of development, and please notice that it is dedicated server only.
Support for the newest minecraft version is updated if and only if TooBee server updates, and yet older version of minecraft is not supported.
For more detailed information, please read README.md in GitHub repo of this project.
What has been done
Most modifications are ensured to be thread safe.
Mob Stacking Optimization
Cache some of the calculation results of vast amount of certain entities stacking in a single position. I try to optimize the time complexity of such calculation from O(n^2 * log n) to O(n) , which means the MSPT caused by 3000 wardens can be reduced from more than 700 to less than 15. However, notice that this mod is server only, so it should be no use on client side.
These mobs are recommended to
- be the same type;
- stack in the same dimension and block pos;
- stand on a solid block steadily;
- have limited mobility;
- with climbable block in the position of their feet so that they don't crush.
Affected Mob
- Warden: usually for pseudo-peace farm in server.
- Piglin: usually for bartering farm.
Principle and Attention
Cache the calculation results of such mobs every tick: One mob experiences a full calculation process and its result will be cached, while others stacking in the same position share it. In this way, original behaviour of mobs stacking in one block are slightly affected, but not so much and most people don't care about it, as hardly any players interact with these thousands of entities.
More reasonable despawn condition
If mobs pickup items, they keep alive permanently unless killed. However, those mobs are not counted into spawn cap, making their population grows endlessly and finally causes huge lags. While a hostile mob (except for enderman) holds the following common items without any components, it will still despawn:
arrow, bone, brown mushroom, cobbled deepslate, cobblestone, dirt, egg, grass block, gravel, gunpowder, pointed dripstone, red mushroom, rotten flesh, spider eye, string, torch, wheat seeds.
Enderman holding the following items will also despawn:
brown mushroom, crimson fungus, crimson nylium, crimson roots, dirt, grass block, gravel, red mushroom, sand, warped fungus, warped nylium, warped roots.
评论 0
登录后参与评分
还没有评论,来抢沙发吧