Looking at the problem mathematically: The basic analog operation we have is a - b
, and the values must be between 0 and 15. How can we produce 2·a
using that?
2·a = a + a no multiplication, but addition
= a - (-a) no addition, but uses negative numbers
= 8 + a - (8 - a) in range, but has a + operation
= 8 - (-a) - (8 - a) almost there...
= 15 - (7 - a) - (8 - a) this can be redstone!
Note that we are finally using 15 and 7, not 16 and 8, because there is no signal strength 16. The output for input 8 will be 15, not 16, because (7 - a)
can only go down to 0 rather than -1.
This is a “physical” implementation of the above formula. The two furnaces are used as signal sources, containing 64+32 and 64+24 items each, causing the comparators to their left (set to subtraction mode) to have input signals of 8 and 7 respectively (which is which doesn't matter). The torch at the bottom provides the constant 15, and the two comparators on the left side subtract the two intermediate results from 15 to produce the final output on the top left.
The middle right comparator is not actually necessary; it just simplifies seeing where the input to the circuit is and what the signal strength at that point is. It does nothing but repeat the signal (it doesn't interact with the furnaces). Thus, this circuit can be built with only 4 comparators.
Note that since the output comes from two subtractions in sequence, when the input changes, the output will change in two equally-sized steps. This could be good if you want a smooth change (e.g. if the input goes from 2 to 3 the output will go through 4, 5, 6) but bad if you're looking for only “correct” outputs (e.g. only even-numbered ones).
The circuit can be compacted by one more block as follows, requiring an additional comparator (which merely repeats the signal, because the input to its right is always weaker and it is not in subtraction mode).
(Another possible compacting is to bring the top and bottom rows right next to each other; this would require feeding the input signal to the two input comparators separately, which might happen to be convenient for some 3D build. Note that you can compensate for signal losses by changing the furnace fill, if your original input's lowest value is above 0.)
These circuits were built and tested in Minecraft 1.6.2 and should work back to version 1.5, but not before 1.5 as comparators did not exist then.
This was an interesting problem to work on and I found what I think is an elegant solution — thanks for asking!
There are a number of methods for extending a redstone signal:
Repeaters
Just plonk down repeaters. Each one gives you another 15 blocks, however, there is a 1-tick delay in the signal for each repeater you use, which can slow down large circuits.
Instant Wire
This allows for instantaneous redstone transmission over long distances. There's a wiki page for it! It's a little complex, so here's video:
Should the video go down, a search for Instant Wire will turn up many more.
Mods
MineFactory Reloaded has redstone wiring that can extend for supposedly unlimited distance, preserving signal strength, using a network system.
Best Answer
I stumbled on this trying to figure out how to do this, and I found out NONE OF THEM WORK! So I figured it out instead. Place a repeating redstone curcuit going into a command block, and type in the command block this:
with a comparotor coming out of it.
Then, hook up whatever you want to the comparotor! Now, here's how to know what number to put: the number you put = how many blocks away a player has to be before the redstone comparotor turns on. Also, if you put "m" after r, so "rm" it will work only if the player has LEFT the number of blocks put.
Don't you use ANY () in your command! JUST []