The bottom light means there are less than 14 items in the lower chest, the middle light means there are exactly 14 items in the chest, and the top light means there is something in an overflow hopper.

Several months ago, I came across a thread on minecraftforum.net where a player was trying to design a system that would detect if there were 14 and exactly 14 items in an inventory. In other words, he wanted one output or signal if the inventory had less than 14, a different signal if it had exactly 14, and yet another signal if it had more than 14. It is this three signal aspect that made the problem a tricky one to solve.

Now, if you know anything about comparators, detecting if there are 14 items in an inventory is not all that difficult. A comparator increases in strength as the inventory it is connected to increases in fullness. It will output a Redstone signal of power 1 as soon as anything enters the inventory, and this signal will increase in strength up to a full 15 when the inventory is full. Precisely what points it increases depends on the inventory and on the kind of items that are being placed therein. If your inventory is a chest and the items that are being placed in the chest are normal items that stack in groups of 64 (cobblestone, sticks, sand, rotten flesh, etc.), the comparator will output a signal strength of 1 up until the chest has 123 items. At the point that it receives its 124th item, the comparator signal will increase to 2.

So how do you detect only 14 items? Well, you use a filler item that is different from the item you want to count, such as sticks, to bring the standing total to 110 (= 124-14).

Here’s a simple setup to show how you can count whether there are 14 cobblestone in the chest or less than 14.

With 110 sticks and 13 cobblestone, the lamp is off.

When the number of cobblestone is greater than or equal to 14, the lamp comes on.

But this only really detects one of two conditions (i.e., a 0 or a 1), either <14 and >=14, or <=14 and >14. In other words, with just a comparator you can get the signal to change either when the total reaches 14 or when it goes over 14. But the original forum question was about a system that will essentially do both, with a separate signal for each condition <14, == 14, and >14.

This is possible, but the Redstone becomes a lot more complicated. Moreover, you cannot simply measure a single inventory. You must measure the main inventory (a chest, in my examples) and an overflow inventory (a hopper). Moreover, items must be entering the main inventory via hoppers. With these caveats, it is definitely possible to detect all three conditions (<14, ==14, and >14) distinctly. Here’s one way to do it.

## (1) Setup three hoppers, two to send items to a destination chest and one as an overflow chest

The top chest is the deposit chest, the bottom chest is the chest being measured. The top right hopper is an overflow hopper. The top left hopper needs to point into the top right overflow hopper (which is disabled by a Redstone torch above it, so it won’t send items, but it can still receive items from a hopper pointed into it). As long as items are flowing into the top left hopper one at a time (e.g., being pulled from a chest), it will release those items downward rather than to the side (hopper pull requests trump hopper push requests, I think). So until there are 14 cobblestone in the bottom chest, items will flow through into the chest through the left two hoppers. Once there are 14 cobblestone in the chest, items will be redirected into the overflow hopper by a little Redstone.

Set up the hoppers like this. The top chest is where items are deposited. The bottom chest is what is being measured.

## (2) Measure the fullness of a chest

This is easy, accomplished through a simple comparator. Here I have divided the Redstone signal into two tracks, each with a different purpose.

The destination chest at the top of the image has 110 sticks so that whenever it receives 14 of something else (e.g., cobblestone) the comparator strength increases from 1 to 2.

## (3) Shut off the flow of items when the desired number is reached

The piece of dust on the cobblestone block powers a repeater that shuts off the flow of items to the chest once the number of cobblestone reaches 14.

The Redstone on the cobblestone block powers a repeater that deactivates the lower hopper.

## (4) Change the output signal

The second piece of Redstone dust extending backward from the chest to the repeater changes the output signal once the number of cobblestone reaches 14. By default the bottom Redstone lamp is lit while the middle lamp is deactivated. When this line is powered by the increased comparator signal (from 1 to 2), that bottom lamp is deactivated and the middle lamp is activated.

The increased comparator signal deactivates the bottom lamp and activates the middle lamp.

This is a better view of the line that activates the middle lamp.

And again with the middle lamp.

## (5) Redirect subsequent items into an overflow hopper

When the bottom hopper is disabled by a Redstone signal, items will now go into the overflow hopper, because though it is also disabled by a Redstone signal (so it cannot pull or push), the top left hopper (the one beneath the deposit chest) can still push items. This is why it is important for the first hopper to point to the overflow hopper.

## (6) Detect the presence of items in the overflow hopper

A new comparator now detects items in the overflow hopper and sends out a new signal to change the output lamps.

This comparator detects whether items are in the overflow hopper.

## (7) Change the output signal again

The signal from the overflow comparator simultaneously activates the top lamp and deactivates the middle lamp.

By default, the Redstone torch sitting over the top lamp is disabled by another Redstone torch that sits in front of the overflow comparator.

When items are in the overflow hopper, the first torch is disabled, allowing the second torch to activate the top lamp.

It also activates the line of Redstone dust that sits over and deactivates the torch that powers the middle lamp. Notice that the repeater is on a slab. This is important. Otherwise the torch that powers the middle lamp would also power the top lamp.

## Some final notes

This system, as it stands, needs to be manually reset (items must be manually removed from the chest and the overflow hopper). It also has one main quirk – if you place more than 14 items in the deposit chest at one time, it still works, but a single item gets trapped in the bottom left hopper. To make this not happen, there are several things you could do. You could use some Redstone to slow down the movement of items through the left hoppers. Otherwise, you could use another hopper and a vertical dropper chain to pull excess items from the bottom left hopper automatically. Finally, you could slow down the flow of items into the system by using droppers and a comparator clock to inject items more slowly into the top left hopper rather than having that hopper pull items directly from the deposit chest. I’ll leave you to design those fixes.

Bottom line, however: this system actually works. It measures an inventory, sends out one signal if there are less than a specific number of items in the inventory, another signal if there are exactly that specific number of items in the inventory, and a third signal if there are more items (meaning, items in a separate overflow inventory). So if you absolutely have to have exactly 14 items in a chest and no more, this is how you can do it.