Skip to content

Misleading argument name for ProjecileUtil#raycast #4263

@skycatminepokie

Description

@skycatminepokie

ProjecileUtil#raycast takes a double as its final parameter, currently named maxDistance. However, it is only ever compared to a squared distance. It should probably be renamed to maxSquaredDistance or something that indicates the squared-ness.
I'm using Yarn 1.21.8+build.1, but the mapping is still present in latest (25w35a).

Relevant code (from ProjectileUtil#raycast, 1.21.8):

double d = maxDistance;
// ...
double e = min.squaredDistanceTo(vec3d2);
if (e < d || d == 0.0) { // The only reference to d or maxDistance that's not a comparison with 0 or a set
// ...

Descriptor: Lnet/minecraft/entity/projectile/ProjectileUtil;raycast(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Box;Ljava/util/function/Predicate;D)Lnet/minecraft/util/hit/EntityHitResult;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions