minecraft-datapack-language 15.1.54__py3-none-any.whl → 15.1.56__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.54'
32
- __version_tuple__ = version_tuple = (15, 1, 54)
31
+ __version__ = version = '15.1.56'
32
+ __version_tuple__ = version_tuple = (15, 1, 56)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -101,6 +101,12 @@ def _merge_mdl_files(files: List[Path], verbose: bool = False, error_collector:
101
101
  ast['variables'] = []
102
102
  ast['variables'].extend(additional_ast['variables'])
103
103
 
104
+ # Merge namespaces (append to existing list)
105
+ if 'namespaces' in additional_ast:
106
+ if 'namespaces' not in ast:
107
+ ast['namespaces'] = []
108
+ ast['namespaces'].extend(additional_ast['namespaces'])
109
+
104
110
  # Merge registry declarations
105
111
  for registry_type in ['recipes', 'loot_tables', 'advancements', 'predicates', 'item_modifiers', 'structures']:
106
112
  if registry_type in additional_ast:
@@ -304,14 +310,25 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
304
310
 
305
311
 
306
312
  def _generate_function_file(ast: Dict[str, Any], output_dir: Path, namespace: str, verbose: bool = False, build_context: BuildContext = None) -> None:
307
- """Generate function files from the AST."""
313
+ """Generate function files from the AST for a specific namespace."""
308
314
  if build_context is None:
309
315
  build_context = BuildContext()
310
316
 
311
317
  if 'functions' not in ast:
312
318
  return
313
319
 
320
+ # Filter functions by namespace
321
+ namespace_functions = []
314
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:
315
332
  func_name = func['name']
316
333
  func_body = func.get('body', [])
317
334
 
@@ -718,29 +735,47 @@ def build_mdl(input_path: str, output_path: str, verbose: bool = False, pack_for
718
735
  # Generate pack.mcmeta
719
736
  _generate_pack_mcmeta(ast, output_dir)
720
737
 
721
- # Get namespace from AST or fall back to pack name
722
- namespace = ast.get('namespace', {}).get('name', ast.get('pack', {}).get('name', 'mdl_pack'))
723
- 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']))
724
746
 
725
- # 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
726
753
  if verbose:
727
- print(f"DEBUG: AST namespace: {ast.get('namespace', {})}")
754
+ print(f"DEBUG: AST namespaces: {ast.get('namespaces', [])}")
728
755
  print(f"DEBUG: AST pack: {ast.get('pack', {})}")
729
- print(f"DEBUG: Using namespace: {namespace}")
756
+ print(f"DEBUG: Using namespaces: {namespaces}")
730
757
 
731
- # Generate functions
758
+ # Generate functions for each namespace
732
759
  build_context = BuildContext()
733
- _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)
734
764
 
735
- # Generate hook files (load/tick tags)
736
- _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)
737
768
 
738
- # Generate global load function
739
- _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)
740
771
 
741
772
  # Create zip file (always create one, use wrapper name if specified)
742
773
  zip_name = wrapper if wrapper else output_dir.name
743
- zip_path = output_dir / 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"
744
779
  _create_zip_file(output_dir, zip_path)
745
780
  if verbose:
746
781
  print(f"[ZIP] Created zip file: {zip_path}")
