38 lines
1.9 KiB
Python
38 lines
1.9 KiB
Python
"""Build the separately stacked MCGUI transport + namespaced DuneRealms menu/item overlay."""
|
|
import argparse
|
|
import hashlib
|
|
import importlib.util
|
|
import json
|
|
from pathlib import Path
|
|
import zipfile
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
spec = importlib.util.spec_from_file_location('gameplay_pack', ROOT / 'tools/build-gameplay-resourcepack.py')
|
|
shared = importlib.util.module_from_spec(spec); spec.loader.exec_module(shared)
|
|
INPUT = ROOT / 'network/resource-pack/mcgui/transport-0.8.6.zip'
|
|
INPUT_SHA256 = 'eb7eacfbb50679b83a4da4a671cb565de2d67b02ee8525d05e345a17cdbe3721'
|
|
|
|
|
|
def build(output, source_commit, transport=INPUT):
|
|
transport = Path(transport)
|
|
if hashlib.sha256(transport.read_bytes()).hexdigest() != INPUT_SHA256:
|
|
raise ValueError('MCGUI client transport differs from reviewed input')
|
|
base = shared.entries(transport)
|
|
if not any(name.startswith('uiengine_26_2/assets/minecraft/shaders/') for name in base):
|
|
raise ValueError('Missing actual26.2 fullscreen transport')
|
|
output = Path(output); result = shared.build(transport, output)
|
|
actual = shared.entries(output)
|
|
if any(actual[name] != data for name, data in base.items()):
|
|
raise ValueError('MCGUI transport changed')
|
|
if any('/textures/block/' in name or '/textures/entity/' in name or '/models/block/' in name for name in actual):
|
|
raise ValueError('Menu overlay must not contain world material/entity replacements')
|
|
result.update(sourceCommit=source_commit, transportSha256=INPUT_SHA256, stacked=True)
|
|
output.with_suffix('.manifest.json').write_text(json.dumps(result, indent=2) + '\n')
|
|
return result
|
|
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--output', type=Path, required=True)
|
|
parser.add_argument('--source', required=True)
|
|
args = parser.parse_args(); print(json.dumps(build(args.output, args.source), indent=2))
|

Staff