How It Works
A detector rail acts as both a track for minecarts and a redstone power source. It activates the moment any portion of a minecart enters its space and deactivates once no minecarts remain on it. The output pulse duration is always a multiple of 10 redstone ticks (though game lag or chunk unloading can occasionally alter this timing).
While active, a detector rail performs the following redstone actions:
- Powers adjacent redstone dust and redstone repeaters (facing away from the rail) to power level 15.
- Strongly powers any full, solid, opaque block directly beneath it to power level 15.
- Activates all adjacent mechanism components—above, below, or to the sides—including pistons, redstone lamps, powered rails, droppers, and hoppers.
Reading Minecart Contents with a Comparator
When paired with a redstone comparator facing away from the rail, a detector rail can inspect the inventory of container minecarts:
- Minecart with Chest or Minecart with Hopper: The comparator outputs a signal strength between 0 and 15 proportional to how full the minecart's inventory is (0 if completely empty).
- Other Minecarts: Regular minecarts (even with a player or mob inside), furnace minecarts, and TNT minecarts produce a comparator output of 0.
Just like standard stationary containers, a comparator can also read the fullness of a chest or hopper minecart sitting on a detector rail through a solid opaque block placed adjacent to the rail.
Placement and Rail Orientation
A detector rail must be placed on top of a valid support surface. It attaches to:
- The top of any full solid opaque block (including full-block mechanisms like droppers, dispensers, note blocks, command blocks, and redstone lamps).
- The top of a hopper, an upside-down slab, or upside-down stairs.
It cannot be suspended in midair (even with commands) and immediately breaks into an item if the block beneath it is removed, if a piston pushes it over a gap with no floor, or if lava flows over it.
Detector rails cannot curve, only forming straight flat tracks (north_south, east_west) or slopes (ascending_north, ascending_south, ascending_east, ascending_west). When placed, the rail automatically aligns with adjacent rails on the same level or one block higher:
- With no adjacent rails, it defaults to
north_south. - If a rail is later placed to its east or west, it re-orients to
east_west, even if already connected north-south. - If two adjacent rails are on non-opposite sides, or three or more rails surround it, it aligns
east_west. - When slanting upward toward a rail one block higher with multiple valid directions, it prioritizes sloping in this order: west, east, south, north.
Common Circuit Applications
- Minecart Unloading Stations: By placing a detector rail on top of a hopper and reading the rail with a comparator (often through a solid block), you can detect while a hopper minecart is still draining items and lock a powered rail until the comparator output drops to 0.
- Track Switching and Routing: A detector rail placed ahead of an intersection can trigger a circuit to switch curved rails or activate powered rails based on whether a cart is approaching or whether a container cart contains items.
- Minecart Clocks and Timers: Because a passing minecart always triggers a detector rail for a multiple of 10 redstone ticks, loops of powered rails and detector rails can generate periodic pulses as a cart circles the track.
Tips and Common Mistakes
- Accidental Hopper Locking: Because an active detector rail powers adjacent mechanisms, a detector rail placed directly on top of a hopper will lock that hopper while a minecart is on it. If you want the hopper below to pull items from the cart, use a hopper minecart or read the cart from a detector rail placed on a solid block next to a hopper, or rely on a hopper minecart pulling from above.
- Powering Adjacent Powered Rails: A detector rail directly powers adjacent powered rails. While convenient for boosting a cart automatically, it can unintentionally launch a parked minecart if placed right next to an unpowered holding rail.
- Trapdoor Interaction: Placing a minecart onto a detector rail resting on a closed, unpowered trapdoor causes the detector rail to power and open the trapdoor, which immediately breaks the rail. However, if the trapdoor is already powered from an external source when the minecart arrives, the trapdoor stays closed; the active detector rail then keeps the trapdoor powered and closed even after the external power is removed.
- Side-Entry Turning: If a minecart enters a detector rail from the side rather than the aligned ends, it turns east or south on flat rails (depending on rail orientation) or travels downward on a sloped detector rail.
