Invulnerable parrots remain unharmed when players feed them cookies in survival or adventure mode, regardless of whether the damage type is player_attack and falls under #bypasses_invulnerability
Relates to MC-117593, MC-117703, MC-117643 and possibly MC-117589, MC-117667 and MC-211526. Feeding a parrot a cookie, or any item in the #minecraft:parrot_poisonous_food item tag, inflicts significant damage and poisons the parrot. This damage stems from the minecraft:player_attack damage type. (To verify, adding this damage type to the #minecraft:bypasses_resistance tag shows that even parrots with resistance 5 cannot survive the cookie. Furthermore, the death message "was slain by" confirms the damage type as minecraft:player_attack.) While invulnerable parrots can still take damage from cookies in creative mode, adding the minecraft:player_attack damage type to the #minecraft:bypasses_invulnerability tag does not allow killing parrots with cookies in survival or adventure mode.
Steps to reproduce
- Install the attached datapack
- Execute the following command in creative mode to verify that minecraft:player_attack is included in the tag:
/damage @s 1 minecraft:player_attack
/summon minecraft:parrot ~ ~ ~ {Invulnerable:1b}- Get some cookies
- Be in survival or adventure mode
- Feed the parrot with the cookie
- Notice that it doesn't take damage from it (it still gets the poison effect)
- Be in creative mode
- Feed the parrot with the cookie
Observed result: While #minecraft:bypasses_invulnerability typically permits damage to be inflicted on invulnerable entities, even when the damage source isn't a player in creative mode, feeding a parrot a cookie in survival or creative mode doesn't cause damage to it with the datapack.
Expected result: As the minecraft:player_attack damage type is included in #minecraft:bypasses_invulnerability, feeding invulnerable parrots cookies in survival or adventure mode should result in damage to the parrot, akin to creative mode.
Guess why it occurs
I suspect that because of the resolution of MC-117593 and MC-117703, there's redundant code checking whether the player is in creative mode. While it might have been essential at the time, it seems unnecessary now and contributes to the reported problem.