horizon-prepare sounds: the sound copy in Rust, run by the launcher
tools/fetch_sounds.py (and the lab.py functions it used) becomes `horizon-prepare sounds` (horizon_prepare::sounds): the pinned asset index, sounds.json and every .ogg from the player's own launcher install, each SHA-1 checked, into .local/horizon-client/<version>. The launcher runs it as part of Prepare (in-process, the version's own binary when its sources differ and it knows the subcommand, in-process for older versions), and a launcher install without the assets only logs that the game will be silent. Player docs no longer mention Python for sound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ COMMON_SOURCES = [
|
||||
|
||||
def require_sounds():
|
||||
if not (RESOURCES / 'assets/minecraft/sounds.json').is_file():
|
||||
raise SystemExit('Sound assets missing: run tools/fetch_sounds.py first')
|
||||
raise SystemExit('Sound assets missing: run cargo run -p horizon-prepare -- sounds first')
|
||||
|
||||
|
||||
def run_harness(name, oracle, example, inputs_text, extra_sources=(), java_args=(), rust_args=(), scope='', timeout=1800):
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Copy the pinned version's sound assets (sounds.json and .ogg files) from your
|
||||
own official launcher install into the private client resource directory,
|
||||
verifying every object's SHA-1. Nothing is downloaded; the files stay in
|
||||
ignored .local/ and are never committed."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
|
||||
import lab
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--minecraft-dir', type=Path,
|
||||
help="official launcher game directory (default: the launcher's own)")
|
||||
args = parser.parse_args()
|
||||
lock, directory = lab.config()
|
||||
manifest = lab.import_manifest(lock, directory, args.minecraft_dir)
|
||||
store, index = lab.launcher_assets(manifest, args.minecraft_dir)
|
||||
target = lab.LOCAL / 'horizon-client' / manifest['id']
|
||||
target.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copyfile(index, target / 'asset-index.json')
|
||||
objects = lab.json.loads(index.read_text())['objects']
|
||||
wanted = {name: info for name, info in objects.items()
|
||||
if name == 'minecraft/sounds.json' or name.startswith('minecraft/sounds/')}
|
||||
total = 0
|
||||
for name, info in wanted.items():
|
||||
source = lab.launcher_object(store, info['hash'])
|
||||
lab.import_copy(source, target / 'assets' / name, info['hash'])
|
||||
total += info['size']
|
||||
print(f'Sound assets ready: {len(wanted)} files, {total / 1e6:.1f} MB')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -87,7 +87,7 @@ def main():
|
||||
if not (args.resources / 'horizon-resources.json').is_file():
|
||||
raise SystemExit(f'missing prepared resources in {args.resources}: run horizon-prepare --prepare (cargo run --release -p horizon-prepare -- --prepare)')
|
||||
if not (args.resources / 'assets/minecraft/sounds.json').is_file():
|
||||
print('warning: no sound assets; run tools/fetch_sounds.py for audio')
|
||||
print('warning: no sound assets; run cargo run -p horizon-prepare -- sounds for audio')
|
||||
|
||||
system = {'Linux': 'linux', 'Darwin': 'macos'}.get(platform.system())
|
||||
if system is None:
|
||||
|
||||
Reference in New Issue
Block a user