Redstone Comparator


Obtaining

To remove a redstone comparator, mine it. A redstone comparator can be broken instantly with anything, and drops itself as an item.

A redstone comparator will also be removed and drop itself as an item:

If lava Lava Transparency Yes Luminance Yes, 15 Blast resistance 500 Tool Renewable No Stackable N/A Flammable No Drops None Data values Flowing Lava dec: 10 hex: A bin: 1010 Still Lava dec: 11 hex: B bin: 1011 Name Flowing Lava flowing_lava Still minecraft flows into a redstone comparator`s space, the redstone comparator will be destroyed without dropping itself as an item.

Info

A redstone comparator is a block See the various blocks found in Minecraft. For the blocking with shields that reduces damage when performed, see Blocking. All blocks Blocks are the basic units of structure in Minecraft. Contents 1 minecraft used in redstone circuits See redstone circuits. For other redstone-related articles, see Redstone (disambiguation). Contents 1 Redstone basics 1.1 Redstone components 1.2 Power 1.3 Power level 1.4 Redstone update 1.5 Redstone tick 1.6 Signals and pulses minecraft to maintain, compare, or subtract signal strength, or to measure certain block states (primarily the fullness of containers).

Videos

Crafting

Name See values from the latest PC version of Minecraft. For values from Classic, see Data values/Classic. For values from Indev, see Data values/Indev. For values from the Pocket Edition, see Pocket Edition minecraft Ingredients Crafting Crafting is the method by which many blocks, tools, and materials are made in Minecraft. In order to craft something, players must move items from their inventory to a crafting grid. A 2×2 crafting grid minecraft recipe Description
Redstone Comparator Redstone Torch+
Nether Quartz+
Stone











Can use stone only, no variants.
Computer and Console Edition Console Edition Author(s) Mojang AB 4J Studios Platform(s) Written in C++ Latest version Xbox 360 - TU53 Xbox One - CU43 PS3 - 1.51 PS4 - 1.50 PSVita - 1.51 Wii U - Patch 23 minecraft only.
Redstone Comparator Redstone Torch+
Nether Quartz+
Any Stone





























Can use stone and its variants interchangeably.
Pocket Edition only.

Usage

A redstone comparator can be placed on the top of any opaque block with a solid full-height top surface (including upside-down slabs and upside-down stairs), as well as on hoppers. To place a redstone comparator, use the Place Block control.

The redstone comparator has a front and a back ⃢₀ₔ the arrow on the top of the comparator points to the front. When placed, the comparator will face away from the player. The comparator has two miniature redstone torches at the back and one at the front. The back torches turn on when the comparator`s output is greater than zero (the arrow on top also turns red). The front torch has two states which can be toggled with the Use Item control:

  • Down and unpowered (indicating the comparator is in "comparison mode")
  • Up and powered (indicating the comparator is in "subtraction mode")

The redstone comparator can take a signal strength input from its rear as well as from both sides. Side inputs are only accepted from redstone blocks, redstone dust, redstone repeaters, and other comparators. The redstone comparator`s front is its output.

It takes 1 redstone tick (2 game ticks, or 0.1 seconds barring lag) for signals to move through a redstone comparator, either from the rear or from the sides. This applies to changing signal strengths as well as simply to turning on and off. Redstone comparators usually will not respond to 1-tick fluctuations of power or signal strength ⃢₀ₔ for instance, a 1-clock input will be treated as always off from the side, and always on from the rear.

The redstone comparator has four functions: maintain signal strength, compare signal strength, subtract signal strength, and measure certain block states (primarily the fullness of containers).

Maintain signal strength

A redstone comparator with no powered side inputs will simply output the same signal strength as its rear input.

Compare signal strength

Comparators in comparison mode.

A redstone comparator in comparison mode (front torch down and unpowered) will compare its rear input to its two side inputs. If either side input is greater than the rear input, the comparator output turns off. If neither side input is greater than the rear input, the comparator simply outputs the same signal strength as its rear input.

Subtract signal strength

A redstone comparator in subtraction mode (front torch up and powered) will subtract the signal strength of the highest side input from the signal strength of the rear input (minimum 0 signal strength).

For instance, if the rear input signal strength is 7, the left side is 2, and the right side is 4, then the output will be a signal strength of 3, because 7 - MAX(2,4) = 3.

Measure block state







A redstone comparator can measure the fullness of a chest, as well as other block states, even through a block.

A redstone comparator will treat certain blocks behind it as power sources and output a signal strength proportional to the block`s state. The comparator may be separated from the measured block by a solid block. But in the Computer version, if the solid block is powered to signal strength 15 the comparator will output 15 no matter the fullness of the container due to MC-64394.

Containers

Minimum Items for Container Signal Strength
Power
Level
Containers and Slots

















