Tutorials/Comparator update detector
A comparator update detector or CUD switch is a redstone mechanism that exploits a feature in the game in order to detect comparator updates. Comparator updates are updates that only update comparators, for example, interacting with a container. Block update detectors cannot detect comparator updates, but CUDs can detect block updates.
There are many different designs, but they are all based on the same general idea: a comparator is turned on while it should be turned off, or the other way around. To get a comparator in such a state, the player have to make sure that it doesn't realize that it should change. This can be done in several ways.
When the comparator gets an update, it will realize that it should change state. This update can be a block update, or a comparator update. CUDs can detect comparator updates next to the comparator, but also 1 block in between, provided that the block in between is a solid block.
What it detects
The CUD switch detects everything a BUD detects, however the CUD can detect updates from the following blocks 2 blocks away from the comparator horizontally (but only if a solid block exists between the comparator and the target block). This means that the player can have a CUD behind a wall that detects the following updates in front of the wall:
|Chain Command Block||Yes||No||Yes|
|Repeating Command Block||Yes||No||Yes|
Note: If a chest is placed beyond a block next to a CUD switch, only placing and removal is detected. (Tested with Cauldron CUD switch)
Types of CUD Switches
The CUD can be only based on a comparator because only comparators can detect comparator updates. Each time players does one of the actions listed above, a comparator update is being sent 2 blocks away in all the 4 directions.
This method uses the mechanics of a chest. When a chest is locked, the comparator doesn't realize that it shouldn't be turned on anymore. When the player updated the comparator, it realizes, and resets the system.
It's also possible to block the chest with an ocelot. When ocelot sits on a chest, the player can't open it. The player can move them using pistons, minecarts or water. Using minecarts, players can make a silent CUD, besides the meow-sound of the ocelot or cat.
This method uses a filled cauldron that is being pushed by a piston, the comparator doesn't notice that the cauldron has been pushed down and stays powered until it gets an update. Note that the cauldron should contain water.
This method is often used in BUD's. The player can turn any repeater-based BUD into a CUD by replacing the repeater with a comparator. They can redirect redstone with a detector rail, redstone block or a solid block, blocking 2 redstone diagonal to each other. Again, the comparator doesn't realize that the redstone isn't pointing the right direction anymore and it will stay turned on until it receives an update.
Item frame based
Comparators can take a redstone output from an item frame, but only if the item frame's position isn't occupied by a block. Many blocks will break the item frame, if they are in the same position, but some blocks don't. Examples are water, fence gates, skulls and flowers.
Other devices can be built using the same underlying principle as the CUD switch. CUDs can be made stackable and even tile-able. They can be turned into a toggle-CUD. CUDs can be made pistonless using ocelots.
A T-CUD toggles between 2 states. The first update will turn the comparator off, and the second update will turn the comparator on again.
Why and how it works
The earliest known CUD-switch was made by RedsMiners. The bug it was based on has been fixed in 1.5.
DvirWi found out that it can detect the clicking inside of chests.
Short time later, NiceMarkMC made a version that used DvirWi's technique, despite not knowing it was a CUD.
NiceMarkMC then uploaded a video of DvirWi's version and called it Tile Entity Update Detector (TEUD) to keep it shorter, and viewers suggested calling it Data Update Detector (DUD) which became a widely used name.
NiceMarkMC accepted the name DUD, but then renamed it to CUD because the other names were technically incorrect.