Minecarts and rails are Minecraft features often used for transporting players. However, they can also perform a lot of mechanical feats better than the usual redstone items. Minecarts are entities that can roll quickly along minecart rails. They can turn, go up and down slants, and even derail (though they suffer a large amount of friction off the rails, slowing to a halt almost immediately).
Minecart rails generally have these properties:
Each rail can be straight or bent at a right angle. When a rail is placed or updated, it automatically connects to any open-ended rails directly adjacent to it, if possible. If a rail is adjacent to three open ends such that it can make two possible elbow turns, it bends in a direction dependent on whether it’s redstone-powered.
Booster rails, detector rails, and activator rails cannot bend in elbow turns, and can only face straight between two opposite directions.
Straight rails can automatically connect to rails one block above or one block below. Rails can run at an upward or downward angle — you just have to arrange some blocks in a staircase pattern and place the rails on top of them.
This concept is similar to the redstone dust property of running up the sides of blocks, but slightly more limited — if a minecart rail is in the form of an elbow turn, you cannot connect it to other rails in this way.
If a minecart jumps onto an elbow turn, it continues to move in a straight line. Some minecart tracks involve running a minecart rail into an elbow turn — but not from one of the open ends. If two tracks are adjacent without being connected, and one is facing the other, the minecart automatically jumps from one track to the other and continues moving in the same direction.
Though redstone is run by an intangible current, minecart machines are run by placing one or more minecarts on a track and setting it going, often in an infinite loop (assisted by booster rails). In this way, working with minecarts is a more object-oriented science, focusing on components and their properties rather than on functions.
You can fill minecarts with chests, furnaces, hoppers, TNT, and command blocks.
You can also push minecart rails with pistons. (You push the rail itself, not the block it rests on.) This makes pistons useful in minecart-based circuits. Pistons can move rails from one track to another, push several rails at a time to extend them outward, and even completely rearrange tracks to change the route of some minecarts. However, you should keep these points in mind when using pistons with minecarts:
You cannot push minecart rails up or down. If the block under a rail is moved vertically, even if the rail is moved at the same time, there will be a moment when the rail and the block are separate, and thus the rail will break. You can move the block under a rail horizontally, but only if you move the rail itself in the same direction simultaneously.
Minecart rails automatically connect to other rails when pushed or pulled. When a rail is moved so that it’s next to the open end of another rail, it automatically changes its direction and can even change between a straight track and an elbow turn.
Minecarts can be pushed along with rails. If a minecart is on a rail, a piston next to the rail can push both of them at one time, and the minecart should stay on the rail. This doesn’t work when pulling a rail with a sticky piston, because it cannot pull entities such as minecarts.
Though minecarts are more physically limited than redstone, they have advantages that make their mechanics worth learning.
For example, you can send a minecart through a long track that activates machines in different positions at different times. You can also move objects such as hoppers and command blocks around in tracks and loops, producing effects that are difficult to obtain with classic redstone. Thus, if you want a program to be simple but dynamic, build it with minecarts.