33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import os
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description="Render renameable item previews with the Minecraft client.")
|
|
parser.add_argument("--manifest", default="build/renameable-items.json", help="Path to the generated manifest")
|
|
parser.add_argument("--pack-root", default="resourcepack", help="Path to the resource pack root")
|
|
parser.add_argument("--output-dir", default="build", help="Directory where renders should be written")
|
|
args = parser.parse_args()
|
|
|
|
repo_root = Path(__file__).resolve().parents[2]
|
|
client_renderer = repo_root / "build" / "client-renderer"
|
|
|
|
env = os.environ.copy()
|
|
env["RENDER_MANIFEST"] = str((repo_root / args.manifest).resolve())
|
|
env["RENDER_OUTPUT_DIR"] = str((repo_root / args.output_dir).resolve())
|
|
env["RENDER_PACK_ROOT"] = str((repo_root / args.pack_root).resolve())
|
|
|
|
command = ["gradle", "-p", str(client_renderer), "runClient", "--no-daemon"]
|
|
|
|
completed = subprocess.run(command, cwd=repo_root, env=env)
|
|
|
|
return completed.returncode
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main()) |