diff options
| author | mat <github@matdoes.dev> | 2022-06-16 20:59:19 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-16 20:59:19 -0500 |
| commit | 9c0b6f6631f861cb1582c6bba41d2931ee26bf16 (patch) | |
| tree | 1976fe06ae3a7949fbc56aa98bea1c7ed00bb121 /codegen/migrate.py | |
| parent | 70cc7dfbeda9775014f25c9ec40932d83bae280f (diff) | |
| download | azalea-drasl-9c0b6f6631f861cb1582c6bba41d2931ee26bf16.tar.xz | |
22w24a & update packets when they're modified
Diffstat (limited to 'codegen/migrate.py')
| -rw-r--r-- | codegen/migrate.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/codegen/migrate.py b/codegen/migrate.py index 98b701bf..95a6ac4d 100644 --- a/codegen/migrate.py +++ b/codegen/migrate.py @@ -19,18 +19,24 @@ new_packet_list = list(new_burger_data[0]['packets']['packet'].values()) old_packets: dict[PacketIdentifier, str] = {} +old_packets_data: dict[PacketIdentifier, dict] = {} new_packets: dict[PacketIdentifier, str] = {} +new_packets_data: dict[PacketIdentifier, dict] = {} for packet in old_packet_list: assert packet['class'].endswith('.class') packet_name = old_mappings.get_class(packet['class'][:-6]) - old_packets[PacketIdentifier( - packet['id'], packet['direction'].lower(), fix_state(packet['state']))] = packet_name + packet_ident = PacketIdentifier( + packet['id'], packet['direction'].lower(), fix_state(packet['state'])) + old_packets[packet_ident] = packet_name + old_packets_data[packet_ident] = packet for packet in new_packet_list: assert packet['class'].endswith('.class') packet_name = new_mappings.get_class(packet['class'][:-6]) - new_packets[PacketIdentifier( - packet['id'], packet['direction'].lower(), fix_state(packet['state']))] = packet_name + packet_ident = PacketIdentifier( + packet['id'], packet['direction'].lower(), fix_state(packet['state'])) + new_packets[packet_ident] = packet_name + new_packets_data[packet_ident] = packet # find removed packets removed_packets: list[PacketIdentifier] = [] @@ -63,13 +69,15 @@ for (direction, state), packets in group_packets(list(changed_packets.keys())).i print() -# find added packets -added_packets: list[PacketIdentifier] = [] +# find added/changed packets +added_or_changed_packets: list[PacketIdentifier] = [] for packet, packet_name in new_packets.items(): if packet_name not in old_packets.values(): - added_packets.append(packet) + added_or_changed_packets.append(packet) print('Added packet:', packet, packet_name) -for packet in added_packets: + if new_packets_data[packet].get('instructions') != old_packets_data[packet].get('instructions'): + print('hmm') +for packet in added_or_changed_packets: lib.code.packet.generate_packet( new_burger_data[0]['packets']['packet'], new_mappings, packet.packet_id, packet.direction, packet.state) |
