After a mob is spawned, or summoned, would it be possible to give it more NBT tags? For example, could I have something such as /nbt @e NoAI:1
(I know that's not a real command) to freeze every mob in the game? Or /nbt @e[type=villager] Invisible:1
to give all villagers the 'Invisible' NBT tag?
Minecraft – Would you be able to add an NBT tag to an already ‘spawned’ mob
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft Java Edition – How to Summon an Entity with Multiple Tags
- Minecraft Java Edition Commands – How to Summon Villagers with Certain Professions
- Minecraft Java Edition – How to Stop Items from Despawning
- Minecraft – How to Test for a Nonexistent NBT Tag
- Minecraft Java Edition Commands – How to TP to the Nearest Arctic Fox
- Minecraft – the correct way of using /data merge on entity tags such as Passengers and Tags and Team
Best Answer
Yes, this would be done with the /data command. The format is
What you'd want is
Here's an example for you:
The data command only works on one entity at a time, so all selectors must have a "limit=1" in it- but no fear, there's a way around it. We just make the entities execute the command to themselves.
Example:
This would make ALL villagers invulnerable.