Minecraft Blogs / Tutorial

Testfor and Targeting Commands

  • 6,486 views, 3 today
  • 9
  • 5
  • 4
GrimCreeper1212's Avatar GrimCreeper1212
Level 26 : Expert Mage
11
The Testfor Commands:

For an Item Dropped:

/testfor @e[type=Item,id=] {Item:{id:"minecraft:",tag:{display:{Name:""}}}}

For Armor Worn:

Boots: /testfor @p {Inventory:[{Slot:100b,tag:{display:{Name:""}}}]}

Legs: /testfor @p {Inventory:[{Slot:101b,tag:{display:{Name:""}}}]}

Chest: /testfor @p {Inventory:[{Slot:102b,tag:{display:{Name:""}}}]}

Helm: /testfor @p {Inventory:[{Slot:103b,tag:{display:{Name:""}}}]}

For Item Held:

/testfor @p {SelectedItem:{id:minecraft:,tag:{display:{Name:""}}}}

For Item in Offhand:

/testfor @p {Inventory:[{Count:1b,Slot:-106b,Damage:0s,id:"minecraft:"}]}

For Item in 8th Slot:

/testfor @p {Inventory:[{Count:1b,Slot:8b,Damage:0s,id:"minecraft:"}]}

Targeting Commands

Radius: /testfor @e[r=1*]
*Radius of blocks

Amount of Entities: /testfor @e[c=3*]
*Amount of Entities

Player Mode: /testfor @a[m=1*]
*What mode a player is in

Tag: /testfor @e[tag=ExampleTag]

Score: /testfor @e[score_ExampleScore_min=1]
/testfor @e[score_ExampleScore=1]

Type: /testfor @e[type=enderman*]
*Type of mob

NOTE TO USERS THAT USE THESE COMMANDS:
The * in the commands are not a part of the command, just the variable. So when you use the commands, remove the * from the command if there is one.
I hope you find this helpful!

-Grim
CreditNotch for making Minecraft
Tags

Create an account or sign in to comment.

1
05/29/2018 11:54 pm
Level 6 : Apprentice Engineer
TobyTapper
TobyTapper's Avatar
Just want i need for my next project!

Thanks!
1
01/16/2018 8:15 pm
Level 3 : Apprentice Engineer
Mcawesomeman
Mcawesomeman's Avatar
Diamond for the picture, also how do you test if someone has taken damage? If you said it in the description I'm sorry for asking
1
03/31/2018 5:03 pm
Level 26 : Expert Mage
GrimCreeper1212
GrimCreeper1212's Avatar
I am sorry for the long time it took for me to reply, I've been busy and forgot to go on PMC. Add a scoreboard that tests if you have damage taken. /scoreboard objectives add (insertnamehere) stat.damageTaken (if you want to test if you deal damage, replace stat.damageTaken to stat.damageDealt)
1
01/06/2017 4:10 pm
Level 46 : Master Mage
CelebornArt
CelebornArt's Avatar
diamond for that aawesome picuture :D, favourite, just because its a pretty good list, one of the best i found.
I dont need it, but I hope you'll find some people, who do. So more diamonds, more views :D
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome