-
-
Notifications
You must be signed in to change notification settings - Fork 130
Expand file tree
/
Copy pathMathUtil.java
More file actions
18 lines (14 loc) · 631 Bytes
/
MathUtil.java
File metadata and controls
18 lines (14 loc) · 631 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package org.bleachhack.util;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import org.bleachhack.util.world.Rot;
public class MathUtil {
public static Rot getDir(Entity entity, Vec3d vec) {
double dx = vec.x - entity.getX(),
dy = vec.y - entity.getY(),
dz = vec.z - entity.getZ(),
dist = MathHelper.sqrt((float) (dx * dx + dz * dz));
return new Rot(MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(dz, dx)) - 90.0), -MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(dy, dist))));
}
}