3 5 9 27 54
0 0i 0i 0i 0i 0i
1 1i 1i 1i 1i 1i "13"
2 14i 23i 42i 1s
60i
3s
55i
"cat"
3 28i 46i 1s
19i
3s
55i
7s
46i
"blocks"
4 42i 1s
5i
1s
60i
5s
51i
11s
37i
"chirp"
5 55i 1s
28i
2s
37i
7s
46i
15s
28i
"far"
6 1s
5i
1s
51i
3s
14i
9s
42i
19s
19i
"mall"
7 1s
19i
2s
10i
3s
55i
11s
37i
23s
10i
"melohi"
8 1s
32i
2s
32i
4s
32i
13s
32i
27s "stal"
9 1s
46i
2s
55i
5s
10i
15s
28i
30s
55i
"strad"
10 1s
60i
3s
14i
5s
51i
17s
23i
34s
46i
"ward"
11 2s
10i
3s
37i
6s
28i
19s
19i
38s
37i
"11"
12 2s
23i
3s
60i
7s
5i
21s
14i
42s
28i
"wait"
13 2s
37i
4s
19i
7s
46i
23s
10i
46s
19i
14 2s
51i
4s
42i
8s
23i
25s
5i
50s
10i
15 3s 5s 9s 27s 54s

A redstone comparator used to measure the state of a container outputs a signal strength in proportion to how full the container is (0 for empty, 15 for full, etc.).

Containers which can be measured by a comparator include:

When a comparator measures a large chest or large trapped chest, it measures the entire large chest (54 slots), not just the half directly behind the comparator. A chest or trapped chest which cannot be opened (either because it has an opaque block or ocelot above it) will always produce an output of 0 no matter how many items are in the container.

The Minimum Items for Container Signal Strength table (right) shows the minimum number of 64-stackable items required to produce specific signal strengths from various containers. A number followed by an "s" indicates the number of full item stacks required (not displayed if a full stack is not required), and a number followed by an "i" indicates the number of additional items required (not displayed if no items are required beyond some number of item stacks). For items which stack up to a maximum of 16 (snowballs, signs, ender pearls, etc.), divide the "i" number by 4 and round up. For non-stackable items, count any "i" number as one additional item.

For instance, to produce a signal strength of 10 from a hopper requires a minimum of 3 full stacks plus 14 more items (or 4 16-stackable items).

