How to Detect Dropped Items on the Ground in Minecraft (Command Block)
Minecraft Java Edition 1.21+ and 26+ β Detect Items by ID, Name, or custom_data
In this tutorial, you will learn how to detect dropped items on the ground in Minecraft using command blocks.
This method works in Minecraft Java Edition 1.21+ and 26+ and allows you to detect any item entity by ID, custom name, or custom_data tags.
It is perfect for creating automatic systems, minigames, item collectors, protected areas, and adventure maps.
Do you want to detect the item by ID, name, or tag? This applies to all cases.
Use this command to get a diamond with a custom name and tag:
give @p minecraft:diamond[minecraft:custom_data={Test:1b},minecraft:custom_name="Testing"]
Let's start by detecting it by ID only:
execute if entity @e[type=item,nbt={Item:{id:"minecraft:diamond"}}] run
The command above detects any diamond item on the ground and works with any entity. After run you can choose the command to execute. The same logic applies to the next commands.
Now letβs detect it by tag:
execute if entity @e[type=item,nbt={Item:{components:{"minecraft:custom_data":{Test:1b}}}}] run
By name:
execute if entity @e[type=item,nbt={Item:{components:{"minecraft:custom_name":"Testing"}}}] run
And we can also combine all of them like this:
execute if entity @e[type=item,nbt={Item:{components:{"minecraft:custom_data":{Test:1b},"minecraft:custom_name":"Testing"},id:"minecraft:diamond"}}] run
This way, we can detect a diamond item in a very specific way.