minecraft-datapack-language 15.1.87__py3-none-any.whl → 15.1.89__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.
- minecraft_datapack_language/_version.py +2 -2
- minecraft_datapack_language/cli_build.py +19 -29
- {minecraft_datapack_language-15.1.87.dist-info → minecraft_datapack_language-15.1.89.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-15.1.87.dist-info → minecraft_datapack_language-15.1.89.dist-info}/RECORD +8 -8
- {minecraft_datapack_language-15.1.87.dist-info → minecraft_datapack_language-15.1.89.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.1.87.dist-info → minecraft_datapack_language-15.1.89.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.1.87.dist-info → minecraft_datapack_language-15.1.89.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.1.87.dist-info → minecraft_datapack_language-15.1.89.dist-info}/top_level.txt +0 -0
@@ -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.
|
32
|
-
__version_tuple__ = version_tuple = (15, 1,
|
31
|
+
__version__ = version = '15.1.89'
|
32
|
+
__version_tuple__ = version_tuple = (15, 1, 89)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -283,7 +283,7 @@ def _process_say_command_with_variables(content: str, selector: str) -> str:
|
|
283
283
|
return f'tellraw @a [{components_str}]'
|
284
284
|
|
285
285
|
|
286
|
-
def _process_statement(statement: Any, namespace: str, function_name: str, statement_index: int = 0, is_tag_function: bool = False, selector: str = "@s", variable_scopes: Dict[str, str] = None, build_context: BuildContext = None) -> List[str]:
|
286
|
+
def _process_statement(statement: Any, namespace: str, function_name: str, statement_index: int = 0, is_tag_function: bool = False, selector: str = "@s", variable_scopes: Dict[str, str] = None, build_context: BuildContext = None, output_dir: Path = None) -> List[str]:
|
287
287
|
"""Process a single statement and return Minecraft commands."""
|
288
288
|
if variable_scopes is None:
|
289
289
|
variable_scopes = {}
|
@@ -384,13 +384,13 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
384
384
|
# Create conditional function
|
385
385
|
if_commands = []
|
386
386
|
for i, stmt in enumerate(then_body):
|
387
|
-
if_commands.extend(_process_statement(stmt, namespace, if_func_name, i, is_tag_function, selector, variable_scopes, build_context))
|
387
|
+
if_commands.extend(_process_statement(stmt, namespace, if_func_name, i, is_tag_function, selector, variable_scopes, build_context, output_dir))
|
388
388
|
|
389
389
|
# Write conditional function
|
390
390
|
if if_commands:
|
391
|
-
# Use the output directory
|
392
|
-
if
|
393
|
-
if_dir =
|
391
|
+
# Use the output directory parameter
|
392
|
+
if output_dir:
|
393
|
+
if_dir = output_dir / "data" / namespace / "function"
|
394
394
|
else:
|
395
395
|
if_dir = Path(f"data/{namespace}/function")
|
396
396
|
ensure_dir(str(if_dir))
|
@@ -401,7 +401,7 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
401
401
|
if else_body:
|
402
402
|
else_commands = []
|
403
403
|
for i, stmt in enumerate(else_body):
|
404
|
-
else_commands.extend(_process_statement(stmt, namespace, else_func_name, i, is_tag_function, selector, variable_scopes, build_context))
|
404
|
+
else_commands.extend(_process_statement(stmt, namespace, else_func_name, i, is_tag_function, selector, variable_scopes, build_context, output_dir))
|
405
405
|
|
406
406
|
if else_commands:
|
407
407
|
with open(if_dir / f"{else_func_name}.mcfunction", 'w', encoding='utf-8') as f:
|
@@ -418,7 +418,7 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
418
418
|
|
419
419
|
elif statement['type'] == 'while_loop' or statement['type'] == 'while_statement':
|
420
420
|
# Handle while loops using recursion
|
421
|
-
loop_commands = _process_while_loop_recursion(statement, namespace, function_name, statement_index, is_tag_function, selector, variable_scopes, build_context)
|
421
|
+
loop_commands = _process_while_loop_recursion(statement, namespace, function_name, statement_index, is_tag_function, selector, variable_scopes, build_context, output_dir)
|
422
422
|
commands.extend(loop_commands)
|
423
423
|
|
424
424
|
elif statement['type'] == 'function_call':
|
@@ -464,7 +464,7 @@ def _generate_function_file(ast: Dict[str, Any], output_dir: Path, namespace: st
|
|
464
464
|
for i, statement in enumerate(func_body):
|
465
465
|
try:
|
466
466
|
print(f"DEBUG: Processing statement {i} of type {statement.get('type', 'unknown')}: {statement}")
|
467
|
-
commands = _process_statement(statement, namespace, func_name, i, False, "@s", {}, build_context)
|
467
|
+
commands = _process_statement(statement, namespace, func_name, i, False, "@s", {}, build_context, output_dir)
|
468
468
|
function_commands.extend(commands)
|
469
469
|
print(f"Generated {len(commands)} commands for statement {i} in function {func_name}: {commands}")
|
470
470
|
except Exception as e:
|
@@ -605,7 +605,7 @@ def _collect_conditional_functions(if_statement, namespace: str, function_name:
|
|
605
605
|
return conditional_functions
|
606
606
|
|
607
607
|
|
608
|
-
def _process_while_loop_recursion(while_statement, namespace: str, function_name: str, statement_index: int, is_tag_function: bool = False, selector: str = "@s", variable_scopes: Dict[str, str] = None, build_context: BuildContext = None) -> List[str]:
|
608
|
+
def _process_while_loop_recursion(while_statement, namespace: str, function_name: str, statement_index: int, is_tag_function: bool = False, selector: str = "@s", variable_scopes: Dict[str, str] = None, build_context: BuildContext = None, output_dir: Path = None) -> List[str]:
|
609
609
|
"""Process while loops using recursive function calls."""
|
610
610
|
if variable_scopes is None:
|
611
611
|
variable_scopes = {}
|
@@ -616,44 +616,34 @@ def _process_while_loop_recursion(while_statement, namespace: str, function_name
|
|
616
616
|
condition = while_statement['condition']
|
617
617
|
body = while_statement['body']
|
618
618
|
|
619
|
-
print(f"DEBUG: _process_while_loop_recursion called with namespace={namespace}, function_name={function_name}, statement_index={statement_index}")
|
620
|
-
|
621
619
|
# Generate unique function names - they should be the same according to the test
|
622
620
|
loop_func_name = f"test_{function_name}_while_{statement_index}"
|
623
621
|
|
624
|
-
print(f"DEBUG: Generated function name: loop_func_name={loop_func_name}")
|
625
|
-
|
626
622
|
# Process loop body
|
627
623
|
body_commands = []
|
628
624
|
for i, stmt in enumerate(body):
|
629
|
-
body_commands.extend(_process_statement(stmt, namespace, loop_func_name, i, is_tag_function, selector, variable_scopes, build_context))
|
630
|
-
|
631
|
-
print(f"DEBUG: Generated body_commands: {body_commands}")
|
625
|
+
body_commands.extend(_process_statement(stmt, namespace, loop_func_name, i, is_tag_function, selector, variable_scopes, build_context, output_dir))
|
632
626
|
|
633
627
|
# Add the recursive call to the loop body
|
634
628
|
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector)
|
635
629
|
body_commands.append(f"execute if {minecraft_condition} run function {namespace}:{loop_func_name}")
|
636
630
|
|
637
|
-
print(f"DEBUG: Final body_commands with recursive call: {body_commands}")
|
638
|
-
|
639
631
|
# Write the single loop function
|
640
632
|
if body_commands:
|
641
|
-
# Use the output directory
|
642
|
-
if
|
643
|
-
func_dir =
|
633
|
+
# Use the output directory parameter
|
634
|
+
if output_dir:
|
635
|
+
func_dir = output_dir / "data" / namespace / "function"
|
644
636
|
else:
|
645
637
|
func_dir = Path(f"data/{namespace}/function")
|
646
638
|
ensure_dir(str(func_dir))
|
647
|
-
print(f"DEBUG: Writing loop function to: {func_dir / f'{loop_func_name}.mcfunction'}")
|
648
639
|
with open(func_dir / f"{loop_func_name}.mcfunction", 'w', encoding='utf-8') as f:
|
649
640
|
f.write('\n'.join(body_commands))
|
650
|
-
print(f"DEBUG: Successfully wrote loop function file")
|
651
641
|
|
652
642
|
# Return the command to start the loop with conditional execution
|
653
643
|
return [f"execute if {minecraft_condition} run function {namespace}:{loop_func_name}"]
|
654
644
|
|
655
645
|
|
656
|
-
def _process_while_loop_schedule(while_statement, namespace: str, function_name: str, statement_index: int, is_tag_function: bool = False, selector: str = "@s", variable_scopes: Dict[str, str] = None, build_context: BuildContext = None) -> List[str]:
|
646
|
+
def _process_while_loop_schedule(while_statement, namespace: str, function_name: str, statement_index: int, is_tag_function: bool = False, selector: str = "@s", variable_scopes: Dict[str, str] = None, build_context: BuildContext = None, output_dir: Path = None) -> List[str]:
|
657
647
|
"""Process while loops using scheduled functions."""
|
658
648
|
if variable_scopes is None:
|
659
649
|
variable_scopes = {}
|
@@ -671,7 +661,7 @@ def _process_while_loop_schedule(while_statement, namespace: str, function_name:
|
|
671
661
|
# Process loop body
|
672
662
|
body_commands = []
|
673
663
|
for i, stmt in enumerate(body):
|
674
|
-
body_commands.extend(_process_statement(stmt, namespace, loop_body_func_name, i, is_tag_function, selector, variable_scopes, build_context))
|
664
|
+
body_commands.extend(_process_statement(stmt, namespace, loop_body_func_name, i, is_tag_function, selector, variable_scopes, build_context, output_dir))
|
675
665
|
|
676
666
|
# Add the loop continuation command
|
677
667
|
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector)
|
@@ -679,9 +669,9 @@ def _process_while_loop_schedule(while_statement, namespace: str, function_name:
|
|
679
669
|
|
680
670
|
# Write loop body function
|
681
671
|
if body_commands:
|
682
|
-
# Use the output directory
|
683
|
-
if
|
684
|
-
func_dir =
|
672
|
+
# Use the output directory parameter
|
673
|
+
if output_dir:
|
674
|
+
func_dir = output_dir / "data" / namespace / "function"
|
685
675
|
else:
|
686
676
|
func_dir = Path(f"data/{namespace}/function")
|
687
677
|
ensure_dir(str(func_dir))
|
@@ -746,7 +736,7 @@ def _ast_to_pack(ast: Dict[str, Any], mdl_files: List[Path]) -> Pack:
|
|
746
736
|
for i, statement in enumerate(func['body']):
|
747
737
|
try:
|
748
738
|
# Use the same processing logic as the build system
|
749
|
-
commands = _process_statement(statement, namespace_name, function_name, i, False, "@s", {}, BuildContext())
|
739
|
+
commands = _process_statement(statement, namespace_name, function_name, i, False, "@s", {}, BuildContext(), None)
|
750
740
|
function.commands.extend(commands)
|
751
741
|
except Exception as e:
|
752
742
|
# If processing fails, try to add as simple command
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 15.1.
|
3
|
+
Version: 15.1.89
|
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=
|
2
|
+
minecraft_datapack_language/_version.py,sha256=ObDGX9vqgStavy3kxAxz1JvfSrbCphoqcEjTATobpMs,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=
|
5
|
+
minecraft_datapack_language/cli_build.py,sha256=Ac4KcP0DQrmyJNVvcWa5C3lJiKNYcKJBSrUyyu8_joQ,41928
|
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
|
@@ -16,9 +16,9 @@ minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYa
|
|
16
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.
|
20
|
-
minecraft_datapack_language-15.1.
|
21
|
-
minecraft_datapack_language-15.1.
|
22
|
-
minecraft_datapack_language-15.1.
|
23
|
-
minecraft_datapack_language-15.1.
|
24
|
-
minecraft_datapack_language-15.1.
|
19
|
+
minecraft_datapack_language-15.1.89.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
20
|
+
minecraft_datapack_language-15.1.89.dist-info/METADATA,sha256=MbIGaFhie0yThP2slKqSU_DXrRaodp-FIxCWYEYf6F8,35230
|
21
|
+
minecraft_datapack_language-15.1.89.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
+
minecraft_datapack_language-15.1.89.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
23
|
+
minecraft_datapack_language-15.1.89.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
24
|
+
minecraft_datapack_language-15.1.89.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|