Here you can find the source of angleYawinRange(float start, float end, float angle)
public static boolean angleYawinRange(float start, float end, float angle)
//package com.java2s; /**/* w w w .j a v a 2 s. com*/ * Copyright (c) Lambda Innovation, 2013-2016 * This file is part of LambdaLib modding library. * https://github.com/LambdaInnovation/LambdaLib * Licensed under MIT, see project root for more information. */ public class Main { /** * Return whether a -180~180 wrapped yaw angle is in the range denoted by [start, end]. * Note that this is not a simple range comparison. If the arc of the angle is in the * range sweeped from start to end clockwisely, then the result is true. */ public static boolean angleYawinRange(float start, float end, float angle) { if (end < start) return false; if (end - start >= 360f) return true; float ss = wrapYawAngle(start), se = wrapYawAngle(end), sa = wrapYawAngle(angle); if (ss > se) { return ss <= sa || sa <= se; } //System.out.println(ss + " " + se + " " + sa); return ss <= sa && sa <= se; } public static float wrapYawAngle(float a) { float ret = a % 360f; return ret < 0 ? ret + 360f : ret; } }