Minecraft Inventory Scanner
Rachel Hill
Published May 05, 2026
I want to do a sort of "inventory scanner" that scans EVERY slots of the inventory of a player. I don't want to write 32 commands in 32 commands blocks, so is there a way to make it short?
For more precision, what I need to scan is the TNT blocks, lava buckets, flint & steel, detected either if renamed or not renamed.
2 Answers
Try using
/testfor @p {Inventory:[{id:"<block or item>"}]}This will check for a specific item in the inventory, ignoring slots, using only 1 command block per item. Make sure you use the modpack prefix before your items. For vanilla Minecraft items, it is minecraft:<block or item>.
You can do /testfor @p {Inventory:[{id:"tnt"},{id:"lava_bucket"},{id:"flint_and_steel"}]}