minecraft-datapack-language 15.1.55__py3-none-any.whl → 15.1.57__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '15.1.55'
32
- __version_tuple__ = version_tuple = (15, 1, 55)
31
+ __version__ = version = '15.1.57'
32
+ __version_tuple__ = version_tuple = (15, 1, 57)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -310,14 +310,25 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
310
310
 
311
311
 
312
312
  def _generate_function_file(ast: Dict[str, Any], output_dir: Path, namespace: str, verbose: bool = False, build_context: BuildContext = None) -> None:
313
- """Generate function files from the AST."""
313
+ """Generate function files from the AST for a specific namespace."""
314
314
  if build_context is None:
315
315
  build_context = BuildContext()
316
316
 
317
317
  if 'functions' not in ast:
318
318
  return
319
319
 
320
+ # Filter functions by namespace
321
+ namespace_functions = []
320
322
  for func in ast['functions']:
323
+ # Check if function belongs to this namespace
324
+ # For now, we'll generate all functions in all namespaces
325
+ # In the future, we could add namespace annotations to functions
326
+ namespace_functions.append(func)
327
+
328
+ if verbose:
329
+ print(f"DEBUG: Processing {len(namespace_functions)} functions for namespace {namespace}")
330
+
331
+ for func in namespace_functions:
321
332
  func_name = func['name']
322
333
  func_body = func.get('body', [])
323
334
 
