How can I remove a specific amount of items from a player with commands, only when the player has equal or more than the requiered items? [duplicate]

How can I remove a specific amount of items from a player with commands, only when the player has equal or more than the requiered items? [duplicate] - 2 Men in Red and White Jersey Shirt Sitting on Grass Field

I know how to do it, with specific quantity of items, such as 2 ender eyes, for example:

/execute if data entity @p {Inventory:[{id:"minecraft:eye_of_ender",Count:2b}]}

But it doesn't work if the player has more than 2, what can I do?



Best Answer

Setup:

scoreboard objectives add eyesOfEnder dummy

Run these commands every tick:

execute store result score #count eyesOfEnder run clear @p minecraft:eye_of_ender 0

execute if score #count eyesOfEnder matches 2.. run clear @p minecraft:eye_of_ender 2




Pictures about "How can I remove a specific amount of items from a player with commands, only when the player has equal or more than the requiered items? [duplicate]"

How can I remove a specific amount of items from a player with commands, only when the player has equal or more than the requiered items? [duplicate] - From below of crop multiethnic team of professional basketball players gathering and putting hands together while standing on playground before game
How can I remove a specific amount of items from a player with commands, only when the player has equal or more than the requiered items? [duplicate] - Faceless multiracial sport team stacking hands on court
How can I remove a specific amount of items from a player with commands, only when the player has equal or more than the requiered items? [duplicate] - Person Holding Black and Green Tennis Racket



How do you delete certain amounts of items in Minecraft?

You can clear items from a player's inventory using the /clear command in Minecraft....Clear Command in Minecraft Java Edition (PC/Mac)
  • targets is optional. ...
  • item is optional. ...
  • data is optional. ...
  • maxCount is optional. ...
  • dataTag is optional.


  • How do you quickly remove items from your inventory in Minecraft?

    You can use the command /clear [targets] [item] [maxCount] , where: targets is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.



    Why Sudo Is The Best Command in Minecraft




    More answers regarding how can I remove a specific amount of items from a player with commands, only when the player has equal or more than the requiered items? [duplicate]

    Answer 2

    do /clear (playername) and then the item example: Minecraft:stone 5. if you type that you remove 5 stone out of his inventory

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Yogendra Singh, Andrea Piacquadio, Monstera, Oliver Sjöström