diff --git a/src/api/java/baritone/api/utils/IPlayerContext.java b/src/api/java/baritone/api/utils/IPlayerContext.java index a97475a5b..de6d7cd58 100644 --- a/src/api/java/baritone/api/utils/IPlayerContext.java +++ b/src/api/java/baritone/api/utils/IPlayerContext.java @@ -99,6 +99,14 @@ default Rotation playerRotations() { return new Rotation(player().getYRot(), player().getXRot()); } + /** + * Returns the player's eye height, taking into account whether or not the player is sneaking. + * + * @param ifSneaking Whether or not the player is sneaking + * @return The player's eye height + * @deprecated Use entity.getEyeHeight(Pose.CROUCHING) instead + */ + @Deprecated static double eyeHeight(boolean ifSneaking) { return ifSneaking ? 1.27 : 1.62; } diff --git a/src/api/java/baritone/api/utils/RayTraceUtils.java b/src/api/java/baritone/api/utils/RayTraceUtils.java index 5541f562b..4a007fd1f 100644 --- a/src/api/java/baritone/api/utils/RayTraceUtils.java +++ b/src/api/java/baritone/api/utils/RayTraceUtils.java @@ -18,6 +18,7 @@ package baritone.api.utils; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.Pose; import net.minecraft.world.level.ClipContext; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; @@ -62,6 +63,6 @@ public static HitResult rayTraceTowards(Entity entity, Rotation rotation, double } public static Vec3 inferSneakingEyePosition(Entity entity) { - return new Vec3(entity.getX(), entity.getY() + IPlayerContext.eyeHeight(true), entity.getZ()); + return new Vec3(entity.getX(), entity.getY() + (entity.getEyeHeight(Pose.CROUCHING)), entity.getZ()); } }