Skip to content

Instantly share code, notes, and snippets.

@adoc
Created September 12, 2014 09:08
Show Gist options
  • Save adoc/d6cfe3178f53d9d47bcf to your computer and use it in GitHub Desktop.
Save adoc/d6cfe3178f53d9d47bcf to your computer and use it in GitHub Desktop.
python 3d distance calc for center point of minecraft spawners.
import math
skellie = (438, 26, -410)
zombie = (443, 16, -386)
c = (440, 21, -398)
def dist(x1, y1, z1, x2, y2, z2):
return (math.sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2))
for yn in range(c[1], 0, -1):
cn = c[0], yn, c[2]
if dist(*skellie+cn) >= 16:
break
if dist(*zombie+cn) >=16:
break
print cn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment