minecraft-datapack-language 15.4.16__py3-none-any.whl → 15.4.18__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 +3 -3
- minecraft_datapack_language/cli_help.py +3 -3
- minecraft_datapack_language/cli_utils.py +21 -4
- {minecraft_datapack_language-15.4.16.dist-info → minecraft_datapack_language-15.4.18.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-15.4.16.dist-info → minecraft_datapack_language-15.4.18.dist-info}/RECORD +10 -10
- {minecraft_datapack_language-15.4.16.dist-info → minecraft_datapack_language-15.4.18.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.4.16.dist-info → minecraft_datapack_language-15.4.18.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.4.16.dist-info → minecraft_datapack_language-15.4.18.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.4.16.dist-info → minecraft_datapack_language-15.4.18.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.4.
|
32
|
-
__version_tuple__ = version_tuple = (15, 4,
|
31
|
+
__version__ = version = '15.4.18'
|
32
|
+
__version_tuple__ = version_tuple = (15, 4, 18)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -402,7 +402,7 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
402
402
|
else_body = statement.get('else_body', [])
|
403
403
|
|
404
404
|
# Convert condition to Minecraft syntax
|
405
|
-
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector)
|
405
|
+
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector, variable_scopes)
|
406
406
|
|
407
407
|
# Generate unique function names for conditional blocks
|
408
408
|
if_func_name = f"{function_name}_if_{statement_index}"
|
@@ -705,7 +705,7 @@ def _process_while_loop_recursion(while_statement, namespace: str, function_name
|
|
705
705
|
body_commands.extend(_process_statement(stmt, namespace, loop_func_name, i, is_tag_function, selector, variable_scopes, build_context, output_dir))
|
706
706
|
|
707
707
|
# Add the recursive call to the loop body
|
708
|
-
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector)
|
708
|
+
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector, variable_scopes)
|
709
709
|
body_commands.append(f"execute if {minecraft_condition} run function {namespace}:{loop_func_name}")
|
710
710
|
|
711
711
|
# Write the single loop function
|
@@ -744,7 +744,7 @@ def _process_while_loop_schedule(while_statement, namespace: str, function_name:
|
|
744
744
|
body_commands.extend(_process_statement(stmt, namespace, loop_body_func_name, i, is_tag_function, selector, variable_scopes, build_context))
|
745
745
|
|
746
746
|
# Add the loop continuation command
|
747
|
-
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector)
|
747
|
+
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector, variable_scopes)
|
748
748
|
body_commands.append(f"execute {minecraft_condition} run schedule function {namespace}:{loop_body_func_name} 1t")
|
749
749
|
|
750
750
|
# Write loop body function
|
@@ -295,10 +295,10 @@ def show_check_help():
|
|
295
295
|
print(color.info(" Error 1: MDLSyntaxError in test.mdl:15:8"))
|
296
296
|
print(color.info(" Missing closing brace for if statement"))
|
297
297
|
print(color.info(" Context:"))
|
298
|
-
print(f" {color.line_number('13')}: if
|
298
|
+
print(f" {color.line_number('13')}: if \"$score<@s>$ > 10\" {{")
|
299
299
|
print(f" {color.line_number('14')}: say \"High score!\"")
|
300
|
-
print(f" {color.line_number('15')}: score = 0")
|
301
|
-
print(f" {color.line_number('16')}:
|
300
|
+
print(f" {color.line_number('15')}: score<@s> = 0")
|
301
|
+
print(f" {color.line_number('16')}: ")
|
302
302
|
print()
|
303
303
|
print(color.suggestion(" Suggestion: Add closing brace '}' after line 15"))
|
304
304
|
print()
|
@@ -118,7 +118,7 @@ def _process_variable_substitutions(command: str, selector: str = "@s") -> str:
|
|
118
118
|
return command
|
119
119
|
|
120
120
|
|
121
|
-
def _convert_condition_to_minecraft_syntax(condition: str, selector: str = "@s") -> str:
|
121
|
+
def _convert_condition_to_minecraft_syntax(condition: str, selector: str = "@s", variable_scopes: dict = None) -> str:
|
122
122
|
"""Convert MDL condition syntax to Minecraft scoreboard syntax."""
|
123
123
|
# Remove extra whitespace and normalize
|
124
124
|
condition = condition.strip()
|
@@ -130,13 +130,30 @@ def _convert_condition_to_minecraft_syntax(condition: str, selector: str = "@s")
|
|
130
130
|
# Replace variable references with proper scoreboard syntax
|
131
131
|
def replace_var(match):
|
132
132
|
var_name = match.group(1)
|
133
|
-
|
133
|
+
print(f"DEBUG: Processing variable in condition: '{var_name}'")
|
134
|
+
# Check if variable has explicit scope selector
|
134
135
|
if '<' in var_name and var_name.endswith('>'):
|
135
136
|
var_parts = var_name.split('<', 1)
|
136
137
|
base_var = var_parts[0]
|
137
|
-
|
138
|
+
scope_selector = var_parts[1][:-1] # Remove trailing >
|
139
|
+
print(f"DEBUG: Found explicit scope: base_var='{base_var}', scope_selector='{scope_selector}'")
|
140
|
+
# Resolve special selectors
|
141
|
+
if scope_selector == "global":
|
142
|
+
scope_selector = "@e[type=armor_stand,tag=mdl_server,limit=1]"
|
143
|
+
result = f"{scope_selector} {base_var}"
|
144
|
+
print(f"DEBUG: Returning scoped result: '{result}'")
|
145
|
+
return result
|
138
146
|
else:
|
139
|
-
|
147
|
+
# Use declared scope if available, otherwise default to current selector
|
148
|
+
if variable_scopes and var_name in variable_scopes:
|
149
|
+
declared_scope = variable_scopes[var_name]
|
150
|
+
if declared_scope == 'global':
|
151
|
+
return f"@e[type=armor_stand,tag=mdl_server,limit=1] {var_name}"
|
152
|
+
else:
|
153
|
+
return f"{declared_scope} {var_name}"
|
154
|
+
else:
|
155
|
+
# Default to current selector
|
156
|
+
return f"{selector} {var_name}"
|
140
157
|
|
141
158
|
# Apply variable substitution
|
142
159
|
condition = re.sub(var_pattern, replace_var, condition)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 15.4.
|
3
|
+
Version: 15.4.18
|
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,13 +1,13 @@
|
|
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=yZg5yd95CuWMizzlppf6oktfL09rlENZ_i53pVAUMso,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=u0XIOH_zTARPC6dvWf-411OqrF7RjT7Z9Hkp6hTeZsI,47990
|
6
6
|
minecraft_datapack_language/cli_check.py,sha256=bPq9gHsxQ1CIiftkrAtRCifWkVAyjp5c8Oay2NNQ1qs,6277
|
7
7
|
minecraft_datapack_language/cli_colors.py,sha256=Hr8awY966bGSnVdXL3WnmRhSP1wH56vTQKGt5z-kIQM,7878
|
8
|
-
minecraft_datapack_language/cli_help.py,sha256=
|
8
|
+
minecraft_datapack_language/cli_help.py,sha256=170MePwG9dV9IowG02SwiRT04fbrEo8FBuREZNwDhXY,20051
|
9
9
|
minecraft_datapack_language/cli_new.py,sha256=_pj5EeXESAG00C80_os9jONIXAMcsu2eoR8xVJWDw6g,9347
|
10
|
-
minecraft_datapack_language/cli_utils.py,sha256=
|
10
|
+
minecraft_datapack_language/cli_utils.py,sha256=Zv6pIDfgiaa-Ke9fZOJCVHZw0Q-dfTZM9E8ml9RACOg,10905
|
11
11
|
minecraft_datapack_language/dir_map.py,sha256=HmxFkuvWGkzHF8o_GFb4BpuMCRc6QMw8UbmcAI8JVdY,1788
|
12
12
|
minecraft_datapack_language/expression_processor.py,sha256=GN6cuRNvgI8TrV6YnEHrA9P0X-ACTT7rCBh4WlOPjSI,20140
|
13
13
|
minecraft_datapack_language/linter.py,sha256=7UqbygC5JPCGg-BSOq65NB2xEJBu_OUOYIIgmHItO2M,16567
|
@@ -17,9 +17,9 @@ minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYa
|
|
17
17
|
minecraft_datapack_language/mdl_parser_js.py,sha256=SQzc67pKls3NVnQaT0xIILGqpZYAmcZn78TQ0KIM4TE,40216
|
18
18
|
minecraft_datapack_language/pack.py,sha256=nYiXQ3jgJlDfc4m-65f7C2LFhDRioaUU_XVy6Na4SJI,34625
|
19
19
|
minecraft_datapack_language/utils.py,sha256=Aq0HAGlXqj9BUTEjaEilpvzEW0EtZYYMMwOqG9db6dE,684
|
20
|
-
minecraft_datapack_language-15.4.
|
21
|
-
minecraft_datapack_language-15.4.
|
22
|
-
minecraft_datapack_language-15.4.
|
23
|
-
minecraft_datapack_language-15.4.
|
24
|
-
minecraft_datapack_language-15.4.
|
25
|
-
minecraft_datapack_language-15.4.
|
20
|
+
minecraft_datapack_language-15.4.18.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
21
|
+
minecraft_datapack_language-15.4.18.dist-info/METADATA,sha256=EErDMh7j3Vvy-zPjKI_QvNxl1UHRV1fzTaNahScv-mc,35230
|
22
|
+
minecraft_datapack_language-15.4.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
minecraft_datapack_language-15.4.18.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
24
|
+
minecraft_datapack_language-15.4.18.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
25
|
+
minecraft_datapack_language-15.4.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|