Give effects to entities if they are standing on a specific block

by Seikatsu7   Last Updated August 14, 2019 06:14 AM

I've been trying to give mobs effects if they stand on a specific block (for example, if a sheep stands on grass, it gets regeneration) using this command:

/execute @e[type=Sheep] ~ ~ ~ detect ~ ~ ~ grass 0 effect @e[type=Sheep] regeneration 1 0

However, it targets all sheep, even if only one fulfills the criteria.



Answers 1


Use c=1 so that the sheep successfully detecting the grass will only target itself:

/execute @e[type=Sheep] ~ ~ ~ detect ~ ~-1 ~ grass 0 effect @e[type=Sheep,c=1] regeneration 1 0
SirBenet
SirBenet
February 29, 2016 21:01 PM

Related Questions





How to make a map

Updated December 27, 2017 04:14 AM