1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

fix set_packets maybe

This commit is contained in:
mat 2022-05-25 20:24:41 -05:00
parent 9d0de818f8
commit 054c6e678b
2 changed files with 3 additions and 4 deletions

View file

@ -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) assert len(packet_ids) == len(packet_class_names)
# sort the packets by id # 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 *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' 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) new_mod_rs.append(line)
if direction == 'serverbound': if direction == 'serverbound':
ignore_lines = True 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( new_mod_rs.append(
make_packet_mod_rs_line(packet_id, packet_class_name) 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) new_mod_rs.append(line)
if direction == 'serverbound': if direction == 'serverbound':
ignore_lines = True 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( new_mod_rs.append(
make_packet_mod_rs_line(packet_id, packet_class_name) make_packet_mod_rs_line(packet_id, packet_class_name)
) )

View file

@ -58,7 +58,6 @@ for (direction, state), packets in group_packets(list(changed_packets.keys())).i
new_packet_id = changed_packets[PacketIdentifier( new_packet_id = changed_packets[PacketIdentifier(
old_packet_id, direction, state)] old_packet_id, direction, state)]
id_map[old_packet_id] = new_packet_id id_map[old_packet_id] = new_packet_id
lib.code.packet.change_packet_ids(id_map, direction, state) lib.code.packet.change_packet_ids(id_map, direction, state)