TrainCarts/Commands [zh-hans]

From BergerHealer Wiki
Revision as of 19:04, 26 November 2025 by Eletronprocoress (talk | contribs) (Created page with "标签可以与转辙器或检测器结合使用。例如,你可以为要销毁的列车设置一个标签来标记它。每个矿车都有一组单独的标签,在列车上设置标签会同时为列车中的所有矿车设置标签。")
Jump to navigation Jump to search

简介

通过命令可控制单一矿车或整条列车,也可执行一些常规操作,例如移除某个世界的全部列车。

基本语法

要执行命令,需以/train或者/cart为开头。/train能对整条列车进行操作,而/cart则是对列车中的其中一节车厢进行操作。

选择

针对特定列车(/train)或单一矿车(/cart)的命令,玩家需要首先选中列车或单一矿车。可通过以下方式完成:

  • 进入矿车。
  • 潜行并打击矿车,这样在创造模式下打不坏。
  • 使用列车生成箱新生成一辆列车。
  • 准心对准要选中的矿车,然后执行命令/train edit
  • 使用/train list命令来显示的列车名称列表,单击列车名称,或在/train edit <列车名称>中指定列车名称。

目标标签

除了以上的选中方式,使用以下的任一标签也可直接选中列车。这些标签同样可在命令方块中使用。

标签 示例 描述
--train <名称> /train maxspeed 0.0 --train train12
/train maxspeed --train @train[name=intercity*]
通过名称选中列车。支持@train 选择器代替名称,这样你可以一次选中多辆列车。
--nearest /train maxspeed 0.0 --nearest 选中离命令执行者最近的列车,最远 128 格方块距离。
--near <x> <y> <z> <范围> /train maxspeed 0.0 --near ~ ~ ~ 5 选中离指定坐标最近的列车,可自定义最远范围。
--cart <索引 或 实体uuid> /cart destroy --nearest --cart 0 选择前方的一个矿车。索引从 0 开始是前方第一个,1 是前方第二个,以此类推。单词 'head'(头部)和 'tail'(尾部)可用于选择开头和末尾的一个矿车。要选择矿车所在的列车可以通过其他标签来选定,否则将使用玩家当前正在编辑的列车。
--world <世界名称> /train destroy --world world_nether --near 2 66 -134 1.5 默认情况下,该标签仅针对命令执行者所在的世界。该标签可以指定不同的世界。从服务器控制台执行命令时需要使用该标签。

全局命令

全局命令总是以/train开头,这些命令不需要选取列车。


列表

/train list
/cart list

列出所处世界中静止和移动状态的列车数量。该命令还会列出矿车实体(列车的所有部分)的总数和你拥有的列车。


重新调度

/train reroute [--lazy]

若自动寻路系统因路线改变而失效,可使用该命令来强制重新计算所有路线。

The '--lazy' -Parameter:

Normally the command takes all previous nodes which known existed and schedules them for routing.
With the '--lazy' parameter, this happens once a cart goes towards a switcher sign, and only from that node.


全部销毁

/train destroyall
/train removeall

销毁服务器上所有的矿车和列车。可用于重置插件。


漏洞修复

/train fixbugged

销毁所有未由插件管理的矿车。若服务器意外关闭,导致轨道上留下单独的列车,这个功能非常有用。


仅 train 命令

以下命令只能使用 /train


重命名

/train setname [name]
/train name [name]
/train rename [name]

设置列车名称,不可与其它列车重复。


设置显示名称

/train setdname [name]
/train displayname [name]
/train setdisplayname [name]

设置列车的显示名称,可以重复。使用触发器时,该名称会显示在SignLink上。


train 和 cart 命令

以下命令使用 /train/cart


信息

/train info
/train i

显示train或cart的相关信息,例如名称和设置的属性。


Ownership

/train claim

Sets you as the only owner of this train.

/train setowner [names...]
/train setowners [names...]
/train setowners

Sets the owner names of this train. Use no names to clear the owners.

/train addowner [names...]
/train addowners [names...]

Adds the owner names to this train.

To change ownership of a single minecart, use the '/cart' command instead of '/train'. When setting train owners, you set owners on all minecarts simultaneously. If no owners are set for a minecart, it can be freely edited and destroyed by everyone else.


标签

/train settags [标签...]
/train settag [标签...]
/train tags [标签...]
/train tag [标签...]
/train settags

为列车设置标签。不填写标签则清除该列车的标签。

/train addtags [标签...]
/train addtag [标签...]

为列车添加标签。

标签可以与转辙器或检测器结合使用。例如,你可以为要销毁的列车设置一个标签来标记它。每个矿车都有一组单独的标签,在列车上设置标签会同时为列车中的所有矿车设置标签。


Destination

/train destination [destination]
/train dest [destination]

Sets the destination for this train.

You can also set a destination on a single minecart in the train, this way letting switcher signs split trains up in multiple carriages.


Player enter

/train playerenter [bool]

Sets if players can enter the train or minecart.


Player exit

/train playerexit [bool]
/train playerleave [bool]

Sets if players can exit the train or minecart.


Pick up

/train pickup [bool]

Sets if the storage minecart(s) (in the train) pick up nearby items from the ground.

Collision

/train collision mobs enter
/train collision player push
/train collision train cancel
/train collision block cancel

Set collision rules. This can be used to allow mobs to enter the train when they collide with it, disable trains linking or push players aside when they are in the way. Setting collision with blocks to cancel will make the train no longer check for collisions with blocks, which can help with performance.