Redstonery
RedstoneryCircuits › Container empty alarm
Detection circuit

Container empty alarm

Turn an empty inventory into an explicit condition.

7 × 1 footprint1 layer7 blocksTested in 4 rotationsJava Edition 26.2
Open in the simulatorBuild it in the game

Layout

Layer 0 (on the floor)
barrel at x 0, z 0comparator [facing=west, mode=compare] at x 1, z 0redstone dust at x 2, z 0stone at x 3, z 0redstone torch (on a wall) [facing=east] at x 4, z 0redstone dust at x 5, z 0redstone lamp at x 6, z 0
redstone dustredstone torchrepeater or comparatorlampcontainersolid blockarrows point where a device sends its output; north is up

How it works

The torch inverts the container comparator: the output is on only when the barrel is empty. A single item clears the alarm.

  1. A comparator reads zero when the measured inventory is empty.
  2. Logic interprets that zero reading as the condition used by the output.

Inputs and outputs

  • Inputedit barrel contents (x 0, y 0, z 0)
  • Outputalarm (x 5, y 0, z 0)

Blocks you need

2 × redstone dust, 1 × barrel, 1 × comparator, 1 × stone, 1 × redstone torch (on a wall), 1 × redstone lamp.

Build it in the game: 7 commands

Relative to where you stand, with x running east and z running south. Paste one line at a time into chat, or into a chain of command blocks. The block art is the game's own; the layout is what the page above shows.

setblock ~0 ~0 ~0 minecraft:barrel
setblock ~1 ~0 ~0 minecraft:comparator[facing=west,mode=compare]
setblock ~2 ~0 ~0 minecraft:redstone_wire
setblock ~3 ~0 ~0 minecraft:stone
setblock ~4 ~0 ~0 minecraft:redstone_wall_torch[facing=east]
setblock ~5 ~0 ~0 minecraft:redstone_wire
setblock ~6 ~0 ~0 minecraft:redstone_lamp