Skip to content

Instantly share code, notes, and snippets.

@DarkblooM-IO
Last active March 14, 2024 08:22
Show Gist options
  • Save DarkblooM-IO/536183c09a1b2ee8ef15bc33a83d986d to your computer and use it in GitHub Desktop.
Save DarkblooM-IO/536183c09a1b2ee8ef15bc33a83d986d to your computer and use it in GitHub Desktop.
from argparse import ArgumentParser
parser = ArgumentParser(prog="NetherCoords", description="Converts Nether coordinates to Overworld coordinates")
parser.add_argument('x', type=int, metavar="X", help="X position")
parser.add_argument('z', type=int, metavar="Z", help="Z position")
parser.add_argument('-o', '--overworld', action='store_true', help="Use Overworld coordinates and convert them to Nether coordinates instead")
def main() -> None:
args = parser.parse_args()
x: int = round(args.x / 8) if not args.overworld else round(args.x * 8)
z: int = round(args.z / 8) if not args.overworld else round(args.z * 8)
print(f"X: {x}\nZ: {z}")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment