The bug
The min
field in the minecraft:health
component can be used to ensure a mob can never go below a certain amount of health. Indeed, mobs like this at minimum health are invincible to damage up to and excluding that amount. It can still be hurt, but its health won't go down. And of course it can be healed as normal.
However, if the mob receives damage equal to or greater than its minimum health, it breaks. The mob is no longer able to be hurt or healed. It is permanently broken.
How to reproduce
1. Download and open the attached world. It contains a pig with minimum health set to 5.
2. Punch the pig as many times as you want. It will never die, since its health can't go below 5.
3. Now hit the pig with the diamond sword.
Expected behavior
Same as punching: the pig gets hurt, but its health can't go below 5.
Observed behavior
The pig makes the death sound, but drops no loot. It starts ignoring all subsequent attacks of any kind. Healing it makes no difference. It's permanently broken. A cursory glance at the mob's NBT (when exported in a structure block) reveals that its Dead
tag is wrongly set to 1.
This bug is current in 1.20.60 please address. Also applies to entities as well as player.
We're trying to set entities and player so they can't die, but this breaks them. Using a higher min for entities solved some issues but issues with player are still there.