The redstone comparator is by far the most misunderstood redstone component. It has one main input, two side inputs and one output. If we ignore the side inputs, comparators might appear to behave similar to repeaters, since they output a signal 1 redstone tick after the main input is activated, but they have the following vital differences.
-Unlike repeaters, comparators do not have an adjustable delay setting of 2-8 gameticks, they will always produce 2 gameticks of delay.
- Comparators have a tiletick priority of 0 while a repeater always has a negative tiletick priority. One exception is that a comparator will have a priority of -1 if facing into a repeater.
-Unlike repeaters, comparators do not repeat the signal, when powered by a redstone line, the signal strength they emit matches the signal strength input and is not reset to 15.
-Comparators can detect items inside blocks that have an inventory, either behind them, or 2 blocks behind through a solid block. The higher the ratio between the amount of items in the inventory to the possible amount of items in the inventory is, the higher is the signal strength of the output. Additionally,fill levels of various other non-inventory blocks
-Comparators will check the state of their back input when their scheduled tiletick is executed. This means that most single 2 gametick pulses or shorter will not cause the comparator to power. Also, if a compartor is powered with x signal strength when their tiletick is scheduled but the signal strength changes to y when it is executed, the comparator will only output y signal strength.
-Comparators can send 2 gametick pulses up torch towers, since torches have the same tiletick priority as comparators
-If a subtract-mode comparator's output is linked directly to it's side input the output toggles between the main input strength and (15 - the main input strength + the number of redstone dust between the output and the side input)(by my untested calculations), if the main input is activated.
-Comparators in compare-mode only output the main input if it is greater than the side input.
-Comparators redirect redstone dust on all 4 sides.
-Comparators can be subject to BUDding by placing a block behind the comparator, a cauldron behind the block and then pulling the cauldron away with a sticky piston.
-Comparators can also detect the following:
- Detect if a container block (chest, furnace, hopper minecart, etc) has an item in it. Unstackable items give the signal strength of a full stack of stackable items. Items which stack to 16 output the signal strength of four 64-stack items for every 16 stack item. (The signal strength output is taken as a percentage of the total number of slots in the container, so for example in a furnace it would take 14 stackable items to reach a signal strength of 2, whereas in a chest it takes 124 in order to do the same).
- Detect if an end portal frame has an eye of ender placed on it. When it does, the comparator will emit a signal strength of 15
- Detect if a cauldron has water inside it. If the cauldron is fully filled, the comparator will emit a signal strength of 3, if the cauldron is semi-filled, the comparator will emit a signal strength of 2, and if the cauldron is almost empty, the comparator will emit a signal strength of 1.
- Detect if an item frame is holding an item, and emits a signal strength dependent on the rotation of the item within the item frame.
- Detect what page a lectern is on, signal strength will be based on what page the lectern is on in relation to the total amount of pages
- Detect the amount of honey in a bee hive or bee nest. The signal strength will be 1 per level of honey
- Detect when there are music discs inside a Jukebox. Each music disc produces a different signal strength
- Disc '13' produces a signal strength of 1
- Disc 'cat' produces a signal strength of 2
-Disc 'blocks' produces a signal strength of 3
-Disc 'chirp' produces a signal strength of 4
-Disc 'far' produces a signal strength of 5
-Disc 'mall' produces a signal strength of 6
-Disc 'mellohi' produces a signal strength of 7
-Disc 'stal' produces a signal strength of 8
-Disc 'strad' produces a signal strength of 9
-Disc 'ward' produces a signal strength of 10
-Disc '11' produces a signal strength of 11
-Disc 'wait' produces a signal strength of 12
-Disc 'pigstep' produces a signal strength of 13
- Comparators cannot detect items within enderchests.
Comparators are tile tick blocks, and because of their tile tick priority they get processed after repeaters in most cases, causing some results that normally wouldn't happen (Main article: 0-tick pulses.)
The power level of the comparator is stored in a tile entity, and the direction facing is stored in the facing blockstate.
Comparators have another very strange property. In the picture below, there is a comparator with a furnace behind it (the furnace is empty). The comparator turns on when input A (left) is powered, which powers the redstone dust directly in front of the furnace with a signal strength of 15, but the comparator does not turn on when input B (right) is powered.
Like repeaters, comparators can be used to make compact monostable circuits. However, there are some key differences. A comparator lock-o-stable can be used to make a rising edge monostable as well as a falling edge, simply by switching the delays necessary for a normal repeater lock. The lowest pulse length that a comparator lock-o-stable can deliver is a 2 tick pulse, because most 1 tick pulses are not picked up by comparators.