public int AddVoxel(RaycastHit hit)
    {
        int x = (int)(Math.Round(hit.point.x + (hit.normal.x / 2 * scale)) / scale); //gets position we want to add to, adds the normal since we want the cube infront of the one clicked.
        int y = (int)(Math.Round(hit.point.y + (hit.normal.y / 2 * scale)) / scale);
        int z = (int)(Math.Round(hit.point.z + (hit.normal.z / 2 * scale)) / scale);

        if (x < X && y < Y && z < Z && x >= 0 && y >= 0 && z >= 0)
        {
            Vector3 groove = data.GetLocalGroove(new Vector3(x, y, z));
            x = (int)groove.x;
            y = (int)groove.y;
            z = (int)groove.z;

            if (data.GetCell(x, y, z) == 8) //remove green cube
            {
                Vector3 remove = new Vector3(x, y, z);
                int     hn     = GetHashNum(remove);
                int     mn     = (int)table[hn];
                meshList[mn].RemoveCube(remove);
                meshList[mn].UpdateMesh();
                table.Remove(hn);
            }
            int type    = 6;
            int meshNum = GetFreeMesh(type);
            MakeCube(adjScale, new Vector3(x * scale, y * scale, z * scale), x, y, z, data, type, meshNum); //creates a cube given the xyz position
            meshList[meshNum].UpdateMesh();                                                                 //updates the mesh that has been added to.
            if (data.GetCell(x, y, z) == 8)                                                                 //if this is where decay was
            {
                data.SetVoxel(x, y, z, 7);
                return(50);
            }
            else
            {
                data.SetVoxel(x, y, z, 7);
                return(-10);
            }
        }
        else
        {
            return(0);
        }
    }