minecraft-datapack-language 15.1.52__py3-none-any.whl → 15.1.54__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.52'
32
- __version_tuple__ = version_tuple = (15, 1, 52)
31
+ __version__ = version = '15.1.54'
32
+ __version_tuple__ = version_tuple = (15, 1, 54)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -355,8 +355,17 @@ def _generate_hook_files(ast: Dict[str, Any], output_dir: Path, namespace: str,
355
355
  load_tag_dir = output_dir / "data" / "minecraft" / "tags" / "function"
356
356
  ensure_dir(str(load_tag_dir))
357
357
 
358
+ # Start with the load function
359
+ load_values = [f"{namespace}:load"]
360
+
361
+ # Add functions specified in on_load hooks
362
+ if 'hooks' in ast:
363
+ for hook in ast['hooks']:
364
+ if hook['hook_type'] == 'load':
365
+ load_values.append(hook['function_name'])
366
+
358
367
  load_tag_content = {
359
- "values": [f"{namespace}:load"]
368
+ "values": load_values
360
369
  }
361
370
  write_json(str(load_tag_dir / "load.json"), load_tag_content)
362
371
 
@@ -729,12 +738,12 @@ def build_mdl(input_path: str, output_path: str, verbose: bool = False, pack_for
729
738
  # Generate global load function
730
739
  _generate_global_load_function(ast, output_dir, namespace, build_context)
731
740
 
732
- # Create zip file if wrapper is specified
733
- if wrapper:
734
- zip_path = output_dir.parent / f"{wrapper}.zip"
735
- _create_zip_file(output_dir, zip_path)
736
- if verbose:
737
- print(f"[ZIP] Created zip file: {zip_path}")
741
+ # Create zip file (always create one, use wrapper name if specified)
742
+ zip_name = wrapper if wrapper else output_dir.name
743
+ zip_path = output_dir / f"{zip_name}.zip"
744
+ _create_zip_file(output_dir, zip_path)
745
+ if verbose:
746
+ print(f"[ZIP] Created zip file: {zip_path}")
738
747
 
739
748
  print(f"[OK] Successfully built datapack: {output_path}")
740
749
  if verbose:
@@ -2,6 +2,7 @@
2
2
  CLI Check Functions - Validation and error checking for MDL files
3
3
  """
4
4
 
5
+ import sys
5
6
  from pathlib import Path
6
7
  from typing import Optional
7
8
 
@@ -42,7 +43,36 @@ def lint_mdl_file_wrapper(file_path: str, verbose: bool = False, ignore_warnings
42
43
 
43
44
  # Perform linting
44
45
  try:
45
- lint_mdl_file(str(path))
46
+ issues = lint_mdl_file(str(path))
47
+
48
+ # Check if there are any errors
49
+ errors = [issue for issue in issues if issue.severity == 'error']
50
+ warnings = [issue for issue in issues if issue.severity == 'warning']
51
+
52
+ if errors:
53
+ # Report errors
54
+ print(f"[CHECK] Found {len(errors)} error(s) in: {file_path}")
55
+ for i, issue in enumerate(errors, 1):
56
+ print(f"Error {i}: {issue.message}")
57
+ if issue.suggestion:
58
+ print(f" Suggestion: {issue.suggestion}")
59
+ if issue.code:
60
+ print(f" Code: {issue.code}")
61
+ print()
62
+
63
+ # Exit with error code
64
+ sys.exit(1)
65
+ elif warnings and not ignore_warnings:
66
+ # Report warnings
67
+ print(f"[CHECK] Found {len(warnings)} warning(s) in: {file_path}")
68
+ for i, issue in enumerate(warnings, 1):
69
+ print(f"Warning {i}: {issue.message}")
70
+ if issue.suggestion:
71
+ print(f" Suggestion: {issue.suggestion}")
72
+ if issue.code:
73
+ print(f" Code: {issue.code}")
74
+ print()
75
+
46
76
  print(f"[CHECK] Successfully checked: {file_path}")
47
77
  print("[OK] No errors found!")
48
78
 
@@ -42,6 +42,47 @@ class MDLLinter:
42
42
  return self.issues
43
43
 
44
44
  try:
45
+ # First, try to parse the file with the actual parser to catch syntax errors
46
+ try:
47
+ from .mdl_parser_js import parse_mdl_js
48
+ with open(file_path, 'r', encoding='utf-8') as f:
49
+ source = f.read()
50
+
51
+ # Parse the file - this will catch syntax errors like missing semicolons
52
+ parse_mdl_js(source, file_path)
53
+
54
+ except Exception as parse_error:
55
+ # If parsing fails, add the error to our issues
56
+ error_message = str(parse_error)
57
+ if "Expected SEMICOLON" in error_message:
58
+ # Extract line and column from the error message
59
+ import re
60
+ line_match = re.search(r'Line: (\d+)', error_message)
61
+ column_match = re.search(r'Column: (\d+)', error_message)
62
+ line_num = int(line_match.group(1)) if line_match else 1
63
+ column_num = int(column_match.group(1)) if column_match else 1
64
+
65
+ self.issues.append(MDLLintIssue(
66
+ line_number=line_num,
67
+ severity='error',
68
+ category='syntax',
69
+ message="Missing semicolon",
70
+ suggestion="Add a semicolon (;) at the end of the statement",
71
+ code=source.split('\n')[line_num - 1] if line_num <= len(source.split('\n')) else ""
72
+ ))
73
+ else:
74
+ # For other parsing errors, add them as well
75
+ self.issues.append(MDLLintIssue(
76
+ line_number=1,
77
+ severity='error',
78
+ category='syntax',
79
+ message=f"Parsing error: {error_message}",
80
+ suggestion="Check the syntax and fix the reported error",
81
+ code=""
82
+ ))
83
+ return self.issues
84
+
85
+ # If parsing succeeds, do additional linting checks
45
86
  with open(file_path, 'r', encoding='utf-8') as f:
46
87
  lines = f.readlines()
47
88
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: minecraft-datapack-language
3
- Version: 15.1.52
3
+ Version: 15.1.54
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,9 +1,9 @@
1
1
  minecraft_datapack_language/__init__.py,sha256=i-qCchbe5b2Fshgc6yCU9mddOLs2UBt9SAcLqfUIrT0,606
2
- minecraft_datapack_language/_version.py,sha256=e7LI5GHD8E_AkxUwqvouD-eLBRqOyRBFHuHDGo6xIv8,708
2
+ minecraft_datapack_language/_version.py,sha256=MJnAS01Xj9LllNeVM6ZB7QjcnbHlUMSoJJjZit4by0o,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=tT00tCj384d0aZYNYP19TosuEydVVxMEogk8B5lj_48,32115
6
- minecraft_datapack_language/cli_check.py,sha256=vzSD9w0_TUcNrfYQBlAmDljiMlnuf8QL_j5HrAwhuYE,4950
5
+ minecraft_datapack_language/cli_build.py,sha256=JPQmdr7DbVCZ0Ra5-svhaPlBEuu7drtMFb5vjGLkL4Y,32440
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=KGbKcZW3POwZFAS0nzcwl2NoTUygXzwcUe-iWYyPKEg,8268
9
9
  minecraft_datapack_language/cli_utils.py,sha256=gLGe2nAn8pLiSJhn-DpNvMxo0th_Gj89I-oSeyPx4zU,9293
@@ -12,13 +12,13 @@ minecraft_datapack_language/expression_processor.py,sha256=GN6cuRNvgI8TrV6YnEHrA
12
12
  minecraft_datapack_language/linter.py,sha256=7UqbygC5JPCGg-BSOq65NB2xEJBu_OUOYIIgmHItO2M,16567
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
- minecraft_datapack_language/mdl_linter.py,sha256=pa1BGx9UWXkF-iKh4XNHpuh0zIaOEYt9pwMa-NjxWaw,15129
15
+ minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYaLDcGNRAl-RAI,17253
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.52.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
20
- minecraft_datapack_language-15.1.52.dist-info/METADATA,sha256=LTNaPMXjaitPT-Hnqk4VUJ93prVA28h-_Zib1XdFxXI,35230
21
- minecraft_datapack_language-15.1.52.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- minecraft_datapack_language-15.1.52.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
23
- minecraft_datapack_language-15.1.52.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
24
- minecraft_datapack_language-15.1.52.dist-info/RECORD,,
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,,