|Part of a series on
|Mechanics and Plugins
RailSwitch is a plugin (source) that allows automated routing across rail lines according to a specified destination. The plugin works by using the redstone mechanics of T-junction, which follows the South-east rule, interaction with detector rails. The plugin allows the detector rail to send a redstone signal only if the person in the minecart chose the right destination. This plugin can only work in one direction as the player has to arrive from a certain direction. Also, it can only choose between two destinations for a total of three rail directions : one starting point and two destinations.
If the rail is set up, simply write
/dest place where
place is the place where you want to go. You can also chain destinations
/dest place1 place2 etc. this can be useful for taking a route via specific junctions, RailSwitch will route players towards signs that contain either
place2. Stations where /dest has been set up will probably list possible destinations on signs, if you use normal direct rails between A and B /dest will do nothing.
A sign with the destination name on it must be placed over a detector rail and reinforced under the same group. The sign first line must be
[destination], then the other three lines can be destination names. They have to be placed before the T-junction. You may also use
[!destination], which will activate the rail if a player's destination is not on the signs.
Upon passing on the detector rail, the redstone signal will activate only if the player on the minecart chose a direction written on the sign. If it's the case, the detector rail will send a signal which will allow the T-junction to change direction, thus allowing the player to chose a direction. In the example on the right, if the player had the mall set has their destination, the detector would send a redstone signal which would change the T-junction orientation, thus sending the player to the mall. If the player had another destination setup, the detector rail won't send a redstone signal, and the player would continue straight up as per the normal T-junction rules.
Additionally, the destination
* is a special case, which activates the detector rail if the player has any destination set, which can be used to redirect rogue carts and players who've forgotten to set their destination.
Direction of the rail
The intersection minecart will always follow the south-east rule. In the case the rail has to be directed in the other direction, a redstone inverter has to be made. This gives two additional conditions :
- The rail has to be at least at y = 4
- The detector rail has to be placed two blocks before the intersection to make space for the inverter.
Going to the stables by default
In our example, the rail direction makes it so that if no redstone signal is sent, the cart would go to the stables. When the player will pass under the sign with
mall as a destination, but without having it set up as their destination, no redstone signal will be send, thus the player will reach the stables. If the player had set their destination to
mall, the activator rail would send a signal that would switch the T-junction orientation, and thus making the player go to the mall.
Going to the mall by default
To make the player go to the mall by default, the T-junction has to be powered, and unpowered when someone wants to go to the stables. Using an inverter makes this possible. If a player arrives without having set their destination to
stables, the T-junction won't change and they'll head to the mall.