32 lines
1.3 KiB
Python
32 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from warium_source import ROOT
|
|
|
|
|
|
def main() -> None:
|
|
inventory_path = ROOT / "docs" / "inventory" / "original-inventory.json"
|
|
generated_source = ROOT / "src" / "generated" / "java" / "net" / "mcreator" / "crustychunks" / "init" / "GeneratedRegistries.java"
|
|
if not inventory_path.exists() or not generated_source.exists():
|
|
raise SystemExit("Generated inventory is missing; run generatePortSources first.")
|
|
inventory = json.loads(inventory_path.read_text(encoding="utf-8"))
|
|
source = generated_source.read_text(encoding="utf-8")
|
|
missing_blocks = [name for name in inventory["blocks_from_blockstates"] if f'"{name}"' not in source]
|
|
missing_items = [name for name in inventory["standalone_items_from_item_models"] if f'"{name}"' not in source]
|
|
if missing_blocks or missing_items:
|
|
raise SystemExit(
|
|
"Registry parity failed: "
|
|
f"{len(missing_blocks)} blocks missing, {len(missing_items)} standalone items missing"
|
|
)
|
|
print(
|
|
"Registry parity OK: "
|
|
f"{len(inventory['blocks_from_blockstates'])} blocks and "
|
|
f"{len(inventory['standalone_items_from_item_models'])} standalone items generated."
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|