How do I /testfor more than 1 item in an inventory without a need to use the /scoreboard command? [duplicate]

How do I /testfor more than 1 item in an inventory without a need to use the /scoreboard command? [duplicate] - Young woman watching movie in headphones in messy room

I would like to test for more than 1 item in one's inventory. However, I'm having some difficulties.

I have tried the /testfor @p[r=2] {Inventory [{id:"minecraft:gold_nugget"}]} command, but it doesn't work. It says "UUID incorrect". I would rather not use scoreboards, because I don't really get along too well with it.

Can someone please put the command to set the amount? (I.E. Of the gold nuggets). If it matters, I would like it in command block form.

Thanks in advance.



Best Answer

You've got a couple syntax errors in the NBT portion of your /testfor command. The command, as you have it, should be /testfor @p[r=2] {Inventory:[{id:minecraft:gold_nugget}]}

However, unless you literally only want to do something to the world whenever there is a player within 2 blocks with a gold nugget in their inventory, you are not going to be able to do anything with this testfor command. testfor does not allow you to pass player information to any other commands. You can see if that player exists, great, but you can't do anything to that player. If you want to do anything to that particular player, you will absolutely need to use a scoreboard. I don't care if you don't want to learn it, that's your only choice (if you just want to do something simple like summon a TNT at a particular location, then you can continue on your merry way with your testfor I guess).




Pictures about "How do I /testfor more than 1 item in an inventory without a need to use the /scoreboard command? [duplicate]"

How do I /testfor more than 1 item in an inventory without a need to use the /scoreboard command? [duplicate] - Unpacked boxes in middle of room
How do I /testfor more than 1 item in an inventory without a need to use the /scoreboard command? [duplicate] - Content female shopaholic lying on floor at home in messy room and making order in online store while using netbook
How do I /testfor more than 1 item in an inventory without a need to use the /scoreboard command? [duplicate] - Crop man packing carton box with scotch tape dispenser



How do you test items in a players inventory?

How to Enter the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.


  • How do you test a specific item in Minecraft?

    Provided you are using a multiplayer server, the common (and useful) Essentials plugin comes with an in-build command to view a player's inventory. You can use the /invsee <name> command to achieve this. You can also modify a users inventory using this command.



    Minecraft Bedrock - Test For Items In Inventory (Mobile/Xbox/PS4/Windows 10/Switch)




    More answers regarding how do I /testfor more than 1 item in an inventory without a need to use the /scoreboard command? [duplicate]

    Answer 2

    If you do these setup commands:

    /scoreboard objectives add items dummy

    /stats entity @a set AffectedItems @p items

    /scoreboard players set @a items 0

    Then run this command: (N.B. The execute is ESSENTIAL)

    /execute @a ~ ~ ~ /clear @p minecraft:gold_ingot 0

    This will then mean that each player has the number of gold ingots in their inventory as their items score.

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

    Images: Andrea Piacquadio, Ketut Subiyanto, Andrea Piacquadio, Ketut Subiyanto