Redstone circuits/Miscellaneous

Here we discuss several "tricks of the trade" and redstone circuits.

The North/South Quirk
A specific arrangement of torches which would normally be expected to behave identically to a traditional 2-torch repeater, causing a 2-tick delay in signal transmission, instead causes only a 1-tick delay. (See figure 1.) When constructed with the torches facing east and west, this arrangement causes the expected 2-tick delay, but when facing north and south, the second (top) torch changes state at the same time as the first, after only a single tick.

The quirk can cause unexpected bugs in complicated circuit designs when not accounted for, but before the introduction of redstone repeaters, it had several practical uses. Even now, if you are using the torches anyway, this trick can be used to synchronize circuits that are 1 tick apart, or conversely delay one side of a circuit. Another application is in creating a clock circuit (see below) with an even pulse width and period.

The North/South Quirk can still be used to obtain two signals which are always inversely related without the additional 1-tick delay a NOT gate normally causes in the second signal. (See figure 2.) This can be especially useful in circuits where precise timing is important, such as signal processing that relies on the transition of an input from high to low and low to high (on to off and back), for example by sending each of the inverse signals through separate edge detectors (see pulse generators below) and then O-Ring their outputs.

Delay Circuit
Sometimes it is desirable to induce a delay in your Redstone circuitry. Formerly this was done with a series of torches, but, in Beta 1.3 the single-block Redstone Repeater was introduced, which effectively rendering these delay circuits obsolete. The historical circuits are shown here for completeness, and will still work should you choose to build one.

These two delay circuits utilize torches heavily in favor of compactness, but in doing so the builder must be aware of the North/South Quirk. For maximum signal delay, construct these designs so that the stacked torches face east and west. For a fine-tuned delay, adjust the design to rotate one of the alternating-torch stacks to face north and south, or add an additional stack in that orientation.

Design A gives a 4 tick delay, while design B gives a 3 tick delay.

ABBA Switch
Many piston creations require them to fire sequentially in one order, and close in the opposite. Such as in secret piston doors, the circuits for them can often be huge. ABBA switch is named so as the compact circuit is designed to turn on output A, then B, and later turn off output B, then A. Design A is a typical ABBA switch. The upper two rows can simply be repeated for additional outputs C, D, etc.. The settings of the repeaters can also be increased, to increase the delay between turning successive switches on or off. However doing either of these lengthens the total time that much more, and to maintain the proper order, the activating pulse must light the entire circuit before turning off.

A 1 Wide compact design (C and D) can be seen in this video. This design is faster and cheaper than the previous vertical ABBA. Delay can be added at the repeaters, and the design can easily be extended to more inputs by repeating the last two columns. The delay for an output can be extended even farther than 4 ticks by duplicating a repeater column, at the cost of some unevenness in timing. Again, the power must hold long enough to light the entire circuit, or the ordering will fail.

Multiplexer
A multiplexer (MUX) is a device that selects one of two or more inputs and outputs the selected input. This multiplexer can be chained together, allowing for multiple bit multiplexing.

For these designs, the inputs are labelled A and B. C is the "control" input: whether A or B passes through depends on whether C is powered or not.

Design A represents an old-style multiplexer based on torches. As with many other circuits, repeaters and pistons have produced far simpler and more compact multiplexers. Design B reacts as quickly as the older version, but only requires as little as 3&times;1;&times;4 cells. Design C represents a vertical option.

Relay(Demultiplexer)
The relay is the reverse of the multiplexer. It allows you to have one input be sent to either of two different outputs, A or B depending if a clock input C is off or on. The clock input is commonly controlled by a latch, so that it can be set or reset by pulses. The modern version A simply reverses the modern (piston) multiplexer.

The traditional way to build a relay is with two AND gates bound by an RS latch]. Design B represents a more compact version of the core logic, with the latch separated out to an external input.

The relay defaults to one output, and by setting the control signal you can change to the secondary output. Unlike a simple latch, the relay allows you to send a non-constant signal, including none at all. It is useful for sequential locks, and any other application where you want a non-constant signal to go to one output, switched to another by an external trigger.