@@ -724,29 +735,47 @@ def build_mdl(input_path: str, output_path: str, verbose: bool = False, pack_for
724
735
  # Generate pack.mcmeta
725
736
  _generate_pack_mcmeta(ast, output_dir)
726
737
 
727
- # Get namespace from AST or fall back to pack name
728
- namespace = ast.get('namespace', {}).get('name', ast.get('pack', {}).get('name', 'mdl_pack'))
729
- namespace = _slugify(namespace)
738
+ # Handle multiple namespaces from multiple files
739
+ namespaces = []
740
+
741
+ # Get namespaces from AST
742
+ if 'namespaces' in ast:
743
+ for ns in ast['namespaces']:
744
+ if 'name' in ns:
745
+ namespaces.append(_slugify(ns['name']))
730
746
 
731
- # Debug: Show what namespace we're using
747
+ # If no explicit namespaces, use the pack name as default
748
+ if not namespaces:
749
+ default_namespace = ast.get('pack', {}).get('name', 'mdl_pack')
750
+ namespaces.append(_slugify(default_namespace))
751
+
752
+ # Debug: Show what namespaces we're using
732
753
  if verbose:
733
- print(f"DEBUG: AST namespace: {ast.get('namespace', {})}")
754
+ print(f"DEBUG: AST namespaces: {ast.get('namespaces', [])}")
734
755
  print(f"DEBUG: AST pack: {ast.get('pack', {})}")
735
- print(f"DEBUG: Using namespace: {namespace}")
756
+ print(f"DEBUG: Using namespaces: {namespaces}")
736
757
 
737
- # Generate functions
758
+ # Generate functions for each namespace
738
759
  build_context = BuildContext()
739
- _generate_function_file(ast, output_dir, namespace, verbose, build_context)
760
+ for namespace in namespaces:
761
+ if verbose:
762
+ print(f"DEBUG: Processing namespace: {namespace}")
763
+ _generate_function_file(ast, output_dir, namespace, verbose, build_context)
740
764
 
741
- # Generate hook files (load/tick tags)
742
- _generate_hook_files(ast, output_dir, namespace, build_context)
765
+ # Generate hook files (load/tick tags) - use first namespace for global functions
766
+ primary_namespace = namespaces[0] if namespaces else 'mdl_pack'
767
+ _generate_hook_files(ast, output_dir, primary_namespace, build_context)
743
768
 
744
- # Generate global load function
745
- _generate_global_load_function(ast, output_dir, namespace, build_context)
769
+ # Generate global load function - use first namespace for global functions
770
+ _generate_global_load_function(ast, output_dir, primary_namespace, build_context)
746
771
 
747
772
  # Create zip file (always create one, use wrapper name if specified)
748
773
  zip_name = wrapper if wrapper else output_dir.name
749
- zip_path = output_dir.parent / f"{zip_name}.zip"
774
+ # When using wrapper, create zip in output directory; otherwise in parent directory
775
+ if wrapper:
776
+ zip_path = output_dir / f"{zip_name}.zip"
777
+ else:
778
+ zip_path = output_dir.parent / f"{zip_name}.zip"
750
779
  _create_zip_file(output_dir, zip_path)
751
780
  if verbose:
752
781
  print(f"[ZIP] Created zip file: {zip_path}")
@@ -51,7 +51,12 @@ class MDLParser:
51
51
  ast['pack'] = self._parse_pack_declaration()
52
52
  elif self._peek().type == TokenType.NAMESPACE:
53
53
  namespace_decl = self._parse_namespace_declaration()
54
+ # Store namespace in both places for compatibility
54
55
  ast['namespace'] = namespace_decl
56
+ # Also collect all namespaces in a list
57
+ if 'namespaces' not in ast:
58
+ ast['namespaces'] = []
59
+ ast['namespaces'].append(namespace_decl)
55
60
  self.current_namespace = namespace_decl['name'] # Update current namespace
56
61
  print(f"DEBUG: Parser updated current_namespace to: {self.current_namespace}")
57
62
  elif self._peek().type == TokenType.FUNCTION:
@@ -672,10 +677,8 @@ class MDLParser:
672
677
  say_token = self._match(TokenType.SAY)
673
678
  content = say_token.value
674
679
 
675
- # The semicolon should already be consumed by the lexer
676
- # But let's make sure we have it
677
- if not self._is_at_end() and self._peek().type == TokenType.SEMICOLON:
678
- self._match(TokenType.SEMICOLON)
680
+ # Always consume the semicolon
681
+ self._match(TokenType.SEMICOLON)
679
682
 
680
683
  return {"type": "command", "command": f"say {content}"}
681
684
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: minecraft-datapack-language
3
- Version: 15.1.55
3
+ Version: 15.1.57
4
4
  Summary: Compile JavaScript-style MDL language or Python API into a Minecraft datapack (1.21+ ready). Features variables, control flow, error handling, and VS Code extension.
5
5
  Project-URL: Homepage, https://www.mcmdl.com
6
6
  Project-URL: Documentation, https://www.mcmdl.com/docs
@@ -1,8 +1,8 @@
1
1
  minecraft_datapack_language/__init__.py,sha256=i-qCchbe5b2Fshgc6yCU9mddOLs2UBt9SAcLqfUIrT0,606
2
- minecraft_datapack_language/_version.py,sha256=NQnt-crdDKDeC7jaDFNdbb6plbYvj8ruHh-M1rXOL3I,708
2
+ minecraft_datapack_language/_version.py,sha256=e1wftaollHKfwpV3prM6DMSEbZLFxc5I0T97bqT1AXA,708
3
3
  minecraft_datapack_language/ast_nodes.py,sha256=pgjI2Nlap3ixFPgWqGSkqncG9zB91h5BKgRjtcJqMew,2118
4
4
  minecraft_datapack_language/cli.py,sha256=p5A_tEEXugN2NhQFbbgfwi4FxbWYD91RWeKR_A3Vuec,6263
5
- minecraft_datapack_language/cli_build.py,sha256=jtBBQiyySb1zQS2ShiaM0LHSP2LR51ILlrgNfYPYfAE,32722
5
+ minecraft_datapack_language/cli_build.py,sha256=H_bjXj1Ch8A6CZ9yZWmeoXay6IiBQCSDxpRJozvCt-E,34048
6
6
  minecraft_datapack_language/cli_check.py,sha256=bPq9gHsxQ1CIiftkrAtRCifWkVAyjp5c8Oay2NNQ1qs,6277
7
7
  minecraft_datapack_language/cli_help.py,sha256=jUTHUQBONAZKVTdQK9tNPXq4c_6xpsafNOvHDjkEldg,12243
8
8
  minecraft_datapack_language/cli_new.py,sha256=uaKH0VBC43XBt_Hztc35-BfC9bYlsDdLbAfe_42rrtI,8235
@@ -13,12 +13,12 @@ minecraft_datapack_language/linter.py,sha256=7UqbygC5JPCGg-BSOq65NB2xEJBu_OUOYII
13
13
  minecraft_datapack_language/mdl_errors.py,sha256=a_-683gjF3gfGRpDMbRgCXmXD9_aYYBmLodNH6fe29A,11596
14
14
  minecraft_datapack_language/mdl_lexer_js.py,sha256=G2leNsQz7792uiGig7d1AcQCOFNnmACJD_pXI0wTxGc,26169
15
15
  minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYaLDcGNRAl-RAI,17253
16
- minecraft_datapack_language/mdl_parser_js.py,sha256=Ng22mKVbMNC4412Xb09i8fcNFPTPrW4NxFeK7Tv7EBQ,38539
16
+ minecraft_datapack_language/mdl_parser_js.py,sha256=4VMWx6O7A10afTzjGnnwL_Sh52osIO84ObqHp8KoDZw,38677
17
17
  minecraft_datapack_language/pack.py,sha256=nYiXQ3jgJlDfc4m-65f7C2LFhDRioaUU_XVy6Na4SJI,34625
18
18
  minecraft_datapack_language/utils.py,sha256=Aq0HAGlXqj9BUTEjaEilpvzEW0EtZYYMMwOqG9db6dE,684
19
- minecraft_datapack_language-15.1.55.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
20
- minecraft_datapack_language-15.1.55.dist-info/METADATA,sha256=INh-sneVWPG4lLmN7cmitdRDplKFW-zuFb9SFAIRsYA,35230
21
- minecraft_datapack_language-15.1.55.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- minecraft_datapack_language-15.1.55.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
23
- minecraft_datapack_language-15.1.55.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
24
- minecraft_datapack_language-15.1.55.dist-info/RECORD,,
19
+ minecraft_datapack_language-15.1.57.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
20
+ minecraft_datapack_language-15.1.57.dist-info/METADATA,sha256=UcRKDAB72tkMNUxciAVTy8fl24H_mWGhhLg__RdQ9Q0,35230
21
+ minecraft_datapack_language-15.1.57.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ minecraft_datapack_language-15.1.57.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
23
+ minecraft_datapack_language-15.1.57.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
24
+ minecraft_datapack_language-15.1.57.dist-info/RECORD,,