Minecraft redstone – 3 outputs and 2 inputs

minecraft-java-editionminecraft-redstone

So my situation is a little bit different from other's questions. I currently have a box with 2 buttons.

Which inside looks like this:
Image #2

I want to be able to switch to previous/next using the buttons. I can do that with an simple flip-flop but the problem is I want the button to activate one of three clocks (1 clock for 1 redstone-line). I am bad at explaining so have a look at this:
Image #2

Is that possible and if yes, how?

Best Answer

Here is the contraption I came up with to solve the problem. It's a bit complicated. Forgive the length. If more clarity is needed, comment and I will try to make it more clear.

It works by moving a redstone block between one of three positions. This redstone block is the power source for the clocks. I will refer to it as the moving block.

I use pos1, pos2, and pos3 to represent the coordinates for the three positions the moving block can be in. In the first image, the moving block is in pos2.

I recommend you figure out what coordinates will power each of your clocks.

Use the command: setblock x y z redstone_block to verify it will power the clock.

In my case: pos1=(10, 40, 2), pos2=(7, 40, 2), pos3=(4, 40, 2)

If I specify command: setblock pos1 redstone_block

That means: setblock 10 40 2 redstone_block

In your case, whatever your coordinates are for pos1.

I also have a grid image with rows and columns. If I use pos(letter)(number), I mean the coordinates of the command block in that position. Examples: posC2, posE0

Here is an image of the complete circuit. Click to enlarge. Full Circuit

It explains the remote control. The two separate blocks with buttons are for next and previous. When the command block is powered it sets a redstone block in position E0 or F0 which after a delay is then removed.

This gives the correct circuit a pulse of power so it will run.

The circuits check which position of the moving block and one command block outputs high. This runs another 4 command blocks which

  1. Remove the current moving block
  2. Set the moving block in it's new position
  3. Set the testing command block to stone
  4. Reset the testing command block

The 3rd and 4th blocks are to reset the testing block output to low. (if anyone knows an easier way, let me know)

Here is the grid. Grid

From column E to the left is all the blocks that make up the 'previous' circuit. Column F to the right make up the 'next' circuit.

Blocks in column E or F are the blocks that determine which position the moving block it in. They all contain: testforblock posX redstone_block. With posX, X is to be replaced with the row number. So block F2 would contain testforblock pos2 redstone_block

One of the three blocks in the column will detect the moving block position will output the comparator high, be delayed by the repeater, and run the 4 blocks in that row.

Blocks in columns D and G are used to clear the moving clock. They contain the command setblock posX air Once again, with posX, X is to be replaced with row number. Example: Block G1 contains setblock pos1 air

After this block runs, the next block in row would be in column C or H. The blocks in these columns set the moving block in it's new position. Column C will set the block to the previous position, column H will set it to the next position. Here I will list the commands as the positions are a little more complicated to explain.

Block C1: setblock pos3 redstone_block

Block C2 setblock pos1 redstone_block

Block C3 setblock pos2 redstone_block

Block G1 setblock pos2 redstone_block

Block G2 setblock pos3 redstone_block

Block G3 setblock pos1 redstone_block

Columns A,B, I, J are the blocks used to reset the output to low.

Columns B and I contain the command setblock posY stone. In this case posY is the command block at the beginning of that row. Column B blocks will set column E blocks. Column I blocks will set column F blocks. Example: block B2 would contain setblock posE2 stone

Columns A and J will contain a similar command:

setblock posY command_block 0 replace {Command:"testforblock posX redstone_block"}

posY will be the same position as the posY from the last block. It replaces the stone that was just set with the command block with the command. With posX, X is to be replaced with the row number.

As an example, block J2 will contain:

setblock posF2 command_block 0 replace {Command:"testforblock pos2 redstone_block"}

Command blocks in columns A, B, C, H, I, J need to be set to chain blocks that are always active.

Image shows remote buttons very close to other circuit. They do not need to be, so long as all command blocks are loaded. Same with the pos1, pos2, pos3. They can be a distance from circuit.

You will have to use a different style clock then your images show as the moving block will power them constantly. Also the clock will have to shut off when the moving block moves.

I recommend a comparator clock: ComparatorClock

Again, let me know if more clarity is needed. I can list all blocks commands if needed.