17 lines
900 B
Python
17 lines
900 B
Python
"""Package only the reviewed native loot definitions; never edits a game world."""
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
from plugin_wild_update import write_archive
|
|
|
|
FILES={'pack.mcmeta','data/minecraft/loot_table/blocks/ender_chest.json','data/minecraft/loot_table/entities/shulker.json'}
|
|
|
|
def build(root,output):
|
|
actual={p.relative_to(root).as_posix() for p in root.rglob('*') if p.is_file()}
|
|
if actual!=FILES or any(p.is_symlink() for p in root.rglob('*')):raise ValueError('Unexpected loot pack files')
|
|
entries={name:(root/name).read_bytes() for name in sorted(FILES)}
|
|
for data in entries.values():json.loads(data)
|
|
with output.open('xb') as stream:stream.write(write_archive(entries))
|
|
|
|
if __name__=='__main__':
|
|
p=argparse.ArgumentParser(description=__doc__);p.add_argument('root',type=Path);p.add_argument('output',type=Path);build(**vars(p.parse_args()))
|

Staff