Give effects to entities if they are standing on a specific block
//ads -- adsterra.com -- native banner
?>
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.
Best Answer
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
Pictures about "Give effects to entities if they are standing on a specific block"



How do you give a specific entity effect in Minecraft?
First off, use the procedure Execute Command / [Command] at x: [x] y: [y] z: [z]. Here are some examples of commands, you can use. This command gives every entity in a 15 block radius poison level 1 for 10 seconds. This command gives every entity except players in a 20 block radius regeneration level 2 for 15 seconds.How do you give a block an effect?
You can give a player an effect (ie: potion effect) or remove an effect from a player whenever you want using the /effect command in Minecraft. Let's explore how to use this cheat (game command)....Add Effect using Effect ID.Effect IDAmplifierResult82Jump Boost III83Jump Boost IV2 more rowsHow to detect if player are standing on *SPECIFIC BLOCKS* in minecraft bedrock
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: ANTONI SHKRABA, Tatiana Syrikova, Tatiana Syrikova, Kampus Production
