aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib/code/registry.py
diff options
context:
space:
mode:
Diffstat (limited to 'codegen/lib/code/registry.py')
-rwxr-xr-xcodegen/lib/code/registry.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/codegen/lib/code/registry.py b/codegen/lib/code/registry.py
index 86f5f02d..1e9d9f43 100755
--- a/codegen/lib/code/registry.py
+++ b/codegen/lib/code/registry.py
@@ -56,7 +56,14 @@ impl<T: Registry> McBufWritable for OptionalRegistry<T> {
# Air => "minecraft:air",
# Stone => "minecraft:stone"
# });
+
+ if registry_name.endswith('_type'):
+ # change _type to _kind because that's Rustier (and because _type
+ # is a reserved keyword)
+ registry_name = registry_name[:-5] + '_kind'
+
registry_struct_name = to_camel_case(registry_name.split(':')[1])
+
code.append(f'registry!({registry_struct_name}, {{')
registry_entries = sorted(
registry['entries'].items(), key=lambda x: x[1]['protocol_id'])