From 782db2e05cb9ea1b8dbd1ab7f5ff2eac29737fef Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 2 Mar 2026 18:53:36 -0530 Subject: disambiguate non-minecraft identifier namespaces in codegen --- codegen/lib/utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'codegen/lib/utils.py') 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}" -- cgit v1.2.3