User:MentalMouse42/Sandbox/Other Circuits

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.

Vertical Transmission
Sometimes it's necessary or desirable to transmit a Redstone state vertically (e.g. to have a central control or status for several circuits from a single observation point.) However, doing so in narrow spaces can be non-trivial -- there are several ways, but each has their own limits and drawbacks.

Redstone stairs and ladder
For fairly short distances, a 2&times;2 spiral of blocks with Redstone can be used to transmit power in either direction, and the spiral is internally navigable -- that is, one can climb or descend the stairs, even if they're enclosed in a tower. This method is instantaneous, but quickly runs into the redstone signal-length limit, so you will need to switch in another method at intervals, to introduce repeaters or even torch pairs.

For upward transmission only, you can also put redstone on a 1&times;2 "staircase" of glowstone, or of upside-down slabs/staircases. All of these are transparent blocks, so the level above does not block diagonal transmission. However, despite the apparent connection, power and signal will not go down these stairs. There is a small purely visual difference, in that with slabs or stairs, the redstone will visibly "connect" to the redstone on the next block up, while dust on glowstone will remain as an unconnected "dot".

transmission]]

Torch and repeater ladders
If greater distance or narrower confines are necessary, there is a 1x1 design A for transmitting a state upward, and a 1x2 design B for transmitting a state downward. Note that every other torch will have the signal inverted, which can complicate output a bit. You can take a non-inverted signal by wire at any block underneath any non-inverted torch. For the block underneath an inverted torch, you can put a torch on the block's side as shown. Both A and B can be combined with staircases to restrengthen the signal -- even inside a 2x2 tower interior, you can use a few ladders to climb past them so the tower is still navigable.

Design C for downwards transmission is slightly larger (3x1) and uses repeaters instead of torches. The advantage to this design is the output can be easily extracted at any height without inversion. On the other hand, it's more expensive and not as easy to navigate as B.

Exotic Downward Transmission
There currently exists a rather exotic method of 1x1 downward vertical transmission, an example of which is shown in this video. This requires stacking a repeating unit of (from top down): a sticky piston, a minecart, a detector rail, and a redstone lamp. You also need to arrange brief low-pulse signalling by adding a Dual Edge Detector at the beginning and a T-Flip-Flop at the end. Furthermore, this design involves rails being in mid-air for 2 tick each, while an off-pulse is being transmitted. That is an invalid state for a rail block, so the rail can "pop" and cut the signal path, in any of several situations: For any of these situations to actually break a rail, they have to occur while the off-pulse is being sent and during the 2 tick in which the rail in question is in mid-air.
 * game/chunk reload
 * directly adjacent blocks that lead to the rail updating itself (redstone powder etc.)
 * any other directly adjacent block updates
 * redstone updates that are 2 blocks away in a straight, non-diagonal line

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/Randomizer
A random number generator is a device that can give numbers to the user without him or her noticing any sort of pattern in them.

There also is a way to use the random delay of Redstone torches to turn back on after they have been burned out. If you combine more of these torches and check which one was the first to recover, you have yourself a random 'number'.

you can also make a compact time based randomizer by adding a clock to lots of rs NOR latches. it will only have the same outcome twice in a row if you perfectly time when you press the buttons.

A short-term randomizer consists of a bat inside a Minecart. Place rails in a loop. Placing Detector Rails at random points along the rail will yield completely random outputs and pulse durations. However, using too many rails can cause some outputs to be triggered more often than others. This circuit is powered by the bat, as bats can move Minecarts slowly. The cons of this circuit are that you must remain nearby, to avoid the despawning of the bat, and that it can't have many outputs. Furthermore, for the odds of each number to be equal, there can only be two outputs.

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.

红石电路/其它