Minecraft – In need of help using /testfor command

minecraft-bedrock-editionminecraft-commands

I want to test if there is a sheep at location -155 7 14. Im a begginer and have little to no clue to what I'm doing. I dont know how to format anything in minecraft command blocks like when to use !,=,@,[,] etc. If there is no sheep there I want the code to detect it and thus carry on a different command, vise versa. How should I format this?

Best Answer

/testfor @e[type=sheep,x=-155,y=7,z=14,r=1]
  • type=sheep - Look for a sheep.
  • x=-155..y=..z=... - Start search at these coordinates
  • r=1 - Look in a radius of 1 block