Minecraft – How to clear all item drops in Minecraft

minecraft-commandsminecraft-java-edition

How do you clear all item drops in Minecraft?
I want to have something activated by an Item landing on a golden pressure plate, but It can only be activated once. Is there any command block command that clears all entities?

Best Answer

If you're trying to clear all item drops in the world, you can run:

/kill @e[type=item]

which will kill all dropped items in the world. However, there are slightly better ways of doing this. Namely, only clear items within a radius of x blocks from the command block. This preserves drops elsewhere, but still clears the first item:

/kill @e[type=item,r=x]

Additionally, if you want to ensure that something can only be triggered once, place an input stabilizer on it:

This device will "lock" the redstone state to ON, even after the item is removed. It cannot be re-triggered unless you manually break the redstone.

You can expand on this by only making it hold one pulse if so needed.