跳到正文

Collision Lag Fix

作者:cambrova

Stops fast TNT and other fast-moving entities from lagging the server with collision checks (MC-260743). Movement stays identical to vanilla.

收藏

介绍

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

Fast TNT and other fast-moving entities can freeze a server for a noticeable moment, even with performance mods installed. Collision Lag Fix makes the collision check for anything moving many blocks per tick cost almost nothing, and the entity still ends up exactly where vanilla would put it.

Fixes MC-260743. Please report bugs here.

What it fixes

When an entity moves, vanilla first gathers the collision shape of every block in the box between where it is and where it’s going. Then it moves the entity along one axis at a time. For a TNT shot from a cannon at 80 blocks per tick diagonally into the ground, that box holds hundreds of thousands of blocks, and almost none of them are anywhere near its path.

This mod gathers only the blocks along each axis the entity actually moves through. The entity hits the same blocks, in the same order, and stops in the same place.

Measured in our tests, for one TNT moving 80 blocks per tick into solid stone:

  • vanilla: 45–110 ms, about a whole tick (50 ms) or more for a single TNT;
  • with this mod: 0.05–0.25 ms.

Lithium already speeds this up when the path goes through air, but not through terrain. With Lithium installed, the same TNT takes 45–62 ms on its own and about 1.1–1.2 ms with this mod added. The two work together.

On 1.21.1, falling TNT also traced a ray along its whole fall every tick (MC-263882), up to 100+ blocks for cannon TNT, to update a fall distance TNT never uses. Newer versions cap that ray at 8 blocks; on 1.21.1 this mod skips it for TNT.

Config

config/collision_lag_fix.properties:

  • enabled: turn the fix off without removing the mod.
  • minSpeed: how fast, in blocks per tick, an entity must move on at least two axes before the fix is used. The default is 2. Slower movement keeps the vanilla code.

FAQ

Client or server? The server needs it (or your game, in singleplayer). Players don’t need it to join.

Does it change how entities move? No. Our tests move thousands of random entities (TNT, items, falling blocks, zombies sneaking or wearing leather boots) through stone, slabs, fences, scaffolding and powder snow, past boats, minecarts and shulkers, and across the world border. Every end position is checked against vanilla’s. They run on every version and loader, and once more with Lithium installed. Close to the world border, and when a mob would step up onto a block, the mod leaves the move to vanilla.

Does it need anything else? No.

Can I use it in my modpack? Yes, go ahead, no need to ask.

MIT. Developed with AI assistance. Source: https://github.com/traelmyx/collision-lag-fix

常见问题

Collision Lag Fix 支持哪些 Minecraft 版本?

Collision Lag Fix 支持 Minecraft Java 版 1.21.1–26.3,共 4 个版本,可用的加载器:Fabric / NeoForge。下载时注意选择和你游戏版本一致的文件。

Collision Lag Fix 怎么安装?

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

评论

登录后评论和评分

cambrova 的其他作品

查看全部 →