1
A Command that Detects entity near a player
I was testing out some commands and was wondering on how would you make a command that would detect if there is a mob near the player any help would be appreciated! :)
Here's a reference on how I would like it to be
https://www.youtube.com/watch?v=UnoLSSUAUMMM
It's like some spidersense where if a mob is nearby it would alarm the player
Here's a reference on how I would like it to be
https://www.youtube.com/watch?v=UnoLSSUAUMMM
It's like some spidersense where if a mob is nearby it would alarm the player
Create an account or sign in to comment.
2
1
/execute at @a if @e[type=entity,distance=#]
should work
should work
1
This will not work unfortunately.
Assuming Java Edition 1.14, it would be a repeating command block with:
execute as @p at @s if entity @e[type=!player,type=!item,type=!any other entity you don’t want included,distance=..5] run command of your choice
This will detect any entities of the types not listed that are within 5 blocks of the player closest to the command block.
Assuming Java Edition 1.14, it would be a repeating command block with:
execute as @p at @s if entity @e[type=!player,type=!item,type=!any other entity you don’t want included,distance=..5] run command of your choice
This will detect any entities of the types not listed that are within 5 blocks of the player closest to the command block.