Replace Math.X functions with MathHelper.X functions, fixes #111
This commit is contained in:
parent
4b41c6b1d7
commit
336b323697
@ -20,6 +20,7 @@ package baritone.pathing.goals;
|
|||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
import baritone.utils.Utils;
|
import baritone.utils.Utils;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,9 +89,9 @@ public class GoalXZ implements Goal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
|
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
|
||||||
double theta = Utils.degToRad(yaw);
|
float theta = (float) Utils.degToRad(yaw);
|
||||||
double x = origin.x - Math.sin(theta) * distance;
|
double x = origin.x - MathHelper.sin(theta) * distance;
|
||||||
double z = origin.z + Math.cos(theta) * distance;
|
double z = origin.z + MathHelper.cos(theta) * distance;
|
||||||
return new GoalXZ((int) x, (int) z);
|
return new GoalXZ((int) x, (int) z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -188,7 +189,7 @@ public final class PathRenderer implements Helper {
|
|||||||
maxX = goalPos.getX() + 1 - 0.002 - renderPosX;
|
maxX = goalPos.getX() + 1 - 0.002 - renderPosX;
|
||||||
minZ = goalPos.getZ() + 0.002 - renderPosZ;
|
minZ = goalPos.getZ() + 0.002 - renderPosZ;
|
||||||
maxZ = goalPos.getZ() + 1 - 0.002 - renderPosZ;
|
maxZ = goalPos.getZ() + 1 - 0.002 - renderPosZ;
|
||||||
double y = Math.sin(((float) (System.nanoTime() / 1000000L) % 2000L) / 2000F * Math.PI * 2);
|
double y = MathHelper.sin((float) (((float) (System.nanoTime() / 1000000L) % 2000L) / 2000F * Math.PI * 2));
|
||||||
y1 = 1 + y + goalPos.getY() - renderPosY;
|
y1 = 1 + y + goalPos.getY() - renderPosY;
|
||||||
y2 = 1 - y + goalPos.getY() - renderPosY;
|
y2 = 1 - y + goalPos.getY() - renderPosY;
|
||||||
minY = goalPos.getY() - renderPosY;
|
minY = goalPos.getY() - renderPosY;
|
||||||
|
@ -54,9 +54,9 @@ public final class Utils {
|
|||||||
*/
|
*/
|
||||||
public static Rotation calcRotationFromVec3d(Vec3d orig, Vec3d dest) {
|
public static Rotation calcRotationFromVec3d(Vec3d orig, Vec3d dest) {
|
||||||
double[] delta = {orig.x - dest.x, orig.y - dest.y, orig.z - dest.z};
|
double[] delta = {orig.x - dest.x, orig.y - dest.y, orig.z - dest.z};
|
||||||
double yaw = Math.atan2(delta[0], -delta[2]);
|
double yaw = MathHelper.atan2(delta[0], -delta[2]);
|
||||||
double dist = Math.sqrt(delta[0] * delta[0] + delta[2] * delta[2]);
|
double dist = Math.sqrt(delta[0] * delta[0] + delta[2] * delta[2]);
|
||||||
double pitch = Math.atan2(delta[1], dist);
|
double pitch = MathHelper.atan2(delta[1], dist);
|
||||||
return new Rotation(
|
return new Rotation(
|
||||||
(float) radToDeg(yaw),
|
(float) radToDeg(yaw),
|
||||||
(float) radToDeg(pitch)
|
(float) radToDeg(pitch)
|
||||||
|
Loading…
Reference in New Issue
Block a user