diff options
| author | mat <github@matdoes.dev> | 2022-06-21 19:48:01 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-21 19:48:01 -0500 |
| commit | 392c553d5688f3d5ad19c4a861c0239c914e3578 (patch) | |
| tree | 2d2a10c01b2d60c7bc3f609ff7525de4d3ecc13f /codegen/lib/extract.py | |
| parent | af7a7b428c60021e1ef717dd7dc3888c21188693 (diff) | |
| download | azalea-drasl-392c553d5688f3d5ad19c4a861c0239c914e3578.tar.xz | |
Force the generator mod to support snapshots
Diffstat (limited to 'codegen/lib/extract.py')
| -rw-r--r-- | codegen/lib/extract.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/codegen/lib/extract.py b/codegen/lib/extract.py index 893b8d5c..4c2d2399 100644 --- a/codegen/lib/extract.py +++ b/codegen/lib/extract.py @@ -1,6 +1,6 @@ # Extracting data from the Minecraft jars -from lib.download import get_server_jar, get_burger, get_client_jar, get_generator_mod, get_yarn_data +from lib.download import get_server_jar, get_burger, get_client_jar, get_generator_mod, get_yarn_data, get_fabric_api_versions from lib.utils import get_dir_location import json import os @@ -61,7 +61,9 @@ def get_generator_mod_data(version_id: str, category: str): # looks like 1.19+build.1 yarn_version = yarn_data['version'] - # the mod has the minecraft version hard-coded by default, so we just change the gradle.properties + fabric_api_version = get_fabric_api_versions()[-1] + + # the mod has the minecraft version hard-coded by default, so we just change the gradle.properties and fabric.mod.json with open(get_dir_location(f'{generator_mod_dir}/gradle.properties'), 'r') as f: lines = f.readlines() with open(get_dir_location(f'{generator_mod_dir}/gradle.properties'), 'w') as f: @@ -70,7 +72,15 @@ def get_generator_mod_data(version_id: str, category: str): line = f'minecraft_version={version_id}\n' if line.startswith('yarn_mappings='): line = f'yarn_mappings={yarn_version}\n' + if line.startswith('fabric_version='): + line = f'fabric_version={fabric_api_version}\n' f.write(line) + # edit the fabric.mod.json to support this version + with open(get_dir_location(f'{generator_mod_dir}/src/main/resources/fabric.mod.json'), 'r') as f: + fabric_mod_json = json.load(f) + fabric_mod_json['depends']['minecraft'] = '*' + with open(get_dir_location(f'{generator_mod_dir}/src/main/resources/fabric.mod.json'), 'w') as f: + json.dump(fabric_mod_json, f, indent=2) os.system( f'cd {generator_mod_dir} && gradlew runServer' |
