public static int validateDirection(int dir) {
		for (int i = 0; i < directions.length; i++)
			if (dir == directions[i])
				return dir;

		return ((dir % 4) + 4) % 4; //This is in case it's negative
	}