diff options
| author | mat <git@matdoes.dev> | 2026-03-02 18:53:36 -0530 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-03-02 19:23:44 -0500 |
| commit | 782db2e05cb9ea1b8dbd1ab7f5ff2eac29737fef (patch) | |
| tree | 2f420e585267098189c94ecae2dc886c4136216f /codegen/lib/utils.py | |
| parent | 8fd11c174d921a8085bb7e67ae62958e23d174cb (diff) | |
| download | azalea-drasl-782db2e05cb9ea1b8dbd1ab7f5ff2eac29737fef.tar.xz | |
disambiguate non-minecraft identifier namespaces in codegen
Diffstat (limited to 'codegen/lib/utils.py')
| -rw-r--r-- | codegen/lib/utils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/codegen/lib/utils.py b/codegen/lib/utils.py index 8d1e8756..52c7206c 100644 --- a/codegen/lib/utils.py +++ b/codegen/lib/utils.py @@ -66,3 +66,15 @@ def group_packets(packets: list[PacketIdentifier]): def get_dir_location(name: str): return os.path.join(os.path.dirname(os.path.dirname(__file__)), name) + +def identifier_to_namespace(ident: str): + return ident.split(":")[0] +def identifier_to_path(ident: str): + if ":" not in ident: + return ident + + namespace, path = ident.lstrip("#").split(":") + if namespace in {"minecraft", "brigadier"}: + return path + # support for mods + return f"{namespace}_{path}" |
