aboutsummaryrefslogtreecommitdiff
path: root/codegen/newpacket.py
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-24 20:28:08 -0500
committermat <github@matdoes.dev>2022-05-24 20:28:08 -0500
commit0a314bca16f6de199c319ffb0d84a5d5c3a61387 (patch)
treeaf5293d0eafb86e12653719b2af0c3f36e8f5663 /codegen/newpacket.py
parent04aea6afaf6819a66181d5d544356764d118b1bb (diff)
downloadazalea-drasl-0a314bca16f6de199c319ffb0d84a5d5c3a61387.tar.xz
rename code-generator to codegen
Diffstat (limited to 'codegen/newpacket.py')
-rw-r--r--codegen/newpacket.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/codegen/newpacket.py b/codegen/newpacket.py
new file mode 100644
index 00000000..f4dc172e
--- /dev/null
+++ b/codegen/newpacket.py
@@ -0,0 +1,17 @@
+from lib import download, packetcodegen # type: ignore
+import sys
+import os
+
+mappings = download.get_mappings_for_version('1.18.2')
+burger_data = download.get_burger_data_for_version('1.18.2')
+
+burger_packets_data = burger_data[0]['packets']['packet']
+packet_id, direction, state = int(sys.argv[1]), sys.argv[2], sys.argv[3]
+print(
+ f'Generating code for packet id: {packet_id} with direction {direction} and state {state}')
+packetcodegen.generate(burger_packets_data, mappings,
+ packet_id, direction, state)
+
+os.system('cd .. && cargo fmt')
+
+print('Done!')