@@ -39,7 +39,7 @@ def create_new_project(project_name: str, pack_name: str = None, pack_format: in
39
39
  project_dir.mkdir(parents=True, exist_ok=False)
40
40
 
41
41
  # Create the main MDL file
42
- mdl_file = project_dir / f"{clean_name}.mdl"
42
+ mdl_file = project_dir / "main.mdl"
43
43
 
44
44
  # Generate template content
45
45
  template_content = _generate_mdl_template(clean_name, pack_name, pack_format)
@@ -61,9 +61,9 @@ def create_new_project(project_name: str, pack_name: str = None, pack_format: in
61
61
  print()
62
62
  print("[NEXT] Next steps:")
63
63
  print(f" 1. cd {clean_name}")
64
- print(f" 2. Edit {clean_name}.mdl with your code")
65
- print(f" 3. mdl build --mdl {clean_name}.mdl -o dist")
66
- print(f" 4. mdl check {clean_name}.mdl")
64
+ print(f" 2. Edit main.mdl with your code")
65
+ print(f" 3. mdl build --mdl main.mdl -o dist")
66
+ print(f" 4. mdl check main.mdl")
67
67
  print()
68
68
  print("[INFO] Learn more:")
69
69
  print(" • Language Reference: https://www.mcmdl.com/docs/language-reference")
@@ -168,7 +168,7 @@ This datapack was generated using the MDL CLI tool. MDL is a simplified language
168
168
  ```
169
169
  {project_name}/
170
170
  ├── README.md # This file
171
- └── {project_name}.mdl # Main MDL source file
171
+ └── main.mdl # Main MDL source file
172
172
  ```
173
173
 
174
174
  ## [NEXT] Getting Started
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: minecraft-datapack-language
3
- Version: 15.1.54
3
+ Version: 15.1.56
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,11 +1,11 @@
1
1
  minecraft_datapack_language/__init__.py,sha256=i-qCchbe5b2Fshgc6yCU9mddOLs2UBt9SAcLqfUIrT0,606
2
- minecraft_datapack_language/_version.py,sha256=MJnAS01Xj9LllNeVM6ZB7QjcnbHlUMSoJJjZit4by0o,708
2
+ minecraft_datapack_language/_version.py,sha256=NjQZ_VQk7ObXSEZETeVAj46ARCqVlJIGL9t_gOTOncA,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=JPQmdr7DbVCZ0Ra5-svhaPlBEuu7drtMFb5vjGLkL4Y,32440
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
- minecraft_datapack_language/cli_new.py,sha256=KGbKcZW3POwZFAS0nzcwl2NoTUygXzwcUe-iWYyPKEg,8268
8
+ minecraft_datapack_language/cli_new.py,sha256=uaKH0VBC43XBt_Hztc35-BfC9bYlsDdLbAfe_42rrtI,8235
9
9
  minecraft_datapack_language/cli_utils.py,sha256=gLGe2nAn8pLiSJhn-DpNvMxo0th_Gj89I-oSeyPx4zU,9293
10
10
  minecraft_datapack_language/dir_map.py,sha256=HmxFkuvWGkzHF8o_GFb4BpuMCRc6QMw8UbmcAI8JVdY,1788
11
11
  minecraft_datapack_language/expression_processor.py,sha256=GN6cuRNvgI8TrV6YnEHrA9P0X-ACTT7rCBh4WlOPjSI,20140
@@ -16,9 +16,9 @@ minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYa
16
16
  minecraft_datapack_language/mdl_parser_js.py,sha256=Ng22mKVbMNC4412Xb09i8fcNFPTPrW4NxFeK7Tv7EBQ,38539
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.54.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
20
- minecraft_datapack_language-15.1.54.dist-info/METADATA,sha256=PsesUE-ZUUVm84GX7i-kS2JtAZ1oQD3QApGhICUb_aU,35230
21
- minecraft_datapack_language-15.1.54.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- minecraft_datapack_language-15.1.54.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
23
- minecraft_datapack_language-15.1.54.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
24
- minecraft_datapack_language-15.1.54.dist-info/RECORD,,
19
+ minecraft_datapack_language-15.1.56.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
20
+ minecraft_datapack_language-15.1.56.dist-info/METADATA,sha256=vqfaptGPBT4zrlKxlQ3Vkrgirq72swYQtJstr8BWjQU,35230
21
+ minecraft_datapack_language-15.1.56.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ minecraft_datapack_language-15.1.56.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
23
+ minecraft_datapack_language-15.1.56.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
24
+ minecraft_datapack_language-15.1.56.dist-info/RECORD,,