Random number generator
A random number generator (aka RNG, or "randomizer") is a circuit that can generate numbers with no recognizable pattern.

The two RNGs below depend on the stack maximums of the items they push:
 * A 64-stackable item is any item with a stack maximum of 64 items (for example, sticks, cobblestone, etc.).
 * A 16-stackable item is any item with a stack maximum of 16 items (for example, signs, snowballs, ender pearls, etc.).
 * A non-stackable item is any item which cannot be stacked (for example, a wooden shovel).


 * Dropper-Hopper 2-RNG


 * 1x3x2 (6 block volume), 1-wide, flat, silent
 * circuit delay: 3 ticks (rising) and 1 tick (falling)
 * Outputs either power level 1 or 3 while on, power level 0 while off.
 * When the input turns on, the dropper will randomly choose to push either the stackable item or the non-stackable item into the hopper, causing the comparator to output either power level 1 or 3. Because the powered dropper is a solid/opaque block, it will also deactivate the hopper, preventing it from pushing the item back to the dropper until the input turns off.
 * The output power level can be used as is (for example, to subtract 1 or 3 from a comparator in subtraction mode), but more often the output is connected to a line of two redstone dust and a repeater to get a final output of 0 or 15.
 * Variations: If the dropper is powered indirectly (for example, by quasiconnecitvity or an adjacent powered block), the hopper won't be deactivated and will immediately push the item back into the dropper. This turns the circuit into a monostable rising edge detector with a 3.5-tick output pulse (still with a random power level of 1 or 3).


 * Dropper-Hopper 3-RNG


 * 1x3x3 (9 block volume), 1-wide, silent
 * circuit delay: 3 ticks (rising) and 1 tick (falling)
 * Outputs power levels 1, 2, or 3 while on, power level 1 while off.
 * When building this circuit, wait until the hopper is deactivated by the powered dust before putting five 16-stackable items in its far right slot. Then put a 64-stackable item, a 16-stackable item, and a non-stackable item in the dropper.
 * Before the input turns on, the hopper's five 16-stackable items are enough to produce a power level 1 output from its comparator (even a single 64-stackable item would be enough for that). These five items should never be returned to the dropper, so the comparator's output will never drop below power level 1.
 * When the input turns on, the dropper will push an item into the hopper, which will be placed in the hopper's left slot. It takes 23 64-stackable items (or five 16-stackable items and three 64-stackable items, or six 16-stackable items) to produce power level 2, so if the 64-stackable item is pushed that won't be enough to increase the output power level, but if the 16-stackable item is pushed the output power level will increase to 2. And if the non-stackable item is pushed, the output power level will increase to 3.
 * The hopper is held deactivated by the powered dust when the circuit is off, and by the powered dropper when the circuit is on. But, when the input turns off, there is a brief 1-tick moment when the dropper has just turned off, but the torch attached to it hasn't turned on again. This allows the hopper to activate for 1 tick, pushing an item back into the dropper. A hopper always pushes items from its left slots first, so the hopper will push back the item the dropper pushed into it, rather than any of the 16-stackable items in its far right slot, allowing the circuit to reset itself.
 * Variations: You can remove one of the items from the dropper to create a 2-RNG with different power level outputs than the regular 2-RNG: removing the 64-stackable item outputs power levels 2 or 3, and removing the non-stackable item outputs power levels 1 or 2.
 * You can add additional redstone dust leading from the hopper to a block next to it, and then down to the side of the comparator. This 2-wide variation will keep the comparator's output off while the input is off.
 * Earliest Known Publication: 16 April 2013

Block Update Detector
The Block Update Detector switch, or BUD, detects any time an adjacent block receives an update. An update is anything that changes that block's state: block placed, destroyed, door opened, repeater delay changed, cake eaten, grass growing, snow falling, furnace used (or turns off), and so on (chests opened and crafting tables used do not cause updates, sleeping in a bed does). When a block is updated, all adjacent blocks are also eligible for an update, and this can be used to produce a redstone signal or for other purposes.

