2

I want to execute a command to entities affected by instant health potions (Potion, Splash, Lingering).

The command execute as @e[nbt={ActiveEffects:[{Id:6b}]}] run <command> only works if the entity is affected through effect give.

Any idea how?

4

"Instant health" is instant. You don't even have it for a single tick, it just applies its health effect and then disappears again. That the effect exists at all is pretty much an implementation detail.

So no, you cannot detect entities that are affected with it. The best you can do would be to detect a splash potion with that effect that is close to the entity and then disappears (like it's done for snowballs) and also detect using the potion directly using the scoreboard type for that (does not work for witches) and also being inside an AreaEffectCloud with that effect (which requires checking its size).

Alternatively, you could use a different potion, like "Unluck", replace all Instant health potions in inventories with Unluck potions (like here) and maybe also the effects of splash potion entities, then execute your commands on entities with that effect, of which the first two commands are giving an Instant health effect and removing the Unluck effect. You can then use a resource pack to replace the name, icon, etc. of Unluck potions to make them appear as Instant health potions. I don't know which of the two methods is easier.

| improve this answer | |
  • Really? It doesn't even exist for the tick that the health is added back to the player? – MBraedley May 27 at 13:44
  • Correct. I just tested it again in the latest snapshot, to be sure. – Fabian Röling May 27 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.