TrainCarts/生成
介紹
TC 提供了多種不同的生成列車方式,以下:
- 原版礦車 - 玩家可以生成 TC 礦車。這個頁面展示了原版礦車的行為。
- 生成牌 - 在生成牌上方的軌道上生成列車,可以通過紅石啟用,也可以實現周期、間隔自動化生成。
- 列車生成箱 - 一個便攜物品,可以將列車儲存進去並在軌道上重新放置。
生成模式
列車生成箱和生成牌都支持生成模式語法。使用語法可以將多個礦車或多輛不同的以保存的列車組合起來並生成。
機制 | 模式 | 釋義 |
---|---|---|
原版礦車 | m
|
生成一個可乘坐的礦車。 |
保存列車 | MyTrain
|
生成 1 個名為 MyTrain 的列車。 |
Repetition | mmm
|
生成 3 個可乘坐的礦車。 |
數量前綴 | 3m3s
|
生成 3 個可乘坐的礦車和 3 個運輸礦車(總共 6 個礦車)。 |
分組序列 | 3[ms]
|
生成 3 組且每組由 1 個礦車和 1 個運輸礦車組成,與msmsms 等價。
|
隨機 | 3[33%RedCart 33%GreenCart 33%BlueCart]
|
生成 3 組且每組由 3 種保存的列車並根據設置的隨機率組成。 |
原版礦車
默認原版礦車通過指定的單個字符表示:
文本 | 礦車類型 |
---|---|
m | 普通礦車 |
p | 動力礦車 |
s | 運輸礦車 |
t | TNT 礦車 |
h | 漏斗礦車 |
e | 刷怪籠礦車 |
例如,這個生成牌會生成 3 個礦車組成的列車:
這個命令會給予玩家一個能生成 3 個礦車組成的列車的列車生成箱:
/train chest mmm
已保存的列車
玩家可以使用/train save [名称]
保存正在編輯的列車。這個名稱可以在生成模式中使用。
- 匹配保存的列車名稱時,將匹配最長的名稱。
- 可以使用命令列出保存的列車名稱:
/savedtrain list
- 可以使用命令導入或編輯保存的列車:
/savedtrain [名称] [子命令]
- 保存的列車也可以包含進伺服器加載的資源包中,就像 TrainCarts Demo Resource Pack 一樣。
- 注意:保存的列車名稱與命名(
/train rename
)的列車不同。兩者之間沒有關係。
例如,這個生成牌會生成一輛名為 MyTrain 的列車:
該命令會給予玩家一個列車生成箱,且內含列車的名稱為「MyTrain」:
/train chest MyTrain
保存列車的生成模式
可以使用/savedtrain [名称] spawn [模式]
保存(長)列車生成模式,而不是只保存列車。
例如:
/savedtrain MyTrain spawn 4[50%m 50%s] p
生成 MyTrain 時,將隨機生成 4 輛普通礦車或運輸礦車,然後是 1 輛動力礦車。當模式太長無法輸入進生成牌時尤其有用。這些模式可以遞歸使用。
重複
多個列車名稱或原版礦車名稱可以彼此緊隨放置,無需空格。匹配名稱時,將匹配與模式符合的最長的保存列車名稱。
Amount Prefix
Digits can be put in front of names to repeat that pattern a number of times. If you want to spawn MyTrain three times, you can put 3MyTrain
Grouped Sequences
Patterns can be grouped so that the amount prefix repeats the entire group, instead of only the one train or cart specified.
For example, if you want to spawn a locomotive followed by red-green-blue carriages repeated four times (12 carriages), you can put:
4[carr carg carb] loco
Random
Use the % weighted prefix to randomly have a pattern choose between different types of trains to spawn. This follows a syntax similar to the WorldEdit syntax.
For example, to spawn a locomotive followed by 12 carts of random red, green or blue carriages:
12[33%carr 33%carg 33%carb] loco
These prefixes can also be applied to grouped sequences to create variable-length trains. This will spawn a locomotive with randomly 0, 1 or 2 carriages:
[33%[] 33%carb 33%[carr carg]] loco
The percentage total is normalized, so in the above examples using 50% or 200% would have resulted in the same behavior.