Added support for axis rotations.

This commit is contained in:
Matthew Miller
2018-11-17 12:00:19 +10:00
parent 24800a662a
commit 2dc9321da6
2 changed files with 59 additions and 7 deletions

View File

@ -22,6 +22,9 @@ package com.sk89q.worldedit.util;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
/**
@ -150,6 +153,23 @@ public enum Direction {
return closest;
}
/**
* Gets all directions with the given flags.
*
* @param flags The flags
* @return The directions that fit the flags
*/
public static List<Direction> valuesOf(int flags) {
List<Direction> directions = new ArrayList<>();
for (Direction direction : values()) {
if ((~flags & direction.flags) == 0) {
directions.add(direction);
}
}
return directions;
}
/**
* Flags to use with {@link #findClosest(Vector3, int)}.
*/