static int DistanceToBlock(Map map, Vector3f coord, Vector3f vec, Block blockType, bool invert) { coord += .5f; int iterations = 0; while (map.InBounds(new Vector3i(coord))) { byte blockAtPos = map.GetBlockByte(new Vector3i(coord)); if ((blockAtPos == (byte)blockType && !invert) || (blockAtPos != (byte)blockType && invert)) { break; } else { coord += vec; iterations++; } } return(iterations); }
static int DistanceToBlock( Map map, Vector3f coord, Vector3f vec, Block blockType, bool invert ) { coord += .5f; int iterations = 0; while( map.InBounds( new Vector3i( coord ) ) ) { byte blockAtPos = map.GetBlockByte( new Vector3i( coord ) ); if( (blockAtPos == (byte)blockType && !invert) || (blockAtPos != (byte)blockType && invert) ) { break; } else { coord += vec; iterations++; } } return iterations; }