diff --git a/codegen/lib/code/packet.py b/codegen/lib/code/packet.py index af41a390..8563e5b9 100644 --- a/codegen/lib/code/packet.py +++ b/codegen/lib/code/packet.py @@ -117,7 +117,7 @@ def set_packets(packet_ids: list[int], packet_class_names: list[str], direction: assert len(packet_ids) == len(packet_class_names) # sort the packets by id - zipped_packets: list[tuple[int, str]] = [list(x) for x in zip( + packet_ids, packet_class_names = [list(x) for x in zip( *sorted(zip(packet_ids, packet_class_names), key=lambda pair: pair[0]))] # type: ignore mod_rs_dir = f'../azalea-protocol/src/packets/{state}/mod.rs' @@ -132,7 +132,7 @@ def set_packets(packet_ids: list[int], packet_class_names: list[str], direction: new_mod_rs.append(line) if direction == 'serverbound': ignore_lines = True - for packet_id, packet_class_name in zipped_packets: + for packet_id, packet_class_name in zip(packet_ids, packet_class_names): new_mod_rs.append( make_packet_mod_rs_line(packet_id, packet_class_name) ) @@ -143,7 +143,7 @@ def set_packets(packet_ids: list[int], packet_class_names: list[str], direction: new_mod_rs.append(line) if direction == 'serverbound': ignore_lines = True - for packet_id, packet_class_name in zipped_packets: + for packet_id, packet_class_name in zip(packet_ids, packet_class_names): new_mod_rs.append( make_packet_mod_rs_line(packet_id, packet_class_name) ) diff --git a/codegen/migrate.py b/codegen/migrate.py index 890186b8..392af9fe 100644 --- a/codegen/migrate.py +++ b/codegen/migrate.py @@ -58,7 +58,6 @@ for (direction, state), packets in group_packets(list(changed_packets.keys())).i new_packet_id = changed_packets[PacketIdentifier( old_packet_id, direction, state)] id_map[old_packet_id] = new_packet_id - lib.code.packet.change_packet_ids(id_map, direction, state)