Calculating signal strength from items
When a container is empty, the output is off.
When it is not empty, the output signal strength is calculated as follows:
signal strength = truncate(1 + ((sum of all slots` fullnesses) / (number of slots in container)) * 14)
fullness of a slot = (number of items in slot) / (max stack size for this type of item)
Example: 300 blocks in a dispenser (which has 9 slots), where each block stacks to a maximum of 64, produces output with a signal strength of 8:

1 + ((300 items / 64 items per slot) / 9 slots) * 14 = 8.292, truncated is 8

Note that a non-stackable item is counted as a full slot (1 item in a slot, with a max stack size of 1: 1 / 1 = 1.0), and items which stack up to 16 (such as ender pearls and snowballs and eggs) are similarly considered a full slot at 16.
Calculating items from signal strength
It can be useful in redstone circuits to use containers with comparators to create signals of a specific strength. The number of items required in a container to produce a signal of desired strength is calculated as follows:
items required = max(desired signal strength, roundup((total slots in container * 64 / 14) * (desired signal strength - 1) ) )
Example: To use a furnace (which has 3 slots) to create a strength 9 signal, you need 110 items:

max(9, (3*64/14)*(9-1)) = 109.714, rounded up is 110

Miscellaneous

Comparators used to measure containers.

Some non-container blocks can also be measured by a redstone comparator:


Cake
A cake outputs a signal strength relative to the amount of cake remaining. Each slice is worth 2 signal strength, with 7 total slices, for an output of 14 for a full cake.
Cauldron signal strength

Cauldron
A cauldron outputs different signal strengths depending on how much water is inside. From completely empty to completely full, the output values are 0, 1, 2, and 3.

Command Block
A command block stores the "success count" of the last command executed, which represents the number of times the most recently used command of this command block succeeded. A "success" is defined by the command`s success conditions: if a red error message is returned in the chat, the command was not successful.
Most commands can only succeed once per execution, but certain commands (such as those which accept players as arguments) can succeed multiple times, and the comparator will output the number of times it succeeded (maximum 15).
A command block continues to store the success count of the last command executed until it executes its command again, thus the comparator will continue to output the same signal strength even after the command block is no longer being activated (it doesn`t turn off when the signal to the command block turns off).

End Portal Frame
An end portal frame outputs a full signal of 15 if it contains an eye of ender and zero otherwise.
A comparator can measure the presence and rotation of an item frame`s contents.

Item Frame
A comparator can measure the state of an item frame`s contents. In order for a comparator to measure an item frame`s contents, it must be placed behind the block the item frame is attached to, facing away from the item frame. An item frame comparator will output 0 if the item frame is empty, or 1 to 8 for any item depending on its rotation (1 at initial placement, plus 1 for each right-click rotation to a maximum of 8, then wrapping back to 1).

Jukebox
A jukebox outputs a signal strength which indicates which record is currently playing. For which records produce which signal strengths, see the Minimum Items for Container Signal Strength table above.

Data values

A redstone comparator is defined by its ID, block data, and block entity. A redstone comparator also has a block state which is expected to replace the functionality of block data in a future version.

ID

Redstone Comparator ID Name Numerical ID
Block (inactive) unpowered_comparator 149
Block (active) powered_comparator 150
Item comparator 404

Block data

See also: Data values

A redstone comparator`s block data specifies its orientation, mode, and powered status.

Bits Values
0x1
0x2
A two-bit field storing a value from 0 to 3 specifying the redstone comparator`s orientation:
  • 0: Facing north.
  • 1: Facing east.
  • 2: Facing south.
  • 3: Facing west.
0x4 Set if in subtraction mode (front torch up and powered).
0x8 Set if powered (at any power level).

Block entity

See also: Block entity format

A redstone comparator has a block entity associated with it that holds additional data about the block. The redstone comparator`s block entity ID is comparator.


  • Block entity data
    • Tags common to all block entities see Template:Nbt inherit/blockentity/template

    • ⃂OutputSignal: Represents the strength of the analog signal output of this redstone comparator.

Block state

See also: Block states
Name See values from the latest PC version of Minecraft. For values from Classic, see Data values/Classic. For values from Indev, see Data values/Indev. For values from the Pocket Edition, see Pocket Edition minecraft Value Description

facing
north
south
east
west
The direction from the output side to the input side of the comparator,
or the opposite from the direction the player faces while placing the comparator.

mode
compare
subtract
Specifies the current mode of the redstone comparator.

powered
true
false
True if the redstone comparator is being powered.

Video

History

Official release
24 Nov. 2012 Jeb stated that there may be a "capacitor" in Minecraft.
27 Dec. 2012 Dinnerbone released pictures of the first version of the "comparator", stating it was a replacement for the "capacitor" idea which has variable, alternate inputs.
2 Jan. 2013 Dinnerbone released one more picture of the comparator. The picture itself showing a digital-to-analogue converter, using the comparator as the main block.
1.5 13w01a Added redstone comparator, with 0 delay.
13w01b Added delay of 1 game tick (1/2 redstone tick) to comparator to fix bugs.
Added ability to measure containers to redstone comparator.
13w02a Updated texture to show quartz in the middle.
Changed algorithm for measuring containers so that comparators output a signal with as few as 1 item in the container.
13w02b Comparators now treat large chests as a single container.
13w03a Comparators now output success count of command blocks.
Comparators now measure container minecarts on detector rails.
13w04a Comparators now measure jukeboxes.
13w05a Comparators no longer cause constant block updates, the delay is made consistent, and side input no longer causes a pulse output.
Block 150 (powered_comparator) is no longer used; powered state is now represented by the 8s bit on block 149 (unpowered_comparator).
13w05b Comparator delay changed from 1 game tick (1/2 redstone tick) to 2 game ticks (1 redstone tick).
13w09c The redstone signal strength from a comparator next to a brewing stand with 3 water bottles in it is the same as one with 3 water bottles and 1 ingredient in it.
1.6.1 13w18a Comparators now measure cauldrons and end portal frames.
1.7.2 13w37a Blocks 149 (unpowered_comparator) and 150 (powered_comparator) were removed from the /give command.
1.8 14w04a Comparators now measure item frames.
14w28a Comparators now measure cakes.
1.9 15w42a With the addition of the blaze powder fuel slot, brewing stands now have 5 slots instead of 4. Their original comparative power values are listed below:
15w47a Comparators` side inputs now take power from redstone blocks.
Pocket Edition Alpha
0.14.0 build 1 Added redstone comparators.
Console Edition Console Edition Author(s) Mojang AB 4J Studios Platform(s) Written in C++ Latest version Xbox 360 - TU53 Xbox One - CU43 PS3 - 1.51 PS4 - 1.50 PSVita - 1.51 Wii U - Patch 23 minecraft
TU19 CU7 1.12 Patch 1 Added redstone comparators.
TU31 CU19 1.22 Patch 3 Can now measure item frames.

Issues

Issues relating to ⃢₀ₜRedstone Comparator⃢₀₝ are maintained on the issue tracker. Report issues there.

Crafting

Redstone Comparator
None
Redstone Torch
None
Redstone Torch
Nether Quartz
Redstone Torch
Stone
Stone
Stone