Spectral/Potion arrows/Channeling tridents apply effect to Endermen
Resolved
Fixed
25
The bug
When shooting normal arrows at endermen they will not get hit and they will teleport away. When shooting them with a spectral arrow they do the same but they will be marked with the spectral effect even though the arrow doesn't hit them. This also applies to the arrow of invisibility (and probably all other new arrows).
Shulker bullet / blaze(dispenser) fire charge also apply effect / fire to endermen.
Code analysis
Code analysis by @unknown can be found in this comment.
Based on net.minecraft.entity.monster.EntityEnderman.attackEntityFrom(), endermans actually can get hit by arrows, they just instantly teleport away as soon as they receive damage from an indirect damage source (such as an projectile). Therefore, the method net.minecraft.entity.projectile.EntityArrow.arrowHit() is called even though it seems like the arrow didn't hit the enderman.
A simple fix would be to check if the entity hit by the arrow (both tipped & spectral arrow) is an enderman before applying potion effects to the hit entity in the aforementioned method.
I think the trident does the same way. I tried to throw a trident with Channeling enchantment to an Enderman, the trident bounced off to the ground, the Enderman teleported away, and the Lightning bolt hits the teleported Enderman.
I noticed a little side effect when a tipped arrow using the CustomPotionEffects tag hits an enderman. The Duration tag is set to 0 after the enderman teleports (i think).
Endermen got hit by Arrow of Invisibility