Repository navigation
Find entity hits of non-arrow projectiles the way vanilla does - #33
Merged
Merged
Conversation
Throwables, fireworks, the fishing hook and the wind charge used the arrow entity-hit logic. In vanilla they go through ProjectileUtil.getHitResultOnMoveVector and getEntityHitResult: each target box inflated by the margin is clipped by the move, the nearest entry wins, and that entry point is the hit location, with no ray to the center and no projection onto the real box. Arrows and tridents keep their own logic.
WilyFoxM
added a commit
that referenced
this pull request
Nov 16, 2026
This was referenced Nov 16, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and resulting behavior
The core used the arrow entity-hit logic for every projectile. Arrows go through
ProjectileUtil.getManyEntityHitResult: an exact box hit first, then a hit within the margin that is confirmed by a ray towards the box center and moved onto the real box surface.Throwables (snowball, egg, ender pearl, potions, bottle o' enchanting), the crossbow firework, the fishing hook and the wind charge don't. In vanilla they go through
ProjectileUtil.getHitResultOnMoveVectorandgetEntityHitResultwithcomputeMargin: each target box inflated by the margin is clipped by the move, the nearest entry point wins (strictly nearer, so the earlier target on a tie), and that entry point is the hit location. There is no ray to the center and no projection onto the surface. This is the same in 26.1.2, 26.2 and 26.3.What changes for the player, for these projectiles only:
Arrows and tridents are unchanged.
ArrowFlight.nearestEntityHitreturns the single nearest hit or none, with the same shooter-group and left-owner filter as before;ThrowableFlight,FireworkFlight,FishingHookFlightandWindChargeFlightuse it.Validation performed
./gradlew format build(node 26.2, the only node on main): passed, including the newNearestEntityHitTest(entry into the inflated box, a margin hit without the center ray, the nearest of two overlapping targets, a tie, the shooter filter).Limits and compatibility
projectSurfaceargument toentityHitsat these four call sites; whichever lands second needs a small rebase there.