Execute command in entity with potion effect

Execute command in entity with potion effect - Man Holding a Megaphone

I want that a mob take damage if it have the water_breathing potion effect.

/effect @e[<mob with water_breathing>] instant_damage 1 1

So, how I execute a command in a mob with a specific potion effect?



Best Answer

This can be done in just one command in Minecraft 1.13

/effect give @e[type=creeper,nbt={ActiveEffects:[{Id:13b]}] instant_damage 1 1



Pictures about "Execute command in entity with potion effect"

Execute command in entity with potion effect - Man With Megaphone Pointing
Execute command in entity with potion effect - Person on Truck's Roof
Execute command in entity with potion effect - Stormy ocean with foamy waves in daylight



How do you summon an entity with a potion effect?

Using the effect command in Minecraft In order to give an effect, the syntax is: "/effect give <targets> <effect> [seconds] [amplifier] [hideParticles]". In order to remove an effect, it is: "/effect clear <targets> [effect]". The target tag refers to the username of the player.



Minecraft Execute Command [1.19] Tutorial




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Pressmaster, Pressmaster, Aidan Roof, Stephane Hurbe