-
Bug
-
Resolution: Cannot Reproduce
-
None
-
1.15.2
-
None
-
Windows 10
-
Unconfirmed
I'll use a villager and zombie as an example here. If I spawn a villager and give it an Invulnerable tag with "/data modify entity @e[limit=1,type=minecraft:villager] Invulnerable set value 1", then it won't get attacked by a zombie I spawned after doing so. However if I spawn my villager, then spawn the zombie and let the zombie target my villager and then set the villager invulnerable it will attack my villager. It doesn't damage the villager or anything, but it will also not change to target any other villagers I spawned in after doing so which are mortal.
Note that I disabled mob spawning in the world I was testing this in and also killed all entities. I did this to make sure that there are no other villagers / zombies suddenly affected by my commands.
What I expected to happen was...:
That my villager would not get attacked any longer after having it set as Invulnerable but that the zombie instead would have attacked other entities.
What actually happened was...:
The zombie kept on attacking my villager, which is not killable for the zombie.
Steps to Reproduce:
1. Create a new world
2. Disable mob spawning by executing "/gamerule doMobSpawning false"
3. Set the time to night to prevent the zombie from burning "/time set night"
4. Kill all existing entities except the player "/kill @e[type=!minecraft:player]"
5. Spawn a villager with a spawn egg
6. Spawn a zombie with a spawn egg
7. As soon as the zombie targets the villager run the command "/data modify entity @e[limit=1,type=minecraft:villager] Invulnerable set value 1"