aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2024-12-19 02:31:08 +0000
committermat <git@matdoes.dev>2024-12-19 02:52:41 +0000
commite268c4929177e540baa9d2bb29bc171f49cc7a25 (patch)
tree10146e529088ab823452a5971c0a37a8886b2a68 /codegen/lib
parent1f06a1540f46d8087907566d7c6c1ab397c517ec (diff)
downloadazalea-drasl-e268c4929177e540baa9d2bb29bc171f49cc7a25.tar.xz
fix incorrect packets
Diffstat (limited to 'codegen/lib')
-rwxr-xr-xcodegen/lib/code/packet.py11
-rwxr-xr-xcodegen/lib/utils.py2
2 files changed, 5 insertions, 8 deletions
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: