WIP: playable client — streaming world, lighting, HUD, crafting, saves, audio, items
Checkpoint of the playable client rewrite before build verification. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fetch the pinned version's sound assets (sounds.json and .ogg files) from
|
||||
Mojang's asset index into the private client resource directory, verifying
|
||||
every object's SHA-1. The files stay in ignored .local/ and are never committed."""
|
||||
import concurrent.futures
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import urllib.request
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
LOCAL = ROOT / '.local'
|
||||
|
||||
|
||||
def fetch(url):
|
||||
with urllib.request.urlopen(url, timeout=120) as response:
|
||||
return response.read()
|
||||
|
||||
|
||||
def main():
|
||||
manifest = json.loads((LOCAL / 'minecraft/26.3/manifest.json').read_text())
|
||||
index_info = manifest['assetIndex']
|
||||
target = LOCAL / 'horizon-client/26.3'
|
||||
index_path = target / 'asset-index.json'
|
||||
if not index_path.exists() or hashlib.sha1(index_path.read_bytes()).hexdigest() != index_info['sha1']:
|
||||
data = fetch(index_info['url'])
|
||||
if hashlib.sha1(data).hexdigest() != index_info['sha1']:
|
||||
raise ValueError('asset index checksum mismatch')
|
||||
index_path.write_bytes(data)
|
||||
objects = json.loads(index_path.read_text())['objects']
|
||||
wanted = {name: info for name, info in objects.items()
|
||||
if name == 'minecraft/sounds.json' or name.startswith('minecraft/sounds/')}
|
||||
|
||||
def download(item):
|
||||
name, info = item
|
||||
path = target / 'assets' / name
|
||||
if path.exists() and hashlib.sha1(path.read_bytes()).hexdigest() == info['hash']:
|
||||
return 0
|
||||
h = info['hash']
|
||||
data = fetch(f'https://resources.download.minecraft.net/{h[:2]}/{h}')
|
||||
if hashlib.sha1(data).hexdigest() != h:
|
||||
raise ValueError(f'checksum mismatch for {name}')
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_bytes(data)
|
||||
return len(data)
|
||||
|
||||
total = 0
|
||||
with concurrent.futures.ThreadPoolExecutor(16) as pool:
|
||||
for size in pool.map(download, wanted.items()):
|
||||
total += size
|
||||
print(f'Sound assets ready: {len(wanted)} files, {total / 1e6:.1f} MB downloaded')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -207,6 +207,20 @@ def main():
|
||||
(root / 'biome-parameters').mkdir(exist_ok=True)
|
||||
for f in (reports / 'biome_parameters' / 'minecraft').glob('*.json'):
|
||||
(root / 'biome-parameters' / f.name).write_bytes(f.read_bytes())
|
||||
entity_models = root / 'entity-models.json'
|
||||
entity_oracle = oracle.with_name('VanillaEntityModelExporter.java')
|
||||
entity_sources = base.source_hashes([entity_oracle])
|
||||
if not (previous.get('entity_model_exporters_sha256') == entity_sources and entity_models.exists()
|
||||
and previous.get('client_sha256') == origin['client_sha256']):
|
||||
classes = lab.LOCAL / 'entity-models' / 'classes'; classes.mkdir(parents=True, exist_ok=True)
|
||||
dependencies = os.pathsep.join(map(str, [jars['client'], *baking.client_libraries()]))
|
||||
with (root / 'entity-model-export.log').open('w') as log:
|
||||
subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none',
|
||||
'-cp', dependencies, '-d', str(classes), str(entity_oracle)],
|
||||
check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600)
|
||||
subprocess.run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies,
|
||||
'dev.horizonlab.parity.VanillaEntityModelExporter', str(entity_models)],
|
||||
check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600)
|
||||
lab.write_json(manifest, {'schema': 7, **origin,
|
||||
'health_exporters_sha256': health_sources,
|
||||
'health_files_sha256': {name: lab.digest(root/name, 'sha256') for name in health_files},
|
||||
@@ -218,6 +232,7 @@ def main():
|
||||
'render_files_sha256': {name: lab.digest(root/name, 'sha256') for name in render_files},
|
||||
'model_state_exporters_sha256': binding_sources,
|
||||
'gameplay_exporters_sha256': gameplay_sources,
|
||||
'entity_model_exporters_sha256': entity_sources,
|
||||
'model_states_sha256': lab.digest(model_states, 'sha256'), 'data_version': version['world_version'],
|
||||
'facts_sha256': lab.digest(facts, 'sha256'),
|
||||
'block_tags_sha256': lab.digest(root / 'block-tags.json', 'sha256'), 'resource_files': count})
|
||||
|
||||
Reference in New Issue
Block a user