
Hey everybody, it’s Under My Cap, and welcome back to another video! Today, I’m going to show you how to test for items in Minecraft. This is a really cool command that I enjoy using. It’s great because you can test for specific items, rename items, and even test for multiple items at the same time. If you stick around, I will show you how to test for a normal item, test for items with name tags, and also test for two items simultaneously. Please note that you don’t actually need to have command blocks like I have here; you just need to use one. When it tests positive, the comparator will send a redstone signal to a command block, where you can have effects, particles, and many more fun things. If you enjoy this video, please leave a like and subscribe. Don’t forget to comment with suggestions down below, and also follow my socials in the description. So, let’s get started with the first method. This setup will actually test for a diamond. If I get a diamond, you will see that there are no particles, but as soon as I pick up a diamond, you’ll notice that it tests correctly and executes this particle effect. This is really cool because it works for anything; you can apply effects too. Now, here’s how to do it: The command is pretty straightforward. You basically use the execute command to the nearest player with an NBT tag. When you type in @p with brackets, you include NBT equals and then use one of those squiggly brackets with inventory: square brackets, another squiggly bracket, and then a colon. This is where it gets interesting. In most of my videos, I didn’t realize you could actually type in names. To do that, you just put quotation marks and enter your Minecraft item, so in this case, I’m testing for a diamond. After that, just make sure to close the correct brackets. It’s crucial to have the correct types of brackets closed in the right order. Now, as soon as I drop the diamond, you’ll see the comparator turns off, and when I pick it up again, it turns back on. This part can be customized to whatever you want; I used a particle effect because it’s the simplest command I know. You could also make it play a sound, like announcing that you have just picked up a diamond. Now, the second method is a little different and a bit tricky because it involves using named items. For instance, if I get a gold ingot and hold it in my hand, you’ll notice that nothing pops up because it’s testing for a name. I named it “Example Test” for fun, and as soon as I rename it, the particles activate. Here’s the command for that: you type slash execute if entity @p, which references the nearest player. Then you use the brackets NBT equals and follow with the squiggly bracket, inventory colon, and then the next brackets for ID. This is checking your inventory against a specific ID, and if it finds it, it will proceed to the next command. You specifically type in Minecraft: gold_ingot (or any item name you wish). After that, you use the tag and colon with squiggly brackets, then type in display, which tests for the name on the command block. Remember to include the correct punctuation; if you miss a comma, it will cause problems. After you’ve entered the name in quotation marks, retrace back all of the squiggly brackets and parentheses. You need to make sure everything is paired correctly or else your command will not work. Next, let’s test for two items that aren’t named. This is similar to the first method, but you just add a comma to list another type of material. You start the command as before, executing if entity @p, then the brackets for NBT equals and your inventory colon, followed by two ID entries. You must remember the quotation marks around the Minecraft item names and don’t forget the commas. If you want to add a third item, it’s just as simple; add another comma and relevant brackets. For example, we could add Minecraft: diamond alongside the gold ingot. Now, if I get a gold ingot, an iron ingot, and a diamond, you’ll see that the test is positive. If I drop one of the items, it will turn off. So that’s basically the command in a nutshell. If you enjoyed it, please leave a like and subscribe to the channel if you’re new. Don’t forget to turn on the bell to be notified whenever I post a new video. I also love reading your suggestions down below, so feel free to suggest any videos you’d like me to make next. I’m open to trying new things and learning, so leave something I might not know. If you’re interested in particles or any other command tutorials, please check out my YouTube channel; it’s full of great content. Thanks so much for watching, and I hope to see you in the next video. See ya!
This post has used AI to generate and enhance content