def dist_to_mat(cord, vec, matidxlist, mcmap, invert=False, limit=False):
 assert isinstance(mcmap, mcInterface.SaveFile)
 block = mcmap.block
 curcord = [(i + 0.5) for i in cord]
 iterations = 0
 on_map = True
 while on_map:
  x = int(curcord[0])
  y = int(curcord[1])
  z = int(curcord[2])
  return_dict = block(x, y, z)
  if (return_dict is None):
   break
  else:
   block_value = return_dict['B']
  if ((block_value in matidxlist) and (invert == False)):
   break
  elif ((block_value not in matidxlist) and invert):
   break
  else:
   curcord = [(curcord[i] + vec[i]) for i in range(3)]
   iterations += 1
  if (limit and (iterations > limit)):
   break
 return iterations

def dist_to_mat ( cord , vec , matidxlist , mcmap , invert = False , limit = False ) : assert isinstance ( mcmap , mcInterface . SaveFile ) block = mcmap . block curcord = [ ( i + 0.5 ) for i in cord ] iterations = 0 on_map = True while on_map : x = int ( curcord [ 0 ] ) y = int ( curcord [ 1 ] ) z = int ( curcord [ 2 ] ) return_dict = block ( x , y , z ) if ( return_dict is None ) : break else : block_value = return_dict [ 'B' ] if ( ( block_value in matidxlist ) and ( invert == False ) ) : break elif ( ( block_value not in matidxlist ) and invert ) : break else : curcord = [ ( curcord [ i ] + vec [ i ] ) for i in range ( 3 ) ] iterations += 1 if ( limit and ( iterations > limit ) ) : break return iterations
travel from cord along vec and return how far it was to a point of matidx the distance is returned in number of iterations .