The redstone comparator is a block which can maipulate signal strength outputs from other redstone components, certain blocks, and item frames.
For normal containers, the output of a comparator is governed by a simple equation:
Let I be the size of the inventory,
i be the slot in the inventory,
C be the number of items in the stack,
S be the stack size (1, 16, or 64), and
I_N be the number of slots in the inventory such that the C for that slot is non-zero. Assume that S for an empty slot is 1.
Note that C can be on the domain [1,127] regardless of the stack size. For this reason, it is possible to achieve signal strengths greater than 15 in 1.12 survival using stacked unstackable items, such as shulker boxes. All stacked boxes acquired in older versions will still be stacked if the world is updated to a newer version, however stacking boxes in newer versions is no longer possible without the assistance of mods or duping exploits.
Since no other redstone component can directly transmit a signal strength greater than 15, the raw transmission of these signals is therefore confined to the x-z plane.
Comparators cannot read from chests with solid blocks directly above them. If the block is placed or removed, it will still retain its state until updated.
The list of normal containers and their inventory sizes are as follows:
|Block|Inventory size|
|—|—|
|Furnace, Blast Furnace, Smoker|3|
|Hopper, Brewing Stand*|5|
|Dropper, Dispenser|9|
|Chest, Trapped Chest, Barrel, Shulker Box|27|
|Double Chest, Double Trapped Chest|54|
*The number of slots in a brewing stand was changed from 4 to 5 in the 1.9 release with the addition of the blaze powder mechanic.
Comparators can read signal strengths from other blocks, but use different rules for calculating the signal strength output for each one.
Command Blocks
Comparators will use the value of the SuccessCount
tag directly. This tag is responsible for tracking the number of successful executions for the command it is currently set to hold.
However, this value can be directly modified by using commands (/blockdata <x> <y> <z> {SuccessCount:<value>}
for 1.8 - 1.12 and /data modify block <x> <y> <z> SuccessCount set value <value>
for 1.13 and above).
signal_strength = 14 - 2 * bites_taken
).(page_index / max(1, total_pages - 1)) * 15
.max(0, 4 * number_of_charges - 1)
.Given multiple redstone inputs, a comparator will take the one with the maximum signal strength.
out = max(0, in - max(left, right))
.