Parrots dismount shoulders even if damage was blocked
The bug
Based on this comment parrots are supposed to dismount as soon as the player takes damage. However, currently parrots dismounts even if the damage was blocked or prevented, for example when the player is standing in fire with fire resistance.
How to reproduce
- Summon a parrot and tame it
- Have the parrot sit on your shoulder
- Give yourself fire resistance
/effect give @s fire_resistance 120 0 true - Place fire
- Switch to Survival or Adventure mode and walk into the fire
Code analysis
Based on 1.12 decompiled using MCP 9.40 PRE 1
Currently the method net.minecraft.entity.player.EntityPlayer.attackEntityFrom(DamageSource, float) dismounts the parrot without testing if the parent methods successfully attacked the player. However, an attack blocked with a shield still counts as successful, therefore the method net.minecraft.entity.EntityLivingBase.damageEntity(DamageSource, float) could probably be used for dismounting the parrot.
Created Issue:
Parrots dismount shoulders even if damage was blocked
The bug
Based on this comment parrots are supposed to dismount as soon as the player takes damage. However, currently parrots dismounts even if the damage was blocked or prevented, for example when the player is standing in fire with fire resistance.
How to reproduce
- Summon a parrot and tame it
- Have the parrot sit on your shoulder
- Give yourself fire resistance
/effect @s fire_resistance 120 0 true- Place fire
- Switch to Survival or Adventure mode and walk into the fire
Code analysis
Based on 1.12 decompiled using MCP 9.40 PRE 1
Currently the method net.minecraft.entity.player.EntityPlayer.attackEntityFrom(DamageSource, float) dismounts the parrot without testing if the parent methods successfully attacked the player. However, an attack blocked with a shield still counts as successful, therefore the method net.minecraft.entity.EntityLivingBase.damageEntity(DamageSource, float) could probably be used for dismounting the parrot.
The bug
Based on this comment parrots are supposed to dismount as soon as the player takes damage. However, currently parrots dismounts even if the damage was blocked or prevented, for example when the player is standing in fire with fire resistance.
How to reproduce
- Summon a parrot and tame it
- Have the parrot sit on your shoulder
- Give yourself fire resistance
/effect give @s fire_resistance 120 0 true- Place fire
- Switch to Survival or Adventure mode and walk into the fire
Code analysis
Based on 1.12 decompiled using MCP 9.40 PRE 1
Currently the method net.minecraft.entity.player.EntityPlayer.attackEntityFrom(DamageSource, float) dismounts the parrot without testing if the parent methods successfully attacked the player. However, an attack blocked with a shield still counts as successful, therefore the method net.minecraft.entity.EntityLivingBase.damageEntity(DamageSource, float) could probably be used for dismounting the parrot.
Should probably be reopened since it affects all damage which was blocked or prevented in some way, see also MC-118954.
Confirmed for 1.13.1-pre1
Confirmed for 1.13.1
In 20w12a, this can often lead to their death
In 1.16 Pre 3
Can confirm in 21w03a.
Can confirm in 21w06a.