//Selectors
Jump to navigation
Jump to search
Introduction
Traincarts adds command selectors that can be used to target trains, or passengers of trains, similar to how vanilla minecraft's @e selector works. Besides the usual position-based selector filters, other train properties can be used to select trains that match specific criteria.
Two selectors exist: @train and @ptrain. Both accept identical selector options, which will be discussed on the rest of this page.
To quickly view what options are available ingame, use a Traincarts command like /train info --train @ptrain[ which will then auto-complete and show suggestions of supported options.
Quick command examples:
| Example | Description |
|---|---|
| /say hello @ptrain[distance=..5] | Message "hello" to the passengers of all trains 5 blocks away or less |
| /kick @ptrain[name=train23] | Kicks players inside train with name 'train23' |
| /train destroy --train @train[destination=InterState5] | Destroy the trains heading for InterState5 |
| /train eject --train @train[dx=-2..2,dy=-3..3,dz=-2..2] | Eject the trains within a cuboid range of the sender |
| /train launch 0.5 --options 2 --train @train[tag=express] | Launches the train with tag 'express' to a speed of 0.5 over 2 blocks distance |