From e268c4929177e540baa9d2bb29bc171f49cc7a25 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 19 Dec 2024 02:31:08 +0000 Subject: fix incorrect packets --- codegen/lib/code/packet.py | 11 ++++------- codegen/lib/utils.py | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'codegen') diff --git a/codegen/lib/code/packet.py b/codegen/lib/code/packet.py index 71bc3a70..1d60378a 100755 --- a/codegen/lib/code/packet.py +++ b/codegen/lib/code/packet.py @@ -6,9 +6,6 @@ import os import re -def make_packet_mod_rs_line(packet_id: int, packet_class_name: str): - return f' {padded_hex(packet_id)}: {to_snake_case(packet_class_name)}::{to_camel_case(packet_class_name)},' - MOJMAP_TO_AZALEA_STATE_NAME_MAPPING = { # shorter name, i like it more 'configuration': 'config', @@ -62,12 +59,12 @@ def set_packets(packets_report): code.append('') code.append(f'declare_state_packets!({to_camel_case(state)}Packet,') code.append(' Clientbound => [') - for packet_name in clientbound_packets: - code.append(f' {packet_name},') + for packet_id, packet_name in enumerate(clientbound_packets): + code.append(f' {packet_name}, // {padded_hex(packet_id)}') code.append(' ],') code.append(' Serverbound => [') - for packet_name in serverbound_packets: - code.append(f' {packet_name},') + for packet_id, packet_name in enumerate(serverbound_packets): + code.append(f' {packet_name}, // {padded_hex(packet_id)}') code.append(' ]') code.append(');') code.append('') diff --git a/codegen/lib/utils.py b/codegen/lib/utils.py index efabbb38..162dd0fa 100755 --- a/codegen/lib/utils.py +++ b/codegen/lib/utils.py @@ -25,7 +25,7 @@ def upper_first_letter(name: str): def padded_hex(n: int): - return f'0x{n:02x}' + return f'0x{n:02X}' class PacketIdentifier: -- cgit v1.2.3