diff --git a/README.md b/README.md index 0bccbc6e..aea4de20 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A collection of Rust crates primarily for creating Minecraft bots.

-*Currently supported Minecraft version: `22w24a`.* +*Currently supported Minecraft version: `1.19.1-pre1`.* I named this Azalea because it sounds like a cool word and this is a cool library. This project was heavily inspired by PrismarineJS. diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index 8425b0e9..0dd79a47 100755 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -12,7 +12,7 @@ use crate::{ use num_derive::FromPrimitive; use num_traits::FromPrimitive; -pub const PROTOCOL_VERSION: u32 = 1073741916; +pub const PROTOCOL_VERSION: u32 = 1073741917; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, FromPrimitive)] pub enum ConnectionProtocol { 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)