Routing System

Overview

The Railcraft Routing System is a sophisticated cart pathfinding mechanism that allows players to control which direction carts travel at junctions. It uses routing tracks and routing tables to determine cart destinations.

Components

Routing Detector

  • Block: DETECTOR with DetectorRouting type
  • Function: Detects carts and reads routing tables
  • GUI: DETECTOR_ROUTING

Routing Actuator

  • Machine Type: ActuatorVariant.ROUTING
  • Function: Controls switch direction based on routing logic
  • GUI: ROUTING

Routing Track Kit

  • Track Kit: TrackKits.ROUTING
  • Applied to: Outfitted tracks
  • Function: Stores routing table and interacts with carts
  • GUI: TRACK_ROUTING

Routing Table

  • Item: ROUTING_TABLE (ItemRoutingTable)
  • Format: Written book with routing commands
  • Storage: Held in routing detector or routing track kit

Routing Logic

The RoutingLogic class processes routing rules:

Conditions

public interface Expression {
    int evaluate(ITileRouting tile, EntityMinecart cart);
    boolean matches(ITileRouting tile, EntityMinecart cart);
}

Available Expressions

Expression Description
ANY Matches any cart
EMPTY Cart has no passengers
OWNER:<name> Cart owned by specific player
DEST:<dest> Cart has matching destination
CART:<type> Cart entity type matches
FUEL Cart needs fuel
REDSTONE Redstone signal state

Operators

Operator Function
AND Both conditions must match
OR Either condition matches
NOT Negates condition
IF-THEN-ELSE Conditional routing

Routing Rules Format

Routing tables use a book format with key-value pairs:

DEST=StationA -> GO_NORTH
DEST=StationB -> GO_EAST
DEFAULT -> GO_SOUTH

Usage

Setting Up Routing

  1. Place a routing detector or routing track kit
  2. Create a routing table (written book)
  3. Name the routing table with destinations
  4. Write routing rules in the book
  5. Apply routing table to detector/track
  6. Carts with matching routing info will follow rules

Cart Routing

  1. Assign a destination to a cart (via ticket or other method)
  2. Cart approaches routing detector/track
  3. System checks routing table
  4. Cart is directed to matching output

Routing Expression Examples

DEST:StationA -> Redirects carts going to StationA
OWNER:PlayerName -> Redirects carts owned by player
EMPTY -> Redirects empty carts
FUEL -> Redirects carts that need fuel

Routing Lock System

The routing system supports locks:

  • RoutingButtonState controls lock behavior
  • Prevents unauthorized routing table edits
  • Uses golden tickets for secure routing

Signal Integration

Routing can be combined with signal system:

  • Routing detectors can emit redstone signals
  • Can trigger track switches
  • Supports complex automation

GUI

  • Detector Routing: EnumGui.DETECTOR_ROUTING
  • Actuator Routing: EnumGui.ROUTING
  • Track Routing: EnumGui.TRACK_ROUTING

Recipe

Routing detector:

XXX
XPX
XXX

Where X = detector frame, P = routing table

Configuration

RailcraftConfig options:

  • ops.only: Limit routing table editing to admins only

See Also

  • Routing Track Kit
  • Detector
  • Actuator