Editing
MinecraftCommands
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== testfor === {{/infobox |testfor |op |1.5|13w03a }} Counts entities (players, mobs, items, etc.) matching specified conditions. ;Syntax : <code>testfor <''player''> [''dataTag'']</code> ;Arguments : ''player'' :: Specifies the targets to count. Must be a player name or a [[#Target selectors|target selector]] (<code>@e</code> is permitted to target entities other than players). : ''dataTag'' (optional) :: Specifies the data tags the entities must have to match successfully. Must be a compound [[NBT tag]] (for example, <code>{XpLevel:3}</code>). ;Result : Fails if the arguments are not specified correctly, or if ''player'' fails to resolve to one or more entities (named players must be online). : On success, produces a success count equal to the number of targets matching ''player'', which can be measured by a [[redstone comparator]] facing away from the command block. ;Examples : To test if Alice is online: <code>testfor Alice</code> : To count the number of players in survival mode within a 3-block radius of (0,64,0): <code>testfor @a[0,64,0,3,m=0]</code> : To count the number of zombies within a 20-block radius of (0,64,0): <code>testfor @e[0,64,0,20,type=Zombie]</code> : To count the number of players currently flying: <code>testfor @a {abilities:{flying:1b}}</code> : To test if a arrow is in a block <code>testfor @e[type=Arrow] {inGround:1b}</code> <!-- please retain double newline above for section differentiation -->
Summary:
Please note that all contributions to Hegemon Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Hegemon Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information