From 559f575db5228be7f796b001b33cd984014f31c1 Mon Sep 17 00:00:00 2001 From: Brady Date: Mon, 24 Sep 2018 18:08:57 -0500 Subject: [PATCH] Add javadocs to RayTraceUtils --- .../java/baritone/utils/RayTraceUtils.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/baritone/utils/RayTraceUtils.java b/src/main/java/baritone/utils/RayTraceUtils.java index 1c8115a5..b313f1fe 100644 --- a/src/main/java/baritone/utils/RayTraceUtils.java +++ b/src/main/java/baritone/utils/RayTraceUtils.java @@ -31,6 +31,18 @@ public final class RayTraceUtils implements Helper { private RayTraceUtils() {} + /** + * Simulates a "vanilla" raytrace. A RayTraceResult returned by this method + * will be that of the next render pass given that the local player's yaw and + * pitch match the specified yaw and pitch values. This is particularly useful + * when you would like to simulate a "legit" raytrace with certainty that the only + * thing to achieve the desired outcome (whether it is hitting and entity or placing + * a block) can be done just by modifying user input. + * + * @param yaw The yaw to raytrace with + * @param pitch The pitch to raytrace with + * @return The calculated raytrace result + */ public static RayTraceResult simulateRayTrace(float yaw, float pitch) { RayTraceResult oldTrace = mc.objectMouseOver; float oldYaw = mc.player.rotationYaw; @@ -49,6 +61,14 @@ public final class RayTraceUtils implements Helper { return result; } + /** + * Performs a block raytrace with the specified rotations. This should only be used when + * any entity collisions can be ignored, because this method will not recognize if an + * entity is in the way or not. The local player's block reach distance will be used. + * + * @param rotation The rotation to raytrace towards + * @return The calculated raytrace result + */ public static RayTraceResult rayTraceTowards(Rotation rotation) { double blockReachDistance = mc.playerController.getBlockReachDistance(); Vec3d start = mc.player.getPositionEyes(1.0F);