Tuesday, July 05, 2011

Minecraft - a redstone cart shuttle

On occasion still playing with Minecraft. The downside of losing infinite blocks is balanced by the upside of gaining all sorts of extra blocks - most notably those that can automate stuff.

In my current world I have two areas separated by quite some distance, annoying to walk between. What I need is some sort of transport that can shuttle me between them. Luckily the paid version of Minecraft includes rails and carts. This should be easy.

I lay down a set of rails between my two points and they snap together quite neatly. I place a minecart on the track and right-click to get in. Nothing happens because the minecart is unpowered. There is a powered version that can be built, but it requires fuel every time it's used and that just makes things complicated.

The way around this is to use a Powered Rail. I place one set at either terminal and still nothing happens. The powered rail hasn't been powered. I place two stone blocks alongside it and add a button.  Buttons provide a quick surge of power to any of the six blocks it's next to; in this case my powered rail.

I get in the cart, press the button, and head backwards and come off the track. One stopping block later and I'm now heading in the right direction... and slowing down. Seems I need to give it some more oomph. What about another powered rail just before I started to slow? Placed and with my cart repositioned back at the start I set off again. I hit the next powered rail and come to a halt. Huh? Turns out unpowered powered rails act as brakes. So do I set up a series of buttons and have to press them in turn? Way too much hassle when I can use a Detector Rail instead
Detector rails activate when a minecart runs over them and provides power to the surrounding four horizontal blocks. One detector followed by one powered rail and I'm maintaining my speed and reach Terminal 2. I press the button and come to a halt again. I need a detector plate on the opposite side too. All in place and my track looks as follows:

Block - Powered Rail - Rail(s) - Detector Rail - Powered Rail - Detector Rail - Rail(s) - Powered Rail - Block.

All done? Well almost because although it's quicker to use the rail to get from Terminal 1 to Terminal 2 and back it's also possible to get back without using the rail should I decide to wander about a bit. That means I can reach Terminal 1 and find the minecart at the other end. Wouldn't it be nice to get it to return when called?

In this instance rather than a button or lever I thought I'd use a pressure plate so that when I walk up to the terminal if the cart is at the other end it is automatically sent back down to me. Pressure plates work like buttons except the power is constant while you stand on them. The problem here though is that the powered rail I want to activate is in the other terminal. This is where redstone wire comes into play. Wire carries a charge. So in this case I place a wire underneath my plate and 'thread' it through a level below my track ( so I can cover it up later) and attach it to the block my powered rail is resting on. I stand on the plate and... nothing happens.

Now here the troubleshooting becomes a problem. The wire changes colour when activated, but it is only activated when I stand on the plate. As soon as I step off to trace the wire I can't. Again a solution presents itself I can use either a Redstone Torch which provides a constant power source; or a lever which toggles power on and off.

With one of those replacing my pressure plate I note the power only goes so far along the wire before petering out. Power only travels so far I need to add a Redstone Repeater. I place one and wonder why it hasn't done anything. That would be because it's the wrong way round. To place it you need to be facing in the direction you want the power to travel. Repeaters in place and I look at my powered rail... which is still unpowered.

Redstone wire only provides power to the four horizontal blocks surrounding it. If I want to power my rail the wire needs to surface, which I think is messy. How to get around this? Redstone torches provide power vertically and can be connected to wires. I place a torch beneath the rail and nothing. I head back and turn off my lever. The torch switches on. Lever on, torch off. That's going to be the same for the pressure plate - plate on, torch off; plate off, torch on. I want it the other way around. This is where it gets complicated.

A torch connected to block is controlled by that block. So feed the wire up to that block and put a torch on the opposite face and you can turn the torch off by powering the wire. However a torch can provide its own power. Place some wire next to the torch and you can pass on the 'state' of the torch along that wire. Plug that into another block with a torch on and the result is:

Plate off - wire off - block off - torch on - wire on - block on - torch off.
Plate on - wire on - block on - torch off - wire off - block off - torch on.

At which point the only hassle is making sure that none of the wires pass too closely to torches not in the circuit. In this instance I have a wire running along each side of the track and looping around each other at the end.

Now I walk into the terminal over the plate and if the cart is not there it gets sent to me. I climb in, hit the button and get sent to the other terminal. When I get out and walk over the plate nothing happens.

So much trial and error to see how these things work.