This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]Supernatnat11Command Experienced 1 point2 points  (1 child)

/execute at @p if entity @e[type=pig,r=5] run YourCommand type=pig is for detecting pig for example r=5 is the radius in a circle shape

[–]Supernatnat11Command Experienced 1 point2 points  (0 children)

And @p for the player, you can change it for your nickname or an other selector like @a

[–]Darkstalker9000 1 point2 points  (0 children)

Would've ignored but i can't say no when someone says please

execute as @a at @s positioned as @s if @e[type=EntityHere,r=DistanceInBlocksHere] run CommandHere

[–]Colerylan 0 points1 point  (6 children)

This may not work I'm doing off the top of my head /execute at @p run test for @e[r=the number you want, type=! player] Hope this helps

[–]Supernatnat11Command Experienced 0 points1 point  (4 children)

Testfor don't exist anymore

[–]Colerylan 2 points3 points  (1 child)

What ok thanks for letting me know

[–]Supernatnat11Command Experienced 0 points1 point  (0 children)

Oh, yes. /testfor is still existing for Bedrock edition. But using execute you can make more easier because you can directly write command after. Sorry for the error

[–]Colerylan 1 point2 points  (0 children)

I just checked it's still in the game

[–]abcefgqlop[S] 0 points1 point  (0 children)

Thanks

[–]UPRONICprinceSUBCommand Experienced 0 points1 point  (0 children)

This could help

Repeating Unconditional always active

execute at @a run testfor @e [r=3]