minecraft-datapack-language 15.1.88__py3-none-any.whl → 15.1.90__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 +21 -27
- {minecraft_datapack_language-15.1.88.dist-info → minecraft_datapack_language-15.1.90.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-15.1.88.dist-info → minecraft_datapack_language-15.1.90.dist-info}/RECORD +8 -8
- {minecraft_datapack_language-15.1.88.dist-info → minecraft_datapack_language-15.1.90.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.1.88.dist-info → minecraft_datapack_language-15.1.90.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.1.88.dist-info → minecraft_datapack_language-15.1.90.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.1.88.dist-info → minecraft_datapack_language-15.1.90.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.90'
|
32
|
+
__version_tuple__ = version_tuple = (15, 1, 90)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -261,8 +261,8 @@ def _process_say_command_with_variables(content: str, selector: str) -> str:
|
|
261
261
|
for i, part in enumerate(parts):
|
262
262
|
if i % 2 == 0:
|
263
263
|
# Text part
|
264
|
-
if part: #
|
265
|
-
components.append(f'{{"text":"{part}"}}')
|
264
|
+
if part.strip(): # Only add non-empty text parts
|
265
|
+
components.append(f'{{"text": "{part.strip()}"}}')
|
266
266
|
else:
|
267
267
|
# Variable part
|
268
268
|
var_name = part
|
@@ -278,12 +278,16 @@ def _process_say_command_with_variables(content: str, selector: str) -> str:
|
|
278
278
|
# Simple variable: $variable$ - use server armor stand
|
279
279
|
components.append(f'{{"score":{{"name":"@e[type=armor_stand,tag=mdl_server,limit=1]","objective":"{var_name}"}}}}')
|
280
280
|
|
281
|
-
|
282
|
-
|
281
|
+
for var_name in matches:
|
282
|
+
# Add score component for each variable
|
283
|
+
components.append(f'{{"score": {{"name": "@e[type=armor_stand,tag=mdl_server,limit=1]", "objective": "{var_name}"}}}}')
|
284
|
+
|
285
|
+
# Join components and create tellraw command
|
286
|
+
components_str = ', '.join(components)
|
283
287
|
return f'tellraw @a [{components_str}]'
|
284
288
|
|
285
289
|
|
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]:
|
290
|
+
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
291
|
"""Process a single statement and return Minecraft commands."""
|
288
292
|
if variable_scopes is None:
|
289
293
|
variable_scopes = {}
|
@@ -384,13 +388,13 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
384
388
|
# Create conditional function
|
385
389
|
if_commands = []
|
386
390
|
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))
|
391
|
+
if_commands.extend(_process_statement(stmt, namespace, if_func_name, i, is_tag_function, selector, variable_scopes, build_context, output_dir))
|
388
392
|
|
389
393
|
# Write conditional function
|
390
394
|
if if_commands:
|
391
|
-
# Use the output directory
|
392
|
-
if
|
393
|
-
if_dir =
|
395
|
+
# Use the output directory parameter
|
396
|
+
if output_dir:
|
397
|
+
if_dir = output_dir / "data" / namespace / "function"
|
394
398
|
else:
|
395
399
|
if_dir = Path(f"data/{namespace}/function")
|
396
400
|
ensure_dir(str(if_dir))
|
@@ -401,7 +405,7 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
401
405
|
if else_body:
|
402
406
|
else_commands = []
|
403
407
|
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))
|
408
|
+
else_commands.extend(_process_statement(stmt, namespace, else_func_name, i, is_tag_function, selector, variable_scopes, build_context, output_dir))
|
405
409
|
|
406
410
|
if else_commands:
|
407
411
|
with open(if_dir / f"{else_func_name}.mcfunction", 'w', encoding='utf-8') as f:
|
@@ -418,7 +422,7 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
418
422
|
|
419
423
|
elif statement['type'] == 'while_loop' or statement['type'] == 'while_statement':
|
420
424
|
# 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)
|
425
|
+
loop_commands = _process_while_loop_recursion(statement, namespace, function_name, statement_index, is_tag_function, selector, variable_scopes, build_context, output_dir)
|
422
426
|
commands.extend(loop_commands)
|
423
427
|
|
424
428
|
elif statement['type'] == 'function_call':
|
@@ -464,7 +468,7 @@ def _generate_function_file(ast: Dict[str, Any], output_dir: Path, namespace: st
|
|
464
468
|
for i, statement in enumerate(func_body):
|
465
469
|
try:
|
466
470
|
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)
|
471
|
+
commands = _process_statement(statement, namespace, func_name, i, False, "@s", {}, build_context, output_dir)
|
468
472
|
function_commands.extend(commands)
|
469
473
|
print(f"Generated {len(commands)} commands for statement {i} in function {func_name}: {commands}")
|
470
474
|
except Exception as e:
|
@@ -605,7 +609,7 @@ def _collect_conditional_functions(if_statement, namespace: str, function_name:
|
|
605
609
|
return conditional_functions
|
606
610
|
|
607
611
|
|
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]:
|
612
|
+
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
613
|
"""Process while loops using recursive function calls."""
|
610
614
|
if variable_scopes is None:
|
611
615
|
variable_scopes = {}
|
@@ -616,38 +620,28 @@ def _process_while_loop_recursion(while_statement, namespace: str, function_name
|
|
616
620
|
condition = while_statement['condition']
|
617
621
|
body = while_statement['body']
|
618
622
|
|
619
|
-
print(f"DEBUG: _process_while_loop_recursion called with namespace={namespace}, function_name={function_name}, statement_index={statement_index}")
|
620
|
-
|
621
623
|
# Generate unique function names - they should be the same according to the test
|
622
624
|
loop_func_name = f"test_{function_name}_while_{statement_index}"
|
623
625
|
|
624
|
-
print(f"DEBUG: Generated function name: loop_func_name={loop_func_name}")
|
625
|
-
|
626
626
|
# Process loop body
|
627
627
|
body_commands = []
|
628
628
|
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}")
|
629
|
+
body_commands.extend(_process_statement(stmt, namespace, loop_func_name, i, is_tag_function, selector, variable_scopes, build_context, output_dir))
|
632
630
|
|
633
631
|
# Add the recursive call to the loop body
|
634
632
|
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector)
|
635
633
|
body_commands.append(f"execute if {minecraft_condition} run function {namespace}:{loop_func_name}")
|
636
634
|
|
637
|
-
print(f"DEBUG: Final body_commands with recursive call: {body_commands}")
|
638
|
-
|
639
635
|
# Write the single loop function
|
640
636
|
if body_commands:
|
641
|
-
# Use the output directory
|
642
|
-
if
|
643
|
-
func_dir =
|
637
|
+
# Use the output directory parameter
|
638
|
+
if output_dir:
|
639
|
+
func_dir = output_dir / "data" / namespace / "function"
|
644
640
|
else:
|
645
641
|
func_dir = Path(f"data/{namespace}/function")
|
646
642
|
ensure_dir(str(func_dir))
|
647
|
-
print(f"DEBUG: Writing loop function to: {func_dir / f'{loop_func_name}.mcfunction'}")
|
648
643
|
with open(func_dir / f"{loop_func_name}.mcfunction", 'w', encoding='utf-8') as f:
|
649
644
|
f.write('\n'.join(body_commands))
|
650
|
-
print(f"DEBUG: Successfully wrote loop function file")
|
651
645
|
|
652
646
|
# Return the command to start the loop with conditional execution
|
653
647
|
return [f"execute if {minecraft_condition} run function {namespace}:{loop_func_name}"]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 15.1.
|
3
|
+
Version: 15.1.90
|
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=yOpzMLbfnlKEce2HqQmpEoDiWCl7A90X3NSpFtT_TDs,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=XDVazfKVMC_3Bb4yGESZ-ApOD4Im4HMuOXXovvuK7v4,42180
|
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.90.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
20
|
+
minecraft_datapack_language-15.1.90.dist-info/METADATA,sha256=ZHZk2YphCsjnc3R1VmKHiMFTmGdV_184hC-YKhEY9yw,35230
|
21
|
+
minecraft_datapack_language-15.1.90.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
+
minecraft_datapack_language-15.1.90.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
23
|
+
minecraft_datapack_language-15.1.90.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
24
|
+
minecraft_datapack_language-15.1.90.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|