The Bug
Under normal circumstances, for regular items, the method getPickRadius() in Entity is called within getEntityHitResult(final Entity except, final Vec3 from, final Vec3 to, final AABB box, final Predicate<Entity> matching, final double maxValue) to inflate the entity’s bounding box. For redirectable projectiles, getPickRadius() will return 1, however inside of getManyEntityHitResult(final Level level, final Entity source, final Vec3 from, final Vec3 to, final AABB targetSearchArea, final Predicate<Entity> matching, final float entityMargin, final Block clipType, final boolean includeFromEntity), the entity’s bounding box is only inflated by the input hitbox margin since this method gets used by projectiles as well.
However, in the case of the Spear or any item with the minecraft:attack_range component, the pick radius will be bypassed, meaning that in the case of an attack being performed to deflect a fireball, it will be harder to hit than players would expect.
Steps to Reproduce
Align the player’s rotation using
/tp @s ~ ~ ~ 0 0Summon a Fireball using the command
/summon minecraft:fireball ~ ~2.5 ~3Attempt to deflect the fireball with a spear
Notice that the spear fails to hit the fireball
Attack again with the fist
Notice it gets deflected
Expected Result
It should be easier to hit a fireball with the spear, much like how easy it is to hit a fireball with a usual weapon
Actual Result
The spear’s hitbox margin is the only one taken into account for attacking a fireball
Attachments
Comments 3
Note that the screenshot is to show how to aim oneself to reproduce the issue, it does not show the issue itself.
Screenshot of the issue