Forumskeyboard_arrow_right Communities keyboard_arrow_right Redstone

Create Forum Thread
1

A Command that Detects entity near a player

1 emeralds2 replies120 views
created 06/04/2019 4:27 am by lnard history
last reply 06/18/2019 11:37 am
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
Posted by avatar
lnard
Level 1 : New Miner
0

comment Login or register to post a reply.

2 replies

1
06/04/2019 6:13 am
Level 8 : Apprentice Modder
HoboMaggot
/execute at @a if @e[type=entity,distance=#]
should work
1
06/18/2019 11:37 am
Level 27 : Expert Architect
TheArchitect_95
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.

Planet Minecraft

Browse

Site

© 2010 - 2019
planetminecraft.com

Welcome