How to use /testfor command on a specific location 1.9 [duplicate]
I'm making a custom map and I needed some help from you guys! I'm trying to use the /testfor command in 1.9 and here's what I've tried:
/testfor @a[-47,10,-37,1]
/testfor @p[-47,10,-37,0]
/testfor @p[-47,10,-37]
/testfor @p[x=-47,y=10,z=-37,r=1]
Any suggestions? Thanks in advance! :)
Best Answer
Note: This is a duplicate of: https://gaming.stackexchange.com/a/198417/153355
However, here's the answer:
You're scanning for the nearest player, your should scan for all the players.
Solution
/testfor @a[x=X,y=Y,z=Z,r=R]
Where:
- X the x location
- Y the y location
- Z the z location
- R the radius
For example:
/testfor @a[x=64,y=10,z=64,r=5]
(Search for players on coordinates 64,64 at height 10, with a radius of 5 blocks)
Variables
Specify the location:
- @p nearest player
- @r random player
- @a all players
- @e all entities
Specify the values:
- x, y, z coordinate
- r, rm radius (max, min)
- m game mode
- c count
- l, lm experience level (max, min)
- score_name max score
- score_name_min min score
- team team name
- name entity name
- dx, dy, dz volume dimensions
- rx, rxm vertical rotation (max, min)
- ry, rym horizontal rotation (max, min)
- type entity type
Examples:
To test if Alice is online:
testfor Alice
To count the number of players in survival mode within a 3-block radius of (0,64,0):
testfor @a[0,64,0,3,m=0]
To count the number of players currently flying:
testfor @a {abilities:{flying:1b}}
To count the number of zombies within a 20-block radius of (0,64,0):
testfor @e[0,64,0,20,type=Zombie]
Pictures about "How to use /testfor command on a specific location 1.9 [duplicate]"
![How to use /testfor command on a specific location 1.9 [duplicate] - Thoughtful man using smartphone on street How to use /testfor command on a specific location 1.9 [duplicate] - Thoughtful man using smartphone on street](/assets/images/how_to_use_testfor_command_on_a_specific_location_19_duplicate_1.jpeg)
![How to use /testfor command on a specific location 1.9 [duplicate] - From above of crop anonymous male hacker typing on netbook with data on screen while sitting at desk How to use /testfor command on a specific location 1.9 [duplicate] - From above of crop anonymous male hacker typing on netbook with data on screen while sitting at desk](/assets/images/how_to_use_testfor_command_on_a_specific_location_19_duplicate_2.jpeg)
![How to use /testfor command on a specific location 1.9 [duplicate] - Unrecognizable female photographer taking photos and reflecting in rear window How to use /testfor command on a specific location 1.9 [duplicate] - Unrecognizable female photographer taking photos and reflecting in rear window](/assets/images/how_to_use_testfor_command_on_a_specific_location_19_duplicate_3.jpeg)
How do you test if a player is in a certain area Minecraft?
How to Enter the CommandHow do you use the Testfor command in Minecraft?
The /testfor command became obsolete in Minecraft 1.13, and has been replaced by the /execute command*. It will do the same as typing /testfor @e {SelectedItem:{id:"<item>"}} and then putting a comparator to the command block with the command, and then running the command which you wanna run.How to use /testfor command in a minecraft bedrock mini game
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Anete Lusina, Andrea Piacquadio, Sora Shimazaki, Dominika Roseclay
