Testfor from player

Testfor from player - From below of crop multiethnic team of professional basketball players gathering and putting hands together while standing on playground before game

This probably sounds like a bad question and I should know this, but how do you test for a block relative from a player? I put down a command block with "testfor ~1 ~ ~ " but that did it from the command block. (I expected it to with that) "testfor @a ~1 ~ ~ " didnt work, and neither did "testfor ~1 ~ ~ @a". What is the right way to write this?



Best Answer

While you cannot use testfor to do this, you CAN use execute detect. This is most likely how it would look: /execute @a ~ ~ ~ detect ~1 ~ ~ grass 0 <command>

the execute command will detect a grass block to the left (in the X cord) of all players in the world. the command is how you would track that player if it detects the block successfully.

an example tracking command would be /execute @a ~ ~ ~ detect ~1 ~ ~ grass 0 scoreboard players set @p Sample_Obj 1

comment if you have any other questions.

Source: http://minecraft.gamepedia.com/Commands#execute




Pictures about "Testfor from player"

Testfor from player - Faceless multiracial sport team stacking hands on court
Testfor from player - Person Holding Black and Green Tennis Racket
Testfor from player - Hand of man with racket and ball on tennis table



How do you use Testfor player?

Test if Nearest Player is at Level 20 experienceType the command in the chat window and press the Enter key to run the command. Once the cheat has been entered, the testfor command will test the experience level of the nearest player.

How do you test a player in Minecraft in a certain area?

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.



Minecraft Redstone Tutorial | How to use testfor commands in MCPE!




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

Images: Andrea Piacquadio, Monstera, Oliver Sjöström, Andrea Piacquadio