From 7b3e2e4bf793466a351510c7fbbd08234e93bb0e Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Thu, 21 Sep 2023 11:16:29 -0500 Subject: 1.20.2 (#99) * add configuration state * start updating to 23w31a * implement a bit more of 23w31a * chunk batching * start adding configuration state * ioasfhjgsd * almost works * configuration state mostly implemented * handle other packets in configuration state and fix keepalive * cleanup, fix warnings * 23w32a * fix some doctests * 23w33a * 23w35a * 1.20.2-pre2 * fix system conflicts * 1.20.2-pre4 * make tests compile * tests pass * 1.20.2-rc2 * 1.20.2 * Revert "1.20.2" This reverts commit dd152fd265332ead333c919e585ded6d609d7468. * didn't mean to commit that code --------- Co-authored-by: mat --- codegen/lib/code/entity.py | 6 +++--- codegen/lib/code/packet.py | 24 ++++++++++++++++++------ codegen/lib/code/utils.py | 9 ++++++++- 3 files changed, 29 insertions(+), 10 deletions(-) (limited to 'codegen') diff --git a/codegen/lib/code/entity.py b/codegen/lib/code/entity.py index 67e818b7..45210b5e 100644 --- a/codegen/lib/code/entity.py +++ b/codegen/lib/code/entity.py @@ -6,10 +6,10 @@ from typing import Optional import re METADATA_RS_DIR = get_dir_location( - '../azalea-world/src/entity/metadata.rs') + '../azalea-entity/src/metadata.rs') DATA_RS_DIR = get_dir_location( - '../azalea-world/src/entity/data.rs') + '../azalea-entity/src/data.rs') def generate_metadata_names(burger_dataserializers: dict, mappings: Mappings): serializer_names: list[Optional[str]] = [None] * len(burger_dataserializers) @@ -105,7 +105,7 @@ use super::{ SnifferState, VillagerData }; use azalea_chat::FormattedText; -use azalea_core::{BlockPos, Direction, Particle, Vec3}; +use azalea_core::{particle::Particle, BlockPos, Direction, Vec3}; use azalea_inventory::ItemSlot; use bevy_ecs::{bundle::Bundle, component::Component}; use derive_more::{Deref, DerefMut}; diff --git a/codegen/lib/code/packet.py b/codegen/lib/code/packet.py index 58e50136..b34d3455 100755 --- a/codegen/lib/code/packet.py +++ b/codegen/lib/code/packet.py @@ -237,12 +237,16 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p field_type_rs = None field_comment = None - print('instruction', instruction) + print('instruction', instruction, next_instruction, next_next_instruction) # iterators - if instruction['operation'] == 'write' and instruction['field'].endswith('.size()') and next_instruction and next_instruction['type'] == 'Iterator' and next_next_instruction and next_next_instruction['operation'] == 'loop': - obfuscated_field_name = instruction['field'].split('.')[ - 0] + if instruction['operation'] == 'write'\ + and instruction['field'].endswith('.size()')\ + and next_instruction\ + and next_instruction['type'] == 'Iterator'\ + and next_next_instruction\ + and next_next_instruction['operation'] == 'loop': + obfuscated_field_name = instruction['field'].split('.')[0] field_name = mappings.get_field( obfuscated_class_name, obfuscated_field_name) @@ -303,6 +307,11 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p condition_types_rs = [] for condition_instruction in condition_instructions: + print('condition_instruction', condition_instruction) + if 'type' not in condition_instruction: + # weird type, maybe it's a loop or something + condition_types_rs.append('todo!("weird type, maybe it\'s a loop or something")') + continue condition_type_rs, is_var, this_uses, this_extra_code = burger_type_to_rust_type( condition_instruction['type'], None, condition_instruction, mappings, obfuscated_class_name) condition_types_rs.append(condition_type_rs) @@ -381,8 +390,11 @@ def burger_field_to_type(field, mappings: Mappings, obfuscated_class_name: str, if obfuscated_first in known_variable_types: first_type = known_variable_types[obfuscated_first] else: - first_type = mappings.get_field_type( - obfuscated_class_name, obfuscated_first) + try: + first_type = mappings.get_field_type( + obfuscated_class_name, obfuscated_first) + except: + first_type = 'TODO' first_obfuscated_class_name: Optional[str] = mappings.get_class_from_deobfuscated_name( first_type) if first_obfuscated_class_name: diff --git a/codegen/lib/code/utils.py b/codegen/lib/code/utils.py index 3f9b6edb..6dd910dc 100755 --- a/codegen/lib/code/utils.py +++ b/codegen/lib/code/utils.py @@ -71,6 +71,11 @@ def burger_type_to_rust_type(burger_type, field_name: Optional[str] = None, inst field_type_rs = 'todo!("fixed bitset")' elif burger_type == 'abstract': field_type_rs = 'todo!()' + elif burger_type == 'interface': + # depends on context + field_type_rs = 'todo!()' + elif burger_type == 'Iterator': + field_type_rs = 'todo!()' elif burger_type == 'enum': if not instruction or not mappings or not obfuscated_class_name: field_type_rs = 'todo!("enum")' @@ -152,7 +157,9 @@ def burger_type_to_rust_type(burger_type, field_name: Optional[str] = None, inst uses.add('azalea_buf::UnsizedByteArray') else: - raise Exception(f'Unknown field type: {burger_type}') + print('instruction that we errored on:', instruction) + deobfuscated_class_name = mappings.get_class(obfuscated_class_name) if obfuscated_class_name else None + raise Exception(f'Unknown field type: {burger_type} ({deobfuscated_class_name or obfuscated_class_name})') return field_type_rs, is_var, uses, extra_code -- cgit v1.2.3