Clear Items From Player Inventory in Bedrock
The /clear command in Minecraft Bedrock Edition removes items from a player's inventory. You can use it to wipe an entire inventory clean or remove a specific number of a single item.
Players and server operators use this command to clean up cluttered inventories in creative mode, reset players before a minigame starts, or take away specific items as part of an adventure map.
/clear [player: target] [itemName: Item] [data: int] [maxCount: int]Clear
| Argument | Type | What it means |
|---|---|---|
data | int | The `item id` to be cleared. If not specified, all will be cleared. Default: `-1`. |
itemName | Item | The item to clear. Clears all items if no specified. Item`ID`or block id. |
maxCount | int | An `integer` that specifies how many items to clear. Default: `-1`. |
player | target | Player selector. May be a player name `string` or a selected target of type player. |
/clearRemoves every single item from your own inventory immediately.
/clear @pClears the entire inventory of the nearest player.
/clear @a dirtRemoves all dirt blocks from every player currently in the world.
/clear Steve diamond -1 5Takes up to 5 diamonds of any data value away from the player named Steve.
/clear @r apple 0 1Removes a single apple with a data value of 0 from one random player.
/clear @s stone 1 64Clears up to 64 stone blocks with a data value of 1 from the player running the command.
/clear Alex emerald -1 0Checks if the player named Alex has any emeralds without actually removing them by setting the maximum count to 0.
In Minecraft Java Edition, the syntax is /clear [<targets>] [<item>] [<maxCount>], which skips the separate data integer argument required between the item name and the maximum count in Bedrock Edition.
Specify the player, the item name, a data value like -1, and set the maxCount argument at the very end to 1.
The number -1 is the default value for both the data and maxCount arguments, telling the game to match all data values or remove all matching items without a limit.
The command requires cheats to be turned on and you must have the Game Directors permission level to run it.