Site Tools


Sidebar

Minecraft Server Plugins

Lands
Extra Storage
Jobs
Craftable Saddles
MinePacks
Better Farming
Pets
Biome Compass
Stargate Portals
Chest Protection
Smaller Plugins
trains:traincarts_commands_selectors

TrainCarts Commands Selectors

This page contains information about using selectors with TrainCarts commands to target specific trains or passengers of trains.

Introduction

TrainCarts adds command selectors similar to Minecraft's @e selector. These selectors allow targeting based on various train properties. Two selectors exist: `@train` and `@ptrain`. Use `/train info –train @ptrain[` to see available conditions in-game.

### Quick Command Examples

Example Description
———————-
`/say hello @ptrain[distance=..5]` Message “hello” to passengers of trains within 5 blocks
`/kick @ptrain[name=train23]` Kick players in train named 'train23'
`/train destroy –train @train[destination=InterState5]` Destroy trains heading for InterState5
`/train eject –train @train[dx=-2..2,dy=-3..3,dz=-2..2]` Eject trains within a specified cuboid range
`/train launch 0.5 –options 2 –train @train[tag=express]` Launch trains tagged 'express' to a speed of 0.5 over 2 blocks

Conditions

Multiple conditions can be combined using commas, and all number-based conditions support Minecraft range syntax (e.g., `a..b`, `..6`, `12..`). Prefixing a value with `!` negates the condition.

### Position Cuboid Specify coordinates and optionally grow the cuboid using `dx/dy/dz`. The `world` condition can target trains in specific worlds.

Examples:

  • `@train[x=10..12,y=23..56,z=-100..-80]`
  • `@train[x=10,y=23,z=-100,dx=2,dy=33,dz=20]`
  • `@train[dx=-10..10,dy=-5..5,dz=-10..10]`

### Distance Filter trains based on spherical distance to the sender or specified cuboid.

Examples:

  • `@train[distance=..10]`
  • `@train[distance=1000..]`
  • `@train[x=100,y=50,z=-100,distance=..5]`

### Sort and Limit Sort results by `nearest`, `furthest`, or `random`. Use `limit` to specify the number of results.

Examples:

  • `@train[distance=..100,sort=random,limit=1]`
  • `@train[distance=..100,sort=nearest,limit=2]`
  • `@train[distance=1000..,sort=furthest,limit=10]`

### Train Name Select trains by name or pattern. Supports wildcards.

Examples:

  • `@train[name=train12]`
  • `@train[name=Intercity*Express]`
  • `@train[name=*]`

### Train Tags Filter trains by tags. Supports multiple tags and wildcards.

Examples:

  • `@train[tag=mytag]`
  • `@train[tag=*fast,tag=!express]`

### Passenger Count Filter trains based on the number of passengers or player passengers.

Examples:

  • `@train[passengers=5..]`
  • `@train[playerpassengers=2..]`

### Derailed Select derailed trains.

Examples:

  • `@train[derailed=1]`
  • `@train[derailed=true]`

### Unloaded Select trains in unloaded chunks.

Examples:

  • `@train[unloaded=1]`
  • `@train[unloaded=true]`

### Speed Filter trains by speed.

Examples:

  • `@train[speed=0]`
  • `@train[velocity=0.5..]`

### Miscellaneous Properties Additional properties can filter selections:

  • destination - Set destination for the train.
  • friction - Friction modifier (default: 1).
  • gravity - Gravity modifier (default: 1).
  • keepchunksloaded - Whether the train keeps nearby chunks loaded.
  • speedlimit - Speed limit set for the train.
  • ticket - Filter by ticket names.

For more details, visit the [original page](https://wiki.traincarts.net/p/TrainCarts/Commands/Selectors).

trains/traincarts_commands_selectors.txt · Last modified: 2024/07/11 21:51 by paul