diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-09-21 11:16:29 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-21 11:16:29 -0500 |
| commit | 7b3e2e4bf793466a351510c7fbbd08234e93bb0e (patch) | |
| tree | 7177a919de9982d9e3c7f36a76d2025696f465b6 /codegen/lib/code/packet.py | |
| parent | 83cce236145cdab1872a472a70943b669a880965 (diff) | |
| download | azalea-drasl-7b3e2e4bf793466a351510c7fbbd08234e93bb0e.tar.xz | |
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 <git@matdoes.dev>
Diffstat (limited to 'codegen/lib/code/packet.py')
| -rwxr-xr-x | codegen/lib/code/packet.py | 24 |
1 files changed, 18 insertions, 6 deletions
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: |
