Files
OpenOnyx/src/openonyx/utilities/RotationRayTrace.java
T

29 lines
1.0 KiB
Java

package openonyx.utilities;
import net.minecraft.entity.Entity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import openonyx.core.MinecraftAccess;
import openonyx.protocol.group_m.Angles;
public final class RotationRayTrace implements MinecraftAccess {
public static MovingObjectPosition L(Entity entity, double d, Angles angles) {
Entity entity1;
if ((entity1 = mc.getRenderViewEntity()) != null && entity != null) {
Vec3 vec32 = entity1.getPositionEyes(1.0F);
Vec3 vec3 = angles.L();
Vec3 vec31 = vec32.addVector(vec3.xCoord * d, vec3.yCoord * d, vec3.zCoord * d);
float f = entity.getCollisionBorderSize();
MovingObjectPosition movingObjectPosition;
return (movingObjectPosition = entity.getEntityBoundingBox().expand(f, f, f).calculateIntercept(vec32, vec31)) == null
? null
: new MovingObjectPosition(entity, movingObjectPosition.hitVec);
} else {
return null;
}
}
private RotationRayTrace() {
}
}