Use local Python renderer for previews

This commit is contained in:
2026-08-11 00:32:11 +01:00
parent da89bb60f1
commit 01a6a99777
3 changed files with 18 additions and 51 deletions
+2 -2
View File
@@ -151,7 +151,7 @@ def build_markdown(records: list[dict[str, Any]]) -> str:
lines.append("")
lines.append(f"- Base items: {len(records)}")
lines.append(f"- Rename variants: {total_cases}")
lines.append("- Render mode: pluggable")
lines.append("- Render mode: local Python renderer")
lines.append("")
lines.append("Sections are sorted by the item they are generated from.")
@@ -389,7 +389,7 @@ def build_html(records: list[dict[str, Any]]) -> str:
<div class="stats">
<div class="stat"><span>Base items</span><strong>{len(records)}</strong></div>
<div class="stat"><span>Rename variants</span><strong>{total_cases}</strong></div>
<div class="stat"><span>Render mode</span><strong>pluggable</strong></div>
<div class="stat"><span>Render mode</span><strong>local Python renderer</strong></div>
</div>
</section>
<section class="grid">
+14 -10
View File
@@ -2,29 +2,33 @@
from __future__ import annotations
import argparse
import os
import subprocess
import sys
from pathlib import Path
def main() -> int:
parser = argparse.ArgumentParser(description="Render renameable item previews with the Minecraft client.")
parser = argparse.ArgumentParser(description="Render renameable item previews from resource pack model JSON.")
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"
renderer_script = repo_root / "build" / "scripts" / "render_models.py"
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 = [
sys.executable,
str(renderer_script),
"--manifest",
str((repo_root / args.manifest).resolve()),
"--pack-root",
str((repo_root / args.pack_root).resolve()),
"--output-dir",
str((repo_root / args.output_dir).resolve()),
]
command = ["gradle", "-p", str(client_renderer), "runClient", "--no-daemon"]
completed = subprocess.run(command, cwd=repo_root, env=env)
completed = subprocess.run(command, cwd=repo_root)
return completed.returncode