aboutsummaryrefslogtreecommitdiff
path: root/codegen
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-06-21 19:57:18 -0500
committermat <github@matdoes.dev>2022-06-21 19:57:18 -0500
commitdeef5d27c08daa709e5ebebc382aadff7450fca6 (patch)
treee7580639bf5c3c64d5b49bd5fc55c1236085c57d /codegen
parent392c553d5688f3d5ad19c4a861c0239c914e3578 (diff)
downloadazalea-drasl-deef5d27c08daa709e5ebebc382aadff7450fca6.tar.xz
Update to 1.19.1-pre1
Diffstat (limited to 'codegen')
-rw-r--r--codegen/lib/code/version.py6
-rw-r--r--codegen/lib/download.py8
-rw-r--r--codegen/migrate.py8
3 files changed, 18 insertions, 4 deletions
diff --git a/codegen/lib/code/version.py b/codegen/lib/code/version.py
index 511d30d1..13d9472d 100644
--- a/codegen/lib/code/version.py
+++ b/codegen/lib/code/version.py
@@ -36,7 +36,7 @@ def set_version_id(version_id: str) -> None:
def get_protocol_version() -> str:
# azalea-protocol/src/packets/mod.rs
# pub const PROTOCOL_VERSION: u32 = 758;
- with open('../azalea-protocol/src/packets/mod.rs', 'r') as f:
+ with open(get_dir_location('../azalea-protocol/src/packets/mod.rs'), 'r') as f:
mod_rs = f.read().splitlines()
for line in mod_rs:
if line.strip().startswith('pub const PROTOCOL_VERSION'):
@@ -46,7 +46,7 @@ def get_protocol_version() -> str:
def set_protocol_version(protocol_version: str) -> None:
- with open('../azalea-protocol/src/packets/mod.rs', 'r') as f:
+ with open(get_dir_location('../azalea-protocol/src/packets/mod.rs'), 'r') as f:
mod_rs = f.read().splitlines()
for i, line in enumerate(mod_rs):
if line.strip().startswith('pub const PROTOCOL_VERSION'):
@@ -56,5 +56,5 @@ def set_protocol_version(protocol_version: str) -> None:
raise Exception(
'Could not find protocol version in azalea-protocol/src/packets/mod.rs')
- with open('../azalea-protocol/src/packets/mod.rs', 'w') as f:
+ with open(get_dir_location('../azalea-protocol/src/packets/mod.rs'), 'w') as f:
f.write('\n'.join(mod_rs))
diff --git a/codegen/lib/download.py b/codegen/lib/download.py
index db21145c..d9e2e63f 100644
--- a/codegen/lib/download.py
+++ b/codegen/lib/download.py
@@ -129,7 +129,13 @@ def get_fabric_api_versions():
fabric_api_versions_data_xml = ET.fromstring(
fabric_api_versions_xml_text)
fabric_api_versions = []
- for version_el in fabric_api_versions_data_xml.find('versioning').find('versions').findall('version'):
+
+ versioning_el = fabric_api_versions_data_xml.find('versioning')
+ assert versioning_el
+ versions_el = versioning_el.find('versions')
+ assert versions_el
+
+ for version_el in versions_el.findall('version'):
fabric_api_versions.append(version_el.text)
with open(get_dir_location('downloads/fabric_api_versions.json'), 'w') as f:
diff --git a/codegen/migrate.py b/codegen/migrate.py
index 62924bb9..fa7b01a6 100644
--- a/codegen/migrate.py
+++ b/codegen/migrate.py
@@ -9,6 +9,14 @@ import sys
lib.download.clear_version_cache()
+if len(sys.argv) == 1:
+ print('\033[91mYou must provide a version to migrate to.\033[m')
+ version_manifest = lib.download.get_version_manifest()
+ newest_version = version_manifest['latest']['snapshot']
+ print(f'Hint: newest version is \033[1m{newest_version}\033[m')
+ exit()
+
+
old_version_id = lib.code.version.get_version_id()
old_mappings = lib.download.get_mappings_for_version(old_version_id)
old_burger_data = lib.extract.get_burger_data_for_version(old_version_id)