BUDs have been used for all kinds of things, from traps to detecting daylight to locking mechanisms on hidden doors.

Current BUD switches take advantage of a quirk where pistons can receive power, but not updates, from blocks adjacent to the space the piston head occupies when extended. That is: blocks adjacent to the extended state and not adjacent to the retracted state provide power to extend the piston, but as they are not adjacent to the retracted state do not cause the piston to update when that power state changes. There was formerly a similar quirk that allowed BUDs made with just redstone torches, but this quirk was removed in 1.3.2.

There are many models of auto resetting BUDs. This is done by having the firing of the BUD switch somehow cause the BUD switch to restore the pre-fired state often when fired it cuts the power to the piston, allowing it to retract. This is done either by extra circuitry or, as in the example below, by the properties of blocks themselves.

Design A, taken from this video, works by powering a block diagonal to the piston, by way of a block of sand. When a block next to the piston is updated, the piston "notices" it is powered, and extends. However, that pushes a block of glass into the sand's place, so the piston is no longer powered. Accordingly, the piston retracts, resetting the switch. This switch as given produces an off-pulse; of course, a NOT gate can easily be added to the output.

Note that the video also shows "clocking" behavior when two such switches are put next to each other in opposite directions. That behavior has changed as of 1.5.1; now the triggered switch disables the other, by extending it so briefly as to leave the glass in the upward position.

Liquids and Block updates
It is possible to use update mechanics to make water or lava shift its flow: Water and lava normally flow toward the closest drop in elevation within 5 blocks (lava can flow toward blocks it cannot reach). However, once they have "settled" into a constant flow, they don't actually check for such drops unless a liquid block is updated.

In order to make use of this, set up your flow in an the initial pattern and run a Redstone wire to the block adjacent to the water/lava source. Then change blocks nearby (but not next to the liquid blocks) so that the "closest drop" is different. Whenever the Redstone wire toggles state, the water/lava source will update and change course. This can in turn be used to wash away redstone wire or other components, producing a signal that can be read somewhere else (a one-shot BUD).

However, newer versions of Minecraft allow for much better means of controlling liquids (and more convenient BUD switches), rendering this trick mostly obsolete. As of Beta 1.7, pistons provide multiple-use liquid control -- the extended piston blocks liquids, and can easily be extended or retracted as desired. Version 1.3.1 also gave dispensers the ability to place and collect lava and water source blocks, providing another means to control where fluids flow.

Item Button
There are several ways to produce a redstone signal based on the presence of an item. To be sure that the item will be dropped on the side of a pressure plate, feed it to the plate using a water slope instead of placing the drop shaft directly above a plate. Also make sure the fence is not connected to other blocks -- fence bars can interfere with falling items. So be sure that you place a non-solid block (like glass) on the side of the fence that is directly below the water slope. And to be completely confident that the item won't land on the fence after dropping from the water slope (though, even with minimal length of slope at 2 blocks I've never encountered this) keep the water level near the pressure plate as low as possible. See the diagram for the final arrangement.
 * The first way was to simply drop the item on a wooden pressure plate, but that would leave the signal on until the item despawned or was manually removed. More recent versions of minecraft have provided  ways to get a more manageable signal.
 * As of version 1.0, a pressure plate can be placed on a solitary fencepost (seen as "tables" in villages). The fence has a very small collision box, so if you drop an item on the side of a pressure plate, it will pass through, activating it only for a split second.
 * Starting with official release version 1.3, tripwires will also react to items, and are perhaps less finicky than pressure plates.
 * Starting with official release version 1.5, substituting a hopper for the lava disposer will retain the item instead of destroying it. Even more useful, the hopper itself can be tested with a comparator to see if it contains an item, providing a durable test.  A redstone current to the hopper will prevent it from passing the item on to a container until the signal has been received, after which you can turn off the current long enough for the hopper to empty itself (resetting the detector).
 * In a different direction, version 1.5 also introduced Weighted Pressure Plates, which respond only to items, and can also report how many items are present. However, as with the original wooden pressure plate, the items can't easily be cleared until they despawn.

红石电路/其它