minecraft-datapack-language 15.1.76__py3-none-any.whl → 15.1.77__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 +40 -26
- {minecraft_datapack_language-15.1.76.dist-info → minecraft_datapack_language-15.1.77.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-15.1.76.dist-info → minecraft_datapack_language-15.1.77.dist-info}/RECORD +8 -8
- {minecraft_datapack_language-15.1.76.dist-info → minecraft_datapack_language-15.1.77.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.1.76.dist-info → minecraft_datapack_language-15.1.77.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.1.76.dist-info → minecraft_datapack_language-15.1.77.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.1.76.dist-info → minecraft_datapack_language-15.1.77.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.77'
|
32
|
+
__version_tuple__ = version_tuple = (15, 1, 77)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -234,29 +234,37 @@ def _process_say_command_with_variables(content: str, selector: str) -> str:
|
|
234
234
|
word_matches = re.findall(word_pattern, content)
|
235
235
|
|
236
236
|
if word_matches:
|
237
|
-
#
|
237
|
+
# Process the content by replacing each variable with a score component
|
238
238
|
components = []
|
239
|
-
|
239
|
+
processed_content = content
|
240
240
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
text_before = remaining_content[:var_pos]
|
248
|
-
if text_before:
|
249
|
-
components.append(f'{{"text":"{text_before}"}}')
|
250
|
-
|
251
|
-
# Add score component for variable
|
252
|
-
components.append(f'{{"score":{{"name":"@e[type=armor_stand,tag=mdl_server,limit=1]","objective":"{var_name}"}}}}')
|
253
|
-
|
254
|
-
# Continue with remaining content after this variable
|
255
|
-
remaining_content = remaining_content[var_pos + len(var_name):]
|
241
|
+
# Sort variables by their position in the content to process them in order
|
242
|
+
var_positions = []
|
243
|
+
for var_name in set(word_matches): # Remove duplicates
|
244
|
+
pos = processed_content.find(var_name)
|
245
|
+
if pos >= 0:
|
246
|
+
var_positions.append((pos, var_name))
|
256
247
|
|
257
|
-
#
|
258
|
-
|
259
|
-
|
248
|
+
var_positions.sort() # Sort by position
|
249
|
+
|
250
|
+
last_pos = 0
|
251
|
+
for pos, var_name in var_positions:
|
252
|
+
# Add text before this variable
|
253
|
+
if pos > last_pos:
|
254
|
+
text_before = processed_content[last_pos:pos]
|
255
|
+
if text_before:
|
256
|
+
components.append(f'{{"text":"{text_before}"}}')
|
257
|
+
|
258
|
+
# Add score component for variable
|
259
|
+
components.append(f'{{"score":{{"name":"@e[type=armor_stand,tag=mdl_server,limit=1]","objective":"{var_name}"}}}}')
|
260
|
+
|
261
|
+
last_pos = pos + len(var_name)
|
262
|
+
|
263
|
+
# Add remaining text after last variable
|
264
|
+
if last_pos < len(processed_content):
|
265
|
+
remaining_text = processed_content[last_pos:]
|
266
|
+
if remaining_text:
|
267
|
+
components.append(f'{{"text":"{remaining_text}"}}')
|
260
268
|
|
261
269
|
# Combine all components
|
262
270
|
components_str = ','.join(components)
|
@@ -490,9 +498,15 @@ def _generate_function_file(ast: Dict[str, Any], output_dir: Path, namespace: st
|
|
490
498
|
|
491
499
|
# Write function file
|
492
500
|
if function_commands:
|
493
|
-
#
|
501
|
+
# Only add armor stand setup to main functions that need it
|
502
|
+
# Don't add to helper functions or functions in the "other" namespace
|
503
|
+
should_add_armor_stand = (namespace != "other" and
|
504
|
+
func_name in ["main", "init", "load"] or
|
505
|
+
any(cmd for cmd in function_commands if "scoreboard" in cmd or "tellraw" in cmd))
|
506
|
+
|
494
507
|
final_commands = []
|
495
|
-
|
508
|
+
if should_add_armor_stand:
|
509
|
+
final_commands.append("execute unless entity @e[type=armor_stand,tag=mdl_server,limit=1] run summon armor_stand ~ 320 ~ {Tags:[\"mdl_server\"],Invisible:1b,Marker:1b,NoGravity:1b,Invulnerable:1b}")
|
496
510
|
final_commands.extend(function_commands)
|
497
511
|
|
498
512
|
if verbose:
|
@@ -648,16 +662,16 @@ def _process_while_loop_recursion(while_statement, namespace: str, function_name
|
|
648
662
|
# Create the main loop function
|
649
663
|
minecraft_condition = _convert_condition_to_minecraft_syntax(condition, selector)
|
650
664
|
loop_commands = [
|
651
|
-
f"execute {minecraft_condition} run function {namespace}:{loop_body_func_name}",
|
652
|
-
f"execute {minecraft_condition} run function {namespace}:{loop_func_name}"
|
665
|
+
f"execute if {minecraft_condition} run function {namespace}:{loop_body_func_name}",
|
666
|
+
f"execute if {minecraft_condition} run function {namespace}:{loop_func_name}"
|
653
667
|
]
|
654
668
|
|
655
669
|
# Write loop function
|
656
670
|
with open(func_dir / f"{loop_func_name}.mcfunction", 'w', encoding='utf-8') as f:
|
657
671
|
f.write('\n'.join(loop_commands))
|
658
672
|
|
659
|
-
# Return the command to start the loop
|
660
|
-
return [f"function {namespace}:{loop_func_name}"]
|
673
|
+
# Return the command to start the loop with conditional execution
|
674
|
+
return [f"execute if {minecraft_condition} run function {namespace}:{loop_func_name}"]
|
661
675
|
|
662
676
|
|
663
677
|
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]:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 15.1.
|
3
|
+
Version: 15.1.77
|
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=MX48oNCAEJyrqB8cvh5XZc3fKpHeRjMav0PQLztoKfo,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=s90ZjY4jItiYYKtcpM7KrrHiJA7xurvqgCmrOcqsvl4,43188
|
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.77.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
20
|
+
minecraft_datapack_language-15.1.77.dist-info/METADATA,sha256=uK2ZkCkYfQGenqR7J362qUSKpmnVS78e5JIgOZL1XPI,35230
|
21
|
+
minecraft_datapack_language-15.1.77.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
+
minecraft_datapack_language-15.1.77.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
23
|
+
minecraft_datapack_language-15.1.77.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
24
|
+
minecraft_datapack_language-15.1.77.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|