aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib/code/packet.py
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-09-30 10:56:34 -0500
committerGitHub <noreply@github.com>2025-09-30 10:56:34 -0500
commit643fcb98c0e6cdc63218dd39960d9053b209d9a6 (patch)
tree6bddb7fe39b8fcc3ab3fb2665574533bb227898a /codegen/lib/code/packet.py
parenta80d8d1b242430c4a251876fa67bfd26af7a0de9 (diff)
downloadazalea-drasl-643fcb98c0e6cdc63218dd39960d9053b209d9a6.tar.xz
1.21.9 (#235)
* start updating to 25w33a * 1.21.9-pre2 * clippy * cleanup, and fix c_explode and c_player_rotation * mc update should be in Changed section in the changelog * 1.21.9
Diffstat (limited to 'codegen/lib/code/packet.py')
-rw-r--r--codegen/lib/code/packet.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/codegen/lib/code/packet.py b/codegen/lib/code/packet.py
index 994e21e5..1337ac2e 100644
--- a/codegen/lib/code/packet.py
+++ b/codegen/lib/code/packet.py
@@ -20,8 +20,8 @@ PACKETS_DIR = "../azalea-protocol/src/packets"
def generate_packet(packets_report, packet_name, direction, state):
- mojmap_state = AZALEA_TO_MOJMAP_STATE_NAME_MAPPING.get(state, state)
- _packet_report = packets_report[mojmap_state][direction]["minecraft:" + packet_name]
+ # mojmap_state = AZALEA_TO_MOJMAP_STATE_NAME_MAPPING.get(state, state)
+ # _packet_report = packets_report[mojmap_state][direction]["minecraft:" + packet_name]
code = []
@@ -46,7 +46,11 @@ def generate_packet(packets_report, packet_name, direction, state):
def get_packet_module_name(packet_name: str, direction: str):
- return f"{direction[0]}_{packet_name}"
+ return f"{direction[0]}_{get_packet_partial_module_name(packet_name)}"
+
+
+def get_packet_partial_module_name(packet_name: str):
+ return packet_name.replace("/", "_")
def set_packets(packets_report):
@@ -75,14 +79,14 @@ def set_packets(packets_report):
code.append(f"declare_state_packets!({to_camel_case(state)}Packet,")
code.append(" Clientbound => [")
for packet_id, packet_name in enumerate(clientbound_packets):
- code.append(f" {packet_name},")
+ code.append(f" {get_packet_partial_module_name(packet_name)},")
expected_packet_module_names.add(
get_packet_module_name(packet_name, "clientbound")
)
code.append(" ],")
code.append(" Serverbound => [")
for packet_id, packet_name in enumerate(serverbound_packets):
- code.append(f" {packet_name},")
+ code.append(f" {get_packet_partial_module_name(packet_name)},")
expected_packet_module_names.add(
get_packet_module_name(packet_name, "serverbound")
)