Add javadocs to RayTraceUtils

This commit is contained in:
Brady 2018-09-24 18:08:57 -05:00
parent 750da2f1a6
commit 559f575db5
No known key found for this signature in database
GPG Key ID: 73A788379A197567

View File

@ -31,6 +31,18 @@ public final class RayTraceUtils implements Helper {
private RayTraceUtils() {} 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) { public static RayTraceResult simulateRayTrace(float yaw, float pitch) {
RayTraceResult oldTrace = mc.objectMouseOver; RayTraceResult oldTrace = mc.objectMouseOver;
float oldYaw = mc.player.rotationYaw; float oldYaw = mc.player.rotationYaw;
@ -49,6 +61,14 @@ public final class RayTraceUtils implements Helper {
return result; 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) { public static RayTraceResult rayTraceTowards(Rotation rotation) {
double blockReachDistance = mc.playerController.getBlockReachDistance(); double blockReachDistance = mc.playerController.getBlockReachDistance();
Vec3d start = mc.player.getPositionEyes(1.0F); Vec3d start = mc.player.getPositionEyes(1.0F);