package me.deftware.client.framework.wrappers.entity;

public enum IDirection {
    SOUTH("South", 0),
    SOUTH_WEST("Southwest", 45),
    WEST("West", 90),
    NORTH_WEST("Northwest", 135),
    NORTH("North", 180),
    NORTH_EAST("Northeast", 225),
    EAST("East", 270),
    SOUTH_EAST("Southeast", 315);

    private final int centerDegree;

    private final String name;

    IDirection(final String name, final int centerDegree) {
        this.centerDegree = centerDegree;

        this.name = name;
    }

    public float getCenter() {
        return centerDegree;
    }

    public String getName() {
        return name;
    }

    private static final IDirection[] VALUES = values();

    public static IDirection getFrom(float lookDir) {
        for (IDirection possibleDir : VALUES) {
            if (lookDir >= (possibleDir.centerDegree - 22.5f) && lookDir <= (possibleDir.centerDegree + 22.5f)) {
                return possibleDir;
            }
        }
        return NORTH;
    }
}

@@ -81,490 +81,926 @@
     
-SOU
+NOR
 TH(%22
-Sou
+Nor
 th%22, 
-0),
+337.5f, 22.5f), // Middle: 0
 %0A    
-SOU
+NOR
 TH_
-W
 E
+A
 ST(%22
-Southwest%22, 45),
+Northeast%22, 22.5f, 67.5f), // Middle: 45
 %0A    
-W
 E
+A
 ST(%22
-We
+Ea
 st%22, 
+67.5f, 112.5f), // Middle: 
 90
-),
 %0A    
-NOR
+SOU
 TH_
-W
 E
+A
 ST(%22
-Northwest%22, 135),
+Southeast%22, 112.5f, 157.5f), // Middle: 135
 %0A    
-NOR
+SOU
 TH(%22
-Nor
+Sou
 th%22, 1
+57.5f, 202.5f), // Middle: 1
 80
-),
 %0A    
-NOR
+SOU
 TH_
+W
 E
-A
 ST(%22
-Northeast%22, 225),
+Southwest%22, 202.5f, 247.5f), // Middle: 225
 %0A    
+W
 E
-A
 ST(%22
-Ea
+We
 st%22, 2
+47.5f, 292.5f), // Middle: 2
 70
-),
 %0A    
-SOU
+NOR
 TH_
+W
 E
-A
 ST(%22
-Southeast%22, 315);%0A%0A    private final int centerDegree;%0A%0A    private final String name;%0A%0A    IDirection(final String name, final int centerDegree) %7B%0A        this.centerDegree = centerDegree;%0A%0A        this.name = name;%0A    %7D%0A%0A    public float getCenter() %7B%0A        return center
+Northwest%22, 292.5f, 337.5f); // Middle: 315%0A%0A    private final float leftDegree, rightDegree;%0A%0A    private final String name;%0A%0A    IDirection(final String name, final float leftDegree, final float rightDegree) %7B%0A        this.leftDegree = leftDegree;%0A        this.rightDegree = rightDegree;%0A%0A        this.name = name;%0A    %7D%0A%0A    public float getCenter() %7B%0A        return (leftDegree + rightDegree) / 2;%0A    %7D%0A%0A    public float getLeftDegree() %7B%0A        return leftDegree;%0A    %7D%0A%0A    public float getRightDegree() %7B%0A        return right
 Degr
@@ -1253,19 +1253,17 @@
 ookDir %3E
-= (
+ 
 possible
@@ -1270,29 +1270,18 @@
 Dir.
-center
+left
 Degree
- - 22.5f)
  && 
@@ -1293,11 +1293,9 @@
 ir %3C
-= (
+ 
 poss
@@ -1306,29 +1306,19 @@
 Dir.
-centerDegree + 22.5f)
+rightDegree
 ) %7B%0A

Rewrite IDirection - Part 1/2