Skip to content

Commit ddc2820

Browse files
authored
Merge pull request #4713 from ZacSharp/pr/1.19.4/misc/useMinecraftEyeHeight
Use minecraft method to determine sneaking eye height
2 parents f019b81 + bbaa602 commit ddc2820

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/api/java/baritone/api/utils/IPlayerContext.java

+8
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ default Rotation playerRotations() {
9999
return new Rotation(player().getYRot(), player().getXRot());
100100
}
101101

102+
/**
103+
* Returns the player's eye height, taking into account whether or not the player is sneaking.
104+
*
105+
* @param ifSneaking Whether or not the player is sneaking
106+
* @return The player's eye height
107+
* @deprecated Use entity.getEyeHeight(Pose.CROUCHING) instead
108+
*/
109+
@Deprecated
102110
static double eyeHeight(boolean ifSneaking) {
103111
return ifSneaking ? 1.27 : 1.62;
104112
}

src/api/java/baritone/api/utils/RayTraceUtils.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package baritone.api.utils;
1919

2020
import net.minecraft.world.entity.Entity;
21+
import net.minecraft.world.entity.Pose;
2122
import net.minecraft.world.level.ClipContext;
2223
import net.minecraft.world.phys.HitResult;
2324
import net.minecraft.world.phys.Vec3;
@@ -62,6 +63,6 @@ public static HitResult rayTraceTowards(Entity entity, Rotation rotation, double
6263
}
6364

6465
public static Vec3 inferSneakingEyePosition(Entity entity) {
65-
return new Vec3(entity.getX(), entity.getY() + IPlayerContext.eyeHeight(true), entity.getZ());
66+
return new Vec3(entity.getX(), entity.getY() + entity.getEyeHeight(Pose.CROUCHING), entity.getZ());
6667
}
6768
}

0 commit comments

Comments
 (0)