TrainCarts/卡顿

From BergerHealer Wiki
Revision as of 08:31, 12 October 2024 by Halogly (talk | contribs) (Created page with "== 限制列车数量 ==")
Jump to navigation Jump to search
Other languages:
English • ‎中文(中国大陆)‎

« 返回

使用 TC 插件时可能在某些功能上会造成服务器或客户端的卡顿。该页面会展示卡顿的原因细节,以及如何去缓解卡顿。

复杂的 3D 模型

Minecraft 不太擅长渲染复杂的体素模型。如果你的服务器上装载有复杂模型的自定义资源包,这可能会导致客户端的帧数下降。请在上传自定义资源包到服务器之前尽可能优化和查看模型。JSON 文件的大小是最强有力的指标。

巨大的矿车

组件编辑器中配置矿车的物理属性时,矿车的大小可以设置的非常大。这改变了实体本身的边界框,这会导致服务器的 TPS 下降。主要原因是服务器对碰撞的过量运算。为防止这些卡顿,可禁用列车的方块碰撞。

Turns off block collisions, trains will fall through the ground
Command: /train collision block cancel
Permission: train.property.collision


超长等待距离

配置列车的等待距离属性,以便列车与前车保持距离。这个属性会使列车始终检测前方的轨道。因此如果等待车距设置太高可能会导致服务器的 TPS 下降。

保持区块加载

列车可以设置为保持区块加载,但加载过多的区块也可能会降低服务器的性能。区块加载过多会消耗 RAM,这可能会导致内存耗尽。一些区块可能会包含实体或红石装置,都会导致服务器的 TPS 下降。当启用这个属性的列车移动时,它们会不断加载和卸载区块,这也可能会导致问题。

通常单辆列车启用区块加载属性并不会发生什么,这和玩家移动时会加载和卸载区块相同。但如果服务器上有数百辆这样的列车就可能会造成问题。

限制列车数量

You can edit plugins/Train_Carts/config.yml to limit how many individual TrainCarts Minecart entities can exist per world. This prevents an out of control spawner sign or player abuse lagging the server to a halt.

# Limits of the amount of carts on the server
cartLimits:
  # Maximum number of TrainCarts minecarts allowed per world
  # If there are more than this number, no more minecarts can be placed/spawned
  # A value of -1 disables this limit (default)
  maxCartsPerWorld: -1
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
# Whether to include unloaded trains/carts in the maxCartsPerWorld limit
  countUnloaded: false
</div>

  <div lang="en" dir="ltr" class="mw-content-ltr">
# Maximum number of carts that can be joined together in a train
  # Linking does not happen when it would exceed this limit,
  # and trains longer than this cannot be spawned
  # A value of -1 disables this limit, allowing any length (default)
  maxCartsPerTrain: -1

Saved Train Spawn Limits

Besides a global limit, it is possible to configure a spawn limit per saved train. After having saved a train with /train save name, you can configure a spawn limit with /savedtrain name spawnlimit <limit>.

Spawn signs and train chests configured with the train name will stop spawning trains when this limit is reached. This is particularly useful with auto-spawning spawn signs that populate a train network, combined with setting destroyAllOnShutdown to true in config.yml.