Java and Bedrock 1.20–1.21, regular containers · 3 min read

Comparators: reading a chest’s fullness

comparator reads the fullness of the container and returns the strength 0–15. It takes into account the proportion of filled slots: one sword and one stone take up different shares of the possible stack.

LonelyCraft editors · Updated

The player assembles a redstone mechanism in a wooden workshop
Illustration: a player assembles a redstone mechanism in a wooden workshop. This is an artistic scene, not a snapshot of a specific server.

Place it right side up

Two small rear racks face the container, one front one faces the exit. To read a chest, place the device close behind its wall with the exit outward and pull the dust away from it. Reference: Minecraft: comparator.

Recipe: bottom row of 3 stones, quartz in the center, 3 redstone torch on top center and sides of middle row. You need a regular stone, not cobblestone. The front flame is extinguished in comparison mode and lit in subtraction mode.

Diagram: modes: rear 8, side 3
Author's diagram for guidance; not a game shot.Scroll the diagram horizontally.Open full-size diagram

Test signal thresholds with a hopper

Place the hopper with its spout in a solid block so that it does not unload. Read her comparator; make a long straight line of dust at the exit. For regular items with a stack of 64 the values will be:

  • Change the quantity 1 → 22 → 23 and observe the second level boundary.
  • In Java, the dust strength can be viewed in the hover block data at F3; in both editions the length of the luminous line is visible.
Stones in five slotsStrength
00
1–221
23–452
46–683
32015

Use the numbers 41+4 only with control samples: Testing an item sorter before putting it into service.

Comparison and subtraction

Without the glow of the front torch, the rear signal passes without amplification if it is not less than the side one; the larger side one zeroes the output. When the front torch is turned on, the strongest side torch is subtracted from the rear torch.

Example: rear 8, side 3 - comparison gives 8, subtraction 5. With a sideways 8 comparison still gives 8, subtraction 0. For the “container is not empty” signal, any output is sufficient; for “almost full” you need a calculated threshold, and not one lamp immediately behind the device.

Direction, gain and delays are discussed separately: Repeaters: direction, delay and long signal lines.

Frequently asked questions

Does one item always give the power 1?

No. A non-stackable item fills its slot more than a single stone.

Why doesn't the output become 15?

comparator stores the measured force; for amplification, set repeater.

Which side signal is selected?

The stronger of the two sides.

Views: … · One view per browser per day

Was this useful?Total score: …

One reaction per browser. Click again to remove it, or choose the other reaction.

Sources and documentation

constructioncomparator

Read on

comparator Minecraft: container, comparison and subtraction — Lonely Craft