1

I am trying to detect active effects on entities with execute as @e[nbt={active_effects:[{id:5b}]}] run say hi, but it doesn't seem to detect any entities despite me having the strength effect (id 5). I have also tried different combinations (e.g., using ActiveEffects instead of active_effects and capitalizing id to Id), but none of them work.

Whenever I search answers online, the results are always /execute as @a[nbt={ActiveEffects:[{Id:5b}]}] run say hi, which also doesn't work. The problem seems to be coming from this part: {active_effects:[{id:5b}]}. I am in version 1.19, and the datapack format is 10 (for 1.19 datapacks).

Could anyone please inform me if there were any recent updates to this part of the commands or if it is a problem with my software? (I am using Visual Studio Code to write this datapack.)

1 Answer 1

1

Apparently, Minecraft 1.20 (what I tested it on) changed the id from numbers to strings (I haven't properly tested it. But I checked the player NBT via /data get entity @s and it should work).

execute as @e[nbt={"active_effects:{["id":"minecraft:strength"]}"}] run say hello, world!

Side note : Forge uses "forge_id" for effects instead of regular "id" (according to my 1.20.1 client). If you intend to publish this pack or send it to friends with modded clients, I would recommend you add an extra command to detect this. Fabric probably doesn't use a different tag (like "fabric_id") but it might be worth checking.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .