OmniGame logoOmniGame

/clear Command

Removes items from player inventories (including hotbar, armor slots, offhand, and crafting grid). If maxCount is 0, counts matching items without removing them. If no item is specified, clears the entire inventory.

Syntax
/clear [<targets>] [<item>] [<maxCount>]
Permission: OP level 2Edition: Both

Examples

/clear @p/clear @a minecraft:arrow/clear @s minecraft:dirt 32/clear @p minecraft:dirt 0

Notes

Using maxCount 0 acts as a detection/count query, returning how many matching items exist without removing any. Items in the player's crafting grid slots are also cleared on Java Edition. Since 1.20.5, item matching uses the component predicate system (e.g. minecraft:diamond_sword[...]) rather than NBT. Bedrock Edition does not clear crafting grid slots.

More commands