The bug
When a Hoglin, Zoglin, or melee Piglin targets an invisible entity, the mob would not be able to attack it normally unless it is too close to its position. This is not the case for other melee mobs.
The bug also affects Piglin Brutes as of 20w27a.
How to reproduce
Use a Potion of Invisibility or the following command to get an Invisibility effect:
/effect give @s invisibility
Find or spawn a Hoglin, Zoglin, melee Piglin, or Piglin Brute in Survival mode, and then attack it.
Have the mob attack the player normally.
→ ❌ The mob is not able to hurt the player even if it is close enough to them.Have the mob get too close to the player.
→ ✔ The mob is now able to hurt them.
Linked issues
relates to 1
Comments
This is also the case for melee Piglins, but other melee mobs properly attack invisible mobs and players within normal range.
relates to MC-182330. Does it affect any other mob?