1

Upon request from multiple moderators/experts, this question has been split into two identical questions, one for each of the two main versions of Minecraft. This question is for solutions for Java Edition. If you have a solution for Bedrock Edition, please post it here.


I am creating a redstone contraption that is based off an RS-NOR latch and a T-flip-flop at once.
The contraption needs to have three pulse-based inputs and one output.

Here are the inputs and their descriptions of what they should do:

  • "On" button: Turn the output on, or keep it on if it is already on.
  • "Off" button: Turn the output off, or keep it off if it is already off.
  • "Toggle" button: Toggle the state of the output, no matter what state it was in before.

The toggle button should provide only a temporary inversion, with the next button press acting as normal.

Here are the questions I would like to have answered:

  • Should my redstone contraption be based off a T-flip flop, a RS-NOR latch, or neither?
  • What is the most compact way to construct a redstone contraption like this?

Please include images with your solution.

1

What you're looking for is still going to be based primarily around an RS latch, with a couple of AND gates to make the toggle line work properly. For this, the circuit diagram looks like this:

Circuit diagram consisting of an RS latch and a pair of AND gates

Breaking it down, you have an RS latch hooked up as normal. From there, you need the output and an inverted output to control two AND gates that control which input the Toggle is meant to control. That is, if the RS state is on, your toggle should control the off side of the RS latch.

I'm sure this could be done more cleanly, but the circuit I came up with is this:

The above circuit implemented in Minecraft

Note that in the above there are sticky pistons underneath the gold blocks which act as AND gates, and a redstone repeater underneath the diamond block to keep the signal from the repeater on the Reset line from being directly connected to the Output line. Here's a closer look at that portion of the circuit:

Closer look at the AND gates and the repeater in the Q line

| improve this answer | |
  • @ExpertCoder14 I added a screenshot to zoom in on the AND gate pistons. As far as I'm aware, this should work in Bedrock Edition. – Unionhawk May 19 at 15:55
  • @ExpertCoder14 Hmm, interesting. Having built it myself in Bedrock I see what the issue is now. The build doesn't utilize quasi-connectivity and gets away with it because Java edition. However, since it does contain diagonal power to pistons, it fails in Bedrock edition. – Unionhawk May 19 at 20:39
1

Maybe there's a compact way to do exactly what you want in one circuit element, but you can also just use a regular RS-NOR latch and then a circuit element that inverts signals on request.
I tried out a bunch of complex ideas around this, until I realised that this comes down to a simple logic gate, with this logic table:

┌───┬───┬───┐
│IN1│IN2│OUT│
├───┼───┼───┤
│ 0 │ 0 │ 0 │
│ 0 │ 1 │ 1 │
│ 1 │ 0 │ 1 │
│ 1 │ 1 │ 0 │
└───┴───┴───┘

Therefore, what you want is an XOR gate. The Minecraft wiki has tutorials for those: https://minecraft.gamepedia.com/Mechanics/Redstone/Logic_circuit#XOR_gate (archive)


Just so this is a complete answer (and not considered a link-only answer), here's a screenshot of one of the alternative designs. Of course you'll realistically want to compare the different designs on the wiki and pick one that works best for your situation.

| improve this answer | |
  • I'm not really following how a 2 lever input XOR works in place of a 3 button input RS+T. I guess would you hook up the S line on an RS-NOR to IN1, then a T output to IN2 here? – Unionhawk May 18 at 20:04
  • The output of your RS-NOR latch is one input lever, the inversion button is the other lever. I don't know what you mean with "S" and "T". – Fabian Röling May 18 at 21:10
  • In other words, such that the final black-box diagram looks like this: i.stack.imgur.com/2KuJP.png – Unionhawk May 18 at 21:21
  • The top left box would be the RS-NOR latch and the bottom left box would not exist, it would just be a lever input. – Fabian Röling May 18 at 22:10
  • Ooh, I like your concept, but unfortunately there is one unacceptable flaw: Based on your last comments with the RS-NOR being on the first lever and the toggle input on the 2nd, it works fine, except for the fact that when the toggle lever is ON, not only does it invert the output, it also inverts the RS-NOR's controls, i.e. the ON button will turn it OFF, and the OFF button will turn it ON. I need the toggle input to invert the output but NOT the controls. – ExpertCoder14 May 18 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.