mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
set version ids
This commit is contained in:
parent
64eaa63e23
commit
3fbbb61c30
1 changed files with 23 additions and 0 deletions
|
@ -29,3 +29,26 @@ def set_version_id(version_id: str) -> None:
|
|||
|
||||
with open(README_DIR, 'w') as f:
|
||||
f.write(readme_text)
|
||||
|
||||
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:
|
||||
mod_rs = f.read().splitlines()
|
||||
for line in mod_rs:
|
||||
if line.strip().startswith('pub const PROTOCOL_VERSION'):
|
||||
return line.strip().split(' ')[-1].strip(';')
|
||||
raise Exception('Could not find protocol version in azalea-protocol/src/packets/mod.rs')
|
||||
|
||||
def set_protocol_version(protocol_version: str) -> None:
|
||||
with open('../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'):
|
||||
mod_rs[i] = f'pub const PROTOCOL_VERSION: u32 = {protocol_version};'
|
||||
break
|
||||
else:
|
||||
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:
|
||||
f.write('\n'.join(mod_rs))
|
Loading…
Add table
Add a link
Reference in a new issue