Tutorials/Comparator update detector

The Comparator Update Detector, or "CUD switch", is a redstone mechanism that exploits bugs and quirks in the game in order to detect comparator updates. There are many different designs, but they are all based on the same general idea: a redstone circuit is put in a state that should be unstable, but is stable due to some block within not being notified of changes in the circuit that would otherwise affect it. This lazy block then functions as the "sensor". When an adjacent block changes state in some way, it sends a notification to the sensor block and "wakes it up". The circuit then performs some other action and goes back into the sleeping state.

What it detects
The CUD switch detects everything a BUD detects (except eating cakes, activating redstone ores, e.t.c.), however the CUD can detect updates from the following blocks 2 blocks away from the comparator (but only if a solid block exists between the comparator and the target block). This means that you can have a CUD behind a wall that detects the following updates in front of the wall:


 * Placement of Chest, Trapped chest, Dispenser, Dropper, Furnace, Hopper, Brewing stand, Jukebox, Detector rail, Cauldron, Endportalframe, Command block, Sign
 * Removal of Chest, Trapped chest, Dispenser, Dropper, Furnace, Hopper
 * Interactions of Chest, Trapped chest, Dispenser, Dropper, Furnace, Hopper, Brewing stand, Jukebox, Detector rail, Cauldron, Endportalframe, Command block, Sign, noteblock, beacon

In this picture you can see everything the CUD detects in a chart: http://i.imgur.com/bIFRCTJ.png

Types of CUD Switches
The CUD can be only based on a comparator because only comparator updates update comparators. Each time you do one of the actions listed above, a compartor update is being sent to adjacent blocks. This explains why the CUD detects updates one blocks away. However they can be made slightly different.

Chest based
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 you update the comparator, it realizes, and resets the system.

Using Solid Block
The idea is to use a solid block to block the chest. If you can't open the chest, you can't take a comparator output from it. The video showcases some different designs you could use (including a tileable design)

Using Cat
It's also possible to block the chest with a cat. When a cat sits on a chest, you can't open it. You can move the cat using pistons, minecarts or water. Using minecarts, you can make a silent CUD, besides the meow-sound of the cat.

Cauldron based
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.

Redirecting based
This method is often used in BUD's. You can turn any repeater-based BUD into a CUD by replacing the repeater with a comparator. You can redirect redstone with a detector rail, redstone block or a solid block, blocking 2 redstone diagonal to eachother. 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 anyway, if they are in the same position, but water doesn't. This can be used to make a CUD.

Variations
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 cats.

T-CUD
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.

History
The earliest known CUD-switch was made by RedsMiners. The bug it was based on has been fixed in Minecraft 1.5.

DvirWi found out that it detected clicking inside of chests.

Short time later, NiceMarkMC made a version (not knowing it was a CUD) that used DvirWi's technique.

Redstone Sheep then found out that it would detect most Tile Entity changes and hat a chat with NiceMarkMC, giving it the first name TEDUD (Tile entitiy data update detector).

NiceMarkMC then uploaded a video of DvirWi's version and called it TEUD to keep it shorter, and viewers suggested calling it DUD (Data Update Detector) which became a widely used name.

NiceMarkMC accepted the name DUD but then renamed it to CUD because the other names where technically incorrect.