22 lines
1.1 KiB
Python
22 lines
1.1 KiB
Python
"""Generate the code-native vanilla material artwork; never installs or publishes a pack."""
|
|
import argparse
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
import zipfile
|
|
ROOT=Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0,str(ROOT/'network/resource-pack/central/generator'))
|
|
sys.path.insert(0,str(ROOT/'tools'))
|
|
from vanilla_materials import build
|
|
if __name__=='__main__':
|
|
parser=argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--client',type=Path,required=True)
|
|
parser.add_argument('--output',type=Path,default=ROOT/'network/resource-pack/vanilla-art/overlay')
|
|
args=parser.parse_args()
|
|
expected=json.loads((ROOT/'network/resource-pack/central/inputs.lock.json').read_text(encoding='utf-8'))['client']
|
|
actual=hashlib.sha1(args.client.read_bytes()).hexdigest()
|
|
if actual!=expected['sha1']:raise ValueError('Pinned official client differs')
|
|
with zipfile.ZipFile(args.client) as z:vanilla={n:z.read(n) for n in z.namelist() if n.startswith('assets/')}
|
|
report=build(vanilla,args.output,actual)
|
|
print(json.dumps({k:v for k,v in report.items() if k!='entries'},indent=2))
|

Staff